ORE ID
Search
K
Comment on page

ASA Opt-in

An example Asset

First, identify the index number of the asset to opt-in to.
USDC
Explorer
Asset Index
Testnet
10458941
Mainnet
31566704

Add a whitelist entry to your ORE ID application

Using the developer dashboard, navigate to the whitelist entry page under Settings.
Add an item to the Whitelisted Actions by clicking the ➕. An example entry is below.

Create the transaction body

The following transaction creates a zero amount asset transfer ("axfer"). Both, the sender and the recipient are the account that will be the signer of this transaction.
const transactionBody = {
from: signingAccount.chainAccount,
to: signingAccount.chainAccount,
assetIndex: 10458941, // USDC Testnet Asset Index
amount: 0,
type: "axfer"
};
Oreid-js will take care of the final transaction formatting. Pass in the transactionBody from above. Along with the other values needed to prepare a transaction object.
const transaction = await oreId.createTransaction({
chainAccount: signingAccount.chainAccount,
chainNetwork: signingAccount.chainNetwork,
transaction: transactionBody,
signOptions: {
broadcast: true,
returnSignedTransaction: false,
},
});

Check out a working example

View the Code

Run the sample app

git clone https://github.com/TeamAikon/oreid.git
cd examples/_algorand/react/asaOptIn
yarn install
yarn start