Associate a Token
The following sample will show you how to prompt a user for a token association. We will first generate a request for the end user. Once validated, you will get notified about token association status.
Prerequisites:
Getting startedStep 1: Import modules
Let's continue building on the index.js from the previous example (Environment Set-up) and add the following modules:
const { Client } = require("@xact-wallet-sdk/client");
require("dotenv").config();Step 2: Initializing Token Association
When initializing a token association, a request will be sent to the end user
/* Update the fields with your informations */
const fromAccountId = '';
const tokenToAssociate = '';
await client.associate({fromAccountId, tokenId: tokenToAssociate});Step 3: Listen for the Token Association
Finally get notified when a new token association has been done successfully !
Code Check ✅
Your index.js file should look like this:
Last updated