Static claimClaim a routed ASA from the receiver's ARC-59 inbox.
If the receiver lacks the opt-in to the ASA, this method composes the opt-in transaction automatically. If the inbox holds excess ALGO above min-balance, a claim of ALGO is also composed so the fee covers the additional calls.
Claim parameters.
ASA identifier to claim.
Target network.
Receiver address and signer authorizing the claim.
The transaction ID of the submitted claim group.
const txId = await Arc59.claimAsset({
network: 'testnet',
receiver: { address: receiverAddr, signer },
assetId: 12345,
});
Static getResolve the ARC-59 router application ID and address for a given network.
Target network, e.g. 'mainnet' or 'testnet'.
Object containing appId and appAddress.
const { appId, appAddress } = Arc59.getAppInfo('testnet');
console.log(appId, appAddress);
Static getSimulate the send flow and fetch information required to send an asset via ARC-59.
Target network.
ASA identifier to send.
Receiver's Algorand address.
Simulation result including:
itxns: total inner transactions expectedmbr: minimum balance requirement to cover during the sendrouterOptedIn: whether the router is opted into the assetreceiverOptedIn: whether the receiver is opted into the assetreceiverAlgoNeededForClaim: ALGO needed by receiver to claim (in microalgos)Error if simulation fails or no return value is produced.
const info = await Arc59.getAssetSendInfo('testnet', 12345, receiverAddr);
if (!info.receiverOptedIn) {
// compose routed send using Arc59.sendAsset
}
Static getList ASA holdings currently held in a receiver's ARC-59 inbox.
Array of assets in the inbox with assetId, amount, and isFrozen.
const assets = await Arc59.getAssetsInInbox({ network: 'testnet', receiver: addr });
Static getGet the ARC-59 inbox address for a receiver.
Target network.
Receiver's Algorand address.
The inbox account address, or the zero address if not created.
Error if simulation does not return an inbox address.
const inbox = await Arc59.getInboxAddress('testnet', receiverAddr);
Static Private isCheck if an address is opted-in to a given ASA.
Target network.
ASA identifier.
Account address to check.
true if the account is opted-in, otherwise false.
const opted = await Arc59.isOptedIn('testnet', 12345, addr);
Static rejectReject a routed ASA from the receiver's ARC-59 inbox.
Reject parameters.
ASA identifier to reject.
Target network.
Receiver address and signer authorizing the rejection.
The transaction ID of the submitted reject group.
const txId = await Arc59.rejectAsset({
network: 'testnet',
receiver: { address: receiverAddr, signer },
assetId: 12345,
});
Static sendSend an ASA to a receiver using ARC-59.
If the receiver is already opted-in, a direct transfer is submitted. Otherwise, a composed transaction group routes the asset through the ARC-59 router so the receiver can later claim it from their inbox.
Send parameters.
Amount to send (base units).
ASA identifier to send.
Target network.
Receiver account address.
Sender address and signer for authorizing transactions.
The transaction ID of the submitted group (last tx for routed send, or lone transfer tx for direct send).
const txId = await Arc59.sendAsset({
network: 'testnet',
assetId: 12345,
amount: 10,
receiver: receiverAddr,
sender: { address: senderAddr, signer }
});
Utilities for interacting with the ARC-59 Router smart contract on Algorand.
Remarks
ARC-59 defines an inbox-based routing scheme for ASAs. This class composes transactions to send assets to a router, and for receivers to claim or reject assets from their ARC-59 inbox. Read-only methods leverage simulation to query contract state without sending transactions.