Skip to main content
Both methods create an Associated Token Account (ATA) — the standard account type that holds tokens for a wallet. Choose the method matching your mint’s token program.
These methods return instruction lists. Add them to a transaction and use the Transaction Service to compile, sign, and submit. See Instructions & Transactions.

CreateToken2022HoldingAccount

Creates a Token-2022 Associated Token Account with optional extensions. Returns the ATA creation instruction plus reallocate and extension-init instructions for each requested extension.

Request

payer_pub_key
Base58-encoded public key (string)
required
Pays for ATA creation. Must be a signer.
owner_pub_key
Base58-encoded public key (string)
required
The wallet that will own this token account.
mint_pub_key
Base58-encoded public key (string)
required
The Token-2022 mint this account will hold tokens for.
extensions
Token2022HoldingAccountExtension[] (repeated)
Optional. Extensions to enable on the ATA. Currently supported: MemoTransfer (requires a memo on all incoming transfers).

Response

instructions
SolanaInstruction[] (repeated)
required
Ordered instructions. Includes ATA creation plus reallocate and init for each extension.
lamports
uint64
Rent-exempt minimum for the final account size including all extensions.

Code Examples

resp, err := client.CreateToken2022HoldingAccount(ctx, &token_v1.CreateToken2022HoldingAccountRequest{
    PayerPubKey: "YourPayerAddress...",
    OwnerPubKey: "WalletOwnerAddress...",
    MintPubKey:  "YourToken2022MintAddress...",
    // Extensions: []*token_v1.Token2022HoldingAccountExtension{...}, // optional
})
if err != nil {
    log.Fatal(err)
}
// Add all instructions to your transaction in order
for _, instr := range resp.Instructions {
    tx.AddInstruction(instr)
}

CreateSPLTokenHoldingAccount

Creates a legacy SPL Token Associated Token Account. Returns a single ATA creation instruction.

Request

payer_pub_key
Base58-encoded public key (string)
required
Pays for ATA creation. Must be a signer.
owner_pub_key
Base58-encoded public key (string)
required
The wallet that will own this token account.
mint_pub_key
Base58-encoded public key (string)
required
The SPL Token mint this account will hold tokens for.

Response

instructions
SolanaInstruction[] (repeated)
required
A single ATA creation instruction.
lamports
uint64
Rent-exempt minimum for the ATA.

Code Examples

resp, err := client.CreateSPLTokenHoldingAccount(ctx, &token_v1.CreateSPLTokenHoldingAccountRequest{
    PayerPubKey: "YourPayerAddress...",
    OwnerPubKey: "WalletOwnerAddress...",
    MintPubKey:  "YourSPLTokenMintAddress...",
})
if err != nil {
    log.Fatal(err)
}
// Add instruction to your transaction
tx.AddInstruction(resp.Instructions[0])