@galacticcouncil/sdk-next 0.40.1 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/aave/index.cjs +1 -0
- package/build/aave/index.mjs +1 -0
- package/build/client/index.cjs +1 -0
- package/build/client/index.mjs +1 -0
- package/build/evm/index.cjs +1 -0
- package/build/evm/index.mjs +1 -0
- package/build/farm/index.cjs +1 -0
- package/build/farm/index.mjs +1 -0
- package/build/pool/index.cjs +1 -0
- package/build/pool/index.mjs +1 -0
- package/build/sor/index.cjs +1 -0
- package/build/sor/index.mjs +1 -0
- package/build/staking/index.cjs +1 -0
- package/build/staking/index.mjs +1 -0
- package/build/tx/index.cjs +1 -0
- package/build/tx/index.mjs +1 -0
- package/build/utils/index.cjs +1 -0
- package/build/utils/index.mjs +1 -0
- package/package.json +57 -5
- /package/build/{types/aave → aave}/AaveClient.d.ts +0 -0
- /package/build/{types/aave → aave}/AaveUtils.d.ts +0 -0
- /package/build/{types/aave → aave}/abi/AavePool.d.ts +0 -0
- /package/build/{types/aave → aave}/abi/AavePoolDataProvider.d.ts +0 -0
- /package/build/{types/aave → aave}/abi/index.d.ts +0 -0
- /package/build/{types/aave → aave}/const.d.ts +0 -0
- /package/build/{types/aave → aave}/index.d.ts +0 -0
- /package/build/{types/aave → aave}/types.d.ts +0 -0
- /package/build/{types/api → api}/Papi.d.ts +0 -0
- /package/build/{types/api → api}/Watcher.d.ts +0 -0
- /package/build/{types/api → api}/index.d.ts +0 -0
- /package/build/{types/api → api}/probe.d.ts +0 -0
- /package/build/{types/api → api}/provider/index.d.ts +0 -0
- /package/build/{types/api → api}/provider/smoldot.d.ts +0 -0
- /package/build/{types/api → api}/provider/websocket.d.ts +0 -0
- /package/build/{types/client → client}/AssetClient.d.ts +0 -0
- /package/build/{types/client → client}/BalanceClient.d.ts +0 -0
- /package/build/{types/client → client}/ChainParams.d.ts +0 -0
- /package/build/{types/client → client}/index.d.ts +0 -0
- /package/build/{types/consts.d.ts → consts.d.ts} +0 -0
- /package/build/{types/errors.d.ts → errors.d.ts} +0 -0
- /package/build/{types/evm → evm}/adapter.d.ts +0 -0
- /package/build/{types/evm → evm}/chain.d.ts +0 -0
- /package/build/{types/evm → evm}/client.d.ts +0 -0
- /package/build/{types/evm → evm}/index.d.ts +0 -0
- /package/build/{types/evm → evm}/types.d.ts +0 -0
- /package/build/{types/factory.d.ts → factory.d.ts} +0 -0
- /package/build/{types/farm → farm}/LiquidityMiningApi.d.ts +0 -0
- /package/build/{types/farm → farm}/LiquidityMiningClient.d.ts +0 -0
- /package/build/{types/farm → farm}/MultiCurrencyContainer.d.ts +0 -0
- /package/build/{types/farm → farm}/RewardClaimSimulator.d.ts +0 -0
- /package/build/{types/farm → farm}/const.d.ts +0 -0
- /package/build/{types/farm → farm}/index.d.ts +0 -0
- /package/build/{types/farm → farm}/types.d.ts +0 -0
- /package/build/{types/gho → gho}/GhoTokenClient.d.ts +0 -0
- /package/build/{types/gho → gho}/abi.d.ts +0 -0
- /package/build/{types/gho → gho}/index.d.ts +0 -0
- /package/build/{types/index.d.ts → index.d.ts} +0 -0
- /package/build/{types/oracle → oracle}/MmOracleClient.d.ts +0 -0
- /package/build/{types/oracle → oracle}/abi.d.ts +0 -0
- /package/build/{types/oracle → oracle}/index.d.ts +0 -0
- /package/build/{types/oracle → oracle}/types.d.ts +0 -0
- /package/build/{types/pool → pool}/PoolClient.d.ts +0 -0
- /package/build/{types/pool → pool}/PoolContextProvider.d.ts +0 -0
- /package/build/{types/pool → pool}/PoolFactory.d.ts +0 -0
- /package/build/{types/pool → pool}/PoolLog.d.ts +0 -0
- /package/build/{types/pool → pool}/PoolStore.d.ts +0 -0
- /package/build/{types/pool → pool}/aave/AaveAbi.d.ts +0 -0
- /package/build/{types/pool → pool}/aave/AavePool.d.ts +0 -0
- /package/build/{types/pool → pool}/aave/AavePoolClient.d.ts +0 -0
- /package/build/{types/pool → pool}/aave/index.d.ts +0 -0
- /package/build/{types/pool → pool}/aave/types.d.ts +0 -0
- /package/build/{types/pool → pool}/hsm/HsmMath.d.ts +0 -0
- /package/build/{types/pool → pool}/hsm/HsmPool.d.ts +0 -0
- /package/build/{types/pool → pool}/hsm/HsmPoolClient.d.ts +0 -0
- /package/build/{types/pool → pool}/hsm/index.d.ts +0 -0
- /package/build/{types/pool → pool}/hsm/types.d.ts +0 -0
- /package/build/{types/pool → pool}/index.d.ts +0 -0
- /package/build/{types/pool → pool}/lbp/LbpMath.d.ts +0 -0
- /package/build/{types/pool → pool}/lbp/LbpPool.d.ts +0 -0
- /package/build/{types/pool → pool}/lbp/LbpPoolClient.d.ts +0 -0
- /package/build/{types/pool → pool}/lbp/index.d.ts +0 -0
- /package/build/{types/pool → pool}/omni/OmniMath.d.ts +0 -0
- /package/build/{types/pool → pool}/omni/OmniPool.d.ts +0 -0
- /package/build/{types/pool → pool}/omni/OmniPoolClient.d.ts +0 -0
- /package/build/{types/pool → pool}/omni/index.d.ts +0 -0
- /package/build/{types/pool → pool}/omni/types.d.ts +0 -0
- /package/build/{types/pool → pool}/stable/StableMath.d.ts +0 -0
- /package/build/{types/pool → pool}/stable/StableSwap.d.ts +0 -0
- /package/build/{types/pool → pool}/stable/StableSwapClient.d.ts +0 -0
- /package/build/{types/pool → pool}/stable/index.d.ts +0 -0
- /package/build/{types/pool → pool}/stable/types.d.ts +0 -0
- /package/build/{types/pool → pool}/types.d.ts +0 -0
- /package/build/{types/pool → pool}/xyk/XykMath.d.ts +0 -0
- /package/build/{types/pool → pool}/xyk/XykPool.d.ts +0 -0
- /package/build/{types/pool → pool}/xyk/XykPoolClient.d.ts +0 -0
- /package/build/{types/pool → pool}/xyk/index.d.ts +0 -0
- /package/build/{types/sor → sor}/Router.d.ts +0 -0
- /package/build/{types/sor → sor}/TradeRouteBuilder.d.ts +0 -0
- /package/build/{types/sor → sor}/TradeRouter.d.ts +0 -0
- /package/build/{types/sor → sor}/TradeScheduler.d.ts +0 -0
- /package/build/{types/sor → sor}/const.d.ts +0 -0
- /package/build/{types/sor → sor}/index.d.ts +0 -0
- /package/build/{types/sor → sor}/route/bfs.d.ts +0 -0
- /package/build/{types/sor → sor}/route/graph.d.ts +0 -0
- /package/build/{types/sor → sor}/route/index.d.ts +0 -0
- /package/build/{types/sor → sor}/route/suggester.d.ts +0 -0
- /package/build/{types/sor → sor}/types.d.ts +0 -0
- /package/build/{types/staking → staking}/StakingApi.d.ts +0 -0
- /package/build/{types/staking → staking}/StakingClient.d.ts +0 -0
- /package/build/{types/staking → staking}/index.d.ts +0 -0
- /package/build/{types/staking → staking}/types.d.ts +0 -0
- /package/build/{types/staking → staking}/utils.d.ts +0 -0
- /package/build/{types/tx → tx}/OrderTxBuilder.d.ts +0 -0
- /package/build/{types/tx → tx}/TradeTxBuilder.d.ts +0 -0
- /package/build/{types/tx → tx}/TxBuilder.d.ts +0 -0
- /package/build/{types/tx → tx}/TxBuilderFactory.d.ts +0 -0
- /package/build/{types/tx → tx}/index.d.ts +0 -0
- /package/build/{types/tx → tx}/types.d.ts +0 -0
- /package/build/{types/tx → tx}/utils.d.ts +0 -0
- /package/build/{types/types.d.ts → types.d.ts} +0 -0
- /package/build/{types/utils → utils}/QueryBus.d.ts +0 -0
- /package/build/{types/utils → utils}/Queue.d.ts +0 -0
- /package/build/{types/utils → utils}/Stack.d.ts +0 -0
- /package/build/{types/utils → utils}/async.d.ts +0 -0
- /package/build/{types/utils → utils}/calc.d.ts +0 -0
- /package/build/{types/utils → utils}/format.d.ts +0 -0
- /package/build/{types/utils → utils}/index.d.ts +0 -0
- /package/build/{types/utils → utils}/json.d.ts +0 -0
- /package/build/{types/utils → utils}/math.d.ts +0 -0
- /package/build/{types/utils → utils}/traversal/bfs.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Dt=Object.defineProperty;var K=(l,t)=>{for(var e in t)Dt(l,e,{get:t[e],enumerable:!0})};import Mt from"buffer";typeof window<"u"&&(window.Buffer=Mt.Buffer);import{calculate_in_given_out as aa,calculate_out_given_in as na,calculate_linear_weights as sa,calculate_pool_trade_fee as ia,get_spot_price as ra}from"@galacticcouncil/math-lbp";import{big as Fa,RUNTIME_DECIMALS as Ea}from"@galacticcouncil/common";var q={};K(q,{withTimeout:()=>Lt});function Lt(l,t,e="timeout"){return new Promise((a,s)=>{let n=setTimeout(()=>s(new Error(e)),t);l.then(i=>{clearTimeout(n),a(i)},i=>{clearTimeout(n),s(i)})})}var y={};K(y,{divSpot:()=>qt,getFraction:()=>Nt,mulScaled:()=>it,mulSpot:()=>Ht});import{RUNTIME_DECIMALS as st}from"@galacticcouncil/common";function it(l,t,e,a,s){let n=e+a-s,i=l*t;return n>0?i/BigInt(10)**BigInt(n):n<0?i*BigInt(10)**BigInt(-n):i}function Ht(l,t,e,a){return it(l,t,e,st,a)}function qt(l,t,e,a){if(t===0n)return 0n;let s=BigInt(10)**BigInt(st+a-e);return l*s/t}function Nt(l,t,e=2){if(t<.01||t>100)throw new Error("Supported range is from 0.01% - 100%");let a=BigInt(10)**BigInt(e),s=BigInt(Math.round(t*Number(a)));return l*s/(BigInt(100)*a)}var p={};K(p,{FeeUtils:()=>j,shiftNeg:()=>Vt});import Ut from"big.js";var j=class l{static toPct(t){let[e,a]=t;return l.safeDivide(e*100,a)}static toRaw(t){let[e,a]=t;return l.safeDivide(e,a)}static fromPermill(t){return[t,1e6]}static fromPerbill(t){return[t,1e9]}static fromRate(t,e){return[t,e]}static safeDivide(t,e,a=12){let s=10**a;return Math.round(t*s/e)/s}static safeRound(t){return parseFloat(t.toPrecision(15))}};function Vt(l,t){let e=Ut(typeof l=="bigint"?l.toString():l);return t===0?e.toString():e.div(Math.pow(10,t)).toString()}import Sa from"big.js";import{TLRUCache as xa}from"@thi.ng/cache";var{FeeUtils:Wa}=p;import{CompatibilityLevel as Zs}from"polkadot-api";import{Subscription as ei,distinctUntilChanged as ai,filter as ni}from"rxjs";import{memoize1 as us}from"@thi.ng/memoize";import{TLRUCache as ms}from"@thi.ng/cache";import{ReplaySubject as bs,Subscription as ys,combineLatest as fs,defer as Ps,from as Ts,merge as Ss,of as vs,EMPTY as ws}from"rxjs";import{bufferCount as Is,bufferTime as Os,catchError as As,filter as Bs,finalize as _s,map as Rs,pairwise as Fs,repeat as Es,skip as Cs,share as ks,startWith as Ds,switchMap as Ms,tap as Ls,throttleTime as Hs}from"rxjs/operators";import{hydration as ie,hydrationNext as re}from"@galacticcouncil/descriptors";import{log as ee}from"@galacticcouncil/common";import{shareReplay as ae,tap as ne}from"rxjs";import{defer as $t,from as Xt,of as lt,timer as Yt}from"rxjs";import{catchError as zt,distinctUntilChanged as Kt,expand as jt,map as Q,shareReplay as Qt,skip as Jt,switchMap as Zt,timeout as te}from"rxjs/operators";function ct(l,{intervalMs:t=5e3,rpcTimeoutMs:e=1e4}={}){let a=()=>$t(()=>Xt(l._request("system_health",[]))).pipe(te({first:e}),Q(()=>"online"),zt(()=>lt("offline")));return lt({state:"offline",delayMs:0}).pipe(jt(n=>Yt(n.delayMs).pipe(Zt(a),Q(i=>({state:i,delayMs:t})))),Jt(1),Q(n=>n.state),Kt(),Qt({bufferSize:1,refCount:!0}))}var{logger:se}=ee,G=class l{static instance=null;bestBlock$;finalizedBlock$;connection$;constructor(t){this.bestBlock$=this.watched("watcher(bestBlock)",t.getUnsafeApi().query.System.Number.watchValue("best")),this.finalizedBlock$=this.watched("watcher(finalizedBlock)",t.finalizedBlock$),this.connection$=this.watched("watcher(connection)",ct(t))}static getInstance(t){return this.instance||(this.instance=new l(t)),this.instance}watched(t,e){return e.pipe(ne({error:a=>se.error(t,a)}),ae({bufferSize:1,refCount:!0}))}};var T=class{client;api;apiNext;watcher;constructor(t){this.client=t,this.api=this.client.getTypedApi(ie),this.apiNext=this.client.getTypedApi(re),this.watcher=G.getInstance(this.client)}};import{getWsProvider as un}from"polkadot-api/ws-provider";import{withLogsRecorder as mn}from"polkadot-api/logs-provider";import{withLegacy as gn}from"@polkadot-api/legacy-provider";import{getSmProvider as fn}from"polkadot-api/sm-provider";import{log as oe}from"@galacticcouncil/common";import{combineLatest as le,concat as ce,defer as D,from as ut}from"rxjs";import{bufferCount as pt,distinctUntilChanged as mt,debounceTime as ue,map as B,retry as pe,startWith as dt,switchMap as gt,tap as M,take as me,skip as de,connect as ge}from"rxjs/operators";var{logger:_}=oe,R=class extends T{erc20Ids=null;constructor(t){super(t)}async getBalance(t,e){return e===0?this.getSystemBalance(t):this.getBalanceData(t,e)}async getSystemBalance(t){let e=this.api.query.System.Account,{data:a}=await e.getValue(t,{at:"best"});return this.getBreakdown(a)}async getTokenBalance(t,e){let s=await this.api.query.Tokens.Accounts.getValue(t,e,{at:"best"});return this.getBreakdown(s)}async getErc20Balance(t,e){return this.getBalanceData(t,e)}watchBalance(t){return D(()=>{let e=this.watchSystemBalance(t),a=this.watchTokensBalance(t),s=this.watchErc20Balance(t);return le([e,a,s]).pipe(ge(n=>ce(n.pipe(me(1)),n.pipe(de(1),ue(250)))))}).pipe(B(e=>e.flat()),dt([]),pt(2,1),B(([e,a],s)=>s===0?a:this.getDeltas(e,a))).pipe(M({subscribe:()=>_.debug("balance: subscribe",t),error:e=>_.error("balance",e)}),pe({delay:1e3}))}watchSystemBalance(t){let e=this.api.query.System.Account;return D(()=>e.watchValue(t,"best")).pipe(B(a=>({id:0,balance:this.getBreakdown(a.data)})),M({error:a=>_.error("balance(system)",a)}))}watchTokenBalance(t,e){let a=this.api.query.Tokens.Accounts;return D(()=>a.watchValue(t,e,"best")).pipe(B(s=>({id:e,balance:this.getBreakdown(s)})),M({error:s=>_.error("balance(token)",s)}))}watchTokensBalance(t){let e=this.api.query.Tokens.Accounts;return D(()=>e.watchEntries(t,{at:"best"})).pipe(mt((a,s)=>!s.deltas),B(({deltas:a})=>{let s=[];return a?.deleted.forEach(n=>{let[i,r]=n.args;s.push({id:r,balance:this.getBreakdown({free:0n,reserved:0n,frozen:0n})})}),a?.upserted.forEach(n=>{let[i,r]=n.args;s.push({id:r,balance:this.getBreakdown(n.value)})}),s}),M({error:a=>_.error("balance(tokens)",a)}))}watchErc20Balance(t,e){let a=async()=>{if(this.erc20Ids)return this.erc20Ids;let n=await this.api.query.AssetRegistry.Assets.getEntries({at:"best"});return this.erc20Ids=n.filter(({value:i})=>i.asset_type.type==="Erc20").map(({keyArgs:i})=>{let[r]=i;return r}),this.erc20Ids},s=async n=>(await Promise.all(n.map(async r=>[r,await this.getBalanceData(t,r)]))).map(([r,c])=>({id:r,balance:c}));return D(()=>ut(e?Promise.resolve(e):a()).pipe(gt(n=>this.watcher.bestBlock$.pipe(gt(()=>ut(s(n))))),dt([]),pt(2,1),B(([n,i],r)=>r===0?i.filter(c=>c.balance.total>0n):this.getDeltas(n,i)),mt((n,i)=>i.length===0),M({error:n=>_.error("balance(erc20)",n)})))}async getBalanceData(t,e){let a=await this.api.apis.CurrenciesApi.account(e,t,{at:"best"});return this.getBreakdown(a)}getBreakdown(t){let e=t.free>=t.frozen?t.free-t.frozen:0n,a=t.free+t.reserved;return{free:t.free,reserved:t.reserved,frozen:t.frozen,total:a,transferable:e}}getDeltas(t,e){let a=(n,i)=>n!==void 0&&i!==void 0&&n.transferable===i.transferable&&n.total===i.total,s=t.reduce((n,i)=>(n.set(i.id,i.balance),n),new Map);return e.filter(n=>!a(n.balance,s.get(n.id)))}};import{BehaviorSubject as Qn}from"rxjs";import{log as he}from"@galacticcouncil/common";var ns={Aave:"AAVE",LBP:"LBP",Omnipool:"OMNI",Stableswap:"STBL",XYK:"XYK",HSM:"HSM"},{logger:ss}=he;var{withTimeout:Ks}=q;import{calculate_in_given_out as fi,calculate_lrna_in_given_out as Pi,calculate_out_given_in as Ti,calculate_out_given_lrna_in as Si,calculate_spot_price as vi,calculate_lrna_spot_price as wi,calculate_shares as xi,calculate_liquidity_out as Ii,calculate_liquidity_lrna_out as Oi,verify_asset_cap as Ai,calculate_liquidity_hub_in as Bi,is_sell_allowed as _i,is_buy_allowed as Ri,is_add_liquidity_allowed as Fi,is_remove_liquidity_allowed as Ei,recalculate_asset_fee as Ci,recalculate_protocol_fee as ki}from"@galacticcouncil/math-omnipool";import Mi from"big.js";import{big as Ni}from"@galacticcouncil/common";var{FeeUtils:Ji}=p;import{AccountId as sr,Binary as ye,CompatibilityLevel as ir,Enum as fe}from"polkadot-api";import{toHex as or}from"@polkadot-api/utils";import{Subscription as cr,distinctUntilChanged as ur,filter as pr,finalize as mr,map as dr,merge as gr,tap as hr}from"rxjs";import{HYDRATION_SS58_PREFIX as yr}from"@galacticcouncil/common";var{FeeUtils:Or}=p,Ar=ye.fromText("omnipool"),Br=fe("Short");import{calculate_in_given_out as Mr,calculate_out_given_in as Lr,calculate_amplification as Hr,calculate_add_one_asset as qr,calculate_liquidity_out_one_asset as Nr,calculate_shares as Gr,calculate_shares_for_amount as Ur,calculate_spot_price_with_fee as Vr,pool_account_name as Wr,recalculate_peg as $r}from"@galacticcouncil/math-stableswap";import{RUNTIME_DECIMALS as Kr,big as jr}from"@galacticcouncil/common";var{FeeUtils:po}=p;import{AccountId as bo,CompatibilityLevel as yo}from"polkadot-api";import{toHex as Po}from"@polkadot-api/utils";import{blake2b as So}from"@noble/hashes/blake2b";import{Subscription as wo,distinctUntilChanged as xo,map as Io,merge as Oo,tap as Ao}from"rxjs";import{HYDRATION_SS58_PREFIX as _o,RUNTIME_DECIMALS as Ro}from"@galacticcouncil/common";var{FeeUtils:Go}=p;import{calculate_in_given_out as Ko,calculate_out_given_in as jo,calculate_pool_trade_fee as Qo,get_spot_price as Jo,calculate_liquidity_in as Zo,calculate_shares as tl,calculate_spot_price as el,calculate_spot_price_with_fee as al,calculate_liquidity_out_asset_a as nl,calculate_liquidity_out_asset_b as sl}from"@galacticcouncil/math-xyk";import{big as ul}from"@galacticcouncil/common";var{FeeUtils:vl}=p;import{CompatibilityLevel as Ol}from"polkadot-api";import{Subscription as Bl}from"rxjs";import{big as Wl,RUNTIME_DECIMALS as $l}from"@galacticcouncil/common";import{AccountId as rc}from"polkadot-api";import{toHex as lc}from"@polkadot-api/utils";import{Subscription as uc,filter as pc,map as mc}from"rxjs";import{decodeEventLog as gc}from"viem";import{erc20 as xe,HYDRATION_SS58_PREFIX as bc}from"@galacticcouncil/common";var{ERC20:wc}=xe;import{calculate_collateral_in_given_hollar_out as Rc,calculate_collateral_out_given_hollar_in as Fc,calculate_hollar_in_given_collateral_out as Ec,calculate_hollar_out_given_collateral_in as Cc,calculate_imbalance as kc,calculate_max_price as Dc,calculate_buyback_limit as Mc,calculate_buyback_price_with_fee as Lc}from"@galacticcouncil/math-hsm";import{big as Uc,RUNTIME_DECIMALS as Vc}from"@galacticcouncil/common";var{FeeUtils:tu}=p;import{AccountId as du,CompatibilityLevel as gu}from"polkadot-api";import{toHex as yu}from"@polkadot-api/utils";import{Subscription as Tu,combineLatest as Su,filter as vu,map as wu,pairwise as xu}from"rxjs";import{decodeEventLog as Ou}from"viem";import{h160 as Be,HYDRATION_SS58_PREFIX as Bu}from"@galacticcouncil/common";var{FeeUtils:Du}=p,{H160:Mu}=Be;import{log as Re}from"@galacticcouncil/common";import{Subject as Tp,Subscription as Sp,takeUntil as vp}from"rxjs";var{logger:Hp}=Re;import{big as Im,RUNTIME_DECIMALS as Om}from"@galacticcouncil/common";var{FeeUtils:Gm}=p;import{big as od}from"@galacticcouncil/common";import{Enum as yt}from"polkadot-api";var I=class{static build(t){return t.map(({assetIn:e,assetOut:a,pool:s,poolId:n})=>s==="Stableswap"?{pool:yt("Stableswap",n),asset_in:e,asset_out:a}:{pool:yt(s),asset_in:e,asset_out:a})}};import{Enum as wt}from"polkadot-api";var ft=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"reserve",type:"address"},{indexed:!1,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"onBehalfOf",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!0,internalType:"uint16",name:"referralCode",type:"uint16"}],name:"Supply",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"reserve",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Withdraw",type:"event"},{inputs:[{internalType:"address",name:"asset",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address",name:"to",type:"address"}],name:"withdraw",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"reserve",type:"address"},{indexed:!1,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"onBehalfOf",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"enum DataTypes.InterestRateMode",name:"interestRateMode",type:"uint8"},{indexed:!1,internalType:"uint256",name:"borrowRate",type:"uint256"},{indexed:!0,internalType:"uint16",name:"referralCode",type:"uint16"}],name:"Borrow",type:"event"},{inputs:[{internalType:"address",name:"asset",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"interestRateMode",type:"uint256"},{internalType:"uint16",name:"referralCode",type:"uint16"},{internalType:"address",name:"onBehalfOf",type:"address"}],name:"borrow",outputs:[],stateMutability:"nonpayable",type:"function"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"reserve",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"repayer",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"bool",name:"useATokens",type:"bool"}],name:"Repay",type:"event"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"getUserAccountData",outputs:[{internalType:"uint256",name:"totalCollateralBase",type:"uint256"},{internalType:"uint256",name:"totalDebtBase",type:"uint256"},{internalType:"uint256",name:"availableBorrowsBase",type:"uint256"},{internalType:"uint256",name:"currentLiquidationThreshold",type:"uint256"},{internalType:"uint256",name:"ltv",type:"uint256"},{internalType:"uint256",name:"healthFactor",type:"uint256"}],stateMutability:"view",type:"function"}];var J=[{inputs:[{internalType:"contract IEACAggregatorProxy",name:"_networkBaseTokenPriceInUsdProxyAggregator",type:"address"},{internalType:"contract IEACAggregatorProxy",name:"_marketReferenceCurrencyPriceInUsdProxyAggregator",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"ETH_CURRENCY_UNIT",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"MKR_ADDRESS",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"_bytes32",type:"bytes32"}],name:"bytes32ToString",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"contract IPoolAddressesProvider",name:"provider",type:"address"}],name:"getReservesData",outputs:[{components:[{internalType:"address",name:"underlyingAsset",type:"address"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"symbol",type:"string"},{internalType:"uint256",name:"decimals",type:"uint256"},{internalType:"uint256",name:"baseLTVasCollateral",type:"uint256"},{internalType:"uint256",name:"reserveLiquidationThreshold",type:"uint256"},{internalType:"uint256",name:"reserveLiquidationBonus",type:"uint256"},{internalType:"uint256",name:"reserveFactor",type:"uint256"},{internalType:"bool",name:"usageAsCollateralEnabled",type:"bool"},{internalType:"bool",name:"borrowingEnabled",type:"bool"},{internalType:"bool",name:"stableBorrowRateEnabled",type:"bool"},{internalType:"bool",name:"isActive",type:"bool"},{internalType:"bool",name:"isFrozen",type:"bool"},{internalType:"uint128",name:"liquidityIndex",type:"uint128"},{internalType:"uint128",name:"variableBorrowIndex",type:"uint128"},{internalType:"uint128",name:"liquidityRate",type:"uint128"},{internalType:"uint128",name:"variableBorrowRate",type:"uint128"},{internalType:"uint128",name:"stableBorrowRate",type:"uint128"},{internalType:"uint40",name:"lastUpdateTimestamp",type:"uint40"},{internalType:"address",name:"aTokenAddress",type:"address"},{internalType:"address",name:"stableDebtTokenAddress",type:"address"},{internalType:"address",name:"variableDebtTokenAddress",type:"address"},{internalType:"address",name:"interestRateStrategyAddress",type:"address"},{internalType:"uint256",name:"availableLiquidity",type:"uint256"},{internalType:"uint256",name:"totalPrincipalStableDebt",type:"uint256"},{internalType:"uint256",name:"averageStableRate",type:"uint256"},{internalType:"uint256",name:"stableDebtLastUpdateTimestamp",type:"uint256"},{internalType:"uint256",name:"totalScaledVariableDebt",type:"uint256"},{internalType:"uint256",name:"priceInMarketReferenceCurrency",type:"uint256"},{internalType:"address",name:"priceOracle",type:"address"},{internalType:"uint256",name:"variableRateSlope1",type:"uint256"},{internalType:"uint256",name:"variableRateSlope2",type:"uint256"},{internalType:"uint256",name:"stableRateSlope1",type:"uint256"},{internalType:"uint256",name:"stableRateSlope2",type:"uint256"},{internalType:"uint256",name:"baseStableBorrowRate",type:"uint256"},{internalType:"uint256",name:"baseVariableBorrowRate",type:"uint256"},{internalType:"uint256",name:"optimalUsageRatio",type:"uint256"},{internalType:"bool",name:"isPaused",type:"bool"},{internalType:"bool",name:"isSiloedBorrowing",type:"bool"},{internalType:"uint128",name:"accruedToTreasury",type:"uint128"},{internalType:"uint128",name:"unbacked",type:"uint128"},{internalType:"uint128",name:"isolationModeTotalDebt",type:"uint128"},{internalType:"bool",name:"flashLoanEnabled",type:"bool"},{internalType:"uint256",name:"debtCeiling",type:"uint256"},{internalType:"uint256",name:"debtCeilingDecimals",type:"uint256"},{internalType:"uint8",name:"eModeCategoryId",type:"uint8"},{internalType:"uint256",name:"borrowCap",type:"uint256"},{internalType:"uint256",name:"supplyCap",type:"uint256"},{internalType:"uint16",name:"eModeLtv",type:"uint16"},{internalType:"uint16",name:"eModeLiquidationThreshold",type:"uint16"},{internalType:"uint16",name:"eModeLiquidationBonus",type:"uint16"},{internalType:"address",name:"eModePriceSource",type:"address"},{internalType:"string",name:"eModeLabel",type:"string"},{internalType:"bool",name:"borrowableInIsolation",type:"bool"}],internalType:"struct IUiPoolDataProviderV3.AggregatedReserveData[]",name:"",type:"tuple[]"},{components:[{internalType:"uint256",name:"marketReferenceCurrencyUnit",type:"uint256"},{internalType:"int256",name:"marketReferenceCurrencyPriceInUsd",type:"int256"},{internalType:"int256",name:"networkBaseTokenPriceInUsd",type:"int256"},{internalType:"uint8",name:"networkBaseTokenPriceDecimals",type:"uint8"}],internalType:"struct IUiPoolDataProviderV3.BaseCurrencyInfo",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IPoolAddressesProvider",name:"provider",type:"address"}],name:"getReservesList",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IPoolAddressesProvider",name:"provider",type:"address"},{internalType:"address",name:"user",type:"address"}],name:"getUserReservesData",outputs:[{components:[{internalType:"address",name:"underlyingAsset",type:"address"},{internalType:"uint256",name:"scaledATokenBalance",type:"uint256"},{internalType:"bool",name:"usageAsCollateralEnabledOnUser",type:"bool"},{internalType:"uint256",name:"stableBorrowRate",type:"uint256"},{internalType:"uint256",name:"scaledVariableDebt",type:"uint256"},{internalType:"uint256",name:"principalStableDebt",type:"uint256"},{internalType:"uint256",name:"stableBorrowLastUpdateTimestamp",type:"uint256"}],internalType:"struct IUiPoolDataProviderV3.UserReserveData[]",name:"",type:"tuple[]"},{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"marketReferenceCurrencyPriceInUsdProxyAggregator",outputs:[{internalType:"contract IEACAggregatorProxy",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"networkBaseTokenPriceInUsdProxyAggregator",outputs:[{internalType:"contract IEACAggregatorProxy",name:"",type:"address"}],stateMutability:"view",type:"function"}];var Pt="0x1b02E051683b5cfaC5929C25E84adb26ECf87B38",Z="0x112b087b60C1a166130d59266363C45F8aa99db0",tt="0xf3Ba4D1b50f78301BDD7EAEa9B67822A15FCA691",Tt=1000000n;var Ld=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var U=class{client;constructor(t){this.client=t.getWsProvider()}async getBlockTimestamp(){let t=await this.client.getBlock();return Number(t.timestamp)}async getReservesData(){return await this.client.readContract({abi:J,address:Z,args:[tt],functionName:"getReservesData"})}async getUserReservesData(t){return await this.client.readContract({abi:J,address:Z,args:[tt,t],functionName:"getUserReservesData"})}async getUserAccountData(t){return await this.client.readContract({abi:ft,address:Pt,args:[t],functionName:"getUserAccountData"})}};import d from"big.js";import{big as A,erc20 as qe,h160 as Ne}from"@galacticcouncil/common";var{ERC20:F}=qe,{H160:et}=Ne,Ge=1.01,Ue=31536000n,St=4,V=-1,W=10n**27n,$=class{client;constructor(t){this.client=new U(t)}async getSummary(t){let e=et.fromAny(t),[a,s,n,i]=await Promise.all([this.client.getReservesData(),this.client.getUserReservesData(e),this.client.getUserAccountData(e),this.client.getBlockTimestamp()]),[r]=a,[c,u]=s,[o,g,h,w,f,P]=n,S=A.toDecimal(P,18),x=[];for(let v of c){let O=v.underlyingAsset.toLowerCase(),b=r.find(({underlyingAsset:kt})=>kt.toLowerCase()===O);if(!b)throw new Error("Missing pool reserve for "+O);let z=v.scaledATokenBalance,C=b.liquidityIndex,xt=b.liquidityRate,It=b.availableLiquidity,Ot=b.priceInMarketReferenceCurrency,At=i+6,Bt=this.calculateLinearInterest(xt,b.lastUpdateTimestamp,At),_t=C*Bt/W,Rt=z*_t/W,Ft=Number(u!==0&&u===b.eModeCategoryId?b.eModeLiquidationThreshold:b.reserveLiquidationThreshold)/1e4,Et=b.usageAsCollateralEnabled&&v.usageAsCollateralEnabledOnUser&&v.scaledATokenBalance>0n,Ct=F.toAssetId(O);x.push({aTokenBalance:Rt,availableLiquidity:It,decimals:Number(b.decimals),isCollateral:Et,priceInRef:Ot,reserveId:Ct,reserveAsset:O,reserveLiquidationThreshold:Ft})}return{healthFactor:Number(S),currentLiquidationThreshold:Number(A.toDecimal(w,St)),totalCollateral:o,totalDebt:g,reserves:x}}async hasBorrowPositions(t){let e=et.fromAny(t),a=await this.client.getUserAccountData(e),[s,n]=a;return n>0n}async getHealthFactor(t){let e=et.fromAny(t),a=await this.client.getUserAccountData(e),[s,n,i,r,c,u]=a;return this.calculateHealthFactorFromBalances(n,s,r)}async getHealthFactorAfterWithdraw(t,e,a){let{totalCollateral:s,totalDebt:n,reserves:i,currentLiquidationThreshold:r}=await this.getSummary(t);if(n===0n)return V;let c=F.fromAssetId(e),u=i.find(O=>O.reserveAsset===c);if(!u)throw new Error("Missing reserve ctx for "+c);let{decimals:o,isCollateral:g,priceInRef:h,reserveLiquidationThreshold:w}=u,f=A.toBigInt(a,o),P=g?f*h/10n**BigInt(o):0n,S=s-P;if(S<=0n)return 0;let x=d(s.toString()).mul(r).minus(d(P.toString()).mul(w)).div(S.toString()),v=d(S.toString()).mul(x).div(n.toString()).toFixed(6,d.roundDown);return Number(v)}async getHealthFactorAfterSupply(t,e,a){let{totalCollateral:s,totalDebt:n,reserves:i,currentLiquidationThreshold:r}=await this.getSummary(t);if(n===0n)return V;let c=F.fromAssetId(e),u=i.find(v=>v.reserveAsset===c);if(!u)throw new Error("Missing reserve ctx for "+c);let{decimals:o,priceInRef:g,reserveLiquidationThreshold:h}=u,f=A.toBigInt(a,o)*g/10n**BigInt(o),P=s+f;if(P<=0n)return 0;let S=d(s.toString()).mul(r).plus(d(f.toString()).mul(h)).div(P.toString()),x=d(P.toString()).mul(S).div(n.toString()).toFixed(6,d.roundDown);return Number(x)}async getHealthFactorAfterSwap(t,e,a,s,n){let{totalDebt:i,reserves:r,healthFactor:c}=await this.getSummary(t);if(i===0n)return V;let u=F.fromAssetId(a),o=F.fromAssetId(n),g=r.find(C=>C.reserveAsset===u),h=r.find(C=>C.reserveAsset===o);if(!g)throw new Error(`Missing reserve ctx for ${u}`);if(!h)throw new Error(`Missing reserve ctx for ${h}`);let w=A.toBigInt(e,g.decimals),f=A.toBigInt(s,h.decimals),P=w*g.priceInRef/10n**BigInt(g.decimals),S=f*h.priceInRef/10n**BigInt(h.decimals),x=g.isCollateral?d(P.toString()).mul(g.reserveLiquidationThreshold):d(0),b=(h.isCollateral?d(S.toString()).mul(h.reserveLiquidationThreshold):d(0)).minus(x).div(i.toString()),z=d(c).plus(b).toFixed(6,d.roundDown);return Number(z)}async getMaxWithdraw(t,e){let{totalDebt:a,reserves:s,healthFactor:n}=await this.getSummary(t),i=F.fromAssetId(e),r=s.find(c=>c.reserveAsset===i);if(!r)throw new Error("Missing reserve ctx for "+i);return this.calculateWithdrawMax(r,a,n)}async getMaxWithdrawAll(t){let{totalDebt:e,reserves:a,healthFactor:s}=await this.getSummary(t),n={};for(let i of a){let r=this.calculateWithdrawMax(i,e,s);i.reserveId&&(n[i.reserveId]=r)}return n}calculateWithdrawMax(t,e,a){let{aTokenBalance:s,availableLiquidity:n,decimals:i,priceInRef:r,reserveLiquidationThreshold:c,isCollateral:u}=t,o=s;if(u&&e>0n){let h=a-Ge;if(h>0){let w=d(h).mul(e.toString()).div(c).toFixed(0,d.roundDown),f=d(w).div(r.toString()).mul(10**i).toFixed(0,d.roundDown);o=s<BigInt(f)?s:BigInt(f)}else o=0n}return{amount:o<n?o:n,decimals:i}}calculateLinearInterest(t,e,a){let s=a-e;if(s<=0)return W;let n=t*BigInt(s)/Ue;return W+n}calculateHealthFactorFromBalances(t,e,a){if(t===0n)return V;let s=e*a/t,n=A.toDecimal(s,St);return Number(n)}};function vt(l){let t=[],e=l;for(;e&&typeof e=="object"&&"type"in e;)t.push(e.type),e=e.value;return t.join(".")}var E=class extends T{evm;evmClient;balance;aaveUtils;constructor(t,e){super(t),this.evm=e,this.evmClient=e.getWsProvider(),this.balance=new R(t),this.aaveUtils=new $(e)}wrapTx(t,e){return{name:t,get:()=>e,dryRun:a=>this.dryRun(a,e)}}async dispatchWithExtraGas(t){return this.api.tx.Dispatcher.dispatch_with_extra_gas({call:t.decodedCall,extra_gas:Tt})}async dryRun(t,e){let a=wt("Signed",t),s=wt("system",a),i=await this.client.getUnsafeApi().apis.DryRunApi.dry_run_call(s,e.decodedCall),r=i.success&&!i.value.execution_result.success?i.value.execution_result.value.error:null;if(r){let c=vt(r.value);throw new Error("Dry run execution error!",{cause:c})}return i}isDirectOmnipoolTrade(t){return t.length===1&&t[0].pool==="Omnipool"}};var X=class extends E{_trade;_beneficiary;_slippagePct=1;setTrade(t){return this._trade=t,this}withBeneficiary(t){return this._beneficiary=t,this}withSlippage(t){return this._slippagePct=t,this}get trade(){if(!this._trade)throw new Error("Trade not set. Use setTrade().");return this._trade}get beneficiary(){if(!this._beneficiary)throw new Error("Beneficiary not set. Use withBeneficiary().");return this._beneficiary}get slippagePct(){return this._slippagePct}async build(){let{amountIn:t,swaps:e,type:a}=this.trade;if(a==="Buy")return this.buildBuyTx();let{assetIn:s}=e[0],n=await this.balance.getBalance(this.beneficiary,s);return t>=n.transferable-5n?this.buildSellAllTx():this.buildSellTx()}async buildBuyTx(){let{amountIn:t,amountOut:e,swaps:a}=this.trade,s=a[0],n=a[a.length-1],i=y.getFraction(t,this.slippagePct),r=s.assetIn,c=n.assetOut,u=t+i,o;return this.isDirectOmnipoolTrade(a)?o=this.api.tx.Omnipool.buy({asset_in:r,asset_out:c,amount:e,max_sell_amount:u}):o=this.api.tx.Router.buy({asset_in:r,asset_out:c,amount_out:e,max_amount_in:u,route:I.build(a)}),await this.aaveUtils.hasBorrowPositions(this.beneficiary)&&(o=await this.dispatchWithExtraGas(o)),this.wrapTx("RouterBuy",o)}async buildSellTx(){let{amountIn:t,amountOut:e,swaps:a}=this.trade,s=a[0],n=a[a.length-1],i=y.getFraction(e,this.slippagePct),r=s.assetIn,c=n.assetOut,u=e-i,o;return this.isDirectOmnipoolTrade(a)?o=this.api.tx.Omnipool.sell({asset_in:r,asset_out:c,amount:t,min_buy_amount:u}):o=this.api.tx.Router.sell({asset_in:r,asset_out:c,amount_in:t,min_amount_out:u,route:I.build(a)}),await this.aaveUtils.hasBorrowPositions(this.beneficiary)&&(o=await this.dispatchWithExtraGas(o)),this.wrapTx("RouterSell",o)}async buildSellAllTx(){let{amountOut:t,swaps:e}=this.trade,a=e[0],s=e[e.length-1],n=y.getFraction(t,this.slippagePct),i=a.assetIn,r=s.assetOut,c=t-n,u=this.api.tx.Router.sell_all({asset_in:i,asset_out:r,min_amount_out:c,route:I.build(e)});return await this.aaveUtils.hasBorrowPositions(this.beneficiary)&&(u=await this.dispatchWithExtraGas(u)),this.wrapTx("RouterSellAll",u)}};import{Enum as at}from"polkadot-api";var Y=class extends E{_order;_beneficiary;_maxRetries=3;_slippagePct=1;setOrder(t){return this._order=t,this}withBeneficiary(t){return this._beneficiary=t,this}withMaxRetries(t){return this._maxRetries=t,this}withSlippage(t){return this._slippagePct=t,this}get order(){if(!this._order)throw new Error("Order not set. Use setOrder().");return this._order}get beneficiary(){if(!this._beneficiary)throw new Error("Beneficiary not set. Use withBeneficiary().");return this._beneficiary}get maxRetries(){return this._maxRetries}get slippagePct(){return this._slippagePct}async build(){let{type:t}=this.order;switch(t){case"Dca":return this.buildDcaTx();case"TwapSell":return this.buildTwapSellTx();case"TwapBuy":return this.buildTwapBuyTx();default:throw new Error(`Unsupported TradeOrderType: ${t}`)}}async buildDcaTx(){let{amountIn:t,assetIn:e,assetOut:a,tradeAmountIn:s,tradePeriod:n,tradeRoute:i}=this.order,r=this.api.tx.DCA.schedule({schedule:{owner:this.beneficiary,period:n,max_retries:this.maxRetries,total_amount:t,slippage:this.slippagePct*1e4,stability_threshold:void 0,order:at("Sell",{asset_in:e,asset_out:a,amount_in:s,min_amount_out:0n,route:i})},start_execution_block:void 0});return await this.aaveUtils.hasBorrowPositions(this.beneficiary)&&(r=await this.dispatchWithExtraGas(r)),this.wrapTx("DcaSchedule",r)}async buildTwapSellTx(){let{amountIn:t,assetIn:e,assetOut:a,tradeAmountIn:s,tradeAmountOut:n,tradePeriod:i,tradeRoute:r}=this.order,c=y.getFraction(n,this.slippagePct),u=n-c,o=this.api.tx.DCA.schedule({schedule:{owner:this.beneficiary,period:i,max_retries:this.maxRetries,total_amount:t,slippage:this.slippagePct*1e4,stability_threshold:void 0,order:at("Sell",{asset_in:e,asset_out:a,amount_in:s,min_amount_out:u,route:r})},start_execution_block:void 0});return await this.aaveUtils.hasBorrowPositions(this.beneficiary)&&(o=await this.dispatchWithExtraGas(o)),this.wrapTx("DcaSchedule.twapSell",o)}async buildTwapBuyTx(){let{amountIn:t,assetIn:e,assetOut:a,tradeAmountIn:s,tradeAmountOut:n,tradePeriod:i,tradeRoute:r}=this.order,c=y.getFraction(s,this.slippagePct),u=s+c,o=this.api.tx.DCA.schedule({schedule:{owner:this.beneficiary,period:i,max_retries:this.maxRetries,total_amount:t,slippage:this.slippagePct*1e4,stability_threshold:void 0,order:at("Buy",{asset_in:e,asset_out:a,amount_out:n,max_amount_in:u,route:r})},start_execution_block:void 0});return await this.aaveUtils.hasBorrowPositions(this.beneficiary)&&(o=await this.dispatchWithExtraGas(o)),this.wrapTx("DcaSchedule.twapBuy",o)}};var nt=class{client;evmClient;constructor(t,e){this.client=t,this.evmClient=e}trade(t){return new X(this.client,this.evmClient).setTrade(t)}order(t){return new Y(this.client,this.evmClient).setOrder(t)}};export{nt as TxBuilderFactory};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var W=Object.create;var v=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var a=(i,t)=>{for(var e in t)v(i,e,{get:t[e],enumerable:!0})},L=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of G(t))!Q.call(i,s)&&s!==e&&v(i,s,{get:()=>t[s],enumerable:!(r=V(t,s))||r.enumerable});return i};var k=(i,t,e)=>(e=i!=null?W(Z(i)):{},L(t||!i||!i.__esModule?v(e,"default",{value:i,enumerable:!0}):e,i)),tt=i=>L(v({},"__esModule",{value:!0}),i);var St={};a(St,{QueryBus:()=>C,async:()=>T,calc:()=>M,fmt:()=>A,json:()=>N,math:()=>B});module.exports=tt(St);var T={};a(T,{withTimeout:()=>et});function et(i,t,e="timeout"){return new Promise((r,s)=>{let n=setTimeout(()=>s(new Error(e)),t);i.then(o=>{clearTimeout(n),r(o)},o=>{clearTimeout(n),s(o)})})}var M={};a(M,{divSpot:()=>it,getFraction:()=>st,mulScaled:()=>F,mulSpot:()=>rt});var O=require("@galacticcouncil/common");function F(i,t,e,r,s){let n=e+r-s,o=i*t;return n>0?o/BigInt(10)**BigInt(n):n<0?o*BigInt(10)**BigInt(-n):o}function rt(i,t,e,r){return F(i,t,e,O.RUNTIME_DECIMALS,r)}function it(i,t,e,r){if(t===0n)return 0n;let s=BigInt(10)**BigInt(O.RUNTIME_DECIMALS+r-e);return i*s/t}function st(i,t,e=2){if(t<.01||t>100)throw new Error("Supported range is from 0.01% - 100%");let r=BigInt(10)**BigInt(e),s=BigInt(Math.round(t*Number(r)));return i*s/(BigInt(100)*r)}var A={};a(A,{FeeUtils:()=>P,shiftNeg:()=>ht});var q=k(require("big.js"));var P=class i{static toPct(t){let[e,r]=t;return i.safeDivide(e*100,r)}static toRaw(t){let[e,r]=t;return i.safeDivide(e,r)}static fromPermill(t){return[t,1e6]}static fromPerbill(t){return[t,1e9]}static fromRate(t,e){return[t,e]}static safeDivide(t,e,r=12){let s=10**r;return Math.round(t*s/e)/s}static safeRound(t){return parseFloat(t.toPrecision(15))}};function ht(i,t){let e=(0,q.default)(typeof i=="bigint"?i.toString():i);return t===0?e.toString():e.div(Math.pow(10,t)).toString()}var N={};a(N,{findNestedKey:()=>lt,findNestedObj:()=>ut,jsonFormatter:()=>at});var lt=(i,t)=>{let e=[];return JSON.stringify(i,(r,s)=>(s&&s[t]&&e.push(s),s)),e[0]},ut=(i,t,e)=>{let r;return JSON.stringify(i,(s,n)=>(n&&n[t]===e&&(r=n),n)),r},at=(i,t)=>typeof t=="bigint"?t.toString():t;var B={};a(B,{calculateBuyFee:()=>mt,calculateDiffToAvg:()=>ft,calculateDiffToRef:()=>pt,calculateSellFee:()=>ct});var u=k(require("big.js"));function ft(i,t){let e=(0,u.default)(i.toString()),r=(0,u.default)(t.toString());return e.minus(r).abs().div(e.plus(r).div(2)).mul(100).round(2).toNumber()}function pt(i,t){if(t===0n)return 0;let e=(0,u.default)(i.toString()),r=(0,u.default)(t.toString());return e.minus(r).div(r).mul(100).round(2).toNumber()}function ct(i,t){if(i===0n)return 0;let e=(0,u.default)(i.toString()),r=(0,u.default)(t.toString());return(0,u.default)(1).minus(r.div(e)).mul(100).round(2).toNumber()}function mt(i,t){if(i===0n)return 0;let e=(0,u.default)(i.toString());return(0,u.default)(t.toString()).div(e).minus(1).mul(100).round(2).toNumber()}var m=(i,t)=>i===t?0:i==null?t==null?0:-1:t==null?i==null?0:1:typeof i.compare=="function"?i.compare(t):typeof t.compare=="function"?-t.compare(i):i<t?-1:i>t?1:0;var _=(i,t=e=>e!==void 0?": "+e:"")=>class extends Error{origMessage;constructor(e){super(i(e)+t(e)),this.origMessage=e!==void 0?String(e):""}};var dt=_(()=>"illegal argument(s)"),j=i=>{throw new dt(i)};var gt=_(()=>"index out of bounds"),D=i=>{throw new gt(i)},x=(i,t,e)=>(i<t||i>=e)&&D(i);var U=23283064365386963e-26,y=class{float(t=1){return this.int()*U*t}probability(t){return this.float()<t}norm(t=1){return(this.int()*U-.5)*2*t}normMinMax(t,e){let r=this.minmax(t,e);return this.float()<.5?r:-r}minmax(t,e){return this.float()*(e-t)+t}minmaxInt(t,e){t|=0;let r=(e|0)-t;return r?t+this.int()%r:t}minmaxUint(t,e){t>>>=0;let r=(e>>>0)-t;return r?t+this.int()%r:t}};var S=class extends y{constructor(t){super(),this.rnd=t}float(t=1){return this.rnd()*t}norm(t=1){return(this.rnd()-.5)*2*t}int(){return this.rnd()*4294967296>>>0}};var H=new S(Math.random);var Y=i=>i!=null&&typeof i!="function"&&i.length!==void 0;var K=Object.getPrototypeOf({}),w="function",$="string",f=(i,t)=>{let e;if(i===t)return!0;if(i!=null){if(typeof i.equiv===w)return i.equiv(t)}else return i==t;if(t!=null){if(typeof t.equiv===w)return t.equiv(i)}else return i==t;return typeof i===$||typeof t===$?!1:(e=Object.getPrototypeOf(i),(e==null||e===K)&&(e=Object.getPrototypeOf(t),e==null||e===K)?yt(i,t):typeof i!==w&&i.length!==void 0&&typeof t!==w&&t.length!==void 0?vt(i,t):i instanceof Set&&t instanceof Set?_t(i,t):i instanceof Map&&t instanceof Map?xt(i,t):i instanceof Date&&t instanceof Date?i.getTime()===t.getTime():i instanceof RegExp&&t instanceof RegExp?i.toString()===t.toString():i!==i&&t!==t)},vt=(i,t,e=f)=>{let r=i.length;if(r===t.length)for(;r-- >0&&e(i[r],t[r]););return r<0},_t=(i,t,e=f)=>i.size===t.size&&e([...i.keys()].sort(),[...t.keys()].sort()),xt=(i,t,e=f)=>i.size===t.size&&e([...i].sort(),[...t].sort()),yt=(i,t,e=f)=>{if(Object.keys(i).length!==Object.keys(t).length)return!1;for(let r in i)if(!t.hasOwnProperty(r)||!e(i[r],t[r]))return!1;return!0};var R=class{value;constructor(t){this.value=t}deref(){return this.value}};var J=i=>i instanceof R;var b=class i{_head;_length=0;constructor(t){t&&this.into(t)}get length(){return this._length}get head(){return this._head}[Symbol.iterator](){return X("next",this._head)}reverseIterator(){return X("prev",this.tail)}clear(){this.release()}compare(t,e=m){let r=this._length;if(r<t._length)return-1;if(r>t._length)return 1;if(r===0)return 0;{let s=this._head,n=t._head,o=0;for(;r-- >0&&o===0;)o=e(s.value,n.value),s=s.next,n=n.next;return o}}concat(...t){let e=this.copy();for(let r of t)e.into(r);return e}equiv(t){if(!(t instanceof i||Y(t))||this._length!==t.length)return!1;if(!this._length||this===t)return!0;let e=t[Symbol.iterator](),r=this._head;for(let s=this._length;s-- >0;){if(!f(r.value,e.next().value))return!1;r=r.next}return!0}filter(t){let e=this.empty();return this.traverse(r=>(t(r.value)&&e.append(r.value),!0)),e}find(t){return this.traverse(e=>e.value!==t)}findWith(t){return this.traverse(e=>!t(e.value))}first(){return this._head?.value}insertSorted(t,e){e=e||m;for(let r=this._head,s=this._length;s-- >0;){if(e(t,r.value)<=0)return this.insertBefore(r,t);r=r.next}return this.append(t)}into(t){for(let e of t)this.append(e);return this}nth(t,e){let r=this.nthCell(t);return r?r.value:e}nthCellUnsafe(t){let e,r;for(t<=this._length>>>1?(e=this._head,r="next"):(e=this.tail,r="prev",t=this._length-t-1);t-- >0&&e;)e=e[r];return e}peek(){return this.tail?.value}$reduce(t,e){let r=this._head;for(let s=this._length;s-- >0&&!J(e);)e=t(e,r.value),r=r.next;return e}reduce(t,e){return this.$reduce(t,e)}release(){let t=this._head;if(!t)return!0;let e;for(let r=this._length;r-- >0;)e=t.next,delete t.value,delete t.prev,delete t.next,t=e;return this._head=void 0,this._length=0,!0}reverse(){let t=this._head,e=this.tail,r=(this._length>>>1)+(this._length&1);for(;t&&e&&r>0;){let s=t.value;t.value=e.value,e.value=s,t=t.next,e=e.prev,r--}return this}setHead(t){let e=this._head;return e?(e.value=t,e):this.prepend(t)}setNth(t,e){let r=this.nthCell(t);return!r&&D(t),r.value=e,r}setTail(t){let e=this.tail;return e?(e.value=t,e):this.append(t)}swap(t,e){if(t!==e){let r=t.value;t.value=e.value,e.value=r}return this}toArray(t=[]){return this.traverse(e=>(t.push(e.value),!0)),t}toJSON(){return this.toArray()}toString(){let t=[];return this.traverse(e=>(t.push(String(e.value)),!0)),t.join(", ")}traverse(t,e=this._head,r){if(!this._head)return;let s=e;do{if(!t(s))break;s=s.next}while(s!==r);return s}_map(t,e){return this.traverse(r=>(t.append(e(r.value)),!0)),t}};function*X(i,t){for(;t;)yield t.value,t=t[i]}var E=class i extends b{_tail;constructor(t){super(),t&&this.into(t)}get tail(){return this._tail}append(t){if(this._tail){let e={value:t,prev:this._tail};return this._tail.next=e,this._tail=e,this._length++,e}else return this.prepend(t)}asHead(t){return t===this._head?this:(this.remove(t),this._head.prev=t,t.next=this._head,t.prev=void 0,this._head=t,this._length++,this)}asTail(t){return t===this._tail?this:(this.remove(t),this._tail.next=t,t.prev=this._tail,t.next=void 0,this._tail=t,this._length++,this)}cons(t){return this.prepend(t),this}copy(){return new i(this)}*cycle(){for(;;)yield*this}drop(){let t=this._head;if(t)return this._head=t.next,this._head?this._head.prev=void 0:this._tail=void 0,this._length--,t.value}empty(){return new i}insertAfter(t,e){let r={value:e,next:t.next,prev:t};return t.next?t.next.prev=r:this._tail=r,t.next=r,this._length++,r}insertAfterNth(t,e){return t<0&&(t+=this._length),t>=this._length-1?this.append(e):(x(t,0,this._length),this.insertAfter(this.nthCellUnsafe(t),e))}insertBefore(t,e){let r={value:e,next:t,prev:t.prev};return t.prev?t.prev.next=r:this._head=r,t.prev=r,this._length++,r}insertBeforeNth(t,e){return t<0&&(t+=this._length),t<=0?this.prepend(e):(x(t,0,this._length),this.insertBefore(this.nthCellUnsafe(t),e))}map(t){return this._map(new i,t)}nth(t,e){let r=this.nthCell(t);return r?r.value:e}nthCell(t){if(t<0&&(t+=this._length),!(t<0||t>=this._length))return this.nthCellUnsafe(t)}pop(){let t=this._tail;if(t)return this._tail=t.prev,this._tail?this._tail.next=void 0:this._head=void 0,this._length--,t.value}prepend(t){let e={value:t,next:this._head};return this._head?this._head.prev=e:this._tail=e,this._head=e,this._length++,e}push(t){return this.append(t),this}release(){return this._tail=void 0,super.release()}remove(t){return t.prev?t.prev.next=t.next:this._head=t.next,t.next?t.next.prev=t.prev:this._tail=t.prev,this._length--,this}rotateLeft(){switch(this._length){case 0:case 1:return this;case 2:return this.swap(this._head,this._tail);default:return this.push(this.drop())}}rotateRight(){switch(this._length){case 0:case 1:return this;case 2:return this.swap(this._head,this._tail);default:let t=this.peek();return this.pop(),this.prepend(t),this}}seq(t=0,e=this.length){if(t>=e||t<0)return;let r=this.nthCell(t),s=this.nthCell(e-1),n=o=>({first(){return o.value},next(){return o!==s&&o.next?n(o.next):void 0}});return r?n(r):void 0}shuffle(t,e=H){if(this._length<2)return this;for(t=t!==void 0?t:Math.ceil(1.5*Math.log2(this._length));t>0;t--){let r=this._head;for(;r;){let s=r.next;e.probability(.5)?this.asHead(r):this.asTail(r),r=s}}return this}slice(t=0,e=this.length){let r=t<0?t+this._length:t,s=e<0?e+this._length:e;(r<0||s<0)&&j("invalid indices: ${from} / ${to}");let n=new i,o=this.nthCell(r);for(;o&&++r<=s;)n.push(o.value),o=o.next;return n}sort(t=m){if(!this._length)return this;let e=1;for(;;){let r=this._head;this._head=void 0,this._tail=void 0;let s=0;for(;r;){s++;let n=r,o=0;for(let h=0;h<e&&(o++,n=n.next,!!n);h++);let p=e;for(;o>0||p>0&&n;){let h;o===0?(h=n,n=n.next,p--):!n||p===0||t(r.value,n.value)<=0?(h=r,r=r.next,o--):(h=n,n=n.next,p--),this._tail?this._tail.next=h:this._head=h,h.prev=this._tail,this._tail=h}r=n}if(this._tail.next=void 0,s<=1)return this;e*=2}}splice(t,e=0,r){let s;typeof t=="number"?(t<0&&(t+=this._length),x(t,0,this._length),s=this.nthCellUnsafe(t)):s=t;let n=new i;if(e>0)for(;s&&e-- >0;)this.remove(s),n.push(s.value),s=s.next;else s&&(s=s.next);if(r)if(s)for(let o of r)this.insertBefore(s,o);else for(let o of r)this.push(o);return n}};var z=class i{map;items;opts;_size;constructor(t,e){let r={maxlen:1/0,maxsize:1/0,map:()=>new Map,ksize:()=>0,vsize:()=>0,...e};this.map=r.map(),this.items=new E,this._size=0,this.opts=r,t&&this.into(t)}get length(){return this.items.length}get size(){return this._size}[Symbol.iterator](){return this.entries()}*entries(){for(let t of this.items)yield[t.k,t]}*keys(){for(let t of this.items)yield t.k}*values(){for(let t of this.items)yield t.v}copy(){let t=this.empty();t.items=this.items.copy();let e=t.items.head;for(;e;)t.map.set(e.value.k,e),e=e.next;return t}empty(){return new i(null,this.opts)}release(){this._size=0,this.map.clear();let t=this.opts.release;if(t){let e;for(;e=this.items.drop();)t(e.k,e.v);return!0}return this.items.release()}has(t){return this.map.has(t)}get(t,e){let r=this.map.get(t);return r?this.resetEntry(r):e}set(t,e){let r=this.opts.ksize(t)+this.opts.vsize(e),s=this.map.get(t),n=Math.max(0,r-(s?s.value.s:0));return this._size+=n,this.ensureSize()?this.doSetEntry(s,t,e,r):this._size-=n,e}into(t){for(let e of t)this.set(e[0],e[1]);return this}async getSet(t,e){let r=this.map.get(t);return r?this.resetEntry(r):this.set(t,await e())}delete(t){let e=this.map.get(t);return e?(this.removeEntry(e),!0):!1}resetEntry(t){return this.items.asTail(t),t.value.v}ensureSize(){let{release:t,maxsize:e,maxlen:r}=this.opts;for(;this._size>e||this.length>=r;){let s=this.items.drop();if(!s)return!1;this.map.delete(s.k),t?.(s.k,s.v),this._size-=s.s}return!0}removeEntry(t){let e=t.value;this.map.delete(e.k),this.items.remove(t),this.opts.release?.(e.k,e.v),this._size-=e.s}doSetEntry(t,e,r,s){t?(this.opts.update?.(e,t.value.v,r),t.value.v=r,t.value.s=s,this.items.asTail(t)):(this.items.push({k:e,v:r,s}),this.map.set(e,this.items.tail))}};var d=class i extends z{constructor(t,e){super(t,{ttl:3600*1e3,autoExtend:!1,...e})}empty(){return new i(null,this.opts)}has(t){return this.get(t)!==void 0}get(t,e){let r=this.map.get(t);if(r){if(r.value.t>=Date.now())return this.resetEntry(r);this.removeEntry(r)}return e}set(t,e,r=this.opts.ttl){let s=this.opts.ksize(t)+this.opts.vsize(e),n=this.map.get(t),o=Math.max(0,s-(n?n.value.s:0));return this._size+=o,this.ensureSize()?this.doSetEntry(n,t,e,s,r):this._size-=o,e}async getSet(t,e,r=this.opts.ttl){let s=this.get(t);return s!==void 0?s:this.set(t,await e(),r)}prune(){let t=Date.now(),e=this.items.head,r=0;for(;e;)e.value.t<t&&(this.removeEntry(e),r++),e=e.next;return r}ensureSize(){let{maxlen:t,maxsize:e}=this.opts,r=Date.now(),s=this.items.head;for(;s&&(this._size>e||this.length>=t);)s.value.t<r&&this.removeEntry(s),s=s.next;return super.ensureSize()}doSetEntry(t,e,r,s,n=this.opts.ttl){let o=Date.now()+n;t?(this.opts.update?.(e,t.value.v,r),t.value.v=r,t.value.s=s,t.value.t=o,this.items.asTail(t)):(this.items.push({k:e,v:r,s,t:o,ttl:n}),this.map.set(e,this.items.tail))}resetEntry(t){return this.opts.autoExtend&&(t.value.t=Date.now()+t.value.ttl),super.resetEntry(t)}};var C=class{debug;constructor(t){this.debug=t||!1}log(t,e,r){this.debug&&console.log(t,e,r)}scope(t,e,r,s){let n=new Map,o=s!==void 0?new d(null,{ttl:s}):new d;return{get:(...g)=>{let l=r(...g);if(n.has(l)){this.log("[live]",t,l);let I=n.get(l);return Promise.resolve(I)}if(o.has(l))return this.log("[memo]",t,l),o.get(l);this.log("[fetch]",t,l);let c=e(...g).catch(I=>{throw o.delete(l),I});return o.set(l,c),c},set:(g,...l)=>{let c=r(...l);this.log("[set-live]",t,c),n.set(c,g)},clear:()=>{this.log("[clear]",t),n.clear(),o.release()}}}};0&&(module.exports={QueryBus,async,calc,fmt,json,math});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var N=Object.defineProperty;var g=(r,t)=>{for(var n in t)N(r,n,{get:t[n],enumerable:!0})};import E from"buffer";typeof window<"u"&&(window.Buffer=E.Buffer);var l={};g(l,{withTimeout:()=>_});function _(r,t,n="timeout"){return new Promise((o,e)=>{let i=setTimeout(()=>e(new Error(n)),t);r.then(s=>{clearTimeout(i),o(s)},s=>{clearTimeout(i),e(s)})})}var S={};g(S,{divSpot:()=>v,getFraction:()=>D,mulScaled:()=>d,mulSpot:()=>B});import{RUNTIME_DECIMALS as p}from"@galacticcouncil/common";function d(r,t,n,o,e){let i=n+o-e,s=r*t;return i>0?s/BigInt(10)**BigInt(i):i<0?s*BigInt(10)**BigInt(-i):s}function B(r,t,n,o){return d(r,t,n,p,o)}function v(r,t,n,o){if(t===0n)return 0n;let e=BigInt(10)**BigInt(p+o-n);return r*e/t}function D(r,t,n=2){if(t<.01||t>100)throw new Error("Supported range is from 0.01% - 100%");let o=BigInt(10)**BigInt(n),e=BigInt(Math.round(t*Number(o)));return r*e/(BigInt(100)*o)}var x={};g(x,{FeeUtils:()=>a,shiftNeg:()=>O});import R from"big.js";var a=class r{static toPct(t){let[n,o]=t;return r.safeDivide(n*100,o)}static toRaw(t){let[n,o]=t;return r.safeDivide(n,o)}static fromPermill(t){return[t,1e6]}static fromPerbill(t){return[t,1e9]}static fromRate(t,n){return[t,n]}static safeDivide(t,n,o=12){let e=10**o;return Math.round(t*e/n)/e}static safeRound(t){return parseFloat(t.toPrecision(15))}};function O(r,t){let n=R(typeof r=="bigint"?r.toString():r);return t===0?n.toString():n.div(Math.pow(10,t)).toString()}var I={};g(I,{findNestedKey:()=>w,findNestedObj:()=>M,jsonFormatter:()=>F});var w=(r,t)=>{let n=[];return JSON.stringify(r,(o,e)=>(e&&e[t]&&n.push(e),e)),n[0]},M=(r,t,n)=>{let o;return JSON.stringify(r,(e,i)=>(i&&i[t]===n&&(o=i),i)),o},F=(r,t)=>typeof t=="bigint"?t.toString():t;var P={};g(P,{calculateBuyFee:()=>j,calculateDiffToAvg:()=>L,calculateDiffToRef:()=>C,calculateSellFee:()=>H});import c from"big.js";function L(r,t){let n=c(r.toString()),o=c(t.toString());return n.minus(o).abs().div(n.plus(o).div(2)).mul(100).round(2).toNumber()}function C(r,t){if(t===0n)return 0;let n=c(r.toString()),o=c(t.toString());return n.minus(o).div(o).mul(100).round(2).toNumber()}function H(r,t){if(r===0n)return 0;let n=c(r.toString()),o=c(t.toString());return c(1).minus(o.div(n)).mul(100).round(2).toNumber()}function j(r,t){if(r===0n)return 0;let n=c(r.toString());return c(t.toString()).div(n).minus(1).mul(100).round(2).toNumber()}import{TLRUCache as T}from"@thi.ng/cache";var h=class{debug;constructor(t){this.debug=t||!1}log(t,n,o){this.debug&&console.log(t,n,o)}scope(t,n,o,e){let i=new Map,s=e!==void 0?new T(null,{ttl:e}):new T;return{get:(...b)=>{let u=o(...b);if(i.has(u)){this.log("[live]",t,u);let f=i.get(u);return Promise.resolve(f)}if(s.has(u))return this.log("[memo]",t,u),s.get(u);this.log("[fetch]",t,u);let m=n(...b).catch(f=>{throw s.delete(u),f});return s.set(u,m),m},set:(b,...u)=>{let m=o(...u);this.log("[set-live]",t,m),i.set(m,b)},clear:()=>{this.log("[clear]",t),i.clear(),s.release()}}}};export{h as QueryBus,l as async,S as calc,x as fmt,I as json,P as math};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacticcouncil/sdk-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Galactic next gen sdk (papi)",
|
|
5
5
|
"author": "GalacticCouncil",
|
|
6
6
|
"repository": {
|
|
@@ -22,11 +22,63 @@
|
|
|
22
22
|
],
|
|
23
23
|
"main": "./build/index.cjs",
|
|
24
24
|
"module": "./build/index.mjs",
|
|
25
|
-
"types": "./build/
|
|
25
|
+
"types": "./build/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./build/index.d.ts",
|
|
29
|
+
"import": "./build/index.mjs",
|
|
30
|
+
"require": "./build/index.cjs"
|
|
31
|
+
},
|
|
32
|
+
"./aave": {
|
|
33
|
+
"types": "./build/aave/index.d.ts",
|
|
34
|
+
"import": "./build/aave/index.mjs",
|
|
35
|
+
"require": "./build/aave/index.cjs"
|
|
36
|
+
},
|
|
37
|
+
"./client": {
|
|
38
|
+
"types": "./build/client/index.d.ts",
|
|
39
|
+
"import": "./build/client/index.mjs",
|
|
40
|
+
"require": "./build/client/index.cjs"
|
|
41
|
+
},
|
|
42
|
+
"./evm": {
|
|
43
|
+
"types": "./build/evm/index.d.ts",
|
|
44
|
+
"import": "./build/evm/index.mjs",
|
|
45
|
+
"require": "./build/evm/index.cjs"
|
|
46
|
+
},
|
|
47
|
+
"./farm": {
|
|
48
|
+
"types": "./build/farm/index.d.ts",
|
|
49
|
+
"import": "./build/farm/index.mjs",
|
|
50
|
+
"require": "./build/farm/index.cjs"
|
|
51
|
+
},
|
|
52
|
+
"./pool": {
|
|
53
|
+
"types": "./build/pool/index.d.ts",
|
|
54
|
+
"import": "./build/pool/index.mjs",
|
|
55
|
+
"require": "./build/pool/index.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./sor": {
|
|
58
|
+
"types": "./build/sor/index.d.ts",
|
|
59
|
+
"import": "./build/sor/index.mjs",
|
|
60
|
+
"require": "./build/sor/index.cjs"
|
|
61
|
+
},
|
|
62
|
+
"./staking": {
|
|
63
|
+
"types": "./build/staking/index.d.ts",
|
|
64
|
+
"import": "./build/staking/index.mjs",
|
|
65
|
+
"require": "./build/staking/index.cjs"
|
|
66
|
+
},
|
|
67
|
+
"./tx": {
|
|
68
|
+
"types": "./build/tx/index.d.ts",
|
|
69
|
+
"import": "./build/tx/index.mjs",
|
|
70
|
+
"require": "./build/tx/index.cjs"
|
|
71
|
+
},
|
|
72
|
+
"./utils": {
|
|
73
|
+
"types": "./build/utils/index.d.ts",
|
|
74
|
+
"import": "./build/utils/index.mjs",
|
|
75
|
+
"require": "./build/utils/index.cjs"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
26
78
|
"scripts": {
|
|
27
79
|
"build": "npm run clean && node ./esbuild.dist.mjs",
|
|
28
80
|
"build:watch": "node ./esbuild.dev.mjs",
|
|
29
|
-
"postbuild": "tsc --emitDeclarationOnly --outDir build
|
|
81
|
+
"postbuild": "tsc --emitDeclarationOnly --outDir build",
|
|
30
82
|
"clean": "rimraf build",
|
|
31
83
|
"link": "npm ln",
|
|
32
84
|
"test": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest"
|
|
@@ -48,8 +100,8 @@
|
|
|
48
100
|
"big.js": "^6.2.1"
|
|
49
101
|
},
|
|
50
102
|
"peerDependencies": {
|
|
51
|
-
"@galacticcouncil/common": ">=0.
|
|
52
|
-
"@galacticcouncil/descriptors": ">=1.
|
|
103
|
+
"@galacticcouncil/common": ">=0.7.0 <1.0.0",
|
|
104
|
+
"@galacticcouncil/descriptors": ">=1.16.0 <2.0.0",
|
|
53
105
|
"polkadot-api": "^1.23.3",
|
|
54
106
|
"viem": "^2.38.3"
|
|
55
107
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|