Closed hboon closed 1 year ago
Integration Unstoppable Domain requires to implement the next api call:
resolve domain by address: https://docs.unstoppabledomains.com/openapi/resolution/#operation/DomainsController.getDomainsList
resolve address by domain name: https://docs.unstoppabledomains.com/openapi/resolution/#operation/DomainsController.getDomain for succesfull request we get response json:
{
"meta": {
"domain": "string",
"owner": "string",
"resolver": "string",
"blockchain": "string",
"networkId": 1,
"registry": "string",
"reverse": true
},
"records": { }
}
address value can be founded as id
field of first element of records
from json.
Api calls require Authorization
header, its static, ping me, or Boon for sharing.
@oa-s do you have sample/test data to test against?
@hboon do you mean example of json and curl of request?
here is wallet address for testing: 0xac1dE5BbdC2C8D0B3E4324c87599Dc66D3221c13
and curl request example:
` curl request for
resolveDomain(address`
curl -XGET -H 'Authorization: Bearer <API_KEY>' 'https://resolve.unstoppabledomains.com/domains/?owners=0xac1dE5BbdC2C8D0B3E4324c87599Dc66D3221c13&perPage=50&sortBy=id&sortDirection=DESC'
with its reponse:
"{\"data\":[{\"id\":\"vladylav.wallet\",\"attributes\":{\"records\":{\"crypto.ETH.address\":\"0xac1de5bbdc2c8d0b3e4324c87599dc66d3221c13\",\"crypto.MATIC.version.ERC20.address\":\"0xac1de5bbdc2c8d0b3e4324c87599dc66d3221c13\",\"crypto.MATIC.version.MATIC.address\":\"0xac1de5bbdc2c8d0b3e4324c87599dc66d3221c13\"},\"meta\":{\"domain\":\"vladylav.wallet\",\"blockchain\":\"MATIC\",\"networkId\":137,\"owner\":\"0xac1de5bbdc2c8d0b3e4324c87599dc66d3221c13\",\"resolver\":\"0xa9a6a3626993d487d2dbda3173cf58ca1a9d9e9f\",\"registry\":\"0xa9a6a3626993d487d2dbda3173cf58ca1a9d9e9f\",\"reverse\":false}}}],\"meta\":{\"perPage\":50,\"nextStartingAfter\":\"994754\",\"sortBy\":\"id\",\"sortDirection\":\"DESC\",\"hasMore\":false}}"
Yeah. Or how to test in app. But curl is good too
Thanks
Future
web3.DeployedContract contract = web3.DeployedContract(
web3.ContractAbi.fromJson(unstoppableDomainAbi, ''),
proxyReader,
);
final rpcUrl = getEVMBlockchains()[udResolvers[contractAddr]]['rpc'];
final client = web3.Web3Client(rpcUrl, Client());
String udCryptoAddress = (await client.call(
contract: contract,
function: contract.function('get'),
params: [
"crypto.${currency ?? 'ETH'}.address",
BigInt.parse(nameHash(cryptoDomainName))
],
))
.first;
if (udCryptoAddress.isNotEmpty) {
return {'success': true, 'msg': udCryptoAddress};
}
}
return {'success': false, 'msg': 'Error resolving unstoppable domain ens'};
} catch (e) { return {'success': false, 'msg': 'Error resolving unstoppable domain ens'}; } }
@oa-s would you help write up details including how to test it, test data? For some reason, we never integrated it.