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

signer.executeNativeTransaction({
    secretType: 'HEDERA',
    type: 'HEDERA_TOKEN_ASSOCIATION',
    walletId: 'd1e091d7-0fab-4f46-8afd-ad31f1e735d7',
    tokenIds: ['0.0.2278508', '0.0.2278508', '0.0.2278508', '0.0.2278508']
})

Signature

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

Returns

Promise<SignerResult>

Parameters

ParameterRequiredDescription

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

signer.executeNativeTransaction({
    secretType: 'HEDERA',
    type: 'HEDERA_TOKEN_ASSOCIATION',
    walletId: 'd1e091d7-0fab-4f46-8afd-ad31f1e735d7',
    tokenIds: ['0.0.2278508', '0.0.2278508', '0.0.2278508', '0.0.2278508']
}).then((signerResult) => {
    if (signerResult.success) {
        console.log(`The tokens have been successfuly associated`);
    } else {
        console.warn(`Something went wrong while associating the tokens`);
    }
}).catch((reason) => {
    console.log(error);
});

Object Types

pageSignerpageHederaTokenAssociationRequestpageRedirectOptionspageSignerResult

Last updated