0xtrails 0.1.2 → 0.1.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/analytics.d.ts +68 -1
- package/dist/analytics.d.ts.map +1 -1
- package/dist/{ccip-BmFTEOaB.js → ccip-CWd4g9uZ.js} +1 -1
- package/dist/chains.d.ts +9 -3
- package/dist/chains.d.ts.map +1 -1
- package/dist/ens.d.ts +7 -0
- package/dist/ens.d.ts.map +1 -0
- package/dist/error.d.ts +2 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/{index-BPsVj7zK.js → index-BTUBzx4R.js} +23624 -21770
- package/dist/index.js +2 -2
- package/dist/lifi.d.ts +4 -0
- package/dist/lifi.d.ts.map +1 -0
- package/dist/mode.d.ts +1 -1
- package/dist/mode.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +3 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +2 -0
- package/dist/prices.d.ts.map +1 -1
- package/dist/relaySdk.d.ts.map +1 -1
- package/dist/relayer.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +2 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trails.d.ts +3 -3
- package/dist/trails.d.ts.map +1 -1
- package/dist/transactions.d.ts.map +1 -1
- package/dist/wallets.d.ts +247 -5
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/ChainFilterDropdown.d.ts +2 -0
- package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts +1 -0
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/DebugScreensDropdown.d.ts.map +1 -1
- package/dist/widget/components/FundSendForm.d.ts +2 -2
- package/dist/widget/components/FundSendForm.d.ts.map +1 -1
- package/dist/widget/components/PaySendForm.d.ts +2 -2
- package/dist/widget/components/PaySendForm.d.ts.map +1 -1
- package/dist/widget/components/QrCode.d.ts +1 -1
- package/dist/widget/components/QrCode.d.ts.map +1 -1
- package/dist/widget/components/RefundAddressInput.d.ts +13 -0
- package/dist/widget/components/RefundAddressInput.d.ts.map +1 -0
- package/dist/widget/components/Swap.d.ts +43 -0
- package/dist/widget/components/Swap.d.ts.map +1 -0
- package/dist/widget/components/TokenList.d.ts +0 -2
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts +26 -0
- package/dist/widget/components/TokenSelector.d.ts.map +1 -0
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/components/WalletConnectionPending.d.ts +12 -0
- package/dist/widget/components/WalletConnectionPending.d.ts.map +1 -0
- package/dist/widget/components/WalletList.d.ts.map +1 -1
- package/dist/widget/hooks/useAmountUsd.d.ts +1 -3
- package/dist/widget/hooks/useAmountUsd.d.ts.map +1 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +6 -4
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts +2 -3
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +9 -6
- package/src/aave.ts +13 -13
- package/src/analytics.ts +87 -4
- package/src/chains.ts +45 -7
- package/src/constants.ts +4 -4
- package/src/ens.ts +17 -0
- package/src/error.ts +16 -1
- package/src/lifi.ts +58 -0
- package/src/mode.ts +1 -1
- package/src/morpho.ts +3 -3
- package/src/pools.ts +18 -18
- package/src/prepareSend.ts +35 -3
- package/src/prices.ts +21 -0
- package/src/relaySdk.ts +1 -0
- package/src/relayer.ts +8 -0
- package/src/tokenBalances.ts +3 -0
- package/src/tokens.ts +85 -19
- package/src/trails.ts +2 -2
- package/src/transactions.ts +1 -0
- package/src/wallets.ts +275 -35
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/ChainFilterDropdown.tsx +42 -33
- package/src/widget/components/ChainImage.tsx +1 -1
- package/src/widget/components/ConnectWallet.tsx +92 -128
- package/src/widget/components/DebugScreensDropdown.tsx +3 -0
- package/src/widget/components/FundSendForm.tsx +17 -3
- package/src/widget/components/PaySendForm.tsx +16 -2
- package/src/widget/components/QRCodeDeposit.tsx +1 -1
- package/src/widget/components/QrCode.tsx +277 -16
- package/src/widget/components/Receipt.tsx +1 -1
- package/src/widget/components/RefundAddressInput.tsx +149 -0
- package/src/widget/components/Swap.tsx +648 -0
- package/src/widget/components/TokenList.tsx +27 -363
- package/src/widget/components/TokenSelector.tsx +405 -0
- package/src/widget/components/WalletConnect.tsx +9 -7
- package/src/widget/components/WalletConnectionPending.tsx +157 -0
- package/src/widget/components/WalletList.tsx +6 -5
- package/src/widget/hooks/useAmountUsd.ts +3 -8
- package/src/widget/hooks/useCheckout.ts +3 -2
- package/src/widget/hooks/useSendForm.ts +66 -32
- package/src/widget/hooks/useTokenList.ts +158 -106
- package/src/widget/widget.tsx +335 -72
package/src/prepareSend.ts
CHANGED
|
@@ -154,8 +154,10 @@ export type PrepareSendOptions = {
|
|
|
154
154
|
slippageTolerance?: string
|
|
155
155
|
originNativeTokenPriceUsd?: number | null
|
|
156
156
|
quoteProvider?: string | null
|
|
157
|
-
fundMethod?: string
|
|
157
|
+
fundMethod?: string
|
|
158
|
+
mode?: "pay" | "fund" | "earn" | "swap"
|
|
158
159
|
checkoutOnHandlers?: CheckoutOnHandlers
|
|
160
|
+
refundAddress?: string
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
export type PrepareSendFees = {
|
|
@@ -357,6 +359,7 @@ export async function prepareSend(
|
|
|
357
359
|
originNativeTokenPriceUsd,
|
|
358
360
|
quoteProvider,
|
|
359
361
|
fundMethod,
|
|
362
|
+
mode,
|
|
360
363
|
checkoutOnHandlers,
|
|
361
364
|
} = options
|
|
362
365
|
|
|
@@ -404,6 +407,8 @@ export async function prepareSend(
|
|
|
404
407
|
originTokenAddress,
|
|
405
408
|
destinationTokenAddress,
|
|
406
409
|
destinationTokenAmount: swapAmount,
|
|
410
|
+
mode,
|
|
411
|
+
fundMethod,
|
|
407
412
|
})
|
|
408
413
|
|
|
409
414
|
if (originTokenBalance === "0") {
|
|
@@ -414,6 +419,8 @@ export async function prepareSend(
|
|
|
414
419
|
trackPaymentError({
|
|
415
420
|
error: "Wallet client not provided",
|
|
416
421
|
userAddress: account.address,
|
|
422
|
+
mode,
|
|
423
|
+
fundMethod,
|
|
417
424
|
})
|
|
418
425
|
throw new Error("Wallet client not provided")
|
|
419
426
|
}
|
|
@@ -423,6 +430,8 @@ export async function prepareSend(
|
|
|
423
430
|
trackPaymentError({
|
|
424
431
|
error: `Chain ${originChainId} not found`,
|
|
425
432
|
userAddress: account.address,
|
|
433
|
+
mode,
|
|
434
|
+
fundMethod,
|
|
426
435
|
})
|
|
427
436
|
throw new Error(`Chain ${originChainId} not found`)
|
|
428
437
|
}
|
|
@@ -559,6 +568,7 @@ export async function prepareSend(
|
|
|
559
568
|
originNativeTokenPriceUsd,
|
|
560
569
|
quoteProvider,
|
|
561
570
|
fundMethod,
|
|
571
|
+
mode,
|
|
562
572
|
checkoutOnHandlers,
|
|
563
573
|
})
|
|
564
574
|
}
|
|
@@ -596,6 +606,7 @@ async function sendHandlerForDifferentChainDifferentToken({
|
|
|
596
606
|
originNativeTokenPriceUsd,
|
|
597
607
|
quoteProvider,
|
|
598
608
|
fundMethod,
|
|
609
|
+
mode,
|
|
599
610
|
checkoutOnHandlers,
|
|
600
611
|
}: {
|
|
601
612
|
mainSignerAddress: string
|
|
@@ -629,7 +640,8 @@ async function sendHandlerForDifferentChainDifferentToken({
|
|
|
629
640
|
tradeType: TradeType
|
|
630
641
|
originNativeTokenPriceUsd?: number | null
|
|
631
642
|
quoteProvider?: string | null
|
|
632
|
-
fundMethod?: string
|
|
643
|
+
fundMethod?: string
|
|
644
|
+
mode?: "pay" | "fund" | "earn" | "swap"
|
|
633
645
|
checkoutOnHandlers?: CheckoutOnHandlers
|
|
634
646
|
}): Promise<PrepareSendReturn> {
|
|
635
647
|
const testnet = isTestnetDebugMode()
|
|
@@ -1256,6 +1268,8 @@ async function sendHandlerForDifferentChainDifferentToken({
|
|
|
1256
1268
|
?.txnHash,
|
|
1257
1269
|
originChainId,
|
|
1258
1270
|
destinationChainId,
|
|
1271
|
+
mode,
|
|
1272
|
+
fundMethod,
|
|
1259
1273
|
})
|
|
1260
1274
|
|
|
1261
1275
|
// Call onCheckoutComplete callback if provided
|
|
@@ -1268,6 +1282,8 @@ async function sendHandlerForDifferentChainDifferentToken({
|
|
|
1268
1282
|
error: "Payment transactions did not complete successfully",
|
|
1269
1283
|
userAddress: account.address,
|
|
1270
1284
|
intentAddress,
|
|
1285
|
+
mode,
|
|
1286
|
+
fundMethod,
|
|
1271
1287
|
})
|
|
1272
1288
|
|
|
1273
1289
|
// Call onCheckoutError callback if provided
|
|
@@ -1307,6 +1323,8 @@ async function sendHandlerForSameChainSameToken({
|
|
|
1307
1323
|
originNativeTokenPriceUsd,
|
|
1308
1324
|
slippageTolerance,
|
|
1309
1325
|
checkoutOnHandlers,
|
|
1326
|
+
mode,
|
|
1327
|
+
fundMethod,
|
|
1310
1328
|
}: {
|
|
1311
1329
|
originTokenAddress: string
|
|
1312
1330
|
swapAmount: string
|
|
@@ -1325,6 +1343,8 @@ async function sendHandlerForSameChainSameToken({
|
|
|
1325
1343
|
originNativeTokenPriceUsd?: number | null
|
|
1326
1344
|
slippageTolerance?: string
|
|
1327
1345
|
checkoutOnHandlers?: CheckoutOnHandlers
|
|
1346
|
+
mode?: "pay" | "fund" | "earn" | "swap"
|
|
1347
|
+
fundMethod?: string
|
|
1328
1348
|
}): Promise<PrepareSendReturn> {
|
|
1329
1349
|
console.log("[trails-sdk] isToSameToken && isToSameChain")
|
|
1330
1350
|
const testnet = isTestnetDebugMode()
|
|
@@ -1506,11 +1526,15 @@ async function sendHandlerForSameChainSameToken({
|
|
|
1506
1526
|
userAddress: account.address,
|
|
1507
1527
|
originTxHash: originUserTxReceipt.transactionHash,
|
|
1508
1528
|
originChainId: effectiveOriginChainId, // Same chain
|
|
1529
|
+
mode,
|
|
1530
|
+
fundMethod,
|
|
1509
1531
|
})
|
|
1510
1532
|
} else if (originUserTxReceipt) {
|
|
1511
1533
|
trackPaymentError({
|
|
1512
1534
|
error: "Transaction failed",
|
|
1513
1535
|
userAddress: account.address,
|
|
1536
|
+
mode,
|
|
1537
|
+
fundMethod,
|
|
1514
1538
|
})
|
|
1515
1539
|
}
|
|
1516
1540
|
}
|
|
@@ -1543,6 +1567,8 @@ async function _sendHandlerForSameChainDifferentToken({
|
|
|
1543
1567
|
sourceTokenPriceUsd,
|
|
1544
1568
|
destinationTokenPriceUsd,
|
|
1545
1569
|
originNativeTokenPriceUsd,
|
|
1570
|
+
mode,
|
|
1571
|
+
fundMethod,
|
|
1546
1572
|
}: {
|
|
1547
1573
|
originTokenAddress: string
|
|
1548
1574
|
swapAmount: string
|
|
@@ -1560,6 +1586,8 @@ async function _sendHandlerForSameChainDifferentToken({
|
|
|
1560
1586
|
sourceTokenPriceUsd?: number | null
|
|
1561
1587
|
destinationTokenPriceUsd?: number | null
|
|
1562
1588
|
originNativeTokenPriceUsd?: number | null
|
|
1589
|
+
mode?: "pay" | "fund" | "earn" | "swap"
|
|
1590
|
+
fundMethod?: string
|
|
1563
1591
|
}): Promise<PrepareSendReturn> {
|
|
1564
1592
|
const destinationTxs: { to: string; value: string; data: string }[] = []
|
|
1565
1593
|
const hasCustomCalldata = getIsCustomCalldata(destinationCalldata)
|
|
@@ -1713,11 +1741,15 @@ async function _sendHandlerForSameChainDifferentToken({
|
|
|
1713
1741
|
originTxHash: originUserTxReceipt.transactionHash,
|
|
1714
1742
|
originChainId,
|
|
1715
1743
|
destinationChainId: originChainId, // Same chain
|
|
1744
|
+
mode,
|
|
1745
|
+
fundMethod,
|
|
1716
1746
|
})
|
|
1717
1747
|
} else if (originUserTxReceipt) {
|
|
1718
1748
|
trackPaymentError({
|
|
1719
1749
|
error: "Relay transaction failed",
|
|
1720
1750
|
userAddress: account.address,
|
|
1751
|
+
mode,
|
|
1752
|
+
fundMethod,
|
|
1721
1753
|
})
|
|
1722
1754
|
}
|
|
1723
1755
|
|
|
@@ -2214,7 +2246,7 @@ async function attemptUserDepositTx({
|
|
|
2214
2246
|
fee: string
|
|
2215
2247
|
onTransactionStateChange: (transactionStates: TransactionState[]) => void
|
|
2216
2248
|
transactionStates: TransactionState[]
|
|
2217
|
-
fundMethod?: string
|
|
2249
|
+
fundMethod?: string
|
|
2218
2250
|
}): Promise<TransactionReceipt | null> {
|
|
2219
2251
|
let originUserTxReceipt: TransactionReceipt | null = null
|
|
2220
2252
|
const originChainId = chain.id
|
package/src/prices.ts
CHANGED
|
@@ -204,3 +204,24 @@ export function formatTvl(tvl: number): string {
|
|
|
204
204
|
if (tvl >= 1e3) return `$${(tvl / 1e3).toFixed(1)}K`
|
|
205
205
|
return `$${tvl.toFixed(0)}`
|
|
206
206
|
}
|
|
207
|
+
|
|
208
|
+
// Helper function to validate numeric values
|
|
209
|
+
export const isValidNumeric = (
|
|
210
|
+
value: number | string | null | undefined,
|
|
211
|
+
): boolean => {
|
|
212
|
+
if (value === null || value === undefined || value === "") {
|
|
213
|
+
return true // Empty values are considered valid
|
|
214
|
+
}
|
|
215
|
+
const strValue = String(value).trim()
|
|
216
|
+
return /^\d+(\.\d+)?$/.test(strValue)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export const isValidInteger = (
|
|
220
|
+
value: number | string | null | undefined,
|
|
221
|
+
): boolean => {
|
|
222
|
+
if (value === null || value === undefined || value === "") {
|
|
223
|
+
return true // Empty values are considered valid
|
|
224
|
+
}
|
|
225
|
+
const strValue = String(value).trim()
|
|
226
|
+
return /^\d+$/.test(strValue)
|
|
227
|
+
}
|
package/src/relaySdk.ts
CHANGED
|
@@ -242,6 +242,7 @@ export const relaySupportedChains: Record<number, Chain> = {
|
|
|
242
242
|
[chains.zircuit.id]: chains.zircuit,
|
|
243
243
|
[chains.zksync.id]: chains.zksync,
|
|
244
244
|
[chains.zora.id]: chains.zora,
|
|
245
|
+
[chains.katana.id]: chains.katana,
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
export async function getRelaySupportedChains(): Promise<Chain[]> {
|
package/src/relayer.ts
CHANGED
|
@@ -162,6 +162,10 @@ export function getRelayerUrl(
|
|
|
162
162
|
relayerUrl = "https://v3-xai-relayer.sequence.app"
|
|
163
163
|
} else if (chainId === 56) {
|
|
164
164
|
relayerUrl = "https://v3-bsc-relayer.sequence.app"
|
|
165
|
+
} else if (chainId === 747474) {
|
|
166
|
+
relayerUrl = "https://v3-katana-relayer.sequence.app"
|
|
167
|
+
} else if (chainId === 42793) {
|
|
168
|
+
relayerUrl = "https://v3-etherlink-relayer.sequence.app"
|
|
165
169
|
} else {
|
|
166
170
|
// Fallback to general dev relayer for other chains if V3 is specified but chain not V3-supported
|
|
167
171
|
relayerUrl = `${baseUrl}${getChainInfo(chainId)!.name?.replace(" ", "-")}-relayer.sequence.app`
|
|
@@ -207,6 +211,10 @@ export function getRelayerUrl(
|
|
|
207
211
|
relayerUrl = "https://dev-xai-relayer.sequence.app"
|
|
208
212
|
} else if (chainId === 56) {
|
|
209
213
|
relayerUrl = "https://dev-bsc-relayer.sequence.app"
|
|
214
|
+
} else if (chainId === 747474) {
|
|
215
|
+
relayerUrl = "https://dev-katana-relayer.sequence.app"
|
|
216
|
+
} else if (chainId === 42793) {
|
|
217
|
+
relayerUrl = "https://dev-etherlink-relayer.sequence.app"
|
|
210
218
|
} else {
|
|
211
219
|
// Fallback to general dev relayer for other chains if V3 is specified but chain not V3-supported
|
|
212
220
|
relayerUrl = `${baseUrl}${getChainInfo(chainId)!.name?.replace(" ", "-")}-relayer.sequence.app`
|
package/src/tokenBalances.ts
CHANGED
|
@@ -283,6 +283,9 @@ export function formatRawAmount(
|
|
|
283
283
|
balance: string | bigint,
|
|
284
284
|
decimals: number = 18,
|
|
285
285
|
): string {
|
|
286
|
+
if (!balance) {
|
|
287
|
+
return "0"
|
|
288
|
+
}
|
|
286
289
|
try {
|
|
287
290
|
const formatted = formatUnits(BigInt(balance), decimals)
|
|
288
291
|
return formatAmount(formatted)
|
package/src/tokens.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { QueryClient, useQuery } from "@tanstack/react-query"
|
|
2
2
|
import { zeroAddress, erc20Abi } from "viem"
|
|
3
|
-
import * as chains from "viem/chains"
|
|
4
3
|
import { getChainInfo, getSupportedChains } from "./chains.js"
|
|
4
|
+
import * as chains from "viem/chains"
|
|
5
5
|
import { getRelaySupportedTokens } from "./relaySdk.js"
|
|
6
6
|
import { useReadContracts } from "wagmi"
|
|
7
7
|
import { useMemo } from "react"
|
|
@@ -17,6 +17,21 @@ export type SupportedToken = {
|
|
|
17
17
|
imageUrl: string
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
export const commonTokenImages: Record<string, string> = {
|
|
21
|
+
ETH: "https://assets.sequence.info/images/tokens/large/1/0x0000000000000000000000000000000000000000.webp",
|
|
22
|
+
WETH: "https://assets.coingecko.com/coins/images/39723/small/WETH.PNG?1723733967",
|
|
23
|
+
POL: "https://assets.sequence.info/images/tokens/large/137/0x0000000000000000000000000000000000000000.webp",
|
|
24
|
+
USDC: "https://assets.sequence.info/images/tokens/large/1/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.webp",
|
|
25
|
+
USDT: "https://assets.sequence.info/images/tokens/large/1/0xdac17f958d2ee523a2206206994597c13d831ec7.webp",
|
|
26
|
+
DAI: "https://assets.sequence.info/images/tokens/large/1/0x6b175474e89094c44da98b954eedeac495271d0f.webp",
|
|
27
|
+
WBTC: "https://assets.sequence.info/images/tokens/large/1/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599.webp",
|
|
28
|
+
BAT: "https://assets.sequence.info/images/tokens/large/1/0x0d8775f648430679a709e98d2b0cb6250d2887ef.webp",
|
|
29
|
+
ARB: "https://assets.sequence.info/images/tokens/large/42161/0x912ce59144191c1204e64559fe8253a0e49e6548.webp",
|
|
30
|
+
LINK: "https://assets.sequence.info/images/tokens/large/1/0x514910771af9ca656af840dff83e8264ecf986ca.webp",
|
|
31
|
+
XTZ: "https://assets.sequence.info/images/tokens/large/42793/0x0000000000000000000000000000000000000000.webp",
|
|
32
|
+
WXTZ: "https://assets.coingecko.com/coins/images/976/standard/Tezos-logo.png?1696502091",
|
|
33
|
+
}
|
|
34
|
+
|
|
20
35
|
const cacheVersion = "01"
|
|
21
36
|
|
|
22
37
|
// LocalStorage cache utilities for token images
|
|
@@ -303,8 +318,13 @@ export async function getTokenImageUrlOrFallback({
|
|
|
303
318
|
}
|
|
304
319
|
}
|
|
305
320
|
|
|
321
|
+
export async function getAllTokens(): Promise<SupportedToken[]> {
|
|
322
|
+
const relayTokens = (await getRelaySupportedTokens()) as SupportedToken[]
|
|
323
|
+
return relayTokens
|
|
324
|
+
}
|
|
325
|
+
|
|
306
326
|
export async function getSupportedTokens(): Promise<SupportedToken[]> {
|
|
307
|
-
const tokens = await
|
|
327
|
+
const tokens = await getAllTokens()
|
|
308
328
|
for (const token of tokens) {
|
|
309
329
|
if (!token.imageUrl) {
|
|
310
330
|
token.imageUrl = getTokenImageUrl({
|
|
@@ -342,9 +362,13 @@ export async function getSupportedTokens(): Promise<SupportedToken[]> {
|
|
|
342
362
|
|
|
343
363
|
const supportedChains = await getSupportedChains()
|
|
344
364
|
const allTokens = [...tokens, ...additionalTokens]
|
|
345
|
-
const supportedChainTokens = allTokens.filter((token) =>
|
|
346
|
-
|
|
347
|
-
|
|
365
|
+
const supportedChainTokens = allTokens.filter((token) => {
|
|
366
|
+
// Always include Etherlink tokens
|
|
367
|
+
if (token.chainId === chains.etherlink.id) {
|
|
368
|
+
return true
|
|
369
|
+
}
|
|
370
|
+
return supportedChains.some((chain) => chain.id === token.chainId)
|
|
371
|
+
})
|
|
348
372
|
const uniqueTokens = supportedChainTokens.filter(
|
|
349
373
|
(token, index, self) =>
|
|
350
374
|
index ===
|
|
@@ -357,7 +381,9 @@ export async function getSupportedTokens(): Promise<SupportedToken[]> {
|
|
|
357
381
|
)
|
|
358
382
|
|
|
359
383
|
// Sort tokens according to priority order
|
|
360
|
-
|
|
384
|
+
const sortedTokens = sortTokens(uniqueTokens as SupportedToken[])
|
|
385
|
+
|
|
386
|
+
return sortedTokens
|
|
361
387
|
}
|
|
362
388
|
|
|
363
389
|
export function useSupportedTokens({ chainId }: { chainId?: number } = {}): {
|
|
@@ -426,6 +452,7 @@ export const tokenNamePrefixes: Record<string, string> = {
|
|
|
426
452
|
[chains.optimism.id]: "Optimistic",
|
|
427
453
|
[chains.arbitrum.id]: "Arbitrum",
|
|
428
454
|
[chains.polygon.id]: "Polygon",
|
|
455
|
+
[chains.etherlink.id]: "Etherlink",
|
|
429
456
|
}
|
|
430
457
|
|
|
431
458
|
export function getFormatttedTokenName(
|
|
@@ -788,21 +815,8 @@ export function useTokenInfo({
|
|
|
788
815
|
}
|
|
789
816
|
}
|
|
790
817
|
|
|
791
|
-
export const commonTokenImages: Record<string, string> = {
|
|
792
|
-
ETH: "https://assets.sequence.info/images/tokens/large/1/0x0000000000000000000000000000000000000000.webp",
|
|
793
|
-
POL: "https://assets.sequence.info/images/tokens/large/137/0x0000000000000000000000000000000000000000.webp",
|
|
794
|
-
USDC: "https://assets.sequence.info/images/tokens/large/1/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.webp",
|
|
795
|
-
USDT: "https://assets.sequence.info/images/tokens/large/1/0xdac17f958d2ee523a2206206994597c13d831ec7.webp",
|
|
796
|
-
DAI: "https://assets.sequence.info/images/tokens/large/1/0x6b175474e89094c44da98b954eedeac495271d0f.webp",
|
|
797
|
-
WBTC: "https://assets.sequence.info/images/tokens/large/1/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599.webp",
|
|
798
|
-
BAT: "https://assets.sequence.info/images/tokens/large/1/0x0d8775f648430679a709e98d2b0cb6250d2887ef.webp",
|
|
799
|
-
ARB: "https://assets.sequence.info/images/tokens/large/42161/0x912ce59144191c1204e64559fe8253a0e49e6548.webp",
|
|
800
|
-
LINK: "https://assets.sequence.info/images/tokens/large/1/0x514910771af9ca656af840dff83e8264ecf986ca.webp",
|
|
801
|
-
}
|
|
802
|
-
|
|
803
818
|
export const tokenImageSymbolMap: Record<string, string> = {
|
|
804
819
|
ETH: "ETH",
|
|
805
|
-
WETH: "ETH",
|
|
806
820
|
cbETH: "ETH",
|
|
807
821
|
POL: "POL",
|
|
808
822
|
WPOL: "POL",
|
|
@@ -1018,6 +1032,58 @@ export const commonTokens: SupportedToken[] = [
|
|
|
1018
1032
|
chainName: chains.mainnet.name,
|
|
1019
1033
|
imageUrl: commonTokenImages.LINK!,
|
|
1020
1034
|
},
|
|
1035
|
+
|
|
1036
|
+
// Etherlink tokens
|
|
1037
|
+
{
|
|
1038
|
+
id: "XTZ-etherlink",
|
|
1039
|
+
symbol: "XTZ",
|
|
1040
|
+
name: "Tezos",
|
|
1041
|
+
contractAddress: "0x0000000000000000000000000000000000000000",
|
|
1042
|
+
decimals: 18,
|
|
1043
|
+
chainId: chains.etherlink.id,
|
|
1044
|
+
chainName: chains.etherlink.name,
|
|
1045
|
+
imageUrl: commonTokenImages.XTZ as string,
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
id: "WXTZ-etherlink",
|
|
1049
|
+
symbol: "WXTZ",
|
|
1050
|
+
name: "Wrapped XTZ",
|
|
1051
|
+
contractAddress: "0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb",
|
|
1052
|
+
decimals: 18,
|
|
1053
|
+
chainId: chains.etherlink.id,
|
|
1054
|
+
chainName: chains.etherlink.name,
|
|
1055
|
+
imageUrl: commonTokenImages.WXTZ as string,
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
id: "USDC-etherlink",
|
|
1059
|
+
symbol: "USDC",
|
|
1060
|
+
name: "USD Coin",
|
|
1061
|
+
contractAddress: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
|
|
1062
|
+
decimals: 6,
|
|
1063
|
+
chainId: chains.etherlink.id,
|
|
1064
|
+
chainName: chains.etherlink.name,
|
|
1065
|
+
imageUrl: commonTokenImages.USDC as string,
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
id: "WETH-etherlink",
|
|
1069
|
+
symbol: "WETH",
|
|
1070
|
+
name: "Wrapped ETH",
|
|
1071
|
+
contractAddress: "0xfc24f770F94edBca6D6f885E12d4317320BcB401",
|
|
1072
|
+
decimals: 18,
|
|
1073
|
+
chainId: chains.etherlink.id,
|
|
1074
|
+
chainName: chains.etherlink.name,
|
|
1075
|
+
imageUrl: commonTokenImages.WETH as string,
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
id: "USDT-etherlink",
|
|
1079
|
+
symbol: "USDT",
|
|
1080
|
+
name: "Bridged USDT",
|
|
1081
|
+
contractAddress: "0x2C03058C8AFC06713be23e58D2febC8337dbfE6A",
|
|
1082
|
+
decimals: 6,
|
|
1083
|
+
chainId: chains.etherlink.id,
|
|
1084
|
+
chainName: chains.etherlink.name,
|
|
1085
|
+
imageUrl: commonTokenImages.USDT as string,
|
|
1086
|
+
},
|
|
1021
1087
|
]
|
|
1022
1088
|
|
|
1023
1089
|
export const wethAddresses: Record<string, string> = {
|
package/src/trails.ts
CHANGED
|
@@ -98,7 +98,7 @@ export type UseTrailsReturn = {
|
|
|
98
98
|
mainSignerAddress: string
|
|
99
99
|
calls: IntentCallsPayload[]
|
|
100
100
|
preconditions: IntentPrecondition[]
|
|
101
|
-
quoteProvider:
|
|
101
|
+
quoteProvider: QuoteProvider
|
|
102
102
|
addressOverrides?: AddressOverrides
|
|
103
103
|
}) => void
|
|
104
104
|
commitIntentConfigPending: boolean
|
|
@@ -109,7 +109,7 @@ export type UseTrailsReturn = {
|
|
|
109
109
|
mainSignerAddress: string
|
|
110
110
|
calls: IntentCallsPayload[]
|
|
111
111
|
preconditions: IntentPrecondition[]
|
|
112
|
-
quoteProvider:
|
|
112
|
+
quoteProvider: QuoteProvider
|
|
113
113
|
addressOverrides?: AddressOverrides
|
|
114
114
|
}
|
|
115
115
|
| undefined
|
package/src/transactions.ts
CHANGED
|
@@ -180,6 +180,7 @@ const chainIdToIndexerUrl = {
|
|
|
180
180
|
660279: "https://xai-indexer.sequence.app",
|
|
181
181
|
56: "https://bsc-indexer.sequence.app",
|
|
182
182
|
421613: "https://arbitrum-nova-sepolia-indexer.sequence.app",
|
|
183
|
+
42793: "https://etherlink-indexer.sequence.app",
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
export async function getAccountTransactionHistory({
|