0xtrails 0.4.3 → 0.6.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/analytics.d.ts +8 -3
- package/dist/analytics.d.ts.map +1 -1
- package/dist/{ccip-C9CA3tIi.js → ccip-Dw5AN7oU.js} +27 -27
- package/dist/cctp.d.ts +0 -149
- package/dist/cctp.d.ts.map +1 -1
- package/dist/chains.d.ts +31 -4
- package/dist/chains.d.ts.map +1 -1
- package/dist/config.d.ts +28 -52
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -7
- package/dist/constants.d.ts.map +1 -1
- package/dist/contractUtils.d.ts.map +1 -1
- package/dist/estimate.d.ts.map +1 -1
- package/dist/fees.d.ts.map +1 -1
- package/dist/gasless.d.ts +12 -0
- package/dist/gasless.d.ts.map +1 -1
- package/dist/{index-CNB57v0n.js → index-BtVUTbEZ.js} +32255 -40547
- package/dist/index.d.ts +13 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +320 -944
- package/dist/indexerClient.d.ts +9 -6
- package/dist/indexerClient.d.ts.map +1 -1
- package/dist/intents.d.ts +0 -18
- package/dist/intents.d.ts.map +1 -1
- package/dist/mutations.d.ts.map +1 -1
- package/dist/paymasterSend.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +1 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/sendUserOp.d.ts +0 -18
- package/dist/sendUserOp.d.ts.map +1 -1
- package/dist/sequenceWallet.d.ts +1 -1
- package/dist/sequenceWallet.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +10 -8
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trailsClient.d.ts +3 -3
- package/dist/trailsClient.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +4 -5
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +4 -5
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +2 -2
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/execution/transactionState.d.ts +2 -2
- package/dist/transactionIntent/execution/transactionState.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/crossChain.d.ts +6 -4
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/index.d.ts +0 -1
- package/dist/transactionIntent/handlers/index.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +4 -34
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +2 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +7 -19
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactionIntent/utils/index.d.ts +0 -1
- package/dist/transactionIntent/utils/index.d.ts.map +1 -1
- package/dist/transactions.d.ts +6 -18
- package/dist/transactions.d.ts.map +1 -1
- package/dist/utils.d.ts +8 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/walletUtils.d.ts +21 -0
- package/dist/walletUtils.d.ts.map +1 -0
- package/dist/wallets.d.ts +33 -240
- package/dist/wallets.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/ConfigDisplay.d.ts.map +1 -1
- package/dist/widget/components/FeeOption.d.ts +8 -13
- package/dist/widget/components/FeeOption.d.ts.map +1 -1
- package/dist/widget/components/FeeOptions.d.ts +11 -5
- package/dist/widget/components/FeeOptions.d.ts.map +1 -1
- package/dist/widget/components/NativeGasOption.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/QRCodeDeposit.d.ts +5 -0
- package/dist/widget/components/QRCodeDeposit.d.ts.map +1 -1
- package/dist/widget/components/QRCodeWalletSelect.d.ts +13 -0
- package/dist/widget/components/QRCodeWalletSelect.d.ts.map +1 -0
- package/dist/widget/components/QrCode.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/ScreenHeader.d.ts +1 -1
- package/dist/widget/components/ScreenHeader.d.ts.map +1 -1
- package/dist/widget/components/SlippageToleranceSettings.d.ts +1 -0
- package/dist/widget/components/SlippageToleranceSettings.d.ts.map +1 -1
- package/dist/widget/components/Toast.d.ts.map +1 -1
- package/dist/widget/components/TokenImage.d.ts.map +1 -1
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/css/compiled.css +1 -1
- package/dist/widget/hooks/useCheckout.d.ts +15 -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/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts +7 -0
- package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts.map +1 -0
- package/dist/widget/hooks/useIsSequenceWallet.d.ts +6 -0
- package/dist/widget/hooks/useIsSequenceWallet.d.ts.map +1 -0
- package/dist/widget/hooks/useQuote.d.ts +6 -11
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useRecentTokens.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFeeOption.d.ts +30 -0
- package/dist/widget/hooks/useSelectedFeeOption.d.ts.map +1 -0
- package/dist/widget/hooks/useSendForm.d.ts +6 -15
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/index.d.ts +1 -0
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +4 -2
- package/dist/widget/providers/TrailsProvider.d.ts +29 -0
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -0
- package/dist/widget/widget.d.ts +14 -3
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/analytics.ts +53 -21
- package/src/cctp.ts +0 -1016
- package/src/chains.ts +155 -68
- package/src/config.ts +51 -207
- package/src/constants.ts +1 -13
- package/src/contractUtils.ts +6 -6
- package/src/estimate.ts +3 -6
- package/src/fees.ts +5 -10
- package/src/gasless.ts +45 -0
- package/src/index.ts +18 -40
- package/src/indexerClient.ts +39 -48
- package/src/intents.ts +51 -226
- package/src/mutations.ts +3 -2
- package/src/paymasterSend.ts +2 -5
- package/src/prepareSend.ts +21 -14
- package/src/sendUserOp.ts +3 -64
- package/src/sequenceWallet.ts +1 -2
- package/src/tokenBalances.ts +2 -1
- package/src/tokens.ts +62 -133
- package/src/trailsClient.ts +17 -12
- package/src/transactionIntent/deposits/depositOrchestrator.ts +14 -15
- package/src/transactionIntent/deposits/gaslessDeposit.ts +70 -100
- package/src/transactionIntent/deposits/standardDeposit.ts +22 -28
- package/src/transactionIntent/execution/transactionState.ts +2 -2
- package/src/transactionIntent/handlers/crossChain.ts +179 -381
- package/src/transactionIntent/handlers/index.ts +0 -1
- package/src/transactionIntent/handlers/sameChainSameToken.ts +228 -94
- package/src/transactionIntent/quote/normalizeQuote.ts +4 -6
- package/src/transactionIntent/quote/quoteHelpers.ts +35 -3
- package/src/transactionIntent/types.ts +7 -27
- package/src/transactionIntent/utils/index.ts +0 -1
- package/src/transactions.ts +19 -118
- package/src/umd.tsx +1 -3
- package/src/utils.ts +28 -8
- package/src/walletUtils.ts +42 -0
- package/src/wallets.ts +365 -208
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +78 -4
- package/src/widget/components/AccountSettings.tsx +17 -17
- package/src/widget/components/ChainList.tsx +3 -3
- package/src/widget/components/ClassicSwap.tsx +19 -10
- package/src/widget/components/ConfigDisplay.tsx +19 -59
- package/src/widget/components/FeeOption.tsx +63 -20
- package/src/widget/components/FeeOptions.tsx +54 -123
- package/src/widget/components/NativeGasOption.tsx +3 -1
- package/src/widget/components/Pay.tsx +18 -11
- package/src/widget/components/PoolDeposit.tsx +23 -10
- package/src/widget/components/QRCodeDeposit.tsx +50 -30
- package/src/widget/components/QRCodeWalletSelect.tsx +77 -0
- package/src/widget/components/QrCode.tsx +188 -233
- package/src/widget/components/QuoteDetails.tsx +48 -2
- package/src/widget/components/Receipt.tsx +5 -2
- package/src/widget/components/ScreenHeader.tsx +10 -8
- package/src/widget/components/SlippageToleranceSettings.tsx +63 -14
- package/src/widget/components/Toast.tsx +10 -0
- package/src/widget/components/TokenImage.tsx +56 -13
- package/src/widget/components/WalletConnect.tsx +37 -99
- package/src/widget/hooks/useCheckout.ts +71 -0
- package/src/widget/hooks/useCurrentScreen.tsx +1 -0
- package/src/widget/hooks/useDebugScreens.ts +5 -0
- package/src/widget/hooks/useIntentTransactionHistory.ts +790 -412
- package/src/widget/hooks/useIsConnectedWalletSmartContract.ts +43 -0
- package/src/widget/hooks/useIsSequenceWallet.ts +17 -0
- package/src/widget/hooks/useQuote.ts +27 -34
- package/src/widget/hooks/useRecentTokens.ts +2 -1
- package/src/widget/hooks/useSelectedFeeOption.tsx +257 -0
- package/src/widget/hooks/useSendForm.ts +175 -46
- package/src/widget/hooks/useTokenList.ts +15 -2
- package/src/widget/index.tsx +8 -0
- package/src/widget/providers/TrailsProvider.tsx +123 -0
- package/src/widget/widget.tsx +165 -143
- package/dist/cctpqueue.d.ts +0 -18
- package/dist/cctpqueue.d.ts.map +0 -1
- package/dist/preconditions.d.ts +0 -12
- package/dist/preconditions.d.ts.map +0 -1
- package/dist/trails.d.ts +0 -110
- package/dist/trails.d.ts.map +0 -1
- package/dist/transactionIntent/handlers/sameChainDifferentToken.d.ts +0 -62
- package/dist/transactionIntent/handlers/sameChainDifferentToken.d.ts.map +0 -1
- package/dist/transactionIntent/utils/lifiHelpers.d.ts +0 -10
- package/dist/transactionIntent/utils/lifiHelpers.d.ts.map +0 -1
- package/dist/widget/hooks/useSelectedFeeToken.d.ts +0 -33
- package/dist/widget/hooks/useSelectedFeeToken.d.ts.map +0 -1
- package/src/cctpqueue.ts +0 -66
- package/src/preconditions.ts +0 -47
- package/src/trails.ts +0 -1303
- package/src/transactionIntent/handlers/sameChainDifferentToken.ts +0 -323
- package/src/transactionIntent/utils/lifiHelpers.ts +0 -68
- package/src/widget/hooks/useSelectedFeeToken.tsx +0 -288
package/src/wallets.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
getWalletConnectProjectId,
|
|
4
|
-
} from "./config.js"
|
|
1
|
+
import { getConfig } from "./config.js"
|
|
2
|
+
import { DEFAULT_WALLETCONNECT_PROJECT_ID } from "./constants.js"
|
|
5
3
|
import WalletConnectLogo from "./widget/assets/WalletConnect-logo-blue-bg.svg"
|
|
6
4
|
import SequenceLogo from "./widget/assets/sequence-logo.svg"
|
|
7
5
|
import { Wallet as WalletIcon } from "lucide-react"
|
|
@@ -15,6 +13,7 @@ import {
|
|
|
15
13
|
import { useConnect } from "wagmi"
|
|
16
14
|
import React from "react"
|
|
17
15
|
import { sequenceWallet } from "@0xsequence/connect"
|
|
16
|
+
import { useTrails } from "./widget/providers/TrailsProvider.js"
|
|
18
17
|
|
|
19
18
|
type Connector = any
|
|
20
19
|
|
|
@@ -25,12 +24,20 @@ export interface WalletConfig {
|
|
|
25
24
|
connector?: Connector
|
|
26
25
|
}
|
|
27
26
|
|
|
27
|
+
export interface QRCodeWalletOption {
|
|
28
|
+
id: string
|
|
29
|
+
label: string
|
|
30
|
+
usesEip681: boolean
|
|
31
|
+
icon: string
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
// WalletConnect connector singleton to avoid multiple Core initializations
|
|
29
35
|
let wcConnectorSingleton: ReturnType<typeof walletConnect> | null = null
|
|
30
36
|
function getWalletConnectConnectorSingleton() {
|
|
31
37
|
if (!wcConnectorSingleton) {
|
|
32
38
|
wcConnectorSingleton = walletConnect({
|
|
33
|
-
projectId:
|
|
39
|
+
projectId:
|
|
40
|
+
getConfig("walletConnectProjectId") || DEFAULT_WALLETCONNECT_PROJECT_ID,
|
|
34
41
|
showQrModal: false,
|
|
35
42
|
})
|
|
36
43
|
}
|
|
@@ -40,10 +47,6 @@ function getWalletConnectConnectorSingleton() {
|
|
|
40
47
|
export const walletConnectConnector: Connector =
|
|
41
48
|
getWalletConnectConnectorSingleton()
|
|
42
49
|
|
|
43
|
-
export const injectedConnector = injected()
|
|
44
|
-
export const baseAccountConnector: Connector = baseAccount()
|
|
45
|
-
export const geminiConnector: Connector = gemini()
|
|
46
|
-
|
|
47
50
|
function isInIframe() {
|
|
48
51
|
// check if we're in an iframe
|
|
49
52
|
if (window?.parent === window) {
|
|
@@ -94,201 +97,321 @@ export function windowProviderOrWalletConnect(
|
|
|
94
97
|
return walletConnectConnector
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Hook to get all wallet connectors, creating them lazily with the correct configuration
|
|
102
|
+
*/
|
|
103
|
+
export function useConnectors(): Connector[] {
|
|
104
|
+
const { trailsApiKey } = useTrails()
|
|
105
|
+
|
|
106
|
+
return React.useMemo(() => {
|
|
107
|
+
return getConnectorsInternal(trailsApiKey)
|
|
108
|
+
}, [trailsApiKey])
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Internal function to get connectors (for use outside React components)
|
|
113
|
+
* Exported for use in widget.tsx where hooks can't be used in useMemo
|
|
114
|
+
*/
|
|
115
|
+
export function getConnectorsInternal(projectAccessKey?: string): Connector[] {
|
|
116
|
+
// Create base connectors
|
|
117
|
+
const injectedConnector = injected()
|
|
118
|
+
const baseAccountConnector: Connector = baseAccount()
|
|
119
|
+
const geminiConnector: Connector = gemini()
|
|
120
|
+
const safeConnector: Connector = safeProviderOrWalletConnect()
|
|
121
|
+
|
|
122
|
+
// Create wallet-specific connectors
|
|
123
|
+
const metamaskConnector = injected({
|
|
124
|
+
target() {
|
|
125
|
+
return {
|
|
126
|
+
id: "metamask",
|
|
127
|
+
name: "metamask",
|
|
128
|
+
provider:
|
|
129
|
+
typeof window !== "undefined" ? (window as any).ethereum : undefined,
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
const rainbowConnector = windowProviderOrWalletConnect(
|
|
135
|
+
"rainbow",
|
|
136
|
+
"rainbow",
|
|
137
|
+
"Rainbow",
|
|
138
|
+
)
|
|
139
|
+
const trustwalletConnector = windowProviderOrWalletConnect(
|
|
140
|
+
"trustwallet",
|
|
141
|
+
"trustwallet",
|
|
142
|
+
"Trust",
|
|
143
|
+
)
|
|
144
|
+
const phantomConnector = windowProviderOrWalletConnect(
|
|
145
|
+
"phantom",
|
|
146
|
+
["phantom", "ethereum"],
|
|
147
|
+
"Phantom",
|
|
148
|
+
)
|
|
149
|
+
const okxwalletConnector = windowProviderOrWalletConnect(
|
|
150
|
+
"okxwallet",
|
|
151
|
+
"okxwallet",
|
|
152
|
+
"OKX Wallet",
|
|
153
|
+
)
|
|
154
|
+
const zerionConnector = windowProviderOrWalletConnect(
|
|
155
|
+
"zerion",
|
|
156
|
+
"zerionWallet",
|
|
157
|
+
"Zerion",
|
|
158
|
+
)
|
|
159
|
+
const ambireConnector = windowProviderOrWalletConnect(
|
|
160
|
+
"ambire",
|
|
161
|
+
"ambire",
|
|
162
|
+
"Ambire",
|
|
163
|
+
)
|
|
164
|
+
const rabbyConnector = windowProviderOrWalletConnect(
|
|
165
|
+
"rabby",
|
|
166
|
+
"rabby",
|
|
167
|
+
"Rabby",
|
|
168
|
+
)
|
|
169
|
+
const coinbaseWalletConnector = windowProviderOrWalletConnect(
|
|
170
|
+
"coinbase",
|
|
171
|
+
"coinbaseWalletExtension",
|
|
172
|
+
"Coinbase Wallet",
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
// Create sequence connector with projectAccessKey
|
|
176
|
+
const sequenceConnector: any = sequenceWallet({
|
|
177
|
+
connect: {
|
|
178
|
+
app: "Trails",
|
|
179
|
+
projectAccessKey: projectAccessKey || getConfig("trailsApiKey") || "",
|
|
180
|
+
},
|
|
181
|
+
defaultNetwork: 1,
|
|
182
|
+
walletAppURL: "https://sequence.app",
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
return [
|
|
186
|
+
injectedConnector,
|
|
187
|
+
walletConnectConnector,
|
|
188
|
+
safeConnector,
|
|
189
|
+
baseAccountConnector,
|
|
190
|
+
geminiConnector,
|
|
191
|
+
coinbaseWalletConnector,
|
|
192
|
+
metamaskConnector,
|
|
193
|
+
rainbowConnector,
|
|
194
|
+
trustwalletConnector,
|
|
195
|
+
phantomConnector,
|
|
196
|
+
okxwalletConnector,
|
|
197
|
+
zerionConnector,
|
|
198
|
+
ambireConnector,
|
|
199
|
+
rabbyConnector,
|
|
200
|
+
sequenceConnector,
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Hook to get wallet configurations, creating connectors lazily with the correct configuration
|
|
206
|
+
*/
|
|
207
|
+
export function useWalletConfigs(): Record<string, WalletConfig> {
|
|
208
|
+
const { trailsApiKey } = useTrails()
|
|
209
|
+
|
|
210
|
+
return React.useMemo(() => {
|
|
211
|
+
return getWalletConfigsInternal(trailsApiKey)
|
|
212
|
+
}, [trailsApiKey])
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Internal function to get wallet configs (for use outside React components)
|
|
217
|
+
*/
|
|
218
|
+
function getWalletConfigsInternal(
|
|
219
|
+
projectAccessKey?: string,
|
|
220
|
+
): Record<string, WalletConfig> {
|
|
221
|
+
// Get connectors
|
|
222
|
+
const connectors = getConnectorsInternal(projectAccessKey)
|
|
223
|
+
const [
|
|
224
|
+
injectedConnector,
|
|
225
|
+
walletConnectConnector,
|
|
226
|
+
safeConnector,
|
|
227
|
+
baseAccountConnector,
|
|
228
|
+
geminiConnector,
|
|
229
|
+
coinbaseWalletConnector,
|
|
230
|
+
metamaskConnector,
|
|
231
|
+
rainbowConnector,
|
|
232
|
+
trustwalletConnector,
|
|
233
|
+
phantomConnector,
|
|
234
|
+
okxwalletConnector,
|
|
235
|
+
zerionConnector,
|
|
236
|
+
ambireConnector,
|
|
237
|
+
rabbyConnector,
|
|
238
|
+
sequenceConnector,
|
|
239
|
+
] = connectors
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
injected: {
|
|
243
|
+
id: "injected",
|
|
244
|
+
name: "Browser Wallet",
|
|
245
|
+
connector: injectedConnector,
|
|
246
|
+
icon: WalletIcon as unknown as string,
|
|
247
|
+
},
|
|
248
|
+
walletconnect: {
|
|
249
|
+
id: "walletconnect",
|
|
250
|
+
name: "WalletConnect",
|
|
251
|
+
connector: walletConnectConnector,
|
|
252
|
+
icon: WalletConnectLogo as string,
|
|
253
|
+
},
|
|
254
|
+
metamask: {
|
|
100
255
|
id: "metamask",
|
|
101
|
-
name: "
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
256
|
+
name: "MetaMask",
|
|
257
|
+
connector: metamaskConnector,
|
|
258
|
+
icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMzAiIHZpZXdCb3g9IjAgMCAzMCAzMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjIzIiBoZWlnaHQ9IjIzIiB4PSIzLjUiIHk9IjMuNSIgdmlld0JveD0iMCAwIDE0MS41MSAxMzYuNDIiPjxwYXRoIGZpbGw9IiNGRjVDMTYiIGQ9Im0xMzIuMjQgMTMxLjc1LTMwLjQ4LTkuMDctMjIuOTkgMTMuNzQtMTYuMDMtLjAxLTIzLTEzLjc0LTMwLjQ3IDkuMDhMMCAxMDAuNDdsOS4yNy0zNC43M0wwIDM2LjQgOS4yNyAwbDQ3LjYgMjguNDRoMjcuNzZMMTMyLjI0IDBsOS4yNyAzNi4zOC05LjI3IDI5LjM2IDkuMjcgMzQuNzItOS4yNyAzMS4zWiIvPjxwYXRoIGZpbGw9IiNGRjVDMTYiIGQ9Im05LjI3IDAgNDcuNjEgMjguNDZMNTQuOTggNDggOS4yOSAwWm0zMC40NyAxMDAuNDggMjAuOTUgMTUuOTUtMjAuOTUgNi4yNHYtMjIuMlpNNTkuMDEgNzQuMSA1NSA0OCAyOS4yMiA2NS43NWgtLjAybC4wOCAxOC4yNyAxMC40NS05LjkyaDE5LjI5Wk0xMzIuMjUgMGwtNDcuNiAyOC40Nkw4Ni41MSA0OGw0NS43Mi00OFptLTMwLjQ3IDEwMC40OC0yMC45NCAxNS45NSAyMC45NCA2LjI0di0yMi4yWm0xMC41My0zNC43M0w4Ni41MyA0OCA4Mi41IDc0LjFoMTkuMjdsMTAuNDYgOS45LjA3LTE4LjI2WiIvPjxwYXRoIGZpbGw9IiNFMzQ4MDciIGQ9Im0zOS43MyAxMjIuNjctMzAuNDYgOS4wOEwwIDEwMC40OGgzOS43M3YyMi4yWk01OS4wMiA3NC4xbDUuODIgMzcuNzEtOC4wNy0yMC45Ny0yNy40OS02LjgyIDEwLjQ2LTkuOTJINTlabTQyLjc2IDQ4LjU5IDMwLjQ3IDkuMDcgOS4yNy0zMS4yN2gtMzkuNzR6TTgyLjUgNzQuMDlsLTUuODIgMzcuNzEgOC4wNi0yMC45NyAyNy41LTYuODItMTAuNDctOS45MnoiLz48cGF0aCBmaWxsPSIjRkY4RDVEIiBkPSJtMCAxMDAuNDcgOS4yNy0zNC43M0gyOS4ybC4wNyAxOC4yNyAyNy41IDYuODIgOC4wNiAyMC45Ny00LjE1IDQuNjItMjAuOTQtMTUuOTZIMFptMTQxLjUgMC05LjI2LTM0LjczaC0xOS45M2wtLjA3IDE4LjI3LTI3LjUgNi44Mi04LjA2IDIwLjk3IDQuMTUgNC42MiAyMC45NC0xNS45NmgzOS43NFpNODQuNjQgMjguNDRINTYuODhsLTEuODkgMTkuNTQgOS44NCA2My44aDExLjg1bDkuODUtNjMuOC0xLjktMTkuNTRaIi8+PHBhdGggZmlsbD0iIzY2MTgwMCIgZD0iTTkuMjcgMCAwIDM2LjM4bDkuMjcgMjkuMzZIMjkuMkw1NC45OCA0OHptNDMuOTggODEuNjdoLTkuMDNsLTQuOTIgNC44MSAxNy40NyA0LjMzLTMuNTItOS4xNVpNMTMyLjI0IDBsOS4yNyAzNi4zOC05LjI3IDI5LjM2aC0xOS45M0w4Ni41MyA0OHpNODguMjcgODEuNjdoOS4wNGw0LjkyIDQuODItMTcuNDkgNC4zNCAzLjUzLTkuMTdabS05LjUgNDIuMyAyLjA2LTcuNTQtNC4xNS00LjYySDY0LjgybC00LjE0IDQuNjIgMi4wNSA3LjU0Ii8+PHBhdGggZmlsbD0iI0MwQzRDRCIgZD0iTTc4Ljc3IDEyMy45N3YxMi40NUg2Mi43NHYtMTIuNDVoMTYuMDJaIi8+PHBhdGggZmlsbD0iI0U3RUJGNiIgZD0ibTM5Ljc0IDEyMi42NiAyMyAxMy43NnYtMTIuNDZsLTIuMDUtNy41NHptNjIuMDMgMC0yMyAxMy43NnYtMTIuNDZsMi4wNi03LjU0eiIvPjwvc3ZnPjwvc3ZnPg==",
|
|
259
|
+
},
|
|
260
|
+
baseAccount: {
|
|
261
|
+
id: "baseAccount",
|
|
262
|
+
name: "Base",
|
|
263
|
+
connector: baseAccountConnector,
|
|
264
|
+
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAALZJREFUaEPtmjEOhDAMBNc/O14GvOzys3CAKK6eAlmaVGl2Zc+kTOU685vkc9/bnD2prZK5/TZY24z9P+g4F5hNh7/GdoG37WlAA5CATwgCxHENYISwQAMQII5rACOEBRqAAHFcAxghLNAABIjjGsAIYYEGIEAc1wBGCAs0AAHiuAYwQligAQgQxzWAEcICDUCAOK4BjBAWaAACxHENYISwQAMQII6fBjr+VHkW3+u+tfyxMpJaDgYzYxb/ALZVAAAAAElFTkSuQmCC",
|
|
265
|
+
},
|
|
266
|
+
safe: {
|
|
267
|
+
id: "safe",
|
|
268
|
+
name: "Safe",
|
|
269
|
+
connector: safeConnector,
|
|
270
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/3913df81-63c2-4413-d60b-8ff83cbed500?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
271
|
+
},
|
|
272
|
+
rainbow: {
|
|
273
|
+
id: "rainbow",
|
|
274
|
+
name: "Rainbow",
|
|
275
|
+
connector: rainbowConnector,
|
|
276
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
277
|
+
},
|
|
278
|
+
trust: {
|
|
279
|
+
id: "trust",
|
|
280
|
+
name: "Trust",
|
|
281
|
+
connector: trustwalletConnector,
|
|
282
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/7677b54f-3486-46e2-4e37-bf8747814f00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
283
|
+
},
|
|
284
|
+
ambire: {
|
|
285
|
+
id: "ambire",
|
|
286
|
+
name: "Ambire Wallet",
|
|
287
|
+
connector: ambireConnector,
|
|
288
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/c39b3a16-1a38-4588-f089-cb7aeb584700?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
289
|
+
},
|
|
290
|
+
argent: {
|
|
291
|
+
id: "argent",
|
|
292
|
+
name: "Argent",
|
|
293
|
+
connector: walletConnectConnector,
|
|
294
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/215158d2-614b-49c9-410f-77aa661c3900?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
295
|
+
},
|
|
296
|
+
binance: {
|
|
297
|
+
id: "binance",
|
|
298
|
+
name: "Binance Wallet",
|
|
299
|
+
connector: walletConnectConnector,
|
|
300
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/ebac7b39-688c-41e3-7912-a4fefba74600?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
301
|
+
},
|
|
302
|
+
okx: {
|
|
303
|
+
id: "okx",
|
|
304
|
+
name: "OKX Wallet",
|
|
305
|
+
connector: okxwalletConnector,
|
|
306
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/c55df831-3c52-49fc-d1d1-97a926dc0c00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
307
|
+
},
|
|
308
|
+
zerion: {
|
|
309
|
+
id: "zerion",
|
|
310
|
+
name: "Zerion",
|
|
311
|
+
connector: zerionConnector,
|
|
312
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/73f6f52f-7862-49e7-bb85-ba93ab72cc00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
313
|
+
},
|
|
314
|
+
phantom: {
|
|
315
|
+
id: "phantom",
|
|
316
|
+
name: "Phantom",
|
|
317
|
+
connector: phantomConnector,
|
|
318
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/b6ec7b81-bb4f-427d-e290-7631e6e50d00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
319
|
+
},
|
|
320
|
+
coinbase: {
|
|
321
|
+
id: "coinbase",
|
|
322
|
+
name: "Coinbase Wallet",
|
|
323
|
+
connector: coinbaseWalletConnector,
|
|
324
|
+
icon: "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",
|
|
325
|
+
},
|
|
326
|
+
rabby: {
|
|
327
|
+
id: "rabby",
|
|
328
|
+
name: "Rabby",
|
|
329
|
+
connector: rabbyConnector,
|
|
330
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/255e6ba2-8dfd-43ad-e88e-57cbb98f6800?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
331
|
+
},
|
|
332
|
+
privy: {
|
|
333
|
+
id: "privy",
|
|
334
|
+
name: "Privy",
|
|
335
|
+
icon: "https://avatars.githubusercontent.com/u/81824329?s=200&v=4",
|
|
336
|
+
},
|
|
337
|
+
gemini: {
|
|
338
|
+
id: "gemini",
|
|
339
|
+
name: "Gemini",
|
|
340
|
+
connector: geminiConnector,
|
|
341
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/56a3fd87-2627-4903-fddd-205224dac500?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
342
|
+
},
|
|
343
|
+
sequence: {
|
|
344
|
+
id: "sequence",
|
|
345
|
+
name: "Sequence",
|
|
346
|
+
connector: sequenceConnector,
|
|
347
|
+
icon: SequenceLogo as string,
|
|
348
|
+
},
|
|
349
|
+
"sequence-waas": {
|
|
350
|
+
id: "sequence-waas",
|
|
351
|
+
name: "Sequence WaaS",
|
|
352
|
+
connector: sequenceConnector,
|
|
353
|
+
icon: SequenceLogo as string,
|
|
354
|
+
},
|
|
355
|
+
}
|
|
356
|
+
}
|
|
107
357
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
113
|
-
export const trustwalletConnector = windowProviderOrWalletConnect(
|
|
114
|
-
"trustwallet",
|
|
115
|
-
"trustwallet",
|
|
116
|
-
"Trust",
|
|
117
|
-
)
|
|
118
|
-
export const phantomConnector = windowProviderOrWalletConnect(
|
|
119
|
-
"phantom",
|
|
120
|
-
["phantom", "ethereum"],
|
|
121
|
-
"Phantom",
|
|
122
|
-
)
|
|
123
|
-
export const okxwalletConnector = windowProviderOrWalletConnect(
|
|
124
|
-
"okxwallet",
|
|
125
|
-
"okxwallet",
|
|
126
|
-
"OKX Wallet",
|
|
127
|
-
)
|
|
128
|
-
export const zerionConnector = windowProviderOrWalletConnect(
|
|
129
|
-
"zerion",
|
|
130
|
-
"zerionWallet",
|
|
131
|
-
"Zerion",
|
|
132
|
-
)
|
|
133
|
-
export const ambireConnector = windowProviderOrWalletConnect(
|
|
134
|
-
"ambire",
|
|
135
|
-
"ambire",
|
|
136
|
-
"Ambire",
|
|
137
|
-
)
|
|
138
|
-
export const rabbyConnector = windowProviderOrWalletConnect(
|
|
139
|
-
"rabby",
|
|
140
|
-
"rabby",
|
|
141
|
-
"Rabby",
|
|
142
|
-
)
|
|
143
|
-
export const coinbaseWalletConnector = windowProviderOrWalletConnect(
|
|
144
|
-
"coinbase",
|
|
145
|
-
"coinbaseWalletExtension",
|
|
146
|
-
"Coinbase Wallet",
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
export const sequenceConnector: any = sequenceWallet({
|
|
150
|
-
connect: {
|
|
151
|
-
app: "Trails",
|
|
152
|
-
projectAccessKey: getSequenceProjectAccessKey(),
|
|
153
|
-
},
|
|
154
|
-
defaultNetwork: 1,
|
|
155
|
-
walletAppURL: "https://sequence.app",
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
export const safeConnector: Connector = safeProviderOrWalletConnect()
|
|
159
|
-
|
|
160
|
-
export const connectors = [
|
|
161
|
-
injectedConnector,
|
|
162
|
-
walletConnectConnector,
|
|
163
|
-
safeConnector,
|
|
164
|
-
baseAccountConnector,
|
|
165
|
-
geminiConnector,
|
|
166
|
-
coinbaseWalletConnector,
|
|
167
|
-
metamaskConnector,
|
|
168
|
-
rainbowConnector,
|
|
169
|
-
trustwalletConnector,
|
|
170
|
-
phantomConnector,
|
|
171
|
-
okxwalletConnector,
|
|
172
|
-
zerionConnector,
|
|
173
|
-
ambireConnector,
|
|
174
|
-
rabbyConnector,
|
|
175
|
-
sequenceConnector,
|
|
176
|
-
]
|
|
358
|
+
/**
|
|
359
|
+
* Hook to get QR code wallet options
|
|
360
|
+
*/
|
|
361
|
+
export function useQRCodeWallets(): QRCodeWalletOption[] {
|
|
362
|
+
const { trailsApiKey } = useTrails()
|
|
177
363
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
name: "Argent",
|
|
230
|
-
connector: walletConnectConnector,
|
|
231
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/215158d2-614b-49c9-410f-77aa661c3900?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
232
|
-
},
|
|
233
|
-
binance: {
|
|
234
|
-
id: "binance",
|
|
235
|
-
name: "Binance Wallet",
|
|
236
|
-
connector: walletConnectConnector,
|
|
237
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/ebac7b39-688c-41e3-7912-a4fefba74600?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
238
|
-
},
|
|
239
|
-
okx: {
|
|
240
|
-
id: "okx",
|
|
241
|
-
name: "OKX Wallet",
|
|
242
|
-
connector: okxwalletConnector,
|
|
243
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/c55df831-3c52-49fc-d1d1-97a926dc0c00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
244
|
-
},
|
|
245
|
-
zerion: {
|
|
246
|
-
id: "zerion",
|
|
247
|
-
name: "Zerion",
|
|
248
|
-
connector: zerionConnector,
|
|
249
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/73f6f52f-7862-49e7-bb85-ba93ab72cc00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
250
|
-
},
|
|
251
|
-
phantom: {
|
|
252
|
-
id: "phantom",
|
|
253
|
-
name: "Phantom",
|
|
254
|
-
connector: phantomConnector,
|
|
255
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/b6ec7b81-bb4f-427d-e290-7631e6e50d00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
256
|
-
},
|
|
257
|
-
coinbase: {
|
|
258
|
-
id: "coinbase",
|
|
259
|
-
name: "Coinbase Wallet",
|
|
260
|
-
connector: coinbaseWalletConnector,
|
|
261
|
-
icon: "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",
|
|
262
|
-
},
|
|
263
|
-
rabby: {
|
|
264
|
-
id: "rabby",
|
|
265
|
-
name: "Rabby",
|
|
266
|
-
connector: rabbyConnector,
|
|
267
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/255e6ba2-8dfd-43ad-e88e-57cbb98f6800?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
268
|
-
},
|
|
269
|
-
privy: {
|
|
270
|
-
id: "privy",
|
|
271
|
-
name: "Privy",
|
|
272
|
-
icon: "https://avatars.githubusercontent.com/u/81824329?s=200&v=4",
|
|
273
|
-
},
|
|
274
|
-
gemini: {
|
|
275
|
-
id: "gemini",
|
|
276
|
-
name: "Gemini",
|
|
277
|
-
connector: geminiConnector,
|
|
278
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/56a3fd87-2627-4903-fddd-205224dac500?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
279
|
-
},
|
|
280
|
-
sequence: {
|
|
281
|
-
id: "sequence",
|
|
282
|
-
name: "Sequence",
|
|
283
|
-
connector: sequenceConnector,
|
|
284
|
-
icon: SequenceLogo as string,
|
|
285
|
-
},
|
|
286
|
-
"sequence-waas": {
|
|
287
|
-
id: "sequence-waas",
|
|
288
|
-
name: "Sequence WaaS",
|
|
289
|
-
connector: sequenceConnector,
|
|
290
|
-
icon: SequenceLogo as string,
|
|
291
|
-
},
|
|
364
|
+
return React.useMemo(() => {
|
|
365
|
+
return getQRCodeWalletsInternal(trailsApiKey)
|
|
366
|
+
}, [trailsApiKey])
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Internal function to get QR code wallets (for use outside React components)
|
|
371
|
+
*/
|
|
372
|
+
function getQRCodeWalletsInternal(
|
|
373
|
+
projectAccessKey?: string,
|
|
374
|
+
): QRCodeWalletOption[] {
|
|
375
|
+
const walletConfigs = getWalletConfigsInternal(projectAccessKey)
|
|
376
|
+
|
|
377
|
+
return [
|
|
378
|
+
{
|
|
379
|
+
id: "metamask",
|
|
380
|
+
label: "MetaMask",
|
|
381
|
+
usesEip681: true,
|
|
382
|
+
icon: walletConfigs.metamask?.icon || "",
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
id: "coinbase",
|
|
386
|
+
label: "CB Wallet",
|
|
387
|
+
usesEip681: false,
|
|
388
|
+
icon: walletConfigs.coinbase?.icon || "",
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
id: "trust",
|
|
392
|
+
label: "Trust Wallet",
|
|
393
|
+
usesEip681: false,
|
|
394
|
+
icon: walletConfigs.trust?.icon || "",
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
id: "rabby",
|
|
398
|
+
label: "Rabby",
|
|
399
|
+
usesEip681: false,
|
|
400
|
+
icon: walletConfigs.rabby?.icon || "",
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
id: "rainbow",
|
|
404
|
+
label: "Rainbow",
|
|
405
|
+
usesEip681: false,
|
|
406
|
+
icon: walletConfigs.rainbow?.icon || "",
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
id: "phantom",
|
|
410
|
+
label: "Phantom",
|
|
411
|
+
usesEip681: false,
|
|
412
|
+
icon: walletConfigs.phantom?.icon || "",
|
|
413
|
+
},
|
|
414
|
+
] satisfies QRCodeWalletOption[]
|
|
292
415
|
}
|
|
293
416
|
|
|
294
417
|
export const topShownWallets = [
|
|
@@ -299,14 +422,47 @@ export const topShownWallets = [
|
|
|
299
422
|
"phantom",
|
|
300
423
|
]
|
|
301
424
|
|
|
302
|
-
|
|
425
|
+
/**
|
|
426
|
+
* Hook to get wallet icon
|
|
427
|
+
*/
|
|
428
|
+
export function useWalletIcon(walletId?: string): string {
|
|
429
|
+
const walletConfigs = useWalletConfigs()
|
|
430
|
+
|
|
431
|
+
return React.useMemo(() => {
|
|
432
|
+
if (!walletId) return ""
|
|
433
|
+
return (walletConfigs[walletId]?.icon || "") as string
|
|
434
|
+
}, [walletId, walletConfigs])
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Hook to get wallet name
|
|
439
|
+
*/
|
|
440
|
+
export function useWalletName(walletId?: string): string {
|
|
441
|
+
const walletConfigs = useWalletConfigs()
|
|
442
|
+
|
|
443
|
+
return React.useMemo(() => {
|
|
444
|
+
if (!walletId) return ""
|
|
445
|
+
return (walletConfigs[walletId]?.name || "") as string
|
|
446
|
+
}, [walletId, walletConfigs])
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Legacy functions for backward compatibility (use hooks instead)
|
|
450
|
+
export const getWalletIcon = (
|
|
451
|
+
walletId?: string,
|
|
452
|
+
projectAccessKey?: string,
|
|
453
|
+
): string => {
|
|
303
454
|
if (!walletId) return ""
|
|
304
|
-
|
|
455
|
+
const walletConfigs = getWalletConfigsInternal(projectAccessKey)
|
|
456
|
+
return (walletConfigs[walletId]?.icon || "") as string
|
|
305
457
|
}
|
|
306
458
|
|
|
307
|
-
export const getWalletName = (
|
|
459
|
+
export const getWalletName = (
|
|
460
|
+
walletId?: string,
|
|
461
|
+
projectAccessKey?: string,
|
|
462
|
+
): string => {
|
|
308
463
|
if (!walletId) return ""
|
|
309
|
-
|
|
464
|
+
const walletConfigs = getWalletConfigsInternal(projectAccessKey)
|
|
465
|
+
return (walletConfigs[walletId]?.name || "") as string
|
|
310
466
|
}
|
|
311
467
|
|
|
312
468
|
export const wagmiConnectorToWalletId = (wagmiConnector: any): string => {
|
|
@@ -332,13 +488,14 @@ export const wagmiConnectorToWalletId = (wagmiConnector: any): string => {
|
|
|
332
488
|
return wagmiConnector.id || "injected"
|
|
333
489
|
}
|
|
334
490
|
|
|
335
|
-
// Hook to get combined wallets from
|
|
491
|
+
// Hook to get combined wallets from wallet configs and wagmi connectors
|
|
336
492
|
export const useWallets = () => {
|
|
337
493
|
const { connectors } = useConnect()
|
|
494
|
+
const walletConfigs = useWalletConfigs()
|
|
338
495
|
|
|
339
496
|
const allWallets = React.useMemo(() => {
|
|
340
497
|
// Get config wallets that have connectors
|
|
341
|
-
const configWallets = Object.values(
|
|
498
|
+
const configWallets = Object.values(walletConfigs)
|
|
342
499
|
.filter((config) => config.connector)
|
|
343
500
|
.map((config) => ({
|
|
344
501
|
id: config.id,
|
|
@@ -401,7 +558,7 @@ export const useWallets = () => {
|
|
|
401
558
|
}
|
|
402
559
|
|
|
403
560
|
return allWallets
|
|
404
|
-
}, [connectors])
|
|
561
|
+
}, [connectors, walletConfigs])
|
|
405
562
|
|
|
406
563
|
return {
|
|
407
564
|
wallets: allWallets,
|