0xtrails 0.8.2 → 0.8.3
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/aave.d.ts.map +1 -1
- package/dist/{ccip-ru_Yzdas.js → ccip-Bs-QcZXm.js} +13 -13
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/fees.d.ts +11 -17
- package/dist/fees.d.ts.map +1 -1
- package/dist/{index-Si7cO9V7.js → index-C_EsqqSn.js} +20320 -20063
- package/dist/index.js +425 -847
- package/dist/intents.d.ts +1 -2
- package/dist/intents.d.ts.map +1 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/recover.d.ts +8 -9
- package/dist/recover.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts +51 -0
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/trailsRouter.d.ts +15 -0
- package/dist/trailsRouter.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +1 -3
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +1 -3
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/crossChain.d.ts +2 -4
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +5 -4
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +11 -18
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/SlippageToleranceSettings.d.ts +2 -1
- package/dist/widget/components/SlippageToleranceSettings.d.ts.map +1 -1
- package/dist/widget/css/compiled.css +1 -1
- package/dist/widget/hooks/useQuote.d.ts +94 -35
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +2 -2
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/package.json +2 -2
- package/src/aave.ts +4 -0
- package/src/constants.ts +4 -0
- package/src/fees.ts +47 -72
- package/src/intents.ts +1 -3
- package/src/morpho.ts +1 -1
- package/src/prepareSend.ts +42 -6
- package/src/recover.ts +116 -172
- package/src/tokenBalances.ts +301 -1
- package/src/trailsRouter.ts +77 -0
- package/src/transactionIntent/deposits/depositOrchestrator.ts +0 -6
- package/src/transactionIntent/deposits/standardDeposit.ts +167 -184
- package/src/transactionIntent/handlers/crossChain.ts +8 -11
- package/src/transactionIntent/handlers/sameChainSameToken.ts +619 -608
- package/src/transactionIntent/quote/normalizeQuote.ts +32 -46
- package/src/transactionIntent/quote/quoteHelpers.ts +4 -2
- package/src/transactionIntent/types.ts +11 -18
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +50 -18
- package/src/widget/components/ClassicSwap.tsx +25 -30
- package/src/widget/components/QuoteDetails.tsx +18 -27
- package/src/widget/components/SlippageToleranceSettings.tsx +55 -25
- package/src/widget/hooks/useQuote.ts +317 -79
- package/src/widget/hooks/useSendForm.ts +123 -764
- package/src/widget/hooks/useTrailsSendTransaction.ts +0 -2
|
@@ -32,8 +32,6 @@ export async function attemptStandardDeposit({
|
|
|
32
32
|
originChainId,
|
|
33
33
|
chain,
|
|
34
34
|
account,
|
|
35
|
-
fee,
|
|
36
|
-
dryMode,
|
|
37
35
|
originIntentAddress,
|
|
38
36
|
onTransactionStateChange,
|
|
39
37
|
transactionStates,
|
|
@@ -53,8 +51,6 @@ export async function attemptStandardDeposit({
|
|
|
53
51
|
originChainId: number
|
|
54
52
|
chain: Chain
|
|
55
53
|
account: Account
|
|
56
|
-
fee: string
|
|
57
|
-
dryMode: boolean
|
|
58
54
|
sourceTokenPriceUsd?: number | null
|
|
59
55
|
destinationTokenPriceUsd?: number | null
|
|
60
56
|
swapAmount: string
|
|
@@ -99,7 +95,6 @@ export async function attemptStandardDeposit({
|
|
|
99
95
|
originTokenAddress,
|
|
100
96
|
originIntentAddress,
|
|
101
97
|
depositAmount: depositAmount,
|
|
102
|
-
fee,
|
|
103
98
|
originChainId,
|
|
104
99
|
chain,
|
|
105
100
|
})
|
|
@@ -112,7 +107,6 @@ export async function attemptStandardDeposit({
|
|
|
112
107
|
isSameChainSameToken &&
|
|
113
108
|
!isNativeToken(originTokenAddress) &&
|
|
114
109
|
hasCustomCalldata &&
|
|
115
|
-
!dryMode &&
|
|
116
110
|
recipient
|
|
117
111
|
) {
|
|
118
112
|
// ERC20 custom calldata requires approval to the recipient contract
|
|
@@ -296,10 +290,6 @@ export async function attemptStandardDeposit({
|
|
|
296
290
|
}
|
|
297
291
|
}
|
|
298
292
|
|
|
299
|
-
if (dryMode) {
|
|
300
|
-
logger.console.log("[trails-sdk] dry mode, skipping send calls")
|
|
301
|
-
}
|
|
302
|
-
|
|
303
293
|
if (useSendCalls) {
|
|
304
294
|
logger.console.log("[trails-sdk] using sendCalls")
|
|
305
295
|
} else {
|
|
@@ -307,172 +297,127 @@ export async function attemptStandardDeposit({
|
|
|
307
297
|
}
|
|
308
298
|
|
|
309
299
|
if (useSendCalls) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (needsNativeFee) {
|
|
317
|
-
calls.push({
|
|
318
|
-
to: originIntentAddress as `0x${string}`,
|
|
319
|
-
data: "0x00",
|
|
320
|
-
value: `0x${BigInt(nativeFee).toString(16)}` as `0x${string}`,
|
|
321
|
-
})
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// Add the origin call
|
|
300
|
+
const calls: Array<{
|
|
301
|
+
to: `0x${string}`
|
|
302
|
+
data: `0x${string}`
|
|
303
|
+
value?: `0x${string}`
|
|
304
|
+
}> = []
|
|
305
|
+
if (needsNativeFee) {
|
|
325
306
|
calls.push({
|
|
326
|
-
to:
|
|
327
|
-
data:
|
|
328
|
-
value:
|
|
329
|
-
? `0x${BigInt(originCallParams.value).toString(16)}`
|
|
330
|
-
: "0x0",
|
|
307
|
+
to: originIntentAddress as `0x${string}`,
|
|
308
|
+
data: "0x00",
|
|
309
|
+
value: `0x${BigInt(nativeFee).toString(16)}` as `0x${string}`,
|
|
331
310
|
})
|
|
311
|
+
}
|
|
332
312
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
throw new Error(`Transaction failed: ${status.error}`)
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// wait a bit before polling again
|
|
379
|
-
await new Promise((r) => setTimeout(r, 2000))
|
|
313
|
+
// Add the origin call
|
|
314
|
+
calls.push({
|
|
315
|
+
to: originCallParams.to as `0x${string}`,
|
|
316
|
+
data: originCallParams.data as `0x${string}`,
|
|
317
|
+
value: originCallParams.value
|
|
318
|
+
? `0x${BigInt(originCallParams.value).toString(16)}`
|
|
319
|
+
: "0x0",
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
// Update persistent toast before wallet interaction
|
|
323
|
+
updatePersistentToast(
|
|
324
|
+
"Waiting for Confirmation",
|
|
325
|
+
"Please confirm the transaction in your wallet...",
|
|
326
|
+
"info",
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
// Send the batched call via EIP-7702
|
|
330
|
+
const result = (await walletClient.request({
|
|
331
|
+
method: "wallet_sendCalls",
|
|
332
|
+
params: [
|
|
333
|
+
{
|
|
334
|
+
version: "2.0.0",
|
|
335
|
+
chainId: `0x${originChainId.toString(16)}`,
|
|
336
|
+
atomicRequired: true,
|
|
337
|
+
calls,
|
|
338
|
+
},
|
|
339
|
+
],
|
|
340
|
+
})) as { requestId: `0x${string}` }
|
|
341
|
+
|
|
342
|
+
logger.console.log("[trails-sdk] sendCalls result", result)
|
|
343
|
+
const requestId = result.requestId || (result as any).id
|
|
344
|
+
|
|
345
|
+
// Poll to check if the tx has been submitted
|
|
346
|
+
let txHash: `0x${string}` | undefined
|
|
347
|
+
while (!txHash) {
|
|
348
|
+
const status = (await walletClient.request({
|
|
349
|
+
method: "wallet_getCallsStatus",
|
|
350
|
+
params: [requestId],
|
|
351
|
+
})) as {
|
|
352
|
+
status: "pending" | "submitted" | "failed"
|
|
353
|
+
transactionHash?: `0x${string}`
|
|
354
|
+
error?: string
|
|
380
355
|
}
|
|
381
356
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
357
|
+
logger.console.log("[trails-sdk] getCallsStatus result", status)
|
|
358
|
+
const receipt = (status as any)?.receipts?.[0]
|
|
385
359
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
)
|
|
360
|
+
if ((status as any).status === 200 && receipt?.transactionHash) {
|
|
361
|
+
txHash = receipt.transactionHash
|
|
362
|
+
break
|
|
363
|
+
} else if ((status as any).status === 500) {
|
|
364
|
+
throw new Error(`Transaction failed: ${status.error}`)
|
|
365
|
+
}
|
|
393
366
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
})
|
|
397
|
-
logger.console.log("[trails-sdk] receipt", receipt)
|
|
398
|
-
depositUserTxnReceipt = receipt
|
|
367
|
+
// wait a bit before polling again
|
|
368
|
+
await new Promise((r) => setTimeout(r, 2000))
|
|
399
369
|
}
|
|
400
|
-
} else {
|
|
401
|
-
if (!dryMode) {
|
|
402
|
-
if (needsNativeFee) {
|
|
403
|
-
// Trigger signature request callback before prompting wallet
|
|
404
|
-
if (checkoutOnHandlers?.triggerCheckoutSignatureRequest) {
|
|
405
|
-
checkoutOnHandlers.triggerCheckoutSignatureRequest()
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
try {
|
|
409
|
-
const txHashNativeFee = await sendOriginTransaction(
|
|
410
|
-
account,
|
|
411
|
-
walletClient,
|
|
412
|
-
{
|
|
413
|
-
to: originIntentAddress,
|
|
414
|
-
data: "0x00",
|
|
415
|
-
value: nativeFee,
|
|
416
|
-
chainId: originChainId,
|
|
417
|
-
chain,
|
|
418
|
-
} as any,
|
|
419
|
-
{
|
|
420
|
-
depositTokenAmountUsd: depositAmountUsd?.toString(),
|
|
421
|
-
},
|
|
422
|
-
) // TODO: Add proper type
|
|
423
|
-
logger.console.log(
|
|
424
|
-
"[trails-sdk] origin tx native fee",
|
|
425
|
-
txHashNativeFee,
|
|
426
|
-
)
|
|
427
|
-
|
|
428
|
-
// Trigger signature confirmed callback after successful signing
|
|
429
|
-
if (checkoutOnHandlers?.triggerCheckoutSignatureConfirmed) {
|
|
430
|
-
checkoutOnHandlers.triggerCheckoutSignatureConfirmed()
|
|
431
|
-
}
|
|
432
|
-
// Wait for transaction receipt
|
|
433
|
-
const feeReceipt = await publicClient.waitForTransactionReceipt({
|
|
434
|
-
hash: txHashNativeFee,
|
|
435
|
-
})
|
|
436
|
-
logger.console.log("[trails-sdk] nativeFeeReceipt", feeReceipt)
|
|
437
|
-
} catch (error) {
|
|
438
|
-
// Check if this is a user rejection error
|
|
439
|
-
if (getIsUserRejectionError(error)) {
|
|
440
|
-
if (checkoutOnHandlers?.triggerCheckoutSignatureRejected) {
|
|
441
|
-
checkoutOnHandlers.triggerCheckoutSignatureRejected(error)
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
throw error
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
370
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
"Waiting for wallet confirmation...",
|
|
452
|
-
"info",
|
|
453
|
-
)
|
|
371
|
+
if (onOriginSend) {
|
|
372
|
+
onOriginSend()
|
|
373
|
+
}
|
|
454
374
|
|
|
375
|
+
// Update persistent toast after transaction sent
|
|
376
|
+
const chainInfo = getChainInfo(originChainId)
|
|
377
|
+
updatePersistentToast(
|
|
378
|
+
"Transaction Submitted",
|
|
379
|
+
`Waiting for confirmation on ${chainInfo?.name || "chain"}...`,
|
|
380
|
+
"info",
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
const receipt = await publicClient.waitForTransactionReceipt({
|
|
384
|
+
hash: txHash as `0x${string}`,
|
|
385
|
+
})
|
|
386
|
+
logger.console.log("[trails-sdk] receipt", receipt)
|
|
387
|
+
depositUserTxnReceipt = receipt
|
|
388
|
+
} else {
|
|
389
|
+
if (needsNativeFee) {
|
|
455
390
|
// Trigger signature request callback before prompting wallet
|
|
456
391
|
if (checkoutOnHandlers?.triggerCheckoutSignatureRequest) {
|
|
457
392
|
checkoutOnHandlers.triggerCheckoutSignatureRequest()
|
|
458
393
|
}
|
|
459
394
|
|
|
460
|
-
let txHash: `0x${string}`
|
|
461
395
|
try {
|
|
462
|
-
|
|
396
|
+
const txHashNativeFee = await sendOriginTransaction(
|
|
463
397
|
account,
|
|
464
398
|
walletClient,
|
|
465
|
-
|
|
399
|
+
{
|
|
400
|
+
to: originIntentAddress,
|
|
401
|
+
data: "0x00",
|
|
402
|
+
value: nativeFee,
|
|
403
|
+
chainId: originChainId,
|
|
404
|
+
chain,
|
|
405
|
+
} as any,
|
|
466
406
|
{
|
|
467
407
|
depositTokenAmountUsd: depositAmountUsd?.toString(),
|
|
468
408
|
},
|
|
469
409
|
) // TODO: Add proper type
|
|
470
|
-
logger.console.log("[trails-sdk] origin tx",
|
|
410
|
+
logger.console.log("[trails-sdk] origin tx native fee", txHashNativeFee)
|
|
471
411
|
|
|
472
412
|
// Trigger signature confirmed callback after successful signing
|
|
473
413
|
if (checkoutOnHandlers?.triggerCheckoutSignatureConfirmed) {
|
|
474
414
|
checkoutOnHandlers.triggerCheckoutSignatureConfirmed()
|
|
475
415
|
}
|
|
416
|
+
// Wait for transaction receipt
|
|
417
|
+
const feeReceipt = await publicClient.waitForTransactionReceipt({
|
|
418
|
+
hash: txHashNativeFee,
|
|
419
|
+
})
|
|
420
|
+
logger.console.log("[trails-sdk] nativeFeeReceipt", feeReceipt)
|
|
476
421
|
} catch (error) {
|
|
477
422
|
// Check if this is a user rejection error
|
|
478
423
|
if (getIsUserRejectionError(error)) {
|
|
@@ -482,50 +427,88 @@ export async function attemptStandardDeposit({
|
|
|
482
427
|
}
|
|
483
428
|
throw error
|
|
484
429
|
}
|
|
430
|
+
}
|
|
485
431
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
432
|
+
// Show persistent toast for checkout flow
|
|
433
|
+
updatePersistentToast(
|
|
434
|
+
"Payment Started",
|
|
435
|
+
"Waiting for wallet confirmation...",
|
|
436
|
+
"info",
|
|
437
|
+
)
|
|
489
438
|
|
|
490
|
-
|
|
491
|
-
|
|
439
|
+
// Trigger signature request callback before prompting wallet
|
|
440
|
+
if (checkoutOnHandlers?.triggerCheckoutSignatureRequest) {
|
|
441
|
+
checkoutOnHandlers.triggerCheckoutSignatureRequest()
|
|
442
|
+
}
|
|
492
443
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
444
|
+
let txHash: `0x${string}`
|
|
445
|
+
try {
|
|
446
|
+
txHash = await sendOriginTransaction(
|
|
447
|
+
account,
|
|
448
|
+
walletClient,
|
|
449
|
+
originCallParams as any,
|
|
450
|
+
{
|
|
451
|
+
depositTokenAmountUsd: depositAmountUsd?.toString(),
|
|
452
|
+
},
|
|
453
|
+
) // TODO: Add proper type
|
|
454
|
+
logger.console.log("[trails-sdk] origin tx", txHash)
|
|
455
|
+
|
|
456
|
+
// Trigger signature confirmed callback after successful signing
|
|
457
|
+
if (checkoutOnHandlers?.triggerCheckoutSignatureConfirmed) {
|
|
458
|
+
checkoutOnHandlers.triggerCheckoutSignatureConfirmed()
|
|
459
|
+
}
|
|
460
|
+
} catch (error) {
|
|
461
|
+
// Check if this is a user rejection error
|
|
462
|
+
if (getIsUserRejectionError(error)) {
|
|
463
|
+
if (checkoutOnHandlers?.triggerCheckoutSignatureRejected) {
|
|
464
|
+
checkoutOnHandlers.triggerCheckoutSignatureRejected(error)
|
|
500
465
|
}
|
|
501
466
|
}
|
|
467
|
+
throw error
|
|
468
|
+
}
|
|
502
469
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
})
|
|
470
|
+
if (onOriginSend) {
|
|
471
|
+
onOriginSend()
|
|
472
|
+
}
|
|
507
473
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
"Transfer Confirmed",
|
|
511
|
-
`Your transaction on ${chainInfo?.name || "chain"} has been confirmed`,
|
|
512
|
-
"info",
|
|
513
|
-
)
|
|
474
|
+
if (transactionStates[0]) {
|
|
475
|
+
transactionStates[0].state = "pending"
|
|
514
476
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
depositTokenAmountUsd: depositAmountUsd?.toString(),
|
|
524
|
-
})
|
|
525
|
-
|
|
526
|
-
logger.console.log("[trails-sdk] receipt", receipt)
|
|
527
|
-
depositUserTxnReceipt = receipt
|
|
477
|
+
try {
|
|
478
|
+
onTransactionStateChange(transactionStates)
|
|
479
|
+
} catch (error) {
|
|
480
|
+
logger.console.error(
|
|
481
|
+
"[trails-sdk] Error calling onTransactionStateChange:",
|
|
482
|
+
error,
|
|
483
|
+
)
|
|
484
|
+
}
|
|
528
485
|
}
|
|
486
|
+
|
|
487
|
+
// Wait for transaction receipt
|
|
488
|
+
const receipt = await publicClient.waitForTransactionReceipt({
|
|
489
|
+
hash: txHash,
|
|
490
|
+
})
|
|
491
|
+
|
|
492
|
+
const chainInfo = getChainInfo(originChainId)
|
|
493
|
+
updatePersistentToast(
|
|
494
|
+
"Transfer Confirmed",
|
|
495
|
+
`Your transaction on ${chainInfo?.name || "chain"} has been confirmed`,
|
|
496
|
+
"info",
|
|
497
|
+
)
|
|
498
|
+
|
|
499
|
+
trackTransactionConfirmed({
|
|
500
|
+
transactionHash: txHash,
|
|
501
|
+
chainId: originChainId,
|
|
502
|
+
userAddress: account.address,
|
|
503
|
+
blockNumber: Number(receipt.blockNumber),
|
|
504
|
+
originIntentAddress,
|
|
505
|
+
originTokenSymbol,
|
|
506
|
+
destinationTokenSymbol,
|
|
507
|
+
depositTokenAmountUsd: depositAmountUsd?.toString(),
|
|
508
|
+
})
|
|
509
|
+
|
|
510
|
+
logger.console.log("[trails-sdk] receipt", receipt)
|
|
511
|
+
depositUserTxnReceipt = receipt
|
|
529
512
|
}
|
|
530
513
|
|
|
531
514
|
return depositUserTxnReceipt
|
|
@@ -35,7 +35,10 @@ import {
|
|
|
35
35
|
decodeGuestModuleEvents,
|
|
36
36
|
} from "../../decoders.js"
|
|
37
37
|
import { updatePersistentToast } from "../../toast.js"
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
formatRawAmount,
|
|
40
|
+
invalidateTokenBalancesCache,
|
|
41
|
+
} from "../../tokenBalances.js"
|
|
39
42
|
import { calcAmountUsdPrice } from "../../prices.js"
|
|
40
43
|
import { checkAccountBalance } from "../utils/balanceChecker.js"
|
|
41
44
|
import { estimateGasLimit } from "../../estimate.js"
|
|
@@ -109,8 +112,6 @@ export async function handleCrossChain({
|
|
|
109
112
|
publicClient,
|
|
110
113
|
chain,
|
|
111
114
|
account,
|
|
112
|
-
fee,
|
|
113
|
-
dryMode,
|
|
114
115
|
onTransactionStateChange,
|
|
115
116
|
transactionStates,
|
|
116
117
|
slippageTolerance,
|
|
@@ -153,11 +154,9 @@ export async function handleCrossChain({
|
|
|
153
154
|
publicClient: PublicClient
|
|
154
155
|
chain: Chain
|
|
155
156
|
account: Account
|
|
156
|
-
fee: string
|
|
157
|
-
dryMode: boolean
|
|
158
157
|
onTransactionStateChange: (transactionStates: TransactionState[]) => void
|
|
159
158
|
transactionStates: TransactionState[]
|
|
160
|
-
slippageTolerance: string
|
|
159
|
+
slippageTolerance: string | null
|
|
161
160
|
tradeType: TradeType
|
|
162
161
|
originNativeTokenPriceUsd?: number | null
|
|
163
162
|
swapProvider?: RouteProvider | null
|
|
@@ -319,7 +318,6 @@ export async function handleCrossChain({
|
|
|
319
318
|
originTokenAddress,
|
|
320
319
|
originIntentAddress,
|
|
321
320
|
depositAmount,
|
|
322
|
-
fee,
|
|
323
321
|
originChainId,
|
|
324
322
|
chain,
|
|
325
323
|
})
|
|
@@ -528,8 +526,6 @@ export async function handleCrossChain({
|
|
|
528
526
|
account: account.address,
|
|
529
527
|
depositAmount,
|
|
530
528
|
originIntentAddress,
|
|
531
|
-
fee,
|
|
532
|
-
dryMode,
|
|
533
529
|
feeOptions: gasFeeOptions,
|
|
534
530
|
selectedFeeOption: effectiveSelectedFeeOption,
|
|
535
531
|
selectedFeeOptionType: typeof effectiveSelectedFeeOption,
|
|
@@ -550,8 +546,6 @@ export async function handleCrossChain({
|
|
|
550
546
|
walletClient,
|
|
551
547
|
destinationTokenDecimals,
|
|
552
548
|
sourceTokenDecimals,
|
|
553
|
-
fee,
|
|
554
|
-
dryMode,
|
|
555
549
|
sourceTokenPriceUsd: sourceTokenPriceUsd ?? null,
|
|
556
550
|
destinationTokenPriceUsd: destinationTokenPriceUsd ?? null,
|
|
557
551
|
swapAmount,
|
|
@@ -1577,6 +1571,9 @@ export async function handleCrossChain({
|
|
|
1577
1571
|
destinationTokenPriceUsd: destinationTokenPriceUsd,
|
|
1578
1572
|
})
|
|
1579
1573
|
|
|
1574
|
+
// Invalidate token balances cache after transaction (success or failure - gas was spent)
|
|
1575
|
+
invalidateTokenBalancesCache(account.address)
|
|
1576
|
+
|
|
1580
1577
|
// Call onCheckoutComplete callback with transaction status
|
|
1581
1578
|
if (checkoutOnHandlers?.triggerCheckoutComplete) {
|
|
1582
1579
|
checkoutOnHandlers.triggerCheckoutComplete(
|