UNPKG

@sega-so/sega-sdk

Version:

An SDK for building applications on top of SEGA.

2 lines 2.77 kB
"use strict";var C=Object.create;var x=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var E=(n,t)=>{for(var r in t)x(n,r,{get:t[r],enumerable:!0})},h=(n,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of A(t))!N.call(n,a)&&a!==r&&x(n,a,{get:()=>t[a],enumerable:!(o=I(t,a))||o.enumerable});return n};var v=(n,t,r)=>(r=n!=null?C(D(n)):{},h(t||!n||!n.__esModule?x(r,"default",{value:n,enumerable:!0}):r,n)),F=n=>h(x({},"__esModule",{value:!0}),n);var M={};E(M,{CpmmConfigInfoLayout:()=>K,CpmmPoolInfoLayout:()=>q});module.exports=F(M);var U=require("@solana/web3.js"),p=v(require("bn.js"));var e=require("@solana/buffer-layout"),b=e.Layout,T=e.Structure;var S=e.UInt;var B=e.u8,w=e.u16;var _=e.seq;var c=e.blob;var m=class extends b{constructor(t,r,o){super(t,o),this.blob=c(t),this.signed=r}decode(t,r=0){let o=new p.default(this.blob.decode(t,r),10,"le");return this.signed?o.fromTwos(this.span*8).clone():o}encode(t,r,o=0){return typeof t=="number"&&(t=new p.default(t)),this.signed&&(t=t.toTwos(this.span*8)),this.blob.encode(t.toArrayLike(Buffer,"le",this.span),r,o)}};function i(n){return new S(1,n)}function s(n){return new m(8,!1,n)}var f=class extends b{constructor(t,r,o,a){super(t.span,a),this.layout=t,this.decoder=r,this.encoder=o}decode(t,r){return this.decoder(this.layout.decode(t,r))}encode(t,r,o){return this.layout.encode(this.encoder(t),r,o)}getSpan(t,r){return this.layout.getSpan(t,r)}};function u(n){return new f(c(32),t=>new U.PublicKey(t),t=>t.toBuffer(),n)}function k(n){return new f(B(),R,V,n)}function R(n){if(n===0)return!1;if(n===1)return!0;throw new Error("Invalid bool: "+n)}function V(n){return n?1:0}var l=class extends T{decode(t,r){return super.decode(t,r)}};function g(n,t,r){return new l(n,t,r)}function L(n,t,r){let o,a=typeof t=="number"?t:(0,p.isBN)(t)?t.toNumber():new Proxy(t,{get(d,P){if(!o){let y=Reflect.get(d,"count");o=(0,p.isBN)(y)?y.toNumber():y,Reflect.set(d,"count",o)}return Reflect.get(d,P)},set(d,P,y){return P==="count"&&(o=y),Reflect.set(d,P,y)}});return _(n,a,r)}var K=g([c(8),i("bump"),k("disableCreatePool"),w("index"),s("tradeFeeRate"),s("protocolFeeRate"),s("fundFeeRate"),s("createPoolFee"),u("protocolOwner"),u("fundOwner"),L(s(),16)]),q=g([c(8),u("configId"),u("poolCreator"),u("vaultA"),u("vaultB"),u("mintLp"),u("mintA"),u("mintB"),u("mintProgramA"),u("mintProgramB"),u("observationId"),i("bump"),i("status"),i("lpDecimals"),i("mintDecimalA"),i("mintDecimalB"),s("lpAmount"),s("protocolFeesMintA"),s("protocolFeesMintB"),s("fundFeesMintA"),s("fundFeesMintB"),s("openTime"),L(s(),32)]);0&&(module.exports={CpmmConfigInfoLayout,CpmmPoolInfoLayout}); //# sourceMappingURL=layout.js.map