@shogun-sdk/swap 0.0.2-test.24 → 0.0.2-test.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +379 -112
- package/dist/core.d.cts +4 -136
- package/dist/core.d.ts +4 -136
- package/dist/core.js +353 -84
- package/dist/index-Czt8I0Vg.d.ts +351 -0
- package/dist/index-D62OxLwp.d.cts +351 -0
- package/dist/index.cjs +373 -500
- package/dist/index.d.cts +4 -9
- package/dist/index.d.ts +4 -9
- package/dist/index.js +347 -474
- package/dist/react.cjs +829 -476
- package/dist/react.d.cts +192 -82
- package/dist/react.d.ts +192 -82
- package/dist/react.js +799 -454
- package/dist/{wallet-BhuMJ3K_.d.cts → wallet-B9bKceyN.d.cts} +1 -2
- package/dist/{wallet-BhuMJ3K_.d.ts → wallet-B9bKceyN.d.ts} +1 -2
- package/dist/wallet-adapter.cjs +25607 -11
- package/dist/wallet-adapter.d.cts +1 -2
- package/dist/wallet-adapter.d.ts +1 -2
- package/dist/wallet-adapter.js +25626 -6
- package/package.json +44 -14
- package/dist/execute-D2qcOzkI.d.ts +0 -145
- package/dist/execute-Xvw4wXBo.d.cts +0 -145
package/dist/core.cjs
CHANGED
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,40 +17,29 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
17
|
return to;
|
|
17
18
|
};
|
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19
21
|
|
|
20
22
|
// src/core/index.ts
|
|
21
23
|
var core_exports = {};
|
|
22
24
|
__export(core_exports, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
SOLANA_CHAIN_ID: () => SOLANA_CHAIN_ID,
|
|
25
|
+
ChainId: () => ChainId,
|
|
26
|
+
OrderExecutionType: () => OrderExecutionType,
|
|
26
27
|
SupportedChains: () => SupportedChains,
|
|
28
|
+
SwapSDK: () => SwapSDK,
|
|
27
29
|
buildQuoteParams: () => buildQuoteParams,
|
|
28
|
-
|
|
29
|
-
getBalances: () => getBalances,
|
|
30
|
-
getQuote: () => getQuote,
|
|
31
|
-
getTokenList: () => getTokenList,
|
|
32
|
-
isEvmChain: () => import_intents_sdk12.isEvmChain,
|
|
33
|
-
isNativeAddress: () => isNativeAddress,
|
|
34
|
-
isViemWalletClient: () => isViemWalletClient,
|
|
35
|
-
serializeBigIntsToStrings: () => serializeBigIntsToStrings
|
|
30
|
+
isEvmChain: () => isEvmChain
|
|
36
31
|
});
|
|
37
32
|
module.exports = __toCommonJS(core_exports);
|
|
38
33
|
|
|
39
|
-
// src/core/token-list.ts
|
|
40
|
-
var import_intents_sdk = require("@shogun-sdk/intents-sdk");
|
|
41
|
-
async function getTokenList(params) {
|
|
42
|
-
return (0, import_intents_sdk.getTokenList)(params);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
34
|
// src/core/getQuote.ts
|
|
46
|
-
var import_intents_sdk4 = require("@shogun-sdk/intents-sdk");
|
|
47
|
-
var import_viem = require("viem");
|
|
48
|
-
|
|
49
|
-
// src/core/executeOrder/normalizeNative.ts
|
|
50
35
|
var import_intents_sdk3 = require("@shogun-sdk/intents-sdk");
|
|
36
|
+
var import_viem2 = require("viem");
|
|
37
|
+
|
|
38
|
+
// src/core/execute/normalizeNative.ts
|
|
39
|
+
var import_intents_sdk2 = require("@shogun-sdk/intents-sdk");
|
|
51
40
|
|
|
52
41
|
// src/utils/address.ts
|
|
42
|
+
var import_viem = require("viem");
|
|
53
43
|
var NATIVE_TOKEN = {
|
|
54
44
|
ETH: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
55
45
|
SOL: "So11111111111111111111111111111111111111111",
|
|
@@ -60,13 +50,31 @@ var isNativeAddress = (tokenAddress) => {
|
|
|
60
50
|
const normalizedTokenAddress = tokenAddress.toLowerCase();
|
|
61
51
|
return !!tokenAddress && NATIVE_ADDRESSES.includes(normalizedTokenAddress);
|
|
62
52
|
};
|
|
53
|
+
function normalizeEvmTokenAddress(address) {
|
|
54
|
+
const lower = address.toLowerCase();
|
|
55
|
+
return lower === NATIVE_TOKEN.ETH.toLowerCase() ? import_viem.zeroAddress : address;
|
|
56
|
+
}
|
|
63
57
|
|
|
64
58
|
// src/utils/chain.ts
|
|
65
|
-
var
|
|
66
|
-
var SOLANA_CHAIN_ID =
|
|
67
|
-
var
|
|
59
|
+
var import_intents_sdk = require("@shogun-sdk/intents-sdk");
|
|
60
|
+
var SOLANA_CHAIN_ID = import_intents_sdk.ChainID.Solana;
|
|
61
|
+
var CURRENT_SUPPORTED = [
|
|
62
|
+
import_intents_sdk.ChainID.Solana,
|
|
63
|
+
import_intents_sdk.ChainID.BSC,
|
|
64
|
+
import_intents_sdk.ChainID.Base
|
|
65
|
+
];
|
|
66
|
+
var ChainId = Object.entries(import_intents_sdk.ChainID).reduce(
|
|
67
|
+
(acc, [key, value]) => {
|
|
68
|
+
if (typeof value === "number" && CURRENT_SUPPORTED.includes(value)) {
|
|
69
|
+
acc[key] = value;
|
|
70
|
+
}
|
|
71
|
+
return acc;
|
|
72
|
+
},
|
|
73
|
+
{}
|
|
74
|
+
);
|
|
75
|
+
var SupportedChainsInternal = [
|
|
68
76
|
{
|
|
69
|
-
id:
|
|
77
|
+
id: import_intents_sdk.ChainID.Arbitrum,
|
|
70
78
|
name: "Arbitrum",
|
|
71
79
|
isEVM: true,
|
|
72
80
|
wrapped: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
@@ -75,7 +83,7 @@ var SupportedChains = [
|
|
|
75
83
|
tokenAddress: NATIVE_TOKEN.ETH
|
|
76
84
|
},
|
|
77
85
|
{
|
|
78
|
-
id:
|
|
86
|
+
id: import_intents_sdk.ChainID.Optimism,
|
|
79
87
|
name: "Optimism",
|
|
80
88
|
isEVM: true,
|
|
81
89
|
wrapped: "0x4200000000000000000000000000000000000006",
|
|
@@ -84,7 +92,7 @@ var SupportedChains = [
|
|
|
84
92
|
tokenAddress: NATIVE_TOKEN.ETH
|
|
85
93
|
},
|
|
86
94
|
{
|
|
87
|
-
id:
|
|
95
|
+
id: import_intents_sdk.ChainID.Base,
|
|
88
96
|
name: "Base",
|
|
89
97
|
isEVM: true,
|
|
90
98
|
wrapped: "0x4200000000000000000000000000000000000006",
|
|
@@ -93,7 +101,7 @@ var SupportedChains = [
|
|
|
93
101
|
tokenAddress: NATIVE_TOKEN.ETH
|
|
94
102
|
},
|
|
95
103
|
{
|
|
96
|
-
id:
|
|
104
|
+
id: import_intents_sdk.ChainID.Hyperliquid,
|
|
97
105
|
name: "Hyperliquid",
|
|
98
106
|
isEVM: true,
|
|
99
107
|
wrapped: "0x5555555555555555555555555555555555555555",
|
|
@@ -102,7 +110,7 @@ var SupportedChains = [
|
|
|
102
110
|
tokenAddress: NATIVE_TOKEN.ETH
|
|
103
111
|
},
|
|
104
112
|
{
|
|
105
|
-
id:
|
|
113
|
+
id: import_intents_sdk.ChainID.BSC,
|
|
106
114
|
name: "BSC",
|
|
107
115
|
isEVM: true,
|
|
108
116
|
wrapped: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
|
|
@@ -120,6 +128,10 @@ var SupportedChains = [
|
|
|
120
128
|
tokenAddress: NATIVE_TOKEN.SOL
|
|
121
129
|
}
|
|
122
130
|
];
|
|
131
|
+
var SupportedChains = SupportedChainsInternal.filter(
|
|
132
|
+
(c) => CURRENT_SUPPORTED.includes(c.id)
|
|
133
|
+
);
|
|
134
|
+
var isEvmChain = import_intents_sdk.isEvmChain;
|
|
123
135
|
|
|
124
136
|
// src/utils/viem.ts
|
|
125
137
|
function isViemWalletClient(wallet) {
|
|
@@ -147,9 +159,9 @@ function serializeBigIntsToStrings(obj) {
|
|
|
147
159
|
return obj;
|
|
148
160
|
}
|
|
149
161
|
|
|
150
|
-
// src/core/
|
|
162
|
+
// src/core/execute/normalizeNative.ts
|
|
151
163
|
function normalizeNative(chainId, address) {
|
|
152
|
-
if ((0,
|
|
164
|
+
if ((0, import_intents_sdk2.isEvmChain)(chainId) && isNativeAddress(address)) {
|
|
153
165
|
const chain = SupportedChains.find((c) => c.id === chainId);
|
|
154
166
|
if (!chain?.wrapped)
|
|
155
167
|
throw new Error(`Wrapped token not found for chainId ${chainId}`);
|
|
@@ -160,22 +172,23 @@ function normalizeNative(chainId, address) {
|
|
|
160
172
|
|
|
161
173
|
// src/core/getQuote.ts
|
|
162
174
|
async function getQuote(params) {
|
|
175
|
+
const amount = BigInt(params.amount);
|
|
163
176
|
if (!params.tokenIn?.address || !params.tokenOut?.address) {
|
|
164
177
|
throw new Error("Both tokenIn and tokenOut must include an address.");
|
|
165
178
|
}
|
|
166
179
|
if (!params.sourceChainId || !params.destChainId) {
|
|
167
180
|
throw new Error("Both sourceChainId and destChainId are required.");
|
|
168
181
|
}
|
|
169
|
-
if (
|
|
182
|
+
if (amount <= 0n) {
|
|
170
183
|
throw new Error("Amount must be greater than 0.");
|
|
171
184
|
}
|
|
172
185
|
const normalizedTokenIn = normalizeNative(params.sourceChainId, params.tokenIn.address);
|
|
173
|
-
const data = await
|
|
186
|
+
const data = await import_intents_sdk3.QuoteProvider.getQuote({
|
|
174
187
|
sourceChainId: params.sourceChainId,
|
|
175
188
|
destChainId: params.destChainId,
|
|
176
189
|
tokenIn: normalizedTokenIn,
|
|
177
190
|
tokenOut: params.tokenOut.address,
|
|
178
|
-
amount
|
|
191
|
+
amount
|
|
179
192
|
});
|
|
180
193
|
const slippagePercent = Math.min(Math.max(params.slippage ?? 0.5, 0), 50);
|
|
181
194
|
let warning;
|
|
@@ -206,7 +219,7 @@ async function getQuote(params) {
|
|
|
206
219
|
decimals: params.tokenOut.decimals ?? 18,
|
|
207
220
|
chainId: params.destChainId
|
|
208
221
|
},
|
|
209
|
-
amountIn: params.amount,
|
|
222
|
+
amountIn: BigInt(params.amount),
|
|
210
223
|
pricePerInputToken,
|
|
211
224
|
slippage: slippagePercent,
|
|
212
225
|
internal: {
|
|
@@ -230,13 +243,13 @@ function buildQuoteParams({
|
|
|
230
243
|
tokenOut,
|
|
231
244
|
sourceChainId,
|
|
232
245
|
destChainId,
|
|
233
|
-
amount: (0,
|
|
246
|
+
amount: (0, import_viem2.parseUnits)(amount.toString(), tokenIn.decimals ?? 18).toString(),
|
|
234
247
|
slippage
|
|
235
248
|
};
|
|
236
249
|
}
|
|
237
250
|
|
|
238
251
|
// src/core/getBalances.ts
|
|
239
|
-
var
|
|
252
|
+
var import_intents_sdk4 = require("@shogun-sdk/intents-sdk");
|
|
240
253
|
async function getBalances(params, options) {
|
|
241
254
|
const { addresses, cursorEvm, cursorSvm } = params;
|
|
242
255
|
const { signal } = options ?? {};
|
|
@@ -249,7 +262,7 @@ async function getBalances(params, options) {
|
|
|
249
262
|
cursorSvm
|
|
250
263
|
});
|
|
251
264
|
const start = performance.now();
|
|
252
|
-
const response = await fetch(`${
|
|
265
|
+
const response = await fetch(`${import_intents_sdk4.TOKEN_SEARCH_API_BASE_URL}/tokens/balances`, {
|
|
253
266
|
method: "POST",
|
|
254
267
|
headers: {
|
|
255
268
|
accept: "application/json",
|
|
@@ -277,21 +290,67 @@ async function getBalances(params, options) {
|
|
|
277
290
|
const evmItems = data.evm?.items ?? [];
|
|
278
291
|
const svmItems = data.svm?.items ?? [];
|
|
279
292
|
const combined = [...evmItems, ...svmItems];
|
|
293
|
+
const filtered = combined.filter(
|
|
294
|
+
(b) => CURRENT_SUPPORTED.includes(b.chainId)
|
|
295
|
+
);
|
|
280
296
|
return {
|
|
281
|
-
results:
|
|
297
|
+
results: filtered,
|
|
282
298
|
nextCursorEvm: data.evm?.cursor ?? null,
|
|
283
299
|
nextCursorSvm: data.svm?.cursor ?? null
|
|
284
300
|
};
|
|
285
301
|
}
|
|
286
302
|
|
|
287
|
-
// src/core/
|
|
288
|
-
var
|
|
289
|
-
|
|
303
|
+
// src/core/token-list.ts
|
|
304
|
+
var import_intents_sdk5 = require("@shogun-sdk/intents-sdk");
|
|
305
|
+
async function getTokenList(params) {
|
|
306
|
+
const url = new URL(`${import_intents_sdk5.TOKEN_SEARCH_API_BASE_URL}/tokens/search`);
|
|
307
|
+
if (params.q) url.searchParams.append("q", params.q);
|
|
308
|
+
if (params.networkId) url.searchParams.append("networkId", String(params.networkId));
|
|
309
|
+
if (params.page) url.searchParams.append("page", String(params.page));
|
|
310
|
+
if (params.limit) url.searchParams.append("limit", String(params.limit));
|
|
311
|
+
const res = await fetch(url.toString(), {
|
|
312
|
+
signal: params.signal
|
|
313
|
+
});
|
|
314
|
+
if (!res.ok) {
|
|
315
|
+
throw new Error(`Failed to fetch tokens: ${res.status} ${res.statusText}`);
|
|
316
|
+
}
|
|
317
|
+
const data = await res.json();
|
|
318
|
+
const filteredResults = data.results.filter(
|
|
319
|
+
(token) => CURRENT_SUPPORTED.includes(token.chainId)
|
|
320
|
+
);
|
|
321
|
+
return {
|
|
322
|
+
...data,
|
|
323
|
+
results: filteredResults,
|
|
324
|
+
count: filteredResults.length
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// src/core/token.ts
|
|
329
|
+
var import_intents_sdk6 = require("@shogun-sdk/intents-sdk");
|
|
330
|
+
async function getTokensData(addresses) {
|
|
331
|
+
if (!addresses?.length) return [];
|
|
332
|
+
const response = await fetch(`${import_intents_sdk6.TOKEN_SEARCH_API_BASE_URL}/tokens/tokens`, {
|
|
333
|
+
method: "POST",
|
|
334
|
+
headers: {
|
|
335
|
+
"Content-Type": "application/json",
|
|
336
|
+
accept: "*/*"
|
|
337
|
+
},
|
|
338
|
+
body: JSON.stringify({ addresses })
|
|
339
|
+
});
|
|
340
|
+
if (!response.ok) {
|
|
341
|
+
throw new Error(`Failed to fetch token data: ${response.statusText}`);
|
|
342
|
+
}
|
|
343
|
+
const data = await response.json();
|
|
344
|
+
const filtered = data.filter((t) => CURRENT_SUPPORTED.includes(Number(t.chainId)));
|
|
345
|
+
return filtered;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// src/core/execute/execute.ts
|
|
349
|
+
var import_intents_sdk12 = require("@shogun-sdk/intents-sdk");
|
|
350
|
+
var import_viem7 = require("viem");
|
|
290
351
|
|
|
291
352
|
// src/wallet-adapter/evm-wallet-adapter/adapter.ts
|
|
292
|
-
var
|
|
293
|
-
var import_utils2 = require("ethers/lib/utils.js");
|
|
294
|
-
var import_viem2 = require("viem");
|
|
353
|
+
var import_viem3 = require("viem");
|
|
295
354
|
function isEVMTransaction(tx) {
|
|
296
355
|
return typeof tx.from === "string";
|
|
297
356
|
}
|
|
@@ -357,7 +416,7 @@ var adaptViemWallet = (wallet) => {
|
|
|
357
416
|
functionName,
|
|
358
417
|
args = []
|
|
359
418
|
}) => {
|
|
360
|
-
const publicClient = wallet.extend(
|
|
419
|
+
const publicClient = wallet.extend(import_viem3.publicActions);
|
|
361
420
|
return await publicClient.readContract({
|
|
362
421
|
address: address2,
|
|
363
422
|
abi,
|
|
@@ -367,7 +426,7 @@ var adaptViemWallet = (wallet) => {
|
|
|
367
426
|
};
|
|
368
427
|
return {
|
|
369
428
|
vmType: "EVM" /* EVM */,
|
|
370
|
-
transport: (0,
|
|
429
|
+
transport: (0, import_viem3.custom)(wallet.transport),
|
|
371
430
|
getChainId: async () => wallet.getChainId(),
|
|
372
431
|
address,
|
|
373
432
|
sendTransaction,
|
|
@@ -377,11 +436,11 @@ var adaptViemWallet = (wallet) => {
|
|
|
377
436
|
};
|
|
378
437
|
};
|
|
379
438
|
|
|
380
|
-
// src/core/
|
|
381
|
-
var
|
|
382
|
-
var
|
|
439
|
+
// src/core/execute/handleEvmExecution.ts
|
|
440
|
+
var import_intents_sdk10 = require("@shogun-sdk/intents-sdk");
|
|
441
|
+
var import_viem6 = require("viem");
|
|
383
442
|
|
|
384
|
-
// src/core/
|
|
443
|
+
// src/core/execute/stageMessages.ts
|
|
385
444
|
var DEFAULT_STAGE_MESSAGES = {
|
|
386
445
|
processing: "Preparing transaction for execution",
|
|
387
446
|
approving: "Approving token allowance",
|
|
@@ -390,33 +449,57 @@ var DEFAULT_STAGE_MESSAGES = {
|
|
|
390
449
|
submitting: "Submitting transaction",
|
|
391
450
|
initiated: "Transaction initiated.",
|
|
392
451
|
success: "Transaction Executed successfully",
|
|
452
|
+
success_limit: "Limit order has been submitted successfully.",
|
|
393
453
|
shogun_processing: "Shogun is processing your transaction",
|
|
394
454
|
error: "Transaction failed during submission"
|
|
395
455
|
};
|
|
396
456
|
|
|
397
|
-
// src/core/
|
|
398
|
-
var
|
|
457
|
+
// src/core/execute/buildOrder.ts
|
|
458
|
+
var import_intents_sdk7 = require("@shogun-sdk/intents-sdk");
|
|
459
|
+
var import_viem4 = require("viem");
|
|
460
|
+
|
|
461
|
+
// src/utils/order.ts
|
|
462
|
+
var OrderExecutionType = /* @__PURE__ */ ((OrderExecutionType2) => {
|
|
463
|
+
OrderExecutionType2["LIMIT"] = "limit";
|
|
464
|
+
OrderExecutionType2["MARKET"] = "market";
|
|
465
|
+
return OrderExecutionType2;
|
|
466
|
+
})(OrderExecutionType || {});
|
|
467
|
+
|
|
468
|
+
// src/core/execute/buildOrder.ts
|
|
399
469
|
async function buildOrder({
|
|
400
470
|
quote,
|
|
401
471
|
accountAddress,
|
|
402
472
|
destination,
|
|
403
473
|
deadline,
|
|
404
|
-
isSingleChain
|
|
474
|
+
isSingleChain,
|
|
475
|
+
orderType,
|
|
476
|
+
options
|
|
405
477
|
}) {
|
|
406
478
|
const { tokenIn, tokenOut } = quote;
|
|
479
|
+
let amountOutMin = BigInt(quote.internal.estimatedAmountOutReduced);
|
|
480
|
+
if (orderType === "limit" /* LIMIT */ && options && "executionPrice" in options) {
|
|
481
|
+
const executionPrice = Number(options.executionPrice);
|
|
482
|
+
if (Number.isFinite(executionPrice) && executionPrice > 0) {
|
|
483
|
+
const decimalsIn = tokenIn.decimals ?? 18;
|
|
484
|
+
const decimalsOut = tokenOut.decimals ?? 18;
|
|
485
|
+
const formattedAmountIn = Number((0, import_viem4.formatUnits)(BigInt(quote.amountIn.toString()), decimalsIn));
|
|
486
|
+
const rawAmountOut = formattedAmountIn * executionPrice;
|
|
487
|
+
amountOutMin = (0, import_viem4.parseUnits)(rawAmountOut.toString(), decimalsOut);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
407
490
|
if (isSingleChain) {
|
|
408
|
-
return await
|
|
491
|
+
return await import_intents_sdk7.SingleChainOrder.create({
|
|
409
492
|
user: accountAddress,
|
|
410
493
|
chainId: tokenIn.chainId,
|
|
411
494
|
tokenIn: tokenIn.address,
|
|
412
495
|
tokenOut: tokenOut.address,
|
|
413
496
|
amountIn: quote.amountIn,
|
|
414
|
-
amountOutMin
|
|
497
|
+
amountOutMin,
|
|
415
498
|
deadline,
|
|
416
499
|
destinationAddress: destination
|
|
417
500
|
});
|
|
418
501
|
}
|
|
419
|
-
return await
|
|
502
|
+
return await import_intents_sdk7.CrossChainOrder.create({
|
|
420
503
|
user: accountAddress,
|
|
421
504
|
sourceChainId: tokenIn.chainId,
|
|
422
505
|
sourceTokenAddress: tokenIn.address,
|
|
@@ -425,13 +508,13 @@ async function buildOrder({
|
|
|
425
508
|
destinationTokenAddress: tokenOut.address,
|
|
426
509
|
destinationAddress: destination,
|
|
427
510
|
deadline,
|
|
428
|
-
destinationTokenMinAmount:
|
|
511
|
+
destinationTokenMinAmount: amountOutMin,
|
|
429
512
|
minStablecoinAmount: quote.minStablecoinsAmount
|
|
430
513
|
});
|
|
431
514
|
}
|
|
432
515
|
|
|
433
516
|
// src/utils/pollOrderStatus.ts
|
|
434
|
-
var
|
|
517
|
+
var import_intents_sdk8 = require("@shogun-sdk/intents-sdk");
|
|
435
518
|
async function pollOrderStatus(address, orderId, options = {}) {
|
|
436
519
|
const { intervalMs = 2e3, timeoutMs = 3e5 } = options;
|
|
437
520
|
const startTime = Date.now();
|
|
@@ -444,7 +527,7 @@ async function pollOrderStatus(address, orderId, options = {}) {
|
|
|
444
527
|
else if (isSuiAddress) queryParam = `suiWallets=${address}`;
|
|
445
528
|
else if (isSolanaAddress) queryParam = `solanaWallets=${address}`;
|
|
446
529
|
else throw new Error(`Unrecognized wallet address format: ${address}`);
|
|
447
|
-
const queryUrl = `${
|
|
530
|
+
const queryUrl = `${import_intents_sdk8.AUCTIONEER_URL}/user_intent?${queryParam}`;
|
|
448
531
|
return new Promise((resolve, reject) => {
|
|
449
532
|
const pollInterval = setInterval(async () => {
|
|
450
533
|
try {
|
|
@@ -496,7 +579,7 @@ async function pollOrderStatus(address, orderId, options = {}) {
|
|
|
496
579
|
});
|
|
497
580
|
}
|
|
498
581
|
|
|
499
|
-
// src/core/
|
|
582
|
+
// src/core/execute/handleOrderPollingResult.ts
|
|
500
583
|
async function handleOrderPollingResult({
|
|
501
584
|
status,
|
|
502
585
|
orderId,
|
|
@@ -534,9 +617,9 @@ async function handleOrderPollingResult({
|
|
|
534
617
|
};
|
|
535
618
|
}
|
|
536
619
|
|
|
537
|
-
// src/core/
|
|
538
|
-
var
|
|
539
|
-
var
|
|
620
|
+
// src/core/execute/ensurePermit2Allowance.ts
|
|
621
|
+
var import_viem5 = require("viem");
|
|
622
|
+
var import_intents_sdk9 = require("@shogun-sdk/intents-sdk");
|
|
540
623
|
async function ensurePermit2Allowance({
|
|
541
624
|
chainId,
|
|
542
625
|
tokenIn,
|
|
@@ -545,7 +628,7 @@ async function ensurePermit2Allowance({
|
|
|
545
628
|
requiredAmount,
|
|
546
629
|
increaseByDelta = false
|
|
547
630
|
}) {
|
|
548
|
-
const spender =
|
|
631
|
+
const spender = import_intents_sdk9.PERMIT2_ADDRESS[chainId];
|
|
549
632
|
let currentAllowance = 0n;
|
|
550
633
|
try {
|
|
551
634
|
if (!wallet.readContract) {
|
|
@@ -553,22 +636,22 @@ async function ensurePermit2Allowance({
|
|
|
553
636
|
}
|
|
554
637
|
currentAllowance = await wallet.readContract({
|
|
555
638
|
address: tokenIn,
|
|
556
|
-
abi:
|
|
639
|
+
abi: import_viem5.erc20Abi,
|
|
557
640
|
functionName: "allowance",
|
|
558
641
|
args: [accountAddress, spender]
|
|
559
642
|
});
|
|
560
643
|
} catch (error) {
|
|
561
644
|
console.warn(`[Permit2] Failed to read allowance for ${tokenIn}`, error);
|
|
562
645
|
}
|
|
563
|
-
const approvalAmount = increaseByDelta ? currentAllowance + requiredAmount :
|
|
646
|
+
const approvalAmount = increaseByDelta ? currentAllowance + requiredAmount : import_viem5.maxUint256;
|
|
564
647
|
console.debug(
|
|
565
648
|
`[Permit2] Approving ${approvalAmount} for ${tokenIn} (current: ${currentAllowance}, required: ${requiredAmount})`
|
|
566
649
|
);
|
|
567
650
|
await wallet.sendTransaction({
|
|
568
651
|
to: tokenIn,
|
|
569
652
|
from: accountAddress,
|
|
570
|
-
data: (0,
|
|
571
|
-
abi:
|
|
653
|
+
data: (0, import_viem5.encodeFunctionData)({
|
|
654
|
+
abi: import_viem5.erc20Abi,
|
|
572
655
|
functionName: "approve",
|
|
573
656
|
args: [spender, approvalAmount]
|
|
574
657
|
}),
|
|
@@ -579,7 +662,7 @@ async function ensurePermit2Allowance({
|
|
|
579
662
|
);
|
|
580
663
|
}
|
|
581
664
|
|
|
582
|
-
// src/core/
|
|
665
|
+
// src/core/execute/handleEvmExecution.ts
|
|
583
666
|
async function handleEvmExecution({
|
|
584
667
|
recipientAddress,
|
|
585
668
|
quote,
|
|
@@ -587,18 +670,22 @@ async function handleEvmExecution({
|
|
|
587
670
|
accountAddress,
|
|
588
671
|
wallet,
|
|
589
672
|
isSingleChain,
|
|
590
|
-
|
|
591
|
-
|
|
673
|
+
update,
|
|
674
|
+
orderType,
|
|
675
|
+
options
|
|
592
676
|
}) {
|
|
593
|
-
const messageFor = (stage) => DEFAULT_STAGE_MESSAGES[stage];
|
|
677
|
+
const messageFor = (stage) => DEFAULT_STAGE_MESSAGES[stage] ?? "";
|
|
678
|
+
const deadline = options?.deadline ?? Math.floor(Date.now() / 1e3) + 20 * 60;
|
|
594
679
|
await wallet.switchChain(chainId);
|
|
595
680
|
const tokenIn = normalizeNative(chainId, quote.tokenIn.address);
|
|
681
|
+
quote.tokenOut.address = normalizeEvmTokenAddress(quote.tokenOut.address);
|
|
596
682
|
const shouldWrapNative = isNativeAddress(quote.tokenIn.address);
|
|
597
683
|
update("processing", shouldWrapNative ? `${messageFor("processing")} (wrapping native token)` : messageFor("processing"));
|
|
598
684
|
if (shouldWrapNative) {
|
|
685
|
+
quote.tokenIn.address === tokenIn;
|
|
599
686
|
await wallet.sendTransaction({
|
|
600
687
|
to: tokenIn,
|
|
601
|
-
data: (0,
|
|
688
|
+
data: (0, import_viem6.encodeFunctionData)({
|
|
602
689
|
abi: [{ type: "function", name: "deposit", stateMutability: "payable", inputs: [], outputs: [] }],
|
|
603
690
|
functionName: "deposit",
|
|
604
691
|
args: []
|
|
@@ -622,11 +709,13 @@ async function handleEvmExecution({
|
|
|
622
709
|
accountAddress,
|
|
623
710
|
destination,
|
|
624
711
|
deadline,
|
|
625
|
-
isSingleChain
|
|
712
|
+
isSingleChain,
|
|
713
|
+
orderType,
|
|
714
|
+
options
|
|
626
715
|
});
|
|
627
716
|
console.debug(`order`, order);
|
|
628
717
|
update("processing", messageFor("signing"));
|
|
629
|
-
const { orderTypedData, nonce } = isSingleChain ? await (0,
|
|
718
|
+
const { orderTypedData, nonce } = isSingleChain ? await (0, import_intents_sdk10.getEVMSingleChainOrderTypedData)(order) : await (0, import_intents_sdk10.getEVMCrossChainOrderTypedData)(order);
|
|
630
719
|
const typedData = serializeBigIntsToStrings(orderTypedData);
|
|
631
720
|
if (!wallet.signTypedData) {
|
|
632
721
|
throw new Error("Wallet does not support EIP-712 signing");
|
|
@@ -646,18 +735,29 @@ async function handleEvmExecution({
|
|
|
646
735
|
update("initiated", messageFor("initiated"));
|
|
647
736
|
const { intentId: orderId } = res.data;
|
|
648
737
|
update("initiated", messageFor("shogun_processing"));
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
738
|
+
if (orderType === "limit" /* LIMIT */) {
|
|
739
|
+
update("success", messageFor("success_limit"));
|
|
740
|
+
return {
|
|
741
|
+
status: true,
|
|
742
|
+
orderId,
|
|
743
|
+
chainId,
|
|
744
|
+
finalStatus: "OrderPlaced",
|
|
745
|
+
stage: "success"
|
|
746
|
+
};
|
|
747
|
+
} else {
|
|
748
|
+
const status = await pollOrderStatus(accountAddress, orderId);
|
|
749
|
+
return await handleOrderPollingResult({
|
|
750
|
+
status,
|
|
751
|
+
orderId,
|
|
752
|
+
chainId,
|
|
753
|
+
update,
|
|
754
|
+
messageFor
|
|
755
|
+
});
|
|
756
|
+
}
|
|
657
757
|
}
|
|
658
758
|
|
|
659
|
-
// src/core/
|
|
660
|
-
var
|
|
759
|
+
// src/core/execute/handleSolanaExecution.ts
|
|
760
|
+
var import_intents_sdk11 = require("@shogun-sdk/intents-sdk");
|
|
661
761
|
var import_web3 = require("@solana/web3.js");
|
|
662
762
|
async function handleSolanaExecution({
|
|
663
763
|
recipientAddress,
|
|
@@ -666,12 +766,14 @@ async function handleSolanaExecution({
|
|
|
666
766
|
isSingleChain,
|
|
667
767
|
update,
|
|
668
768
|
accountAddress,
|
|
669
|
-
|
|
769
|
+
orderType,
|
|
770
|
+
options
|
|
670
771
|
}) {
|
|
671
772
|
if (!wallet.rpcUrl) {
|
|
672
773
|
throw new Error("Solana wallet is missing rpcUrl");
|
|
673
774
|
}
|
|
674
|
-
const
|
|
775
|
+
const deadline = options?.deadline ?? Math.floor(Date.now() / 1e3) + 20 * 60;
|
|
776
|
+
const messageFor = (stage) => DEFAULT_STAGE_MESSAGES[stage] ?? "";
|
|
675
777
|
update("processing", messageFor("processing"));
|
|
676
778
|
const destination = recipientAddress ?? accountAddress;
|
|
677
779
|
const order = await buildOrder({
|
|
@@ -679,7 +781,9 @@ async function handleSolanaExecution({
|
|
|
679
781
|
accountAddress,
|
|
680
782
|
destination,
|
|
681
783
|
deadline,
|
|
682
|
-
isSingleChain
|
|
784
|
+
isSingleChain,
|
|
785
|
+
orderType,
|
|
786
|
+
options
|
|
683
787
|
});
|
|
684
788
|
const txData = await getSolanaOrderInstructions({
|
|
685
789
|
order,
|
|
@@ -701,14 +805,25 @@ async function handleSolanaExecution({
|
|
|
701
805
|
update("initiated", messageFor("initiated"));
|
|
702
806
|
const { jwt, intentId: orderId } = response.data;
|
|
703
807
|
update("initiated", messageFor("shogun_processing"));
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
808
|
+
if (orderType === "limit" /* LIMIT */) {
|
|
809
|
+
update("success", messageFor("success_limit"));
|
|
810
|
+
return {
|
|
811
|
+
status: true,
|
|
812
|
+
orderId,
|
|
813
|
+
chainId: SOLANA_CHAIN_ID,
|
|
814
|
+
finalStatus: "OrderPlaced",
|
|
815
|
+
stage: "success"
|
|
816
|
+
};
|
|
817
|
+
} else {
|
|
818
|
+
const status = await pollOrderStatus(jwt, orderId);
|
|
819
|
+
return await handleOrderPollingResult({
|
|
820
|
+
status,
|
|
821
|
+
orderId,
|
|
822
|
+
chainId: SOLANA_CHAIN_ID,
|
|
823
|
+
update,
|
|
824
|
+
messageFor
|
|
825
|
+
});
|
|
826
|
+
}
|
|
712
827
|
}
|
|
713
828
|
async function getSolanaOrderInstructions({
|
|
714
829
|
order,
|
|
@@ -716,11 +831,11 @@ async function getSolanaOrderInstructions({
|
|
|
716
831
|
rpcUrl
|
|
717
832
|
}) {
|
|
718
833
|
if (isSingleChain) {
|
|
719
|
-
return await (0,
|
|
834
|
+
return await (0, import_intents_sdk11.getSolanaSingleChainOrderInstructions)(order, {
|
|
720
835
|
rpcUrl
|
|
721
836
|
});
|
|
722
837
|
}
|
|
723
|
-
return await (0,
|
|
838
|
+
return await (0, import_intents_sdk11.getSolanaCrossChainOrderInstructions)(order, {
|
|
724
839
|
rpcUrl
|
|
725
840
|
});
|
|
726
841
|
}
|
|
@@ -741,13 +856,14 @@ async function submitToAuctioneer({
|
|
|
741
856
|
});
|
|
742
857
|
}
|
|
743
858
|
|
|
744
|
-
// src/core/
|
|
859
|
+
// src/core/execute/execute.ts
|
|
745
860
|
async function executeOrder({
|
|
746
861
|
quote,
|
|
747
862
|
accountAddress,
|
|
748
863
|
recipientAddress,
|
|
749
864
|
wallet,
|
|
750
865
|
onStatus,
|
|
866
|
+
orderType = "market" /* MARKET */,
|
|
751
867
|
options = {}
|
|
752
868
|
}) {
|
|
753
869
|
const isDev = process.env.NODE_ENV !== "production";
|
|
@@ -760,21 +876,31 @@ async function executeOrder({
|
|
|
760
876
|
onStatus?.(stage, message ?? messageFor(stage));
|
|
761
877
|
};
|
|
762
878
|
try {
|
|
763
|
-
const deadline = options.deadline ?? Math.floor(Date.now() / 1e3) + 20 * 60;
|
|
764
879
|
log("Starting execution:", {
|
|
765
880
|
accountAddress,
|
|
766
881
|
recipientAddress,
|
|
767
|
-
deadline,
|
|
768
882
|
tokenIn: quote?.tokenIn,
|
|
769
883
|
tokenOut: quote?.tokenOut
|
|
770
884
|
});
|
|
771
885
|
const adapter = normalizeWallet(wallet);
|
|
772
886
|
if (!adapter) throw new Error("No wallet provided");
|
|
773
887
|
const { tokenIn, tokenOut } = quote;
|
|
888
|
+
const srcChain = Number(tokenIn.chainId);
|
|
889
|
+
const destChain = Number(tokenOut.chainId);
|
|
890
|
+
if (!CURRENT_SUPPORTED.includes(srcChain) || !CURRENT_SUPPORTED.includes(destChain)) {
|
|
891
|
+
const unsupportedChains = [
|
|
892
|
+
!CURRENT_SUPPORTED.includes(srcChain) ? srcChain : null,
|
|
893
|
+
!CURRENT_SUPPORTED.includes(destChain) ? destChain : null
|
|
894
|
+
].filter(Boolean).join(", ");
|
|
895
|
+
const errorMsg = `Unsupported chain(s): ${unsupportedChains}`;
|
|
896
|
+
update("error", errorMsg);
|
|
897
|
+
log("Error:", errorMsg);
|
|
898
|
+
throw new Error(errorMsg);
|
|
899
|
+
}
|
|
774
900
|
const isSingleChain = tokenIn.chainId === tokenOut.chainId;
|
|
775
901
|
const chainId = Number(tokenIn.chainId);
|
|
776
902
|
update("processing");
|
|
777
|
-
if ((0,
|
|
903
|
+
if ((0, import_intents_sdk12.isEvmChain)(chainId)) {
|
|
778
904
|
log("Detected EVM chain:", chainId);
|
|
779
905
|
const result = await handleEvmExecution({
|
|
780
906
|
recipientAddress,
|
|
@@ -783,13 +909,14 @@ async function executeOrder({
|
|
|
783
909
|
accountAddress,
|
|
784
910
|
wallet: adapter,
|
|
785
911
|
isSingleChain,
|
|
786
|
-
|
|
787
|
-
|
|
912
|
+
update,
|
|
913
|
+
orderType,
|
|
914
|
+
options
|
|
788
915
|
});
|
|
789
916
|
log("EVM execution result:", result);
|
|
790
917
|
return result;
|
|
791
918
|
}
|
|
792
|
-
if (chainId ===
|
|
919
|
+
if (chainId === import_intents_sdk12.ChainID.Solana) {
|
|
793
920
|
log("Detected Solana chain");
|
|
794
921
|
const result = await handleSolanaExecution({
|
|
795
922
|
recipientAddress,
|
|
@@ -797,8 +924,9 @@ async function executeOrder({
|
|
|
797
924
|
accountAddress,
|
|
798
925
|
wallet: adapter,
|
|
799
926
|
isSingleChain,
|
|
800
|
-
|
|
801
|
-
|
|
927
|
+
update,
|
|
928
|
+
orderType,
|
|
929
|
+
options
|
|
802
930
|
});
|
|
803
931
|
log("Solana execution result:", result);
|
|
804
932
|
return result;
|
|
@@ -808,8 +936,13 @@ async function executeOrder({
|
|
|
808
936
|
log("Error:", unsupported);
|
|
809
937
|
return { status: false, message: unsupported, stage: "error" };
|
|
810
938
|
} catch (error) {
|
|
811
|
-
|
|
812
|
-
|
|
939
|
+
let message = "An unknown error occurred";
|
|
940
|
+
if (error && typeof error === "object") {
|
|
941
|
+
const err = error;
|
|
942
|
+
message = err.details ?? err.message ?? message;
|
|
943
|
+
} else if (typeof error === "string") {
|
|
944
|
+
message = error;
|
|
945
|
+
}
|
|
813
946
|
update("error", message);
|
|
814
947
|
return { status: false, message, stage: "error" };
|
|
815
948
|
}
|
|
@@ -820,5 +953,139 @@ function normalizeWallet(wallet) {
|
|
|
820
953
|
return wallet;
|
|
821
954
|
}
|
|
822
955
|
|
|
823
|
-
// src/core/
|
|
824
|
-
var
|
|
956
|
+
// src/core/client.ts
|
|
957
|
+
var SwapSDK = class {
|
|
958
|
+
constructor(config) {
|
|
959
|
+
__publicField(this, "apiKey");
|
|
960
|
+
/**
|
|
961
|
+
* Fetches metadata for one or more tokens from the Shogun Token Search API.
|
|
962
|
+
*
|
|
963
|
+
* ---
|
|
964
|
+
* ### Overview
|
|
965
|
+
* `getTokensData` retrieves normalized token information — such as symbol, name,
|
|
966
|
+
* decimals, logo URI, and verified status — for a given list of token addresses.
|
|
967
|
+
*
|
|
968
|
+
* It supports both **EVM** and **SVM (Solana)** tokens, returning metadata from
|
|
969
|
+
* Shogun’s unified token registry.
|
|
970
|
+
*
|
|
971
|
+
* ---
|
|
972
|
+
* @example
|
|
973
|
+
* ```ts
|
|
974
|
+
* const tokens = await getTokensData([
|
|
975
|
+
* "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
|
|
976
|
+
* "So11111111111111111111111111111111111111112", // SOL
|
|
977
|
+
* ]);
|
|
978
|
+
*
|
|
979
|
+
* console.log(tokens);
|
|
980
|
+
* [
|
|
981
|
+
* { symbol: "USDC", name: "USD Coin", chainId: 1, decimals: 6, ... },
|
|
982
|
+
* { symbol: "SOL", name: "Solana", chainId: 101, decimals: 9, ... }
|
|
983
|
+
* ]
|
|
984
|
+
* ```
|
|
985
|
+
*
|
|
986
|
+
* @param addresses - An array of token addresses (EVM or SVM) to fetch metadata for.
|
|
987
|
+
* @returns A promise resolving to an array of {@link TokenInfo} objects.
|
|
988
|
+
*
|
|
989
|
+
* @throws Will throw an error if the network request fails or the API responds with a non-OK status.
|
|
990
|
+
*/
|
|
991
|
+
__publicField(this, "getTokensData", getTokensData.bind(this));
|
|
992
|
+
if (!config.apiKey) {
|
|
993
|
+
throw new Error("SwapSDK: Missing API key");
|
|
994
|
+
}
|
|
995
|
+
this.apiKey = config.apiKey;
|
|
996
|
+
if (this.apiKey) void this.apiKey;
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Retrieves a swap quote for the given input and output tokens.
|
|
1000
|
+
*
|
|
1001
|
+
* @param params - Quote parameters including source/destination tokens and amount.
|
|
1002
|
+
* @returns A normalized `SwapQuoteResponse` containing output amount, route, and metadata.
|
|
1003
|
+
*/
|
|
1004
|
+
async getQuote(params) {
|
|
1005
|
+
return getQuote(params);
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Fetches token balances for the specified user wallet(s).
|
|
1009
|
+
*
|
|
1010
|
+
* Supports both EVM and SVM (Solana) wallet addresses.
|
|
1011
|
+
*
|
|
1012
|
+
* @param params - Wallet address and optional chain filters.
|
|
1013
|
+
* @param options - Optional abort signal for cancellation.
|
|
1014
|
+
* @returns A unified balance response with per-chain token details.
|
|
1015
|
+
*/
|
|
1016
|
+
async getBalances(params, options) {
|
|
1017
|
+
return getBalances(params, options);
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Retrieves a list of verified tokens based on search query or chain filter.
|
|
1021
|
+
*
|
|
1022
|
+
* @param params - Search parameters (query, chain ID, pagination options).
|
|
1023
|
+
* @returns Paginated `TokenSearchResponse` containing token metadata.
|
|
1024
|
+
*/
|
|
1025
|
+
async getTokenList(params) {
|
|
1026
|
+
return getTokenList(params);
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Executes a prepared swap quote using the provided wallet and configuration.
|
|
1030
|
+
*
|
|
1031
|
+
* Handles:
|
|
1032
|
+
* - Token approval (if required)
|
|
1033
|
+
* - Transaction signing and broadcasting
|
|
1034
|
+
* - Confirmation polling and stage-based status updates
|
|
1035
|
+
*
|
|
1036
|
+
* Supports both:
|
|
1037
|
+
* - Market orders (with optional deadline)
|
|
1038
|
+
* - Limit orders (requires executionPrice and deadline)
|
|
1039
|
+
*
|
|
1040
|
+
* @param quote - The swap quote to execute, containing route and metadata.
|
|
1041
|
+
* @param accountAddress - The user's wallet address executing the swap.
|
|
1042
|
+
* @param recipientAddress - Optional recipient address for the output tokens (defaults to sender).
|
|
1043
|
+
* @param wallet - Adapted wallet instance (EVM/Solana) or a standard Viem `WalletClient`.
|
|
1044
|
+
* @param onStatus - Optional callback for receiving execution stage updates and messages.
|
|
1045
|
+
* @param orderType - Defines whether this is a market or limit order.
|
|
1046
|
+
* @param options - Execution parameters (different per order type).
|
|
1047
|
+
*
|
|
1048
|
+
* @returns A finalized execution result containing transaction hash, status, and any returned data.
|
|
1049
|
+
*
|
|
1050
|
+
* @example
|
|
1051
|
+
* ```ts
|
|
1052
|
+
* * Market order
|
|
1053
|
+
* const result = await sdk.executeTransaction({
|
|
1054
|
+
* quote,
|
|
1055
|
+
* accountAddress: "0x123...",
|
|
1056
|
+
* wallet,
|
|
1057
|
+
* orderType: OrderExecutionType.MARKET,
|
|
1058
|
+
* options: { deadline: 1800 },
|
|
1059
|
+
* onStatus: (stage, msg) => console.log(stage, msg),
|
|
1060
|
+
* });
|
|
1061
|
+
*
|
|
1062
|
+
* * Limit order
|
|
1063
|
+
* const result = await sdk.executeTransaction({
|
|
1064
|
+
* quote,
|
|
1065
|
+
* accountAddress: "0x123...",
|
|
1066
|
+
* wallet,
|
|
1067
|
+
* orderType: OrderExecutionType.LIMIT,
|
|
1068
|
+
* options: { executionPrice: "0.0021", deadline: 3600 },
|
|
1069
|
+
* });
|
|
1070
|
+
* ```
|
|
1071
|
+
*/
|
|
1072
|
+
async executeTransaction({
|
|
1073
|
+
quote,
|
|
1074
|
+
accountAddress,
|
|
1075
|
+
recipientAddress,
|
|
1076
|
+
wallet,
|
|
1077
|
+
onStatus,
|
|
1078
|
+
orderType,
|
|
1079
|
+
options
|
|
1080
|
+
}) {
|
|
1081
|
+
return executeOrder({
|
|
1082
|
+
quote,
|
|
1083
|
+
wallet,
|
|
1084
|
+
accountAddress,
|
|
1085
|
+
recipientAddress,
|
|
1086
|
+
onStatus,
|
|
1087
|
+
orderType,
|
|
1088
|
+
options
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
};
|