Documentation ¶
Index ¶
- Constants
- Variables
- func DecimalsInBigInt(decimal uint32) *big.Int
- func DecodeInstruction(programID PublicKey, accounts []*AccountMeta, data []byte) (interface{}, error)
- func NewRandomPrivateKey() (PublicKey, PrivateKey, error)
- func RegisterInstructionDecoder(programID PublicKey, decoder InstructionDecoder)
- type Account
- type AccountMeta
- type AccountSettable
- type Base58
- type ByteWrapper
- type CompiledInstruction
- type Data
- type Hash
- type Instruction
- type InstructionDecoder
- type Message
- type MessageHeader
- type Padding
- type PrivateKey
- type PublicKey
- type Signature
- func MustSignatureFromString(in string) (out Signature)
- func NewSignatureFromBase58(in string) (out Signature, err error)
- func NewSignatureFromBytes(in []byte) (out Signature, err error)
- func NewSignatureFromString(in string) (out Signature, err error)
- func SignatureFromBase58(in string) (out Signature, err error)deprecated
- type Transaction
- func (t *Transaction) AccountMetaList() (out []*AccountMeta)
- func (t *Transaction) IsSigner(account PublicKey) bool
- func (t *Transaction) IsWritable(account PublicKey) bool
- func (t *Transaction) ResolveProgramIDIndex(programIDIndex uint8) (PublicKey, error)
- func (t *Transaction) Sign(getter privateKeyGetter) (out []Signature, err error)
- func (t *Transaction) TouchAccount(account PublicKey) bool
- type TransactionOption
Constants ¶
View Source
const MAX_SEED_LENGTH = 32
Variables ¶
View Source
var InstructionDecoderRegistry = map[string]InstructionDecoder{}
Functions ¶
func DecimalsInBigInt ¶
func DecodeInstruction ¶
func DecodeInstruction(programID PublicKey, accounts []*AccountMeta, data []byte) (interface{}, error)
func NewRandomPrivateKey ¶
func NewRandomPrivateKey() (PublicKey, PrivateKey, error)
func RegisterInstructionDecoder ¶
func RegisterInstructionDecoder(programID PublicKey, decoder InstructionDecoder)
Types ¶
type Account ¶
type Account struct {
PrivateKey PrivateKey
}
func NewAccount ¶
func NewAccount() *Account
type AccountMeta ¶
type AccountSettable ¶
type AccountSettable interface {
SetAccounts(accounts []*AccountMeta) error
}
type CompiledInstruction ¶
type CompiledInstruction struct { ProgramIDIndex uint8 `json:"programIdIndex"` AccountCount bin.Varuint16 `json:"-" bin:"sizeof=Accounts"` Accounts []uint8 `json:"accounts"` DataLength bin.Varuint16 `json:"-" bin:"sizeof=Data"` Data Base58 `json:"data"` }
func (*CompiledInstruction) ResolveInstructionAccounts ¶
func (ci *CompiledInstruction) ResolveInstructionAccounts(message *Message) (out []*AccountMeta)
type Instruction ¶
type Instruction interface { Accounts() []*AccountMeta // returns the list of accounts the instructions requires ProgramID() PublicKey // the programID the instruction acts on 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 Message ¶
type Message struct { Header MessageHeader `json:"header"` AccountKeys []PublicKey `json:"accountKeys"` RecentBlockhash PublicKey `json:"recentBlockhash"` Instructions []CompiledInstruction `json:"instructions"` }
func (*Message) AccountMetaList ¶
func (m *Message) AccountMetaList() (out []*AccountMeta)
func (*Message) IsWritable ¶
func (*Message) ResolveProgramIDIndex ¶
func (*Message) TouchAccount ¶
type MessageHeader ¶
type PrivateKey ¶
type PrivateKey []byte
func MustPrivateKeyFromBase58 ¶
func MustPrivateKeyFromBase58(in string) PrivateKey
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 [32]byte
func MustPublicKeyFromBase58 ¶
func PublicKeyFromBase58 ¶
func PublicKeyFromBytes ¶
func (PublicKey) MarshalJSON ¶
func (*PublicKey) UnmarshalJSON ¶
type Signature ¶
type Signature [64]byte
func MustSignatureFromString ¶ added in v0.5.0
func NewSignatureFromBase58 ¶
func NewSignatureFromBytes ¶
func NewSignatureFromString ¶
func SignatureFromBase58
deprecated
func (Signature) MarshalJSON ¶
func (*Signature) UnmarshalJSON ¶
type Transaction ¶
type Transaction struct { Signatures []Signature `json:"signatures"` Message Message `json:"message"` }
func NewTransaction ¶
func NewTransaction(instructions []Instruction, blockHash PublicKey, opts ...TransactionOption) (*Transaction, error)
func TransactionFromData ¶
func TransactionFromData(in []byte) (*Transaction, error)
func (*Transaction) AccountMetaList ¶
func (t *Transaction) AccountMetaList() (out []*AccountMeta)
func (*Transaction) IsSigner ¶
func (t *Transaction) IsSigner(account PublicKey) bool
func (*Transaction) IsWritable ¶
func (t *Transaction) IsWritable(account PublicKey) bool
func (*Transaction) ResolveProgramIDIndex ¶
func (t *Transaction) ResolveProgramIDIndex(programIDIndex uint8) (PublicKey, error)
func (*Transaction) Sign ¶
func (t *Transaction) Sign(getter privateKeyGetter) (out []Signature, err error)
func (*Transaction) TouchAccount ¶
func (t *Transaction) TouchAccount(account PublicKey) bool
type TransactionOption ¶
type TransactionOption interface {
// contains filtered or unexported methods
}
func TransactionPayer ¶
func TransactionPayer(payer PublicKey) TransactionOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.