UNPKG

@powrldgr/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

2 lines 4.57 kB
import{PublicKey as I}from"@solana/web3.js";import w,{isBN as B}from"bn.js";import{bits as F,BitStructure as O,blob as _,Blob as M,cstr as E,f32 as v,f32be as R,f64 as Q,f64be as K,greedy as z,Layout as U,ns64 as G,ns64be as j,nu64 as Y,nu64be as H,offset as J,s16 as W,s16be as X,s24 as Z,s24be as $,s32 as ee,s32be as te,s40 as ne,s40be as re,s48 as oe,s48be as se,s8 as ae,seq as q,struct as ue,Structure as k,u16 as ie,u16be as ye,u24 as pe,u24be as ce,u32 as de,u32be as Pe,u40 as me,u40be as xe,u48 as le,u48be as be,u8 as fe,UInt as A,union as Le,Union as ge,unionLayoutDiscriminator as Se,utf8 as Te}from"@solana/buffer-layout";var m=U,S=k;var T=A;var h=q;var x=_;var P=class extends m{constructor(t,r,a){super(t,a);this.blob=x(t),this.signed=r}decode(t,r=0){let a=new w(this.blob.decode(t,r),10,"le");return this.signed?a.fromTwos(this.span*8).clone():a}encode(t,r,a=0){return typeof t=="number"&&(t=new w(t)),this.signed&&(t=t.toTwos(this.span*8)),this.blob.encode(t.toArrayLike(Buffer,"le",this.span),r,a)}};function i(s){return new T(1,s)}function e(s){return new P(8,!1,s)}function y(s){return new P(16,!1,s)}var l=class extends m{constructor(t,r,a,p){super(t.span,p);this.layout=t,this.decoder=r,this.encoder=a}decode(t,r){return this.decoder(this.layout.decode(t,r))}encode(t,r,a){return this.layout.encode(this.encoder(t),r,a)}getSpan(t,r){return this.layout.getSpan(t,r)}};function n(s){return new l(x(32),o=>new I(o),o=>o.toBuffer(),s)}var b=class extends S{decode(o,t){return super.decode(o,t)}};function u(s,o,t){return new b(s,o,t)}function f(s,o,t){let r,a=typeof o=="number"?o:B(o)?o.toNumber():new Proxy(o,{get(p,d){if(!r){let c=Reflect.get(p,"count");r=B(c)?c.toNumber():c,Reflect.set(p,"count",r)}return Reflect.get(p,d)},set(p,d,c){return d==="count"&&(r=c),Reflect.set(p,d,c)}});return h(s,a,t)}var Ee=u([i("instruction"),e("amountIn"),e("minAmountOut")]),ve=u([i("instruction"),e("maxAmountIn"),e("amountOut")]),Re=u([i("instruction"),i("nonce")]),Qe=u([i("instruction"),i("nonce"),e("startTime")]),V=u([e("status"),e("nonce"),e("maxOrder"),e("depth"),e("baseDecimal"),e("quoteDecimal"),e("state"),e("resetFlag"),e("minSize"),e("volMaxCutRatio"),e("amountWaveRatio"),e("baseLotSize"),e("quoteLotSize"),e("minPriceMultiplier"),e("maxPriceMultiplier"),e("systemDecimalValue"),e("minSeparateNumerator"),e("minSeparateDenominator"),e("tradeFeeNumerator"),e("tradeFeeDenominator"),e("pnlNumerator"),e("pnlDenominator"),e("swapFeeNumerator"),e("swapFeeDenominator"),e("baseNeedTakePnl"),e("quoteNeedTakePnl"),e("quoteTotalPnl"),e("baseTotalPnl"),e("poolOpenTime"),e("punishPcAmount"),e("punishCoinAmount"),e("orderbookToInitTime"),y("swapBaseInAmount"),y("swapQuoteOutAmount"),e("swapBase2QuoteFee"),y("swapQuoteInAmount"),y("swapBaseOutAmount"),e("swapQuote2BaseFee"),n("baseVault"),n("quoteVault"),n("baseMint"),n("quoteMint"),n("lpMint"),n("openOrders"),n("marketId"),n("marketProgramId"),n("targetOrders"),n("withdrawQueue"),n("lpVault"),n("owner"),e("lpReserve"),f(e(),3,"padding")]),D=u([e("accountType"),e("status"),e("nonce"),e("maxOrder"),e("depth"),e("baseDecimal"),e("quoteDecimal"),e("state"),e("resetFlag"),e("minSize"),e("volMaxCutRatio"),e("amountWaveRatio"),e("baseLotSize"),e("quoteLotSize"),e("minPriceMultiplier"),e("maxPriceMultiplier"),e("systemDecimalsValue"),e("abortTradeFactor"),e("priceTickMultiplier"),e("priceTick"),e("minSeparateNumerator"),e("minSeparateDenominator"),e("tradeFeeNumerator"),e("tradeFeeDenominator"),e("pnlNumerator"),e("pnlDenominator"),e("swapFeeNumerator"),e("swapFeeDenominator"),e("baseNeedTakePnl"),e("quoteNeedTakePnl"),e("quoteTotalPnl"),e("baseTotalPnl"),e("poolOpenTime"),e("punishPcAmount"),e("punishCoinAmount"),e("orderbookToInitTime"),y("swapBaseInAmount"),y("swapQuoteOutAmount"),y("swapQuoteInAmount"),y("swapBaseOutAmount"),e("swapQuote2BaseFee"),e("swapBase2QuoteFee"),n("baseVault"),n("quoteVault"),n("baseMint"),n("quoteMint"),n("lpMint"),n("modelDataAccount"),n("openOrders"),n("marketId"),n("marketProgramId"),n("targetOrders"),n("owner"),f(e(),64,"padding")]),Ke=u([i("instruction"),e("baseAmountIn"),e("quoteAmountIn"),e("fixedSide"),e("otherAmountMin")]),ze=u([i("instruction"),e("lpAmount"),e("baseAmountMin"),e("quoteAmountMin")]),Ge={4:V,5:D},je=u([e("fee")]);export{Ge as LIQUIDITY_VERSION_TO_STATE_LAYOUT,Ke as addLiquidityLayout,je as createPoolFeeLayout,Re as createPoolV4Layout,Ee as fixedSwapInLayout,ve as fixedSwapOutLayout,Qe as initPoolLayout,V as liquidityStateV4Layout,D as liquidityStateV5Layout,ze as removeLiquidityLayout}; //# sourceMappingURL=layout.mjs.map