Documentation ¶
Index ¶
- Constants
- Variables
- func CloseAccount(account, dest, owner ed25519.PublicKey) solana.Instruction
- 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 Transfer(source, dest, owner ed25519.PublicKey, amount uint64) solana.Instruction
- func TransferMultisig(source, dest, multisigOwner ed25519.PublicKey, amount uint64, ...) solana.Instruction
- type Account
- type AccountState
- type AuthorityType
- type Client
- type DecompiledInitializeAccount
- type DecompiledSetAuthority
- type DecompiledTransferAccount
Constants ¶
View Source
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 )
View Source
const AccountSize = 165
View Source
const MultisigAccountSize = 355
Variables ¶
View Source
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") )
View Source
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 InitializeAccount ¶
func InitializeAccount(account, mint, owner ed25519.PublicKey) solana.Instruction
func InitializeMultisig ¶ added in v0.50.0
func SetAuthority ¶
func SetAuthority(account, currentAuthority, newAuthority ed25519.PublicKey, authorityType AuthorityType) solana.Instruction
func Transfer ¶
func Transfer(source, dest, owner ed25519.PublicKey, amount uint64) solana.Instruction
todo(feature): support multi-sig
func TransferMultisig ¶ added in v0.50.0
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 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)
Click to show internal directories.
Click to hide internal directories.