Identities¶
In order to receive tokens, Identities must be added in the Identity Registry of the Token, which is a Smart Contract. The methods described in this section are used to retrieve and manage identities within the scope of a Token.
Read methods¶
Check if a Wallet is registered¶
This simple method verifies if the Wallet is present in the Identity Registry and if it is associated with an Identity. Note that the "wallet" is an address that owns the tokens. It can be a Smart Contract.
await token.isWalletRegistered('WALLET ADDRESS');
Get Identity associated with Wallet¶
If a Wallet is in the Identity Registry, it is associated with an Identity that you can retrieve as an Identity object from the OnchainID SDK. If the Wallet is not registered, this function will return null.
const identityAddress = await token.getIdentityAddress('WALLET ADDRESS');
console.log(identityAddress);
Check Identity of Wallet Compliance¶
Verifies that a wallet is associated with a compliant Identity by calling the .isVerified
method
of the Identity Registry, as defined in the T-REX standard.
await token.isIdentityOfWalletCompliant('WALLET ADDRESS');
Write methods¶
Register Identity by Wallet¶
To register an Identity that is not already registered, pass as argument the Wallet, the identity address and the country (iso integer) of the holder.
This method is forwarded to the Identity Registry instance of the Token.
The specified Wallet MUST NOT be registered with an identity yet on this Registry. The call will throw a WalletAlreadyRegisteredError
otherwise.
const tx = await token.registerIdentityOfWallet({
country: COUNTRY CODE, // ISO-3166-NUMERIC CODE
identityAddress: 'IDENTITY/ONCHAINID ADDRESS',
wallet: 'WALLET ADDRESS',
});
Update Identity registered with Wallet¶
To change the Identity registered with a Wallet, use the updateIdentity
method:
const tx = await token.updateIdentityOfWallet({
newIdentityAddress: 'NEW IDENTITY/ONCHAINID ADDRESS',
wallet: 'WALLET ADDRESS',
})
Update country of Wallet¶
const tx = await token.updateCountryOfWallet({
newCountry: NEW COUNTRY CODE,
wallet: 'WALLET ADDRESS',
});
Unregister Identity¶
Warning
This operation will remove the Identity from the Registry, and breaks the link between the Wallet and the Identity. You should not call this method for wallets that still hold tokens.
const tx = await token.unregisterIdentityOfWallet({
wallet: 'WALLET ADDRESS',
});