Documentation ¶
Index ¶
- Constants
- Variables
- func ActivateInstructionFromBinary(data []byte) (*ActivateInstructionArgs, *ActivateInstructionAccounts, error)
- func BurnDustWithAuthorityInstructionFromBinary(data []byte) (*BurnDustWithAuthorityInstructionArgs, ...)
- func BurnDustWithAuthorityInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*BurnDustWithAuthorityInstructionArgs, ...)
- func CancelLockTimeoutInstructionFromBinary(data []byte) (*CancelLockTimeoutInstructionArgs, *CancelLockTimeoutInstructionAccounts, ...)
- 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 InitializeInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*InitializeInstructionArgs, *InitializeInstructionAccounts, error)
- func RevokeLockWithAuthorityFromLegacyInstruction(txn solana.Transaction, idx int) (*RevokeLockWithAuthorityInstructionArgs, ...)
- func RevokeLockWithAuthorityInstructionFromBinary(data []byte) (*RevokeLockWithAuthorityInstructionArgs, ...)
- func RevokeLockWithTimeoutInstructionFromBinary(data []byte) (*RevokeLockWithTimeoutInstructionArgs, ...)
- func TransferWithAuthorityInstructionFromBinary(data []byte) (*TransferWithAuthorityInstructionArgs, ...)
- func TransferWithAuthorityInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*TransferWithAuthorityInstructionArgs, ...)
- func WithdrawInstructionFromBinary(data []byte) (*WithdrawInstructionArgs, *WithdrawInstructionAccounts, error)
- func WithdrawInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*WithdrawInstructionArgs, *WithdrawInstructionAccounts, error)
- type AccountMeta
- type ActivateInstructionAccounts
- type ActivateInstructionArgs
- type BurnDustWithAuthorityInstructionAccounts
- type BurnDustWithAuthorityInstructionArgs
- type CancelLockTimeoutInstructionAccounts
- type CancelLockTimeoutInstructionArgs
- type CloseAccountsInstructionAccounts
- type CloseAccountsInstructionArgs
- type DeactivateInstructionAccounts
- type DeactivateInstructionArgs
- type GetStateAddressArgs
- type GetVaultAddressArgs
- type InitializeInstructionAccounts
- type InitializeInstructionArgs
- type Instruction
- func NewActivateInstruction(accounts *ActivateInstructionAccounts, args *ActivateInstructionArgs) Instruction
- func NewBurnDustWithAuthorityInstruction(accounts *BurnDustWithAuthorityInstructionAccounts, ...) Instruction
- func NewCancelLockTimeoutInstruction(accounts *CancelLockTimeoutInstructionAccounts, ...) 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 NewRevokeLockWithTimeoutInstruction(accounts *RevokeLockWithTimeoutInstructionAccounts, ...) Instruction
- func NewTransferWithAuthorityInstruction(accounts *TransferWithAuthorityInstructionAccounts, ...) Instruction
- func NewWithdrawInstruction(accounts *WithdrawInstructionAccounts, args *WithdrawInstructionArgs) Instruction
- type RevokeLockWithAuthorityInstructionAccounts
- type RevokeLockWithAuthorityInstructionArgs
- type RevokeLockWithTimeoutInstructionAccounts
- type RevokeLockWithTimeoutInstructionArgs
- type TimeLockTokenError
- type TimelockAccount
- type TimelockDataVersion
- type TimelockState
- type TransferWithAuthorityInstructionAccounts
- type TransferWithAuthorityInstructionArgs
- type WithdrawInstructionAccounts
- type WithdrawInstructionArgs
Constants ¶
View Source
const ( ActivateInstructionArgsSize = (1 + 8) // UnlockDuration ActivateInstructionAccountsSize = (32 + 32 + 32) // payer ActivateInstructionSize = (8 + ActivateInstructionArgsSize + ActivateInstructionAccountsSize) // accounts )
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 ( CancelLockTimeoutInstructionArgsSize = (1) // TimelockBump CancelLockTimeoutInstructionAccountsSize = (32 + 32 + 32 + 32) // systemProgram CancelLockTimeoutInstructionSize = (8 + CancelLockTimeoutInstructionArgsSize + CancelLockTimeoutInstructionAccountsSize) // 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 = (1) // numDaysLocked InitializeInstructionAccountsSize = (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 ( RevokeLockWithTimeoutInstructionArgsSize = (1) // TimelockBump RevokeLockWithTimeoutInstructionAccountsSize = (32 + 32 + 32 + 32) // payer RevokeLockWithTimeoutInstructionSize = (8 + RevokeLockWithTimeoutInstructionArgsSize + RevokeLockWithTimeoutInstructionAccountsSize) // accounts )
View Source
const ( TransferWithAuthorityInstructionArgsSize = (1 + 8) // amount TransferWithAuthorityInstructionAccountsSize = (32 + 32 + 32 + 32 + 32 + 32 + 32 + 32) // systemProgram TransferWithAuthorityInstructionSize = (8 + TransferWithAuthorityInstructionArgsSize + TransferWithAuthorityInstructionAccountsSize) // 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. DefaultNumDaysLocked = uint8(21) )
View Source
const TimelockAccountSize = (8 + 1 + 32 + 32 + 32 + 32 + 1 + 1 + 32 + 9 + 1) // num_days_locked
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("time2Z2SCnn3qYg3ULKVtdkh8YmZ5jFdKicnA1W2YnJ") 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 ActivateInstructionFromBinary ¶
func ActivateInstructionFromBinary(data []byte) (*ActivateInstructionArgs, *ActivateInstructionAccounts, error)
func BurnDustWithAuthorityInstructionFromBinary ¶
func BurnDustWithAuthorityInstructionFromBinary(data []byte) (*BurnDustWithAuthorityInstructionArgs, *BurnDustWithAuthorityInstructionAccounts, error)
func BurnDustWithAuthorityInstructionFromLegacyInstruction ¶
func BurnDustWithAuthorityInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*BurnDustWithAuthorityInstructionArgs, *BurnDustWithAuthorityInstructionAccounts, error)
func CancelLockTimeoutInstructionFromBinary ¶
func CancelLockTimeoutInstructionFromBinary(data []byte) (*CancelLockTimeoutInstructionArgs, *CancelLockTimeoutInstructionAccounts, 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 InitializeInstructionFromLegacyInstruction ¶
func InitializeInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*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 RevokeLockWithTimeoutInstructionFromBinary ¶
func RevokeLockWithTimeoutInstructionFromBinary(data []byte) (*RevokeLockWithTimeoutInstructionArgs, *RevokeLockWithTimeoutInstructionAccounts, error)
func TransferWithAuthorityInstructionFromBinary ¶
func TransferWithAuthorityInstructionFromBinary(data []byte) (*TransferWithAuthorityInstructionArgs, *TransferWithAuthorityInstructionAccounts, error)
func TransferWithAuthorityInstructionFromLegacyInstruction ¶
func TransferWithAuthorityInstructionFromLegacyInstruction(txn solana.Transaction, idx int) (*TransferWithAuthorityInstructionArgs, *TransferWithAuthorityInstructionAccounts, 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 ActivateInstructionArgs ¶
type CancelLockTimeoutInstructionArgs ¶
type CancelLockTimeoutInstructionArgs struct {
TimelockBump uint8
}
type CloseAccountsInstructionArgs ¶
type CloseAccountsInstructionArgs struct {
TimelockBump uint8
}
type DeactivateInstructionArgs ¶
type DeactivateInstructionArgs struct {
TimelockBump uint8
}
type GetStateAddressArgs ¶
type GetVaultAddressArgs ¶
type GetVaultAddressArgs struct { State ed25519.PublicKey DataVersion TimelockDataVersion }
type InitializeInstructionArgs ¶
type InitializeInstructionArgs struct {
NumDaysLocked uint8
}
type Instruction ¶
type Instruction struct { Program ed25519.PublicKey Accounts []AccountMeta Data []byte }
Instruction represents a transaction instruction.
func NewActivateInstruction ¶
func NewActivateInstruction( accounts *ActivateInstructionAccounts, args *ActivateInstructionArgs, ) Instruction
func NewBurnDustWithAuthorityInstruction ¶
func NewBurnDustWithAuthorityInstruction( accounts *BurnDustWithAuthorityInstructionAccounts, args *BurnDustWithAuthorityInstructionArgs, ) Instruction
func NewCancelLockTimeoutInstruction ¶
func NewCancelLockTimeoutInstruction( accounts *CancelLockTimeoutInstructionAccounts, args *CancelLockTimeoutInstructionArgs, ) 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 NewRevokeLockWithTimeoutInstruction ¶
func NewRevokeLockWithTimeoutInstruction( accounts *RevokeLockWithTimeoutInstructionAccounts, args *RevokeLockWithTimeoutInstructionArgs, ) Instruction
func NewTransferWithAuthorityInstruction ¶
func NewTransferWithAuthorityInstruction( accounts *TransferWithAuthorityInstructionAccounts, args *TransferWithAuthorityInstructionArgs, ) 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 RevokeLockWithTimeoutInstructionArgs ¶
type RevokeLockWithTimeoutInstructionArgs struct {
TimelockBump uint8
}
type TimeLockTokenError ¶
type TimeLockTokenError uint32
const ( // Invalid time-lock state for this instruction ErrInvalidTimeLockState TimeLockTokenError = iota + 0x1770 // Invalid time-lock duration provided ErrInvalidTimeLockDuration // Invalid vault account ErrInvalidVaultAccount // The time-lock 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 // Invalid dust burn ErrInvalidDustBurn // Invalid token mint ErrInvalidTokenMint )
type TimelockAccount ¶
type TimelockAccount struct { DataVersion TimelockDataVersion TimeAuthority ed25519.PublicKey CloseAuthority ed25519.PublicKey Mint ed25519.PublicKey Vault ed25519.PublicKey VaultBump uint8 VaultState TimelockState VaultOwner ed25519.PublicKey UnlockAt *uint64 // optional NumDaysLocked uint8 }
Arguments used to create {@link TimelockAccount}
func NewTimeLockAccount ¶
func NewTimeLockAccount( dataVersion TimelockDataVersion, timeAuthority ed25519.PublicKey, closeAuthority ed25519.PublicKey, mint ed25519.PublicKey, vault ed25519.PublicKey, vaultBump uint8, vaultState TimelockState, vaultOwner ed25519.PublicKey, unlockAt *uint64, numDaysLocked uint8, ) *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 DataVersionLegacy DataVersionClosed DataVersion1 )
type TimelockState ¶
type TimelockState uint8
const ( StateUnknown TimelockState = iota StateUnlocked StateWaitingForTimeout StateLocked StateClosed )
func (TimelockState) String ¶
func (s TimelockState) String() string
type WithdrawInstructionArgs ¶
type WithdrawInstructionArgs struct {
TimelockBump uint8
}
Source Files ¶
- accounts.go
- address.go
- constants.go
- errors.go
- instruction_activate.go
- instruction_burndustwithauthority.go
- instruction_cancellocktimeout.go
- instruction_closeAccounts.go
- instruction_deactivate.go
- instruction_initialize.go
- instruction_revokelockwithauthority.go
- instruction_revokelockwithtimeout.go
- instruction_transferwithauthority.go
- instruction_withdraw.go
- legacy.go
- program.go
- types.go
- utils.go
Click to show internal directories.
Click to hide internal directories.