UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

2 lines 6.84 kB
import{PublicKey as z}from"@solana/web3.js";import N,{isBN as O}from"bn.js";import{bits as oe,BitStructure as se,blob as X,Blob as ue,cstr as ae,f32 as ie,f32be as ce,f64 as pe,f64be as ye,greedy as de,Layout as G,ns64 as fe,ns64be as xe,nu64 as Pe,nu64be as be,offset as le,s16 as me,s16be as _e,s24 as Le,s24be as Te,s32 as V,s32be as we,s40 as ge,s40be as he,s48 as Ie,s48be as Ee,s8 as Ae,seq as K,struct as Be,Structure as q,u16 as Z,u16be as Se,u24 as Re,u24be as ke,u32 as Ne,u32be as Oe,u40 as Ue,u40be as Ce,u48 as Me,u48be as De,u8 as Q,UInt as Y,union as ve,Union as Fe,unionLayoutDiscriminator as Xe,utf8 as Ge}from"@solana/buffer-layout";var h=G,S=q;var I=Y;var R=Q,x=Z;var P=V;var k=K;var a=X;var m=class extends h{constructor(o,c,f){super(o,f);this.blob=a(o),this.signed=c}decode(o,c=0){let f=new N(this.blob.decode(o,c),10,"le");return this.signed?f.fromTwos(this.span*8).clone():f}encode(o,c,f=0){return typeof o=="number"&&(o=new N(o)),this.signed&&(o=o.toTwos(this.span*8)),this.blob.encode(o.toArrayLike(Buffer,"le",this.span),c,f)}};function p(r){return new I(1,r)}function d(r){return new I(4,r)}function e(r){return new m(8,!1,r)}function u(r){return new m(16,!1,r)}function U(r){return new m(8,!0,r)}function C(r){return new m(16,!0,r)}var T=class extends h{constructor(o,c,f,b){super(o.span,b);this.layout=o,this.decoder=c,this.encoder=f}decode(o,c){return this.decoder(this.layout.decode(o,c))}encode(o,c,f){return this.layout.encode(this.encoder(o),c,f)}getSpan(o,c){return this.layout.getSpan(o,c)}};function t(r){return new T(a(32),y=>new z(y),y=>y.toBuffer(),r)}function A(r){return new T(R(),W,j,r)}function W(r){if(r===0)return!1;if(r===1)return!0;throw new Error("Invalid bool: "+r)}function j(r){return r?1:0}var E=class extends S{decode(y,o){return super.decode(y,o)}};function i(r,y,o){return new E(r,y,o)}function s(r,y,o){let c,f=typeof y=="number"?y:O(y)?y.toNumber():new Proxy(y,{get(b,L){if(!c){let l=Reflect.get(b,"count");c=O(l)?l.toNumber():l,Reflect.set(b,"count",c)}return Reflect.get(b,L)},set(b,L,l){return L==="count"&&(c=l),Reflect.set(b,L,l)}});return k(r,f,o)}import n from"bn.js";var nt=new n(1).shln(64);var rt=new n(1).shln(128),ot=new n(1).shln(64).subn(1),st=new n(1).shln(128).subn(1);var ut=new n("4295048016"),at=new n("79226673521066979257578248091"),it=new n("59543866431248"),ct=new n("184467440737095516"),pt=new n("15793534762490258745");var M=60,yt=new n("18446743708227953217"),dt=[{bit:0,factor:new n("fffcb933bd6fb800",16)},{bit:1,factor:new n("fff97272373d4000",16)},{bit:2,factor:new n("fff2e50f5f657000",16)},{bit:3,factor:new n("ffe5caca7e10f000",16)},{bit:4,factor:new n("ffcb9843d60f7000",16)},{bit:5,factor:new n("ff973b41fa98e800",16)},{bit:6,factor:new n("ff2ea16466c9b000",16)},{bit:7,factor:new n("fe5dee046a9a3800",16)},{bit:8,factor:new n("fcbe86c7900bb000",16)},{bit:9,factor:new n("f987a7253ac65800",16)},{bit:10,factor:new n("f3392b0822bb6000",16)},{bit:11,factor:new n("e7159475a2caf000",16)},{bit:12,factor:new n("d097f3bdfd2f2000",16)},{bit:13,factor:new n("a9f746462d9f8000",16)},{bit:14,factor:new n("70d869a156f31c00",16)},{bit:15,factor:new n("31be135f97ed3200",16)},{bit:16,factor:new n("9aa508b5b85a500",16)},{bit:17,factor:new n("5d6af8dedc582c",16)},{bit:18,factor:new n("2216e584f5fa",16)}];var _=3,D=100;var v=10,F=100,B=14;var ft=new n(0),xt=new n(1),Pt=new n(-1);var bt=new n("18446744073700000000");var Lt=i([a(8),p("bump"),x("index"),t("owner"),d("protocolFeeRate"),d("tradeFeeRate"),x("tickSpacing"),d("fundFeeRate"),s(d(),1),t("fundOwner"),s(e(),3)]),H=i([d("blockTimestamp"),U("tickCumulative"),s(e(),4)]),Tt=i([a(8),A("initialized"),e("recentEpoch"),x("observationIndex"),t("poolId"),s(H,D,"observations"),s(e(),4)]),$=i([x("filterPeriod"),x("decayPeriod"),x("reductionFactor"),d("dynamicFeeControl"),d("maxVolatilityAccumulator"),P("tickSpacingIndexReference"),d("volatilityReference"),d("volatilityAccumulator"),e("lastUpdateTimestamp"),s(p(),46)]),J=i([p("state"),e("openTime"),e("endTime"),e("lastUpdateTime"),u("emissionsPerSecondX64"),e("totalEmissioned"),e("claimed"),t("mint"),t("vault"),t("creator"),u("growthGlobalX64")]),wt=i([a(8),p("bump"),t("configId"),t("creator"),t("mintA"),t("mintB"),t("vaultA"),t("vaultB"),t("observationId"),p("mintDecimalsA"),p("mintDecimalsB"),x("tickSpacing"),u("liquidity"),u("sqrtPriceX64"),P("tickCurrent"),d(),u("feeGrowthGlobalX64A"),u("feeGrowthGlobalX64B"),e("protocolFeesTokenA"),e("protocolFeesTokenB"),s(u(),4),p("status"),p("feeOn"),a(6),s(J,_,"rewardInfos"),a(8*16,"tickArrayBitmap"),s(e(),4),e("fundFeesTokenA"),e("fundFeesTokenB"),e("startTime"),e("recentEpoch"),$.replicate("dynamicFeeInfo"),s(e(),46)]),ee=i([u("growthInsideLastX64"),e("rewardAmountOwed")]),gt=i([a(8),p("bump"),t("nftMint"),t("poolId"),P("tickLower"),P("tickUpper"),u("liquidity"),u("feeGrowthInsideLastX64A"),u("feeGrowthInsideLastX64B"),e("tokenFeesOwedA"),e("tokenFeesOwedB"),s(ee,_,"rewardInfos"),e("recentEpoch"),s(e(),7)]),ht=i([a(8),p("bump"),t("poolId"),P("tickLower"),P("tickUpper"),u("liquidity"),u("feeGrowthInsideLastX64A"),u("feeGrowthInsideLastX64B"),e("tokenFeesOwedA"),e("tokenFeesOwedB"),s(u(),_,"rewardGrowthInside"),e("recentEpoch"),s(e(),7)]),te=i([P("tick"),C("liquidityNet"),u("liquidityGross"),u("feeGrowthOutsideX64A"),u("feeGrowthOutsideX64B"),s(u(),_,"rewardGrowthsOutsideX64"),e("orderPhase"),e("ordersAmount"),e("partFilledOrdersRemaining"),u("unfilledRatioX64"),s(d(),3)]),It=i([a(8),t("poolId"),P("startTickIndex"),s(te,M,"ticks"),p("initializedTickCount"),e("recentEpoch"),s(p(),107)]),Et=i([a(8),p("bump"),s(t(),v,"operationOwners"),s(t(),F,"whitelistMints")]),At=i([a(8),t("poolId"),t("owner"),P("tick"),A("zeroForOne"),e("orderPhase"),e("totalAmount"),e("filledAmount"),e("settleBase"),e("settleOutput"),e("openTime"),u("unfilledRatioX64"),s(e(),4)]),Bt=i([a(8),t("poolId"),a(8*8*B,"positiveTickArrayBitmap"),a(8*8*B,"negativeTickArrayBitmap")]),St=i([a(8),x("index"),x("filterPeriod"),x("decayPeriod"),x("reductionFactor"),d("dynamicFeeControl"),d("maxVolatilityAccumulator"),s(e(),8)]),Rt=i([a(8),t("wallet"),p("nonceIndex"),e("orderNonce"),s(e(),4)]),kt=i([e(),p("bump"),t("owner"),t("poolId"),t("positionId"),t("nftAccount"),s(e(),8)]),Nt=i([a(8),p("bump"),t("lockOwner"),t("poolId"),t("positionId"),t("nftAccount"),t("lockNftMint"),e("recentEpoch"),s(e(),8)]);export{Lt as ClmmConfigLayout,St as DynamicFeeConfigLayout,$ as DynamicFeeInfoLayout,At as LimitOrderLayout,Rt as LimitOrderNonceLayout,Nt as LockClPositionLayoutV2,kt as LockPositionLayout,H as ObservationItemLayout,Tt as ObservationLayout,Et as OperationLayout,gt as PersonalPositionLayout,wt as PoolInfoLayout,ee as PositionRewardInfoLayout,ht as ProtocolPositionLayout,J as RewardInfoLayout,Bt as TickArrayBitmapExtensionLayout,It as TickArrayLayout,te as TickLayout}; //# sourceMappingURL=layout.mjs.map