Documentation ¶
Index ¶
- Constants
- Variables
- func BurnDustWithAuthorityInstructionFromBinary(data []byte) (*BurnDustWithAuthorityInstructionArgs, ...)
- func BurnDustWithAuthorityInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*BurnDustWithAuthorityInstructionArgs, ...)
- func CloseAccountsInstructionFromBinary(data []byte) (*CloseAccountsInstructionArgs, *CloseAccountsInstructionAccounts, error)
- func CloseAccountsInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*CloseAccountsInstructionArgs, *CloseAccountsInstructionAccounts, error)
- func DeactivateInstructionFromBinary(data []byte) (*DeactivateInstructionArgs, *DeactivateInstructionAccounts, error)
- func DeactivateInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*DeactivateInstructionArgs, *DeactivateInstructionAccounts, error)
- func GetStateAddress(args *GetStateAddressArgs) (ed25519.PublicKey, uint8, error)
- func GetVaultAddress(args *GetVaultAddressArgs) (ed25519.PublicKey, uint8, error)
- func InitializeInstructionFromBinary(data []byte) (*InitializeInstructionArgs, *InitializeInstructionAccounts, error)
- func RevokeLockWithAuthorityFromLegacyInstruction(txn solana.Transaction, idx int) (*RevokeLockWithAuthorityInstructionArgs, ...)
- func RevokeLockWithAuthorityInstructionFromBinary(data []byte) (*RevokeLockWithAuthorityInstructionArgs, ...)
- func WithdrawInstructionFromBinary(data []byte) (*WithdrawInstructionArgs, *WithdrawInstructionAccounts, error)
- func WithdrawInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*WithdrawInstructionArgs, *WithdrawInstructionAccounts, error)
- type AccountMeta
- type BurnDustWithAuthorityInstructionAccounts
- type BurnDustWithAuthorityInstructionArgs
- type CloseAccountsInstructionAccounts
- type CloseAccountsInstructionArgs
- type DeactivateInstructionAccounts
- type DeactivateInstructionArgs
- type GetStateAddressArgs
- type GetVaultAddressArgs
- type InitializeInstructionAccounts
- type InitializeInstructionArgs
- type Instruction
- func NewBurnDustWithAuthorityInstruction(accounts *BurnDustWithAuthorityInstructionAccounts, ...) Instruction
- func NewCloseAccountsInstruction(accounts *CloseAccountsInstructionAccounts, args *CloseAccountsInstructionArgs) Instruction
- func NewDeactivateInstruction(accounts *DeactivateInstructionAccounts, args *DeactivateInstructionArgs) Instruction
- func NewInitializeInstruction(accounts *InitializeInstructionAccounts, args *InitializeInstructionArgs) Instruction
- func NewRevokeLockWithAuthorityInstruction(accounts *RevokeLockWithAuthorityInstructionAccounts, ...) Instruction
- func NewWithdrawInstruction(accounts *WithdrawInstructionAccounts, args *WithdrawInstructionArgs) Instruction
- type RevokeLockWithAuthorityInstructionAccounts
- type RevokeLockWithAuthorityInstructionArgs
- type TimelockAccount
- type TimelockDataVersion
- type TimelockPdaVersion
- type TimelockState
- type TimelockTokenError
- type WithdrawInstructionAccounts
- type WithdrawInstructionArgs
Constants ¶
View Source
const ( BurnDustWithAuthorityInstructionArgsSize = (1 + 8) // max_amount BurnDustWithAuthorityInstructionAccountsSize = (32 + 32 + 32 + 32 + 32 + 32 + 32 + 32) // systemProgram BurnDustWithAuthorityInstructionSize = (8 + BurnDustWithAuthorityInstructionArgsSize + BurnDustWithAuthorityInstructionAccountsSize) // accounts )
View Source
const ( CloseAccountsInstructionArgsSize = (1) // TimelockBump CloseAccountsInstructionAccountsSize = (32 + 32 + 32 + 32 + 32 + 32) // systemProgram CloseAccountsInstructionSize = (8 + CloseAccountsInstructionArgsSize + CloseAccountsInstructionAccountsSize) // accounts )
View Source
const ( DeactivateInstructionArgsSize = (1) // TimelockBump DeactivateInstructionAccountsSize = (32 + 32 + 32) // payer DeactivateInstructionSize = (8 + DeactivateInstructionArgsSize + DeactivateInstructionAccountsSize) // accounts )
View Source
const ( InitializeInstructionArgsSize = (8) // UnlockDuration InitializeInstructionAccountsSize = (32 + 32 + 32 + 32 + 32 + 32 + 32 + 32 + 32 + 32) // sysvarRent InitializeInstructionSize = (8 + InitializeInstructionArgsSize + InitializeInstructionAccountsSize) // accounts )
View Source
const ( RevokeLockWithAuthorityInstructionArgsSize = (1) // TimelockBump RevokeLockWithAuthorityInstructionAccountsSize = (32 + 32 + 32 + 32 + 32 + 32) // systemProgram RevokeLockWithAuthorityInstructionSize = (8 + RevokeLockWithAuthorityInstructionArgsSize + RevokeLockWithAuthorityInstructionAccountsSize) // accounts )
View Source
const ( WithdrawInstructionArgsSize = (1) // TimelockBump WithdrawInstructionAccountsSize = (32 + 32 + 32 + 32 + 32 + 32 + 32) // systemProgram WithdrawInstructionSize = (8 + WithdrawInstructionArgsSize + WithdrawInstructionAccountsSize) // accounts )
View Source
const ( // Need to be very careful changing this value, as it's used in the state // address PDA. DefaultUnlockDuration = uint64(3 * 7 * 24 * time.Hour / time.Second) // 3 weeks in seconds )
View Source
const TimelockAccountSize = (8 + 1 + 1 + 1 + 32 + 32 + 32 + 32 + 32 + 1 + 1 + 32 + 8 + 9 + 9 + 32) // pda_padding
Variables ¶
View Source
var ( ErrInvalidProgram = errors.New("invalid program id") ErrInvalidAccountData = errors.New("unexpected account data") ErrInvalidInstructionData = errors.New("unexpected instruction data") )
View Source
var ( PROGRAM_ADDRESS = mustBase58Decode("timeDBoQGL52du9K7EtrhkJSqpiFapE9dHrmDVkuZx6") PROGRAM_ID = ed25519.PublicKey(PROGRAM_ADDRESS) )
View Source
var ( SYSTEM_PROGRAM_ID = ed25519.PublicKey(mustBase58Decode("11111111111111111111111111111111")) SPL_TOKEN_PROGRAM_ID = ed25519.PublicKey(mustBase58Decode("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")) SPL_ASSOCIATED_TOKEN_PROGRAM_ID = ed25519.PublicKey(mustBase58Decode("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL")) SYSVAR_CLOCK_PUBKEY = ed25519.PublicKey(mustBase58Decode("SysvarC1ock11111111111111111111111111111111")) SYSVAR_RENT_PUBKEY = ed25519.PublicKey(mustBase58Decode("SysvarRent111111111111111111111111111111111")) )
Functions ¶
func BurnDustWithAuthorityInstructionFromBinary ¶
func BurnDustWithAuthorityInstructionFromBinary(data []byte) (*BurnDustWithAuthorityInstructionArgs, *BurnDustWithAuthorityInstructionAccounts, error)
func BurnDustWithAuthorityInstructionFromLegacyInstruction ¶
func BurnDustWithAuthorityInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*BurnDustWithAuthorityInstructionArgs, *BurnDustWithAuthorityInstructionAccounts, error)
func CloseAccountsInstructionFromBinary ¶
func CloseAccountsInstructionFromBinary(data []byte) (*CloseAccountsInstructionArgs, *CloseAccountsInstructionAccounts, error)
func CloseAccountsInstructionFromLegacyInstruction ¶
func CloseAccountsInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*CloseAccountsInstructionArgs, *CloseAccountsInstructionAccounts, error)
func DeactivateInstructionFromBinary ¶
func DeactivateInstructionFromBinary(data []byte) (*DeactivateInstructionArgs, *DeactivateInstructionAccounts, error)
func DeactivateInstructionFromLegacyInstruction ¶
func DeactivateInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*DeactivateInstructionArgs, *DeactivateInstructionAccounts, error)
func GetStateAddress ¶
func GetStateAddress(args *GetStateAddressArgs) (ed25519.PublicKey, uint8, error)
func GetVaultAddress ¶
func GetVaultAddress(args *GetVaultAddressArgs) (ed25519.PublicKey, uint8, error)
func InitializeInstructionFromBinary ¶
func InitializeInstructionFromBinary(data []byte) (*InitializeInstructionArgs, *InitializeInstructionAccounts, error)
func RevokeLockWithAuthorityFromLegacyInstruction ¶
func RevokeLockWithAuthorityFromLegacyInstruction(txn solana.Transaction, idx int) (*RevokeLockWithAuthorityInstructionArgs, *RevokeLockWithAuthorityInstructionAccounts, error)
func RevokeLockWithAuthorityInstructionFromBinary ¶
func RevokeLockWithAuthorityInstructionFromBinary(data []byte) (*RevokeLockWithAuthorityInstructionArgs, *RevokeLockWithAuthorityInstructionAccounts, error)
func WithdrawInstructionFromBinary ¶
func WithdrawInstructionFromBinary(data []byte) (*WithdrawInstructionArgs, *WithdrawInstructionAccounts, error)
func WithdrawInstructionFromLegacyInstruction ¶
func WithdrawInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*WithdrawInstructionArgs, *WithdrawInstructionAccounts, error)
Types ¶
type AccountMeta ¶
AccountMeta represents the account information required for building transactions.
type CloseAccountsInstructionArgs ¶
type CloseAccountsInstructionArgs struct {
TimelockBump uint8
}
type DeactivateInstructionArgs ¶
type DeactivateInstructionArgs struct {
TimelockBump uint8
}
type GetStateAddressArgs ¶
type GetVaultAddressArgs ¶
type InitializeInstructionArgs ¶
type InitializeInstructionArgs struct {
UnlockDuration uint64
}
type Instruction ¶
type Instruction struct { Program ed25519.PublicKey Accounts []AccountMeta Data []byte }
Instruction represents a transaction instruction.
func NewBurnDustWithAuthorityInstruction ¶
func NewBurnDustWithAuthorityInstruction( accounts *BurnDustWithAuthorityInstructionAccounts, args *BurnDustWithAuthorityInstructionArgs, ) Instruction
func NewCloseAccountsInstruction ¶
func NewCloseAccountsInstruction( accounts *CloseAccountsInstructionAccounts, args *CloseAccountsInstructionArgs, ) Instruction
func NewDeactivateInstruction ¶
func NewDeactivateInstruction( accounts *DeactivateInstructionAccounts, args *DeactivateInstructionArgs, ) Instruction
func NewInitializeInstruction ¶
func NewInitializeInstruction( accounts *InitializeInstructionAccounts, args *InitializeInstructionArgs, ) Instruction
func NewRevokeLockWithAuthorityInstruction ¶
func NewRevokeLockWithAuthorityInstruction( accounts *RevokeLockWithAuthorityInstructionAccounts, args *RevokeLockWithAuthorityInstructionArgs, ) Instruction
func NewWithdrawInstruction ¶
func NewWithdrawInstruction( accounts *WithdrawInstructionAccounts, args *WithdrawInstructionArgs, ) Instruction
func (Instruction) ToLegacyInstruction ¶
func (i Instruction) ToLegacyInstruction() solana.Instruction
type RevokeLockWithAuthorityInstructionArgs ¶
type RevokeLockWithAuthorityInstructionArgs struct {
TimelockBump uint8
}
type TimelockAccount ¶
type TimelockAccount struct { DataVersion TimelockDataVersion PdaVersion TimelockPdaVersion InitOffset uint8 Nonce ed25519.PublicKey TimeAuthority ed25519.PublicKey CloseAuthority ed25519.PublicKey Mint ed25519.PublicKey Vault ed25519.PublicKey VaultBump uint8 VaultState TimelockState VaultOwner ed25519.PublicKey UnlockDuration uint64 UnlockAt *uint64 // optional LockedAt *uint64 // optional PdaPadding [ed25519.PublicKeySize]byte }
Arguments used to create {@link TimelockAccount}
func NewTimelockAccount ¶
func NewTimelockAccount( dataVersion TimelockDataVersion, pdaVersion TimelockPdaVersion, initOffset uint8, nonce ed25519.PublicKey, timeAuthority ed25519.PublicKey, closeAuthority ed25519.PublicKey, mint ed25519.PublicKey, vault ed25519.PublicKey, vaultBump uint8, vaultState TimelockState, vaultOwner ed25519.PublicKey, unlockDuration uint64, unlockAt *uint64, lockedAt *uint64, ) *TimelockAccount
Holds the data for the {@link TimelockAccount} Account and provides de/serialization functionality for that data
func (*TimelockAccount) Clone ¶
func (obj *TimelockAccount) Clone() *TimelockAccount
Clones a {@link TimelockAccount} instance.
func (*TimelockAccount) Marshal ¶
func (obj *TimelockAccount) Marshal() []byte
Serializes the {@link TimelockAccount} into a Buffer. @returns the created []byte buffer
func (*TimelockAccount) ToString ¶
func (obj *TimelockAccount) ToString() string
func (*TimelockAccount) Unmarshal ¶
func (obj *TimelockAccount) Unmarshal(data []byte) error
Deserializes the {@link TimelockAccount} from the provided data Buffer. @returns an error if the deserialize operation was unsuccessful.
type TimelockDataVersion ¶
type TimelockDataVersion uint8
const ( UnknownDataVersion TimelockDataVersion = iota DataVersion1 )
type TimelockPdaVersion ¶
type TimelockPdaVersion uint8
const ( UnknownPdaVersion TimelockPdaVersion = iota PdaVersion1 )
type TimelockState ¶
type TimelockState uint8
const ( Unknown TimelockState = iota Unlocked WaitingForTimeout Locked Closed )
func (TimelockState) String ¶
func (s TimelockState) String() string
type TimelockTokenError ¶
type TimelockTokenError uint32
const ( // Invalid timelock state for this instruction ErrInvalidTimelockState TimelockTokenError = iota + 0x1770 // Invalid timelock duration provided ErrInvalidTimelockDuration // Invalid vault account ErrInvalidVaultAccount // The timelock period has not yet been reached ErrInsufficientTimeElapsed // Insufficient vault funds ErrInsufficientVaultBalance // Invalid time authority ErrInvalidTimeAuthority // Invalid vault owner ErrInvalidVaultOwner // Invalid close authority ErrInvalidCloseAuthority // Invalid token balance. Token balance must be zero. ErrNonZeroTokenBalance )
type WithdrawInstructionArgs ¶
type WithdrawInstructionArgs struct {
TimelockBump uint8
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.