Skip to main content
This method returns a SolanaInstruction. Add it to a transaction and use the Transaction Service to execute it on-chain. See Instructions & Transactions.

Assign

Changes the owner program of an account. Only the account’s current owner program or System Program can assign a new owner. The account must be a signer.

Request

account
Base58-encoded public key (string)
required
The account to reassign. Must be a signer.
owner_program
Base58-encoded public key (string)
required
The new owner program address.

Response

instruction
SolanaInstruction (object)
The assign instruction. Add this to a transaction and submit it via the Transaction Service.

Code Examples

resp, err := client.Assign(ctx, &system_v1.AssignRequest{
    Account:      "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV",
    OwnerProgram: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
})
if err != nil {
    log.Fatal(err)
}
// Add instruction to your transaction
instruction := resp.Instruction

AssignWithSeed

Reassigns the owner of a seed-derived account. The base key must sign the transaction — not the derived account address.

Request

account
Base58-encoded public key (string)
required
The seed-derived account address to reassign.
base
Base58-encoded public key (string)
required
Base public key used to derive account. Must be a signer.
seed
string
required
Seed string used to derive account.
owner_program
Base58-encoded public key (string)
required
The new owner program address.

Response

instruction
SolanaInstruction (object)
The assign_with_seed instruction. Add this to a transaction and submit it via the Transaction Service.

Code Examples

resp, err := client.AssignWithSeed(ctx, &system_v1.AssignWithSeedRequest{
    Account:      "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin",
    Base:         "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV",
    Seed:         "my-program-data",
    OwnerProgram: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
})
if err != nil {
    log.Fatal(err)
}
// Add instruction to your transaction
instruction := resp.Instruction