@scallop-io/scallop-swap-sdk 2.2.0 → 3.0.0-rc.2
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/dist/index.cjs +29 -0
- package/dist/{index.d.mts → index.d.cts} +50 -59
- package/dist/index.d.ts +50 -59
- package/dist/index.js +12 -32
- package/package.json +16 -15
- package/src/class/aggregator.ts +12 -10
- package/src/class/base.ts +11 -6
- package/src/class/coinMetadata.ts +10 -7
- package/src/const/afAddresses.ts +0 -21
- package/src/example/index.ts +5 -4
- package/src/interface/aggregator.ts +2 -2
- package/src/interface/base.ts +5 -4
- package/src/sdk/7k.ts +124 -195
- package/src/sdk/aftermath.ts +47 -16
- package/src/sdk/cetus.ts +41 -17
- package/src/sdk/flowx.ts +31 -9
- package/src/sdk/util.ts +23 -0
- package/src/utils.ts +15 -11
- package/dist/index.mjs +0 -15
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var grpc = require('@mysten/sui/grpc');
|
|
4
|
+
var suiKit = require('@scallop-io/sui-kit');
|
|
5
|
+
var utils = require('@mysten/sui/utils');
|
|
6
|
+
var bignumber_js = require('bignumber.js');
|
|
7
|
+
var events = require('events');
|
|
8
|
+
var transactions = require('@mysten/sui/transactions');
|
|
9
|
+
var J = require('bn.js');
|
|
10
|
+
var jsonRpc = require('@mysten/sui/jsonRpc');
|
|
11
|
+
|
|
12
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
var J__default = /*#__PURE__*/_interopDefault(J);
|
|
15
|
+
|
|
16
|
+
var U=utils.normalizeStructTag(utils.SUI_TYPE_ARG),B=n=>utils.normalizeStructTag(n)===U,E=async(n,e,A,a)=>{let o=[],s=bignumber_js.BigNumber(A),r=null;try{do{let{objects:t,hasNextPage:c,cursor:i}=await n.core.listCoins({coinType:e,owner:a,limit:50,cursor:r});if(o.push(...t),s=s.minus(t.reduce((f,d)=>f.plus(bignumber_js.BigNumber(d.balance)),bignumber_js.BigNumber(0))),s.lte(0)||(r=i??null,!c))break}while(r)}catch(t){throw new Error(t?.message??"Failed to fetch coins")}if(o.length===0)throw new Error(`No available coin for type ${e} found in wallet ${a}`);if(s.gt(0))throw new Error(`Insufficient balance for coin type ${e} in wallet ${a}`);return o},S=async(n,e,A,a,o)=>{try{if(B(a))n.mergeCoins(n.gas,[e]);else {let{objects:s}=await A.core.listCoins({coinType:a,owner:o,limit:1});if(!s.length)throw new Error(`No existing ${a} coin found to merge with`);let r=n.objectRef({objectId:s[0].objectId,version:s[0].version,digest:s[0].digest});s.length===1?n.mergeCoins(r,[e]):n.mergeCoins(r,[e,...s.slice(1).map(t=>n.objectRef({objectId:t.objectId,version:t.version,digest:t.digest}))]);}}catch{n.transferObjects([e],n.pure.address(o));}},Z=n=>n[0].toUpperCase()+n.slice(1),I=n=>n.split("_").map(Z).join(" ");var m=class extends events.EventEmitter{on(e,A){return super.on(e,A)}once(e,A){return super.once(e,A)}off(e,A){return super.off(e,A)}emit(e,A){return super.emit(e,A)}};var l=class{rawRouteResult;name="";events=new m;client;suiClient;fetchTimeoutInMs;walletAddress;fetchSettings;poolsMap=new Map;constructor(e,A){this.suiClient=A.suiClient??new grpc.SuiGrpcClient({baseUrl:"https://fullnode.mainnet.sui.io:443",network:"mainnet"}),this.fetchTimeoutInMs=A.fetchTimeoutInMs??4e3,this.walletAddress=A.walletAddress,this.name=e.toLowerCase(),A.fetchSettings&&this.setFetchRouteSettings(A.fetchSettings);}get pools(){return Array.from(this.poolsMap.keys())}validateWalletAddress(){if(!this.walletAddress||this.walletAddress.length===0)throw new Error("Wallet address is not set")}validateClient(){if(!this.client)throw new Error("SDK client is not set")}setWalletAddress(e){this.walletAddress=e;}setSuiClient(e){this.suiClient=e;}togglePoolStatus(e,A){let a=A??!(this.poolsMap.get(e)??true);this.poolsMap.set(e,a),this.events.emit("poolStatusChanged",{name:this.name,pool:e,enabled:a});}toggleAllPoolStatus(e){this.pools.forEach(A=>{this.poolsMap.set(A,e);}),this.events.emit("allPoolStatusChanged",{name:this.name,enabled:e});}getEnabledPools(){return Array.from(this.poolsMap.entries()).filter(([e,A])=>A).map(([e,A])=>e)}normalizeFetchRouteParams(e){return {...e,coinInType:suiKit.normalizeStructTag(e.coinInType),coinOutType:suiKit.normalizeStructTag(e.coinOutType)}}async withTimeout(e,A){let a,o,s=[e,new Promise((r,t)=>{a=setTimeout(()=>{t(new Error(`${this.name} fetch route timeout`));},this.fetchTimeoutInMs);})];A&&s.push(new Promise((r,t)=>{if(A.aborted){t(A.reason??new Error(`${this.name} fetch route aborted`));return}o=()=>t(A.reason??new Error(`${this.name} fetch route aborted`)),A.addEventListener("abort",o,{once:true});}));try{return await Promise.race(s)}finally{a&&clearTimeout(a),A&&o&&A.removeEventListener("abort",o);}}async selectCoinInForSwap(e,A,a){let o=bignumber_js.BigNumber(A.toString());if(B(a)){let[s]=e.splitCoins(e.gas,[o.toString()]);return s}else {let s=await this.selectCoins(a,o.toString()),r=s.reduce((c,i)=>c.plus(bignumber_js.BigNumber(i.balance)),bignumber_js.BigNumber(0)),t=e.objectRef({objectId:s[0].objectId,version:s[0].version,digest:s[0].digest});if(s.length>1&&e.mergeCoins(t,s.slice(1).map(c=>e.objectRef({objectId:c.objectId,version:c.version,digest:c.digest}))),r.gt(o)){let[c]=e.splitCoins(t,[o.toString()]);return c}else return t}}async selectCoins(e,A){return this.validateWalletAddress(),await E(this.suiClient,e,A,this.walletAddress)}};var p=class{constructor(e,A){this.client=e;A&&A.forEach(a=>this.cache.set(a.coinType,a));}cache=new Map;setClient(e){this.client=e;}async getCoinMetadata(e){let A=utils.normalizeStructTag(e);if(this.cache.has(A))return this.cache.get(A);let{coinMetadata:a}=await this.client.core.getCoinMetadata({coinType:A}),o=a;if(!o)throw new Error(`Coin metadata not found for coin type: ${A}`);return this.cache.set(A,o),o}};var y=class{coinMetadata;suiKit;events=new m;_slippage=.003;signerMode=false;aggregatorMap=new Map;activeAggregator=new Map;_fetchingStatus=new Map;poolStatusForwarders=new Map;allPoolStatusForwarders=new Map;walletAddress;client;constructor(e){if(this.client=e.client??new grpc.SuiGrpcClient({baseUrl:e.fullnodeUrl||"https://fullnode.mainnet.sui.io:443",network:"mainnet"}),this.coinMetadata=new p(this.client),this.signerMode=!!(e.secretKey||e.mnemonics),e.secretKey||e.mnemonics)this.suiKit=new suiKit.SuiKit({...e,suiClients:[this.client]}),this.walletAddress=this.suiKit.currentAddress;else if(e.walletAddress!==void 0)this.walletAddress=e.walletAddress;else throw new Error("One of secretKey, mnemonics or walletAddress must be provided")}forwardPoolStatusChangeEvent(e){this.events.emit("poolStatusChanged",e);}addAggregator(e){for(let A of e)if(!this.aggregatorMap.has(A.name)){this.aggregatorMap.set(A.name,A),this.activeAggregator.set(A.name,true),this._fetchingStatus.set(A.name,false);let a=s=>this.forwardPoolStatusChangeEvent(s);this.poolStatusForwarders.set(A.name,a),A.events.on("poolStatusChanged",a);let o=s=>this.events.emit("allPoolStatusChanged",s);this.allPoolStatusForwarders.set(A.name,o),A.events.on("allPoolStatusChanged",o),this.events.emit("aggregatorAdded",{name:A.name});}}getActiveAggregators(){return Array.from(this.activeAggregator.entries()).filter(([e,A])=>A).map(([e,A])=>e)}getAggregator(e){return this.aggregatorMap.get(e)}toggleAggregator(e,A){if(!this.activeAggregator.has(e))throw new Error(`Aggregator ${e} not found`);this.activeAggregator.set(e,A),this.events.emit("aggregatorStatusChanged",{name:e,enabled:A});}removeAggregator(e){let A=this.aggregatorMap.get(e);if(!A)throw new Error(`Aggregator ${e} not found`);let a=this.poolStatusForwarders.get(e);a&&A.events.off("poolStatusChanged",a),this.poolStatusForwarders.delete(e);let o=this.allPoolStatusForwarders.get(e);o&&A.events.off("allPoolStatusChanged",o),this.allPoolStatusForwarders.delete(e),this.aggregatorMap.delete(e),this.activeAggregator.delete(e),this._fetchingStatus.delete(e),this.events.emit("aggregatorRemoved",{name:e});}get aggregators(){return Array.from(this.aggregatorMap.values())}get fetchingStatus(){return Object.fromEntries(this._fetchingStatus)}get slippage(){return this._slippage}setSlippage(e){this._slippage=e,this.events.emit("aggregatorSlippageChanged",{slippageInDecimal:e});}setFetchTimeoutInMs(e){this.aggregators.forEach(A=>{A.fetchTimeoutInMs=e;});}#e(){if(!this.suiKit)throw new Error("SuiKit is not initialized.")}setSuiClient(e){this.aggregators.forEach(A=>{A.setSuiClient(e);}),this.coinMetadata.setClient(e),this.client=e;}setWalletAddress(e){if(this.signerMode)throw new Error("Cannot change wallet address when SuiKit is initialized with secretKey or mnemonics.");if(!utils.isValidSuiAddress(e))throw new Error("Invalid Sui wallet address");this.walletAddress=e,this.aggregators.forEach(A=>{A.setWalletAddress(e);});}async getCoinMetadata(e){return this.coinMetadata.getCoinMetadata(e)}async fetchRoutes(e,A){let a=this.aggregators.filter(({name:t})=>this.activeAggregator.get(t)===true),o=[],s=[],r=a.map(async t=>{this._fetchingStatus.set(t.name,true),this.events.emit("aggregatorFetchStart",{name:t.name});try{let c=await t.fetchRoute(e,A?.abortSignal);o.push(c),A?.onRouteFound?.(c);}catch(c){let i={name:t.name,reason:c};s.push(i),A?.onError?.(i);}finally{this._fetchingStatus.set(t.name,false),this.events.emit("aggregatorFetchEnd",{name:t.name});}});return await Promise.all(r),{routes:o.sort((t,c)=>bignumber_js.BigNumber(c.formattedResult.coinOut.amount).comparedTo(t.formattedResult.coinOut.amount)??0),errors:s}}async buildRouteTransaction(e,A={}){let{mergeResult:a=true,txExtensionParams:o}=A,s=this.aggregatorMap.get(e.formattedResult.name);if(!s)throw new Error(`Aggregator ${e.formattedResult.name} not found in the aggregator list`);let{tx:r,coinOut:t}=await s.buildSwapTransaction({route:e,slippage:A.slippage??this.slippage,txExtensionParams:o}),c=e.formattedResult.coinOut.type;return a?(await S(r,t,this.client,c,this.walletAddress),{tx:r,coinOutType:c}):{tx:r,coinOut:t,coinOutType:c}}async executeSwapTransaction(e,A=false){return this.#e(),A?(e.setSender(this.walletAddress),this.suiKit.dryRunTxn(e)):this.suiKit.signAndSendTxn(e)}};function u(n,e){let A;return async()=>{if(A)return A;try{return A=await e(),A}catch{throw new Error(`${n} is required but not installed. Install it with: pnpm add ${n}`)}}}var _=u("@cetusprotocol/aggregator-sdk",()=>import('@cetusprotocol/aggregator-sdk')),T=class extends l{constructor(e){super("cetus",e);}async ensureClient(){if(!this.client){let{AggregatorClient:e,ALL_DEXES:A,Env:a}=await _(),o=this.suiClient.network;this.client=new e({endpoint:"https://api-sui.cetus.zone/router_v3/find_routes",signer:this.walletAddress,client:new jsonRpc.SuiJsonRpcClient({url:jsonRpc.getJsonRpcFullnodeUrl(o),network:o}),env:a.Mainnet}),this.poolsMap.size===0&&(this.poolsMap=new Map(A.map(s=>[s,true])));}return this.client}createRoute(e,A,a){let o=[],s=null;for(let t of e)t.from===A&&(s={paths:[],coinIn:{type:t.from,amount:BigInt(t.amountIn)},coinOut:{type:t.target,amount:BigInt(t.amountOut)}},o.push(s)),s&&(s.paths.push({protocolName:t.provider,coinIn:{type:t.from,amount:BigInt(t.amountIn)},coinOut:{type:t.target,amount:BigInt(t.amountOut)}}),s.coinOut={type:t.target,amount:BigInt(t.amountOut)},t.target===a&&(s=null));let r=o.reduce((t,c)=>t+c.coinIn.amount,BigInt(0)).toString();return r!=="0"&&o.forEach(t=>{t.splitPercentage=bignumber_js.BigNumber(t.coinIn.amount.toString()).div(r).times(100).toNumber();}),o}parseRawToFormattedResult({routerData:e,coinInType:A,coinOutType:a}){return {coinIn:{type:A,amount:BigInt(e.amountIn.toString()??"0")},coinOut:{type:a,amount:BigInt(e.amountOut.toString()??"0")},routes:this.createRoute(e.paths,A,a)}}setFetchRouteSettings(e){this.fetchSettings=e;}calcSlippage(e){return e}async fetchRoute(e,A){let a=await this.ensureClient(),o=this.normalizeFetchRouteParams(e),{coinInType:s,coinOutType:r,swapAmount:t}=o;this.rawRouteResult=void 0;let c=await this.withTimeout(a.findRouters({...this.fetchSettings,from:utils.normalizeStructTag(s),target:utils.normalizeStructTag(r),amount:new J__default.default(t.toString()),byAmountIn:true,providers:this.getEnabledPools()}),A);if(!c)throw new Error(`${this.name} fetch route returned empty response`);return this.rawRouteResult=c,{formattedResult:{...this.parseRawToFormattedResult({routerData:c,coinInType:s,coinOutType:r}),name:this.name},rawRouteResult:c}}async buildSwapTransaction(e){this.validateWalletAddress();let A=await this.ensureClient(),{txExtensionParams:a,slippage:o,route:s}=e,r=s?.rawRouteResult??this.rawRouteResult;if(!r)throw new Error(`${this.name} buildSwapTransaction requires a route, but none was provided or fetched.`);let t=null,c=null;if(a){let{initTx:f,coinIn:d}=a;t=f,c=d;}else t=new transactions.Transaction,t.setSender(this.walletAddress),c=await this.selectCoinInForSwap(t,BigInt(r.amountIn.toString()),utils.normalizeStructTag(r.paths[0].from));let i=await A.routerSwap({router:r,txb:t,slippage:this.calcSlippage(o),inputCoin:c});return {tx:t,coinOut:i}}};var P={faucet:{packages:{faucet:"",suiFrensGenesisWrapper:""},objects:{faucet:"",suiFrensMint:""}},staking:{packages:{events:"0x7f6ce7ade63857c4fd16ef7783fed2dfc4d7fb7e40615abdb653030b76aef0c6",lsd:"0x1575034d2729907aefca1ac757d6ccfcd3fc7e9e77927523c06007d8353ad836",afsui:"0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc"},objects:{stakedSuiVault:"0x2f8f6d5da7f13ea37daa397724280483ed062769813b6f31e9788e59cc88994d",stakedSuiVaultState:"0x55486449e41d89cfbdb20e005c1c5c1007858ad5b4d5d7c047d2b3b592fe8791",safe:"0xeb685899830dd5837b47007809c76d91a098d52aabbf61e8ac467c59e5cc4610",treasury:"0xd2b95022244757b0ab9f74e2ee2fb2c3bf29dce5590fa6993a85d64bd219d7e8",referralVault:"0x4ce9a19b594599536c53edb25d22532f82f18038dc8ef618afd00fbbfb9845ef",validatorConfigsTable:"0x8536350cfb8a8efdd133a1e087b55416d431f7e8b894f77b55b20c4b799ebad9",aftermathValidator:"0xd30018ec3f5ff1a3c75656abf927a87d7f0529e6dc89c7ddd1bd27ecb05e3db2"}},pools:{packages:{amm:"0xc4049b2d1cc0f6e017fda8260e4377cecd236bd7f56a54fee120816e72e2e0dd",ammInterface:"0x8d8bba50c626753589aa5abbc006c9fa07736f55f4e6fb57481682997c0b0d52",events:"0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c",eventsV2:"0xc4049b2d1cc0f6e017fda8260e4377cecd236bd7f56a54fee120816e72e2e0dd"},objects:{poolRegistry:"0xfcc774493db2c45c79f688f88d28023a3e7d98e4ee9f48bbf5c7990f651577ae",protocolFeeVault:"0xf194d9b1bcad972e45a7dd67dd49b3ee1e3357a00a50850c52cd51bb450e13b4",treasury:"0x28e499dff5e864a2eafe476269a4f5035f1c16f338da7be18b103499abf271ce",insuranceFund:"0xf0c40d67b078000e18032334c3325c47b9ec9f3d9ae4128be820d54663d14e3b",lpCoinsTable:"0x7f3bb65251feccacc7f48461239be1008233b85594114f7bf304e5e5b340bf59"},other:{createLpCoinPackageCompilations:{0:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEAAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[167,102,246,194,32,223,3,45,134,147,18,9,59,94,154,58,126,34,119,96,13,193,175,198,63,222,118,4,234,110,46,214]}',1:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEBAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[68,93,25,253,95,37,116,117,115,245,79,81,250,68,193,193,125,175,148,139,217,235,215,33,240,45,78,14,3,86,156,253]}',2:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgECAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[226,124,21,102,7,55,200,164,249,68,13,253,43,195,52,31,88,207,26,30,152,251,208,57,135,126,235,45,23,164,119,82]}',3:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEDAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[1,144,16,189,84,90,47,167,188,222,48,174,25,190,46,185,6,221,67,91,132,40,116,30,179,102,100,127,83,12,109,13]}',4:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEEAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[188,181,24,0,200,201,56,67,47,157,254,230,47,200,183,173,203,125,184,180,21,175,170,42,167,82,194,112,35,226,84,160]}',5:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEFAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[139,229,11,229,58,97,20,164,146,173,45,172,225,131,71,62,84,106,77,218,122,249,243,255,146,34,28,60,77,35,55,138]}',6:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEGAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[57,76,77,44,68,157,60,123,68,75,189,64,53,35,82,187,207,42,126,62,112,57,251,96,190,255,39,160,152,130,157,52]}',7:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEHAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[123,60,245,235,196,138,131,187,192,81,41,5,55,144,176,99,178,245,228,90,186,155,175,11,175,182,127,251,112,69,207,36]}',8:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEIAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[62,140,187,2,13,226,252,216,57,79,25,215,73,0,30,117,240,181,17,67,90,160,116,93,0,185,100,177,98,158,120,249]}',9:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEJAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[224,168,250,132,113,73,22,162,90,31,20,5,146,218,102,211,9,26,235,144,153,60,68,242,99,43,182,103,163,123,70,243]}',10:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEKAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[230,2,103,229,53,229,25,139,165,170,103,184,37,95,22,138,144,54,70,94,84,1,166,69,226,228,2,111,190,177,88,67]}',11:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgELAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[47,22,229,32,128,229,189,95,254,208,76,7,63,57,67,181,242,47,139,87,115,116,187,69,186,231,157,193,217,175,119,251]}',12:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEMAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[84,220,49,85,231,231,205,206,223,231,112,68,34,157,61,115,234,156,6,203,2,158,212,203,215,170,136,228,68,193,188,13]}',13:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgENAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[237,140,135,226,69,221,118,110,149,250,210,127,140,11,253,163,73,64,189,152,115,51,234,40,195,87,188,107,171,233,96,99]}',14:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEOAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[178,202,9,164,149,122,241,165,109,17,64,83,161,86,55,194,230,149,60,174,236,221,205,150,98,176,28,228,122,182,83,85]}',15:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEPAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[162,91,42,1,93,167,63,154,173,142,135,15,249,131,197,24,69,164,212,169,231,169,19,38,42,86,25,84,219,229,233,20]}',16:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgEQAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[79,121,127,12,72,247,127,165,243,18,184,175,76,20,119,251,245,47,31,190,247,87,15,198,47,204,130,99,18,94,161,74]}',17:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgERAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[40,28,55,168,44,135,53,11,9,113,97,54,212,21,163,15,203,241,151,5,117,250,3,22,135,69,113,175,166,166,111,19]}',18:'{"modules":["oRzrCwYAAAAKAQAGAgYIAw4LBBkCBRsRByxPCHtgBtsBAwreAQUM4wEPAAICAwEHAAACAAIBAgAABgABAAEEAwEBAgECAggABwgBAAEIAAMJAAIHCAEFQUZfTFAJVHhDb250ZXh0BWFmX2xwDWFtbV9pbnRlcmZhY2UOY3JlYXRlX2xwX2NvaW4LZHVtbXlfZmllbGQEaW5pdAp0eF9jb250ZXh0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgYl3CzUCu45mKHWYg3oiSlkwVBm4KKF2LVzkQ7Ux11QAgESAAIBBQEAAAAAAQULAAcACwE4AAIA"],"dependencies":["0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c","0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50","0x712579292f80c11a0c9de4ff553d6e5c4757105e83a8a3129823d2b39e65d062","0xa6baab1e668c7868991c1c3c11e144100f5734c407d020f72a01b9d1a8bcb97f","0x0000000000000000000000000000000000000000000000000000000000000001","0x2d9316f1f1a95f6d7c85a4e690ef7c359e6649773ef2c37ad7d9857adb6bef06","0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf","0x0000000000000000000000000000000000000000000000000000000000000002","0x64213b0e4a52bac468d4ac3f140242f70714381653a1919a6d57cd49c628207a","0x73baa782c55003b3a359dec04b189312565d18e7309d4a51f5f112f891e3b2ab"],"digest":[173,252,173,67,1,192,123,156,242,232,253,247,12,147,190,24,152,41,3,166,219,90,110,43,48,139,30,235,10,219,209,58]}'}}},daoFeePools:{packages:{amm:"0x5ad6890968efcf3d20899e0cec735214f1067b96e77e77d86408989998468bb2",events:"0x6f60a091637054e23915b8745c0c0d47b1d49618ee3435b5f68eccf6a44fb53d"},objects:{version:"0xb4bfb0f917f12ad2a772bea9b4f22431f6f5f9653162c3ae6fae5b99b21392b7"}},farms:{packages:{vaults:"0x7ce31301b506b4ed327523061fe95d9c347082fa60da39733f74ffad9a53f8f5",vaultsInitial:"0x4f0a1a923dd063757fd37e04a9c2cee8980008e94433c9075c390065f98e9e4b",vaultsV2:"0x2d6755e10132fc1eab5e8a4a3e7ddfdacc31884621592d95fce48ecf1e157db9",eventsV2:"0x79ee374b9e3c60c00a19fdbeaea25731bbea8f2cab9bb61bb712543e0ba55b7a"},objects:{version:"0xdc372fa9b6a538382efc560478a786fcf04e6e34850100020056c98c5c387193"}},dca:{packages:{dca:"0x409e2ace51cc5821be41a667e4cb9afa64cde49a7f940c68109db24b39ca93b8",events:"0x002134246a32eec18e68f1f5aadb8edd34856298ae6d32c145d28f3ca46c7fd1",eventsV2:"0x409e2ace51cc5821be41a667e4cb9afa64cde49a7f940c68109db24b39ca93b8"},objects:{config:"0x1b26465e9c688e3a3d2301f26e25091bc0f91708d953dc220f5697faa8ba9bd6"}},limitOrders:{packages:{limitOrders:"0xe57ee3613b7dece546f8a2d8a53145cbab41d32b86037b94f9ebfcbcfa66885a",events:"0xe57ee3613b7dece546f8a2d8a53145cbab41d32b86037b94f9ebfcbcfa66885a"}},sharedCustody:{address:"0xafe2fafac0b048c9c70a61cc1798400a85173df96b30118c40af6f3382b5a777",publicKey:"AMylYwVSuJQmTmDm6KuPlNwLnTtkk63HqOByubxxsVeC"},referralVault:{packages:{referralVault:"0xc66fabf1a9253e43c70f1cc02d40a1d18db183140ecaae2a3f58fa6b66c55acf"},objects:{referralVault:"0x35d35b0e5b177593d8c3a801462485572fc30861e6ce96a55af6dc4730709278"}},suiFrens:{packages:{suiFrens:"",suiFrensBullshark:"",accessories:"",suiFrensVault:"",suiFrensVaultCapyLabsExtension:""},objects:{capyLabsApp:"",suiFrensVault:"",suiFrensVaultStateV1:"",suiFrensVaultStateV1MetadataTable:"",suiFrensVaultCapyLabsExtension:""}},router:{packages:{utils:"0xdc15721baa82ba64822d585a7349a1508f76d94ae80e899b06e48369c257750e"}},dynamicGas:{sponsorAddress:"0xae4ba5f592e695a46d58a0579aa5d4f6ebead46be0f2d5bd229d5c292290548c"},perpetuals:{packages:{events:"0x21d001e8b07da2e3facb3e2d636bbaef43ba3c978bd84810368840b7d57c5068"},objects:{registry:"0xd0b3ea6b7a2f5887543a5a493aa70bcd0ec1a2d9c03d830504234df3e8c6a609"}},perpetualsVaults:{other:{createLpCoinPackageCompilation:'{"modules":["oRzrCwYAAAAKAQAOAg4eAywsBFgIBWBZB7kB4gEImwOAAQabBGcKggUFDIcFLAASAwcBDQIGAhMCFAIVAAICAAIBBwEAAAMADAEAAQMDDAEAAQUEAgAGBQcAAAoAAQABCwEDAAIRBgcBAAMICQoBAgQOBgEBDAQPDwEBDAUQDA0ABgwEBQACBQMIBAsFDgIIAAcIBAACCwIBCAALAwEIAAECAQoCAQgFAQkAAQsBAQkAAQgABwkAAgoCCgIKAgsBAQgFBwgEAgsDAQkACwIBCQABCwIBCAABBggEAQUBCwMBCAACCQAFDENvaW5NZXRhZGF0YQZPcHRpb24IVEVNUExBVEULVHJlYXN1cnlDYXAJVHhDb250ZXh0A1VybARjb2luCWNvbnN0YW50cw9jcmVhdGVfY3VycmVuY3kLZHVtbXlfZmllbGQEaW5pdAtscF9kZWNpbWFscxVuZXdfdW5zYWZlX2Zyb21fYnl0ZXMGb3B0aW9uFHB1YmxpY19mcmVlemVfb2JqZWN0D3B1YmxpY190cmFuc2ZlcgZzZW5kZXIEc29tZQh0ZW1wbGF0ZQh0cmFuc2Zlcgp0eF9jb250ZXh0A3VybAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAp4geY2XwRD2s2t7PYVDqpJGMi7y/Y2DrXnvMyXUc7wvCgIJCFRFTVBMQVRFCgIKCUNPSU4gTkFNRQoCERBDT0lOIERFU0NSSVBUSU9OCgI3Nmh0dHBzOi8vYWZ0ZXJtYXRoLmZpbmFuY2UvY29pbnMvcGVycGV0dWFscy9kZWZhdWx0LnN2ZwACAQkBAAAAAAIUCwARAQcABwEHAgcDEQc4AAoBOAEMAgwDCwI4AgsDCwEuEQY4AwIA"],"dependencies":["0x46234ba81f3a5ba6571383233df0f9ea5fe60a3a327537be1f5fec447bced693","0x9e20798d97c110f6b36b7b3d8543aa9246322ef2fd8d83ad79ef3325d473bc2f","0xa8172ed2a6f14cd0ee55124326685713d6f765039e7c5339f7a0b57be06fddb5","0x21d001e8b07da2e3facb3e2d636bbaef43ba3c978bd84810368840b7d57c5068","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000002"],"digest":[197,20,191,110,212,210,250,216,46,69,171,178,75,240,176,17,254,237,222,251,192,94,195,175,10,216,89,18,238,154,114,144]}'}},scallop:{objects:{version:"",afSuiMarket:"",coinDecimalsRegistry:"",xOracle:""}},nftAmm:{packages:{nftAmm:""},objects:{protocolFeeVault:"",treasury:"",insuranceFund:"",referralVault:""}},nfts:{packages:{mystenTransferPolicy:"0x0cb4bcc0560340eb1a1b929cabe56b33fc6449820ec8c1980d69bb98b649b802"}}};var a0=u("aftermath-ts-sdk",()=>import('aftermath-ts-sdk')),o0=["Aftermath","Bolt","Bluefin","BlueMove","Cetus","DeepBook","DeepBookV3","DoubleUpPump","FlowX","FlowXClmm","FullSail","HopFun","Kriya","KriyaClmm","Magma","Metastable","Momentum","MovePump","Obric","SpringSui","Steamm","SuiAi","SuiSwap","Turbos","TurbosFun","BlastFun"],Q=class extends l{afApi;_afParams;constructor(e){super("aftermath",e),this._afParams=e,this.poolsMap=new Map(o0.map(A=>[A,true]));}async ensureClient(){if(!this.client){let{AftermathApi:e,Aftermath:A}=await a0(),a=this.suiClient.network;this.afApi=new e(new jsonRpc.SuiJsonRpcClient({url:jsonRpc.getJsonRpcFullnodeUrl(a),network:a}),this._afParams.addresses??P),this.client=new A("MAINNET",this.afApi);}return this.client}async getRouter(){return (await this.ensureClient()).Router()}setFetchRouteSettings(e){this.fetchSettings=e;}calcSlippage(e){return e}parseRawRouteToFormattedResult(e){let A=e.coinIn.amount,a={...e,name:this.name};return a.routes.forEach(o=>{let s=o.paths[0].coinIn.amount;o.splitPercentage=bignumber_js.BigNumber(s.toString()).div(A.toString()).times(100).toNumber();}),a}async fetchRoute(e,A){let a=await this.getRouter(),o=this.normalizeFetchRouteParams(e),{coinInType:s,coinOutType:r,swapAmount:t}=o;this.rawRouteResult=void 0;let c=await this.withTimeout(a.getCompleteTradeRouteGivenAmountIn({...this.fetchSettings,protocolWhitelist:this.getEnabledPools(),coinInType:s,coinOutType:r,coinInAmount:t},A));if(!c)throw new Error(`${this.name} fetch route returned empty response`);return this.rawRouteResult=c,{formattedResult:this.parseRawRouteToFormattedResult(c),rawRouteResult:c}}async buildSwapTransaction(e){this.validateWalletAddress();let A=await this.getRouter(),{txExtensionParams:a,slippage:o,route:s}=e,r=s?.rawRouteResult??this.rawRouteResult;if(!r)throw new Error(`${this.name} build swap transaction failed: no route available`);let t=null,c=null;if(a){let{initTx:d,coinIn:b}=a;t=d,c=b;}else t=new suiKit.Transaction,t.setSender(this.walletAddress),c=await this.selectCoinInForSwap(t,BigInt(r.coinIn.amount.toString()),suiKit.normalizeStructTag(r.coinIn.type));let{tx:i,coinOutId:f}=await A.addTransactionForCompleteTradeRoute({walletAddress:this.walletAddress,completeRoute:r,slippage:this.calcSlippage(o),tx:t,coinInId:c});if(!f)throw new Error(`${this.name} build swap transaction failed`);return {tx:i,coinOut:f}}};var r0=u("@7kprotocol/sdk-ts",()=>import('@7kprotocol/sdk-ts')),n0=["bluefin7k","cetus","flowx"],v=class extends l{_constructorParams;constructor(e){super("7k",e),this._constructorParams=e,this.poolsMap=new Map(n0.map(A=>[A,true]));}async ensureClient(){if(!this.client){let{MetaAg:e}=await r0(),A=this.suiClient.network;this.client=new e({fullnodeUrl:jsonRpc.getJsonRpcFullnodeUrl(A),partner:this._constructorParams.commission?.partner??this.walletAddress,partnerCommissionBps:this._constructorParams.commission?.commissionBps??0,...this._constructorParams.fetchSettings});}return this.client}setSuiClient(e){super.setSuiClient(e);let A=e.network;this.client?.updateMetaAgOptions({fullnodeUrl:jsonRpc.getJsonRpcFullnodeUrl(A)});}setFetchRouteSettings(e){this.fetchSettings=e,this.client?.updateMetaAgOptions(e);}calcSlippage(e){return Math.round(e*1e4)}parseRawRouteToFormattedResult(e){return {routes:[{paths:[],coinIn:{type:e.coinTypeIn,amount:BigInt(e.amountIn)},coinOut:{type:e.coinTypeOut,amount:BigInt(e.amountOut)},splitPercentage:100}],coinIn:{type:e.coinTypeIn,amount:BigInt(e.amountIn)},coinOut:{type:e.coinTypeOut,amount:BigInt(e.amountOut)},name:this.name}}async fetchRoute(e,A){let a=await this.ensureClient(),o=this.normalizeFetchRouteParams(e),{coinInType:s,coinOutType:r,swapAmount:t}=o;this.rawRouteResult=void 0;let c=new Set(this.getEnabledPools()),f=(await this.withTimeout(a.quote({coinTypeIn:s,coinTypeOut:r,amountIn:t.toString()}),A)).filter(b=>c.has(b.provider));if(!f||f.length===0)throw new Error(`${this.name} fetch route returned empty response`);let d=f.sort((b,w)=>Number(BigInt(w.amountOut)-BigInt(b.amountOut)))[0];return this.rawRouteResult=d,{formattedResult:this.parseRawRouteToFormattedResult(d),rawRouteResult:d}}async buildSwapTransaction(e){this.validateWalletAddress();let A=await this.ensureClient(),{txExtensionParams:a,slippage:o,route:s}=e,r=s?.rawRouteResult??this.rawRouteResult;if(!r)throw new Error(`${this.name} build swap transaction failed: no route available`);let t,c;a?(t=a.initTx,c=a.coinIn):(t=new suiKit.Transaction,t.setSender(this.walletAddress),c=await this.selectCoinInForSwap(t,BigInt(r.amountIn),suiKit.normalizeStructTag(r.coinTypeIn)));let i=await A.swap({quote:r,signer:this.walletAddress,tx:t,coinIn:c},this.calcSlippage(o));return {tx:t,coinOut:i}}};var Y=u("@flowx-finance/sdk",()=>import('@flowx-finance/sdk')),X=class extends l{commission;constructor(e){super("flowx",e),this.commission=e.commission;}async ensureClient(){if(!this.client){let{AggregatorQuoter:e,Protocol:A}=await Y();this.client=new e("mainnet"),this.poolsMap.size===0&&(this.poolsMap=new Map(Object.values(A).map(a=>[a,true])));}return this.client}setFetchRouteSettings(e){this.fetchSettings=e;}calcSlippage(e){return bignumber_js.BigNumber(e).multipliedBy(1e6).integerValue().toNumber()}parseRawRouteToFormattedResult(e){let A=[];for(let a of e.routes)A.push({paths:a.paths.map(o=>({protocolName:I(o.protocol()?.toLowerCase()??""),coinIn:{amount:BigInt((o.amountIn??0).toString()),type:o.input.coinType},coinOut:{amount:BigInt((o.amountOut??0).toString()),type:o.output.coinType}})),splitPercentage:Number(a.amountIn??0)/Number(this.rawRouteResult?.amountIn??1)*100,coinIn:{amount:BigInt(a.amountIn.toString()),type:utils.normalizeStructTag(a.input.coinType)},coinOut:{amount:BigInt(a.amountOut.toString()),type:utils.normalizeStructTag(a.output.coinType)}});return {routes:A,coinIn:{type:utils.normalizeStructTag(e.coinIn.coinType),amount:BigInt(e.amountIn.toString())},coinOut:{type:utils.normalizeStructTag(e.coinOut.coinType),amount:BigInt(e.amountOut.toString())},name:this.name}}async fetchRoute(e,A){let a=await this.ensureClient(),o=this.normalizeFetchRouteParams(e);this.rawRouteResult=void 0;let{coinInType:s,coinOutType:r,swapAmount:t}=o,c=await this.withTimeout(a.getRoutes({...this.fetchSettings,tokenIn:s,tokenOut:r,amountIn:t.toString(),commission:this.commission,includeSources:this.getEnabledPools()}),A);if(!c)throw new Error(`${this.name} fetch route returned empty response`);return this.rawRouteResult=c,{formattedResult:this.parseRawRouteToFormattedResult(c),rawRouteResult:c}}async buildSwapTransaction(e){this.validateWalletAddress();let{TradeBuilder:A}=await Y(),{txExtensionParams:a,slippage:o,route:s}=e,r=s?.rawRouteResult??this.rawRouteResult;if(!r)throw new Error(`${this.name} build swap transaction failed: no route available`);let t=null,c=null;if(a){let{initTx:b,coinIn:w}=a;t=b,c=w;}else t=new transactions.Transaction,t.setSender(this.walletAddress),c=await this.selectCoinInForSwap(t,BigInt(r.amountIn.toString()),utils.normalizeStructTag(r.coinIn.coinType));let i=new A("mainnet",r.routes).sender(this.walletAddress).slippage(this.calcSlippage(o)).deadline(Date.now()+60*60*1e3),d=await(this.commission?i.commission(this.commission).build():i.build()).swap({client:new jsonRpc.SuiJsonRpcClient({network:this.suiClient.network,url:suiKit.getFullnodeUrl(this.suiClient.network)}),tx:t,coinIn:c});if(!d)throw new Error(`${this.name} build swap transaction failed`);return {tx:t,coinOut:d}}};
|
|
17
|
+
|
|
18
|
+
exports.AftermathSwap = Q;
|
|
19
|
+
exports.Aggregator = y;
|
|
20
|
+
exports.CetusSwap = T;
|
|
21
|
+
exports.CoinMetadataRegistry = p;
|
|
22
|
+
exports.FlowXSwap = X;
|
|
23
|
+
exports.SwapSdkBase = l;
|
|
24
|
+
exports.TypedEventEmitter = m;
|
|
25
|
+
exports._7kSwap = v;
|
|
26
|
+
exports.isSuiType = B;
|
|
27
|
+
exports.mergeWithExistingOrTransfer = S;
|
|
28
|
+
exports.selectCoins = E;
|
|
29
|
+
exports.transformProperCase = I;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
1
|
+
import * as _mysten_sui_client from '@mysten/sui/client';
|
|
2
|
+
import { ClientWithCoreApi, SuiClientTypes } from '@mysten/sui/client';
|
|
3
3
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
4
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
4
5
|
import { EventEmitter } from 'events';
|
|
5
6
|
import * as _scallop_io_sui_kit from '@scallop-io/sui-kit';
|
|
6
|
-
import { SuiKitParams, AccountManagerParams, Transaction as Transaction$1, TransactionObjectArgument as TransactionObjectArgument$1, SuiKit } from '@scallop-io/sui-kit';
|
|
7
|
-
import * as _mysten_sui_dist_cjs_transactions from '@mysten/sui/dist/cjs/transactions';
|
|
7
|
+
import { SuiKitParams, AccountManagerParams, Transaction as Transaction$1, TransactionObjectArgument as TransactionObjectArgument$1, SuiKit, SuiTransactionBlockResponse, SimulateTransactionResponse } from '@scallop-io/sui-kit';
|
|
8
8
|
import { RouterDataV3, FindRouterParams, AggregatorClient, AggregatorClientParams } from '@cetusprotocol/aggregator-sdk';
|
|
9
9
|
export { AggregatorClient, RouterDataV3 } from '@cetusprotocol/aggregator-sdk';
|
|
10
|
-
import * as aftermath_ts_sdk from 'aftermath-ts-sdk';
|
|
11
10
|
import { RouterProtocolName, RouterCompleteTradeRoute, ApiRouterPartialCompleteTradeRouteBody, Aftermath, AftermathApi, ConfigAddresses } from 'aftermath-ts-sdk';
|
|
12
11
|
export { Aftermath, RouterCompleteTradeRoute } from 'aftermath-ts-sdk';
|
|
13
|
-
import {
|
|
14
|
-
export {
|
|
15
|
-
import { Protocol, GetRoutesResult, Coin as Coin$1, SingleQuoteQueryParams, AggregatorQuoter, Commission
|
|
12
|
+
import { EProvider, MetaQuote, MetaAgOptions, MetaAg } from '@7kprotocol/sdk-ts';
|
|
13
|
+
export { MetaQuote as _7kQuoteResponse } from '@7kprotocol/sdk-ts';
|
|
14
|
+
import { Protocol, GetRoutesResult, Coin as Coin$1, SingleQuoteQueryParams, AggregatorQuoter, Commission } from '@flowx-finance/sdk';
|
|
16
15
|
export { AggregatorQuoter, GetRoutesResult } from '@flowx-finance/sdk';
|
|
17
16
|
|
|
18
17
|
type SecretKeyOrMnemonicsOrWalletAddress = {
|
|
@@ -29,7 +28,7 @@ type SecretKeyOrMnemonicsOrWalletAddress = {
|
|
|
29
28
|
secretKey?: never;
|
|
30
29
|
};
|
|
31
30
|
type SuiClientOrFullnodeUrl = {
|
|
32
|
-
client?:
|
|
31
|
+
client?: ClientWithCoreApi;
|
|
33
32
|
fullnodeUrl?: never;
|
|
34
33
|
} | {
|
|
35
34
|
fullnodeUrl?: string;
|
|
@@ -100,7 +99,7 @@ type SwapBuildResult<MergeResult extends boolean> = MergeResult extends true ? {
|
|
|
100
99
|
coinOut: TransactionObjectArgument;
|
|
101
100
|
};
|
|
102
101
|
interface SwapSdkConstructorParams<T> {
|
|
103
|
-
suiClient?:
|
|
102
|
+
suiClient?: ClientWithCoreApi;
|
|
104
103
|
fetchTimeoutInMs?: number;
|
|
105
104
|
walletAddress: string;
|
|
106
105
|
fetchSettings?: T;
|
|
@@ -108,7 +107,7 @@ interface SwapSdkConstructorParams<T> {
|
|
|
108
107
|
/**
|
|
109
108
|
* Base interface for Swap SDK
|
|
110
109
|
*/
|
|
111
|
-
interface SwapSdkBaseInterface<PoolType = string, RawRouteResultType = any, FetchRouteSettings = any, SdkClient =
|
|
110
|
+
interface SwapSdkBaseInterface<PoolType = string, RawRouteResultType = any, FetchRouteSettings = any, SdkClient = ClientWithCoreApi> {
|
|
112
111
|
/**
|
|
113
112
|
* SDK specific client
|
|
114
113
|
*/
|
|
@@ -137,7 +136,7 @@ interface SwapSdkBaseInterface<PoolType = string, RawRouteResultType = any, Fetc
|
|
|
137
136
|
setFetchRouteSettings: (settings: FetchRouteSettings) => void;
|
|
138
137
|
togglePoolStatus: (pool: PoolType, enabled?: boolean) => void;
|
|
139
138
|
toggleAllPoolStatus: (enabled: boolean) => void;
|
|
140
|
-
setSuiClient: (client:
|
|
139
|
+
setSuiClient: (client: SuiGrpcClient) => void;
|
|
141
140
|
setWalletAddress: (address: string) => void;
|
|
142
141
|
/**
|
|
143
142
|
* Calculate slippage for the specific protocol.
|
|
@@ -208,7 +207,7 @@ declare abstract class SwapSdkBase<PoolType = string, RawRouteResultType = any,
|
|
|
208
207
|
readonly name: string;
|
|
209
208
|
readonly events: TypedEventEmitter<SwapSdkEvents<PoolType>>;
|
|
210
209
|
client?: SdkClient;
|
|
211
|
-
suiClient:
|
|
210
|
+
suiClient: ClientWithCoreApi;
|
|
212
211
|
fetchTimeoutInMs?: number;
|
|
213
212
|
walletAddress: string;
|
|
214
213
|
fetchSettings?: FetchRouteSettings;
|
|
@@ -222,7 +221,7 @@ declare abstract class SwapSdkBase<PoolType = string, RawRouteResultType = any,
|
|
|
222
221
|
client: SdkClient;
|
|
223
222
|
};
|
|
224
223
|
setWalletAddress(address: string): void;
|
|
225
|
-
setSuiClient(client:
|
|
224
|
+
setSuiClient(client: ClientWithCoreApi): void;
|
|
226
225
|
abstract calcSlippage(slippageInDecimal: number): number;
|
|
227
226
|
togglePoolStatus(pool: PoolType, enabled?: boolean): void;
|
|
228
227
|
toggleAllPoolStatus(enabled: boolean): void;
|
|
@@ -230,14 +229,14 @@ declare abstract class SwapSdkBase<PoolType = string, RawRouteResultType = any,
|
|
|
230
229
|
protected normalizeFetchRouteParams(params: FetchRouteParams): FetchRouteParams;
|
|
231
230
|
protected withTimeout<T>(fn: Promise<T>, abortSignal?: AbortSignal): Promise<T>;
|
|
232
231
|
selectCoinInForSwap(tx: Transaction, amount: bigint, coinType: string): Promise<{
|
|
233
|
-
$kind: "NestedResult";
|
|
234
232
|
NestedResult: [number, number];
|
|
233
|
+
$kind: "NestedResult";
|
|
235
234
|
} | {
|
|
236
235
|
$kind: "Input";
|
|
237
236
|
Input: number;
|
|
238
237
|
type?: "object";
|
|
239
238
|
}>;
|
|
240
|
-
protected selectCoins(coinType: string, amount: string): Promise<
|
|
239
|
+
protected selectCoins(coinType: string, amount: string): Promise<_mysten_sui_client.SuiClientTypes.Coin[]>;
|
|
241
240
|
abstract setFetchRouteSettings(settings: FetchRouteSettings): void;
|
|
242
241
|
abstract fetchRoute(params: FetchRouteParams, abortSignal?: AbortSignal): Promise<FetchRouteResult<RawRouteResultType>>;
|
|
243
242
|
abstract buildSwapTransaction(params: SwapParams<RawRouteResultType>): Promise<{
|
|
@@ -250,6 +249,7 @@ type FetchRouteSettings$3 = Omit<FindRouterParams, 'from' | 'target' | 'amount'
|
|
|
250
249
|
|
|
251
250
|
declare class CetusSwap extends SwapSdkBase<string, RouterDataV3, FetchRouteSettings$3, AggregatorClient> {
|
|
252
251
|
constructor(params: SwapSdkConstructorParams<FetchRouteSettings$3> & Omit<AggregatorClientParams, 'client'>);
|
|
252
|
+
private ensureClient;
|
|
253
253
|
private createRoute;
|
|
254
254
|
/**
|
|
255
255
|
* Parse the raw route data from Cetus to the standardized FetchRouteResult format.
|
|
@@ -273,18 +273,20 @@ declare class CetusSwap extends SwapSdkBase<string, RouterDataV3, FetchRouteSett
|
|
|
273
273
|
}>;
|
|
274
274
|
buildSwapTransaction(params: SwapParams<RouterDataV3>): Promise<{
|
|
275
275
|
tx: Transaction;
|
|
276
|
-
coinOut:
|
|
276
|
+
coinOut: TransactionObjectArgument;
|
|
277
277
|
}>;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
type FetchRouteSettings$2 = Omit<ApiRouterPartialCompleteTradeRouteBody, 'coinInType' | 'coinOutType' | 'coinInAmount' | 'protocolWhitelist' | 'protocolBlacklist'>;
|
|
281
281
|
|
|
282
282
|
declare class AftermathSwap extends SwapSdkBase<RouterProtocolName, RouterCompleteTradeRoute, FetchRouteSettings$2, Aftermath> {
|
|
283
|
-
|
|
283
|
+
afApi?: AftermathApi;
|
|
284
|
+
private _afParams;
|
|
284
285
|
constructor(params: SwapSdkConstructorParams<FetchRouteSettings$2> & {
|
|
285
286
|
addresses?: ConfigAddresses;
|
|
286
287
|
});
|
|
287
|
-
|
|
288
|
+
private ensureClient;
|
|
289
|
+
private getRouter;
|
|
288
290
|
setFetchRouteSettings(settings: FetchRouteSettings$2): void;
|
|
289
291
|
calcSlippage(slippageInDecimal: number): number;
|
|
290
292
|
private parseRawRouteToFormattedResult;
|
|
@@ -295,39 +297,28 @@ declare class AftermathSwap extends SwapSdkBase<RouterProtocolName, RouterComple
|
|
|
295
297
|
}>;
|
|
296
298
|
}
|
|
297
299
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
* @warning BluefinX must be explicitly specified if needed
|
|
305
|
-
* @example ```sources: [...DEFAULT_SOURCES, "bluefinx"]``` */
|
|
306
|
-
sources?: SourceDex[];
|
|
307
|
-
commissionBps?: number;
|
|
308
|
-
/** Limit the route to a specific set of pools */
|
|
309
|
-
targetPools?: string[];
|
|
310
|
-
/** Exclude a specific set of pools from the route */
|
|
311
|
-
excludedPools?: string[];
|
|
312
|
-
/** The taker address, required for bluefinx */
|
|
313
|
-
taker?: string;
|
|
314
|
-
/** If true, excludes all liquidity sources that depend on pyth price feeds - pyth client use tx.gas to pay the fee*/
|
|
315
|
-
isSponsored?: boolean;
|
|
316
|
-
}
|
|
317
|
-
type FetchRouteSettings$1 = Omit<Params, 'tokenIn' | 'tokenOut' | 'amountIn' | 'sources'>;
|
|
300
|
+
type FetchRouteSettings$1 = {
|
|
301
|
+
providers?: MetaAgOptions['providers'];
|
|
302
|
+
hermesApi?: string;
|
|
303
|
+
slippageBps?: number;
|
|
304
|
+
tipBps?: number;
|
|
305
|
+
};
|
|
318
306
|
|
|
319
|
-
declare class _7kSwap extends SwapSdkBase<
|
|
320
|
-
|
|
307
|
+
declare class _7kSwap extends SwapSdkBase<EProvider, MetaQuote, FetchRouteSettings$1, MetaAg> {
|
|
308
|
+
private _constructorParams;
|
|
321
309
|
constructor(params: SwapSdkConstructorParams<FetchRouteSettings$1> & {
|
|
322
|
-
commission?:
|
|
310
|
+
commission?: {
|
|
311
|
+
partner?: string;
|
|
312
|
+
commissionBps?: number;
|
|
313
|
+
};
|
|
323
314
|
});
|
|
324
|
-
|
|
315
|
+
private ensureClient;
|
|
316
|
+
setSuiClient(client: ClientWithCoreApi): void;
|
|
325
317
|
setFetchRouteSettings(settings: FetchRouteSettings$1): void;
|
|
326
318
|
calcSlippage(slippageInDecimal: number): number;
|
|
327
|
-
private createRoute;
|
|
328
319
|
private parseRawRouteToFormattedResult;
|
|
329
|
-
fetchRoute(params: FetchRouteParams, abortSignal?: AbortSignal): Promise<FetchRouteResult<
|
|
330
|
-
buildSwapTransaction(params: SwapParams<
|
|
320
|
+
fetchRoute(params: FetchRouteParams, abortSignal?: AbortSignal): Promise<FetchRouteResult<MetaQuote>>;
|
|
321
|
+
buildSwapTransaction(params: SwapParams<MetaQuote>): Promise<{
|
|
331
322
|
tx: Transaction$1;
|
|
332
323
|
coinOut: TransactionObjectArgument$1;
|
|
333
324
|
}>;
|
|
@@ -336,11 +327,11 @@ declare class _7kSwap extends SwapSdkBase<SourceDex, QuoteResponse, FetchRouteSe
|
|
|
336
327
|
type FetchRouteSettings = Omit<SingleQuoteQueryParams, 'amountIn' | 'tokenIn' | 'tokenOut' | 'excludeSources' | 'includeSources'>;
|
|
337
328
|
|
|
338
329
|
declare class FlowXSwap extends SwapSdkBase<Protocol, GetRoutesResult<Coin$1, Coin$1>, FetchRouteSettings, AggregatorQuoter> {
|
|
339
|
-
|
|
340
|
-
commission?: Commission$1;
|
|
330
|
+
commission?: Commission;
|
|
341
331
|
constructor(params: SwapSdkConstructorParams<FetchRouteSettings> & Omit<SingleQuoteQueryParams, 'amountIn' | 'tokenIn' | 'tokenOut'> & {
|
|
342
|
-
commission?: Commission
|
|
332
|
+
commission?: Commission;
|
|
343
333
|
});
|
|
334
|
+
private ensureClient;
|
|
344
335
|
setFetchRouteSettings(settings: FetchRouteSettings): void;
|
|
345
336
|
/**
|
|
346
337
|
* Calculate slippage for FlowX, which uses 6 decimals for slippage, e.g. 1% = 10000, 0.5% = 5000, 0.01% = 100
|
|
@@ -365,13 +356,13 @@ interface SdkRegistry {
|
|
|
365
356
|
type SdkName = keyof SdkRegistry;
|
|
366
357
|
|
|
367
358
|
declare class CoinMetadataRegistry {
|
|
368
|
-
client:
|
|
359
|
+
client: ClientWithCoreApi;
|
|
369
360
|
private cache;
|
|
370
|
-
constructor(client:
|
|
361
|
+
constructor(client: ClientWithCoreApi, initialData?: (SuiClientTypes.CoinMetadata & {
|
|
371
362
|
coinType: string;
|
|
372
363
|
})[]);
|
|
373
|
-
setClient(client:
|
|
374
|
-
getCoinMetadata(coinType: string): Promise<CoinMetadata>;
|
|
364
|
+
setClient(client: ClientWithCoreApi): void;
|
|
365
|
+
getCoinMetadata(coinType: string): Promise<SuiClientTypes.CoinMetadata>;
|
|
375
366
|
}
|
|
376
367
|
|
|
377
368
|
type TxExt = {
|
|
@@ -395,7 +386,7 @@ declare class Aggregator {
|
|
|
395
386
|
private poolStatusForwarders;
|
|
396
387
|
private allPoolStatusForwarders;
|
|
397
388
|
walletAddress: string;
|
|
398
|
-
client:
|
|
389
|
+
client: ClientWithCoreApi;
|
|
399
390
|
constructor(params: AggregatorConstructorParams);
|
|
400
391
|
private forwardPoolStatusChangeEvent;
|
|
401
392
|
addAggregator(aggregator: SwapSdkBase[]): void;
|
|
@@ -423,9 +414,9 @@ declare class Aggregator {
|
|
|
423
414
|
* @param timeoutInMs
|
|
424
415
|
*/
|
|
425
416
|
setFetchTimeoutInMs(timeoutInMs: number): void;
|
|
426
|
-
setSuiClient(client:
|
|
417
|
+
setSuiClient(client: SuiGrpcClient): void;
|
|
427
418
|
setWalletAddress(address: string): void;
|
|
428
|
-
getCoinMetadata(coinType: string): Promise<
|
|
419
|
+
getCoinMetadata(coinType: string): Promise<_mysten_sui_client.SuiClientTypes.CoinMetadata>;
|
|
429
420
|
/**
|
|
430
421
|
* Fetch swap routes from all aggregators, and sort them by best output amount
|
|
431
422
|
* @param params FetchRouteParams
|
|
@@ -449,13 +440,13 @@ declare class Aggregator {
|
|
|
449
440
|
mergeResult: false;
|
|
450
441
|
}): Promise<SwapBuildResult<false>>;
|
|
451
442
|
executeSwapTransaction(tx: Transaction): Promise<SuiTransactionBlockResponse>;
|
|
452
|
-
executeSwapTransaction(tx: Transaction, dryRun: true): Promise<
|
|
443
|
+
executeSwapTransaction(tx: Transaction, dryRun: true): Promise<SimulateTransactionResponse>;
|
|
453
444
|
executeSwapTransaction(tx: Transaction, dryRun: false): Promise<SuiTransactionBlockResponse>;
|
|
454
445
|
}
|
|
455
446
|
|
|
456
447
|
declare const isSuiType: (coinType: string) => boolean;
|
|
457
|
-
declare const selectCoins: (client:
|
|
458
|
-
declare const mergeWithExistingOrTransfer: (tx: Transaction, coin: TransactionObjectArgument, client:
|
|
448
|
+
declare const selectCoins: (client: ClientWithCoreApi, coinType: string, amount: string, owner: string) => Promise<SuiClientTypes.Coin[]>;
|
|
449
|
+
declare const mergeWithExistingOrTransfer: (tx: Transaction, coin: TransactionObjectArgument, client: ClientWithCoreApi, coinType: string, sender: string) => Promise<void>;
|
|
459
450
|
declare const transformProperCase: (provider: string) => string;
|
|
460
451
|
|
|
461
452
|
export { type FetchRouteSettings$2 as AftermathFetchRouteSettings, AftermathSwap, Aggregator, type AggregatorConstructorParams, type AggregatorEvent, type AggregatorEvents, type AggregatorStatusEvent, type AllSwapSdkPoolStatusEvent, type FetchRouteSettings$3 as CetusFetchRouteSettings, CetusSwap, type Coin, CoinMetadataRegistry, type FetchRouteParams, type FetchRouteResult, type FetchRoutesOptions, type FetchRouteSettings as FlowXFetchRouteSettings, FlowXSwap, type FormattedRouteResult, type SdkName, type SdkRegistry, type SecretKeyOrMnemonicsOrWalletAddress, type SlippageChangedEvent, type SuiClientOrFullnodeUrl, type SwapBuildResult, type SwapCoinInfo, type SwapParams, type SwapPath, type SwapRoute, SwapSdkBase, type SwapSdkBaseInterface, type SwapSdkConstructorParams, type SwapSdkEvents, type SwapSdkPoolStatusEvent, TypedEventEmitter, type FetchRouteSettings$1 as _7kFetchRouteSettings, _7kSwap, isSuiType, mergeWithExistingOrTransfer, selectCoins, transformProperCase };
|