@7kprotocol/sdk-ts 3.5.2-beta.1 → 3.5.4
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/config/index.js +0 -9
- package/lib/cjs/features/metaAg/index.js +108 -98
- package/lib/cjs/features/metaAg/providers/bluefin.js +6 -6
- package/lib/cjs/features/metaAg/providers/cetus.js +4 -4
- package/lib/cjs/features/metaAg/providers/flowx.js +4 -4
- package/lib/cjs/features/swap/buildTx.js +0 -3
- package/lib/cjs/features/swap/buildTxV2.js +6 -10
- package/lib/cjs/features/swap/config.js +1 -2
- package/lib/cjs/features/swap/getQuote.js +2 -3
- package/lib/cjs/libs/protocols/bluefinx/client.js +1 -1
- package/lib/cjs/types/config/index.d.ts +0 -4
- package/lib/cjs/types/config/index.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/index.d.ts +2 -11
- package/lib/cjs/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/bluefin.d.ts +3 -3
- package/lib/cjs/types/features/metaAg/providers/bluefin.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts +5 -4
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts +3 -3
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/buildTx.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/buildTxV2.d.ts +3 -3
- package/lib/cjs/types/features/swap/buildTxV2.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/config.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/getQuote.d.ts +3 -1
- package/lib/cjs/types/features/swap/getQuote.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +1 -3
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/metaAg.js +4 -11
- package/lib/cjs/types/types/metaAg.d.ts +8 -60
- package/lib/cjs/types/types/metaAg.d.ts.map +1 -1
- package/lib/cjs/types/utils/condition.d.ts +1 -1
- package/lib/cjs/types/utils/condition.d.ts.map +1 -1
- package/lib/esm/config/index.js +0 -9
- package/lib/esm/features/metaAg/index.js +109 -99
- package/lib/esm/features/metaAg/providers/bluefin.js +6 -6
- package/lib/esm/features/metaAg/providers/cetus.js +4 -4
- package/lib/esm/features/metaAg/providers/flowx.js +4 -4
- package/lib/esm/features/swap/buildTx.js +0 -3
- package/lib/esm/features/swap/buildTxV2.js +2 -6
- package/lib/esm/features/swap/config.js +1 -2
- package/lib/esm/features/swap/getQuote.js +2 -3
- package/lib/esm/libs/protocols/bluefinx/client.js +1 -1
- package/lib/esm/types/config/index.d.ts +0 -4
- package/lib/esm/types/config/index.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/index.d.ts +2 -11
- package/lib/esm/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/bluefin.d.ts +3 -3
- package/lib/esm/types/features/metaAg/providers/bluefin.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts +5 -4
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts +3 -3
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/lib/esm/types/features/swap/buildTx.d.ts.map +1 -1
- package/lib/esm/types/features/swap/buildTxV2.d.ts +3 -3
- package/lib/esm/types/features/swap/buildTxV2.d.ts.map +1 -1
- package/lib/esm/types/features/swap/config.d.ts.map +1 -1
- package/lib/esm/types/features/swap/getQuote.d.ts +3 -1
- package/lib/esm/types/features/swap/getQuote.d.ts.map +1 -1
- package/lib/esm/types/index.d.ts +1 -3
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/metaAg.js +2 -8
- package/lib/esm/types/types/metaAg.d.ts +8 -60
- package/lib/esm/types/types/metaAg.d.ts.map +1 -1
- package/lib/esm/types/utils/condition.d.ts +1 -1
- package/lib/esm/types/utils/condition.d.ts.map +1 -1
- package/package.json +2 -3
- package/lib/cjs/features/metaAg/common.js +0 -117
- package/lib/cjs/features/metaAg/providers/astro.js +0 -43
- package/lib/cjs/features/metaAg/providers/bluefinx.js +0 -87
- package/lib/cjs/features/metaAg/providers/okx.js +0 -181
- package/lib/cjs/types/features/metaAg/common.d.ts +0 -33
- package/lib/cjs/types/features/metaAg/common.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/astro.d.ts +0 -9
- package/lib/cjs/types/features/metaAg/providers/astro.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/bluefinx.d.ts +0 -10
- package/lib/cjs/types/features/metaAg/providers/bluefinx.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/okx.d.ts +0 -21
- package/lib/cjs/types/features/metaAg/providers/okx.d.ts.map +0 -1
- package/lib/cjs/types/okx.js +0 -6
- package/lib/cjs/types/types/okx.d.ts +0 -193
- package/lib/cjs/types/types/okx.d.ts.map +0 -1
- package/lib/esm/features/metaAg/common.js +0 -109
- package/lib/esm/features/metaAg/providers/astro.js +0 -40
- package/lib/esm/features/metaAg/providers/bluefinx.js +0 -84
- package/lib/esm/features/metaAg/providers/okx.js +0 -146
- package/lib/esm/types/features/metaAg/common.d.ts +0 -33
- package/lib/esm/types/features/metaAg/common.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/astro.d.ts +0 -9
- package/lib/esm/types/features/metaAg/providers/astro.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/bluefinx.d.ts +0 -10
- package/lib/esm/types/features/metaAg/providers/bluefinx.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/okx.d.ts +0 -21
- package/lib/esm/types/features/metaAg/providers/okx.d.ts.map +0 -1
- package/lib/esm/types/okx.js +0 -5
- package/lib/esm/types/types/okx.d.ts +0 -193
- package/lib/esm/types/types/okx.d.ts.map +0 -1
package/lib/cjs/config/index.js
CHANGED
|
@@ -6,7 +6,6 @@ const pyth_sui_js_1 = require("@pythnetwork/pyth-sui-js");
|
|
|
6
6
|
const HERMES_API = "https://hermes.pyth.network";
|
|
7
7
|
const WORMHOLE_STATE_ID = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
|
|
8
8
|
const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
|
|
9
|
-
let api = "";
|
|
10
9
|
let apiKey = "";
|
|
11
10
|
let bluefinXApiKey = "";
|
|
12
11
|
let suiClient = new client_1.SuiClient({
|
|
@@ -14,12 +13,6 @@ let suiClient = new client_1.SuiClient({
|
|
|
14
13
|
});
|
|
15
14
|
let pythClient = new pyth_sui_js_1.SuiPythClient(suiClient, PYTH_STATE_ID, WORMHOLE_STATE_ID);
|
|
16
15
|
let pythConnection = new pyth_sui_js_1.SuiPriceServiceConnection(HERMES_API);
|
|
17
|
-
function setApi(url) {
|
|
18
|
-
api = url;
|
|
19
|
-
}
|
|
20
|
-
function getApi() {
|
|
21
|
-
return api;
|
|
22
|
-
}
|
|
23
16
|
function setApiKey(key) {
|
|
24
17
|
apiKey = key;
|
|
25
18
|
}
|
|
@@ -51,8 +44,6 @@ function getPythConnection() {
|
|
|
51
44
|
return pythConnection;
|
|
52
45
|
}
|
|
53
46
|
const Config = {
|
|
54
|
-
setApi,
|
|
55
|
-
getApi,
|
|
56
47
|
setApiKey,
|
|
57
48
|
getApiKey,
|
|
58
49
|
setBluefinXApiKey,
|
|
@@ -37,22 +37,18 @@ exports.MetaAg = void 0;
|
|
|
37
37
|
const client_1 = require("@mysten/sui/client");
|
|
38
38
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
39
39
|
const utils_1 = require("@mysten/sui/utils");
|
|
40
|
+
const _7k_1 = require("../../constants/_7k");
|
|
40
41
|
const sui_1 = require("../../constants/sui");
|
|
41
42
|
const metaAg_1 = require("../../types/metaAg");
|
|
42
43
|
const condition_1 = require("../../utils/condition");
|
|
43
44
|
const SuiClientUtils_1 = require("../../utils/SuiClientUtils");
|
|
44
45
|
const buildTx_1 = require("../swap/buildTx");
|
|
45
|
-
const common_1 = require("./common");
|
|
46
46
|
const bluefin_1 = require("./providers/bluefin");
|
|
47
|
-
const bluefinx_1 = require("./providers/bluefinx");
|
|
48
|
-
const okx_1 = require("./providers/okx");
|
|
49
47
|
const HERMES_API = "https://hermes.pyth.network";
|
|
50
48
|
const DEFAULT_PROVIDERS = {
|
|
51
49
|
[metaAg_1.EProvider.BLUEFIN7K]: {},
|
|
52
50
|
[metaAg_1.EProvider.FLOWX]: {},
|
|
53
51
|
[metaAg_1.EProvider.CETUS]: {},
|
|
54
|
-
[metaAg_1.EProvider.ASTRO]: {},
|
|
55
|
-
[metaAg_1.EProvider.BLUEFINX]: {},
|
|
56
52
|
};
|
|
57
53
|
class MetaAg {
|
|
58
54
|
constructor(options) {
|
|
@@ -89,16 +85,6 @@ class MetaAg {
|
|
|
89
85
|
const { CetusProvider } = await Promise.resolve().then(() => __importStar(require("./providers/cetus"))).catch(catchImportError(metaAg_1.EProvider.CETUS));
|
|
90
86
|
this.providers[metaAg_1.EProvider.CETUS] = new CetusProvider(providerOptions, this.options, this.client);
|
|
91
87
|
break;
|
|
92
|
-
case metaAg_1.EProvider.OKX:
|
|
93
|
-
this.providers[metaAg_1.EProvider.OKX] = new okx_1.OkxProvider(providerOptions, this.options, this.client);
|
|
94
|
-
break;
|
|
95
|
-
case metaAg_1.EProvider.BLUEFINX:
|
|
96
|
-
this.providers[metaAg_1.EProvider.BLUEFINX] = new bluefinx_1.BluefinXProvider(providerOptions);
|
|
97
|
-
break;
|
|
98
|
-
case metaAg_1.EProvider.ASTRO:
|
|
99
|
-
const { AstroProvider } = await Promise.resolve().then(() => __importStar(require("./providers/astro"))).catch(catchImportError(metaAg_1.EProvider.ASTRO));
|
|
100
|
-
this.providers[metaAg_1.EProvider.ASTRO] = new AstroProvider(providerOptions);
|
|
101
|
-
break;
|
|
102
88
|
default:
|
|
103
89
|
throw new Error(`Provider not supported: ${provider}`);
|
|
104
90
|
}
|
|
@@ -106,56 +92,62 @@ class MetaAg {
|
|
|
106
92
|
}
|
|
107
93
|
async _simulate(provider, quote, simulation) {
|
|
108
94
|
try {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
95
|
+
const tx = new transactions_1.Transaction();
|
|
96
|
+
const id = quote.id;
|
|
97
|
+
const coinOut = await provider.swap({
|
|
98
|
+
quote,
|
|
99
|
+
coinIn: (0, transactions_1.coinWithBalance)({
|
|
100
|
+
balance: BigInt(quote.amountIn),
|
|
101
|
+
type: quote.coinTypeIn,
|
|
102
|
+
useGasCoin: false,
|
|
103
|
+
}),
|
|
104
|
+
signer: simulation.sender,
|
|
105
|
+
tx,
|
|
106
|
+
});
|
|
107
|
+
tx.add(metaSettle(quote, coinOut, 10000, this.options.tipBps, this.options.partner, this.options.partnerCommissionBps));
|
|
108
|
+
tx.transferObjects([coinOut], simulation.sender);
|
|
109
|
+
const res = await timeout(() => this.inspector.devInspectTransactionBlock({
|
|
110
|
+
sender: simulation.sender,
|
|
111
|
+
transactionBlock: tx,
|
|
112
|
+
}), simulation.timeout ?? 2000, `simulation for ${provider.kind} provider with id ${id}`);
|
|
113
|
+
if (res.effects.status.status === "failure") {
|
|
114
|
+
throw new Error(res.error ?? "Simulation failed");
|
|
119
115
|
}
|
|
116
|
+
const amountOut = extractAmountOutWrapper(res.events);
|
|
117
|
+
return {
|
|
118
|
+
id,
|
|
119
|
+
simulatedAmountOut: amountOut,
|
|
120
|
+
gasUsed: res.effects.gasUsed,
|
|
121
|
+
provider: provider.kind,
|
|
122
|
+
};
|
|
120
123
|
}
|
|
121
124
|
catch (error) {
|
|
122
|
-
console.warn(
|
|
125
|
+
console.warn(`Failed to simulate ${provider.kind}: `, error);
|
|
123
126
|
}
|
|
124
127
|
}
|
|
125
|
-
async _quote(provider, options) {
|
|
126
|
-
const quote = await
|
|
128
|
+
async _quote(provider, options, simulation) {
|
|
129
|
+
const quote = await timeout(async () => {
|
|
127
130
|
const quote = await provider.quote(options);
|
|
128
|
-
if (!quote)
|
|
129
|
-
return null;
|
|
130
131
|
const { expectedAmount } = (0, buildTx_1.getExpectedReturn)(quote.rawAmountOut, 0, this.options.partnerCommissionBps, this.options.tipBps);
|
|
131
132
|
quote.amountOut = expectedAmount;
|
|
132
133
|
return quote;
|
|
133
|
-
}, options.timeout ?? 2000, `quote for ${provider.kind} provider from ${options.
|
|
134
|
+
}, options.timeout ?? 2000, `quote for ${provider.kind} provider from ${options.coinInType} to ${options.coinOutType}`);
|
|
135
|
+
if (simulation) {
|
|
136
|
+
if (simulation.onSimulated) {
|
|
137
|
+
this._simulate(provider, quote, simulation).then((payload) => {
|
|
138
|
+
if (payload) {
|
|
139
|
+
simulation.onSimulated?.(payload);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const updated = await this._simulate(provider, quote, simulation);
|
|
145
|
+
quote.simulatedAmountOut = updated?.simulatedAmountOut;
|
|
146
|
+
quote.gasUsed = updated?.gasUsed;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
134
149
|
return quote;
|
|
135
150
|
}
|
|
136
|
-
async _fastSwap({ quote, signer, useGasCoin, signTransaction }, getTransactionBlockParams) {
|
|
137
|
-
const tx = new transactions_1.Transaction();
|
|
138
|
-
const coin = await this.swap({
|
|
139
|
-
quote,
|
|
140
|
-
signer,
|
|
141
|
-
tx,
|
|
142
|
-
coinIn: (0, transactions_1.coinWithBalance)({
|
|
143
|
-
type: quote.coinTypeIn,
|
|
144
|
-
balance: BigInt(quote.amountIn),
|
|
145
|
-
useGasCoin,
|
|
146
|
-
}),
|
|
147
|
-
});
|
|
148
|
-
tx.transferObjects([coin], signer);
|
|
149
|
-
tx.setSenderIfNotSet(signer);
|
|
150
|
-
const txBytes = await tx.build({ client: this.client });
|
|
151
|
-
const { signature, bytes } = await signTransaction((0, utils_1.toBase64)(txBytes));
|
|
152
|
-
return this.client.executeTransactionBlock({
|
|
153
|
-
transactionBlock: bytes,
|
|
154
|
-
signature,
|
|
155
|
-
options: getTransactionBlockParams?.options,
|
|
156
|
-
signal: getTransactionBlockParams?.signal,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
151
|
/**
|
|
160
152
|
* Get quotes from all providers
|
|
161
153
|
* @param options - quote options
|
|
@@ -165,38 +157,23 @@ class MetaAg {
|
|
|
165
157
|
async quote(options, simulation) {
|
|
166
158
|
const opts = {
|
|
167
159
|
...options,
|
|
168
|
-
|
|
169
|
-
|
|
160
|
+
coinInType: (0, utils_1.normalizeStructTag)(options.coinInType),
|
|
161
|
+
coinOutType: (0, utils_1.normalizeStructTag)(options.coinOutType),
|
|
170
162
|
};
|
|
171
163
|
const quotes = await Promise.allSettled(Object.entries(this.options.providers)
|
|
172
164
|
.filter(([_k, v]) => !v.disabled)
|
|
173
165
|
.map(async ([provider]) => {
|
|
174
166
|
const p = await this._getProvider(provider);
|
|
175
|
-
return this._quote(p, opts);
|
|
167
|
+
return this._quote(p, opts, simulation);
|
|
176
168
|
}));
|
|
177
|
-
|
|
169
|
+
return quotes
|
|
178
170
|
.map((quote) => quote.status === "fulfilled"
|
|
179
171
|
? quote.value
|
|
180
172
|
: (console.log(quote.reason), null))
|
|
181
173
|
.filter((quote) => quote !== null);
|
|
182
|
-
if (simulation) {
|
|
183
|
-
const requests = result.map(async (quote) => {
|
|
184
|
-
const provider = await this._getProvider(quote.provider);
|
|
185
|
-
const updated = await this._simulate(provider, quote, simulation);
|
|
186
|
-
quote.simulatedAmountOut = updated?.simulatedAmountOut;
|
|
187
|
-
quote.gasUsed = updated?.gasUsed;
|
|
188
|
-
simulation?.onSimulated?.({ ...quote });
|
|
189
|
-
});
|
|
190
|
-
if (!simulation.onSimulated) {
|
|
191
|
-
await Promise.all(requests);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return result;
|
|
195
174
|
}
|
|
196
175
|
/**
|
|
197
176
|
* Build transaction from quote
|
|
198
|
-
* @info Use this function to build composable transaction (ie: add more commands after the swap, consume the coin out object)
|
|
199
|
-
* @warning Providers that build transaction on the fly (typically RFQ, Swap-API providers ie: BluefinX, Okx, ...) are not supported, please use `fastSwap` instead
|
|
200
177
|
* @param options - build tx options
|
|
201
178
|
* @param slippageBps - slippage bps if not specified, fallback to global slippage bps, if none of them specified, default to 100
|
|
202
179
|
* @returns coin out object, you must consume it by transferObjects, or other sub sequence commands
|
|
@@ -204,32 +181,11 @@ class MetaAg {
|
|
|
204
181
|
async swap(options, slippageBps) {
|
|
205
182
|
const provider = await this._getProvider(options.quote.provider);
|
|
206
183
|
(0, condition_1.assert)(!!provider, `Provider not found: ${options.quote.provider}`);
|
|
207
|
-
(0, condition_1.assert)((0, metaAg_1.isAggregatorProvider)(provider), `Provider does not support swap: ${provider.kind}`);
|
|
208
184
|
const coinOut = await provider.swap(options);
|
|
209
|
-
options.tx.add(
|
|
185
|
+
options.tx.add(metaSettle(options.quote, coinOut, slippageBps ?? this.options.slippageBps ?? 100, this.options.tipBps, this.options.partner, this.options.partnerCommissionBps));
|
|
210
186
|
options.tx.setSenderIfNotSet(options.signer);
|
|
211
187
|
return coinOut;
|
|
212
188
|
}
|
|
213
|
-
/**
|
|
214
|
-
* Build, Sign, and Execute transaction in one step
|
|
215
|
-
* @param options - fast swap options
|
|
216
|
-
* @returns - txDigest of the transaction
|
|
217
|
-
*/
|
|
218
|
-
async fastSwap(options, getTransactionBlockParams) {
|
|
219
|
-
const provider = await this._getProvider(options.quote.provider);
|
|
220
|
-
if ((0, metaAg_1.isAggregatorProvider)(provider)) {
|
|
221
|
-
return this._fastSwap(options, getTransactionBlockParams);
|
|
222
|
-
}
|
|
223
|
-
else if ((0, metaAg_1.isSwapAPIProvider)(provider)) {
|
|
224
|
-
return this.client.waitForTransaction({
|
|
225
|
-
...getTransactionBlockParams,
|
|
226
|
-
digest: await provider.fastSwap(options),
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
throw new Error(`Provider not supported: ${provider.kind}`);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
189
|
/**
|
|
234
190
|
* Update meta aggregator options
|
|
235
191
|
* @param options - update options payload
|
|
@@ -263,17 +219,71 @@ class MetaAg {
|
|
|
263
219
|
}
|
|
264
220
|
}
|
|
265
221
|
exports.MetaAg = MetaAg;
|
|
222
|
+
/**
|
|
223
|
+
* this settlement does not charge commission fee for partner, since all integrated aggregators already charge commission fee for partner
|
|
224
|
+
* @param quote Meta Aggregator Quote
|
|
225
|
+
* @param coinOut Coin Out Object
|
|
226
|
+
* @param slippageBps Slippage Bps
|
|
227
|
+
* @param tipBps Tip Bps default = 0
|
|
228
|
+
* @param partner address of partner for analytic default is zero address
|
|
229
|
+
*/
|
|
230
|
+
const metaSettle = (quote, coinOut, slippageBps = 100, tipBps = 0, partner, commissionBps = 0) => {
|
|
231
|
+
return (tx) => {
|
|
232
|
+
const { minAmount, expectedAmount } = (0, buildTx_1.getExpectedReturn)(quote.rawAmountOut, slippageBps, commissionBps, tipBps);
|
|
233
|
+
if (tipBps > 0) {
|
|
234
|
+
tx.moveCall({
|
|
235
|
+
target: `${_7k_1._7K_META_PUBLISHED_AT}::vault::collect_tip`,
|
|
236
|
+
typeArguments: [quote.coinTypeOut],
|
|
237
|
+
arguments: [
|
|
238
|
+
tx.object(_7k_1._7K_META_VAULT),
|
|
239
|
+
tx.object(_7k_1._7K_META_CONFIG),
|
|
240
|
+
coinOut,
|
|
241
|
+
tx.pure.u64(tipBps),
|
|
242
|
+
],
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
tx.moveCall({
|
|
246
|
+
target: `${_7k_1._7K_META_PUBLISHED_AT}::settle::settle`,
|
|
247
|
+
typeArguments: [quote.coinTypeIn, quote.coinTypeOut],
|
|
248
|
+
arguments: [
|
|
249
|
+
tx.object(_7k_1._7K_META_CONFIG),
|
|
250
|
+
tx.object(_7k_1._7K_META_VAULT),
|
|
251
|
+
tx.pure.u64(quote.amountIn),
|
|
252
|
+
coinOut,
|
|
253
|
+
tx.pure.u64(minAmount),
|
|
254
|
+
tx.pure.u64(expectedAmount),
|
|
255
|
+
tx.pure.option("address", partner),
|
|
256
|
+
tx.pure.u64(commissionBps),
|
|
257
|
+
tx.pure.u64(0), // ps
|
|
258
|
+
],
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
const extractAmountOutWrapper = (events) => {
|
|
263
|
+
const swapEvent = events
|
|
264
|
+
.filter((event) => event.type === `${_7k_1._7K_META_PACKAGE_ID}::settle::Swap`)
|
|
265
|
+
?.pop();
|
|
266
|
+
return swapEvent?.parsedJson?.amount_out;
|
|
267
|
+
};
|
|
266
268
|
const catchImportError = (provider) => {
|
|
267
269
|
return (e) => {
|
|
268
270
|
const map = {
|
|
269
271
|
[metaAg_1.EProvider.CETUS]: "@cetusprotocol/aggregator-sdk",
|
|
270
272
|
[metaAg_1.EProvider.FLOWX]: "@flowx-finance/sdk",
|
|
271
273
|
[metaAg_1.EProvider.BLUEFIN7K]: "@7kprotocol/sdk-ts",
|
|
272
|
-
[metaAg_1.EProvider.ASTRO]: "@naviprotocol/astros-aggregator-sdk",
|
|
273
|
-
[metaAg_1.EProvider.OKX]: "",
|
|
274
|
-
[metaAg_1.EProvider.BLUEFINX]: "",
|
|
275
274
|
};
|
|
276
275
|
console.warn(`Please install ${map[provider]} to use ${provider} provider`);
|
|
277
276
|
throw e;
|
|
278
277
|
};
|
|
279
278
|
};
|
|
279
|
+
const timeout = async (fn, timeout, msg) => {
|
|
280
|
+
if (timeout <= 0)
|
|
281
|
+
return fn();
|
|
282
|
+
return new Promise((resolve, reject) => {
|
|
283
|
+
const timer = setTimeout(() => reject(new Error(`Timeout ${msg ?? "operation"}`)), timeout);
|
|
284
|
+
fn()
|
|
285
|
+
.then(resolve)
|
|
286
|
+
.catch(reject)
|
|
287
|
+
.finally(() => clearTimeout(timer));
|
|
288
|
+
});
|
|
289
|
+
};
|
|
@@ -5,6 +5,7 @@ const pyth_sui_js_1 = require("@pythnetwork/pyth-sui-js");
|
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
6
|
const config_1 = require("../../../config");
|
|
7
7
|
const _7k_1 = require("../../../constants/_7k");
|
|
8
|
+
const apiEndpoints_1 = require("../../../constants/apiEndpoints");
|
|
8
9
|
const metaAg_1 = require("../../../types/metaAg");
|
|
9
10
|
const condition_1 = require("../../../utils/condition");
|
|
10
11
|
const buildTxV2_1 = require("../../swap/buildTxV2");
|
|
@@ -20,8 +21,6 @@ class BluefinProvider {
|
|
|
20
21
|
const pythConnection = new pyth_sui_js_1.SuiPriceServiceConnection(this.metaOptions.hermesApi);
|
|
21
22
|
if (options.apiKey)
|
|
22
23
|
config_1.Config.setApiKey(options.apiKey);
|
|
23
|
-
if (options.api)
|
|
24
|
-
config_1.Config.setApi(options.api);
|
|
25
24
|
config_1.Config.setSuiClient(client);
|
|
26
25
|
config_1.Config.setPythClient(pythClient);
|
|
27
26
|
config_1.Config.setPythConnection(pythConnection);
|
|
@@ -29,8 +28,9 @@ class BluefinProvider {
|
|
|
29
28
|
async quote(options) {
|
|
30
29
|
const quote = await (0, getQuote_1.getQuote)({
|
|
31
30
|
amountIn: options.amountIn,
|
|
32
|
-
tokenIn: options.
|
|
33
|
-
tokenOut: options.
|
|
31
|
+
tokenIn: options.coinInType,
|
|
32
|
+
tokenOut: options.coinOutType,
|
|
33
|
+
api: this.options.api || apiEndpoints_1.API_ENDPOINTS.MAIN,
|
|
34
34
|
sources: this.options.sources,
|
|
35
35
|
maxPaths: this.options.maxPaths,
|
|
36
36
|
excludedPools: this.options.excludedPools,
|
|
@@ -43,8 +43,8 @@ class BluefinProvider {
|
|
|
43
43
|
amountIn: quote.swapAmountWithDecimal,
|
|
44
44
|
rawAmountOut: quote.returnAmountWithDecimal,
|
|
45
45
|
amountOut: quote.returnAmountWithDecimal,
|
|
46
|
-
coinTypeIn: options.
|
|
47
|
-
coinTypeOut: options.
|
|
46
|
+
coinTypeIn: options.coinInType,
|
|
47
|
+
coinTypeOut: options.coinOutType,
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
async swap({ quote, signer, tx, coinIn }) {
|
|
@@ -24,8 +24,8 @@ class CetusProvider {
|
|
|
24
24
|
const quote = await this.cetusClient.findRouters({
|
|
25
25
|
amount: quoteOptions.amountIn,
|
|
26
26
|
byAmountIn: true,
|
|
27
|
-
from: quoteOptions.
|
|
28
|
-
target: quoteOptions.
|
|
27
|
+
from: quoteOptions.coinInType,
|
|
28
|
+
target: quoteOptions.coinOutType,
|
|
29
29
|
providers: this.options.sources,
|
|
30
30
|
splitCount: this.options.splitCount,
|
|
31
31
|
splitAlgorithm: this.options.splitAlgorithm,
|
|
@@ -41,8 +41,8 @@ class CetusProvider {
|
|
|
41
41
|
amountIn: quote.amountIn.toString() || "0",
|
|
42
42
|
rawAmountOut: quote.amountOut.toString() || "0",
|
|
43
43
|
amountOut: quote.amountOut.toString() || "0",
|
|
44
|
-
coinTypeIn: quoteOptions.
|
|
45
|
-
coinTypeOut: quoteOptions.
|
|
44
|
+
coinTypeIn: quoteOptions.coinInType,
|
|
45
|
+
coinTypeOut: quoteOptions.coinOutType,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
async swap(options) {
|
|
@@ -16,8 +16,8 @@ class FlowxProvider {
|
|
|
16
16
|
async quote(quoteOptions) {
|
|
17
17
|
const quote = await this.quoter.getRoutes({
|
|
18
18
|
amountIn: quoteOptions.amountIn,
|
|
19
|
-
tokenIn: quoteOptions.
|
|
20
|
-
tokenOut: quoteOptions.
|
|
19
|
+
tokenIn: quoteOptions.coinInType,
|
|
20
|
+
tokenOut: quoteOptions.coinOutType,
|
|
21
21
|
includeSources: this.options.sources,
|
|
22
22
|
excludePools: this.options.excludePools,
|
|
23
23
|
excludeSources: this.options.excludeSources,
|
|
@@ -31,8 +31,8 @@ class FlowxProvider {
|
|
|
31
31
|
amountIn: quote.amountIn?.toString() ?? "0",
|
|
32
32
|
rawAmountOut: quote.amountOut?.toString() ?? "0",
|
|
33
33
|
amountOut: quote.amountOut?.toString() ?? "0",
|
|
34
|
-
coinTypeIn: quoteOptions.
|
|
35
|
-
coinTypeOut: quoteOptions.
|
|
34
|
+
coinTypeIn: quoteOptions.coinInType,
|
|
35
|
+
coinTypeOut: quoteOptions.coinOutType,
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
async swap(options) {
|
|
@@ -177,9 +177,6 @@ const buildBluefinXTx = async (tx, accountAddress, quoteResponse) => {
|
|
|
177
177
|
if (extra.quoteExpiresAtUtcMillis < Date.now()) {
|
|
178
178
|
throw new Error("Quote expired");
|
|
179
179
|
}
|
|
180
|
-
if (extra.taker !== accountAddress) {
|
|
181
|
-
throw new Error("Sender mismatch with quote");
|
|
182
|
-
}
|
|
183
180
|
tx.setSenderIfNotSet(accountAddress);
|
|
184
181
|
const bytes = await tx.build({
|
|
185
182
|
client: config_1.Config.getSuiClient(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.multiSwap = exports.
|
|
3
|
+
exports.multiSwap = exports.optimize = exports.buildTxV2 = void 0;
|
|
4
4
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
5
5
|
const utils_1 = require("@mysten/sui/utils");
|
|
6
6
|
const groupSwapRoutes_1 = require("../../libs/groupSwapRoutes");
|
|
@@ -15,11 +15,7 @@ const config_1 = require("./config");
|
|
|
15
15
|
* 2. Merging redundant swaps to the same pool within each wave
|
|
16
16
|
* 3. Processing waves sequentially, passing intermediate tokens between waves
|
|
17
17
|
*/
|
|
18
|
-
const buildTxV2 = async (
|
|
19
|
-
return (0, exports.buildTxV2Int)(params);
|
|
20
|
-
};
|
|
21
|
-
exports.buildTxV2 = buildTxV2;
|
|
22
|
-
const buildTxV2Int = async ({ quoteResponse, accountAddress, slippage, commission: __commission, devInspect, extendTx, isSponsored, }, beforeBuildBluefinXTx) => {
|
|
18
|
+
const buildTxV2 = async ({ quoteResponse, accountAddress, slippage, commission: __commission, devInspect, extendTx, isSponsored, }) => {
|
|
23
19
|
const isBluefinX = (0, aggregator_1.isBluefinXRouting)(quoteResponse);
|
|
24
20
|
const _commission = {
|
|
25
21
|
...__commission,
|
|
@@ -53,7 +49,7 @@ const buildTxV2Int = async ({ quoteResponse, accountAddress, slippage, commissio
|
|
|
53
49
|
sui_1.SuiUtils.transferOrDestroyZeroCoin(tx, quoteResponse.tokenIn, coinIn, accountAddress);
|
|
54
50
|
const pythMap = await (0, buildTx_1.updatePythPriceFeedsIfAny)(tx, [quoteResponse]);
|
|
55
51
|
const config = await (0, config_1.getConfig)();
|
|
56
|
-
const finalCoins = await optimize(pythMap, config, routes, coinData, tx, accountAddress);
|
|
52
|
+
const finalCoins = await (0, exports.optimize)(pythMap, config, routes, coinData, tx, accountAddress);
|
|
57
53
|
// Merge all final coins
|
|
58
54
|
if (finalCoins.length > 0) {
|
|
59
55
|
const mergeCoin = tx.add((0, buildTx_1.settle)(finalCoins, quoteResponse, Math.floor(+slippage * 10000), _commission));
|
|
@@ -65,7 +61,6 @@ const buildTxV2Int = async ({ quoteResponse, accountAddress, slippage, commissio
|
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
63
|
if (isBluefinX) {
|
|
68
|
-
beforeBuildBluefinXTx?.(tx, coinOut);
|
|
69
64
|
return {
|
|
70
65
|
tx: await (0, buildTx_1.buildBluefinXTx)(tx, accountAddress, quoteResponse),
|
|
71
66
|
coinOut,
|
|
@@ -74,7 +69,7 @@ const buildTxV2Int = async ({ quoteResponse, accountAddress, slippage, commissio
|
|
|
74
69
|
tx.setSenderIfNotSet(accountAddress);
|
|
75
70
|
return { tx, coinOut };
|
|
76
71
|
};
|
|
77
|
-
exports.
|
|
72
|
+
exports.buildTxV2 = buildTxV2;
|
|
78
73
|
const optimize = async (pythMap, config, routes, coinData, tx, accountAddress) => {
|
|
79
74
|
// Initialize route states with split coins
|
|
80
75
|
const routeStates = routes.map((route, index) => ({
|
|
@@ -186,6 +181,7 @@ const optimize = async (pythMap, config, routes, coinData, tx, accountAddress) =
|
|
|
186
181
|
}
|
|
187
182
|
return finalCoins;
|
|
188
183
|
};
|
|
184
|
+
exports.optimize = optimize;
|
|
189
185
|
/**
|
|
190
186
|
* execute multiple swap in single transaction
|
|
191
187
|
*
|
|
@@ -207,7 +203,7 @@ const multiSwap = async ({ sender, slippageBps, swaps, tx, commission, }) => {
|
|
|
207
203
|
const coinData = splits.length === 1
|
|
208
204
|
? [coinIn]
|
|
209
205
|
: [coinIn, ...tx.splitCoins(coinIn, splits.slice(1))];
|
|
210
|
-
const coinObjects = await optimize(pythMap, config, routes, coinData, tx, sender);
|
|
206
|
+
const coinObjects = await (0, exports.optimize)(pythMap, config, routes, coinData, tx, sender);
|
|
211
207
|
if (coinObjects.length > 0) {
|
|
212
208
|
const mergeCoin = tx.add((0, buildTx_1.settle)(coinObjects, sorResponse, slippageBps, commission));
|
|
213
209
|
if (!map[(0, utils_1.normalizeStructTag)(sorResponse.tokenOut)]) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_CONFIG = void 0;
|
|
4
4
|
exports.getConfig = getConfig;
|
|
5
|
-
const config_1 = require("../../config");
|
|
6
5
|
const fetchClient_1 = require("../../config/fetchClient");
|
|
7
6
|
const apiEndpoints_1 = require("../../constants/apiEndpoints");
|
|
8
7
|
exports.DEFAULT_CONFIG = {
|
|
@@ -142,7 +141,7 @@ async function getConfig() {
|
|
|
142
141
|
return config;
|
|
143
142
|
}
|
|
144
143
|
try {
|
|
145
|
-
const response = await (0, fetchClient_1.fetchClient)(`${
|
|
144
|
+
const response = await (0, fetchClient_1.fetchClient)(`${apiEndpoints_1.API_ENDPOINTS.MAIN}/config`);
|
|
146
145
|
const quoteResponse = (await response.json());
|
|
147
146
|
config = { ...config, ...quoteResponse };
|
|
148
147
|
configTs = Date.now();
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ORACLE_BASED_SOURCES = exports.DEFAULT_SOURCES = void 0;
|
|
4
4
|
exports.getQuote = getQuote;
|
|
5
5
|
const utils_1 = require("@mysten/sui/utils");
|
|
6
|
-
const config_1 = require("../../config");
|
|
7
6
|
const fetchClient_1 = require("../../config/fetchClient");
|
|
8
7
|
const apiEndpoints_1 = require("../../constants/apiEndpoints");
|
|
9
8
|
const aggregator_1 = require("../../types/aggregator");
|
|
@@ -41,7 +40,7 @@ exports.ORACLE_BASED_SOURCES = new Set([
|
|
|
41
40
|
"steamm_oracle_quoter",
|
|
42
41
|
"steamm_oracle_quoter_v2",
|
|
43
42
|
]);
|
|
44
|
-
async function getQuote({ tokenIn, tokenOut, amountIn, sources: _sources = exports.DEFAULT_SOURCES, commissionBps, targetPools, excludedPools, taker, isSponsored, maxPaths, }) {
|
|
43
|
+
async function getQuote({ tokenIn, tokenOut, amountIn, sources: _sources = exports.DEFAULT_SOURCES, commissionBps, targetPools, excludedPools, taker, isSponsored, api, maxPaths, }) {
|
|
45
44
|
let sources = _sources;
|
|
46
45
|
if (isSponsored) {
|
|
47
46
|
sources = _sources.filter((s) => !exports.ORACLE_BASED_SOURCES.has(s));
|
|
@@ -64,7 +63,7 @@ async function getQuote({ tokenIn, tokenOut, amountIn, sources: _sources = expor
|
|
|
64
63
|
if (maxPaths) {
|
|
65
64
|
params.append("max_paths", maxPaths.toString());
|
|
66
65
|
}
|
|
67
|
-
const response = await (0, fetchClient_1.fetchClient)(`${
|
|
66
|
+
const response = await (0, fetchClient_1.fetchClient)(`${api || apiEndpoints_1.API_ENDPOINTS.MAIN}/quote?${params}`);
|
|
68
67
|
if (!response.ok) {
|
|
69
68
|
let responseText;
|
|
70
69
|
try {
|
|
@@ -11,7 +11,7 @@ const request = async (path, body) => {
|
|
|
11
11
|
if (bluefinXApiKey) {
|
|
12
12
|
headers.set("Bluefin-X-API-Key", bluefinXApiKey);
|
|
13
13
|
}
|
|
14
|
-
const res = await fetch(`${
|
|
14
|
+
const res = await fetch(`${apiEndpoints_1.API_ENDPOINTS.MAIN}/${path}`, {
|
|
15
15
|
method: "POST",
|
|
16
16
|
body: JSON.stringify(body),
|
|
17
17
|
headers,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui/client";
|
|
2
2
|
import { SuiPriceServiceConnection, SuiPythClient } from "@pythnetwork/pyth-sui-js";
|
|
3
|
-
declare function setApi(url: string): void;
|
|
4
|
-
declare function getApi(): string;
|
|
5
3
|
declare function setApiKey(key: string): void;
|
|
6
4
|
declare function getApiKey(): string;
|
|
7
5
|
declare function setBluefinXApiKey(key: string): void;
|
|
@@ -13,8 +11,6 @@ declare function getPythClient(): SuiPythClient;
|
|
|
13
11
|
declare function setPythConnection(connection: SuiPriceServiceConnection): void;
|
|
14
12
|
declare function getPythConnection(): SuiPriceServiceConnection;
|
|
15
13
|
declare const Config: {
|
|
16
|
-
setApi: typeof setApi;
|
|
17
|
-
getApi: typeof getApi;
|
|
18
14
|
setApiKey: typeof setApiKey;
|
|
19
15
|
getApiKey: typeof getApiKey;
|
|
20
16
|
setBluefinXApiKey: typeof setBluefinXApiKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EACL,yBAAyB,EACzB,aAAa,EACd,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EACL,yBAAyB,EACzB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAsBlC,iBAAS,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEpC;AAED,iBAAS,SAAS,IAAI,MAAM,CAE3B;AAED,iBAAS,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED,iBAAS,iBAAiB,IAAI,MAAM,CAEnC;AAED,iBAAS,YAAY,IAAI,SAAS,CAEjC;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAE7C;AAED,iBAAS,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAElD;AAED,iBAAS,aAAa,IAAI,aAAa,CAEtC;AAED,iBAAS,iBAAiB,CAAC,UAAU,EAAE,yBAAyB,GAAG,IAAI,CAEtE;AAED,iBAAS,iBAAiB,IAAI,yBAAyB,CAEtD;AAED,QAAA,MAAM,MAAM;;;;;;;;;;;CAWX,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SuiClient } from "@mysten/sui/client";
|
|
2
2
|
import { TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
3
|
-
import { MetaAgOptions,
|
|
3
|
+
import { MetaAgOptions, MetaQuote, MetaQuoteOptions, MetaSimulationOptions, MetaSwapOptions } from "../../types/metaAg";
|
|
4
4
|
export declare class MetaAg {
|
|
5
5
|
client: SuiClient;
|
|
6
6
|
private providers;
|
|
@@ -10,7 +10,6 @@ export declare class MetaAg {
|
|
|
10
10
|
private _getProvider;
|
|
11
11
|
private _simulate;
|
|
12
12
|
private _quote;
|
|
13
|
-
private _fastSwap;
|
|
14
13
|
/**
|
|
15
14
|
* Get quotes from all providers
|
|
16
15
|
* @param options - quote options
|
|
@@ -20,19 +19,11 @@ export declare class MetaAg {
|
|
|
20
19
|
quote(options: MetaQuoteOptions, simulation?: MetaSimulationOptions): Promise<MetaQuote[]>;
|
|
21
20
|
/**
|
|
22
21
|
* Build transaction from quote
|
|
23
|
-
* @info Use this function to build composable transaction (ie: add more commands after the swap, consume the coin out object)
|
|
24
|
-
* @warning Providers that build transaction on the fly (typically RFQ, Swap-API providers ie: BluefinX, Okx, ...) are not supported, please use `fastSwap` instead
|
|
25
22
|
* @param options - build tx options
|
|
26
23
|
* @param slippageBps - slippage bps if not specified, fallback to global slippage bps, if none of them specified, default to 100
|
|
27
24
|
* @returns coin out object, you must consume it by transferObjects, or other sub sequence commands
|
|
28
25
|
*/
|
|
29
26
|
swap(options: MetaSwapOptions, slippageBps?: number): Promise<TransactionObjectArgument>;
|
|
30
|
-
/**
|
|
31
|
-
* Build, Sign, and Execute transaction in one step
|
|
32
|
-
* @param options - fast swap options
|
|
33
|
-
* @returns - txDigest of the transaction
|
|
34
|
-
*/
|
|
35
|
-
fastSwap(options: MetaFastSwapOptions, getTransactionBlockParams?: Omit<GetTransactionBlockParams, "digest">): Promise<SuiTransactionBlockResponse>;
|
|
36
27
|
/**
|
|
37
28
|
* Update meta aggregator options
|
|
38
29
|
* @param options - update options payload
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,9 +1,9 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui/client";
|
|
2
|
-
import {
|
|
3
|
-
export declare class BluefinProvider implements
|
|
2
|
+
import { AgProvider, BluefinProviderOptions, EProvider, MetaAgOptions, MetaQuote, MetaQuoteOptions, MetaSwapOptions } from "../../../types/metaAg";
|
|
3
|
+
export declare class BluefinProvider implements AgProvider {
|
|
4
4
|
private readonly options;
|
|
5
5
|
private readonly metaOptions;
|
|
6
|
-
|
|
6
|
+
kind: EProvider;
|
|
7
7
|
constructor(options: BluefinProviderOptions, metaOptions: Required<MetaAgOptions>, client: SuiClient);
|
|
8
8
|
quote(options: MetaQuoteOptions): Promise<MetaQuote>;
|
|
9
9
|
swap({ quote, signer, tx, coinIn }: MetaSwapOptions): Promise<import("@mysten/sui/dist/cjs/transactions").TransactionObjectArgument>;
|
|
@@ -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;
|
|
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"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui/client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
3
|
+
import { AgProvider, CetusProviderOptions, EProvider, MetaAgOptions, MetaQuote, MetaQuoteOptions, MetaSwapOptions } from "../../../types/metaAg";
|
|
4
|
+
export declare class CetusProvider implements AgProvider {
|
|
4
5
|
private readonly options;
|
|
5
|
-
|
|
6
|
+
kind: EProvider;
|
|
6
7
|
private readonly cetusClient;
|
|
7
8
|
constructor(options: CetusProviderOptions, metaOptions: MetaAgOptions, client: SuiClient);
|
|
8
9
|
quote(quoteOptions: MetaQuoteOptions): Promise<MetaQuote>;
|
|
9
|
-
swap(options: MetaSwapOptions): Promise<
|
|
10
|
+
swap(options: MetaSwapOptions): Promise<TransactionObjectArgument>;
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=cetus.d.ts.map
|