Versions in this module Expand all Collapse all v1 v1.99.0 Feb 5, 2024 Changes in this version + const LAMPORTS_PER_SOL + const MaxSeedLength + const MaxSeeds + const PDA_MARKER + const PublicKeyLength + const SignatureLength + var BPFLoaderDeprecatedProgramID = MustPublicKeyFromBase58("BPFLoader1111111111111111111111111111111111") + var BPFLoaderProgramID = MustPublicKeyFromBase58("BPFLoader2111111111111111111111111111111111") + var BPFLoaderUpgradeableProgramID = MustPublicKeyFromBase58("BPFLoaderUpgradeab1e11111111111111111111111") + var ComputeBudget = MustPublicKeyFromBase58("ComputeBudget111111111111111111111111111111") + var ConfigProgramID = MustPublicKeyFromBase58("Config1111111111111111111111111111111111111") + var ErrInstructionDecoderNotFound = errors.New("instruction decoder not found") + var ErrMaxSeedLengthExceeded = errors.New("Max seed length exceeded") + var FeatureProgramID = MustPublicKeyFromBase58("Feature111111111111111111111111111111111111") + var MemoProgramID = MustPublicKeyFromBase58("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr") + var SPLAssociatedTokenAccountProgramID = MustPublicKeyFromBase58("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL") + var Secp256k1ProgramID = MustPublicKeyFromBase58("KeccakSecp256k11111111111111111111111111111") + var SolMint = MustPublicKeyFromBase58("So11111111111111111111111111111111111111112") + var StakeProgramID = MustPublicKeyFromBase58("Stake11111111111111111111111111111111111111") + var SysVarClockPubkey = MustPublicKeyFromBase58("SysvarC1ock11111111111111111111111111111111") + var SysVarEpochSchedulePubkey = MustPublicKeyFromBase58("SysvarEpochSchedu1e111111111111111111111111") + var SysVarFeesPubkey = MustPublicKeyFromBase58("SysvarFees111111111111111111111111111111111") + var SysVarInstructionsPubkey = MustPublicKeyFromBase58("Sysvar1nstructions1111111111111111111111111") + var SysVarRecentBlockHashesPubkey = MustPublicKeyFromBase58("SysvarRecentB1ockHashes11111111111111111111") + var SysVarRentPubkey = MustPublicKeyFromBase58("SysvarRent111111111111111111111111111111111") + var SysVarRewardsPubkey = MustPublicKeyFromBase58("SysvarRewards111111111111111111111111111111") + var SysVarSlotHashesPubkey = MustPublicKeyFromBase58("SysvarS1otHashes111111111111111111111111111") + var SysVarSlotHistoryPubkey = MustPublicKeyFromBase58("SysvarS1otHistory11111111111111111111111111") + var SysVarStakeHistoryPubkey = MustPublicKeyFromBase58("SysvarStakeHistory1111111111111111111111111") + var SystemProgramID = MustPublicKeyFromBase58("11111111111111111111111111111111") + var TokenLendingProgramID = MustPublicKeyFromBase58("LendZqTs8gn5CTSJU1jWKhKuVpjJGom45nnwPb2AMTi") + var TokenMetadataProgramID = MustPublicKeyFromBase58("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s") + var TokenProgramID = MustPublicKeyFromBase58("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA") + var TokenSwapFeeOwner = MustPublicKeyFromBase58("HfoTxFR1Tm6kGmWgYWD6J7YHVy1UwqSULUGVLXkJqaKN") + var TokenSwapProgramID = MustPublicKeyFromBase58("SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8") + var VoteProgramID = MustPublicKeyFromBase58("Vote111111111111111111111111111111111111111") + var WrappedSol = SolMint + func DecimalsInBigInt(decimal uint32) *big.Int + func DecodeInstruction(programID PublicKey, accounts []*AccountMeta, data []byte) (interface{}, error) + func GetAddedRemovedPubkeys(previous PublicKeySlice, next PublicKeySlice) (added PublicKeySlice, removed PublicKeySlice) + func IsAnyOfEncodingType(candidate EncodingType, allowed ...EncodingType) bool + func IsOnCurve(b []byte) bool + func RegisterInstructionDecoder(programID PublicKey, decoder InstructionDecoder) + type AccountMeta struct + IsSigner bool + IsWritable bool + PublicKey PublicKey + func Meta(pubKey PublicKey) *AccountMeta + func NewAccountMeta(pubKey PublicKey, WRITE bool, SIGNER bool) *AccountMeta + func (meta *AccountMeta) SIGNER() *AccountMeta + func (meta *AccountMeta) WRITE() *AccountMeta + type AccountMetaSlice []*AccountMeta + func (slice *AccountMetaSlice) Append(account *AccountMeta) + func (slice *AccountMetaSlice) SetAccounts(accounts []*AccountMeta) error + func (slice AccountMetaSlice) Get(index int) *AccountMeta + func (slice AccountMetaSlice) GetAccounts() []*AccountMeta + func (slice AccountMetaSlice) GetKeys() PublicKeySlice + func (slice AccountMetaSlice) GetSigners() []*AccountMeta + func (slice AccountMetaSlice) Len() int + func (slice AccountMetaSlice) SplitFrom(index int) (AccountMetaSlice, AccountMetaSlice) + type AccountsGettable interface + GetAccounts func() (accounts []*AccountMeta) + type AccountsSettable interface + SetAccounts func(accounts []*AccountMeta) error + type Base58 []byte + func (t *Base58) UnmarshalJSON(data []byte) (err error) + func (t Base58) MarshalJSON() ([]byte, error) + func (t Base58) String() string + type ByteWrapper struct + func (w *ByteWrapper) ReadByte() (byte, error) + type CompiledInstruction struct + Accounts []uint16 + Data Base58 + ProgramIDIndex uint16 + func (ci *CompiledInstruction) ResolveInstructionAccounts(message *Message) ([]*AccountMeta, error) + type Data struct + Content []byte + Encoding EncodingType + func (obj *Data) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) + func (obj Data) MarshalWithEncoder(encoder *bin.Encoder) (err error) + func (t *Data) UnmarshalJSON(data []byte) (err error) + func (t Data) MarshalJSON() ([]byte, error) + func (t Data) String() string + type DurationMilliseconds int64 + func (res DurationMilliseconds) Duration() time.Duration + func (res DurationMilliseconds) String() string + type DurationSeconds int64 + func (res DurationSeconds) Duration() time.Duration + func (res DurationSeconds) String() string + type EncodingType string + const EncodingBase58 + const EncodingBase64 + const EncodingBase64Zstd + const EncodingJSON + const EncodingJSONParsed + type GenericInstruction struct + AccountValues AccountMetaSlice + DataBytes []byte + ProgID PublicKey + func NewInstruction(programID PublicKey, accounts AccountMetaSlice, data []byte) *GenericInstruction + func (in *GenericInstruction) Accounts() []*AccountMeta + func (in *GenericInstruction) Data() ([]byte, error) + func (in *GenericInstruction) ProgramID() PublicKey + type Hash PublicKey + func HashFromBase58(in string) (Hash, error) + func HashFromBytes(in []byte) Hash + func MustHashFromBase58(in string) Hash + func (ha *Hash) UnmarshalJSON(data []byte) (err error) + func (ha *Hash) UnmarshalText(data []byte) (err error) + func (ha Hash) Equals(pb Hash) bool + func (ha Hash) IsZero() bool + func (ha Hash) MarshalJSON() ([]byte, error) + func (ha Hash) MarshalText() ([]byte, error) + func (ha Hash) String() string + type Instruction interface + Accounts func() []*AccountMeta + Data func() ([]byte, error) + ProgramID func() PublicKey + type InstructionDecoder func(instructionAccounts []*AccountMeta, data []byte) (interface{}, error) + type Message struct + AccountKeys []PublicKey + AddressTableLookups MessageAddressTableLookupSlice + Header MessageHeader + Instructions []CompiledInstruction + RecentBlockhash Hash + func (m *Message) GetVersion() MessageVersion + func (m *Message) SetVersion(version MessageVersion) *Message + func (m Message) Account(index uint16) (PublicKey, error) + func (m Message) AccountMetaList() (AccountMetaSlice, error) + func (m Message) HasAccount(account PublicKey) (bool, error) + func (m Message) IsSigner(account PublicKey) bool + func (m Message) IsVersioned() bool + func (m Message) IsWritable(account PublicKey) (bool, error) + func (m Message) Program(programIDIndex uint16) (PublicKey, error) + func (m Message) ResolveProgramIDIndex(programIDIndex uint16) (PublicKey, error) + func (m Message) Signers() PublicKeySlice + func (m Message) Writable() (out PublicKeySlice, err error) + func (mx *Message) AddAddressTableLookup(lookup MessageAddressTableLookup) *Message + func (mx *Message) EncodeToTree(txTree treeout.Branches) + func (mx *Message) GetAddressTableLookups() MessageAddressTableLookupSlice + func (mx *Message) GetAddressTables() map[PublicKey]PublicKeySlice + func (mx *Message) MarshalBinary() ([]byte, error) + func (mx *Message) MarshalLegacy() ([]byte, error) + func (mx *Message) MarshalV0() ([]byte, error) + func (mx *Message) ResolveLookups() (err error) + func (mx *Message) SetAddressTableLookups(lookups []MessageAddressTableLookup) *Message + func (mx *Message) SetAddressTables(tables map[PublicKey]PublicKeySlice) error + func (mx *Message) UnmarshalBase64(b64 string) error + func (mx *Message) UnmarshalLegacy(decoder *bin.Decoder) (err error) + func (mx *Message) UnmarshalV0(decoder *bin.Decoder) (err error) + func (mx *Message) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) + func (mx Message) GetAddressTableLookupAccounts() ([]PublicKey, error) + func (mx Message) GetAllKeys() (keys PublicKeySlice, err error) + func (mx Message) MarshalJSON() ([]byte, error) + func (mx Message) MarshalWithEncoder(encoder *bin.Encoder) error + func (mx Message) NumLookups() int + func (mx Message) NumWritableLookups() int + func (mx Message) ToBase64() string + type MessageAddressTableLookup struct + AccountKey PublicKey + ReadonlyIndexes Uint8SliceAsNum + WritableIndexes Uint8SliceAsNum + type MessageAddressTableLookupSlice []MessageAddressTableLookup + func (lookups MessageAddressTableLookupSlice) GetTableIDs() PublicKeySlice + func (lookups MessageAddressTableLookupSlice) NumLookups() int + func (lookups MessageAddressTableLookupSlice) NumWritableLookups() int + type MessageHeader struct + NumReadonlySignedAccounts uint8 + NumReadonlyUnsignedAccounts uint8 + NumRequiredSignatures uint8 + func (header *MessageHeader) EncodeToTree(mxBranch treeout.Branches) + type MessageVersion int + const MessageVersionLegacy + const MessageVersionV0 + type PK = PublicKey + type Padding []byte + type PrivateKey []byte + func MustPrivateKeyFromBase58(in string) PrivateKey + func NewRandomPrivateKey() (PrivateKey, error) + func PrivateKeyFromBase58(privkey string) (PrivateKey, error) + func PrivateKeyFromSolanaKeygenFile(file string) (PrivateKey, error) + func (k PrivateKey) PublicKey() PublicKey + func (k PrivateKey) Sign(payload []byte) (Signature, error) + func (k PrivateKey) String() string + type PublicKey [PublicKeyLength]byte + func CreateProgramAddress(seeds [][]byte, programID PublicKey) (PublicKey, error) + func CreateWithSeed(base PublicKey, seed string, owner PublicKey) (PublicKey, error) + func FindAssociatedTokenAddress(wallet PublicKey, mint PublicKey) (PublicKey, uint8, error) + func FindProgramAddress(seed [][]byte, programID PublicKey) (PublicKey, uint8, error) + func FindTokenMetadataAddress(mint PublicKey) (PublicKey, uint8, error) + func MPK(in string) PublicKey + func MustPublicKeyFromBase58(in string) PublicKey + func PublicKeyFromBase58(in string) (out PublicKey, err error) + func PublicKeyFromBytes(in []byte) (out PublicKey) + func (p *PublicKey) Set(s string) (err error) + func (p *PublicKey) UnmarshalBSON(data []byte) (err error) + func (p *PublicKey) UnmarshalBSONValue(t bsontype.Type, data []byte) (err error) + func (p *PublicKey) UnmarshalJSON(data []byte) (err error) + func (p *PublicKey) UnmarshalText(data []byte) error + func (p PublicKey) Bytes() []byte + func (p PublicKey) Equals(pb PublicKey) bool + func (p PublicKey) IsAnyOf(keys ...PublicKey) bool + func (p PublicKey) IsOnCurve() bool + func (p PublicKey) IsZero() bool + func (p PublicKey) MarshalBSON() ([]byte, error) + func (p PublicKey) MarshalBSONValue() (bsontype.Type, []byte, error) + func (p PublicKey) MarshalJSON() ([]byte, error) + func (p PublicKey) MarshalText() ([]byte, error) + func (p PublicKey) Short(n int) string + func (p PublicKey) String() string + func (p PublicKey) ToPointer() *PublicKey + func (p PublicKey) Verify(message []byte, signature Signature) bool + type PublicKeySlice []PublicKey + func (a PublicKeySlice) Added(b PublicKeySlice) PublicKeySlice + func (a PublicKeySlice) Removed(b PublicKeySlice) PublicKeySlice + func (prev PublicKeySlice) GetAddedRemoved(next PublicKeySlice) (added PublicKeySlice, removed PublicKeySlice) + func (prev PublicKeySlice) Intersect(next PublicKeySlice) PublicKeySlice + func (slice *PublicKeySlice) Append(pubkeys ...PublicKey) + func (slice *PublicKeySlice) UniqueAppend(pubkey PublicKey) bool + func (slice PublicKeySlice) Contains(pubkey PublicKey) bool + func (slice PublicKeySlice) ContainsAll(pubkeys PublicKeySlice) bool + func (slice PublicKeySlice) ContainsAny(pubkeys PublicKeySlice) bool + func (slice PublicKeySlice) Dedupe() PublicKeySlice + func (slice PublicKeySlice) Equals(other PublicKeySlice) bool + func (slice PublicKeySlice) First() *PublicKey + func (slice PublicKeySlice) Has(pubkey PublicKey) bool + func (slice PublicKeySlice) Last() *PublicKey + func (slice PublicKeySlice) Len() int + func (slice PublicKeySlice) Less(i, j int) bool + func (slice PublicKeySlice) Same(other PublicKeySlice) bool + func (slice PublicKeySlice) Sort() + func (slice PublicKeySlice) Split(chunkSize int) []PublicKeySlice + func (slice PublicKeySlice) Swap(i, j int) + func (slice PublicKeySlice) ToBase58() []string + func (slice PublicKeySlice) ToBytes() [][]byte + func (slice PublicKeySlice) ToPointers() []*PublicKey + type Signature [64]byte + func MustSignatureFromBase58(in string) Signature + func SignatureFromBase58(in string) (out Signature, err error) + func SignatureFromBytes(in []byte) (out Signature) + func (p *Signature) UnmarshalJSON(data []byte) (err error) + func (p *Signature) UnmarshalText(data []byte) (err error) + func (p Signature) MarshalJSON() ([]byte, error) + func (p Signature) MarshalText() ([]byte, error) + func (p Signature) String() string + func (s Signature) Verify(pubkey PublicKey, msg []byte) bool + func (sig Signature) Equals(pb Signature) bool + func (sig Signature) IsZero() bool + type Transaction struct + Message Message + Signatures []Signature + func MustTransactionFromDecoder(decoder *bin.Decoder) *Transaction + func NewTransaction(instructions []Instruction, recentBlockHash Hash, opts ...TransactionOption) (*Transaction, error) + func TransactionFromDecoder(decoder *bin.Decoder) (*Transaction, error) + func (t *Transaction) AccountMetaList() ([]*AccountMeta, error) + func (t *Transaction) HasAccount(account PublicKey) (bool, error) + func (t *Transaction) IsSigner(account PublicKey) bool + func (t *Transaction) IsWritable(account PublicKey) (bool, error) + func (t *Transaction) ResolveProgramIDIndex(programIDIndex uint16) (PublicKey, error) + func (tx *Transaction) EncodeToTree(parent treeout.Branches) + func (tx *Transaction) EncodeTree(encoder *text.TreeEncoder) (int, error) + func (tx *Transaction) MarshalBinary() ([]byte, error) + func (tx *Transaction) PartialSign(getter privateKeyGetter) (out []Signature, err error) + func (tx *Transaction) Sign(getter privateKeyGetter) (out []Signature, err error) + func (tx *Transaction) String() string + func (tx *Transaction) UnmarshalBase64(b64 string) error + func (tx *Transaction) UnmarshalWithDecoder(decoder *bin.Decoder) (err error) + func (tx *Transaction) VerifySignatures() error + func (tx Transaction) MarshalWithEncoder(encoder *bin.Encoder) error + func (tx Transaction) MustToBase64() string + func (tx Transaction) ToBase64() (string, error) + type TransactionBuilder struct + func NewTransactionBuilder() *TransactionBuilder + func (builder *TransactionBuilder) AddInstruction(instruction Instruction) *TransactionBuilder + func (builder *TransactionBuilder) Build() (*Transaction, error) + func (builder *TransactionBuilder) SetFeePayer(feePayer PublicKey) *TransactionBuilder + func (builder *TransactionBuilder) SetRecentBlockHash(recentBlockHash Hash) *TransactionBuilder + func (builder *TransactionBuilder) WithOpt(opt TransactionOption) *TransactionBuilder + type TransactionOption interface + func TransactionAddressTables(tables map[PublicKey]PublicKeySlice) TransactionOption + func TransactionPayer(payer PublicKey) TransactionOption + type Uint8SliceAsNum []uint8 + func (slice Uint8SliceAsNum) MarshalJSON() ([]byte, error) + type UnixTimeMilliseconds int64 + func (res UnixTimeMilliseconds) String() string + func (res UnixTimeMilliseconds) Time() time.Time + type UnixTimeSeconds int64 + func (res UnixTimeSeconds) String() string + func (res UnixTimeSeconds) Time() time.Time + type Wallet struct + PrivateKey PrivateKey + func NewWallet() *Wallet + func WalletFromPrivateKeyBase58(privateKey string) (*Wallet, error) + func (a *Wallet) PublicKey() PublicKey