0xtrails 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ccip-fConRNoG.js → ccip-uMWNlvmJ.js} +34 -34
- package/dist/fees.d.ts.map +1 -1
- package/dist/{index-BbajxCG_.js → index-BiPwqVkZ.js} +31527 -28874
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +478 -456
- package/dist/intents.d.ts +10 -4
- package/dist/intents.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +1 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +2 -2
- package/dist/prices.d.ts.map +1 -1
- package/dist/refund.d.ts +116 -0
- package/dist/refund.d.ts.map +1 -0
- package/dist/tokenBalances.d.ts +1 -1
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/crossChain.d.ts +4 -3
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +3 -3
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts +1 -2
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +3 -3
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +5 -4
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactions.d.ts +4 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +2 -1
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/Earn.d.ts +2 -1
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/ErrorDisplay.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +2 -1
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundSwap.d.ts +2 -1
- package/dist/widget/components/FundSwap.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts +2 -1
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts +2 -1
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts +1 -0
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts +2 -1
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/TokenImage.d.ts.map +1 -1
- package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
- package/dist/widget/css/compiled.css +1 -1
- package/dist/widget/hooks/useAmountUsd.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
- package/dist/widget/hooks/useGetIntent.d.ts +18 -0
- package/dist/widget/hooks/useGetIntent.d.ts.map +1 -0
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +10 -7
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +3 -2
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +1 -1
- package/dist/widget/index.js +3 -3
- package/dist/widget/widget.d.ts +2 -1
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +5 -12
- package/src/fees.ts +8 -2
- package/src/index.ts +33 -1
- package/src/intents.ts +34 -7
- package/src/prepareSend.ts +6 -4
- package/src/prices.ts +6 -6
- package/src/refund.ts +914 -0
- package/src/tokenBalances.ts +4 -14
- package/src/transactionIntent/handlers/crossChain.ts +21 -10
- package/src/transactionIntent/handlers/sameChainSameToken.ts +12 -8
- package/src/transactionIntent/quote/normalizeQuote.ts +29 -27
- package/src/transactionIntent/quote/quoteHelpers.ts +5 -9
- package/src/transactionIntent/types.ts +5 -3
- package/src/transactions.ts +5 -0
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +197 -5
- package/src/widget/components/ClassicSwap.tsx +6 -3
- package/src/widget/components/Earn.tsx +6 -3
- package/src/widget/components/ErrorDisplay.tsx +6 -4
- package/src/widget/components/Fund.tsx +6 -3
- package/src/widget/components/FundSwap.tsx +2 -1
- package/src/widget/components/Pay.tsx +15 -7
- package/src/widget/components/PoolDeposit.tsx +6 -3
- package/src/widget/components/QuoteDetails.tsx +34 -38
- package/src/widget/components/Swap.tsx +2 -1
- package/src/widget/components/TokenImage.tsx +3 -1
- package/src/widget/components/TransactionDetails.tsx +108 -0
- package/src/widget/hooks/useAmountUsd.ts +0 -3
- package/src/widget/hooks/useDefaultTokenSelection.tsx +0 -3
- package/src/widget/hooks/useGetIntent.ts +53 -0
- package/src/widget/hooks/useIntentTransactionHistory.ts +85 -3
- package/src/widget/hooks/useQuote.ts +16 -10
- package/src/widget/hooks/useSendForm.ts +30 -15
- package/src/widget/hooks/useTokenList.ts +2 -4
- package/src/widget/hooks/useTrailsSendTransaction.ts +2 -1
- package/src/widget/widget.tsx +12 -6
- package/dist/sequenceWallet.d.ts +0 -67
- package/dist/sequenceWallet.d.ts.map +0 -1
- package/src/sequenceWallet.ts +0 -532
package/src/tokenBalances.ts
CHANGED
|
@@ -256,11 +256,7 @@ export interface GetTokenBalancesWithPrice {
|
|
|
256
256
|
>
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
export function useTokenBalances(
|
|
260
|
-
address: Address.Address,
|
|
261
|
-
indexerGatewayClient?: SequenceIndexerGateway,
|
|
262
|
-
sequenceApiClient?: TrailsClient,
|
|
263
|
-
): {
|
|
259
|
+
export function useTokenBalances(address: Address.Address | null): {
|
|
264
260
|
tokenBalancesData: GetTokenBalancesSummaryReturn | undefined
|
|
265
261
|
isLoadingBalances: boolean
|
|
266
262
|
isLoadingPrices: boolean
|
|
@@ -268,13 +264,8 @@ export function useTokenBalances(
|
|
|
268
264
|
balanceError: Error | null
|
|
269
265
|
sortedTokens: Token[]
|
|
270
266
|
} {
|
|
271
|
-
//
|
|
272
|
-
const
|
|
273
|
-
const hookTrailsClient = useTrailsClient()
|
|
274
|
-
|
|
275
|
-
// Use passed parameters if available, otherwise use hook results
|
|
276
|
-
const indexerClient = indexerGatewayClient ?? hookIndexerClient
|
|
277
|
-
const apiClient = sequenceApiClient ?? hookTrailsClient
|
|
267
|
+
// Use hooks to get clients
|
|
268
|
+
const indexerClient = useIndexerGatewayClient()
|
|
278
269
|
|
|
279
270
|
// Fetch token balances with improved query key structure
|
|
280
271
|
const {
|
|
@@ -285,7 +276,7 @@ export function useTokenBalances(
|
|
|
285
276
|
queryKey: ["getTokenBalancesWithPrices", "summary", address],
|
|
286
277
|
queryFn: async (): Promise<GetTokenBalancesWithPrice> => {
|
|
287
278
|
if (!address) {
|
|
288
|
-
logger.console.warn("[trails-sdk] No account address
|
|
279
|
+
logger.console.warn("[trails-sdk] No account address provided")
|
|
289
280
|
return {
|
|
290
281
|
balances: [],
|
|
291
282
|
nativeBalances: [],
|
|
@@ -377,7 +368,6 @@ export function useTokenBalances(
|
|
|
377
368
|
}
|
|
378
369
|
}),
|
|
379
370
|
) ?? [],
|
|
380
|
-
apiClient,
|
|
381
371
|
)
|
|
382
372
|
|
|
383
373
|
const { data: sortedTokens = [], isLoading: isLoadingSortedTokens } =
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from "viem"
|
|
8
8
|
import { JsonEncode } from "@0xtrails/api"
|
|
9
9
|
import { getChainRpcClient } from "../../chains.js"
|
|
10
|
-
import type { FeeOption, TrailsApi } from "@0xtrails/api"
|
|
10
|
+
import type { FeeOption, TrailsApi, RouteProvider } from "@0xtrails/api"
|
|
11
11
|
import type { IntentTransaction } from "@0xtrails/api"
|
|
12
12
|
import type { PrepareSendReturn, SendReturn } from "../types.js"
|
|
13
13
|
import type { TransactionState } from "../../transactions.js"
|
|
@@ -116,7 +116,8 @@ export async function handleCrossChain({
|
|
|
116
116
|
slippageTolerance,
|
|
117
117
|
tradeType,
|
|
118
118
|
originNativeTokenPriceUsd,
|
|
119
|
-
|
|
119
|
+
swapProvider,
|
|
120
|
+
bridgeProvider,
|
|
120
121
|
fundMethod,
|
|
121
122
|
mode,
|
|
122
123
|
checkoutOnHandlers,
|
|
@@ -159,7 +160,8 @@ export async function handleCrossChain({
|
|
|
159
160
|
slippageTolerance: string
|
|
160
161
|
tradeType: TradeType
|
|
161
162
|
originNativeTokenPriceUsd?: number | null
|
|
162
|
-
|
|
163
|
+
swapProvider?: RouteProvider | null
|
|
164
|
+
bridgeProvider?: RouteProvider | null
|
|
163
165
|
fundMethod?: string
|
|
164
166
|
mode?: "pay" | "fund" | "earn" | "swap"
|
|
165
167
|
checkoutOnHandlers?: Partial<CheckoutOnHandlers>
|
|
@@ -178,8 +180,6 @@ export async function handleCrossChain({
|
|
|
178
180
|
trailsApiKey?: string
|
|
179
181
|
trailsApiUrl?: string
|
|
180
182
|
}): Promise<PrepareSendReturn> {
|
|
181
|
-
const salt = Date.now().toString()
|
|
182
|
-
|
|
183
183
|
const intentArgs = await getIntentArgs(
|
|
184
184
|
mainSignerAddress,
|
|
185
185
|
originChainId,
|
|
@@ -190,10 +190,10 @@ export async function handleCrossChain({
|
|
|
190
190
|
tradeType === TradeType.EXACT_OUTPUT ? swapAmount : "0", // destinationTokenAmount
|
|
191
191
|
recipient,
|
|
192
192
|
destinationCalldata,
|
|
193
|
-
salt,
|
|
194
193
|
slippageTolerance,
|
|
195
194
|
tradeType,
|
|
196
|
-
|
|
195
|
+
swapProvider,
|
|
196
|
+
bridgeProvider,
|
|
197
197
|
undefined, // connector - not available in this context
|
|
198
198
|
walletId, // walletId - use this to check for Sequence wallets
|
|
199
199
|
isSmartWallet, // isSmartWallet - force onlyNativeGasFee when true
|
|
@@ -350,6 +350,19 @@ export async function handleCrossChain({
|
|
|
350
350
|
estimatedGasLimitForQuote,
|
|
351
351
|
)
|
|
352
352
|
|
|
353
|
+
if (
|
|
354
|
+
intent.quote?.routeProviders &&
|
|
355
|
+
intent.quote.routeProviders.length === 1
|
|
356
|
+
) {
|
|
357
|
+
swapProvider = intent.quote.routeProviders[0]!
|
|
358
|
+
} else if (
|
|
359
|
+
intent.quote?.routeProviders &&
|
|
360
|
+
intent.quote.routeProviders.length === 2
|
|
361
|
+
) {
|
|
362
|
+
swapProvider = intent.quote.routeProviders[0]!
|
|
363
|
+
bridgeProvider = intent.quote.routeProviders[1]!
|
|
364
|
+
}
|
|
365
|
+
|
|
353
366
|
const quote = await getNormalizedQuoteObject({
|
|
354
367
|
originDepositAddress: originIntentAddress,
|
|
355
368
|
destinationDepositAddress: intent.destinationIntentAddress,
|
|
@@ -377,7 +390,6 @@ export async function handleCrossChain({
|
|
|
377
390
|
priceImpactUsd: getPriceImpactUsdFromIntent(intent),
|
|
378
391
|
transactionStates,
|
|
379
392
|
originNativeTokenPriceUsd,
|
|
380
|
-
quoteProvider: intent.quote?.quoteProvider,
|
|
381
393
|
noSufficientBalance,
|
|
382
394
|
estimatedGasLimit: estimatedGasLimitForQuote,
|
|
383
395
|
intent,
|
|
@@ -1347,8 +1359,7 @@ export async function handleCrossChain({
|
|
|
1347
1359
|
logger.console.log(
|
|
1348
1360
|
"[trails-sdk] Starting destinationSendMetaTxnPromise",
|
|
1349
1361
|
{
|
|
1350
|
-
|
|
1351
|
-
hasQuoteProviderRequestId: !!intent.quote.quoteProviderRequestId,
|
|
1362
|
+
routeProviders: intent.quote.routeProviders || [],
|
|
1352
1363
|
hasPrecondition1: !!destinationPre,
|
|
1353
1364
|
hasMetaTxn1: !!destinationMeta,
|
|
1354
1365
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Account, Chain, WalletClient, TransactionReceipt } from "viem"
|
|
2
2
|
import { formatUnits } from "viem"
|
|
3
3
|
import { getChainRpcClient } from "../../chains.js"
|
|
4
|
-
import type { FeeOption, TrailsApi } from "@0xtrails/api"
|
|
4
|
+
import type { FeeOption, TrailsApi, RouteProvider } from "@0xtrails/api"
|
|
5
5
|
import type { PrepareSendReturn, SendReturn } from "../types.js"
|
|
6
6
|
import type { IntentTransaction } from "@0xtrails/api"
|
|
7
7
|
import type { TransactionState } from "../../transactions.js"
|
|
@@ -62,7 +62,7 @@ export async function handleSameChainSameToken({
|
|
|
62
62
|
destinationTokenPriceUsd,
|
|
63
63
|
originNativeTokenPriceUsd,
|
|
64
64
|
slippageTolerance,
|
|
65
|
-
|
|
65
|
+
swapProvider,
|
|
66
66
|
checkoutOnHandlers,
|
|
67
67
|
mode,
|
|
68
68
|
fundMethod,
|
|
@@ -97,7 +97,7 @@ export async function handleSameChainSameToken({
|
|
|
97
97
|
destinationTokenPriceUsd?: number | null
|
|
98
98
|
originNativeTokenPriceUsd?: number | null
|
|
99
99
|
slippageTolerance: string
|
|
100
|
-
|
|
100
|
+
swapProvider?: RouteProvider | null
|
|
101
101
|
checkoutOnHandlers?: Partial<CheckoutOnHandlers>
|
|
102
102
|
mode?: "pay" | "fund" | "earn" | "swap"
|
|
103
103
|
fundMethod?: string
|
|
@@ -201,7 +201,6 @@ export async function handleSameChainSameToken({
|
|
|
201
201
|
destinationChainId: effectiveOriginChainId,
|
|
202
202
|
originNativeTokenPriceUsd,
|
|
203
203
|
slippageTolerance,
|
|
204
|
-
quoteProvider: quoteProvider || "direct",
|
|
205
204
|
noSufficientBalance,
|
|
206
205
|
estimatedGasLimit: estimatedGasLimitForQuote,
|
|
207
206
|
trailsApiKey: trailsApiKey || "",
|
|
@@ -451,7 +450,6 @@ export async function handleSameChainSameToken({
|
|
|
451
450
|
}
|
|
452
451
|
|
|
453
452
|
// For same-chain transactions, use Intent flow to support gasless deposits
|
|
454
|
-
const salt = Date.now().toString()
|
|
455
453
|
const intentArgs = await getIntentArgs(
|
|
456
454
|
mainSignerAddress,
|
|
457
455
|
effectiveOriginChainId,
|
|
@@ -462,10 +460,10 @@ export async function handleSameChainSameToken({
|
|
|
462
460
|
"0", // destinationTokenAmount (exact input)
|
|
463
461
|
recipient,
|
|
464
462
|
destinationCalldata,
|
|
465
|
-
salt,
|
|
466
463
|
slippageTolerance,
|
|
467
464
|
TradeType.EXACT_INPUT,
|
|
468
|
-
|
|
465
|
+
swapProvider,
|
|
466
|
+
null,
|
|
469
467
|
undefined, // connector - not available in this context
|
|
470
468
|
walletId, // walletId - use this to check for Sequence wallets
|
|
471
469
|
isSmartWallet, // isSmartWallet - force onlyNativeGasFee when true
|
|
@@ -534,6 +532,13 @@ export async function handleSameChainSameToken({
|
|
|
534
532
|
estimatedGasLimitForQuote,
|
|
535
533
|
)
|
|
536
534
|
|
|
535
|
+
if (
|
|
536
|
+
intent.quote?.routeProviders &&
|
|
537
|
+
intent.quote.routeProviders.length === 1
|
|
538
|
+
) {
|
|
539
|
+
swapProvider = intent.quote.routeProviders[0]!
|
|
540
|
+
}
|
|
541
|
+
|
|
537
542
|
const quote = await getNormalizedQuoteObject({
|
|
538
543
|
originDepositAddress: intent.originIntentAddress,
|
|
539
544
|
destinationDepositAddress: intent.destinationIntentAddress,
|
|
@@ -552,7 +557,6 @@ export async function handleSameChainSameToken({
|
|
|
552
557
|
destinationChainId: effectiveOriginChainId,
|
|
553
558
|
originNativeTokenPriceUsd,
|
|
554
559
|
slippageTolerance,
|
|
555
|
-
quoteProvider: intent.quote?.quoteProvider || "",
|
|
556
560
|
noSufficientBalance,
|
|
557
561
|
estimatedGasLimit: estimatedGasLimitForQuote,
|
|
558
562
|
intent,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Intent } from "@0xtrails/api"
|
|
1
|
+
import type { Intent, RouteProvider } from "@0xtrails/api"
|
|
2
2
|
import type { TransactionState } from "../../transactions.js"
|
|
3
3
|
import type { PrepareSendQuote, PrepareSendFees } from "../types.js"
|
|
4
|
-
import type {
|
|
4
|
+
import type { RouteProviderInfo } from "../../widget/hooks/useQuote.js"
|
|
5
5
|
import { formatUnits } from "viem"
|
|
6
6
|
import { mainnet } from "viem/chains"
|
|
7
7
|
import { getTokenInfo } from "../../tokens.js"
|
|
@@ -64,7 +64,6 @@ export async function getNormalizedQuoteObject({
|
|
|
64
64
|
priceImpact,
|
|
65
65
|
priceImpactUsd,
|
|
66
66
|
originNativeTokenPriceUsd,
|
|
67
|
-
quoteProvider,
|
|
68
67
|
noSufficientBalance,
|
|
69
68
|
estimatedGasLimit,
|
|
70
69
|
intent,
|
|
@@ -91,7 +90,6 @@ export async function getNormalizedQuoteObject({
|
|
|
91
90
|
priceImpact?: string
|
|
92
91
|
priceImpactUsd?: string
|
|
93
92
|
originNativeTokenPriceUsd?: number | null
|
|
94
|
-
quoteProvider?: string
|
|
95
93
|
noSufficientBalance?: boolean
|
|
96
94
|
estimatedGasLimit?: bigint
|
|
97
95
|
intent?: Intent
|
|
@@ -262,30 +260,34 @@ export async function getNormalizedQuoteObject({
|
|
|
262
260
|
destinationToken.symbol,
|
|
263
261
|
)
|
|
264
262
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
263
|
+
// Map RouteProvider enum values to display names and URLs
|
|
264
|
+
const routeProviderInfo: Record<
|
|
265
|
+
RouteProvider,
|
|
266
|
+
{ name: string; url: string }
|
|
267
|
+
> = {
|
|
268
|
+
AUTO: { name: "", url: "" },
|
|
269
|
+
CCTP: { name: "Circle CCTP", url: "https://www.circle.com/" },
|
|
270
|
+
RELAY: { name: "Relay", url: "https://relay.link/" },
|
|
271
|
+
LIFI: { name: "LiFi", url: "https://li.fi/" },
|
|
272
|
+
ZEROX: { name: "0x", url: "https://0x.org/" },
|
|
273
|
+
SUSHI: { name: "Sushi", url: "https://www.sushi.com/" },
|
|
272
274
|
}
|
|
273
275
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
276
|
+
// Build routeProviders array from intent.quote.routeProviders
|
|
277
|
+
const routeProviders: RouteProviderInfo[] =
|
|
278
|
+
intent?.quote?.routeProviders && Array.isArray(intent.quote.routeProviders)
|
|
279
|
+
? intent.quote.routeProviders.map((provider) => {
|
|
280
|
+
const info = routeProviderInfo[provider] || {
|
|
281
|
+
name: provider,
|
|
282
|
+
url: "",
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
id: provider,
|
|
286
|
+
name: info.name,
|
|
287
|
+
url: info.url,
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
: []
|
|
289
291
|
|
|
290
292
|
const priceImpactUsdDisplay = formatUsdAmountDisplay(priceImpactUsd)
|
|
291
293
|
|
|
@@ -401,7 +403,7 @@ export async function getNormalizedQuoteObject({
|
|
|
401
403
|
destinationAmountMinDisplay: formatAmountDisplay(
|
|
402
404
|
destinationAmountMinFormatted,
|
|
403
405
|
),
|
|
404
|
-
|
|
406
|
+
routeProviders,
|
|
405
407
|
noSufficientBalance: noSufficientBalance || false,
|
|
406
408
|
trailsFeeBreakdown,
|
|
407
409
|
grandTotalUsd,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QuoteIntentRequest } from "@0xtrails/api"
|
|
1
|
+
import type { QuoteIntentRequest, RouteProvider } from "@0xtrails/api"
|
|
2
2
|
import type { Connector } from "wagmi"
|
|
3
3
|
import { getIsCustomCalldata } from "../../contractUtils.js"
|
|
4
4
|
import {
|
|
@@ -19,21 +19,16 @@ export async function getIntentArgs(
|
|
|
19
19
|
destinationTokenAmount: string,
|
|
20
20
|
recipient: string,
|
|
21
21
|
destinationCalldata: string | undefined,
|
|
22
|
-
_destinationSalt: string = Date.now().toString(),
|
|
23
22
|
slippageTolerance: string, // 0.03 = 3%
|
|
24
23
|
tradeType: TradeType,
|
|
25
|
-
|
|
24
|
+
swapProvider?: RouteProvider | null,
|
|
25
|
+
bridgeProvider?: RouteProvider | null,
|
|
26
26
|
connector?: Connector | undefined,
|
|
27
27
|
walletId?: string | undefined,
|
|
28
28
|
isSmartWallet?: boolean,
|
|
29
29
|
): Promise<QuoteIntentRequest> {
|
|
30
30
|
const hasCustomCalldata = getIsCustomCalldata(destinationCalldata)
|
|
31
31
|
|
|
32
|
-
let effectiveProvider = provider
|
|
33
|
-
if (provider === "auto") {
|
|
34
|
-
effectiveProvider = undefined
|
|
35
|
-
}
|
|
36
|
-
|
|
37
32
|
// Check if wallet is Sequence wallet (via connector or walletId)
|
|
38
33
|
const isSequence = connector
|
|
39
34
|
? isSequenceWallet(connector)
|
|
@@ -74,7 +69,8 @@ export async function getIntentArgs(
|
|
|
74
69
|
onlyNativeGasFee,
|
|
75
70
|
options: {
|
|
76
71
|
slippageTolerance: Number(slippageTolerance),
|
|
77
|
-
|
|
72
|
+
swapProvider: swapProvider || undefined,
|
|
73
|
+
bridgeProvider: bridgeProvider || undefined,
|
|
78
74
|
},
|
|
79
75
|
tradeType,
|
|
80
76
|
}
|
|
@@ -13,11 +13,12 @@ import type {
|
|
|
13
13
|
FeeOption,
|
|
14
14
|
GasFeeOptions,
|
|
15
15
|
ExecuteIntentResponse,
|
|
16
|
+
RouteProvider,
|
|
16
17
|
} from "@0xtrails/api"
|
|
17
18
|
import type { TransactionState } from "../transactions.js"
|
|
18
19
|
import type { Token } from "../tokens.js"
|
|
19
20
|
import type { CheckoutOnHandlers } from "../widget/hooks/useCheckout.js"
|
|
20
|
-
import type {
|
|
21
|
+
import type { RouteProviderInfo } from "../widget/hooks/useQuote.js"
|
|
21
22
|
import type { TrailsFeeBreakdown } from "../fees.js"
|
|
22
23
|
import type { IntentTransaction } from "@0xtrails/api"
|
|
23
24
|
|
|
@@ -54,7 +55,8 @@ export type PrepareSendOptions = {
|
|
|
54
55
|
gasless?: boolean
|
|
55
56
|
slippageTolerance?: string
|
|
56
57
|
originNativeTokenPriceUsd?: number | null
|
|
57
|
-
|
|
58
|
+
swapProvider?: RouteProvider | null
|
|
59
|
+
bridgeProvider?: RouteProvider | null
|
|
58
60
|
fundMethod?: string
|
|
59
61
|
mode?: "pay" | "fund" | "earn" | "swap"
|
|
60
62
|
originPublicClient?: PublicClient
|
|
@@ -125,7 +127,7 @@ export type PrepareSendQuote = {
|
|
|
125
127
|
gasCostFormatted: string
|
|
126
128
|
originTokenRate: string
|
|
127
129
|
destinationTokenRate: string
|
|
128
|
-
|
|
130
|
+
routeProviders?: RouteProviderInfo[]
|
|
129
131
|
noSufficientBalance: boolean
|
|
130
132
|
trailsFeeBreakdown?: TrailsFeeBreakdown | null
|
|
131
133
|
grandTotalUsd?: number
|
package/src/transactions.ts
CHANGED
|
@@ -265,6 +265,7 @@ export type IntentTransaction = {
|
|
|
265
265
|
originIntentAddress: string
|
|
266
266
|
destinationIntentAddress: string
|
|
267
267
|
mainSigner: string
|
|
268
|
+
intentId?: string
|
|
268
269
|
metaTxnId?: string
|
|
269
270
|
txnHash?: string
|
|
270
271
|
executionStatus?: string
|
|
@@ -279,6 +280,10 @@ export type IntentTransaction = {
|
|
|
279
280
|
// Transaction hashes from API response
|
|
280
281
|
originTransactionHash?: string // Transaction hash from API
|
|
281
282
|
destinationTransactionHash?: string // Transaction hash from API
|
|
283
|
+
// Transaction statuses from API response
|
|
284
|
+
depositTransactionStatus?: string // Deposit transaction status from API
|
|
285
|
+
originTransactionStatus?: string // Origin transaction status from API
|
|
286
|
+
destinationTransactionStatus?: string // Destination transaction status from API
|
|
282
287
|
// Enriched token information
|
|
283
288
|
originToken?: {
|
|
284
289
|
symbol: string
|