@7kprotocol/sdk-ts 3.4.2-beta.8 → 3.5.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/lib/cjs/features/metaAg/index.js +22 -11
- package/lib/cjs/features/metaAg/providers/bluefin.js +5 -7
- package/lib/cjs/features/metaAg/providers/cetus.js +3 -14
- package/lib/cjs/features/metaAg/providers/flowx.js +2 -8
- package/lib/cjs/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/bluefin.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts +0 -1
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts +2 -3
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/lib/cjs/types/types/metaAg.d.ts +9 -9
- package/lib/cjs/types/types/metaAg.d.ts.map +1 -1
- package/lib/esm/features/metaAg/index.js +22 -11
- package/lib/esm/features/metaAg/providers/bluefin.js +5 -7
- package/lib/esm/features/metaAg/providers/cetus.js +3 -15
- package/lib/esm/features/metaAg/providers/flowx.js +3 -10
- package/lib/esm/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/bluefin.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts +0 -1
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts +2 -3
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/lib/esm/types/types/metaAg.d.ts +9 -9
- package/lib/esm/types/types/metaAg.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.MetaAg = void 0;
|
|
37
37
|
const client_1 = require("@mysten/sui/client");
|
|
38
38
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
39
|
+
const utils_1 = require("@mysten/sui/utils");
|
|
39
40
|
const _7k_1 = require("../../constants/_7k");
|
|
40
41
|
const sui_1 = require("../../constants/sui");
|
|
41
42
|
const metaAg_1 = require("../../types/metaAg");
|
|
@@ -53,7 +54,7 @@ class MetaAg {
|
|
|
53
54
|
constructor(options) {
|
|
54
55
|
this.providers = {};
|
|
55
56
|
this.options = {
|
|
56
|
-
providers: options?.providers
|
|
57
|
+
providers: { ...DEFAULT_PROVIDERS, ...options?.providers },
|
|
57
58
|
slippageBps: options?.slippageBps ?? 100,
|
|
58
59
|
fullnodeUrl: options?.fullnodeUrl ?? (0, client_1.getFullnodeUrl)("mainnet"),
|
|
59
60
|
hermesApi: options?.hermesApi ?? HERMES_API,
|
|
@@ -72,14 +73,13 @@ class MetaAg {
|
|
|
72
73
|
return p;
|
|
73
74
|
const providerOptions = this.options.providers[provider];
|
|
74
75
|
(0, condition_1.assert)(!!providerOptions, `Provider not found: ${provider}`);
|
|
75
|
-
// eslint-disable-next-line no-case-declarations
|
|
76
76
|
switch (provider) {
|
|
77
77
|
case metaAg_1.EProvider.BLUEFIN7K:
|
|
78
78
|
this.providers[metaAg_1.EProvider.BLUEFIN7K] = new bluefin_1.BluefinProvider(providerOptions, this.options, this.client);
|
|
79
79
|
break;
|
|
80
80
|
case metaAg_1.EProvider.FLOWX:
|
|
81
81
|
const { FlowxProvider } = await Promise.resolve().then(() => __importStar(require("./providers/flowx"))).catch(catchImportError(metaAg_1.EProvider.FLOWX));
|
|
82
|
-
this.providers[metaAg_1.EProvider.FLOWX] = new FlowxProvider(providerOptions, this.
|
|
82
|
+
this.providers[metaAg_1.EProvider.FLOWX] = new FlowxProvider(providerOptions, this.client);
|
|
83
83
|
break;
|
|
84
84
|
case metaAg_1.EProvider.CETUS:
|
|
85
85
|
const { CetusProvider } = await Promise.resolve().then(() => __importStar(require("./providers/cetus"))).catch(catchImportError(metaAg_1.EProvider.CETUS));
|
|
@@ -110,8 +110,8 @@ class MetaAg {
|
|
|
110
110
|
sender: simulation.sender,
|
|
111
111
|
transactionBlock: tx,
|
|
112
112
|
}), simulation.timeout ?? 2000, `simulation for ${provider.kind} provider with id ${id}`);
|
|
113
|
-
if (res.effects.status.status ===
|
|
114
|
-
throw new Error(res.error ??
|
|
113
|
+
if (res.effects.status.status === "failure") {
|
|
114
|
+
throw new Error(res.error ?? "Simulation failed");
|
|
115
115
|
}
|
|
116
116
|
const amountOut = extractAmountOutWrapper(res.events);
|
|
117
117
|
return {
|
|
@@ -126,7 +126,12 @@ class MetaAg {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
async _quote(provider, options, simulation) {
|
|
129
|
-
const quote = await timeout(() =>
|
|
129
|
+
const quote = await timeout(async () => {
|
|
130
|
+
const quote = await provider.quote(options);
|
|
131
|
+
const { expectedAmount } = (0, buildTx_1.getExpectedReturn)(quote.rawAmountOut, 0, this.options.partnerCommissionBps, this.options.tipBps);
|
|
132
|
+
quote.amountOut = expectedAmount;
|
|
133
|
+
return quote;
|
|
134
|
+
}, options.timeout ?? 2000, `quote for ${provider.kind} provider from ${options.coinInType} to ${options.coinOutType}`);
|
|
130
135
|
if (simulation) {
|
|
131
136
|
if (simulation.onSimulated) {
|
|
132
137
|
this._simulate(provider, quote, simulation).then((payload) => {
|
|
@@ -150,9 +155,16 @@ class MetaAg {
|
|
|
150
155
|
* @returns quotes from all providers
|
|
151
156
|
*/
|
|
152
157
|
async quote(options, simulation) {
|
|
153
|
-
const
|
|
158
|
+
const opts = {
|
|
159
|
+
...options,
|
|
160
|
+
coinInType: (0, utils_1.normalizeStructTag)(options.coinInType),
|
|
161
|
+
coinOutType: (0, utils_1.normalizeStructTag)(options.coinOutType),
|
|
162
|
+
};
|
|
163
|
+
const quotes = await Promise.allSettled(Object.entries(this.options.providers)
|
|
164
|
+
.filter(([_k, v]) => !v.disabled)
|
|
165
|
+
.map(async ([provider]) => {
|
|
154
166
|
const p = await this._getProvider(provider);
|
|
155
|
-
return this._quote(p,
|
|
167
|
+
return this._quote(p, opts, simulation);
|
|
156
168
|
}));
|
|
157
169
|
return quotes
|
|
158
170
|
.map((quote) => quote.status === "fulfilled"
|
|
@@ -217,8 +229,7 @@ exports.MetaAg = MetaAg;
|
|
|
217
229
|
*/
|
|
218
230
|
const metaSettle = (quote, coinOut, slippageBps = 100, tipBps = 0, partner, commissionBps = 0) => {
|
|
219
231
|
return (tx) => {
|
|
220
|
-
const { minAmount, expectedAmount } = (0, buildTx_1.getExpectedReturn)(quote.rawAmountOut, slippageBps, commissionBps,
|
|
221
|
-
tipBps);
|
|
232
|
+
const { minAmount, expectedAmount } = (0, buildTx_1.getExpectedReturn)(quote.rawAmountOut, slippageBps, commissionBps, tipBps);
|
|
222
233
|
if (tipBps > 0) {
|
|
223
234
|
tx.moveCall({
|
|
224
235
|
target: `${_7k_1._7K_META_PUBLISHED_AT}::vault::collect_tip`,
|
|
@@ -242,7 +253,7 @@ const metaSettle = (quote, coinOut, slippageBps = 100, tipBps = 0, partner, comm
|
|
|
242
253
|
tx.pure.u64(minAmount),
|
|
243
254
|
tx.pure.u64(expectedAmount),
|
|
244
255
|
tx.pure.option("address", partner),
|
|
245
|
-
tx.pure.u64(
|
|
256
|
+
tx.pure.u64(commissionBps),
|
|
246
257
|
tx.pure.u64(0), // ps
|
|
247
258
|
],
|
|
248
259
|
});
|
|
@@ -8,7 +8,6 @@ const apiEndpoints_1 = require("../../../constants/apiEndpoints");
|
|
|
8
8
|
const sui_1 = require("../../../constants/sui");
|
|
9
9
|
const metaAg_1 = require("../../../types/metaAg");
|
|
10
10
|
const condition_1 = require("../../../utils/condition");
|
|
11
|
-
const buildTx_1 = require("../../swap/buildTx");
|
|
12
11
|
const buildTxV2_1 = require("../../swap/buildTxV2");
|
|
13
12
|
const getQuote_1 = require("../../swap/getQuote");
|
|
14
13
|
const WORMHOLE_STATE_ID = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
|
|
@@ -37,16 +36,15 @@ class BluefinProvider {
|
|
|
37
36
|
excludedPools: this.options.excludedPools,
|
|
38
37
|
targetPools: this.options.targetPools,
|
|
39
38
|
});
|
|
40
|
-
const { expectedAmount } = (0, buildTx_1.getExpectedReturn)(quote.returnAmountWithDecimal.toString(), 0, this.metaOptions.partnerCommissionBps ?? 0, this.metaOptions.tipBps ?? 0);
|
|
41
39
|
return {
|
|
42
40
|
id: (0, uuid_1.v4)(),
|
|
43
41
|
provider: metaAg_1.EProvider.BLUEFIN7K,
|
|
44
42
|
quote,
|
|
45
43
|
amountIn: quote.swapAmountWithDecimal,
|
|
46
44
|
rawAmountOut: quote.returnAmountWithDecimal,
|
|
47
|
-
amountOut:
|
|
48
|
-
coinTypeIn:
|
|
49
|
-
coinTypeOut:
|
|
45
|
+
amountOut: quote.returnAmountWithDecimal,
|
|
46
|
+
coinTypeIn: options.coinInType,
|
|
47
|
+
coinTypeOut: options.coinOutType,
|
|
50
48
|
};
|
|
51
49
|
}
|
|
52
50
|
async swap({ quote, signer, tx, coinIn }) {
|
|
@@ -55,8 +53,8 @@ class BluefinProvider {
|
|
|
55
53
|
quoteResponse: quote.quote,
|
|
56
54
|
accountAddress: signer,
|
|
57
55
|
commission: {
|
|
58
|
-
commissionBps:
|
|
59
|
-
partner:
|
|
56
|
+
commissionBps: 0,
|
|
57
|
+
partner: sui_1.SUI_ADDRESS_ZERO,
|
|
60
58
|
},
|
|
61
59
|
slippage: 1,
|
|
62
60
|
extendTx: {
|
|
@@ -5,18 +5,12 @@ const aggregator_sdk_1 = require("@cetusprotocol/aggregator-sdk");
|
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
6
|
const metaAg_1 = require("../../../types/metaAg");
|
|
7
7
|
const condition_1 = require("../../../utils/condition");
|
|
8
|
-
const buildTx_1 = require("../../swap/buildTx");
|
|
9
8
|
class CetusProvider {
|
|
10
9
|
constructor(options, metaOptions, client) {
|
|
11
10
|
this.options = options;
|
|
12
|
-
this.metaOptions = metaOptions;
|
|
13
11
|
this.kind = metaAg_1.EProvider.CETUS;
|
|
14
12
|
this.cetusClient = new aggregator_sdk_1.AggregatorClient({
|
|
15
13
|
apiKey: options.apiKey,
|
|
16
|
-
overlayFeeReceiver: metaOptions.partner,
|
|
17
|
-
overlayFeeRate: metaOptions.partnerCommissionBps
|
|
18
|
-
? metaOptions.partnerCommissionBps / 10000
|
|
19
|
-
: undefined,
|
|
20
14
|
client,
|
|
21
15
|
endpoint: options.api,
|
|
22
16
|
env: aggregator_sdk_1.Env.Mainnet,
|
|
@@ -37,18 +31,13 @@ class CetusProvider {
|
|
|
37
31
|
liquidityChanges: this.options.liquidityChanges,
|
|
38
32
|
});
|
|
39
33
|
(0, condition_1.assert)(!!quote, "No quote found");
|
|
40
|
-
const bps = BigInt(this.metaOptions.partnerCommissionBps ?? 0);
|
|
41
|
-
// calc amount out before any commission fees
|
|
42
|
-
const amountOut = ((BigInt(quote.amountOut.toString()) * 10000n) /
|
|
43
|
-
(10000n - bps)).toString();
|
|
44
|
-
const { expectedAmount } = (0, buildTx_1.getExpectedReturn)(amountOut, 0, this.metaOptions.partnerCommissionBps ?? 0, this.metaOptions.tipBps ?? 0);
|
|
45
34
|
return {
|
|
46
35
|
id: (0, uuid_1.v4)(),
|
|
47
36
|
provider: metaAg_1.EProvider.CETUS,
|
|
48
37
|
quote,
|
|
49
|
-
amountIn: quote.amountIn.toString(),
|
|
50
|
-
rawAmountOut: amountOut,
|
|
51
|
-
amountOut:
|
|
38
|
+
amountIn: quote.amountIn.toString() || "0",
|
|
39
|
+
rawAmountOut: quote.amountOut.toString() || "0",
|
|
40
|
+
amountOut: quote.amountOut.toString() || "0",
|
|
52
41
|
coinTypeIn: quoteOptions.coinInType,
|
|
53
42
|
coinTypeOut: quoteOptions.coinOutType,
|
|
54
43
|
};
|
|
@@ -5,11 +5,9 @@ const sdk_1 = require("@flowx-finance/sdk");
|
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
6
|
const metaAg_1 = require("../../../types/metaAg");
|
|
7
7
|
const condition_1 = require("../../../utils/condition");
|
|
8
|
-
const buildTx_1 = require("../../swap/buildTx");
|
|
9
8
|
class FlowxProvider {
|
|
10
|
-
constructor(options,
|
|
9
|
+
constructor(options, client) {
|
|
11
10
|
this.options = options;
|
|
12
|
-
this.metaOptions = metaOptions;
|
|
13
11
|
this.client = client;
|
|
14
12
|
this.kind = metaAg_1.EProvider.FLOWX;
|
|
15
13
|
this.quoter = new sdk_1.AggregatorQuoter("mainnet", options.apiKey);
|
|
@@ -25,14 +23,13 @@ class FlowxProvider {
|
|
|
25
23
|
maxHops: this.options.maxHops,
|
|
26
24
|
splitDistributionPercent: this.options.splitDistributionPercent,
|
|
27
25
|
});
|
|
28
|
-
const { expectedAmount } = (0, buildTx_1.getExpectedReturn)(quote.amountOut?.toString() ?? "0", 0, this.metaOptions.partnerCommissionBps ?? 0, this.metaOptions.tipBps ?? 0);
|
|
29
26
|
return {
|
|
30
27
|
id: (0, uuid_1.v4)(),
|
|
31
28
|
provider: metaAg_1.EProvider.FLOWX,
|
|
32
29
|
quote: quote,
|
|
33
30
|
amountIn: quote.amountIn?.toString() ?? "0",
|
|
34
31
|
rawAmountOut: quote.amountOut?.toString() ?? "0",
|
|
35
|
-
amountOut:
|
|
32
|
+
amountOut: quote.amountOut?.toString() ?? "0",
|
|
36
33
|
coinTypeIn: quoteOptions.coinInType,
|
|
37
34
|
coinTypeOut: quoteOptions.coinOutType,
|
|
38
35
|
};
|
|
@@ -40,9 +37,6 @@ class FlowxProvider {
|
|
|
40
37
|
async swap(options) {
|
|
41
38
|
(0, condition_1.assert)(options.quote.provider === metaAg_1.EProvider.FLOWX, "Invalid quote");
|
|
42
39
|
const builder = new sdk_1.TradeBuilder("mainnet", options.quote.quote.routes);
|
|
43
|
-
if (this.metaOptions.partner) {
|
|
44
|
-
builder.commission(new sdk_1.Commission(this.metaOptions.partner, options.quote.quote.coinOut, sdk_1.CommissionType.PERCENTAGE, (this.metaOptions.partnerCommissionBps ?? 0) * 100, true));
|
|
45
|
-
}
|
|
46
40
|
builder.sender(options.signer);
|
|
47
41
|
builder.slippage(10000 * 100);
|
|
48
42
|
const res = await builder.build().swap({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAY,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAY,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAML,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAa5B,qBAAa,MAAM;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,OAAO,CAA0B;gBAC7B,OAAO,CAAC,EAAE,aAAa;YAkBrB,YAAY;YAuCZ,SAAS;YAqDT,MAAM;IAoCpB;;;;;OAKG;IACG,KAAK,CACT,OAAO,EAAE,gBAAgB,EACzB,UAAU,CAAC,EAAE,qBAAqB,GACjC,OAAO,CAAC,SAAS,EAAE,CAAC;IAuBvB;;;;;OAKG;IACG,IAAI,CACR,OAAO,EAAE,eAAe,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,yBAAyB,CAAC;IAkBrC;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,aAAa;CA4B3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bluefin.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU/C,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"bluefin.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU/C,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAQ/B,qBAAa,eAAgB,YAAW,UAAU;IAG9C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAH9B,IAAI,YAAuB;gBAER,OAAO,EAAE,sBAAsB,EAC/B,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,EACrD,MAAM,EAAE,SAAS;IAeb,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAsBpD,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,eAAe;CAiB1D"}
|
|
@@ -3,7 +3,6 @@ import { TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
|
3
3
|
import { AgProvider, CetusProviderOptions, EProvider, MetaAgOptions, MetaQuote, MetaQuoteOptions, MetaSwapOptions } from "../../../types/metaAg";
|
|
4
4
|
export declare class CetusProvider implements AgProvider {
|
|
5
5
|
private readonly options;
|
|
6
|
-
private readonly metaOptions;
|
|
7
6
|
kind: EProvider;
|
|
8
7
|
private readonly cetusClient;
|
|
9
8
|
constructor(options: CetusProviderOptions, metaOptions: MetaAgOptions, client: SuiClient);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,IAAI,YAAmB;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAE5B,OAAO,EAAE,oBAAoB,EAC9C,WAAW,EAAE,aAAa,EAC1B,MAAM,EAAE,SAAS;IAWb,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IA0BzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAUzE"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui/client";
|
|
2
2
|
import { TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
3
|
-
import { AgProvider, EProvider, FlowxProviderOptions,
|
|
3
|
+
import { AgProvider, EProvider, FlowxProviderOptions, MetaQuote, MetaQuoteOptions, MetaSwapOptions } from "../../../types/metaAg";
|
|
4
4
|
export declare class FlowxProvider implements AgProvider {
|
|
5
5
|
private readonly options;
|
|
6
|
-
private readonly metaOptions;
|
|
7
6
|
private readonly client;
|
|
8
7
|
kind: EProvider;
|
|
9
8
|
private quoter;
|
|
10
|
-
constructor(options: FlowxProviderOptions,
|
|
9
|
+
constructor(options: FlowxProviderOptions, client: SuiClient);
|
|
11
10
|
quote(quoteOptions: MetaQuoteOptions): Promise<MetaQuote>;
|
|
12
11
|
swap(options: MetaSwapOptions): Promise<TransactionObjectArgument>;
|
|
13
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EACL,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,IAAI,YAAmB;IACvB,OAAO,CAAC,MAAM,CAAmB;gBAEd,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,SAAS;IAK9B,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAYzE"}
|
|
@@ -8,32 +8,31 @@ export declare enum EProvider {
|
|
|
8
8
|
CETUS = "cetus",
|
|
9
9
|
FLOWX = "flowx"
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
type ProviderBaseOptions = {
|
|
12
|
+
api?: string;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type BluefinProviderOptions = ProviderBaseOptions & {
|
|
12
17
|
sources?: SourceDex[];
|
|
13
18
|
maxPaths?: number;
|
|
14
19
|
excludedPools?: string[];
|
|
15
20
|
targetPools?: string[];
|
|
16
|
-
api?: string;
|
|
17
|
-
apiKey?: string;
|
|
18
21
|
};
|
|
19
|
-
export type FlowxProviderOptions = {
|
|
22
|
+
export type FlowxProviderOptions = ProviderBaseOptions & {
|
|
20
23
|
sources?: Protocol[];
|
|
21
24
|
excludePools?: string[];
|
|
22
25
|
excludeSources?: Protocol[];
|
|
23
26
|
maxHops?: number;
|
|
24
27
|
splitDistributionPercent?: number;
|
|
25
|
-
api?: string;
|
|
26
|
-
apiKey?: string;
|
|
27
28
|
};
|
|
28
|
-
export type CetusProviderOptions = {
|
|
29
|
+
export type CetusProviderOptions = ProviderBaseOptions & {
|
|
29
30
|
sources?: string[];
|
|
30
31
|
splitCount?: number;
|
|
31
32
|
splitAlgorithm?: string;
|
|
32
33
|
splitFactor?: number;
|
|
33
34
|
depth?: number;
|
|
34
35
|
liquidityChanges?: PreSwapLpChangeParams[];
|
|
35
|
-
api?: string;
|
|
36
|
-
apiKey?: string;
|
|
37
36
|
};
|
|
38
37
|
export interface MetaAgOptions {
|
|
39
38
|
/**If not specified, all providers will be used */
|
|
@@ -124,4 +123,5 @@ export declare abstract class AgProvider {
|
|
|
124
123
|
abstract quote(quoteOptions: MetaQuoteOptions): Promise<MetaQuote>;
|
|
125
124
|
abstract swap(options: MetaSwapOptions): Promise<TransactionObjectArgument>;
|
|
126
125
|
}
|
|
126
|
+
export {};
|
|
127
127
|
//# sourceMappingURL=metaAg.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metaAg.d.ts","sourceRoot":"","sources":["../../../../src/types/metaAg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExD,oBAAY,SAAS;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AACD,
|
|
1
|
+
{"version":3,"file":"metaAg.d.ts","sourceRoot":"","sources":["../../../../src/types/metaAg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExD,oBAAY,SAAS;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AACD,KAAK,mBAAmB,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG;IACzD,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAA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E,MAAM,CAAC;IACrB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,CAAC;AACF,8BAAsB,UAAU;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAClE,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAC5E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getFullnodeUrl, SuiClient } from "@mysten/sui/client";
|
|
2
2
|
import { coinWithBalance, Transaction, } from "@mysten/sui/transactions";
|
|
3
|
+
import { normalizeStructTag } from "@mysten/sui/utils";
|
|
3
4
|
import { _7K_META_CONFIG, _7K_META_PACKAGE_ID, _7K_META_PUBLISHED_AT, _7K_META_VAULT, } from "../../constants/_7k";
|
|
4
5
|
import { SUI_ADDRESS_ZERO } from "../../constants/sui";
|
|
5
6
|
import { EProvider, } from "../../types/metaAg";
|
|
@@ -20,7 +21,7 @@ export class MetaAg {
|
|
|
20
21
|
options;
|
|
21
22
|
constructor(options) {
|
|
22
23
|
this.options = {
|
|
23
|
-
providers: options?.providers
|
|
24
|
+
providers: { ...DEFAULT_PROVIDERS, ...options?.providers },
|
|
24
25
|
slippageBps: options?.slippageBps ?? 100,
|
|
25
26
|
fullnodeUrl: options?.fullnodeUrl ?? getFullnodeUrl("mainnet"),
|
|
26
27
|
hermesApi: options?.hermesApi ?? HERMES_API,
|
|
@@ -39,14 +40,13 @@ export class MetaAg {
|
|
|
39
40
|
return p;
|
|
40
41
|
const providerOptions = this.options.providers[provider];
|
|
41
42
|
assert(!!providerOptions, `Provider not found: ${provider}`);
|
|
42
|
-
// eslint-disable-next-line no-case-declarations
|
|
43
43
|
switch (provider) {
|
|
44
44
|
case EProvider.BLUEFIN7K:
|
|
45
45
|
this.providers[EProvider.BLUEFIN7K] = new BluefinProvider(providerOptions, this.options, this.client);
|
|
46
46
|
break;
|
|
47
47
|
case EProvider.FLOWX:
|
|
48
48
|
const { FlowxProvider } = await import("./providers/flowx").catch(catchImportError(EProvider.FLOWX));
|
|
49
|
-
this.providers[EProvider.FLOWX] = new FlowxProvider(providerOptions, this.
|
|
49
|
+
this.providers[EProvider.FLOWX] = new FlowxProvider(providerOptions, this.client);
|
|
50
50
|
break;
|
|
51
51
|
case EProvider.CETUS:
|
|
52
52
|
const { CetusProvider } = await import("./providers/cetus").catch(catchImportError(EProvider.CETUS));
|
|
@@ -77,8 +77,8 @@ export class MetaAg {
|
|
|
77
77
|
sender: simulation.sender,
|
|
78
78
|
transactionBlock: tx,
|
|
79
79
|
}), simulation.timeout ?? 2000, `simulation for ${provider.kind} provider with id ${id}`);
|
|
80
|
-
if (res.effects.status.status ===
|
|
81
|
-
throw new Error(res.error ??
|
|
80
|
+
if (res.effects.status.status === "failure") {
|
|
81
|
+
throw new Error(res.error ?? "Simulation failed");
|
|
82
82
|
}
|
|
83
83
|
const amountOut = extractAmountOutWrapper(res.events);
|
|
84
84
|
return {
|
|
@@ -93,7 +93,12 @@ export class MetaAg {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
async _quote(provider, options, simulation) {
|
|
96
|
-
const quote = await timeout(() =>
|
|
96
|
+
const quote = await timeout(async () => {
|
|
97
|
+
const quote = await provider.quote(options);
|
|
98
|
+
const { expectedAmount } = getExpectedReturn(quote.rawAmountOut, 0, this.options.partnerCommissionBps, this.options.tipBps);
|
|
99
|
+
quote.amountOut = expectedAmount;
|
|
100
|
+
return quote;
|
|
101
|
+
}, options.timeout ?? 2000, `quote for ${provider.kind} provider from ${options.coinInType} to ${options.coinOutType}`);
|
|
97
102
|
if (simulation) {
|
|
98
103
|
if (simulation.onSimulated) {
|
|
99
104
|
this._simulate(provider, quote, simulation).then((payload) => {
|
|
@@ -117,9 +122,16 @@ export class MetaAg {
|
|
|
117
122
|
* @returns quotes from all providers
|
|
118
123
|
*/
|
|
119
124
|
async quote(options, simulation) {
|
|
120
|
-
const
|
|
125
|
+
const opts = {
|
|
126
|
+
...options,
|
|
127
|
+
coinInType: normalizeStructTag(options.coinInType),
|
|
128
|
+
coinOutType: normalizeStructTag(options.coinOutType),
|
|
129
|
+
};
|
|
130
|
+
const quotes = await Promise.allSettled(Object.entries(this.options.providers)
|
|
131
|
+
.filter(([_k, v]) => !v.disabled)
|
|
132
|
+
.map(async ([provider]) => {
|
|
121
133
|
const p = await this._getProvider(provider);
|
|
122
|
-
return this._quote(p,
|
|
134
|
+
return this._quote(p, opts, simulation);
|
|
123
135
|
}));
|
|
124
136
|
return quotes
|
|
125
137
|
.map((quote) => quote.status === "fulfilled"
|
|
@@ -183,8 +195,7 @@ export class MetaAg {
|
|
|
183
195
|
*/
|
|
184
196
|
const metaSettle = (quote, coinOut, slippageBps = 100, tipBps = 0, partner, commissionBps = 0) => {
|
|
185
197
|
return (tx) => {
|
|
186
|
-
const { minAmount, expectedAmount } = getExpectedReturn(quote.rawAmountOut, slippageBps, commissionBps,
|
|
187
|
-
tipBps);
|
|
198
|
+
const { minAmount, expectedAmount } = getExpectedReturn(quote.rawAmountOut, slippageBps, commissionBps, tipBps);
|
|
188
199
|
if (tipBps > 0) {
|
|
189
200
|
tx.moveCall({
|
|
190
201
|
target: `${_7K_META_PUBLISHED_AT}::vault::collect_tip`,
|
|
@@ -208,7 +219,7 @@ const metaSettle = (quote, coinOut, slippageBps = 100, tipBps = 0, partner, comm
|
|
|
208
219
|
tx.pure.u64(minAmount),
|
|
209
220
|
tx.pure.u64(expectedAmount),
|
|
210
221
|
tx.pure.option("address", partner),
|
|
211
|
-
tx.pure.u64(
|
|
222
|
+
tx.pure.u64(commissionBps),
|
|
212
223
|
tx.pure.u64(0), // ps
|
|
213
224
|
],
|
|
214
225
|
});
|
|
@@ -5,7 +5,6 @@ import { API_ENDPOINTS } from "../../../constants/apiEndpoints";
|
|
|
5
5
|
import { SUI_ADDRESS_ZERO } from "../../../constants/sui";
|
|
6
6
|
import { EProvider, } from "../../../types/metaAg";
|
|
7
7
|
import { assert } from "../../../utils/condition";
|
|
8
|
-
import { getExpectedReturn } from "../../swap/buildTx";
|
|
9
8
|
import { buildTxV2 } from "../../swap/buildTxV2";
|
|
10
9
|
import { getQuote } from "../../swap/getQuote";
|
|
11
10
|
const WORMHOLE_STATE_ID = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
|
|
@@ -36,16 +35,15 @@ export class BluefinProvider {
|
|
|
36
35
|
excludedPools: this.options.excludedPools,
|
|
37
36
|
targetPools: this.options.targetPools,
|
|
38
37
|
});
|
|
39
|
-
const { expectedAmount } = getExpectedReturn(quote.returnAmountWithDecimal.toString(), 0, this.metaOptions.partnerCommissionBps ?? 0, this.metaOptions.tipBps ?? 0);
|
|
40
38
|
return {
|
|
41
39
|
id: v4(),
|
|
42
40
|
provider: EProvider.BLUEFIN7K,
|
|
43
41
|
quote,
|
|
44
42
|
amountIn: quote.swapAmountWithDecimal,
|
|
45
43
|
rawAmountOut: quote.returnAmountWithDecimal,
|
|
46
|
-
amountOut:
|
|
47
|
-
coinTypeIn:
|
|
48
|
-
coinTypeOut:
|
|
44
|
+
amountOut: quote.returnAmountWithDecimal,
|
|
45
|
+
coinTypeIn: options.coinInType,
|
|
46
|
+
coinTypeOut: options.coinOutType,
|
|
49
47
|
};
|
|
50
48
|
}
|
|
51
49
|
async swap({ quote, signer, tx, coinIn }) {
|
|
@@ -54,8 +52,8 @@ export class BluefinProvider {
|
|
|
54
52
|
quoteResponse: quote.quote,
|
|
55
53
|
accountAddress: signer,
|
|
56
54
|
commission: {
|
|
57
|
-
commissionBps:
|
|
58
|
-
partner:
|
|
55
|
+
commissionBps: 0,
|
|
56
|
+
partner: SUI_ADDRESS_ZERO,
|
|
59
57
|
},
|
|
60
58
|
slippage: 1,
|
|
61
59
|
extendTx: {
|
|
@@ -2,21 +2,14 @@ import { AggregatorClient, Env } from "@cetusprotocol/aggregator-sdk";
|
|
|
2
2
|
import { v4 } from "uuid";
|
|
3
3
|
import { EProvider, } from "../../../types/metaAg";
|
|
4
4
|
import { assert } from "../../../utils/condition";
|
|
5
|
-
import { getExpectedReturn } from "../../swap/buildTx";
|
|
6
5
|
export class CetusProvider {
|
|
7
6
|
options;
|
|
8
|
-
metaOptions;
|
|
9
7
|
kind = EProvider.CETUS;
|
|
10
8
|
cetusClient;
|
|
11
9
|
constructor(options, metaOptions, client) {
|
|
12
10
|
this.options = options;
|
|
13
|
-
this.metaOptions = metaOptions;
|
|
14
11
|
this.cetusClient = new AggregatorClient({
|
|
15
12
|
apiKey: options.apiKey,
|
|
16
|
-
overlayFeeReceiver: metaOptions.partner,
|
|
17
|
-
overlayFeeRate: metaOptions.partnerCommissionBps
|
|
18
|
-
? metaOptions.partnerCommissionBps / 10000
|
|
19
|
-
: undefined,
|
|
20
13
|
client,
|
|
21
14
|
endpoint: options.api,
|
|
22
15
|
env: Env.Mainnet,
|
|
@@ -37,18 +30,13 @@ export class CetusProvider {
|
|
|
37
30
|
liquidityChanges: this.options.liquidityChanges,
|
|
38
31
|
});
|
|
39
32
|
assert(!!quote, "No quote found");
|
|
40
|
-
const bps = BigInt(this.metaOptions.partnerCommissionBps ?? 0);
|
|
41
|
-
// calc amount out before any commission fees
|
|
42
|
-
const amountOut = ((BigInt(quote.amountOut.toString()) * 10000n) /
|
|
43
|
-
(10000n - bps)).toString();
|
|
44
|
-
const { expectedAmount } = getExpectedReturn(amountOut, 0, this.metaOptions.partnerCommissionBps ?? 0, this.metaOptions.tipBps ?? 0);
|
|
45
33
|
return {
|
|
46
34
|
id: v4(),
|
|
47
35
|
provider: EProvider.CETUS,
|
|
48
36
|
quote,
|
|
49
|
-
amountIn: quote.amountIn.toString(),
|
|
50
|
-
rawAmountOut: amountOut,
|
|
51
|
-
amountOut:
|
|
37
|
+
amountIn: quote.amountIn.toString() || "0",
|
|
38
|
+
rawAmountOut: quote.amountOut.toString() || "0",
|
|
39
|
+
amountOut: quote.amountOut.toString() || "0",
|
|
52
40
|
coinTypeIn: quoteOptions.coinInType,
|
|
53
41
|
coinTypeOut: quoteOptions.coinOutType,
|
|
54
42
|
};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { AggregatorQuoter,
|
|
1
|
+
import { AggregatorQuoter, TradeBuilder } from "@flowx-finance/sdk";
|
|
2
2
|
import { v4 } from "uuid";
|
|
3
3
|
import { EProvider, } from "../../../types/metaAg";
|
|
4
4
|
import { assert } from "../../../utils/condition";
|
|
5
|
-
import { getExpectedReturn } from "../../swap/buildTx";
|
|
6
5
|
export class FlowxProvider {
|
|
7
6
|
options;
|
|
8
|
-
metaOptions;
|
|
9
7
|
client;
|
|
10
8
|
kind = EProvider.FLOWX;
|
|
11
9
|
quoter;
|
|
12
|
-
constructor(options,
|
|
10
|
+
constructor(options, client) {
|
|
13
11
|
this.options = options;
|
|
14
|
-
this.metaOptions = metaOptions;
|
|
15
12
|
this.client = client;
|
|
16
13
|
this.quoter = new AggregatorQuoter("mainnet", options.apiKey);
|
|
17
14
|
}
|
|
@@ -26,14 +23,13 @@ export class FlowxProvider {
|
|
|
26
23
|
maxHops: this.options.maxHops,
|
|
27
24
|
splitDistributionPercent: this.options.splitDistributionPercent,
|
|
28
25
|
});
|
|
29
|
-
const { expectedAmount } = getExpectedReturn(quote.amountOut?.toString() ?? "0", 0, this.metaOptions.partnerCommissionBps ?? 0, this.metaOptions.tipBps ?? 0);
|
|
30
26
|
return {
|
|
31
27
|
id: v4(),
|
|
32
28
|
provider: EProvider.FLOWX,
|
|
33
29
|
quote: quote,
|
|
34
30
|
amountIn: quote.amountIn?.toString() ?? "0",
|
|
35
31
|
rawAmountOut: quote.amountOut?.toString() ?? "0",
|
|
36
|
-
amountOut:
|
|
32
|
+
amountOut: quote.amountOut?.toString() ?? "0",
|
|
37
33
|
coinTypeIn: quoteOptions.coinInType,
|
|
38
34
|
coinTypeOut: quoteOptions.coinOutType,
|
|
39
35
|
};
|
|
@@ -41,9 +37,6 @@ export class FlowxProvider {
|
|
|
41
37
|
async swap(options) {
|
|
42
38
|
assert(options.quote.provider === EProvider.FLOWX, "Invalid quote");
|
|
43
39
|
const builder = new TradeBuilder("mainnet", options.quote.quote.routes);
|
|
44
|
-
if (this.metaOptions.partner) {
|
|
45
|
-
builder.commission(new Commission(this.metaOptions.partner, options.quote.quote.coinOut, CommissionType.PERCENTAGE, (this.metaOptions.partnerCommissionBps ?? 0) * 100, true));
|
|
46
|
-
}
|
|
47
40
|
builder.sender(options.signer);
|
|
48
41
|
builder.slippage(10000 * 100);
|
|
49
42
|
const res = await builder.build().swap({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAY,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAY,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAGL,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAML,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAa5B,qBAAa,MAAM;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,OAAO,CAA0B;gBAC7B,OAAO,CAAC,EAAE,aAAa;YAkBrB,YAAY;YAuCZ,SAAS;YAqDT,MAAM;IAoCpB;;;;;OAKG;IACG,KAAK,CACT,OAAO,EAAE,gBAAgB,EACzB,UAAU,CAAC,EAAE,qBAAqB,GACjC,OAAO,CAAC,SAAS,EAAE,CAAC;IAuBvB;;;;;OAKG;IACG,IAAI,CACR,OAAO,EAAE,eAAe,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,yBAAyB,CAAC;IAkBrC;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,aAAa;CA4B3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bluefin.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU/C,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"bluefin.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU/C,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAQ/B,qBAAa,eAAgB,YAAW,UAAU;IAG9C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAH9B,IAAI,YAAuB;gBAER,OAAO,EAAE,sBAAsB,EAC/B,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,EACrD,MAAM,EAAE,SAAS;IAeb,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAsBpD,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,eAAe;CAiB1D"}
|
|
@@ -3,7 +3,6 @@ import { TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
|
3
3
|
import { AgProvider, CetusProviderOptions, EProvider, MetaAgOptions, MetaQuote, MetaQuoteOptions, MetaSwapOptions } from "../../../types/metaAg";
|
|
4
4
|
export declare class CetusProvider implements AgProvider {
|
|
5
5
|
private readonly options;
|
|
6
|
-
private readonly metaOptions;
|
|
7
6
|
kind: EProvider;
|
|
8
7
|
private readonly cetusClient;
|
|
9
8
|
constructor(options: CetusProviderOptions, metaOptions: MetaAgOptions, client: SuiClient);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"cetus.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/cetus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,IAAI,YAAmB;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAE5B,OAAO,EAAE,oBAAoB,EAC9C,WAAW,EAAE,aAAa,EAC1B,MAAM,EAAE,SAAS;IAWb,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IA0BzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAUzE"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui/client";
|
|
2
2
|
import { TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
3
|
-
import { AgProvider, EProvider, FlowxProviderOptions,
|
|
3
|
+
import { AgProvider, EProvider, FlowxProviderOptions, MetaQuote, MetaQuoteOptions, MetaSwapOptions } from "../../../types/metaAg";
|
|
4
4
|
export declare class FlowxProvider implements AgProvider {
|
|
5
5
|
private readonly options;
|
|
6
|
-
private readonly metaOptions;
|
|
7
6
|
private readonly client;
|
|
8
7
|
kind: EProvider;
|
|
9
8
|
private quoter;
|
|
10
|
-
constructor(options: FlowxProviderOptions,
|
|
9
|
+
constructor(options: FlowxProviderOptions, client: SuiClient);
|
|
11
10
|
quote(quoteOptions: MetaQuoteOptions): Promise<MetaQuote>;
|
|
12
11
|
swap(options: MetaSwapOptions): Promise<TransactionObjectArgument>;
|
|
13
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flowx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/flowx.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EACL,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,IAAI,YAAmB;IACvB,OAAO,CAAC,MAAM,CAAmB;gBAEd,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,SAAS;IAK9B,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBzD,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAYzE"}
|
|
@@ -8,32 +8,31 @@ export declare enum EProvider {
|
|
|
8
8
|
CETUS = "cetus",
|
|
9
9
|
FLOWX = "flowx"
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
type ProviderBaseOptions = {
|
|
12
|
+
api?: string;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type BluefinProviderOptions = ProviderBaseOptions & {
|
|
12
17
|
sources?: SourceDex[];
|
|
13
18
|
maxPaths?: number;
|
|
14
19
|
excludedPools?: string[];
|
|
15
20
|
targetPools?: string[];
|
|
16
|
-
api?: string;
|
|
17
|
-
apiKey?: string;
|
|
18
21
|
};
|
|
19
|
-
export type FlowxProviderOptions = {
|
|
22
|
+
export type FlowxProviderOptions = ProviderBaseOptions & {
|
|
20
23
|
sources?: Protocol[];
|
|
21
24
|
excludePools?: string[];
|
|
22
25
|
excludeSources?: Protocol[];
|
|
23
26
|
maxHops?: number;
|
|
24
27
|
splitDistributionPercent?: number;
|
|
25
|
-
api?: string;
|
|
26
|
-
apiKey?: string;
|
|
27
28
|
};
|
|
28
|
-
export type CetusProviderOptions = {
|
|
29
|
+
export type CetusProviderOptions = ProviderBaseOptions & {
|
|
29
30
|
sources?: string[];
|
|
30
31
|
splitCount?: number;
|
|
31
32
|
splitAlgorithm?: string;
|
|
32
33
|
splitFactor?: number;
|
|
33
34
|
depth?: number;
|
|
34
35
|
liquidityChanges?: PreSwapLpChangeParams[];
|
|
35
|
-
api?: string;
|
|
36
|
-
apiKey?: string;
|
|
37
36
|
};
|
|
38
37
|
export interface MetaAgOptions {
|
|
39
38
|
/**If not specified, all providers will be used */
|
|
@@ -124,4 +123,5 @@ export declare abstract class AgProvider {
|
|
|
124
123
|
abstract quote(quoteOptions: MetaQuoteOptions): Promise<MetaQuote>;
|
|
125
124
|
abstract swap(options: MetaSwapOptions): Promise<TransactionObjectArgument>;
|
|
126
125
|
}
|
|
126
|
+
export {};
|
|
127
127
|
//# sourceMappingURL=metaAg.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metaAg.d.ts","sourceRoot":"","sources":["../../../../src/types/metaAg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExD,oBAAY,SAAS;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AACD,
|
|
1
|
+
{"version":3,"file":"metaAg.d.ts","sourceRoot":"","sources":["../../../../src/types/metaAg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,SAAS,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AAQ,EAAE,SAAS,CAAC,KAAK,CAAC;IAC1B,KAAK,EAAE,YAAY,CAAC;CACrB,GACD;IACE,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC;IAC1B,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CACJ,GAAG;IACF,6GAA6G;IAC7G,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,YAAY,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,CAAC;AACF,8BAAsB,UAAU;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAClE,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAC5E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@7kprotocol/sdk-ts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"typescript-eslint": "^8.34.1"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@mysten/sui": "^1.
|
|
74
|
+
"@mysten/sui": "^1.44.0",
|
|
75
75
|
"@pythnetwork/pyth-sui-js": "^2.2.0"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|