@shogun-sdk/swap 0.0.2-test.2 → 0.0.2-test.20
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 +222 -62
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +214 -55
- package/dist/{execute-HX1fQ7wG.d.ts → execute-CKTsf_tD.d.ts} +14 -16
- package/dist/{execute-FaLLPp1i.d.cts → execute-DOv1i2Su.d.cts} +14 -16
- package/dist/index.cjs +255 -108
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +248 -102
- package/dist/react.cjs +262 -115
- package/dist/react.d.cts +6 -40
- package/dist/react.d.ts +6 -40
- package/dist/react.js +250 -104
- package/dist/wallet-adapter.cjs +20 -9
- package/dist/wallet-adapter.js +20 -9
- package/package.json +2 -2
package/dist/core.cjs
CHANGED
|
@@ -20,7 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/core/index.ts
|
|
21
21
|
var core_exports = {};
|
|
22
22
|
__export(core_exports, {
|
|
23
|
-
ChainID: () =>
|
|
23
|
+
ChainID: () => import_intents_sdk11.ChainID,
|
|
24
24
|
NATIVE_TOKEN: () => NATIVE_TOKEN,
|
|
25
25
|
SOLANA_CHAIN_ID: () => SOLANA_CHAIN_ID,
|
|
26
26
|
SupportedChains: () => SupportedChains,
|
|
@@ -29,7 +29,7 @@ __export(core_exports, {
|
|
|
29
29
|
getBalances: () => getBalances,
|
|
30
30
|
getQuote: () => getQuote,
|
|
31
31
|
getTokenList: () => getTokenList,
|
|
32
|
-
isEvmChain: () =>
|
|
32
|
+
isEvmChain: () => import_intents_sdk11.isEvmChain,
|
|
33
33
|
isNativeAddress: () => isNativeAddress,
|
|
34
34
|
isViemWalletClient: () => isViemWalletClient,
|
|
35
35
|
serializeBigIntsToStrings: () => serializeBigIntsToStrings
|
|
@@ -177,22 +177,26 @@ async function getQuote(params) {
|
|
|
177
177
|
tokenOut: params.tokenOut.address,
|
|
178
178
|
amount: params.amount
|
|
179
179
|
});
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
const slippage = Math.min(Math.max(slippageDecimal, 0), 0.5);
|
|
180
|
+
console.log({ data });
|
|
181
|
+
const slippagePercent = Math.min(Math.max(params.slippage ?? 0.5, 0), 50);
|
|
183
182
|
let warning;
|
|
184
|
-
if (
|
|
185
|
-
warning = `\u26A0\uFE0F High slippage tolerance (${
|
|
183
|
+
if (slippagePercent > 10) {
|
|
184
|
+
warning = `\u26A0\uFE0F High slippage tolerance (${slippagePercent.toFixed(2)}%) \u2014 price may vary significantly.`;
|
|
186
185
|
}
|
|
187
|
-
const estimatedAmountOut = BigInt(data.
|
|
188
|
-
const slippageBps = BigInt(Math.round(
|
|
186
|
+
const estimatedAmountOut = BigInt(data.estimatedAmountOut);
|
|
187
|
+
const slippageBps = BigInt(Math.round(slippagePercent * 100));
|
|
189
188
|
const estimatedAmountOutAfterSlippage = estimatedAmountOut * (10000n - slippageBps) / 10000n;
|
|
189
|
+
const pricePerTokenOutInUsd = data.estimatedAmountOutUsd / Number(data.estimatedAmountOut);
|
|
190
|
+
const amountOutUsdAfterSlippage = Number(estimatedAmountOutAfterSlippage) * pricePerTokenOutInUsd;
|
|
191
|
+
const minStablecoinsAmountValue = BigInt(data.estimatedAmountInAsMinStablecoinAmount);
|
|
192
|
+
const minStablecoinsAmountAfterSlippage = minStablecoinsAmountValue * (10000n - slippageBps) / 10000n;
|
|
190
193
|
const pricePerInputToken = estimatedAmountOut * 10n ** BigInt(params.tokenIn.decimals ?? 18) / BigInt(params.amount);
|
|
191
194
|
return {
|
|
192
|
-
amountOut:
|
|
193
|
-
amountOutUsd:
|
|
195
|
+
amountOut: estimatedAmountOutAfterSlippage,
|
|
196
|
+
amountOutUsd: amountOutUsdAfterSlippage,
|
|
194
197
|
amountInUsd: data.amountInUsd,
|
|
195
|
-
|
|
198
|
+
// Input USD stays the same
|
|
199
|
+
minStablecoinsAmount: minStablecoinsAmountAfterSlippage,
|
|
196
200
|
tokenIn: {
|
|
197
201
|
address: params.tokenIn.address,
|
|
198
202
|
decimals: params.tokenIn.decimals ?? 18,
|
|
@@ -205,10 +209,11 @@ async function getQuote(params) {
|
|
|
205
209
|
},
|
|
206
210
|
amountIn: params.amount,
|
|
207
211
|
pricePerInputToken,
|
|
208
|
-
slippage,
|
|
212
|
+
slippage: slippagePercent,
|
|
209
213
|
internal: {
|
|
210
214
|
...data,
|
|
211
|
-
estimatedAmountOutReduced: estimatedAmountOutAfterSlippage
|
|
215
|
+
estimatedAmountOutReduced: estimatedAmountOutAfterSlippage,
|
|
216
|
+
estimatedAmountOutUsdReduced: amountOutUsdAfterSlippage
|
|
212
217
|
},
|
|
213
218
|
warning
|
|
214
219
|
};
|
|
@@ -281,7 +286,7 @@ async function getBalances(params, options) {
|
|
|
281
286
|
}
|
|
282
287
|
|
|
283
288
|
// src/core/executeOrder/execute.ts
|
|
284
|
-
var
|
|
289
|
+
var import_intents_sdk10 = require("@shogun-sdk/intents-sdk");
|
|
285
290
|
var import_viem4 = require("viem");
|
|
286
291
|
|
|
287
292
|
// src/wallet-adapter/evm-wallet-adapter/adapter.ts
|
|
@@ -305,15 +310,26 @@ var adaptViemWallet = (wallet) => {
|
|
|
305
310
|
if (!isEVMTransaction(transaction)) {
|
|
306
311
|
throw new Error("Expected EVMTransaction but got SolanaTransaction");
|
|
307
312
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
313
|
+
if (wallet.transport.type === "http") {
|
|
314
|
+
const request = await wallet.prepareTransactionRequest({
|
|
315
|
+
to: transaction.to,
|
|
316
|
+
data: transaction.data,
|
|
317
|
+
value: transaction.value,
|
|
318
|
+
chain: wallet.chain
|
|
319
|
+
});
|
|
320
|
+
const serializedTransaction = await wallet.signTransaction(request);
|
|
321
|
+
const tx = await wallet.sendRawTransaction({ serializedTransaction });
|
|
322
|
+
return tx;
|
|
323
|
+
} else {
|
|
324
|
+
const hash = await wallet.sendTransaction({
|
|
325
|
+
to: transaction.to,
|
|
326
|
+
data: transaction.data,
|
|
327
|
+
value: transaction.value,
|
|
328
|
+
chain: wallet.chain,
|
|
329
|
+
account: wallet.account
|
|
330
|
+
});
|
|
331
|
+
return hash;
|
|
332
|
+
}
|
|
317
333
|
};
|
|
318
334
|
const switchChain = async (chainId) => {
|
|
319
335
|
try {
|
|
@@ -348,7 +364,7 @@ var adaptViemWallet = (wallet) => {
|
|
|
348
364
|
};
|
|
349
365
|
|
|
350
366
|
// src/core/executeOrder/handleEvmExecution.ts
|
|
351
|
-
var
|
|
367
|
+
var import_intents_sdk8 = require("@shogun-sdk/intents-sdk");
|
|
352
368
|
var import_viem3 = require("viem");
|
|
353
369
|
|
|
354
370
|
// src/core/executeOrder/stageMessages.ts
|
|
@@ -356,10 +372,12 @@ var DEFAULT_STAGE_MESSAGES = {
|
|
|
356
372
|
processing: "Preparing transaction for execution",
|
|
357
373
|
approving: "Approving token allowance",
|
|
358
374
|
approved: "Token approved successfully",
|
|
359
|
-
signing: "Signing
|
|
360
|
-
submitting: "Submitting
|
|
361
|
-
|
|
362
|
-
|
|
375
|
+
signing: "Signing transaction for submission",
|
|
376
|
+
submitting: "Submitting transaction",
|
|
377
|
+
initiated: "Transaction initiated.",
|
|
378
|
+
success: "Transaction Executed successfully",
|
|
379
|
+
shogun_processing: "Shogun is processing your transaction",
|
|
380
|
+
error: "Transaction failed during submission"
|
|
363
381
|
};
|
|
364
382
|
|
|
365
383
|
// src/core/executeOrder/buildOrder.ts
|
|
@@ -398,6 +416,106 @@ async function buildOrder({
|
|
|
398
416
|
});
|
|
399
417
|
}
|
|
400
418
|
|
|
419
|
+
// src/utils/pollOrderStatus.ts
|
|
420
|
+
var import_intents_sdk7 = require("@shogun-sdk/intents-sdk");
|
|
421
|
+
async function pollOrderStatus(address, orderId, options = {}) {
|
|
422
|
+
const { intervalMs = 2e3, timeoutMs = 3e5 } = options;
|
|
423
|
+
const startTime = Date.now();
|
|
424
|
+
const isEvmAddress = /^0x[a-fA-F0-9]{40}$/.test(address);
|
|
425
|
+
const isSuiAddress = /^0x[a-fA-F0-9]{64}$/.test(address);
|
|
426
|
+
const isSolanaAddress = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(address);
|
|
427
|
+
let queryParam;
|
|
428
|
+
if (isEvmAddress) {
|
|
429
|
+
queryParam = `evmWallets=${address}`;
|
|
430
|
+
} else if (isSuiAddress) {
|
|
431
|
+
queryParam = `suiWallets=${address}`;
|
|
432
|
+
} else if (isSolanaAddress) {
|
|
433
|
+
queryParam = `solanaWallets=${address}`;
|
|
434
|
+
} else {
|
|
435
|
+
throw new Error(`Unrecognized wallet address format: ${address}`);
|
|
436
|
+
}
|
|
437
|
+
const queryUrl = `${import_intents_sdk7.AUCTIONEER_URL}/user_intent?${queryParam}`;
|
|
438
|
+
return new Promise((resolve, reject) => {
|
|
439
|
+
const pollInterval = setInterval(async () => {
|
|
440
|
+
try {
|
|
441
|
+
if (Date.now() - startTime > timeoutMs) {
|
|
442
|
+
clearInterval(pollInterval);
|
|
443
|
+
return resolve("Timeout");
|
|
444
|
+
}
|
|
445
|
+
const res = await fetch(queryUrl, {
|
|
446
|
+
method: "GET",
|
|
447
|
+
headers: { "Content-Type": "application/json" }
|
|
448
|
+
});
|
|
449
|
+
if (!res.ok) {
|
|
450
|
+
clearInterval(pollInterval);
|
|
451
|
+
return reject(
|
|
452
|
+
new Error(`Failed to fetch orders: ${res.status} ${res.statusText}`)
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
const json = await res.json();
|
|
456
|
+
const data = json?.data ?? {};
|
|
457
|
+
const allOrders = [
|
|
458
|
+
...data.crossChainDcaOrders ?? [],
|
|
459
|
+
...data.crossChainLimitOrders ?? [],
|
|
460
|
+
...data.singleChainDcaOrders ?? [],
|
|
461
|
+
...data.singleChainLimitOrders ?? []
|
|
462
|
+
];
|
|
463
|
+
const targetOrder = allOrders.find((o) => o.orderId === orderId);
|
|
464
|
+
if (!targetOrder) {
|
|
465
|
+
clearInterval(pollInterval);
|
|
466
|
+
return resolve("NotFound");
|
|
467
|
+
}
|
|
468
|
+
const { orderStatus } = targetOrder;
|
|
469
|
+
if (["Fulfilled", "Cancelled", "Outdated"].includes(orderStatus)) {
|
|
470
|
+
clearInterval(pollInterval);
|
|
471
|
+
return resolve(orderStatus);
|
|
472
|
+
}
|
|
473
|
+
} catch (error) {
|
|
474
|
+
clearInterval(pollInterval);
|
|
475
|
+
return reject(error);
|
|
476
|
+
}
|
|
477
|
+
}, intervalMs);
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// src/core/executeOrder/handleOrderPollingResult.ts
|
|
482
|
+
async function handleOrderPollingResult({
|
|
483
|
+
status,
|
|
484
|
+
orderId,
|
|
485
|
+
chainId,
|
|
486
|
+
update,
|
|
487
|
+
messageFor
|
|
488
|
+
}) {
|
|
489
|
+
switch (status) {
|
|
490
|
+
case "Fulfilled":
|
|
491
|
+
update("success", messageFor("success"));
|
|
492
|
+
return {
|
|
493
|
+
status: true,
|
|
494
|
+
orderId,
|
|
495
|
+
chainId,
|
|
496
|
+
finalStatus: status,
|
|
497
|
+
stage: "success"
|
|
498
|
+
};
|
|
499
|
+
case "Cancelled":
|
|
500
|
+
update("error", "Order was cancelled before fulfillment");
|
|
501
|
+
break;
|
|
502
|
+
case "Timeout":
|
|
503
|
+
update("error", "Order polling timed out");
|
|
504
|
+
break;
|
|
505
|
+
case "NotFound":
|
|
506
|
+
default:
|
|
507
|
+
update("error", "Order not found");
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
510
|
+
return {
|
|
511
|
+
status: false,
|
|
512
|
+
orderId,
|
|
513
|
+
chainId,
|
|
514
|
+
finalStatus: status,
|
|
515
|
+
stage: "error"
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
|
|
401
519
|
// src/core/executeOrder/handleEvmExecution.ts
|
|
402
520
|
async function handleEvmExecution({
|
|
403
521
|
recipientAddress,
|
|
@@ -426,18 +544,18 @@ async function handleEvmExecution({
|
|
|
426
544
|
from: accountAddress
|
|
427
545
|
});
|
|
428
546
|
}
|
|
429
|
-
update("
|
|
547
|
+
update("processing", messageFor("approving"));
|
|
430
548
|
await wallet.sendTransaction({
|
|
431
549
|
to: tokenIn,
|
|
432
550
|
data: (0, import_viem3.encodeFunctionData)({
|
|
433
551
|
abi: import_viem3.erc20Abi,
|
|
434
552
|
functionName: "approve",
|
|
435
|
-
args: [
|
|
553
|
+
args: [import_intents_sdk8.PERMIT2_ADDRESS[chainId], BigInt(quote.amountIn)]
|
|
436
554
|
}),
|
|
437
555
|
value: 0n,
|
|
438
556
|
from: accountAddress
|
|
439
557
|
});
|
|
440
|
-
update("
|
|
558
|
+
update("processing", messageFor("approved"));
|
|
441
559
|
const destination = recipientAddress ?? accountAddress;
|
|
442
560
|
const order = await buildOrder({
|
|
443
561
|
quote,
|
|
@@ -446,23 +564,39 @@ async function handleEvmExecution({
|
|
|
446
564
|
deadline,
|
|
447
565
|
isSingleChain
|
|
448
566
|
});
|
|
449
|
-
update("
|
|
450
|
-
const { orderTypedData, nonce } = isSingleChain ? await (0,
|
|
567
|
+
update("processing", messageFor("signing"));
|
|
568
|
+
const { orderTypedData, nonce } = isSingleChain ? await (0, import_intents_sdk8.getEVMSingleChainOrderTypedData)(order) : await (0, import_intents_sdk8.getEVMCrossChainOrderTypedData)(order);
|
|
569
|
+
const typedData = serializeBigIntsToStrings(orderTypedData);
|
|
451
570
|
if (!wallet.signTypedData) {
|
|
452
571
|
throw new Error("Wallet does not support EIP-712 signing");
|
|
453
572
|
}
|
|
454
|
-
const signature = await wallet.signTypedData(
|
|
455
|
-
|
|
573
|
+
const signature = await wallet.signTypedData({
|
|
574
|
+
domain: typedData.domain,
|
|
575
|
+
types: typedData.types,
|
|
576
|
+
primaryType: typedData.primaryType,
|
|
577
|
+
value: typedData.message,
|
|
578
|
+
message: typedData.message
|
|
579
|
+
});
|
|
580
|
+
update("processing", messageFor("submitting"));
|
|
456
581
|
const res = await order.sendToAuctioneer({ signature, nonce: nonce.toString() });
|
|
457
582
|
if (!res.success) {
|
|
458
583
|
throw new Error("Auctioneer submission failed");
|
|
459
584
|
}
|
|
460
|
-
update("
|
|
461
|
-
|
|
585
|
+
update("initiated", messageFor("initiated"));
|
|
586
|
+
const { intentId: orderId } = res.data;
|
|
587
|
+
update("initiated", messageFor("shogun_processing"));
|
|
588
|
+
const status = await pollOrderStatus(accountAddress, orderId);
|
|
589
|
+
return await handleOrderPollingResult({
|
|
590
|
+
status,
|
|
591
|
+
orderId,
|
|
592
|
+
chainId,
|
|
593
|
+
update,
|
|
594
|
+
messageFor
|
|
595
|
+
});
|
|
462
596
|
}
|
|
463
597
|
|
|
464
598
|
// src/core/executeOrder/handleSolanaExecution.ts
|
|
465
|
-
var
|
|
599
|
+
var import_intents_sdk9 = require("@shogun-sdk/intents-sdk");
|
|
466
600
|
var import_web3 = require("@solana/web3.js");
|
|
467
601
|
async function handleSolanaExecution({
|
|
468
602
|
recipientAddress,
|
|
@@ -492,10 +626,9 @@ async function handleSolanaExecution({
|
|
|
492
626
|
rpcUrl: wallet.rpcUrl
|
|
493
627
|
});
|
|
494
628
|
const transaction = import_web3.VersionedTransaction.deserialize(Uint8Array.from(txData.txBytes));
|
|
495
|
-
update("
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
update("submitting", messageFor("submitting"));
|
|
629
|
+
update("processing", messageFor("signing"));
|
|
630
|
+
await wallet.sendTransaction(transaction);
|
|
631
|
+
update("processing", messageFor("submitting"));
|
|
499
632
|
const response = await submitToAuctioneer({
|
|
500
633
|
order,
|
|
501
634
|
isSingleChain,
|
|
@@ -504,13 +637,17 @@ async function handleSolanaExecution({
|
|
|
504
637
|
if (!response.success) {
|
|
505
638
|
throw new Error("Auctioneer submission failed");
|
|
506
639
|
}
|
|
507
|
-
update("
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
640
|
+
update("initiated", messageFor("initiated"));
|
|
641
|
+
const { jwt, intentId: orderId } = response.data;
|
|
642
|
+
update("initiated", messageFor("shogun_processing"));
|
|
643
|
+
const status = await pollOrderStatus(jwt, orderId);
|
|
644
|
+
return await handleOrderPollingResult({
|
|
645
|
+
status,
|
|
646
|
+
orderId,
|
|
647
|
+
chainId: SOLANA_CHAIN_ID,
|
|
648
|
+
update,
|
|
649
|
+
messageFor
|
|
650
|
+
});
|
|
514
651
|
}
|
|
515
652
|
async function getSolanaOrderInstructions({
|
|
516
653
|
order,
|
|
@@ -518,11 +655,11 @@ async function getSolanaOrderInstructions({
|
|
|
518
655
|
rpcUrl
|
|
519
656
|
}) {
|
|
520
657
|
if (isSingleChain) {
|
|
521
|
-
return await (0,
|
|
658
|
+
return await (0, import_intents_sdk9.getSolanaSingleChainOrderInstructions)(order, {
|
|
522
659
|
rpcUrl
|
|
523
660
|
});
|
|
524
661
|
}
|
|
525
|
-
return await (0,
|
|
662
|
+
return await (0, import_intents_sdk9.getSolanaCrossChainOrderInstructions)(order, {
|
|
526
663
|
rpcUrl
|
|
527
664
|
});
|
|
528
665
|
}
|
|
@@ -552,18 +689,33 @@ async function executeOrder({
|
|
|
552
689
|
onStatus,
|
|
553
690
|
options = {}
|
|
554
691
|
}) {
|
|
555
|
-
const
|
|
692
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
693
|
+
const log = (...args) => {
|
|
694
|
+
if (isDev) console.log("[OneShot::executeOrder]", ...args);
|
|
695
|
+
};
|
|
556
696
|
const messageFor = (stage) => DEFAULT_STAGE_MESSAGES[stage];
|
|
557
|
-
const update = (stage, message) =>
|
|
697
|
+
const update = (stage, message) => {
|
|
698
|
+
log("Stage:", stage, "| Message:", message ?? messageFor(stage));
|
|
699
|
+
onStatus?.(stage, message ?? messageFor(stage));
|
|
700
|
+
};
|
|
558
701
|
try {
|
|
702
|
+
const deadline = options.deadline ?? Math.floor(Date.now() / 1e3) + 20 * 60;
|
|
703
|
+
log("Starting execution:", {
|
|
704
|
+
accountAddress,
|
|
705
|
+
recipientAddress,
|
|
706
|
+
deadline,
|
|
707
|
+
tokenIn: quote?.tokenIn,
|
|
708
|
+
tokenOut: quote?.tokenOut
|
|
709
|
+
});
|
|
559
710
|
const adapter = normalizeWallet(wallet);
|
|
560
711
|
if (!adapter) throw new Error("No wallet provided");
|
|
561
712
|
const { tokenIn, tokenOut } = quote;
|
|
562
713
|
const isSingleChain = tokenIn.chainId === tokenOut.chainId;
|
|
563
714
|
const chainId = Number(tokenIn.chainId);
|
|
564
|
-
update("processing"
|
|
565
|
-
if ((0,
|
|
566
|
-
|
|
715
|
+
update("processing");
|
|
716
|
+
if ((0, import_intents_sdk10.isEvmChain)(chainId)) {
|
|
717
|
+
log("Detected EVM chain:", chainId);
|
|
718
|
+
const result = await handleEvmExecution({
|
|
567
719
|
recipientAddress,
|
|
568
720
|
quote,
|
|
569
721
|
chainId,
|
|
@@ -573,9 +725,12 @@ async function executeOrder({
|
|
|
573
725
|
deadline,
|
|
574
726
|
update
|
|
575
727
|
});
|
|
728
|
+
log("EVM execution result:", result);
|
|
729
|
+
return result;
|
|
576
730
|
}
|
|
577
|
-
if (chainId ===
|
|
578
|
-
|
|
731
|
+
if (chainId === import_intents_sdk10.ChainID.Solana) {
|
|
732
|
+
log("Detected Solana chain");
|
|
733
|
+
const result = await handleSolanaExecution({
|
|
579
734
|
recipientAddress,
|
|
580
735
|
quote,
|
|
581
736
|
accountAddress,
|
|
@@ -584,11 +739,16 @@ async function executeOrder({
|
|
|
584
739
|
deadline,
|
|
585
740
|
update
|
|
586
741
|
});
|
|
742
|
+
log("Solana execution result:", result);
|
|
743
|
+
return result;
|
|
587
744
|
}
|
|
588
|
-
|
|
589
|
-
|
|
745
|
+
const unsupported = `Unsupported chain: ${chainId}`;
|
|
746
|
+
update("error", unsupported);
|
|
747
|
+
log("Error:", unsupported);
|
|
748
|
+
return { status: false, message: unsupported, stage: "error" };
|
|
590
749
|
} catch (error) {
|
|
591
750
|
const message = error instanceof import_viem4.BaseError ? error.shortMessage : error instanceof Error ? error.message : String(error);
|
|
751
|
+
log("Execution failed:", { message, error });
|
|
592
752
|
update("error", message);
|
|
593
753
|
return { status: false, message, stage: "error" };
|
|
594
754
|
}
|
|
@@ -600,7 +760,7 @@ function normalizeWallet(wallet) {
|
|
|
600
760
|
}
|
|
601
761
|
|
|
602
762
|
// src/core/index.ts
|
|
603
|
-
var
|
|
763
|
+
var import_intents_sdk11 = require("@shogun-sdk/intents-sdk");
|
|
604
764
|
// Annotate the CommonJS export names for ESM import in node:
|
|
605
765
|
0 && (module.exports = {
|
|
606
766
|
ChainID,
|
package/dist/core.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TokenSearchParams, TokenSearchResponse, ChainID } from '@shogun-sdk/intents-sdk';
|
|
2
2
|
export { ChainID, isEvmChain } from '@shogun-sdk/intents-sdk';
|
|
3
|
-
import { S as SwapQuoteParams, a as SwapQuoteResponse, Q as QuoteTokenInfo, B as BalanceRequestParams, c as BalanceResponse } from './execute-
|
|
4
|
-
export { P as PlaceOrderResult, b as Stage, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse, e as executeOrder } from './execute-
|
|
3
|
+
import { S as SwapQuoteParams, a as SwapQuoteResponse, Q as QuoteTokenInfo, B as BalanceRequestParams, c as BalanceResponse } from './execute-DOv1i2Su.cjs';
|
|
4
|
+
export { P as PlaceOrderResult, b as Stage, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse, e as executeOrder } from './execute-DOv1i2Su.cjs';
|
|
5
5
|
import { WalletClient } from 'viem';
|
|
6
6
|
import { A as AdaptedWallet } from './wallet-MmUIz8GE.cjs';
|
|
7
7
|
import '@mysten/sui/transactions';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TokenSearchParams, TokenSearchResponse, ChainID } from '@shogun-sdk/intents-sdk';
|
|
2
2
|
export { ChainID, isEvmChain } from '@shogun-sdk/intents-sdk';
|
|
3
|
-
import { S as SwapQuoteParams, a as SwapQuoteResponse, Q as QuoteTokenInfo, B as BalanceRequestParams, c as BalanceResponse } from './execute-
|
|
4
|
-
export { P as PlaceOrderResult, b as Stage, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse, e as executeOrder } from './execute-
|
|
3
|
+
import { S as SwapQuoteParams, a as SwapQuoteResponse, Q as QuoteTokenInfo, B as BalanceRequestParams, c as BalanceResponse } from './execute-CKTsf_tD.js';
|
|
4
|
+
export { P as PlaceOrderResult, b as Stage, T as TokenBalance, f as TokenInfo, d as TokenSearchResponse, e as executeOrder } from './execute-CKTsf_tD.js';
|
|
5
5
|
import { WalletClient } from 'viem';
|
|
6
6
|
import { A as AdaptedWallet } from './wallet-MmUIz8GE.js';
|
|
7
7
|
import '@mysten/sui/transactions';
|