Documentation ¶
Index ¶
- Constants
- Variables
- 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
- type AccountMetaSlice
- func (slice *AccountMetaSlice) Append(account *AccountMeta)
- 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) SetAccounts(accounts []*AccountMeta) error
- func (slice AccountMetaSlice) SplitFrom(index int) (AccountMetaSlice, AccountMetaSlice)
- type AccountsGettable
- type AccountsSettable
- type Base58
- type ByteWrapper
- type CompiledInstruction
- type Data
- type DurationSeconds
- type EncodingType
- type GenericInstruction
- type Hash
- type Instruction
- type InstructionDecoder
- type MarshallOpts
- type Message
- func (m *Message) AccountMetaList() AccountMetaSlice
- func (mx *Message) EncodeToTree(txTree treeout.Branches)
- func (m *Message) HasAccount(account PublicKey) bool
- func (m *Message) IsSigner(account PublicKey) bool
- func (m *Message) IsWritable(account PublicKey) bool
- func (mx *Message) MarshalBinary() ([]byte, error)
- func (mx Message) MarshalWithEncoder(encoder *bin.Encoder) error
- func (m *Message) ResolveProgramIDIndex(programIDIndex uint16) (PublicKey, error)
- func (m *Message) Signers() PublicKeySlice
- func (mx Message) ToBase64() string
- func (mx *Message) UnmarshalWithDecoder(decoder *bin.Decoder) (err error)
- func (m *Message) Writable() (out PublicKeySlice)
- type MessageHeader
- type Padding
- type PrivateKey
- type PublicKey
- 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 MustPublicKeyFromBase58(in string) PublicKey
- func PublicKeyFromBase58(in string) (out PublicKey, err error)
- func PublicKeyFromBytes(in []byte) (out PublicKey)
- func (p PublicKey) Bytes() []byte
- func (p PublicKey) Equals(pb PublicKey) bool
- func (p PublicKey) IsOnCurve() bool
- func (p PublicKey) IsZero() bool
- func (p PublicKey) MarshalJSON() ([]byte, error)
- func (p PublicKey) MarshalText() ([]byte, error)
- func (p *PublicKey) Set(s string) (err error)
- func (p PublicKey) Short(n int) string
- func (p PublicKey) String() string
- func (p PublicKey) ToPointer() *PublicKey
- func (p *PublicKey) UnmarshalJSON(data []byte) (err error)
- func (p *PublicKey) UnmarshalText(data []byte) error
- type PublicKeySlice
- type Signature
- type Transaction
- func (t *Transaction) AccountMetaList() (out []*AccountMeta)
- func (tx *Transaction) EncodeToTree(parent treeout.Branches)
- func (tx *Transaction) EncodeTree(encoder *text.TreeEncoder) (int, error)
- func (t *Transaction) HasAccount(account PublicKey) bool
- func (t *Transaction) IsSigner(account PublicKey) bool
- func (t *Transaction) IsWritable(account PublicKey) bool
- func (tx *Transaction) MarshalBinary() ([]byte, error)
- func (tx *Transaction) MarshalBinaryWitOpts(opts MarshallOpts) ([]byte, error)
- func (tx Transaction) MarshalWithEncoder(encoder *bin.Encoder) error
- func (tx Transaction) MustToBase64() string
- func (t *Transaction) ResolveProgramIDIndex(programIDIndex uint16) (PublicKey, error)
- func (tx *Transaction) Sign(getter privateKeyGetter) (out []Signature, err error)
- func (tx *Transaction) String() string
- func (tx Transaction) ToBase64() (string, error)
- func (tx *Transaction) UnmarshalWithDecoder(decoder *bin.Decoder) (err error)
- func (tx *Transaction) VerifySignatures() error
- type 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
- type UnixTimeSeconds
- type Wallet
Constants ¶
const ( /// Number of bytes in a pubkey. PublicKeyLength = 32 // Maximum length of derived pubkey seed. MaxSeedLength = 32 // Maximum number of seeds. MaxSeeds = 16 /// Number of bytes in a signature. SignatureLength = 64 )
const ( // There are 1-billion lamports in one SOL. LAMPORTS_PER_SOL uint64 = 1000000000 )
const PDA_MARKER = "ProgramDerivedAddress"
Variables ¶
var ( // Create new accounts, allocate account data, assign accounts to owning programs, // transfer lamports from System Program owned accounts and pay transacation fees. SystemProgramID = MustPublicKeyFromBase58("11111111111111111111111111111111") // Add configuration data to the chain and the list of public keys that are permitted to modify it. ConfigProgramID = MustPublicKeyFromBase58("Config1111111111111111111111111111111111111") // Create and manage accounts representing stake and rewards for delegations to validators. StakeProgramID = MustPublicKeyFromBase58("Stake11111111111111111111111111111111111111") // Create and manage accounts that track validator voting state and rewards. VoteProgramID = MustPublicKeyFromBase58("Vote111111111111111111111111111111111111111") BPFLoaderDeprecatedProgramID = MustPublicKeyFromBase58("BPFLoader1111111111111111111111111111111111") // Deploys, upgrades, and executes programs on the chain. BPFLoaderProgramID = MustPublicKeyFromBase58("BPFLoader2111111111111111111111111111111111") BPFLoaderUpgradeableProgramID = MustPublicKeyFromBase58("BPFLoaderUpgradeab1e11111111111111111111111") // Verify secp256k1 public key recovery operations (ecrecover). Secp256k1ProgramID = MustPublicKeyFromBase58("KeccakSecp256k11111111111111111111111111111") FeatureProgramID = MustPublicKeyFromBase58("Feature111111111111111111111111111111111111") )
var ( // A Token program on the Solana blockchain. // This program defines a common implementation for Fungible and Non Fungible tokens. TokenProgramID = MustPublicKeyFromBase58("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA") // A Uniswap-like exchange for the Token program on the Solana blockchain, // implementing multiple automated market maker (AMM) curves. TokenSwapProgramID = MustPublicKeyFromBase58("SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8") TokenSwapFeeOwner = MustPublicKeyFromBase58("HfoTxFR1Tm6kGmWgYWD6J7YHVy1UwqSULUGVLXkJqaKN") // A lending protocol for the Token program on the Solana blockchain inspired by Aave and Compound. TokenLendingProgramID = MustPublicKeyFromBase58("LendZqTs8gn5CTSJU1jWKhKuVpjJGom45nnwPb2AMTi") // This program defines the convention and provides the mechanism for mapping // the user's wallet address to the associated token accounts they hold. SPLAssociatedTokenAccountProgramID = MustPublicKeyFromBase58("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL") // The Memo program is a simple program that validates a string of UTF-8 encoded characters // and verifies that any accounts provided are signers of the transaction. // The program also logs the memo, as well as any verified signer addresses, // to the transaction log, so that anyone can easily observe memos // and know they were approved by zero or more addresses // by inspecting the transaction log from a trusted provider. MemoProgramID = MustPublicKeyFromBase58("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr") )
SPL:
var ( // The Mint for native SOL Token accounts SolMint = MustPublicKeyFromBase58("So11111111111111111111111111111111111111112") WrappedSol = SolMint )
var ( // The Clock sysvar contains data on cluster time, // including the current slot, epoch, and estimated wall-clock Unix timestamp. // It is updated every slot. SysVarClockPubkey = MustPublicKeyFromBase58("SysvarC1ock11111111111111111111111111111111") // The EpochSchedule sysvar contains epoch scheduling constants that are set in genesis, // and enables calculating the number of slots in a given epoch, // the epoch for a given slot, etc. // (Note: the epoch schedule is distinct from the leader schedule) SysVarEpochSchedulePubkey = MustPublicKeyFromBase58("SysvarEpochSchedu1e111111111111111111111111") // The Fees sysvar contains the fee calculator for the current slot. // It is updated every slot, based on the fee-rate governor. SysVarFeesPubkey = MustPublicKeyFromBase58("SysvarFees111111111111111111111111111111111") // The Instructions sysvar contains the serialized instructions in a Message while that Message is being processed. // This allows program instructions to reference other instructions in the same transaction. SysVarInstructionsPubkey = MustPublicKeyFromBase58("Sysvar1nstructions1111111111111111111111111") // The RecentBlockhashes sysvar contains the active recent blockhashes as well as their associated fee calculators. // It is updated every slot. // Entries are ordered by descending block height, // so the first entry holds the most recent block hash, // and the last entry holds an old block hash. SysVarRecentBlockHashesPubkey = MustPublicKeyFromBase58("SysvarRecentB1ockHashes11111111111111111111") // The Rent sysvar contains the rental rate. // Currently, the rate is static and set in genesis. // The Rent burn percentage is modified by manual feature activation. SysVarRentPubkey = MustPublicKeyFromBase58("SysvarRent111111111111111111111111111111111") // SysVarRewardsPubkey = MustPublicKeyFromBase58("SysvarRewards111111111111111111111111111111") // The SlotHashes sysvar contains the most recent hashes of the slot's parent banks. // It is updated every slot. SysVarSlotHashesPubkey = MustPublicKeyFromBase58("SysvarS1otHashes111111111111111111111111111") // The SlotHistory sysvar contains a bitvector of slots present over the last epoch. It is updated every slot. SysVarSlotHistoryPubkey = MustPublicKeyFromBase58("SysvarS1otHistory11111111111111111111111111") // The StakeHistory sysvar contains the history of cluster-wide stake activations and de-activations per epoch. // It is updated at the start of every epoch. SysVarStakeHistoryPubkey = MustPublicKeyFromBase58("SysvarStakeHistory1111111111111111111111111") )
var ErrInstructionDecoderNotFound = errors.New("instruction decoder not found")
var ErrMaxSeedLengthExceeded = errors.New("Max seed length exceeded")
var (
TokenMetadataProgramID = MustPublicKeyFromBase58("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s")
)
Functions ¶
func DecimalsInBigInt ¶
func DecodeInstruction ¶
func DecodeInstruction(programID PublicKey, accounts []*AccountMeta, data []byte) (interface{}, error)
func GetAddedRemovedPubkeys ¶
func GetAddedRemovedPubkeys(previous PublicKeySlice, next PublicKeySlice) (added PublicKeySlice, removed PublicKeySlice)
GetAddedRemovedPubkeys accepts two slices of pubkeys (`previous` and `next`), and returns two slices: - `added` is the slice of pubkeys that are present in `next` but NOT present in `previous`. - `removed` is the slice of pubkeys that are present in `previous` but are NOT present in `next`.
func IsAnyOfEncodingType ¶
func IsAnyOfEncodingType(candidate EncodingType, allowed ...EncodingType) bool
IsAnyOfEncodingType checks whether the provided `candidate` is any of the `allowed`.
func RegisterInstructionDecoder ¶
func RegisterInstructionDecoder(programID PublicKey, decoder InstructionDecoder)
Types ¶
type AccountMeta ¶
func Meta ¶
func Meta( pubKey PublicKey, ) *AccountMeta
Meta intializes a new AccountMeta with the provided pubKey.
func NewAccountMeta ¶
func NewAccountMeta( pubKey PublicKey, WRITE bool, SIGNER bool, ) *AccountMeta
func (*AccountMeta) SIGNER ¶
func (meta *AccountMeta) SIGNER() *AccountMeta
SIGNER sets IsSigner to true.
func (*AccountMeta) WRITE ¶
func (meta *AccountMeta) WRITE() *AccountMeta
WRITE sets IsWritable to true.
type AccountMetaSlice ¶
type AccountMetaSlice []*AccountMeta
func (*AccountMetaSlice) Append ¶
func (slice *AccountMetaSlice) Append(account *AccountMeta)
func (AccountMetaSlice) Get ¶
func (slice AccountMetaSlice) Get(index int) *AccountMeta
Get returns the AccountMeta at the desired index. If the index is not present, it returns nil.
func (AccountMetaSlice) GetAccounts ¶
func (slice AccountMetaSlice) GetAccounts() []*AccountMeta
func (AccountMetaSlice) GetKeys ¶
func (slice AccountMetaSlice) GetKeys() PublicKeySlice
GetKeys returns the pubkeys of all AccountMeta.
func (AccountMetaSlice) GetSigners ¶
func (slice AccountMetaSlice) GetSigners() []*AccountMeta
GetSigners returns the accounts that are signers.
func (AccountMetaSlice) Len ¶
func (slice AccountMetaSlice) Len() int
func (*AccountMetaSlice) SetAccounts ¶
func (slice *AccountMetaSlice) SetAccounts(accounts []*AccountMeta) error
func (AccountMetaSlice) SplitFrom ¶
func (slice AccountMetaSlice) SplitFrom(index int) (AccountMetaSlice, AccountMetaSlice)
type AccountsGettable ¶
type AccountsGettable interface {
GetAccounts() (accounts []*AccountMeta)
}
type AccountsSettable ¶
type AccountsSettable interface {
SetAccounts(accounts []*AccountMeta) error
}
type ByteWrapper ¶
func (*ByteWrapper) ReadByte ¶
func (w *ByteWrapper) ReadByte() (byte, error)
type CompiledInstruction ¶
type CompiledInstruction struct { // Index into the message.accountKeys array indicating the program account that executes this instruction. // NOTE: it is actually a uint8, but using a uint16 because uint8 is treated as a byte everywhere, // and that can be an issue. ProgramIDIndex uint16 `json:"programIdIndex"` // List of ordered indices into the message.accountKeys array indicating which accounts to pass to the program. // NOTE: it is actually a []uint8, but using a uint16 because []uint8 is treated as a []byte everywhere, // and that can be an issue. Accounts []uint16 `json:"accounts"` // The program input data encoded in a base-58 string. Data Base58 `json:"data"` }
func (*CompiledInstruction) ResolveInstructionAccounts ¶
func (ci *CompiledInstruction) ResolveInstructionAccounts(message *Message) []*AccountMeta
type Data ¶
type Data struct { Content []byte Encoding EncodingType }
func (Data) MarshalJSON ¶
func (Data) MarshalWithEncoder ¶
func (*Data) UnmarshalJSON ¶
type DurationSeconds ¶
type DurationSeconds int64
func (DurationSeconds) Duration ¶
func (res DurationSeconds) Duration() time.Duration
func (DurationSeconds) String ¶
func (res DurationSeconds) String() string
type EncodingType ¶
type EncodingType string
const ( EncodingBase58 EncodingType = "base58" // limited to Account data of less than 129 bytes EncodingBase64 EncodingType = "base64" // will return base64 encoded data for Account data of any size EncodingBase64Zstd EncodingType = "base64+zstd" // compresses the Account data using Zstandard and base64-encodes the result // attempts to use program-specific state parsers to // return more human-readable and explicit account state data. // If "jsonParsed" is requested but a parser cannot be found, // the field falls back to "base64" encoding, detectable when the data field is type <string>. // Cannot be used if specifying dataSlice parameters (offset, length). EncodingJSONParsed EncodingType = "jsonParsed" EncodingJSON EncodingType = "json" // NOTE: you're probably looking for EncodingJSONParsed )
type GenericInstruction ¶
type GenericInstruction struct { AccountValues AccountMetaSlice ProgID PublicKey DataBytes []byte }
func NewInstruction ¶
func NewInstruction( programID PublicKey, accounts AccountMetaSlice, data []byte, ) *GenericInstruction
NewInstruction creates a generic instruction with the provided programID, accounts, and data bytes.
func (*GenericInstruction) Accounts ¶
func (in *GenericInstruction) Accounts() []*AccountMeta
func (*GenericInstruction) Data ¶
func (in *GenericInstruction) Data() ([]byte, error)
func (*GenericInstruction) ProgramID ¶
func (in *GenericInstruction) ProgramID() PublicKey
type Hash ¶
type Hash PublicKey
func HashFromBase58 ¶
func HashFromBytes ¶
func MustHashFromBase58 ¶
func (Hash) MarshalJSON ¶
func (*Hash) UnmarshalJSON ¶
type Instruction ¶
type Instruction interface { ProgramID() PublicKey // the programID the instruction acts on Accounts() []*AccountMeta // returns the list of accounts the instructions requires Data() ([]byte, error) // the binary encoded instructions }
type InstructionDecoder ¶
type InstructionDecoder func(instructionAccounts []*AccountMeta, data []byte) (interface{}, error)
InstructionDecoder receives the AccountMeta FOR THAT INSTRUCTION, and not the accounts of the *Message object. Resolve with CompiledInstruction.ResolveInstructionAccounts(message) beforehand.
type MarshallOpts ¶
type MarshallOpts struct {
RequireAllSignatures bool
}
type Message ¶
type Message struct { // List of base-58 encoded public keys used by the transaction, // including by the instructions and for signatures. // The first `message.header.numRequiredSignatures` public keys must sign the transaction. AccountKeys []PublicKey `json:"accountKeys"` // Details the account types and signatures required by the transaction. Header MessageHeader `json:"header"` // A base-58 encoded hash of a recent block in the ledger used to // prevent transaction duplication and to give transactions lifetimes. RecentBlockhash Hash `json:"recentBlockhash"` // List of program instructions that will be executed in sequence // and committed in one atomic transaction if all succeed. Instructions []CompiledInstruction `json:"instructions"` }
func (*Message) AccountMetaList ¶
func (m *Message) AccountMetaList() AccountMetaSlice
func (*Message) EncodeToTree ¶
func (*Message) HasAccount ¶
func (*Message) IsWritable ¶
func (*Message) MarshalBinary ¶
func (Message) MarshalWithEncoder ¶
func (*Message) ResolveProgramIDIndex ¶
func (*Message) Signers ¶
func (m *Message) Signers() PublicKeySlice
Signers returns the pubkeys of all accounts that are signers.
func (*Message) UnmarshalWithDecoder ¶
func (*Message) Writable ¶
func (m *Message) Writable() (out PublicKeySlice)
Writable returns the pubkeys of all accounts that are writable.
type MessageHeader ¶
type MessageHeader struct { // The total number of signatures required to make the transaction valid. // The signatures must match the first `numRequiredSignatures` of `message.account_keys`. NumRequiredSignatures uint8 `json:"numRequiredSignatures"` // The last numReadonlySignedAccounts of the signed keys are read-only accounts. // Programs may process multiple transactions that load read-only accounts within // a single PoH entry, but are not permitted to credit or debit lamports or modify // account data. // Transactions targeting the same read-write account are evaluated sequentially. NumReadonlySignedAccounts uint8 `json:"numReadonlySignedAccounts"` // The last `numReadonlyUnsignedAccounts` of the unsigned keys are read-only accounts. NumReadonlyUnsignedAccounts uint8 `json:"numReadonlyUnsignedAccounts"` }
func (*MessageHeader) EncodeToTree ¶
func (header *MessageHeader) EncodeToTree(mxBranch treeout.Branches)
type PrivateKey ¶
type PrivateKey []byte
func MustPrivateKeyFromBase58 ¶
func MustPrivateKeyFromBase58(in string) PrivateKey
func NewRandomPrivateKey ¶
func NewRandomPrivateKey() (PrivateKey, error)
func PrivateKeyFromBase58 ¶
func PrivateKeyFromBase58(privkey string) (PrivateKey, error)
func PrivateKeyFromSolanaKeygenFile ¶
func PrivateKeyFromSolanaKeygenFile(file string) (PrivateKey, error)
func (PrivateKey) PublicKey ¶
func (k PrivateKey) PublicKey() PublicKey
func (PrivateKey) String ¶
func (k PrivateKey) String() string
type PublicKey ¶
type PublicKey [PublicKeyLength]byte
func CreateProgramAddress ¶
Create a program address. Ported from https://github.com/solana-labs/solana/blob/216983c50e0a618facc39aa07472ba6d23f1b33a/sdk/program/src/pubkey.rs#L204
func CreateWithSeed ¶
func FindProgramAddress ¶
Find a valid program address and its corresponding bump seed.
func FindTokenMetadataAddress ¶
FindTokenMetadataAddress returns the token metadata program-derived address given a SPL token mint address.
func MustPublicKeyFromBase58 ¶
func PublicKeyFromBase58 ¶
func PublicKeyFromBytes ¶
func (PublicKey) IsZero ¶
IsZero returns whether the public key is zero. NOTE: the System Program public key is also zero.
func (PublicKey) MarshalJSON ¶
func (PublicKey) MarshalText ¶
func (PublicKey) Short ¶
Short returns a shortened pubkey string, only including the first n chars, ellipsis, and the last n characters. NOTE: this is ONLY for visual representation for humans, and cannot be used for anything else.
func (*PublicKey) UnmarshalJSON ¶
func (*PublicKey) UnmarshalText ¶
type PublicKeySlice ¶
type PublicKeySlice []PublicKey
func (*PublicKeySlice) Append ¶
func (slice *PublicKeySlice) Append(pubkeys ...PublicKey)
func (PublicKeySlice) Has ¶
func (slice PublicKeySlice) Has(pubkey PublicKey) bool
func (PublicKeySlice) Split ¶
func (slice PublicKeySlice) Split(chunkSize int) []PublicKeySlice
Split splits the slice into chunks of the specified size.
func (*PublicKeySlice) UniqueAppend ¶
func (slice *PublicKeySlice) UniqueAppend(pubkey PublicKey) bool
UniqueAppend appends the provided pubkey only if it is not already present in the slice. Returns true when the provided pubkey wasn't already present.
type Signature ¶
type Signature [64]byte
func MustSignatureFromBase58 ¶
func SignatureFromBase58 ¶
func SignatureFromBytes ¶
func (Signature) MarshalJSON ¶
func (*Signature) UnmarshalJSON ¶
type Transaction ¶
type Transaction struct { // A list of base-58 encoded signatures applied to the transaction. // The list is always of length `message.header.numRequiredSignatures` and not empty. // The signature at index `i` corresponds to the public key at index // `i` in `message.account_keys`. The first one is used as the transaction id. Signatures []Signature `json:"signatures"` // Defines the content of the transaction. Message Message `json:"message"` }
func MustTransactionFromDecoder ¶
func MustTransactionFromDecoder(decoder *bin.Decoder) *Transaction
func NewTransaction ¶
func NewTransaction(instructions []Instruction, recentBlockHash Hash, opts ...TransactionOption) (*Transaction, error)
func TransactionFromDecoder ¶
func TransactionFromDecoder(decoder *bin.Decoder) (*Transaction, error)
func (*Transaction) AccountMetaList ¶
func (t *Transaction) AccountMetaList() (out []*AccountMeta)
func (*Transaction) EncodeToTree ¶
func (tx *Transaction) EncodeToTree(parent treeout.Branches)
func (*Transaction) EncodeTree ¶
func (tx *Transaction) EncodeTree(encoder *text.TreeEncoder) (int, error)
func (*Transaction) HasAccount ¶
func (t *Transaction) HasAccount(account PublicKey) bool
func (*Transaction) IsSigner ¶
func (t *Transaction) IsSigner(account PublicKey) bool
func (*Transaction) IsWritable ¶
func (t *Transaction) IsWritable(account PublicKey) bool
func (*Transaction) MarshalBinary ¶
func (tx *Transaction) MarshalBinary() ([]byte, error)
func (*Transaction) MarshalBinaryWitOpts ¶
func (tx *Transaction) MarshalBinaryWitOpts(opts MarshallOpts) ([]byte, error)
func (Transaction) MarshalWithEncoder ¶
func (tx Transaction) MarshalWithEncoder(encoder *bin.Encoder) error
func (Transaction) MustToBase64 ¶
func (tx Transaction) MustToBase64() string
func (*Transaction) ResolveProgramIDIndex ¶
func (t *Transaction) ResolveProgramIDIndex(programIDIndex uint16) (PublicKey, error)
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(getter privateKeyGetter) (out []Signature, err error)
func (*Transaction) String ¶
func (tx *Transaction) String() string
String returns a human-readable string representation of the transaction data. To disable colors, set "github.com/olegfomenko/solana-go/text".DisableColors = true
func (Transaction) ToBase64 ¶
func (tx Transaction) ToBase64() (string, error)
func (*Transaction) UnmarshalWithDecoder ¶
func (tx *Transaction) UnmarshalWithDecoder(decoder *bin.Decoder) (err error)
func (*Transaction) VerifySignatures ¶
func (tx *Transaction) VerifySignatures() error
VerifySignatures verifies all the signatures in the transaction against the pubkeys of the signers.
type TransactionBuilder ¶
type TransactionBuilder struct {
// contains filtered or unexported fields
}
func NewTransactionBuilder ¶
func NewTransactionBuilder() *TransactionBuilder
NewTransactionBuilder creates a new instruction builder.
func (*TransactionBuilder) AddInstruction ¶
func (builder *TransactionBuilder) AddInstruction(instruction Instruction) *TransactionBuilder
AddInstruction adds the provided instruction to the builder.
func (*TransactionBuilder) Build ¶
func (builder *TransactionBuilder) Build() (*Transaction, error)
Build builds and returns a *Transaction.
func (*TransactionBuilder) SetFeePayer ¶
func (builder *TransactionBuilder) SetFeePayer(feePayer PublicKey) *TransactionBuilder
Set transaction fee payer. If not set, defaults to first signer account of the first instruction.
func (*TransactionBuilder) SetRecentBlockHash ¶
func (builder *TransactionBuilder) SetRecentBlockHash(recentBlockHash Hash) *TransactionBuilder
SetRecentBlockHash sets the recent blockhash for the instruction builder.
func (*TransactionBuilder) WithOpt ¶
func (builder *TransactionBuilder) WithOpt(opt TransactionOption) *TransactionBuilder
WithOpt adds a TransactionOption.
type TransactionOption ¶
type TransactionOption interface {
// contains filtered or unexported methods
}
func TransactionPayer ¶
func TransactionPayer(payer PublicKey) TransactionOption
type UnixTimeSeconds ¶
type UnixTimeSeconds int64
Unix timestamp (seconds since the Unix epoch)
func (UnixTimeSeconds) String ¶
func (res UnixTimeSeconds) String() string
func (UnixTimeSeconds) Time ¶
func (res UnixTimeSeconds) Time() time.Time
type Wallet ¶
type Wallet struct {
PrivateKey PrivateKey
}
Wallet is a wrapper around a PrivateKey
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
programs
|
|
serum
Code generated by rice embed-go; DO NOT EDIT.
|
Code generated by rice embed-go; DO NOT EDIT. |
jsonrpc
Package jsonrpc provides a JSON-RPC 2.0 client that sends JSON-RPC requests and receives JSON-RPC responses using HTTP.
|
Package jsonrpc provides a JSON-RPC 2.0 client that sends JSON-RPC requests and receives JSON-RPC responses using HTTP. |