0xtrails 0.1.13 → 0.2.1
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/analytics.d.ts +12 -2
- package/dist/analytics.d.ts.map +1 -1
- package/dist/apiClient.d.ts +1 -1
- package/dist/apiClient.d.ts.map +1 -1
- package/dist/{ccip-D3gTQONK.js → ccip-BbfANth7.js} +12 -12
- package/dist/cctp.d.ts.map +1 -1
- package/dist/cctpqueue.d.ts +3 -3
- package/dist/cctpqueue.d.ts.map +1 -1
- package/dist/chains.d.ts.map +1 -1
- package/dist/config.d.ts +18 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +6 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/contractUtils.d.ts +2 -0
- package/dist/contractUtils.d.ts.map +1 -1
- package/dist/customChains.d.ts +24 -0
- package/dist/customChains.d.ts.map +1 -0
- package/dist/gasless.d.ts +19 -7
- package/dist/gasless.d.ts.map +1 -1
- package/dist/{index-CnUM7lKf.js → index-WpIVoh3X.js} +36741 -31761
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +405 -394
- package/dist/indexerClient.d.ts +10 -0
- package/dist/indexerClient.d.ts.map +1 -1
- package/dist/intentEntrypoint.d.ts +122 -0
- package/dist/intentEntrypoint.d.ts.map +1 -0
- package/dist/intents.d.ts +5 -3
- package/dist/intents.d.ts.map +1 -1
- package/dist/metaTxnMonitor.d.ts.map +1 -1
- package/dist/morpho.d.ts.map +1 -1
- package/dist/pools.d.ts +3 -1
- package/dist/pools.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +18 -9
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +1 -1
- 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/toast.d.ts +9 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/tokenBalances.d.ts +6 -2
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trails.d.ts +6 -5
- package/dist/trails.d.ts.map +1 -1
- package/dist/trailsClient.d.ts +12 -0
- package/dist/trailsClient.d.ts.map +1 -0
- package/dist/trailsRouter.d.ts +22 -0
- package/dist/trailsRouter.d.ts.map +1 -0
- package/dist/transactions.d.ts +8 -1
- package/dist/transactions.d.ts.map +1 -1
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountActionsDropdown.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/AccountSettings.d.ts +7 -0
- package/dist/widget/components/AccountSettings.d.ts.map +1 -0
- package/dist/widget/components/ChainList.d.ts +0 -1
- package/dist/widget/components/ChainList.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +46 -0
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -0
- package/dist/widget/components/ConfigDisplay.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts +9 -0
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -0
- package/dist/widget/components/DebugMenu.d.ts.map +1 -1
- package/dist/widget/components/DebugScreensList.d.ts.map +1 -1
- package/dist/widget/components/DebugToast.d.ts +3 -0
- package/dist/widget/components/DebugToast.d.ts.map +1 -0
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/EarnPools.d.ts.map +1 -1
- package/dist/widget/components/FeeOption.d.ts +22 -0
- package/dist/widget/components/FeeOption.d.ts.map +1 -0
- package/dist/widget/components/FeeOptions.d.ts +13 -17
- package/dist/widget/components/FeeOptions.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +44 -0
- package/dist/widget/components/Fund.d.ts.map +1 -0
- package/dist/widget/components/FundMethods.d.ts +1 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/FundSendForm.d.ts.map +1 -1
- package/dist/widget/components/Identicon.d.ts +9 -0
- package/dist/widget/components/Identicon.d.ts.map +1 -0
- package/dist/widget/components/MeshConnectExchanges.d.ts +5 -2
- package/dist/widget/components/MeshConnectExchanges.d.ts.map +1 -1
- package/dist/widget/components/MeshConnectFlow.d.ts +2 -0
- package/dist/widget/components/MeshConnectFlow.d.ts.map +1 -1
- package/dist/widget/components/NativeGasOption.d.ts +12 -0
- package/dist/widget/components/NativeGasOption.d.ts.map +1 -0
- package/dist/widget/components/Pay.d.ts +46 -0
- package/dist/widget/components/Pay.d.ts.map +1 -0
- package/dist/widget/components/PaySendForm.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receive.d.ts.map +1 -1
- package/dist/widget/components/RecentTokens.d.ts.map +1 -1
- package/dist/widget/components/Recipients.d.ts +9 -0
- package/dist/widget/components/Recipients.d.ts.map +1 -0
- package/dist/widget/components/RefundWarning.d.ts +9 -0
- package/dist/widget/components/RefundWarning.d.ts.map +1 -0
- package/dist/widget/components/SimpleSwap.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/SwapSettings.d.ts +1 -5
- package/dist/widget/components/SwapSettings.d.ts.map +1 -1
- package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
- package/dist/widget/components/ThemeSyncer.d.ts +6 -0
- package/dist/widget/components/ThemeSyncer.d.ts.map +1 -0
- package/dist/widget/components/Toast.d.ts +24 -0
- package/dist/widget/components/Toast.d.ts.map +1 -0
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
- package/dist/widget/components/TruncatedAddress.d.ts +2 -0
- package/dist/widget/components/TruncatedAddress.d.ts.map +1 -1
- package/dist/widget/components/UserPreferences.d.ts +7 -0
- package/dist/widget/components/UserPreferences.d.ts.map +1 -0
- package/dist/widget/hooks/useBack.d.ts +2 -0
- package/dist/widget/hooks/useBack.d.ts.map +1 -1
- package/dist/widget/hooks/useBalanceVisible.d.ts +1 -0
- package/dist/widget/hooks/useBalanceVisible.d.ts.map +1 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
- package/dist/widget/hooks/useDebugScreens.d.ts +1 -1
- package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts +54 -0
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -0
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/usePayMessage.d.ts +34 -0
- package/dist/widget/hooks/usePayMessage.d.ts.map +1 -0
- package/dist/widget/hooks/useRecipients.d.ts +17 -0
- package/dist/widget/hooks/useRecipients.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedFeeToken.d.ts +32 -0
- package/dist/widget/hooks/useSelectedFeeToken.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedMeshExchange.d.ts +14 -0
- package/dist/widget/hooks/useSelectedMeshExchange.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedRecipient.d.ts +12 -0
- package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -0
- package/dist/widget/hooks/useSendForm.d.ts +10 -13
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useSwapAmount.d.ts +13 -0
- package/dist/widget/hooks/useSwapAmount.d.ts.map +1 -0
- package/dist/widget/hooks/useSwapSettings.d.ts +16 -0
- package/dist/widget/hooks/useSwapSettings.d.ts.map +1 -0
- package/dist/widget/hooks/useTargetAmount.d.ts +5 -0
- package/dist/widget/hooks/useTargetAmount.d.ts.map +1 -0
- package/dist/widget/hooks/useTheme.d.ts +14 -0
- package/dist/widget/hooks/useTheme.d.ts.map +1 -0
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/index.js +2 -2
- package/dist/widget/widget.d.ts +9 -0
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +38 -36
- package/src/aave.ts +6 -1
- package/src/analytics.ts +109 -53
- package/src/apiClient.ts +1 -1
- package/src/cctp.ts +6 -2
- package/src/cctpqueue.ts +7 -7
- package/src/chains.ts +18 -0
- package/src/config.ts +63 -17
- package/src/constants.ts +20 -16
- package/src/contractUtils.ts +33 -2
- package/src/customChains.ts +24 -0
- package/src/gasless.ts +162 -109
- package/src/index.ts +11 -1
- package/src/indexerClient.ts +73 -1
- package/src/intentEntrypoint.ts +218 -0
- package/src/intents.ts +85 -54
- package/src/metaTxnMonitor.ts +1 -0
- package/src/morpho.ts +13 -2
- package/src/pools.ts +68 -86
- package/src/prepareSend.ts +1719 -967
- package/src/prices.ts +51 -7
- package/src/relaySdk.ts +6 -4
- package/src/relayer.ts +6 -3
- package/src/toast.ts +110 -0
- package/src/tokenBalances.ts +112 -20
- package/src/tokens.ts +70 -7
- package/src/trails.ts +81 -80
- package/src/trailsClient.ts +48 -0
- package/src/{proxyCaller.ts → trailsRouter.ts} +25 -20
- package/src/transactions.ts +30 -88
- package/src/umd.tsx +1 -1
- package/src/wallets.ts +2 -1
- package/src/widget/assets/sequence-logo.svg +15 -0
- package/src/widget/compiled.css +2 -2
- package/src/widget/components/AccountActionsDropdown.tsx +18 -159
- package/src/widget/components/AccountIntentTransactionHistory.tsx +346 -63
- package/src/widget/components/AccountSettings.tsx +102 -0
- package/src/widget/components/ChainFilterDropdown.tsx +1 -1
- package/src/widget/components/ChainList.tsx +10 -20
- package/src/widget/components/ClassicSwap.tsx +921 -0
- package/src/widget/components/ConfigDisplay.tsx +41 -5
- package/src/widget/components/ConnectWallet.tsx +168 -11
- package/src/widget/components/ConnectedWallets.tsx +342 -0
- package/src/widget/components/DebugMenu.tsx +2 -0
- package/src/widget/components/DebugScreensList.tsx +3 -0
- package/src/widget/components/DebugToast.tsx +63 -0
- package/src/widget/components/Earn.tsx +112 -143
- package/src/widget/components/EarnPools.tsx +2 -4
- package/src/widget/components/EarnPoolsFilters.tsx +6 -6
- package/src/widget/components/FeeOption.tsx +78 -0
- package/src/widget/components/FeeOptions.tsx +192 -127
- package/src/widget/components/Fund.tsx +1236 -0
- package/src/widget/components/FundMethods.tsx +4 -4
- package/src/widget/components/FundSendForm.tsx +1 -34
- package/src/widget/components/Identicon.tsx +158 -0
- package/src/widget/components/MeshConnectExchanges.tsx +32 -3
- package/src/widget/components/MeshConnectFlow.tsx +23 -4
- package/src/widget/components/NativeGasOption.tsx +99 -0
- package/src/widget/components/Pay.tsx +1092 -0
- package/src/widget/components/PaySendForm.tsx +1 -38
- package/src/widget/components/QuoteDetails.tsx +1 -30
- package/src/widget/components/Receipt.tsx +1 -1
- package/src/widget/components/Receive.tsx +4 -2
- package/src/widget/components/RecentTokens.tsx +2 -1
- package/src/widget/components/Recipients.tsx +448 -0
- package/src/widget/components/RefundWarning.tsx +61 -0
- package/src/widget/components/ScreenHeader.tsx +1 -1
- package/src/widget/components/SimpleSwap.tsx +74 -58
- package/src/widget/components/Swap.tsx +35 -853
- package/src/widget/components/SwapSettings.tsx +5 -11
- package/src/widget/components/ThemeProvider.tsx +32 -0
- package/src/widget/components/ThemeSyncer.tsx +47 -0
- package/src/widget/components/Toast.tsx +315 -0
- package/src/widget/components/TokenList.tsx +2 -34
- package/src/widget/components/TokenSelector.tsx +14 -3
- package/src/widget/components/TransactionDetails.tsx +153 -13
- package/src/widget/components/TransferPendingVertical.tsx +1 -1
- package/src/widget/components/TruncatedAddress.tsx +5 -1
- package/src/widget/components/UserPreferences.tsx +155 -0
- package/src/widget/components/WalletList.tsx +1 -1
- package/src/widget/hooks/useBack.tsx +4 -0
- package/src/widget/hooks/useBalanceVisible.tsx +40 -2
- package/src/widget/hooks/useCheckout.ts +13 -0
- package/src/widget/hooks/useCurrentScreen.tsx +4 -0
- package/src/widget/hooks/useDebugScreens.ts +12 -2
- package/src/widget/hooks/useDefaultTokenSelection.tsx +471 -0
- package/src/widget/hooks/useIntentTransactionHistory.ts +212 -0
- package/src/widget/hooks/usePayMessage.tsx +370 -0
- package/src/widget/hooks/useRecipients.ts +168 -0
- package/src/widget/hooks/useSelectedFeeToken.tsx +299 -0
- package/src/widget/hooks/useSelectedMeshExchange.tsx +46 -0
- package/src/widget/hooks/useSelectedRecipient.tsx +48 -0
- package/src/widget/hooks/useSendForm.ts +257 -49
- package/src/widget/hooks/useSwapAmount.tsx +50 -0
- package/src/widget/hooks/useSwapSettings.tsx +100 -0
- package/src/widget/hooks/useTargetAmount.ts +23 -0
- package/src/widget/hooks/useTheme.tsx +80 -0
- package/src/widget/hooks/useTokenList.ts +20 -11
- package/src/widget/index.css +45 -21
- package/src/widget/widget.tsx +294 -136
- package/dist/address.d.ts +0 -2
- package/dist/address.d.ts.map +0 -1
- package/dist/proxyCaller.d.ts +0 -21
- package/dist/proxyCaller.d.ts.map +0 -1
- package/src/address.ts +0 -6
package/src/chains.ts
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
soneiumMinato,
|
|
31
31
|
xaiTestnet,
|
|
32
32
|
etherlinkTestnet,
|
|
33
|
+
somniaTestnet,
|
|
33
34
|
} from "viem/chains"
|
|
34
35
|
import { getRelaySupportedChains } from "./relaySdk.js"
|
|
35
36
|
import { getLifiSupportedChains } from "./lifi.js"
|
|
@@ -38,6 +39,7 @@ import {
|
|
|
38
39
|
getSequenceNodeGatewayUrl,
|
|
39
40
|
} from "./config.js"
|
|
40
41
|
import type { QuoteProvider } from "./intents.js"
|
|
42
|
+
import { somnia } from "./customChains.js"
|
|
41
43
|
|
|
42
44
|
export function getAllChains(): Chain[] {
|
|
43
45
|
return [
|
|
@@ -48,6 +50,7 @@ export function getAllChains(): Chain[] {
|
|
|
48
50
|
gnosis,
|
|
49
51
|
polygon,
|
|
50
52
|
soneium,
|
|
53
|
+
somnia,
|
|
51
54
|
xai,
|
|
52
55
|
apeChain,
|
|
53
56
|
arbitrumNova,
|
|
@@ -70,6 +73,7 @@ export function getAllChains(): Chain[] {
|
|
|
70
73
|
soneiumMinato,
|
|
71
74
|
xaiTestnet,
|
|
72
75
|
etherlinkTestnet,
|
|
76
|
+
somniaTestnet,
|
|
73
77
|
]
|
|
74
78
|
}
|
|
75
79
|
|
|
@@ -87,6 +91,7 @@ function getSequenceRpcUrls(): Record<number, string> {
|
|
|
87
91
|
[gnosis.id]: getSequenceRpcUrlFromSlug("gnosis"),
|
|
88
92
|
[polygon.id]: getSequenceRpcUrlFromSlug("polygon"),
|
|
89
93
|
[soneium.id]: getSequenceRpcUrlFromSlug("soneium"),
|
|
94
|
+
[somnia.id]: getSequenceRpcUrlFromSlug("somnia"),
|
|
90
95
|
[xai.id]: getSequenceRpcUrlFromSlug("xai"),
|
|
91
96
|
[apeChain.id]: getSequenceRpcUrlFromSlug("apechain"),
|
|
92
97
|
[arbitrumNova.id]: getSequenceRpcUrlFromSlug("arbitrum-nova"),
|
|
@@ -124,6 +129,7 @@ export const supportedSequenceChains: Record<number, Chain> = {
|
|
|
124
129
|
[optimism.id]: getChainInfo(optimism.id)!,
|
|
125
130
|
[polygon.id]: getChainInfo(polygon.id)!,
|
|
126
131
|
[soneium.id]: getChainInfo(soneium.id)!,
|
|
132
|
+
[somnia.id]: getChainInfo(somnia.id)!,
|
|
127
133
|
[xai.id]: getChainInfo(xai.id)!,
|
|
128
134
|
[katana.id]: getChainInfo(katana.id)!,
|
|
129
135
|
[etherlink.id]: getChainInfo(etherlink.id)!,
|
|
@@ -143,6 +149,7 @@ export const supportedSequenceTestnetChains: Record<number, Chain> = {
|
|
|
143
149
|
[soneiumMinato.id]: getChainInfo(soneiumMinato.id)!,
|
|
144
150
|
[xaiTestnet.id]: getChainInfo(xaiTestnet.id)!,
|
|
145
151
|
[etherlinkTestnet.id]: getChainInfo(etherlinkTestnet.id)!,
|
|
152
|
+
[somniaTestnet.id]: getChainInfo(somniaTestnet.id)!,
|
|
146
153
|
}
|
|
147
154
|
|
|
148
155
|
export const mainnetChainsToTestnetChains: Record<number, Chain> = {
|
|
@@ -161,6 +168,7 @@ export const mainnetChainsToTestnetChains: Record<number, Chain> = {
|
|
|
161
168
|
[arbitrumNova.id]: arbitrumSepolia,
|
|
162
169
|
[apeChain.id]: sepolia,
|
|
163
170
|
[etherlink.id]: etherlinkTestnet,
|
|
171
|
+
[somnia.id]: somniaTestnet,
|
|
164
172
|
}
|
|
165
173
|
|
|
166
174
|
// Helper to get chain info
|
|
@@ -189,6 +197,16 @@ export function getChainInfo(
|
|
|
189
197
|
}
|
|
190
198
|
}
|
|
191
199
|
|
|
200
|
+
// Override explorer URLs for specific chains
|
|
201
|
+
if (chainId === katana.id && chainInfo) {
|
|
202
|
+
chainInfo.blockExplorers = {
|
|
203
|
+
default: {
|
|
204
|
+
name: "Katanascan",
|
|
205
|
+
url: "https://katanascan.com", // use katanascan instead of explorer.katanarpc.com
|
|
206
|
+
},
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
192
210
|
return chainInfo
|
|
193
211
|
}
|
|
194
212
|
|
package/src/config.ts
CHANGED
|
@@ -6,20 +6,23 @@ import {
|
|
|
6
6
|
PROD_SEQUENCE_PROJECT_ACCESS_KEY,
|
|
7
7
|
DEV_SEQUENCE_INDEXER_URL,
|
|
8
8
|
DEV_SEQUENCE_API_URL,
|
|
9
|
+
DEV_TRAILS_API_URL,
|
|
9
10
|
DEV_SEQUENCE_PROJECT_ACCESS_KEY,
|
|
10
11
|
DEFAULT_SEQUENCE_ENV,
|
|
11
12
|
PROD_SEQUENCE_NODE_GATEWAY_URL,
|
|
12
13
|
DEV_SEQUENCE_NODE_GATEWAY_URL,
|
|
14
|
+
PROD_TRAILS_API_URL,
|
|
13
15
|
} from "./constants.js"
|
|
14
16
|
import { getQueryParam } from "./queryParams.js"
|
|
15
17
|
|
|
16
|
-
type SequenceEnv = "prod" | "dev" | "local" | "cors-anywhere"
|
|
18
|
+
export type SequenceEnv = "prod" | "dev" | "local" | "cors-anywhere"
|
|
17
19
|
|
|
18
20
|
export const globalConfig: {
|
|
19
21
|
sequenceProjectAccessKey: string
|
|
20
22
|
sequenceIndexerUrl: string
|
|
21
23
|
sequenceNodeGatewayUrl: string
|
|
22
24
|
sequenceApiUrl: string
|
|
25
|
+
trailsApiUrl: string
|
|
23
26
|
sequenceEnv: SequenceEnv
|
|
24
27
|
walletConnectProjectId: string
|
|
25
28
|
slippageTolerance: string
|
|
@@ -27,11 +30,12 @@ export const globalConfig: {
|
|
|
27
30
|
commitHash: string | undefined
|
|
28
31
|
} = {
|
|
29
32
|
commitHash: declareCommitHash(),
|
|
33
|
+
sequenceEnv: declareSequenceEnv(),
|
|
30
34
|
sequenceProjectAccessKey: declareSequenceProjectAccessKey(),
|
|
31
35
|
sequenceIndexerUrl: declareSequenceIndexerUrl(),
|
|
32
36
|
sequenceNodeGatewayUrl: declareSequenceNodeGatewayUrl(),
|
|
33
37
|
sequenceApiUrl: declareSequenceApiUrl(),
|
|
34
|
-
|
|
38
|
+
trailsApiUrl: declareTrailsApiUrl(),
|
|
35
39
|
walletConnectProjectId: DEFAULT_WALLETCONNECT_PROJECT_ID,
|
|
36
40
|
slippageTolerance: DEFAULT_SLIPPAGE_TOLERANCE,
|
|
37
41
|
debug: false,
|
|
@@ -49,12 +53,18 @@ export function declareSequenceEnv(): SequenceEnv {
|
|
|
49
53
|
if (getEnvVar("ENV") === "development" || getEnvVar("ENV") === "dev") {
|
|
50
54
|
return "dev"
|
|
51
55
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
|
|
57
|
+
// Special handling for Cloudflare Pages branches
|
|
58
|
+
const cfPagesBranch = getEnvVar("CF_PAGES_BRANCH")
|
|
59
|
+
if (cfPagesBranch) {
|
|
60
|
+
// If running on Cloudflare Pages, all branches except "production" default to dev
|
|
61
|
+
if (cfPagesBranch === "prod" || cfPagesBranch === "production") {
|
|
62
|
+
return "prod"
|
|
63
|
+
}
|
|
64
|
+
return "dev"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (getEnvVar("ENV") === "production" || getEnvVar("ENV") === "prod") {
|
|
58
68
|
return "prod"
|
|
59
69
|
}
|
|
60
70
|
}
|
|
@@ -74,11 +84,21 @@ export function declareSequenceApiUrl() {
|
|
|
74
84
|
return PROD_SEQUENCE_API_URL
|
|
75
85
|
}
|
|
76
86
|
if (declareSequenceEnv() === "local") {
|
|
77
|
-
return getEnvVar("
|
|
87
|
+
return getEnvVar("SEQUENCE_API_URL") || DEV_SEQUENCE_API_URL
|
|
78
88
|
}
|
|
79
89
|
return DEV_SEQUENCE_API_URL
|
|
80
90
|
}
|
|
81
91
|
|
|
92
|
+
export function declareTrailsApiUrl() {
|
|
93
|
+
if (declareSequenceEnv() === "prod") {
|
|
94
|
+
return PROD_TRAILS_API_URL
|
|
95
|
+
}
|
|
96
|
+
if (declareSequenceEnv() === "local") {
|
|
97
|
+
return getEnvVar("TRAILS_API_URL") || DEV_TRAILS_API_URL
|
|
98
|
+
}
|
|
99
|
+
return DEV_TRAILS_API_URL
|
|
100
|
+
}
|
|
101
|
+
|
|
82
102
|
export function declareSequenceNodeGatewayUrl() {
|
|
83
103
|
if (declareSequenceEnv() === "prod") {
|
|
84
104
|
return PROD_SEQUENCE_NODE_GATEWAY_URL
|
|
@@ -87,9 +107,21 @@ export function declareSequenceNodeGatewayUrl() {
|
|
|
87
107
|
}
|
|
88
108
|
|
|
89
109
|
export function declareSequenceProjectAccessKey() {
|
|
90
|
-
|
|
110
|
+
const sequenceEnv = declareSequenceEnv()
|
|
111
|
+
|
|
112
|
+
// Check for explicit env var override
|
|
113
|
+
if (typeof process !== "undefined") {
|
|
114
|
+
const envVarKey = getEnvVar("SEQUENCE_PROJECT_ACCESS_KEY")
|
|
115
|
+
if (envVarKey) {
|
|
116
|
+
return envVarKey
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Use dev/prod keys based on environment
|
|
121
|
+
if (sequenceEnv === "prod") {
|
|
91
122
|
return PROD_SEQUENCE_PROJECT_ACCESS_KEY
|
|
92
123
|
}
|
|
124
|
+
|
|
93
125
|
return DEV_SEQUENCE_PROJECT_ACCESS_KEY
|
|
94
126
|
}
|
|
95
127
|
|
|
@@ -105,6 +137,10 @@ export function declareCommitHash() {
|
|
|
105
137
|
return cfPagesCommitHash || viteCommitHash
|
|
106
138
|
}
|
|
107
139
|
|
|
140
|
+
export function getSequenceConfig() {
|
|
141
|
+
return globalConfig
|
|
142
|
+
}
|
|
143
|
+
|
|
108
144
|
export function getSequenceProjectAccessKey() {
|
|
109
145
|
return globalConfig.sequenceProjectAccessKey
|
|
110
146
|
}
|
|
@@ -137,25 +173,40 @@ export function getSequenceApiUrl() {
|
|
|
137
173
|
return globalConfig.sequenceApiUrl
|
|
138
174
|
}
|
|
139
175
|
|
|
176
|
+
export function setTrailsApiUrl(trailsApiUrl: string) {
|
|
177
|
+
globalConfig.trailsApiUrl = trailsApiUrl
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function getTrailsApiUrl() {
|
|
181
|
+
return globalConfig.trailsApiUrl
|
|
182
|
+
}
|
|
183
|
+
|
|
140
184
|
export function setSequenceEnv(sequenceEnv: SequenceEnv) {
|
|
141
185
|
globalConfig.sequenceEnv = sequenceEnv
|
|
142
186
|
|
|
143
187
|
if (sequenceEnv === "prod") {
|
|
144
188
|
setSequenceIndexerUrl(PROD_SEQUENCE_INDEXER_URL)
|
|
145
189
|
setSequenceApiUrl(PROD_SEQUENCE_API_URL)
|
|
190
|
+
setTrailsApiUrl(PROD_TRAILS_API_URL)
|
|
146
191
|
setSequenceNodeGatewayUrl(PROD_SEQUENCE_NODE_GATEWAY_URL)
|
|
192
|
+
setSequenceProjectAccessKey(PROD_SEQUENCE_PROJECT_ACCESS_KEY)
|
|
147
193
|
}
|
|
148
194
|
|
|
149
195
|
if (sequenceEnv === "local") {
|
|
150
|
-
if (getEnvVar("
|
|
151
|
-
setSequenceApiUrl(getEnvVar("
|
|
196
|
+
if (getEnvVar("SEQUENCE_API_URL")) {
|
|
197
|
+
setSequenceApiUrl(getEnvVar("SEQUENCE_API_URL"))
|
|
198
|
+
}
|
|
199
|
+
if (getEnvVar("TRAILS_API_URL")) {
|
|
200
|
+
setTrailsApiUrl(getEnvVar("TRAILS_API_URL"))
|
|
152
201
|
}
|
|
153
202
|
}
|
|
154
203
|
|
|
155
204
|
if (sequenceEnv === "dev") {
|
|
156
205
|
setSequenceIndexerUrl(DEV_SEQUENCE_INDEXER_URL)
|
|
157
206
|
setSequenceApiUrl(DEV_SEQUENCE_API_URL)
|
|
207
|
+
setTrailsApiUrl(DEV_TRAILS_API_URL)
|
|
158
208
|
setSequenceNodeGatewayUrl(DEV_SEQUENCE_NODE_GATEWAY_URL)
|
|
209
|
+
setSequenceProjectAccessKey(DEV_SEQUENCE_PROJECT_ACCESS_KEY)
|
|
159
210
|
}
|
|
160
211
|
}
|
|
161
212
|
|
|
@@ -208,13 +259,8 @@ export function getAccountIntentTransactionHistory() {
|
|
|
208
259
|
return FeatureFlags.accountIntentTransactionHistory
|
|
209
260
|
}
|
|
210
261
|
|
|
211
|
-
export function getSameChainSwapDifferentIntentAddresses() {
|
|
212
|
-
return FeatureFlags.sameChainSwapDifferentIntentAddresses
|
|
213
|
-
}
|
|
214
|
-
|
|
215
262
|
export const FeatureFlags = {
|
|
216
263
|
accountIntentTransactionHistory: false,
|
|
217
|
-
sameChainSwapDifferentIntentAddresses: false,
|
|
218
264
|
}
|
|
219
265
|
|
|
220
266
|
export function getEnvVar(name: string) {
|
package/src/constants.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AddressOverrides } from "@0xsequence/trails-api"
|
|
1
2
|
import type { Context as ContextLike } from "@0xsequence/wallet-primitives"
|
|
2
3
|
|
|
3
4
|
export const SEQUENCE_V3_CONTRACT_ADDRESSES: ContextLike.Context = {
|
|
@@ -8,34 +9,39 @@ export const SEQUENCE_V3_CONTRACT_ADDRESSES: ContextLike.Context = {
|
|
|
8
9
|
"0x6041600e3d396021805130553df33d3d36153402601f57363d3d373d363d30545af43d82803e903d91601f57fd5bf3" as `0x${string}`,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export const
|
|
12
|
-
|
|
12
|
+
export const SEQUENCE_V3_CONTRACT_ADDRESSES_OVERRIDES: AddressOverrides = {
|
|
13
|
+
sequenceWalletFactoryAddress: SEQUENCE_V3_CONTRACT_ADDRESSES.factory,
|
|
14
|
+
sequenceWalletMainModuleAddress: SEQUENCE_V3_CONTRACT_ADDRESSES.stage1,
|
|
15
|
+
sequenceWalletMainModuleUpgradableAddress:
|
|
16
|
+
SEQUENCE_V3_CONTRACT_ADDRESSES.stage2,
|
|
17
|
+
} as AddressOverrides
|
|
18
|
+
|
|
19
|
+
export const TRAILS_ROUTER_ADDRESS =
|
|
20
|
+
"0x07abd6f71aE3EAD08b2B6D5d091eE24d32dc1Dfa"
|
|
21
|
+
|
|
22
|
+
export const TRAILS_INTENT_ENTRYPOINT_ADDRESS =
|
|
23
|
+
"0xf9dF60584Da03f8D83fF1Bed663465734B2221a7"
|
|
13
24
|
|
|
14
25
|
export const ATTESATION_SIGNER_ADDRESS =
|
|
15
26
|
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
|
16
27
|
|
|
17
|
-
export const TRAILS_LIFI_SAPIENT_SIGNER_ADDRESS =
|
|
18
|
-
"0xd7571bd1e3af468c3a49966c9a92a2e907cdfa52"
|
|
19
|
-
export const TRAILS_RELAY_SAPIENT_SIGNER_ADDRESS =
|
|
20
|
-
"0x9a013e7d186611af36a918ef23d81886e8c256f8"
|
|
21
|
-
export const TRAILS_CCTP_SAPIENT_SIGNER_ADDRESS =
|
|
22
|
-
"0xc1A9B197eBb31Fc2B613C59dAC3f3E5698A429D0"
|
|
23
|
-
|
|
24
28
|
export const DEFAULT_SEQUENCE_ENV = "prod"
|
|
25
29
|
|
|
26
30
|
export const PROD_SEQUENCE_NODE_GATEWAY_URL = "https://nodes.sequence.app"
|
|
27
31
|
export const PROD_SEQUENCE_INDEXER_URL = "https://indexer.sequence.app"
|
|
28
32
|
export const PROD_SEQUENCE_API_URL = "https://api.sequence.app"
|
|
33
|
+
export const PROD_TRAILS_API_URL = "https://trails-api.sequence.app"
|
|
29
34
|
export const DEV_SEQUENCE_NODE_GATEWAY_URL = "https://dev-nodes.sequence.app"
|
|
30
35
|
export const DEV_SEQUENCE_INDEXER_URL = "https://dev-indexer.sequence.app"
|
|
31
36
|
export const DEV_SEQUENCE_API_URL = "https://dev-api.sequence.app"
|
|
37
|
+
export const DEV_TRAILS_API_URL = "https://dev-trails-api.sequence-dev.app"
|
|
32
38
|
|
|
39
|
+
// TODO: Update with new single address once latest contracts are deployed
|
|
33
40
|
export const intentEntrypoints: Record<number, `0x${string}`> = {
|
|
34
|
-
8453: "
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
137: "0x4dBb20eA3A969F1A44d7653D4Dc8632B853E36DE",
|
|
41
|
+
8453: "0x80DB82D640F9Df20Cfe89fa4E70B0EcC56f3715c", // Base
|
|
42
|
+
42161: "0x20CC15eb516Ba56398c28CE1A567e3a82889Db46", // Arbitrum One
|
|
43
|
+
137: "0x1C69bCdcD751785F2a3b815333B46AB150370E6E", // Polygon
|
|
44
|
+
747474: "0x814A110fF7c664C26e6c3e2E6E85C23291e4359e", // Katana
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
// This is used for Sequence Indexer and API
|
|
@@ -54,5 +60,3 @@ export const DEFAULT_WALLETCONNECT_PROJECT_ID =
|
|
|
54
60
|
export const SITE_URL = "https://trails.build/"
|
|
55
61
|
|
|
56
62
|
export const DEFAULT_SLIPPAGE_TOLERANCE = "0.05" // 0.001 = 0.1%, 0.005 = 0.5%, 0.03 = 3%, 0.05 = 5%
|
|
57
|
-
|
|
58
|
-
export const MINIMUM_USD_AMOUNT_FOR_SWAP = "0.15"
|
package/src/contractUtils.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPublicClient, http } from "viem"
|
|
2
2
|
import { getChainInfo } from "./chains.js"
|
|
3
|
+
import { logger } from "./logger.js"
|
|
3
4
|
|
|
4
5
|
export async function getIsContract(address: `0x${string}`, chainId: number) {
|
|
5
6
|
const client = createPublicClient({
|
|
@@ -8,9 +9,39 @@ export async function getIsContract(address: `0x${string}`, chainId: number) {
|
|
|
8
9
|
})
|
|
9
10
|
|
|
10
11
|
const code = await client.getCode({ address })
|
|
11
|
-
|
|
12
|
+
const isNonZero = isNonZeroHexString(code)
|
|
13
|
+
const is7702 = is7702ContractCode(code)
|
|
14
|
+
const isContract = isNonZero && !is7702
|
|
15
|
+
|
|
16
|
+
logger.console.log(
|
|
17
|
+
"[trails-sdk] code:",
|
|
18
|
+
code?.slice(0, 10),
|
|
19
|
+
"address:",
|
|
20
|
+
address,
|
|
21
|
+
"chainId:",
|
|
22
|
+
chainId,
|
|
23
|
+
"isContract:",
|
|
24
|
+
isContract,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
return isContract
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function is7702ContractCode(hex: string | undefined): boolean {
|
|
31
|
+
return hex?.startsWith("0xef0100") || false
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function isNonZeroHexString(hex: string | undefined): boolean {
|
|
35
|
+
return (
|
|
36
|
+
hex !== undefined &&
|
|
37
|
+
hex !== "" &&
|
|
38
|
+
hex !== "0" &&
|
|
39
|
+
hex !== "0x" &&
|
|
40
|
+
hex !== "0x0" &&
|
|
41
|
+
hex !== "0x00"
|
|
42
|
+
)
|
|
12
43
|
}
|
|
13
44
|
|
|
14
45
|
export function getIsCustomCalldata(calldata: string | undefined): boolean {
|
|
15
|
-
return calldata
|
|
46
|
+
return isNonZeroHexString(calldata)
|
|
16
47
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Custom chain definition for Somnia
|
|
2
|
+
export const somnia = {
|
|
3
|
+
id: 5031,
|
|
4
|
+
name: "Somnia",
|
|
5
|
+
nativeCurrency: {
|
|
6
|
+
decimals: 18,
|
|
7
|
+
name: "SOMI",
|
|
8
|
+
symbol: "SOMI",
|
|
9
|
+
},
|
|
10
|
+
rpcUrls: {
|
|
11
|
+
default: {
|
|
12
|
+
http: ["https://api.infra.mainnet.somnia.network"],
|
|
13
|
+
},
|
|
14
|
+
public: {
|
|
15
|
+
http: ["https://api.infra.mainnet.somnia.network"],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
blockExplorers: {
|
|
19
|
+
default: {
|
|
20
|
+
name: "Somnia Explorer",
|
|
21
|
+
url: "https://explorer.somnia.network/",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
} as const
|