@7kprotocol/sdk-ts 4.0.0 → 5.0.0-beta.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/README.md +22 -12
- package/dist/bluefin7k-63A5CV3A.mjs +2 -0
- package/dist/bluefin7k-63A5CV3A.mjs.map +1 -0
- package/dist/bluefin7k-MP3A4MG4.js +2 -0
- package/dist/bluefin7k-MP3A4MG4.js.map +1 -0
- package/dist/cetus-HOKHMQSS.mjs +2 -0
- package/dist/cetus-HOKHMQSS.mjs.map +1 -0
- package/dist/cetus-MUHFO44Y.js +2 -0
- package/dist/cetus-MUHFO44Y.js.map +1 -0
- package/dist/chunk-CYI4MM5C.mjs +2 -0
- package/dist/chunk-CYI4MM5C.mjs.map +1 -0
- package/dist/chunk-E5KM5OVW.js +2 -0
- package/dist/chunk-E5KM5OVW.js.map +1 -0
- package/dist/flowx-533PLKYB.mjs +2 -0
- package/dist/flowx-533PLKYB.mjs.map +1 -0
- package/dist/flowx-SIZHC2DP.js +2 -0
- package/dist/flowx-SIZHC2DP.js.map +1 -0
- package/dist/index.d.mts +44 -6
- package/dist/index.d.ts +44 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/dist/bluefin7k-I6ZCDWDN.js +0 -2
- package/dist/bluefin7k-I6ZCDWDN.js.map +0 -1
- package/dist/bluefin7k-TERLUCNL.mjs +0 -2
- package/dist/bluefin7k-TERLUCNL.mjs.map +0 -1
- package/dist/cetus-AU3OMWOY.mjs +0 -2
- package/dist/cetus-AU3OMWOY.mjs.map +0 -1
- package/dist/cetus-SIPX6FYL.js +0 -2
- package/dist/cetus-SIPX6FYL.js.map +0 -1
- package/dist/chunk-ETQEI4QC.mjs +0 -2
- package/dist/chunk-ETQEI4QC.mjs.map +0 -1
- package/dist/chunk-KVGSSW22.js +0 -2
- package/dist/chunk-KVGSSW22.js.map +0 -1
- package/dist/flowx-6M54WFWO.js +0 -2
- package/dist/flowx-6M54WFWO.js.map +0 -1
- package/dist/flowx-OXZZX5FD.mjs +0 -2
- package/dist/flowx-OXZZX5FD.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/metaAg.ts","../src/constants/_7k.ts","../src/features/metaAg/error.ts"],"sourcesContent":["import type {\n QuoteResponse,\n SourceDex,\n} from \"@bluefin-exchange/bluefin7k-aggregator-sdk\";\nimport type {\n PreSwapLpChangeParams,\n RouterDataV3,\n} from \"@cetusprotocol/aggregator-sdk\";\nimport type { AggregatorQuoter, Protocol } from \"@flowx-finance/sdk\";\nimport type { GasCostSummary } from \"@mysten/sui/client\";\nimport { SignatureWithBytes } from \"@mysten/sui/cryptography\";\nimport type {\n Transaction,\n TransactionObjectArgument,\n} from \"@mysten/sui/transactions\";\nimport { OkxSwapResponseData } from \"./okx\";\n\nexport enum EProvider {\n BLUEFIN7K = \"bluefin7k\",\n CETUS = \"cetus\",\n FLOWX = \"flowx\",\n OKX = \"okx\",\n}\ntype ProviderBaseOptions = {\n api?: string;\n apiKey?: string;\n disabled?: boolean;\n};\nexport type Bluefin7kProviderOptions = ProviderBaseOptions & {\n sources?: SourceDex[];\n excludedPools?: string[];\n targetPools?: string[];\n};\nexport type FlowxProviderOptions = ProviderBaseOptions & {\n sources?: Protocol[];\n excludePools?: string[];\n excludeSources?: Protocol[];\n maxHops?: number;\n splitDistributionPercent?: number;\n};\nexport type CetusProviderOptions = ProviderBaseOptions & {\n sources?: string[];\n splitCount?: number;\n splitAlgorithm?: string;\n splitFactor?: number;\n depth?: number;\n liquidityChanges?: PreSwapLpChangeParams[];\n};\nexport type OkxProviderOptions = Required<Omit<ProviderBaseOptions, \"api\">> & {\n api?: string;\n secretKey: string;\n apiPassphrase: string;\n projectId: string;\n};\nexport interface MetaAgOptions {\n /**If not specified, all providers will be used */\n providers?: {\n [EProvider.BLUEFIN7K]?: Bluefin7kProviderOptions;\n [EProvider.FLOWX]?: FlowxProviderOptions;\n [EProvider.CETUS]?: CetusProviderOptions;\n [EProvider.OKX]?: OkxProviderOptions;\n };\n /**Mainnet Json Rpc url, if not specified, the default mainnet url will be used */\n fullnodeUrl?: string;\n /**Hermes Api url, if not specified, the default hermes api url will be used */\n hermesApi?: string;\n /**Address to receive commission, if not specified, the commission will not be used */\n partner?: string;\n /**@default 0 */\n partnerCommissionBps?: number;\n /**@default 100 */\n slippageBps?: number;\n /**\n * Tip to support 7k\n * @default 0 */\n tipBps?: number;\n}\nexport interface MetaQuoteOptions {\n coinTypeIn: string;\n coinTypeOut: string;\n amountIn: string;\n /** Required for api-tx providers (ie: Okx) */\n signer?: string;\n /**\n * Timeout for quote operation in milliseconds\n * @default 2000ms\n */\n timeout?: number;\n}\nexport interface MetaSimulationOptions {\n sender: string;\n /**\n * Timeout for simulation operation in milliseconds\n * @default 2000ms\n */\n timeout?: number;\n /** If specify, defer the simulation that could reduce the time to display quote result, you must update the quote via the id on callback\n * else await all quote and simulation before return\n */\n onSimulated?: (payload: MetaQuote) => void;\n}\nexport interface MetaFastSwapOptions {\n /** Quote object from the quote operation */\n quote: MetaQuote;\n /** Signer address (owner of `coinIn`) */\n signer: string;\n /** If true, use the gas coin for the swap\n * @default true */\n useGasCoin?: boolean;\n /**\n * Sign the transaction bytes\n * @param txBytes - base64 transaction bytes\n * @returns - signature with bytes\n */\n signTransaction: (txBytes: string) => Promise<SignatureWithBytes>;\n}\nexport interface MetaSwapOptions {\n /** Quote object from the quote operation */\n quote: MetaQuote;\n /** Signer address (owner of `coinIn`) */\n signer: string;\n /** Transaction object to add the swap operation */\n tx: Transaction;\n /**\n * Coin object used for the swap, must be consumed completely, no `coinIn` left, user must pass the coinIn object with the balance required for the swap - ie in quote `amountIn`\n * @warning `coinIn` value must match the quote `amountIn` */\n coinIn: TransactionObjectArgument;\n}\n\nexport type FlowxQuoteResponse = Awaited<\n ReturnType<AggregatorQuoter[\"getRoutes\"]>\n>;\nexport type MetaQuote = (\n | {\n provider: EProvider.BLUEFIN7K;\n quote: QuoteResponse;\n }\n | {\n provider: EProvider.CETUS;\n quote: RouterDataV3;\n }\n | {\n provider: EProvider.FLOWX;\n quote: FlowxQuoteResponse;\n }\n | {\n provider: EProvider.OKX;\n quote: OkxSwapResponseData;\n }\n) & {\n /** uuid to keep track the quote result, used to apply simulation result on quote on callback `onSimulated`*/\n id: string;\n /** coin type: ie 0x2::sui::SUI */\n coinTypeIn: string;\n /** coin type: ie 0x2::sui::SUI */\n coinTypeOut: string;\n /** Amount in as u64 */\n amountIn: string;\n /** Amount out as u64 if there're no commission be applied to the amount out */\n rawAmountOut: string;\n /** Amount as u64 after minus any commission kind */\n amountOut: string;\n /** Simulated amount out if the transaction is executed */\n simulatedAmountOut?: string;\n /** Estimate gas consumption if the transaction is executed */\n gasUsed?: GasCostSummary;\n};\nexport interface QuoteProvider {\n readonly kind: EProvider;\n quote(_quoteOptions: MetaQuoteOptions): Promise<MetaQuote | null>;\n}\n\nexport interface SwapAPIProvider extends QuoteProvider {\n readonly kind: EProvider.OKX;\n fastSwap(options: MetaFastSwapOptions): Promise<string>;\n}\n\nexport interface AggregatorProvider extends QuoteProvider {\n readonly kind: EProvider.BLUEFIN7K | EProvider.CETUS | EProvider.FLOWX;\n swap(options: MetaSwapOptions): Promise<TransactionObjectArgument>;\n}\n\nexport const isAggregatorProvider = (\n provider: QuoteProvider,\n): provider is AggregatorProvider =>\n provider.kind === EProvider.BLUEFIN7K ||\n provider.kind === EProvider.CETUS ||\n provider.kind === EProvider.FLOWX;\n\nexport const isSwapAPIProvider = (\n provider: QuoteProvider,\n): provider is SwapAPIProvider => provider.kind === EProvider.OKX;\n","// export const _7K_PACKAGE_ID =\n// \"0x62412b7268c35f3808336aee57a52836501f40b8ba5d936f8ad275e672befd04\";\n// //legacy V4: \"0xe8f996ea6ff38c557c253d3b93cfe2ebf393816487266786371aa4532a9229f2\";\n// //legacy V3: \"0x7ea6e27ad7af6f3b8671d59df1aaebd7c03dddab893e52a714227b2f4fe91519\";\n// //legacy V2: \"0xa13447019cd982d6bef91cf7b46ad384a52583b1dfc2bdecf31ef0c4bd787a0f\";\n// //legacy V1: \"0xd48e7cdc9e92bec69ce3baa75578010458a0c5b2733d661a84971e8cef6806bc\";\n// export const _7K_CONFIG =\n// \"0x47442a93f7727d188ba7cb71031170d1786af70013cb7ad5115f3fe877ff0c54\";\n// //legacy v3: \"0x0f8fc23dbcc9362b72c7a4c5aa53fcefa02ebfbb83a812c8c262ccd2c076d9ee\";\n\n// export const _7K_VAULT =\n// \"0x442ad50389ed5cda6f7a6f5a7ae6361a4c05ef1d9fb2e54fbba5a268d690bfe6\";\n// //legacy v3: \"0x39a3c55742c0e011b6f65548e73cf589e1ae5e82dbfab449ca57f24c3bcd9514\";\nexport const _7K_META_PUBLISHED_AT =\n \"0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302\";\nexport const _7K_META_PACKAGE_ID =\n \"0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302\";\nexport const _7K_META_VAULT =\n \"0x9a8abd32fe5721307ce3b697cf982ee84e9ffbd58d667a4a199f1683c1a3d23c\";\nexport const _7K_META_CONFIG =\n \"0xbbb3a51877ed9b492f26f4e2181811cfb2bd70c532f6f7621263d122d5e96b56\";\nexport const _7K_PARTNER_ADDRESS =\n \"0x93ead46c1e48a9b62e25b6787f2ea6f75caedabb21726f12431acc4381f5f4c5\";\n","import { DevInspectResults } from \"@mysten/sui/client\";\nimport { EProvider, MetaQuote, MetaQuoteOptions } from \"../../types/metaAg\";\n\nexport enum MetaAgErrorCode {\n UNKNOWN = 1000,\n TIMEOUT = 1001,\n PROVIDER_NOT_FOUND = 1002,\n PROVIDER_NOT_SUPPORTED = 1003,\n INVALID_QUOTE = 1004,\n QUOTE_NOT_FOUND = 1005,\n INVALID_SIGNER_ADDRESS = 1006,\n PROVIDER_NOT_SUPPORT_SWAP = 1007,\n SIMULATION_FAILED = 1008,\n // OKX error\n OKX_FINALIZE_COMMAND_NOT_FOUND = 1100,\n}\n\nexport type MetaAgErrorDetailsMap = {\n [MetaAgErrorCode.UNKNOWN]: any;\n [MetaAgErrorCode.TIMEOUT]: { timeout: number };\n [MetaAgErrorCode.PROVIDER_NOT_FOUND]: { provider: EProvider };\n [MetaAgErrorCode.PROVIDER_NOT_SUPPORTED]: { provider: EProvider };\n [MetaAgErrorCode.INVALID_QUOTE]: {\n quote: MetaQuote;\n expectedProvider: EProvider;\n };\n [MetaAgErrorCode.QUOTE_NOT_FOUND]: {\n provider: EProvider;\n quoteOptions?: MetaQuoteOptions;\n };\n [MetaAgErrorCode.INVALID_SIGNER_ADDRESS]: { signer: string };\n [MetaAgErrorCode.PROVIDER_NOT_SUPPORT_SWAP]: { provider: EProvider };\n [MetaAgErrorCode.SIMULATION_FAILED]: { error: DevInspectResults[\"error\"] };\n // OKX error\n [MetaAgErrorCode.OKX_FINALIZE_COMMAND_NOT_FOUND]: { packageId: string };\n};\n\nexport type MetaAgErrorDetails<T extends MetaAgErrorCode> =\n T extends keyof MetaAgErrorDetailsMap ? MetaAgErrorDetailsMap[T] : never;\n\nexport class MetaAgError<T extends MetaAgErrorCode> extends Error {\n code: T;\n details?: MetaAgErrorDetails<T>;\n constructor(message: string, code?: T, details?: MetaAgErrorDetails<T>) {\n super(message);\n this.name = \"MetaAgError\";\n this.code = code ?? (MetaAgErrorCode.UNKNOWN as T);\n this.details = details;\n }\n\n static assert<T extends MetaAgErrorCode>(\n condition: any,\n message?: string | null,\n code?: T,\n details?: MetaAgErrorDetails<T>,\n ): asserts condition {\n if (!condition) {\n throw new MetaAgError(message ?? \"Assertion failed\", code, details);\n }\n }\n}\n"],"mappings":"2UAiBO,IAAKA,OACVA,EAAA,UAAY,YACZA,EAAA,MAAQ,QACRA,EAAA,MAAQ,QACRA,EAAA,IAAM,MAJIA,OAAA,IAqKCC,EACXC,GAEAA,EAAS,OAAS,aAClBA,EAAS,OAAS,SAClBA,EAAS,OAAS,QAEPC,EACXD,GACgCA,EAAS,OAAS,MClL7C,IAAME,EACX,qEACWC,EACX,qEACWC,EACX,qEACWC,EACX,qEACWC,EACX,qECkBK,IAAMC,EAAN,MAAMC,UAA+C,KAAM,CAGhE,YAAYC,EAAiBC,EAAUC,EAAiC,CACtE,MAAMF,CAAO,EACb,KAAK,KAAO,cACZ,KAAK,KAAOC,GAAS,IACrB,KAAK,QAAUC,CACjB,CAEA,OAAO,OACLC,EACAH,EACAC,EACAC,EACmB,CACnB,GAAI,CAACC,EACH,MAAM,IAAIJ,EAAYC,GAAW,mBAAoBC,EAAMC,CAAO,CAEtE,CACF","names":["EProvider","isAggregatorProvider","provider","isSwapAPIProvider","_7K_META_PUBLISHED_AT","_7K_META_PACKAGE_ID","_7K_META_VAULT","_7K_META_CONFIG","_7K_PARTNER_ADDRESS","MetaAgError","_MetaAgError","message","code","details","condition"]}
|
package/dist/chunk-KVGSSW22.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var s=e=>{throw TypeError(e)};var n=(e,t,r)=>t.has(e)||s("Cannot "+r);var d=(e,t,r)=>(n(e,t,"read from private field"),r?r.call(e):t.get(e)),u= exports.b =(e,t,r)=>t.has(e)?s("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),O= exports.c =(e,t,r,o)=>(n(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var p=(i=>(i.BLUEFIN7K="bluefin7k",i.CETUS="cetus",i.FLOWX="flowx",i.OKX="okx",i))(p||{}),P= exports.e =e=>e.kind==="bluefin7k"||e.kind==="cetus"||e.kind==="flowx",g= exports.f =e=>e.kind==="okx";var E="0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302",l= exports.h ="0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302",x= exports.i ="0x9a8abd32fe5721307ce3b697cf982ee84e9ffbd58d667a4a199f1683c1a3d23c",T= exports.j ="0xbbb3a51877ed9b492f26f4e2181811cfb2bd70c532f6f7621263d122d5e96b56",v= exports.k ="0x93ead46c1e48a9b62e25b6787f2ea6f75caedabb21726f12431acc4381f5f4c5";var a=class e extends Error{constructor(t,r,o){super(t),this.name="MetaAgError",this.code=_nullishCoalesce(r, () => (1e3)),this.details=o}static assert(t,r,o,i){if(!t)throw new e(_nullishCoalesce(r, () => ("Assertion failed")),o,i)}};exports.a = d; exports.b = u; exports.c = O; exports.d = p; exports.e = P; exports.f = g; exports.g = E; exports.h = l; exports.i = x; exports.j = T; exports.k = v; exports.l = a;
|
|
2
|
-
//# sourceMappingURL=chunk-KVGSSW22.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/otis/Documents/7k-ts-sdk/dist/chunk-KVGSSW22.js","../src/types/metaAg.ts","../src/constants/_7k.ts","../src/features/metaAg/error.ts"],"names":["EProvider","isAggregatorProvider","provider","isSwapAPIProvider","_7K_META_PUBLISHED_AT","_7K_META_PACKAGE_ID","_7K_META_VAULT","_7K_META_CONFIG","_7K_PARTNER_ADDRESS","MetaAgError","_MetaAgError","message","code","details","condition"],"mappings":"AAAA,iLAAI,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mDAAmD,CAAC,CAAC,EAAE,WAAW,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CCiBnU,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CACVA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA,CAAA,GAAA,CAAM,KAAA,CAJIA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CAqKCC,CAAAA,aACXC,CAAAA,EAEAA,CAAAA,CAAS,IAAA,GAAS,WAAA,EAClBA,CAAAA,CAAS,IAAA,GAAS,OAAA,EAClBA,CAAAA,CAAS,IAAA,GAAS,OAAA,CAEPC,CAAAA,aACXD,CAAAA,EACgCA,CAAAA,CAAS,IAAA,GAAS,KAAA,CClL7C,IAAME,CAAAA,CACX,oEAAA,CACWC,CAAAA,aACX,oEAAA,CACWC,CAAAA,aACX,oEAAA,CACWC,CAAAA,aACX,oEAAA,CACWC,CAAAA,aACX,oEAAA,CCkBK,IAAMC,CAAAA,CAAN,MAAMC,EAAAA,QAA+C,KAAM,CAGhE,WAAA,CAAYC,CAAAA,CAAiBC,CAAAA,CAAUC,CAAAA,CAAiC,CACtE,KAAA,CAAMF,CAAO,CAAA,CACb,IAAA,CAAK,IAAA,CAAO,aAAA,CACZ,IAAA,CAAK,IAAA,kBAAOC,CAAAA,SAAS,KAAA,CACrB,IAAA,CAAK,OAAA,CAAUC,CACjB,CAEA,OAAO,MAAA,CACLC,CAAAA,CACAH,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACmB,CACnB,EAAA,CAAI,CAACC,CAAAA,CACH,MAAM,IAAIJ,CAAAA,kBAAYC,CAAAA,SAAW,oBAAA,CAAoBC,CAAAA,CAAMC,CAAO,CAEtE,CACF,CAAA,CAAA,mLAAA","file":"/Users/otis/Documents/7k-ts-sdk/dist/chunk-KVGSSW22.js","sourcesContent":[null,"import type {\n QuoteResponse,\n SourceDex,\n} from \"@bluefin-exchange/bluefin7k-aggregator-sdk\";\nimport type {\n PreSwapLpChangeParams,\n RouterDataV3,\n} from \"@cetusprotocol/aggregator-sdk\";\nimport type { AggregatorQuoter, Protocol } from \"@flowx-finance/sdk\";\nimport type { GasCostSummary } from \"@mysten/sui/client\";\nimport { SignatureWithBytes } from \"@mysten/sui/cryptography\";\nimport type {\n Transaction,\n TransactionObjectArgument,\n} from \"@mysten/sui/transactions\";\nimport { OkxSwapResponseData } from \"./okx\";\n\nexport enum EProvider {\n BLUEFIN7K = \"bluefin7k\",\n CETUS = \"cetus\",\n FLOWX = \"flowx\",\n OKX = \"okx\",\n}\ntype ProviderBaseOptions = {\n api?: string;\n apiKey?: string;\n disabled?: boolean;\n};\nexport type Bluefin7kProviderOptions = ProviderBaseOptions & {\n sources?: SourceDex[];\n excludedPools?: string[];\n targetPools?: string[];\n};\nexport type FlowxProviderOptions = ProviderBaseOptions & {\n sources?: Protocol[];\n excludePools?: string[];\n excludeSources?: Protocol[];\n maxHops?: number;\n splitDistributionPercent?: number;\n};\nexport type CetusProviderOptions = ProviderBaseOptions & {\n sources?: string[];\n splitCount?: number;\n splitAlgorithm?: string;\n splitFactor?: number;\n depth?: number;\n liquidityChanges?: PreSwapLpChangeParams[];\n};\nexport type OkxProviderOptions = Required<Omit<ProviderBaseOptions, \"api\">> & {\n api?: string;\n secretKey: string;\n apiPassphrase: string;\n projectId: string;\n};\nexport interface MetaAgOptions {\n /**If not specified, all providers will be used */\n providers?: {\n [EProvider.BLUEFIN7K]?: Bluefin7kProviderOptions;\n [EProvider.FLOWX]?: FlowxProviderOptions;\n [EProvider.CETUS]?: CetusProviderOptions;\n [EProvider.OKX]?: OkxProviderOptions;\n };\n /**Mainnet Json Rpc url, if not specified, the default mainnet url will be used */\n fullnodeUrl?: string;\n /**Hermes Api url, if not specified, the default hermes api url will be used */\n hermesApi?: string;\n /**Address to receive commission, if not specified, the commission will not be used */\n partner?: string;\n /**@default 0 */\n partnerCommissionBps?: number;\n /**@default 100 */\n slippageBps?: number;\n /**\n * Tip to support 7k\n * @default 0 */\n tipBps?: number;\n}\nexport interface MetaQuoteOptions {\n coinTypeIn: string;\n coinTypeOut: string;\n amountIn: string;\n /** Required for api-tx providers (ie: Okx) */\n signer?: string;\n /**\n * Timeout for quote operation in milliseconds\n * @default 2000ms\n */\n timeout?: number;\n}\nexport interface MetaSimulationOptions {\n sender: string;\n /**\n * Timeout for simulation operation in milliseconds\n * @default 2000ms\n */\n timeout?: number;\n /** If specify, defer the simulation that could reduce the time to display quote result, you must update the quote via the id on callback\n * else await all quote and simulation before return\n */\n onSimulated?: (payload: MetaQuote) => void;\n}\nexport interface MetaFastSwapOptions {\n /** Quote object from the quote operation */\n quote: MetaQuote;\n /** Signer address (owner of `coinIn`) */\n signer: string;\n /** If true, use the gas coin for the swap\n * @default true */\n useGasCoin?: boolean;\n /**\n * Sign the transaction bytes\n * @param txBytes - base64 transaction bytes\n * @returns - signature with bytes\n */\n signTransaction: (txBytes: string) => Promise<SignatureWithBytes>;\n}\nexport interface MetaSwapOptions {\n /** Quote object from the quote operation */\n quote: MetaQuote;\n /** Signer address (owner of `coinIn`) */\n signer: string;\n /** Transaction object to add the swap operation */\n tx: Transaction;\n /**\n * Coin object used for the swap, must be consumed completely, no `coinIn` left, user must pass the coinIn object with the balance required for the swap - ie in quote `amountIn`\n * @warning `coinIn` value must match the quote `amountIn` */\n coinIn: TransactionObjectArgument;\n}\n\nexport type FlowxQuoteResponse = Awaited<\n ReturnType<AggregatorQuoter[\"getRoutes\"]>\n>;\nexport type MetaQuote = (\n | {\n provider: EProvider.BLUEFIN7K;\n quote: QuoteResponse;\n }\n | {\n provider: EProvider.CETUS;\n quote: RouterDataV3;\n }\n | {\n provider: EProvider.FLOWX;\n quote: FlowxQuoteResponse;\n }\n | {\n provider: EProvider.OKX;\n quote: OkxSwapResponseData;\n }\n) & {\n /** uuid to keep track the quote result, used to apply simulation result on quote on callback `onSimulated`*/\n id: string;\n /** coin type: ie 0x2::sui::SUI */\n coinTypeIn: string;\n /** coin type: ie 0x2::sui::SUI */\n coinTypeOut: string;\n /** Amount in as u64 */\n amountIn: string;\n /** Amount out as u64 if there're no commission be applied to the amount out */\n rawAmountOut: string;\n /** Amount as u64 after minus any commission kind */\n amountOut: string;\n /** Simulated amount out if the transaction is executed */\n simulatedAmountOut?: string;\n /** Estimate gas consumption if the transaction is executed */\n gasUsed?: GasCostSummary;\n};\nexport interface QuoteProvider {\n readonly kind: EProvider;\n quote(_quoteOptions: MetaQuoteOptions): Promise<MetaQuote | null>;\n}\n\nexport interface SwapAPIProvider extends QuoteProvider {\n readonly kind: EProvider.OKX;\n fastSwap(options: MetaFastSwapOptions): Promise<string>;\n}\n\nexport interface AggregatorProvider extends QuoteProvider {\n readonly kind: EProvider.BLUEFIN7K | EProvider.CETUS | EProvider.FLOWX;\n swap(options: MetaSwapOptions): Promise<TransactionObjectArgument>;\n}\n\nexport const isAggregatorProvider = (\n provider: QuoteProvider,\n): provider is AggregatorProvider =>\n provider.kind === EProvider.BLUEFIN7K ||\n provider.kind === EProvider.CETUS ||\n provider.kind === EProvider.FLOWX;\n\nexport const isSwapAPIProvider = (\n provider: QuoteProvider,\n): provider is SwapAPIProvider => provider.kind === EProvider.OKX;\n","// export const _7K_PACKAGE_ID =\n// \"0x62412b7268c35f3808336aee57a52836501f40b8ba5d936f8ad275e672befd04\";\n// //legacy V4: \"0xe8f996ea6ff38c557c253d3b93cfe2ebf393816487266786371aa4532a9229f2\";\n// //legacy V3: \"0x7ea6e27ad7af6f3b8671d59df1aaebd7c03dddab893e52a714227b2f4fe91519\";\n// //legacy V2: \"0xa13447019cd982d6bef91cf7b46ad384a52583b1dfc2bdecf31ef0c4bd787a0f\";\n// //legacy V1: \"0xd48e7cdc9e92bec69ce3baa75578010458a0c5b2733d661a84971e8cef6806bc\";\n// export const _7K_CONFIG =\n// \"0x47442a93f7727d188ba7cb71031170d1786af70013cb7ad5115f3fe877ff0c54\";\n// //legacy v3: \"0x0f8fc23dbcc9362b72c7a4c5aa53fcefa02ebfbb83a812c8c262ccd2c076d9ee\";\n\n// export const _7K_VAULT =\n// \"0x442ad50389ed5cda6f7a6f5a7ae6361a4c05ef1d9fb2e54fbba5a268d690bfe6\";\n// //legacy v3: \"0x39a3c55742c0e011b6f65548e73cf589e1ae5e82dbfab449ca57f24c3bcd9514\";\nexport const _7K_META_PUBLISHED_AT =\n \"0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302\";\nexport const _7K_META_PACKAGE_ID =\n \"0x17c0b1f7a6ad73f51268f16b8c06c049eecc2f28a270cdd29c06e3d2dea23302\";\nexport const _7K_META_VAULT =\n \"0x9a8abd32fe5721307ce3b697cf982ee84e9ffbd58d667a4a199f1683c1a3d23c\";\nexport const _7K_META_CONFIG =\n \"0xbbb3a51877ed9b492f26f4e2181811cfb2bd70c532f6f7621263d122d5e96b56\";\nexport const _7K_PARTNER_ADDRESS =\n \"0x93ead46c1e48a9b62e25b6787f2ea6f75caedabb21726f12431acc4381f5f4c5\";\n","import { DevInspectResults } from \"@mysten/sui/client\";\nimport { EProvider, MetaQuote, MetaQuoteOptions } from \"../../types/metaAg\";\n\nexport enum MetaAgErrorCode {\n UNKNOWN = 1000,\n TIMEOUT = 1001,\n PROVIDER_NOT_FOUND = 1002,\n PROVIDER_NOT_SUPPORTED = 1003,\n INVALID_QUOTE = 1004,\n QUOTE_NOT_FOUND = 1005,\n INVALID_SIGNER_ADDRESS = 1006,\n PROVIDER_NOT_SUPPORT_SWAP = 1007,\n SIMULATION_FAILED = 1008,\n // OKX error\n OKX_FINALIZE_COMMAND_NOT_FOUND = 1100,\n}\n\nexport type MetaAgErrorDetailsMap = {\n [MetaAgErrorCode.UNKNOWN]: any;\n [MetaAgErrorCode.TIMEOUT]: { timeout: number };\n [MetaAgErrorCode.PROVIDER_NOT_FOUND]: { provider: EProvider };\n [MetaAgErrorCode.PROVIDER_NOT_SUPPORTED]: { provider: EProvider };\n [MetaAgErrorCode.INVALID_QUOTE]: {\n quote: MetaQuote;\n expectedProvider: EProvider;\n };\n [MetaAgErrorCode.QUOTE_NOT_FOUND]: {\n provider: EProvider;\n quoteOptions?: MetaQuoteOptions;\n };\n [MetaAgErrorCode.INVALID_SIGNER_ADDRESS]: { signer: string };\n [MetaAgErrorCode.PROVIDER_NOT_SUPPORT_SWAP]: { provider: EProvider };\n [MetaAgErrorCode.SIMULATION_FAILED]: { error: DevInspectResults[\"error\"] };\n // OKX error\n [MetaAgErrorCode.OKX_FINALIZE_COMMAND_NOT_FOUND]: { packageId: string };\n};\n\nexport type MetaAgErrorDetails<T extends MetaAgErrorCode> =\n T extends keyof MetaAgErrorDetailsMap ? MetaAgErrorDetailsMap[T] : never;\n\nexport class MetaAgError<T extends MetaAgErrorCode> extends Error {\n code: T;\n details?: MetaAgErrorDetails<T>;\n constructor(message: string, code?: T, details?: MetaAgErrorDetails<T>) {\n super(message);\n this.name = \"MetaAgError\";\n this.code = code ?? (MetaAgErrorCode.UNKNOWN as T);\n this.details = details;\n }\n\n static assert<T extends MetaAgErrorCode>(\n condition: any,\n message?: string | null,\n code?: T,\n details?: MetaAgErrorDetails<T>,\n ): asserts condition {\n if (!condition) {\n throw new MetaAgError(message ?? \"Assertion failed\", code, details);\n }\n }\n}\n"]}
|
package/dist/flowx-6M54WFWO.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkKVGSSW22js = require('./chunk-KVGSSW22.js');var _sdk = require('@flowx-finance/sdk');var _uuid = require('uuid');var i=class{constructor(t,e){this.options=t;this.client=e;this.kind="flowx";this.quoter=new (0, _sdk.AggregatorQuoter)("mainnet",t.apiKey)}async quote(t){let e=await this.quoter.getRoutes({amountIn:t.amountIn,tokenIn:t.coinTypeIn,tokenOut:t.coinTypeOut,includeSources:this.options.sources,excludePools:this.options.excludePools,excludeSources:this.options.excludeSources,maxHops:this.options.maxHops,splitDistributionPercent:this.options.splitDistributionPercent});return{id:_uuid.v4.call(void 0, ),provider:"flowx",quote:e,amountIn:_nullishCoalesce(_optionalChain([e, 'access', _ => _.amountIn, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]), () => ("0")),rawAmountOut:_nullishCoalesce(_optionalChain([e, 'access', _4 => _4.amountOut, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]), () => ("0")),amountOut:_nullishCoalesce(_optionalChain([e, 'access', _7 => _7.amountOut, 'optionalAccess', _8 => _8.toString, 'call', _9 => _9()]), () => ("0")),coinTypeIn:t.coinTypeIn,coinTypeOut:t.coinTypeOut}}async swap(t){_chunkKVGSSW22js.l.assert(t.quote.provider==="flowx","Invalid quote",1004,{quote:t.quote,expectedProvider:"flowx"});let e=new (0, _sdk.TradeBuilder)("mainnet",t.quote.quote.routes);return e.sender(t.signer),e.slippage(1e4*100),e.commission(new (0, _sdk.Commission)(_chunkKVGSSW22js.k,t.quote.quote.coinOut,_sdk.CommissionType.PERCENTAGE,0,!0)),await e.build().swap({tx:t.tx,client:this.client,coinIn:t.coinIn})}};exports.FlowxProvider = i;
|
|
2
|
-
//# sourceMappingURL=flowx-6M54WFWO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/otis/Documents/7k-ts-sdk/dist/flowx-6M54WFWO.js","../src/features/metaAg/providers/flowx.ts"],"names":["FlowxProvider","options","client","AggregatorQuoter","quoteOptions","quote","v4","MetaAgError","builder","TradeBuilder","Commission","_7K_PARTNER_ADDRESS","CommissionType"],"mappings":"AAAA,uuBAA8C,yCCKvC,4BAGY,IAaNA,CAAAA,CAAN,KAAiE,CAGtE,WAAA,CACmBC,CAAAA,CACAC,CAAAA,CACjB,CAFiB,IAAA,CAAA,OAAA,CAAAD,CAAAA,CACA,IAAA,CAAA,MAAA,CAAAC,CAAAA,CAJnB,IAAA,CAAS,IAAA,CAAO,OAAA,CAMd,IAAA,CAAK,MAAA,CAAS,IAAIC,0BAAAA,CAAiB,SAAA,CAAWF,CAAAA,CAAQ,MAAM,CAC9D,CAEA,MAAM,KAAA,CAAMG,CAAAA,CAAoD,CAC9D,IAAMC,CAAAA,CAAQ,MAAM,IAAA,CAAK,MAAA,CAAO,SAAA,CAAU,CACxC,QAAA,CAAUD,CAAAA,CAAa,QAAA,CACvB,OAAA,CAASA,CAAAA,CAAa,UAAA,CACtB,QAAA,CAAUA,CAAAA,CAAa,WAAA,CACvB,cAAA,CAAgB,IAAA,CAAK,OAAA,CAAQ,OAAA,CAC7B,YAAA,CAAc,IAAA,CAAK,OAAA,CAAQ,YAAA,CAC3B,cAAA,CAAgB,IAAA,CAAK,OAAA,CAAQ,cAAA,CAC7B,OAAA,CAAS,IAAA,CAAK,OAAA,CAAQ,OAAA,CACtB,wBAAA,CAA0B,IAAA,CAAK,OAAA,CAAQ,wBACzC,CAAC,CAAA,CACD,MAAO,CACL,EAAA,CAAIE,sBAAAA,CAAG,CACP,QAAA,CAAA,OAAA,CACA,KAAA,CAAOD,CAAAA,CACP,QAAA,kCAAUA,CAAAA,mBAAM,QAAA,6BAAU,QAAA,mBAAS,GAAA,SAAK,KAAA,CACxC,YAAA,kCAAcA,CAAAA,qBAAM,SAAA,6BAAW,QAAA,mBAAS,GAAA,SAAK,KAAA,CAC7C,SAAA,kCAAWA,CAAAA,qBAAM,SAAA,6BAAW,QAAA,mBAAS,GAAA,SAAK,KAAA,CAC1C,UAAA,CAAYD,CAAAA,CAAa,UAAA,CACzB,WAAA,CAAaA,CAAAA,CAAa,WAC5B,CACF,CAEA,MAAM,IAAA,CAAKH,CAAAA,CAA8D,CACvEM,kBAAAA,CAAY,MAAA,CACVN,CAAAA,CAAQ,KAAA,CAAM,QAAA,GAAa,OAAA,CAC3B,eAAA,CAAA,IAAA,CAEA,CAAE,KAAA,CAAOA,CAAAA,CAAQ,KAAA,CAAO,gBAAA,CAAA,OAAkC,CAC5D,CAAA,CACA,IAAMO,CAAAA,CAAU,IAAIC,sBAAAA,CAAa,SAAA,CAAWR,CAAAA,CAAQ,KAAA,CAAM,KAAA,CAAM,MAAM,CAAA,CACtE,OAAAO,CAAAA,CAAQ,MAAA,CAAOP,CAAAA,CAAQ,MAAM,CAAA,CAC7BO,CAAAA,CAAQ,QAAA,CAAS,GAAA,CAAQ,GAAG,CAAA,CAC5BA,CAAAA,CAAQ,UAAA,CACN,IAAIE,oBAAAA,CACFC,kBAAAA,CACAV,CAAAA,CAAQ,KAAA,CAAM,KAAA,CAAM,OAAA,CACpBW,mBAAAA,CAAe,UAAA,CACf,CAAA,CACA,CAAA,CACF,CACF,CAAA,CACY,MAAMJ,CAAAA,CAAQ,KAAA,CAAM,CAAA,CAAE,IAAA,CAAK,CACrC,EAAA,CAAIP,CAAAA,CAAQ,EAAA,CACZ,MAAA,CAAQ,IAAA,CAAK,MAAA,CACb,MAAA,CAAQA,CAAAA,CAAQ,MAClB,CAAC,CAEH,CACF,CAAA,CAAA,0BAAA","file":"/Users/otis/Documents/7k-ts-sdk/dist/flowx-6M54WFWO.js","sourcesContent":[null,"import {\n AggregatorQuoter,\n Commission,\n CommissionType,\n TradeBuilder,\n} from \"@flowx-finance/sdk\";\nimport { SuiClient } from \"@mysten/sui/client\";\nimport { TransactionObjectArgument } from \"@mysten/sui/transactions\";\nimport { v4 } from \"uuid\";\nimport { _7K_PARTNER_ADDRESS } from \"../../../constants/_7k\";\nimport {\n AggregatorProvider,\n EProvider,\n FlowxProviderOptions,\n MetaQuote,\n MetaQuoteOptions,\n MetaSwapOptions,\n QuoteProvider,\n} from \"../../../types/metaAg\";\nimport { MetaAgError, MetaAgErrorCode } from \"../error\";\n\nexport class FlowxProvider implements QuoteProvider, AggregatorProvider {\n readonly kind = EProvider.FLOWX;\n private quoter: AggregatorQuoter;\n constructor(\n private readonly options: FlowxProviderOptions,\n private readonly client: SuiClient,\n ) {\n this.quoter = new AggregatorQuoter(\"mainnet\", options.apiKey);\n }\n\n async quote(quoteOptions: MetaQuoteOptions): Promise<MetaQuote> {\n const quote = await this.quoter.getRoutes({\n amountIn: quoteOptions.amountIn,\n tokenIn: quoteOptions.coinTypeIn,\n tokenOut: quoteOptions.coinTypeOut,\n includeSources: this.options.sources,\n excludePools: this.options.excludePools,\n excludeSources: this.options.excludeSources,\n maxHops: this.options.maxHops,\n splitDistributionPercent: this.options.splitDistributionPercent,\n });\n return {\n id: v4(),\n provider: EProvider.FLOWX,\n quote: quote,\n amountIn: quote.amountIn?.toString() ?? \"0\",\n rawAmountOut: quote.amountOut?.toString() ?? \"0\",\n amountOut: quote.amountOut?.toString() ?? \"0\",\n coinTypeIn: quoteOptions.coinTypeIn,\n coinTypeOut: quoteOptions.coinTypeOut,\n };\n }\n\n async swap(options: MetaSwapOptions): Promise<TransactionObjectArgument> {\n MetaAgError.assert(\n options.quote.provider === EProvider.FLOWX,\n \"Invalid quote\",\n MetaAgErrorCode.INVALID_QUOTE,\n { quote: options.quote, expectedProvider: EProvider.FLOWX },\n );\n const builder = new TradeBuilder(\"mainnet\", options.quote.quote.routes);\n builder.sender(options.signer);\n builder.slippage(10000 * 100);\n builder.commission(\n new Commission(\n _7K_PARTNER_ADDRESS,\n options.quote.quote.coinOut,\n CommissionType.PERCENTAGE,\n 0,\n true,\n ),\n );\n const res = await builder.build().swap({\n tx: options.tx as any,\n client: this.client as any,\n coinIn: options.coinIn as any,\n });\n return res!;\n }\n}\n"]}
|
package/dist/flowx-OXZZX5FD.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{k as o,l as r}from"./chunk-ETQEI4QC.mjs";import{AggregatorQuoter as n,Commission as u,CommissionType as a,TradeBuilder as s}from"@flowx-finance/sdk";import{v4 as m}from"uuid";var i=class{constructor(t,e){this.options=t;this.client=e;this.kind="flowx";this.quoter=new n("mainnet",t.apiKey)}async quote(t){let e=await this.quoter.getRoutes({amountIn:t.amountIn,tokenIn:t.coinTypeIn,tokenOut:t.coinTypeOut,includeSources:this.options.sources,excludePools:this.options.excludePools,excludeSources:this.options.excludeSources,maxHops:this.options.maxHops,splitDistributionPercent:this.options.splitDistributionPercent});return{id:m(),provider:"flowx",quote:e,amountIn:e.amountIn?.toString()??"0",rawAmountOut:e.amountOut?.toString()??"0",amountOut:e.amountOut?.toString()??"0",coinTypeIn:t.coinTypeIn,coinTypeOut:t.coinTypeOut}}async swap(t){r.assert(t.quote.provider==="flowx","Invalid quote",1004,{quote:t.quote,expectedProvider:"flowx"});let e=new s("mainnet",t.quote.quote.routes);return e.sender(t.signer),e.slippage(1e4*100),e.commission(new u(o,t.quote.quote.coinOut,a.PERCENTAGE,0,!0)),await e.build().swap({tx:t.tx,client:this.client,coinIn:t.coinIn})}};export{i as FlowxProvider};
|
|
2
|
-
//# sourceMappingURL=flowx-OXZZX5FD.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/features/metaAg/providers/flowx.ts"],"sourcesContent":["import {\n AggregatorQuoter,\n Commission,\n CommissionType,\n TradeBuilder,\n} from \"@flowx-finance/sdk\";\nimport { SuiClient } from \"@mysten/sui/client\";\nimport { TransactionObjectArgument } from \"@mysten/sui/transactions\";\nimport { v4 } from \"uuid\";\nimport { _7K_PARTNER_ADDRESS } from \"../../../constants/_7k\";\nimport {\n AggregatorProvider,\n EProvider,\n FlowxProviderOptions,\n MetaQuote,\n MetaQuoteOptions,\n MetaSwapOptions,\n QuoteProvider,\n} from \"../../../types/metaAg\";\nimport { MetaAgError, MetaAgErrorCode } from \"../error\";\n\nexport class FlowxProvider implements QuoteProvider, AggregatorProvider {\n readonly kind = EProvider.FLOWX;\n private quoter: AggregatorQuoter;\n constructor(\n private readonly options: FlowxProviderOptions,\n private readonly client: SuiClient,\n ) {\n this.quoter = new AggregatorQuoter(\"mainnet\", options.apiKey);\n }\n\n async quote(quoteOptions: MetaQuoteOptions): Promise<MetaQuote> {\n const quote = await this.quoter.getRoutes({\n amountIn: quoteOptions.amountIn,\n tokenIn: quoteOptions.coinTypeIn,\n tokenOut: quoteOptions.coinTypeOut,\n includeSources: this.options.sources,\n excludePools: this.options.excludePools,\n excludeSources: this.options.excludeSources,\n maxHops: this.options.maxHops,\n splitDistributionPercent: this.options.splitDistributionPercent,\n });\n return {\n id: v4(),\n provider: EProvider.FLOWX,\n quote: quote,\n amountIn: quote.amountIn?.toString() ?? \"0\",\n rawAmountOut: quote.amountOut?.toString() ?? \"0\",\n amountOut: quote.amountOut?.toString() ?? \"0\",\n coinTypeIn: quoteOptions.coinTypeIn,\n coinTypeOut: quoteOptions.coinTypeOut,\n };\n }\n\n async swap(options: MetaSwapOptions): Promise<TransactionObjectArgument> {\n MetaAgError.assert(\n options.quote.provider === EProvider.FLOWX,\n \"Invalid quote\",\n MetaAgErrorCode.INVALID_QUOTE,\n { quote: options.quote, expectedProvider: EProvider.FLOWX },\n );\n const builder = new TradeBuilder(\"mainnet\", options.quote.quote.routes);\n builder.sender(options.signer);\n builder.slippage(10000 * 100);\n builder.commission(\n new Commission(\n _7K_PARTNER_ADDRESS,\n options.quote.quote.coinOut,\n CommissionType.PERCENTAGE,\n 0,\n true,\n ),\n );\n const res = await builder.build().swap({\n tx: options.tx as any,\n client: this.client as any,\n coinIn: options.coinIn as any,\n });\n return res!;\n }\n}\n"],"mappings":"gDAAA,OACE,oBAAAA,EACA,cAAAC,EACA,kBAAAC,EACA,gBAAAC,MACK,qBAGP,OAAS,MAAAC,MAAU,OAaZ,IAAMC,EAAN,KAAiE,CAGtE,YACmBC,EACAC,EACjB,CAFiB,aAAAD,EACA,YAAAC,EAJnB,KAAS,KAAO,QAMd,KAAK,OAAS,IAAIC,EAAiB,UAAWF,EAAQ,MAAM,CAC9D,CAEA,MAAM,MAAMG,EAAoD,CAC9D,IAAMC,EAAQ,MAAM,KAAK,OAAO,UAAU,CACxC,SAAUD,EAAa,SACvB,QAASA,EAAa,WACtB,SAAUA,EAAa,YACvB,eAAgB,KAAK,QAAQ,QAC7B,aAAc,KAAK,QAAQ,aAC3B,eAAgB,KAAK,QAAQ,eAC7B,QAAS,KAAK,QAAQ,QACtB,yBAA0B,KAAK,QAAQ,wBACzC,CAAC,EACD,MAAO,CACL,GAAIE,EAAG,EACP,iBACA,MAAOD,EACP,SAAUA,EAAM,UAAU,SAAS,GAAK,IACxC,aAAcA,EAAM,WAAW,SAAS,GAAK,IAC7C,UAAWA,EAAM,WAAW,SAAS,GAAK,IAC1C,WAAYD,EAAa,WACzB,YAAaA,EAAa,WAC5B,CACF,CAEA,MAAM,KAAKH,EAA8D,CACvEM,EAAY,OACVN,EAAQ,MAAM,WAAa,QAC3B,qBAEA,CAAE,MAAOA,EAAQ,MAAO,wBAAkC,CAC5D,EACA,IAAMO,EAAU,IAAIC,EAAa,UAAWR,EAAQ,MAAM,MAAM,MAAM,EACtE,OAAAO,EAAQ,OAAOP,EAAQ,MAAM,EAC7BO,EAAQ,SAAS,IAAQ,GAAG,EAC5BA,EAAQ,WACN,IAAIE,EACFC,EACAV,EAAQ,MAAM,MAAM,QACpBW,EAAe,WACf,EACA,EACF,CACF,EACY,MAAMJ,EAAQ,MAAM,EAAE,KAAK,CACrC,GAAIP,EAAQ,GACZ,OAAQ,KAAK,OACb,OAAQA,EAAQ,MAClB,CAAC,CAEH,CACF","names":["AggregatorQuoter","Commission","CommissionType","TradeBuilder","v4","FlowxProvider","options","client","AggregatorQuoter","quoteOptions","quote","v4","MetaAgError","builder","TradeBuilder","Commission","_7K_PARTNER_ADDRESS","CommissionType"]}
|