Documentation
¶
Index ¶
- Constants
- Variables
- func GetPoolAddress(args *GetPoolAddressArgs) (ed25519.PublicKey, uint8, error)
- func GetVaultAddress(args *GetVaultAddressArgs) (ed25519.PublicKey, uint8, error)
- func NewInitializeInstruction(accounts *InitializeInstructionAccounts, args *InitializeInstructionArgs) solana.Instruction
- func NewSwapInstruction(accounts *SwapInstructionAccounts, args *SwapInstructionArgs) solana.Instruction
- func NewTransferInstruction(accounts *TransferInstructionAccounts, args *TransferInstructionArgs) solana.Instruction
- type AccountType
- type GetPoolAddressArgs
- type GetVaultAddressArgs
- type InitializeInstructionAccounts
- type InitializeInstructionArgs
- type InstructionType
- type PoolAccount
- type SwapInstructionAccounts
- type SwapInstructionArgs
- type TransferInstructionAccounts
- type TransferInstructionArgs
Constants ¶
View Source
const ( MaxPoolNameLength = 32 MaxSwapDollars = 1000 )
View Source
const ( InitializeInstructionArgsSize = (MaxPoolNameLength + 1 + 1 + 1) // other_vault_bump )
View Source
const ( PoolAccountSize = (8 + 32 + MaxPoolNameLength + 32 + 32 + 32 + 32 + 1 + 1 + 1 + 1 + 1 + 3) // padding )
View Source
const ( SwapInstructionArgsSize = (8 + 1) // usdf_to_other )
View Source
const ( TransferInstructionArgsSize = (8 + 1) // is_usdf )
Variables ¶
View Source
var ( PoolPrefix = []byte("pool") VaultPrefix = []byte("vault") )
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("usdfcP2V1bh1Lz7Y87pxR4zJd3wnVtssJ6GeSHFeZeu") PROGRAM_ID = ed25519.PublicKey(PROGRAM_ADDRESS) )
View Source
var ( SPL_TOKEN_PROGRAM_ID = ed25519.PublicKey(mustBase58Decode("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")) SYSTEM_PROGRAM_ID = ed25519.PublicKey(mustBase58Decode("11111111111111111111111111111111")) SYSVAR_RENT_PUBKEY = ed25519.PublicKey(mustBase58Decode("SysvarRent111111111111111111111111111111111")) )
View Source
var PoolAccountDiscriminator = []byte{byte(AccountTypePool), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
Functions ¶
func GetPoolAddress ¶
func GetPoolAddress(args *GetPoolAddressArgs) (ed25519.PublicKey, uint8, error)
func GetVaultAddress ¶
func GetVaultAddress(args *GetVaultAddressArgs) (ed25519.PublicKey, uint8, error)
func NewInitializeInstruction ¶
func NewInitializeInstruction( accounts *InitializeInstructionAccounts, args *InitializeInstructionArgs, ) solana.Instruction
func NewSwapInstruction ¶
func NewSwapInstruction( accounts *SwapInstructionAccounts, args *SwapInstructionArgs, ) solana.Instruction
func NewTransferInstruction ¶
func NewTransferInstruction( accounts *TransferInstructionAccounts, args *TransferInstructionArgs, ) solana.Instruction
Types ¶
type AccountType ¶
type AccountType uint8
const ( AccountTypeUnknown AccountType = iota AccountTypePool )
type GetPoolAddressArgs ¶
type GetVaultAddressArgs ¶
type InstructionType ¶
type InstructionType uint8
const ( InstructionTypeUnknown InstructionType = iota InstructionTypeInitialize InstructionTypeSwap InstructionTypeTransfer )
type PoolAccount ¶
type PoolAccount struct {
Authority ed25519.PublicKey
Name string
UsdfMint ed25519.PublicKey
OtherMint ed25519.PublicKey
UsdfVault ed25519.PublicKey
OtherVault ed25519.PublicKey
Bump uint8
UsdfVaultBump uint8
OtherVaultBump uint8
UsdfDecimals uint8
OtherDecimals uint8
}
func (*PoolAccount) String ¶
func (obj *PoolAccount) String() string
func (*PoolAccount) Unmarshal ¶
func (obj *PoolAccount) Unmarshal(data []byte) error
type SwapInstructionAccounts ¶
type SwapInstructionArgs ¶
type TransferInstructionArgs ¶
Click to show internal directories.
Click to hide internal directories.