executeTokenAssociation
Associate a token to a Hedera account
This is not a dedicated function, but more a specific transaction type
This transaction type is only available for Hedera accounts
1
signer.executeNativeTransaction({
2
secretType: 'HEDERA',
3
type: 'HEDERA_TOKEN_ASSOCIATION',
4
walletId: 'd1e091d7-0fab-4f46-8afd-ad31f1e735d7',
5
tokenIds: ['0.0.2278508', '0.0.2278508', '0.0.2278508', '0.0.2278508']
6
})
Copied!

Signature

1
signer.executeNativeTransaction(hederaTokenAssociationRequest, options?): Promise<SignerResult>
Copied!

Returns

1
Promise<SignerResult>
Copied!

Parameters

Parameter
Required
Description
hederaTokenAssociationRequest
True
The hederaTokenAssociationRequest you want to execute. For more info on how this request should look like, see HederaTokenAssociationRequest.
options
False
Redirect options you want to pass. Only available when using a REDIRECT signer​

Example

1
signer.executeNativeTransaction({
2
secretType: 'HEDERA',
3
type: 'HEDERA_TOKEN_ASSOCIATION',
4
walletId: 'd1e091d7-0fab-4f46-8afd-ad31f1e735d7',
5
tokenIds: ['0.0.2278508', '0.0.2278508', '0.0.2278508', '0.0.2278508']
6
}).then((signerResult) => {
7
if (signerResult.success) {
8
console.log(`The tokens have been successfuly associated`);
9
} else {
10
console.warn(`Something went wrong while associating the tokens`);
11
}
12
}).catch((reason) => {
13
console.log(error);
14
});
Copied!

Object Types

Last modified 1mo ago