UNPKG

@cobaltx/sdk-v2

Version:

An SDK for building applications on top of CobaltX.

2 lines 2.58 kB
import{PublicKey as v}from"@solana/web3.js";import w,{isBN as _}from"bn.js";import{bits as K,BitStructure as q,blob as k,Blob as M,cstr as G,f32 as O,f32be as j,f64 as z,f64be as H,greedy as J,Layout as C,ns64 as Q,ns64be as X,nu64 as Y,nu64be as Z,offset as $,s16 as W,s16be as ee,s24 as te,s24be as ne,s32 as re,s32be as oe,s40 as se,s40be as ue,s48 as ae,s48be as ie,s8 as ye,seq as I,struct as ce,Structure as A,u16 as D,u16be as pe,u24 as de,u24be as Pe,u32 as xe,u32be as fe,u40 as be,u40be as me,u48 as le,u48be as ge,u8 as N,UInt as E,union as Le,Union as he,unionLayoutDiscriminator as Te,utf8 as Se}from"@solana/buffer-layout";var P=C,L=A;var h=E;var T=N,S=D;var B=I;var c=k;var x=class extends P{constructor(e,n,u){super(e,u);this.blob=c(e),this.signed=n}decode(e,n=0){let u=new w(this.blob.decode(e,n),10,"le");return this.signed?u.fromTwos(this.span*8).clone():u}encode(e,n,u=0){return typeof e=="number"&&(e=new w(e)),this.signed&&(e=e.toTwos(this.span*8)),this.blob.encode(e.toArrayLike(Buffer,"le",this.span),n,u)}};function i(t){return new h(1,t)}function o(t){return new x(8,!1,t)}var d=class extends P{constructor(e,n,u,a){super(e.span,a);this.layout=e,this.decoder=n,this.encoder=u}decode(e,n){return this.decoder(this.layout.decode(e,n))}encode(e,n,u){return this.layout.encode(this.encoder(e),n,u)}getSpan(e,n){return this.layout.getSpan(e,n)}};function s(t){return new d(c(32),r=>new v(r),r=>r.toBuffer(),t)}function U(t){return new d(T(),F,R,t)}function F(t){if(t===0)return!1;if(t===1)return!0;throw new Error("Invalid bool: "+t)}function R(t){return t?1:0}var f=class extends L{decode(r,e){return super.decode(r,e)}};function b(t,r,e){return new f(t,r,e)}function m(t,r,e){let n,u=typeof r=="number"?r:_(r)?r.toNumber():new Proxy(r,{get(a,p){if(!n){let y=Reflect.get(a,"count");n=_(y)?y.toNumber():y,Reflect.set(a,"count",n)}return Reflect.get(a,p)},set(a,p,y){return p==="count"&&(n=y),Reflect.set(a,p,y)}});return B(t,u,e)}var Ve=b([c(8),i("bump"),U("disableCreatePool"),S("index"),o("tradeFeeRate"),o("protocolFeeRate"),o("fundFeeRate"),o("createPoolFee"),s("protocolOwner"),s("fundOwner"),m(o(),16)]),Ke=b([c(8),s("configId"),s("poolCreator"),s("vaultA"),s("vaultB"),s("mintLp"),s("mintA"),s("mintB"),s("mintProgramA"),s("mintProgramB"),s("observationId"),i("bump"),i("status"),i("lpDecimals"),i("mintDecimalA"),i("mintDecimalB"),o("lpAmount"),o("protocolFeesMintA"),o("protocolFeesMintB"),o("fundFeesMintA"),o("fundFeesMintB"),o("openTime"),m(o(),32)]);export{Ve as CpmmConfigInfoLayout,Ke as CpmmPoolInfoLayout}; //# sourceMappingURL=layout.mjs.map