solana-token-extension-boost
Version:
SDK for Solana Token Extensions with wallet adapter support
24 lines (23 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOrCreateTokenAccount = getOrCreateTokenAccount;
const spl_token_1 = require("@solana/spl-token");
const spl_token_2 = require("@solana/spl-token");
/**
* Get or create associated token account for owner and mint
*
* @param connection Connection to use
* @param payer Transaction and initialization fee payer
* @param mint Mint associated with the account to establish or verify
* @param owner Owner of the account to establish or verify
* @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)
* @param commitment Desired commitment level for the query state
* @param confirmOptions Transaction confirmation options
* @param programId SPL Token program account
* @param associatedTokenProgramId SPL Associated Token program account
*
* @return Address of the new associated token account
*/
async function getOrCreateTokenAccount(connection, payer, mint, owner, allowOwnerOffCurve = false, commitment, confirmOptions, programId = spl_token_2.TOKEN_PROGRAM_ID, associatedTokenProgramId = spl_token_2.ASSOCIATED_TOKEN_PROGRAM_ID) {
return (0, spl_token_1.getOrCreateAssociatedTokenAccount)(connection, payer, mint, owner, allowOwnerOffCurve, commitment, confirmOptions, programId, associatedTokenProgramId);
}