coder

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitializeInstruction          = 0
	Initialize2Instruction         = 1
	MonitorStepInstruction         = 2
	DepositInstruction             = 3
	WithdrawInstruction            = 4
	MigrateToOpenBookInstruction   = 5
	SetParamsInstruction           = 6
	WithdrawPnlInstruction         = 7
	WithdrawSrmInstruction         = 8
	SwapBaseInInstruction          = 9
	PreInitializeInstruction       = 10
	SwapBaseOutInstruction         = 11
	SimulateInfoInstruction        = 12
	AdminCancelOrdersInstruction   = 13
	CreateConfigAccountInstruction = 14
	UpdateConfigAccountInstruction = 15
)

Variables

This section is empty.

Functions

func DecodeData

func DecodeData[T any](data []byte) (T, error)

Types

type AdminCancelOrders

type AdminCancelOrders struct {
	Limit uint16
}

type Compute

type Compute struct {
	Instruction uint8
	Value       uint32
}

type ConfigArgs

type ConfigArgs struct {
	Param         uint8
	Owner         []byte
	CreatePoolFee *uint64
}

type Deposit

type Deposit struct {
	MaxCoinAmount  uint64
	MaxPcAmount    uint64
	BaseSide       uint64
	OtherAmountMin *uint64
}

type Fees

type Fees struct {
}

type Initialize

type Initialize struct {
	Nonce    byte
	OpenTime uint64
}

type Initialize2

type Initialize2 struct {
	Nonce          byte
	OpenTime       uint64
	InitPcAmount   uint64
	InitCoinAmount uint64
}

type LastOrderDistance

type LastOrderDistance struct {
	LastOrderNumerator   uint64
	LastOrderDenominator uint64
}

type MonitorStep

type MonitorStep struct {
	PlanOrderLimit   uint16
	PlaceOrderLimit  uint16
	CancelOrderLimit uint16
}

type PreInitialize

type PreInitialize struct {
	Nonce byte
}

type PumpFunAnchorSelfCPILogData

type PumpFunAnchorSelfCPILogData struct {
	Unused1              [16]byte         `compare:"-"`
	Mint                 solana.PublicKey `compare:"true"`
	SolAmount            uint64           `compare:"true"`
	TokenAmount          uint64           `compare:"true"`
	IsBuy                bool             `compare:"true"`
	User                 solana.PublicKey `compare:"true"`
	Timestamp            int64            `compare:"true"`
	VirtualSolReserves   uint64           `compare:"true"`
	VirtualTokenReserves uint64           `compare:"true"`
}

func DecodePumpFunCpiLog

func DecodePumpFunCpiLog(data []byte) (PumpFunAnchorSelfCPILogData, error)

type RaydiumAmmInstructionCoder

type RaydiumAmmInstructionCoder struct{}

RaydiumAmmInstructionCoder implements the Coder interface.

func NewRaydiumAmmInstructionCoder

func NewRaydiumAmmInstructionCoder() *RaydiumAmmInstructionCoder

func (*RaydiumAmmInstructionCoder) Decode

func (coder *RaydiumAmmInstructionCoder) Decode(data []byte) (interface{}, int, error)

Decode decodes the given byte array into an instruction.

type SetParams

type SetParams struct {
	Param             uint8
	Value             *uint64
	NewPubkey         []byte
	Fees              *Fees
	LastOrderDistance *LastOrderDistance
}

type SimulateInfo

type SimulateInfo struct {
	Param            uint8
	SwapBaseInValue  *SwapBaseIn
	SwapBaseOutValue *SwapBaseOut
}

type SwapBaseIn

type SwapBaseIn struct {
	AmountIn         uint64
	MinimumAmountOut uint64
}

type SwapBaseOut

type SwapBaseOut struct {
	MaxAmountIn uint64
	AmountOut   uint64
}

type SystemTransfer

type SystemTransfer struct {
	// programId:11111111111111111111111111111111
	Info struct {
		Destination string `json:"destination"`
		Lamports    int    `json:"lamports"`
		Source      string `json:"source"`
	} `json:"info"`
	Type string `json:"type"`
}

type TokenTransfer

type TokenTransfer struct {
	Info struct {
		Amount      string `json:"amount"`
		Authority   string `json:"authority"`
		Destination string `json:"destination"`
		Source      string `json:"source"`
	} `json:"info"`
	InstructionType string `json:"type"`
}

type TokenTransferChecked

type TokenTransferChecked struct {
	Info struct {
		Authority   string `json:"authority"`
		Destination string `json:"destination"`
		Mint        string `json:"mint"`
		Source      string `json:"source"`
		TokenAmount struct {
			Amount         string  `json:"amount"`
			Decimals       int     `json:"decimals"`
			UiAmount       float64 `json:"uiAmount"`
			UiAmountString string  `json:"uiAmountString"`
		} `json:"tokenAmount"`
	} `json:"info"`
	InstructionType string `json:"type"`
}

TODO: A better struct, maybe from anchor generated code

type Transfer

type Transfer struct {
	Instruction uint32
	Amount      int64
}

type Withdraw

type Withdraw struct {
	Amount uint64
}

Jump to

Keyboard shortcuts

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