cvm

package
v1.10.21-0...-9c8923f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRelayStateDepth   = 63
	DefaultRelayHistoryItems = 32

	MaxRelayAccountNameSize = 32
)
View Source
const (
	DefaultCompressedStateDepth = 20

	MaxStorageAccountNameSize = 32
)
View Source
const (
	AirdropVirtrualInstructionDataSize = (SignatureSize +
		8 +
		1) // count
)
View Source
const (
	CodeVmAccountSize = (8 +
		32 +
		32 +
		8 +
		HashSize +
		TokenPoolSize +
		1 +
		1 +
		5) // padding
)
View Source
const (
	CompressInstructionArgsSize = (2 +
		SignatureSize) // signature
)
View Source
const (
	ConditionalTransferVirtrualInstructionDataSize = (SignatureSize +
		8) // amount
)
View Source
const (
	DepositInstructionArgsSize = (2 +
		8 +
		1) // bump
)
View Source
const (
	ExternalRelayVirtrualInstructionDataSize = (8 +
		HashSize +
		HashSize +
		HashSize) // commitment
)
View Source
const (
	ExternalTransferVirtrualInstructionDataSize = (SignatureSize +
		8) // amount
)
View Source
const (
	ExternalWithdrawVirtrualInstructionDataSize = SignatureSize // signature
)
View Source
const HashSize = 32
View Source
const (
	InitMemoryInstructionArgsSize = (MaxMemoryAccountNameLength +
		4 +
		2 +
		1) // vm_memory_bump
)
View Source
const (
	InitNonceInstructionArgsSize = 2 // account_index
)
View Source
const (
	InitRelayInstructionArgsSize = (MaxRelayAccountNameSize +
		1 +
		1) // relay_vault_bump
)
View Source
const (
	InitStorageInstructionArgsSize = (MaxStorageAccountNameLength +
		1) // vm_storage_bump
)
View Source
const (
	InitTimelockInstructionArgsSize = (2 +
		1 +
		1 +
		1) // vm_unlock_pda_bump
)
View Source
const (
	InitUnlockInstructionArgsSize = 0
)
View Source
const (
	InitVmInstructionArgsSize = (1 +
		1 +
		1) // vm_omnibus_bump
)
View Source
const (
	ItemStateSize = 1
)
View Source
const (
	MaxMemoryAccountNameLength = 32
)
View Source
const (
	MaxStorageAccountNameLength = 32
)
View Source
const MemoryAccountSize = (8 +
	32 +
	MaxMemoryAccountNameLength +
	1 +
	1 +
	2 +

	4) // num_accounts
View Source
const (
	MemoryV0NumAccounts = 32_000
)
View Source
const (
	MinDecompressInstructionArgsSize = (8 +
		2 +
		4 +
		4 +
		SignatureSize) // signature
)
View Source
const (
	RelaySaveRecentRootInstructionArgsSize = 0
)
View Source
const (
	RelayVirtrualInstructionDataSize = (8 +
		HashSize +
		HashSize +
		HashSize) // commitment
)
View Source
const (
	ResizeMemoryInstructionArgsSize = 4 // account_size
)
View Source
const SignatureSize = 64
View Source
const (
	TimelockDataVersion1 = 3
)
View Source
const (
	TokenPoolSize = (32 +
		1) // vault_bump
)
View Source
const (
	TransferVirtrualInstructionDataSize = (SignatureSize +
		8) // amount
)
View Source
const (
	UnlockStateAccountSize = (8 +
		32 +
		32 +
		32 +
		1 +
		1 +
		6) // padding
)
View Source
const VirtualDurableNonceSize = (32 +

	32) // hash
View Source
const VirtualRelayAccountSize = (32 +

	32) // destination
View Source
const VirtualTimelockAccountSize = (32 +
	32 +
	1 +
	1 +
	1 +
	8 +

	1) // bump
View Source
const (
	WithdrawVirtrualInstructionDataSize = SignatureSize // signature
)

Variables

View Source
var (
	CodeVmPrefix            = []byte("code_vm")
	VmOmnibusPrefix         = []byte("vm_omnibus")
	VmMemoryPrefix          = []byte("vm_memory_account")
	VmStoragePrefix         = []byte("vm_storage_account")
	VmDurableNoncePrefix    = []byte("vm_durable_nonce")
	VmUnlockPdaPrefix       = []byte("vm_unlock_pda_account")
	VmWithdrawReceiptPrefix = []byte("vm_withdraw_receipt_account")
	VmDepositPdaPrefix      = []byte("vm_deposit_pda")
	VmRelayPrefix           = []byte("vm_relay_account")
	VmRelayProofPrefix      = []byte("vm_proof_account")
	VmRelayVaultPrefix      = []byte("vm_relay_vault")
	VmRelayCommitmentPrefix = []byte("relay_commitment")
	VmTimelockStatePrefix   = []byte("timelock_state")
	VmTimelockVaultPrefix   = []byte("timelock_vault")
)
View Source
var (
	ErrInvalidProgram            = errors.New("invalid program id")
	ErrInvalidAccountData        = errors.New("unexpected account data")
	ErrInvalidVirtualAccountData = errors.New("unexpected virtual account data")
	ErrInvalidVirtualAccountType = errors.New("unexpected virtual account type")
	ErrInvalidInstructionData    = errors.New("unexpected instruction data")
)
View Source
var (
	PROGRAM_ADDRESS = mustBase58Decode("vmZ1WUq8SxjBWcaeTCvgJRZbS84R61uniFsQy5YMRTJ")
	PROGRAM_ID      = ed25519.PublicKey(PROGRAM_ADDRESS)
)
View Source
var (
	SYSTEM_PROGRAM_ID    = ed25519.PublicKey(mustBase58Decode("11111111111111111111111111111111"))
	SPL_TOKEN_PROGRAM_ID = ed25519.PublicKey(mustBase58Decode("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"))
	TIMELOCK_PROGRAM_ID  = ed25519.PublicKey(mustBase58Decode("time2Z2SCnn3qYg3ULKVtdkh8YmZ5jFdKicnA1W2YnJ"))
	SPLITTER_PROGRAM_ID  = ed25519.PublicKey(mustBase58Decode("spLit2eb13Tz93if6aJM136nUWki5PVUsoEjcUjwpwW"))

	SYSVAR_RENT_PUBKEY = ed25519.PublicKey(mustBase58Decode("SysvarRent111111111111111111111111111111111"))
)
View Source
var CodeVmAccountDiscriminator = []byte{byte(AccountTypeCodeVm), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
View Source
var MemoryAccountDiscriminator = []byte{byte(AccountTypeMemory), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
View Source
var (
	MerkleTreePrefix = []byte("merkletree")
)
View Source
var RelayAccountDiscriminator = []byte{byte(AccountTypeRelay), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
View Source
var UnlockStateAccountDiscriminator = []byte{byte(AccountTypeUnlockState), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

Functions

func GetDecompressInstructionArgsSize

func GetDecompressInstructionArgsSize(args *DecompressInstructionArgs) int

func GetMemoryAccountAddress

func GetMemoryAccountAddress(args *GetMemoryAccountAddressArgs) (ed25519.PublicKey, uint8, error)

func GetMerkleTreeSize

func GetMerkleTreeSize(levels int) int

func GetPageSizeFromMemoryLayout

func GetPageSizeFromMemoryLayout(layout MemoryLayout) uint32

func GetRecentRootsSize

func GetRecentRootsSize(length int) int

func GetRelayAccountAddress

func GetRelayAccountAddress(args *GetRelayAccountAddressArgs) (ed25519.PublicKey, uint8, error)

func GetRelayCommitmentAddress

func GetRelayCommitmentAddress(args *GetRelayCommitmentAddressArgs) (ed25519.PublicKey, uint8, error)

func GetRelayDestinationAddress

func GetRelayDestinationAddress(args *GetRelayDestinationAddressArgs) (ed25519.PublicKey, uint8, error)

func GetRelayProofAddress

func GetRelayProofAddress(args *GetRelayProofAddressArgs) (ed25519.PublicKey, uint8, error)

func GetSliceAllocatorSize

func GetSliceAllocatorSize(capacity, itemSize int) int

func GetStorageAccountAddress

func GetStorageAccountAddress(args *GetMemoryAccountAddressArgs) (ed25519.PublicKey, uint8, error)

func GetVirtualAccountSize

func GetVirtualAccountSize(accountType VirtualAccountType) uint32

func GetVirtualAccountSizeInMemory

func GetVirtualAccountSizeInMemory(accountType VirtualAccountType) uint32

func GetVmAddress

func GetVmAddress(args *GetVmAddressArgs) (ed25519.PublicKey, uint8, error)

func GetVmDepositAddress

func GetVmDepositAddress(args *GetVmDepositAddressArgs) (ed25519.PublicKey, uint8, error)

func GetVmObnibusAddress

func GetVmObnibusAddress(args *GetVmObnibusAddressArgs) (ed25519.PublicKey, uint8, error)

func NewCompressInstruction

func NewCompressInstruction(
	accounts *CompressInstructionAccounts,
	args *CompressInstructionArgs,
) solana.Instruction

func NewDepositInstruction

func NewDepositInstruction(
	accounts *DepositInstructionAccounts,
	args *DepositInstructionArgs,
) solana.Instruction

func NewExecInstruction

func NewExecInstruction(
	accounts *ExecInstructionAccounts,
	args *ExecInstructionArgs,
) solana.Instruction

func NewInitVmInstruction

func NewInitVmInstruction(
	accounts *InitVmInstructionAccounts,
	args *InitVmInstructionArgs,
) solana.Instruction

Types

type AccountType

type AccountType uint8
const (
	AccountTypeUnknown AccountType = iota
	AccountTypeCodeVm
	AccountTypeMemory
	AccountTypeStorage
	AccountTypeRelay
	AccountTypeUnlockState
	AccountTypeWithdrawReceipt
)

type AirdropVirtualInstructionArgs

type AirdropVirtualInstructionArgs struct {
	Amount    uint64
	Count     uint8
	Signature Signature
}

type CodeInstruction

type CodeInstruction uint8
const (
	Unknown CodeInstruction = iota

	CodeInstructionInitVm
	CodeInstructionInitMemory
	CodeInstructionInitStorage
	CodeInstructionInitRelay
	CodeInstructionInitNonce
	CodeInstructionInitTimelock
	CodeInstructionInitUnlock

	CodeInstructionExec
	CodeInstructionCompress
	CodeInstructionDecompress

	CodeInstructionResizeMemory
	CodeInstructionSnapshot

	CodeInstructionDeposit
	CodeInstructionWithdraw
	CodeInstructionUnlockI
)

type CodeVmAccount

type CodeVmAccount struct {
	Authority    ed25519.PublicKey
	Mint         ed25519.PublicKey
	Slot         uint64
	Poh          Hash
	Omnibus      TokenPool
	LockDuration uint8
	Bump         uint8
}

func (*CodeVmAccount) String

func (obj *CodeVmAccount) String() string

func (*CodeVmAccount) Unmarshal

func (obj *CodeVmAccount) Unmarshal(data []byte) error

type CompactMessage

type CompactMessage Hash

func GetCompactAirdropMessage

func GetCompactAirdropMessage(args *GetCompactAirdropMessageArgs) CompactMessage

func GetCompactTransferMessage

func GetCompactTransferMessage(args *GetCompactTransferMessageArgs) CompactMessage

func GetCompactWithdrawMessage

func GetCompactWithdrawMessage(args *GetCompactWithdrawMessageArgs) CompactMessage

type CompressInstructionAccounts

type CompressInstructionAccounts struct {
	VmAuthority ed25519.PublicKey
	Vm          ed25519.PublicKey
	VmMemory    ed25519.PublicKey
	VmStorage   ed25519.PublicKey
}

type CompressInstructionArgs

type CompressInstructionArgs struct {
	AccountIndex uint16
	Signature    Signature
}

type ConditionalTransferVirtualInstructionArgs

type ConditionalTransferVirtualInstructionArgs struct {
	Amount    uint64
	Signature Signature
}

type DecompressInstructionAccounts

type DecompressInstructionAccounts struct {
	VmAuthority     ed25519.PublicKey
	Vm              ed25519.PublicKey
	VmMemory        ed25519.PublicKey
	VmStorage       ed25519.PublicKey
	UnlockPda       *ed25519.PublicKey
	WithdrawReceipt *ed25519.PublicKey
}

type DecompressInstructionArgs

type DecompressInstructionArgs struct {
	AccountIndex uint16
	PackedVa     []uint8
	Proof        HashArray
	Signature    Signature
}

type DepositInstructionAccounts

type DepositInstructionAccounts struct {
	VmAuthority ed25519.PublicKey
	Vm          ed25519.PublicKey
	VmMemory    ed25519.PublicKey
	Depositor   ed25519.PublicKey
	DepositPda  ed25519.PublicKey
	DepositAta  ed25519.PublicKey
	VmOmnibus   ed25519.PublicKey
}

type DepositInstructionArgs

type DepositInstructionArgs struct {
	AccountIndex uint16
	Amount       uint64
	Bump         uint8
}

type ExecArgsAndAccounts

type ExecArgsAndAccounts struct {
	Args     ExecInstructionArgs
	Accounts ExecInstructionAccounts
}

type ExecInstructionAccounts

type ExecInstructionAccounts struct {
	VmAuthority     ed25519.PublicKey
	Vm              ed25519.PublicKey
	VmMemA          *ed25519.PublicKey
	VmMemB          *ed25519.PublicKey
	VmMemC          *ed25519.PublicKey
	VmMemD          *ed25519.PublicKey
	VmOmnibus       *ed25519.PublicKey
	VmRelay         *ed25519.PublicKey
	VmRelayVault    *ed25519.PublicKey
	ExternalAddress *ed25519.PublicKey
}

type ExecInstructionArgs

type ExecInstructionArgs struct {
	Opcode     Opcode
	MemIndices []uint16
	MemBanks   []uint8
	Data       []uint8
}

type ExternalRelayVirtualInstructionArgs

type ExternalRelayVirtualInstructionArgs struct {
	Amount     uint64
	Transcript Hash
	RecentRoot Hash
	Commitment Hash
}

type ExternalTransferVirtualInstructionArgs

type ExternalTransferVirtualInstructionArgs struct {
	Amount    uint64
	Signature Signature
}

type ExternalWithdrawVirtualInstructionArgs

type ExternalWithdrawVirtualInstructionArgs struct {
	Signature Signature
}

type GetCompactAirdropMessageArgs

type GetCompactAirdropMessageArgs struct {
	Source       ed25519.PublicKey
	Destinations []ed25519.PublicKey
	Amount       uint64
	NonceAddress ed25519.PublicKey
	NonceValue   Hash
}

type GetCompactTransferMessageArgs

type GetCompactTransferMessageArgs struct {
	Source       ed25519.PublicKey
	Destination  ed25519.PublicKey
	Amount       uint64
	NonceAddress ed25519.PublicKey
	NonceValue   Hash
}

type GetCompactWithdrawMessageArgs

type GetCompactWithdrawMessageArgs struct {
	Source       ed25519.PublicKey
	Destination  ed25519.PublicKey
	NonceAddress ed25519.PublicKey
	NonceValue   Hash
}

type GetMemoryAccountAddressArgs

type GetMemoryAccountAddressArgs struct {
	Name string
	Vm   ed25519.PublicKey
}

type GetRelayAccountAddressArgs

type GetRelayAccountAddressArgs struct {
	Name string
	Vm   ed25519.PublicKey
}

type GetRelayCommitmentAddressArgs

type GetRelayCommitmentAddressArgs struct {
	Relay       ed25519.PublicKey
	MerkleRoot  Hash
	Transcript  Hash
	Destination ed25519.PublicKey
	Amount      uint64
}

type GetRelayDestinationAddressArgs

type GetRelayDestinationAddressArgs struct {
	RelayOrProof ed25519.PublicKey
}

type GetRelayProofAddressArgs

type GetRelayProofAddressArgs struct {
	Relay      ed25519.PublicKey
	MerkleRoot Hash
	Commitment Hash
}

type GetStorageAccountAddressArgs

type GetStorageAccountAddressArgs struct {
	Name string
	Vm   ed25519.PublicKey
}

type GetVirtualDurableNonceAddressArgs

type GetVirtualDurableNonceAddressArgs struct {
	Seed ed25519.PublicKey
	Poh  Hash
	Vm   ed25519.PublicKey
}

type GetVirtualTimelockAccountAddressArgs

type GetVirtualTimelockAccountAddressArgs struct {
	Mint         ed25519.PublicKey
	VmAuthority  ed25519.PublicKey
	Owner        ed25519.PublicKey
	LockDuration uint8
}

type GetVirtualTimelockVaultAddressArgs

type GetVirtualTimelockVaultAddressArgs struct {
	VirtualTimelock ed25519.PublicKey
}

type GetVmAddressArgs

type GetVmAddressArgs struct {
	Mint         ed25519.PublicKey
	VmAuthority  ed25519.PublicKey
	LockDuration uint8
}

type GetVmDepositAddressArgs

type GetVmDepositAddressArgs struct {
	Depositor ed25519.PublicKey
	Vm        ed25519.PublicKey
}

type GetVmObnibusAddressArgs

type GetVmObnibusAddressArgs struct {
	Vm ed25519.PublicKey
}

type GetVmUnlockStateAccountAddressArgs

type GetVmUnlockStateAccountAddressArgs struct {
	VirtualAccountOwner ed25519.PublicKey
	VirtualAccount      ed25519.PublicKey
	Vm                  ed25519.PublicKey
}

type GetWithdrawReceiptAccountAddressArgs

type GetWithdrawReceiptAccountAddressArgs struct {
	UnlockAccount ed25519.PublicKey
	Nonce         Hash
	Vm            ed25519.PublicKey
}

type Hash

type Hash [HashSize]byte

func (Hash) String

func (h Hash) String() string

type HashArray

type HashArray []Hash

func (HashArray) String

func (h HashArray) String() string

type InitMemoryInstructionAccounts

type InitMemoryInstructionAccounts struct {
	VmAuthority ed25519.PublicKey
	Vm          ed25519.PublicKey
	VmMemory    ed25519.PublicKey
}

type InitMemoryInstructionArgs

type InitMemoryInstructionArgs struct {
	Name         string
	NumAccounts  uint32
	AccountSize  uint16
	VmMemoryBump uint8
}

type InitNonceInstructionAccounts

type InitNonceInstructionAccounts struct {
	VmAuthority         ed25519.PublicKey
	Vm                  ed25519.PublicKey
	VmMemory            ed25519.PublicKey
	VirtualAccountOwner ed25519.PublicKey
}

type InitNonceInstructionArgs

type InitNonceInstructionArgs struct {
	AccountIndex uint16
}

type InitRelayInstructionAccounts

type InitRelayInstructionAccounts struct {
	VmAuthority ed25519.PublicKey
	Vm          ed25519.PublicKey
	Relay       ed25519.PublicKey
	RelayVault  ed25519.PublicKey
	Mint        ed25519.PublicKey
}

type InitRelayInstructionArgs

type InitRelayInstructionArgs struct {
	Name           string
	RelayBump      uint8
	RelayVaultBump uint8
}

type InitStorageInstructionAccounts

type InitStorageInstructionAccounts struct {
	VmAuthority ed25519.PublicKey
	Vm          ed25519.PublicKey
	VmStorage   ed25519.PublicKey
}

type InitStorageInstructionArgs

type InitStorageInstructionArgs struct {
	Name          string
	VmStorageBump uint8
}

type InitTimelockInstructionAccounts

type InitTimelockInstructionAccounts struct {
	VmAuthority         ed25519.PublicKey
	Vm                  ed25519.PublicKey
	VmMemory            ed25519.PublicKey
	VirtualAccountOwner ed25519.PublicKey
}

type InitTimelockInstructionArgs

type InitTimelockInstructionArgs struct {
	AccountIndex        uint16
	VirtualTimelockBump uint8
	VirtualVaultBump    uint8
	VmUnlockPdaBump     uint8
}

type InitUnlockInstructionAccounts

type InitUnlockInstructionAccounts struct {
	AccountOwner ed25519.PublicKey
	Payer        ed25519.PublicKey
	Vm           ed25519.PublicKey
	UnlockState  ed25519.PublicKey
}

type InitUnlockInstructionArgs

type InitUnlockInstructionArgs struct {
}

type InitVmInstructionAccounts

type InitVmInstructionAccounts struct {
	VmAuthority ed25519.PublicKey
	Vm          ed25519.PublicKey
	VmOmnibus   ed25519.PublicKey
	Mint        ed25519.PublicKey
}

type InitVmInstructionArgs

type InitVmInstructionArgs struct {
	LockDuration  uint8
	VmBump        uint8
	VmOmnibusBump uint8
}

type ItemState

type ItemState uint8
const (
	ItemStateEmpty ItemState = iota
	ItemStateAllocated
)

func (ItemState) String

func (obj ItemState) String() string

type ItemStateArray

type ItemStateArray []ItemState

func (ItemStateArray) String

func (obj ItemStateArray) String() string

type MemoryAccount

type MemoryAccount struct {
	Vm          ed25519.PublicKey
	Name        string
	Bump        uint8
	Version     MemoryVersion
	AccountSize uint16
	NumAccounts uint32
}

func (*MemoryAccount) String

func (obj *MemoryAccount) String() string

func (*MemoryAccount) Unmarshal

func (obj *MemoryAccount) Unmarshal(data []byte) error

type MemoryAccountWithData

type MemoryAccountWithData struct {
	Vm          ed25519.PublicKey
	Name        string
	Bump        uint8
	Version     MemoryVersion
	AccountSize uint16
	NumAccounts uint32
	Data        SliceAllocator // todo: support other implementations
}

func (*MemoryAccountWithData) String

func (obj *MemoryAccountWithData) String() string

func (*MemoryAccountWithData) Unmarshal

func (obj *MemoryAccountWithData) Unmarshal(data []byte) error

type MemoryAllocator

type MemoryAllocator interface {
	IsAllocated(index int) bool

	Read(index int) ([]byte, bool)

	String() string
}

type MemoryLayout

type MemoryLayout uint8
const (
	MemoryLayoutUnknown MemoryLayout = iota
	MemoryLayoutTimelock
	MemoryLayoutNonce
	MemoryLayoutRelay
)

type MemoryVersion

type MemoryVersion uint8
const (
	MemoryVersionV0 MemoryVersion = iota
	MemoryVersionV1
)

type MerkleTree

type MerkleTree struct {
	Root           Hash
	FilledSubtrees HashArray
	ZeroValues     HashArray
	NextIndex      uint64
}

func (*MerkleTree) String

func (obj *MerkleTree) String() string

func (*MerkleTree) Unmarshal

func (obj *MerkleTree) Unmarshal(data []byte, levels int) error

type Message

type Message []byte

type Opcode

type Opcode uint8
const (
	OpcodeUnknown Opcode = 0

	OpcodeTransfer Opcode = 11
	OpcodeWithdraw Opcode = 14
	OpcodeRelay    Opcode = 21

	OpcodeExternalTransfer Opcode = 10
	OpcodeExternalWithdraw Opcode = 13
	OpcodeExternalRelay    Opcode = 20

	OpcodeConditionalTransfer Opcode = 12

	OpcodeAirdrop Opcode = 30
)

type RecentRoots

type RecentRoots struct {
	Items    HashArray
	Offset   uint8
	NumItems uint8
}

func (*RecentRoots) String

func (obj *RecentRoots) String() string

func (*RecentRoots) Unmarshal

func (obj *RecentRoots) Unmarshal(data []byte, length int) error

type RelayAccount

type RelayAccount struct {
	Vm   ed25519.PublicKey
	Name string

	Treasury   TokenPool
	Bump       uint8
	NumLevels  uint8
	NumHistory uint8

	History     MerkleTree
	RecentRoots RecentRoots
}

func (*RelayAccount) String

func (obj *RelayAccount) String() string

func (*RelayAccount) Unmarshal

func (obj *RelayAccount) Unmarshal(data []byte) error

type RelaySaveRecentRootInstructionAccounts

type RelaySaveRecentRootInstructionAccounts struct {
	VmAuthority ed25519.PublicKey
	Vm          ed25519.PublicKey
	Relay       ed25519.PublicKey
}

type RelaySaveRecentRootInstructionArgs

type RelaySaveRecentRootInstructionArgs struct {
}

type RelayVirtualInstructionArgs

type RelayVirtualInstructionArgs struct {
	Amount     uint64
	Transcript Hash
	RecentRoot Hash
	Commitment Hash
}

type ResizeMemoryInstructionAccounts

type ResizeMemoryInstructionAccounts struct {
	VmAuthority ed25519.PublicKey
	Vm          ed25519.PublicKey
	VmMemory    ed25519.PublicKey
}

type ResizeMemoryInstructionArgs

type ResizeMemoryInstructionArgs struct {
	AccountSize uint32
}

type Signature

type Signature [SignatureSize]byte

func (Signature) String

func (s Signature) String() string

type SliceAllocator

type SliceAllocator struct {
	State ItemStateArray
	Data  [][]byte
}

func (*SliceAllocator) IsAllocated

func (obj *SliceAllocator) IsAllocated(index int) bool

func (*SliceAllocator) Read

func (obj *SliceAllocator) Read(index int) ([]byte, bool)

func (*SliceAllocator) String

func (obj *SliceAllocator) String() string

func (*SliceAllocator) Unmarshal

func (obj *SliceAllocator) Unmarshal(data []byte, capacity, itemSize int) error

type TimelockState

type TimelockState uint8
const (
	TimelockStateUnknown TimelockState = iota
	TimelockStateUnlocked
	TimelockStateWaitingForTimeout
)

func (TimelockState) String

func (s TimelockState) String() string

type TokenPool

type TokenPool struct {
	Vault     ed25519.PublicKey
	VaultBump uint8
}

func (*TokenPool) String

func (obj *TokenPool) String() string

func (*TokenPool) Unmarshal

func (obj *TokenPool) Unmarshal(data []byte) error

type TransferVirtualInstructionArgs

type TransferVirtualInstructionArgs struct {
	Amount    uint64
	Signature Signature
}

type UnlockStateAccount

type UnlockStateAccount struct {
	Vm       ed25519.PublicKey
	Owner    ed25519.PublicKey
	Address  ed25519.PublicKey
	UnlockAt int64
	Bump     uint8
	State    TimelockState
}

func (*UnlockStateAccount) IsUnlocked

func (obj *UnlockStateAccount) IsUnlocked() bool

func (*UnlockStateAccount) String

func (obj *UnlockStateAccount) String() string

func (*UnlockStateAccount) Unmarshal

func (obj *UnlockStateAccount) Unmarshal(data []byte) error

type VirtualAccountType

type VirtualAccountType uint8
const (
	VirtualAccountTypeDurableNonce VirtualAccountType = iota
	VirtualAccountTypeTimelock
	VirtualAccountTypeRelay
)

func GetVirtualAccountTypeFromMemoryLayout

func GetVirtualAccountTypeFromMemoryLayout(layout MemoryLayout) (VirtualAccountType, error)

type VirtualDurableNonce

type VirtualDurableNonce struct {
	Address ed25519.PublicKey
	Value   Hash
}

func (*VirtualDurableNonce) Marshal

func (obj *VirtualDurableNonce) Marshal() []byte

func (*VirtualDurableNonce) String

func (obj *VirtualDurableNonce) String() string

func (*VirtualDurableNonce) UnmarshalDirectly

func (obj *VirtualDurableNonce) UnmarshalDirectly(data []byte) error

func (*VirtualDurableNonce) UnmarshalFromMemory

func (obj *VirtualDurableNonce) UnmarshalFromMemory(data []byte) error

type VirtualInstruction

type VirtualInstruction struct {
	Opcode Opcode
	Data   []byte
}

func NewAirdropVirtualInstruction

func NewAirdropVirtualInstruction(
	args *AirdropVirtualInstructionArgs,
) VirtualInstruction

func NewExternalRelayVirtualInstruction

func NewExternalRelayVirtualInstruction(
	args *ExternalRelayVirtualInstructionArgs,
) VirtualInstruction

func NewExternalTransferVirtualInstruction

func NewExternalTransferVirtualInstruction(
	args *TransferVirtualInstructionArgs,
) VirtualInstruction

func NewRelayVirtualInstruction

func NewRelayVirtualInstruction(
	args *RelayVirtualInstructionArgs,
) VirtualInstruction

func NewTransferVirtualInstruction

func NewTransferVirtualInstruction(
	args *TransferVirtualInstructionArgs,
) VirtualInstruction

func NewWithdrawVirtualInstruction

func NewWithdrawVirtualInstruction(
	args *WithdrawVirtualInstructionArgs,
) VirtualInstruction

type VirtualRelayAccount

type VirtualRelayAccount struct {
	Target      ed25519.PublicKey
	Destination ed25519.PublicKey
}

func (*VirtualRelayAccount) Marshal

func (obj *VirtualRelayAccount) Marshal() []byte

func (*VirtualRelayAccount) String

func (obj *VirtualRelayAccount) String() string

func (*VirtualRelayAccount) UnmarshalDirectly

func (obj *VirtualRelayAccount) UnmarshalDirectly(data []byte) error

func (*VirtualRelayAccount) UnmarshalFromMemory

func (obj *VirtualRelayAccount) UnmarshalFromMemory(data []byte) error

type VirtualTimelockAccount

type VirtualTimelockAccount struct {
	Owner ed25519.PublicKey
	Nonce Hash

	TokenBump    uint8
	UnlockBump   uint8
	WithdrawBump uint8

	Balance uint64
	Bump    uint8
}

func (*VirtualTimelockAccount) Marshal

func (obj *VirtualTimelockAccount) Marshal() []byte

func (*VirtualTimelockAccount) String

func (obj *VirtualTimelockAccount) String() string

func (*VirtualTimelockAccount) UnmarshalDirectly

func (obj *VirtualTimelockAccount) UnmarshalDirectly(data []byte) error

func (*VirtualTimelockAccount) UnmarshalFromMemory

func (obj *VirtualTimelockAccount) UnmarshalFromMemory(data []byte) error

type WithdrawVirtualInstructionArgs

type WithdrawVirtualInstructionArgs struct {
	Signature Signature
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL