Polygon Developer Integration
This page outlines the steps developers will take to integrate with Polygon and support Unstoppable domains on Polygon L2 network.
There will be minimal changes to Unstoppable Domains’ resolution libraries and resolution service with the rollout of our Layer 2 solution on Polygon. Over 90% of the library and resolution service will be similar to what we provide for Ethereum. However, for UD developers, all of the integrated "apps" will need to update their resolution libraries or API endpoints in order to be able to read and resolve NFT domains on Polygon.

Polygon Updates

Polygon apps will resolve domains by reading UNS Smart Contracts housed on Polygon. Developers can also go directly to the Smart Contracts Repo to help with integration.
To further assist with L2, the Polygon team will be adding Unstoppable Domains resolution to their API and Matic.js library. This will make it easier, for example, for Polygon apps to use domains for payments in wallets and login with dapps.

Resolution Library Updates

Our Layer 2 resolution libraries will require a few configuration changes to allow the libraries to read from Polygon. There are a few small changes to function/method calls and one brand new method which provides additional resolution information.

Method Changes and Updates

  • gettokensownedby has been deprecated and is no longer supported in L2.
  • getallrecords has changed structurally but does not require a change to the function or method call; the external interface remains the same, but the method will not be as decentralized because it uses our resolution service instead of querying the blockchain.

New Supported Method

Resolution#getLocations([domain1, domain2, domain3]) is a new method array that returns information for an unlimited number of domains; it only supports UNS and CNS due to Zilliqa technical limits.
This method returns a list of domain locations:
  • Blockchain Provider URL (if possible otherwise null)
  • RegistryAddress
  • ResolverAddress
  • Blockchain (Coin symbol)
  • Owner address

List of Network IDs

This table displays the network IDs used by Unstoppable Domains in the UNS config file.
Network ID
Description
1
mainnet
4
Rinkeby testnet
137
Polygon mainnet
80001
Polygon testnet

Resolution Service Updates

Unstoppable Domains’ Polygon resolution service will have the same specifications as our existing resolution service, but there will be a few metadata changes to the service.

/status route

Overall changes for /status route
  • Return Network ID instead of network
  • Move all fields under “blockchain” namespace
NEW Response
OLD response
1
{
2
"blockchain":{
3
"ETH":{
4
"latestNetworkBlock":13100548,
5
"latestMirroredBlock":12674000,
6
"networkId":1
7
},
8
"ZIL":{
9
"latestNetworkBlock":1385207,
10
"latestMirroredBlock":1385207,
11
"networkId":1
12
}
13
}
14
}
Copied!
1
{
2
"ETH":{
3
"latestNetworkBlock":13230550,
4
"latestMirroredBlock":13230530,
5
"network":"mainnet"
6
},
7
"ZIL":{
8
"latestNetworkBlock":1433099,
9
"latestMirroredBlock":1433091,
10
"network":"mainnet"
11
}
12
}
Copied!

/domains and /domains/<domain name> routes

Overall changes for /domain and /domains<domain name> routes
  • Return Network ID instead of location field
  • Add blockchain field to store data about Layer 1 and Layer 2
NEW response
OLD Response
1
{
2
"records": {
3
"crypto.BTC.address": "bc1q359khn0phg58xgezyqsuuaha28zkwx047c0c3y",
4
"crypto.ETH.address": "0x8aaD44321A86b170879d7A244c1e8d360c99DdA8"
5
},
6
"meta": {
7
"networkId": 1,
8
"blockchain": "ETH",
9
"domain": "brad.crypto",
10
"owner": "0x8aad44321a86b170879d7a244c1e8d360c99dda8",
11
"resolver": "0xb66dce2da6afaaa98f2013446dbcb0f4b0ab2842",
12
"registry": "0xd1e5b0ff1287aa9f9a268759062e4ab08b9dacbe"
13
}
14
}
Copied!
1
{
2
"records": {
3
"crypto.BTC.address": "bc1q359khn0phg58xgezyqsuuaha28zkwx047c0c3y",
4
"crypto.ETH.address": "0x8aaD44321A86b170879d7A244c1e8d360c99DdA8"
5
},
6
"meta": {
7
"location": "CNS",
8
"domain": "brad.crypto",
9
"owner": "0x8aad44321a86b170879d7a244c1e8d360c99dda8",
10
"resolver": "0xb66dce2da6afaaa98f2013446dbcb0f4b0ab2842",
11
"registry": "0xd1e5b0ff1287aa9f9a268759062e4ab08b9dacbe"
12
}
13
}
Copied!
Last modified 17d ago