Documentation ¶
Index ¶
- Constants
- Variables
- func ClassifyApplication(transaction solana.TransactionResult, apps map[string]applications.Application) []applications.Application
- func EncodeCompactU16Length(bytes *[]byte, ln int)
- func GetAllInstructions(result solTypes.TransactionResult) []solTypes.TransactionInstruction
- func ValidCurve(point []byte) bool
- type AccountMeta
- type AccountMetaSlice
- type CompiledInstruction
- type GenericInstruction
- type Hash
- type Instruction
- type Message
- type MessageHeader
- type PrivateKey
- type PublicKey
- type PublicKeySlice
- type Signature
- type TokenDetailsSolana
- type Transaction
- type TransactionOption
- type Wallet
Constants ¶
View Source
const ( // SysVarClockAddress SysVarClockAddress = "SysvarC1ock11111111111111111111111111111111" // SystemProgramIdAddress SystemProgramIdAddress = "11111111111111111111111111111111" // SysVarRentAddress SysVarRentAddress = "SysvarRent111111111111111111111111111111111" )
View Source
const ( MaxSeeds = 16 MaxSeedLength = 32 )
View Source
const ContextLogging = "SOLANA"
ContextLogging to use for logging
View Source
const ProgramDerivedAddressMarker = "ProgramDerivedAddress"
Variables ¶
View Source
var ErrMaxSeedLengthExceeded = fmt.Errorf("max seed length exceeded")
View Source
var UnknownInstructionError = errors.New("Unknown instruction")
UnknownInstructionError to be returned as a sentinel for when an unknown instruction is seen
Functions ¶
func ClassifyApplication ¶
func ClassifyApplication(transaction solana.TransactionResult, apps map[string]applications.Application) []applications.Application
func EncodeCompactU16Length ¶
Src: https://github.com/gagliardetto/binary/blob/master/compact-u16.go
func GetAllInstructions ¶
func GetAllInstructions(result solTypes.TransactionResult) []solTypes.TransactionInstruction
getAllInstructions extracts instructions and innerInstructions from a solana transaction
func ValidCurve ¶
Check if point exists on the ED25519 curve. Solana program addresses must not appear on curve.
Types ¶
type AccountMeta ¶
func NewAccountMeta ¶
func NewAccountMeta( pubKey PublicKey, WRITE bool, SIGNER bool, ) *AccountMeta
type AccountMetaSlice ¶
type AccountMetaSlice []*AccountMeta
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 []byte `json:"data"` }
type GenericInstruction ¶
type GenericInstruction struct { AccountValues AccountMetaSlice ProgID PublicKey DataBytes []byte }
func NewInstruction ¶
func NewInstruction( programID PublicKey, accounts AccountMetaSlice, data []byte, ) *GenericInstruction
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 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 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) MarshalBinary ¶
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"` }
type PrivateKey ¶
type PrivateKey []byte
func (PrivateKey) PublicKey ¶
func (k PrivateKey) PublicKey() PublicKey
type PublicKey ¶
type PublicKey [32]byte
func CreateProgramAddress ¶
func FindProgramAddress ¶
FindProgramAddress - just enough to cover the prior use case
func PublicKeyFromBase58 ¶
PublicKeyFromBase58 using btcsuite
func PublicKeyFromBytes ¶
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) UniqueAppend ¶
func (slice *PublicKeySlice) UniqueAppend(pubkey PublicKey) bool
type TokenDetailsSolana ¶
type TokenDetailsSolana struct { FluidMintPubkey PublicKey ObligationPubkey PublicKey ReservePubkey PublicKey PythPubkey PublicKey SwitchboardPubkey PublicKey TokenDecimals *big.Rat TokenName string Amount float64 }
TokenDetailsSolana containing information about tokens that we unpacked using the environment variables
func GetTokensListSolana ¶
func GetTokensListSolana(tokensList_ string) []TokenDetailsSolana
GetTokensListSolana to parse a string list into separated token information
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 NewTransaction ¶
func NewTransaction(instructions []Instruction, recentBlockHash Hash, opts ...TransactionOption) (*Transaction, error)
Pure clone of solana go code
func (*Transaction) MarshalBinary ¶
func (tx *Transaction) MarshalBinary() ([]byte, error)
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(getter privateKeyGetter) (out []Signature, err error)
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.