Integrating
Integrating with (de)NS - Testnet is simple.
Web2 API:
Note that all addresses can be sent as any valid cosmos bech32.
It will be converted to a Juno address and then any data returned based on that.
For example, the following is the Uni Faucet, looked up using its STARS address.
curl -vk https://dens.vercel.app/api/addresses/stars15gu3cm8dpxzf8mzl4meeu0zqa2gt23tz8j7f4h/primary
To see a single name:
/api/ids/[token-name]
To see all the names registered to a wallet:
/api/addresses/[address]
To see the primary alias for a wallet:
/api/addresses/[address]/primary
UI:
To see a single name (without logging in):
/ids/[token-name]
To see all the names registered to a wallet (without logging in):
/addresses/[address]
To see the primary alias (without logging in):
/addresses/[address]/primary
For Developers:
Mapping Address → Name
A wallet address has a 1-to-many relationship to names.
Most times, however, we only want one name.
This is where the primary alias comes in.
To get the primary alias for a wallet address, call it like so:
PrimaryAlias { address: String }
If a user/wallet address has set a primary alias, this will be returned.
Otherwise, the first (latest) result will be returned from chain.
If no names exist, NotFound will be returned.
Mapping Name → Address
This mapping is simpler, since (de)NS - Testnet names are extended CW721 NFTs.
AddressOf is a simplification of OwnerOf that returns contract address and validator address, if set.
AddressOf {
token_id: String,
contract_address: Option<String>,
validator_address: Option<String>,
},
OwnerOf
is nice as it is part of the CW721 standard, but it is not that ergonomic.
This is why for most cases, you should prefer AddressOf when querying (de)NS - Testnet.
The address of this contract is: