Documentation ¶
Index ¶
- Constants
- Variables
- func CloseAccount(account, dest, owner ed25519.PublicKey) solana.Instruction
- func CreateAssociatedTokenAccount(subsidizer, wallet, mint ed25519.PublicKey) (solana.Instruction, ed25519.PublicKey, error)
- func GetAssociatedAccount(wallet, mint ed25519.PublicKey) (ed25519.PublicKey, error)
- func InitializeAccount(account, mint, owner ed25519.PublicKey) solana.Instruction
- func InitializeMultisig(account ed25519.PublicKey, requiredSigners byte, signers ...ed25519.PublicKey) solana.Instruction
- func SetAuthority(account, currentAuthority, newAuthority ed25519.PublicKey, ...) solana.Instruction
- func SetAuthorityMultisig(account, multisigOwner, newAuthority ed25519.PublicKey, ...) solana.Instruction
- func Transfer(source, dest, owner ed25519.PublicKey, amount uint64) solana.Instruction
- func Transfer2(source, mint, dest, owner ed25519.PublicKey, amount uint64, decimals byte) solana.Instruction
- func TransferMultisig(source, dest, multisigOwner ed25519.PublicKey, amount uint64, ...) solana.Instruction
- type Account
- type AccountState
- type AuthorityType
- type Client
- type Command
- type DecompiledCloseAccount
- type DecompiledCreateAssociatedAccount
- type DecompiledInitializeAccount
- type DecompiledSetAuthority
- type DecompiledTransfer
- type DecompiledTransfer2
Constants ¶
const ( // nolint:varcheck,deadcode,unused ErrorNotRentExempt solana.CustomError = iota // nolint:varcheck,deadcode,unused ErrorInsufficientFunds // nolint:varcheck,deadcode,unused ErrorInvalidMint // nolint:varcheck,deadcode,unused ErrorMintMismatch // nolint:varcheck,deadcode,unused ErrorOwnerMismatch // nolint:varcheck,deadcode,unused ErrorFixedSupply // nolint:varcheck,deadcode,unused ErrorAlreadyInUse // nolint:varcheck,deadcode,unused ErrorInvalidNumberOfProvidedSigners // nolint:varcheck,deadcode,unused ErrorInvalidNumberOfRequiredSigners // nolint:varcheck,deadcode,unused ErrorUninitializedState // nolint:varcheck,deadcode,unused ErrorNativeNotSupported // nolint:varcheck,deadcode,unused ErrorNonNativeHasBalance // nolint:varcheck,deadcode,unused ErrorInvalidInstruction // nolint:varcheck,deadcode,unused ErrorInvalidState // nolint:varcheck,deadcode,unused ErrorOverflow // nolint:varcheck,deadcode,unused ErrorAuthorityTypeNotSupported // nolint:varcheck,deadcode,unused ErrorMintCannotFreeze // nolint:varcheck,deadcode,unused ErrorAccountFrozen // nolint:varcheck,deadcode,unused ErrorMintDecimalsMismatch )
const AccountSize = 165
const MultisigAccountSize = 355
Variables ¶
var ( // ErrAccountNotFound indicates there is no account for the given address. ErrAccountNotFound = errors.New("account not found") // ErrInvalidTokenAccount indicates that a Solana account exists at the // given address, but it is either not initialized, or not configured correctly. ErrInvalidTokenAccount = errors.New("invalid token account") )
var AssociatedTokenAccountProgramKey = ed25519.PublicKey{140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89}
AssociatedTokenAccountProgramKey is the address of the associated token account program that should be used.
Current key: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
var ProgramKey = ed25519.PublicKey{6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169}
ProgramKey is the address of the token program that should be used.
Current key: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
todo: lock this in, or make configurable.
Functions ¶
func CloseAccount ¶
func CloseAccount(account, dest, owner ed25519.PublicKey) solana.Instruction
func CreateAssociatedTokenAccount ¶
func GetAssociatedAccount ¶
GetAssociatedAccount returns the associated account address for an SPL token.
Reference: https://spl.solana.com/associated-token-account#finding-the-associated-token-account-address
func InitializeAccount ¶
func InitializeAccount(account, mint, owner ed25519.PublicKey) solana.Instruction
func InitializeMultisig ¶
func SetAuthority ¶
func SetAuthority(account, currentAuthority, newAuthority ed25519.PublicKey, authorityType AuthorityType) solana.Instruction
func SetAuthorityMultisig ¶
func SetAuthorityMultisig(account, multisigOwner, newAuthority ed25519.PublicKey, authorityType AuthorityType, signers []ed25519.PublicKey) solana.Instruction
func Transfer ¶
func Transfer(source, dest, owner ed25519.PublicKey, amount uint64) solana.Instruction
func Transfer2 ¶
func TransferMultisig ¶
Types ¶
type Account ¶
type Account struct { // The mint associated with this account Mint ed25519.PublicKey // The owner of this account. Owner ed25519.PublicKey // The amount of tokens this account holds. Amount uint64 // If set, then the 'DelegatedAmount' represents the amount // authorized by the delegate. Delegate ed25519.PublicKey /// The account's state State AccountState // If set, this is a native token, and the value logs the rent-exempt reserve. An Account // is required to be rent-exempt, so the value is used by the Processor to ensure that wrapped // SOL accounts do not drop below this threshold. IsNative *uint64 // The amount delegated DelegatedAmount uint64 // Optional authority to close the account. CloseAuthority ed25519.PublicKey }
type AccountState ¶
type AccountState byte
const ( AccountStateUninitialized AccountState = iota AccountStateInitialized AccountStateFrozen )
type AuthorityType ¶
type AuthorityType byte
const ( AuthorityTypeMintTokens AuthorityType = iota AuthorityTypeFreezeAccount AuthorityTypeAccountHolder AuthorityTypeCloseAccount )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides utilities for accessing token accounts for a given token.
func (*Client) GetAccount ¶
func (c *Client) GetAccount(accountID ed25519.PublicKey, commitment solana.Commitment) (*Account, error)
GetAccount returns the token account info for the specified account.
If the account is not initialized, or belongs to a different mint, then ErrInvalidTokenAccount is returned.
type Command ¶
type Command byte
const ( // nolint:varcheck,deadcode,unused CommandInitializeMint Command = iota CommandInitializeAccount CommandInitializeMultisig CommandTransfer // nolint:varcheck,deadcode,unused CommandApprove // nolint:varcheck,deadcode,unused CommandRevoke CommandSetAuthority // nolint:varcheck,deadcode,unused CommandMintTo // nolint:varcheck,deadcode,unused CommandBurn CommandCloseAccount // nolint:varcheck,deadcode,unused CommandFreezeAccount // nolint:varcheck,deadcode,unused CommandThawAccount // nolint:varcheck,deadcode,unused CommandTransfer2 // nolint:varcheck,deadcode,unused CommandApprove2 // nolint:varcheck,deadcode,unused CommandMintTo2 // nolint:varcheck,deadcode,unused CommandBurn2 CommandUnknown = Command(math.MaxUint8) )
type DecompiledCloseAccount ¶
type DecompiledCloseAccount struct { Account ed25519.PublicKey Destination ed25519.PublicKey Owner ed25519.PublicKey }
func DecompileCloseAccount ¶
func DecompileCloseAccount(m solana.Message, index int) (*DecompiledCloseAccount, error)
type DecompiledCreateAssociatedAccount ¶
type DecompiledCreateAssociatedAccount struct { Subsidizer ed25519.PublicKey Address ed25519.PublicKey Owner ed25519.PublicKey Mint ed25519.PublicKey }
func DecompileCreateAssociatedAccount ¶
func DecompileCreateAssociatedAccount(m solana.Message, index int) (*DecompiledCreateAssociatedAccount, error)
type DecompiledInitializeAccount ¶
type DecompiledInitializeAccount struct { Account ed25519.PublicKey Mint ed25519.PublicKey Owner ed25519.PublicKey }
func DecompileInitializeAccount ¶
func DecompileInitializeAccount(m solana.Message, index int) (*DecompiledInitializeAccount, error)
type DecompiledSetAuthority ¶
type DecompiledSetAuthority struct { Account ed25519.PublicKey CurrentAuthority ed25519.PublicKey NewAuthority ed25519.PublicKey Type AuthorityType }
func DecompileSetAuthority ¶
func DecompileSetAuthority(m solana.Message, index int) (*DecompiledSetAuthority, error)
type DecompiledTransfer ¶
type DecompiledTransfer struct { Source ed25519.PublicKey Destination ed25519.PublicKey Owner ed25519.PublicKey Amount uint64 }
func DecompileTransfer ¶
func DecompileTransfer(m solana.Message, index int) (*DecompiledTransfer, error)
type DecompiledTransfer2 ¶
type DecompiledTransfer2 struct { Source ed25519.PublicKey Mint ed25519.PublicKey Destination ed25519.PublicKey Owner ed25519.PublicKey Amount uint64 Decimals byte }
func DecompileTransfer2 ¶
func DecompileTransfer2(m solana.Message, index int) (*DecompiledTransfer2, error)