Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type AccountMeta
- type AddressLookupTableAccount
- type CompiledAddressLookupTable
- type CompiledInstruction
- type CompiledKeyMeta
- type CompiledKeys
- type Instruction
- type Message
- type MessageHeader
- type MessageVersion
- type NewMessageParam
- type NewTransactionParam
- type Signature
- type Transaction
Constants ¶
View Source
const ( MessageVersionLegacy = "legacy" MessageVersionV0 = "v0" )
Variables ¶
View Source
var ( ErrAccountFailedToBase58Decode = errors.New("failed to base58 decode") ErrAccountFailedToHexDecode = errors.New("failed to hex decode") ErrAccountPrivateKeyLengthMismatch = errors.New("key length mismatch") )
View Source
var (
ErrTransactionAddNotNecessarySignatures = errors.New("add not necessary signatures")
)
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
PublicKey common.PublicKey
PrivateKey ed25519.PrivateKey
}
func AccountFromBase58 ¶
AccountFromBase58 generate a account by base58 private key
func AccountFromBytes ¶
AccountFromBytes generate a account by bytes private key
func AccountFromHex ¶
AccountFromHex generate a account by hex private key
func AccountFromSeed ¶
AccountFromSeed generate a account by seed
func NewAccount ¶
func NewAccount() Account
type AccountMeta ¶
type CompiledInstruction ¶
type CompiledKeyMeta ¶
type CompiledKeys ¶
type CompiledKeys struct {
Payer *common.PublicKey
KeyMetaMap map[common.PublicKey]CompiledKeyMeta
}
func NewCompiledKeys ¶
func NewCompiledKeys(instructions []Instruction, payer *common.PublicKey) CompiledKeys
type Instruction ¶
type Instruction struct {
ProgramID common.PublicKey
Accounts []AccountMeta
Data []byte
}
type Message ¶
type Message struct {
Version MessageVersion
Header MessageHeader
Accounts []common.PublicKey
RecentBlockHash string
Instructions []CompiledInstruction
AddressLookupTables []CompiledAddressLookupTable
}
func MessageDeserialize ¶
func MustMessageDeserialize ¶
func NewMessage ¶
func NewMessage(param NewMessageParam) Message
func (Message) DecompileInstructions ¶
type MessageHeader ¶
type MessageVersion ¶
type MessageVersion string
type NewMessageParam ¶
type NewMessageParam struct {
FeePayer common.PublicKey
Instructions []Instruction
RecentBlockhash string
// v0 transaction
AddressLookupTableAccounts []AddressLookupTableAccount
}
type NewTransactionParam ¶
type Transaction ¶
func MustTransactionDeserialize ¶
func MustTransactionDeserialize(data []byte) Transaction
MustTransactionDeserialize can deserialize a tx from byte array, it panic if error ocour
func NewTransaction ¶
func NewTransaction(param NewTransactionParam) (Transaction, error)
NewTransaction create a new tx by message and signer. it will reserve signatures slot.
func TransactionDeserialize ¶
func TransactionDeserialize(tx []byte) (Transaction, error)
TransactionDeserialize can deserialize a tx from byte array
func (*Transaction) AddSignature ¶
func (tx *Transaction) AddSignature(sig []byte) error
AddSignature will add or replace signature into the correct order signature's slot.
func (*Transaction) Serialize ¶
func (tx *Transaction) Serialize() ([]byte, error)
Serialize pack tx into byte array
Click to show internal directories.
Click to hide internal directories.