Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var OpenBookDex solana.PublicKey = solana.MustPublicKeyFromBase58("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX")
Serum's OpenBookDex program ID.
Functions ¶
This section is empty.
Types ¶
type MarketInfo ¶
type MarketInfo struct { // Initialize Market Instruction Data ProgramID solana.PublicKey // always OpenBook v3 Market solana.PublicKey // serum market address RequestQueue solana.PublicKey // serum request queue address (unused for swaps) EventQueue solana.PublicKey // serum event queue address Bids solana.PublicKey // serum bids address Asks solana.PublicKey // serum asks address BaseMint solana.PublicKey // base mint address (Token Address) QuoteMint solana.PublicKey // quote mint address (Currency Address) BaseVault solana.PublicKey // base vault address (Token Account) QuoteVault solana.PublicKey // quote vault address (Currency Account) Sysvar solana.PublicKey // SYSVAR_CLOCK_PUBKEY // Initialize Market Instruction Metadata Caller solana.PublicKey // Caller wallet address TxID solana.Signature // Transaction ID Slot uint64 // Chain Slot TxTime time.Time // Timestamp of transaction in blockchain Timestamp time.Time // Timestamp of transaction discovery Swapped bool // Whether the pair was created in reverse order. // Initialize Market Instruction Extra VaultSigner solana.PublicKey // Vault signer; this value is provided by separate RPC call. }
programID -> OpenBook account1 -> Market -> SerumMarket account2 -> RequestQueue (unused) account3 -> EventQueue -> SerumEventQueue account4 -> Bids -> SerumBids account5 -> Asks -> SerumAsks account6 -> BaseVault -> SerumCoinVaultAccount account7 -> QuoteVault -> SerumPcVaultAccount account8 -> BaseMint (TokenAddress) account9 -> QuoteMint (CurrencyAddress - chcemy tylko WSOL, więc So11111111111111111111111111111111111111112) account10 -> Sysvar: Rent
func MarketInfoFromTransaction ¶
func MarketInfoFromTransaction(rpcTx *rpc.GetTransactionResult, tx *solana.Transaction) (MarketInfo, error)
serum market initialization input data: 34 bytes, 5 args + 5 bytes unknown
(0, 34) => MarketInstruction::InitializeMarket({ let data_array = array_ref![data, 0, 34]; let fields = array_refs![data_array, 8, 8, 2, 8, 8]; InitializeMarketInstruction { coin_lot_size: u64::from_le_bytes(*fields.0), pc_lot_size: u64::from_le_bytes(*fields.1), fee_rate_bps: u16::from_le_bytes(*fields.2), vault_signer_nonce: u64::from_le_bytes(*fields.3), pc_dust_threshold: u64::from_le_bytes(*fields.4), } }),
const vaultSigner = await PublicKey.createProgramAddress(
[ this.address.toBuffer(), this._decoded.vaultSignerNonce.toArrayLike(Buffer, 'le', 8), ], this._programId, );
It seems somehow it doesnt match above. VaultSignerNonce starts at 23th because of additional 5 bytes (method id??)
func NewMarketInfo ¶
func NewMarketInfo() *MarketInfo
Initialize market info with hardcoded values. The rest of the values will be filled in by the Update method.
func (*MarketInfo) CoinVault ¶
func (m *MarketInfo) CoinVault() solana.PublicKey
Market's token vault.
func (*MarketInfo) PcVault ¶
func (m *MarketInfo) PcVault() solana.PublicKey
Market's currency vault.
func (*MarketInfo) Ready ¶
func (m *MarketInfo) Ready() bool
Ready returns true if all the required fields are filled in. This should be true after Update. MarketInfo and raydium.AmmInfo both has to be ready before the swap can be executed.
func (*MarketInfo) TokenAddress ¶
func (m *MarketInfo) TokenAddress() solana.PublicKey
TokenAddress returns the token address of the market.