0xtrails 0.5.0 → 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-DhEkQ6QC.js → ccip-Dw5AN7oU.js} +1 -1
- package/dist/cctp.d.ts +0 -149
- package/dist/cctp.d.ts.map +1 -1
- package/dist/chains.d.ts +28 -3
- package/dist/chains.d.ts.map +1 -1
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -1
- 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-MhD2DA7_.js → index-BtVUTbEZ.js} +30984 -38945
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -107
- package/dist/indexerClient.d.ts +2 -2
- package/dist/intents.d.ts +0 -17
- 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/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +10 -8
- package/dist/tokens.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 +4 -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 +6 -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 +2 -20
- 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/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/Toast.d.ts.map +1 -1
- package/dist/widget/components/TokenImage.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 +5 -8
- 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.js +1 -1
- package/dist/widget/providers/TrailsProvider.d.ts +23 -12
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/widget.d.ts +11 -0
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/analytics.ts +53 -21
- package/src/cctp.ts +0 -1016
- package/src/chains.ts +93 -39
- package/src/config.ts +24 -6
- package/src/constants.ts +1 -4
- 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 +7 -6
- package/src/indexerClient.ts +2 -2
- package/src/intents.ts +52 -206
- package/src/mutations.ts +3 -2
- package/src/paymasterSend.ts +2 -5
- package/src/prepareSend.ts +9 -12
- package/src/sendUserOp.ts +3 -64
- package/src/tokenBalances.ts +2 -1
- package/src/tokens.ts +62 -133
- package/src/trailsClient.ts +1 -1
- 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 +165 -385
- 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 +6 -27
- package/src/transactionIntent/utils/index.ts +0 -1
- package/src/transactions.ts +6 -203
- package/src/umd.tsx +1 -3
- package/src/utils.ts +28 -8
- package/src/walletUtils.ts +42 -0
- package/src/wallets.ts +361 -203
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +73 -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 +1 -1
- 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/Toast.tsx +10 -0
- package/src/widget/components/TokenImage.tsx +56 -13
- 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 +788 -418
- package/src/widget/hooks/useIsConnectedWalletSmartContract.ts +43 -0
- package/src/widget/hooks/useIsSequenceWallet.ts +17 -0
- package/src/widget/hooks/useQuote.ts +16 -17
- package/src/widget/hooks/useRecentTokens.ts +2 -1
- package/src/widget/hooks/useSelectedFeeOption.tsx +257 -0
- package/src/widget/hooks/useSendForm.ts +172 -47
- package/src/widget/hooks/useTokenList.ts +15 -2
- package/src/widget/providers/TrailsProvider.tsx +53 -25
- package/src/widget/widget.tsx +119 -48
- 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/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 -69
- package/src/preconditions.ts +0 -47
- 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
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { useConnect } from "wagmi"
|
|
14
14
|
import React from "react"
|
|
15
15
|
import { sequenceWallet } from "@0xsequence/connect"
|
|
16
|
+
import { useTrails } from "./widget/providers/TrailsProvider.js"
|
|
16
17
|
|
|
17
18
|
type Connector = any
|
|
18
19
|
|
|
@@ -23,6 +24,13 @@ export interface WalletConfig {
|
|
|
23
24
|
connector?: Connector
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
export interface QRCodeWalletOption {
|
|
28
|
+
id: string
|
|
29
|
+
label: string
|
|
30
|
+
usesEip681: boolean
|
|
31
|
+
icon: string
|
|
32
|
+
}
|
|
33
|
+
|
|
26
34
|
// WalletConnect connector singleton to avoid multiple Core initializations
|
|
27
35
|
let wcConnectorSingleton: ReturnType<typeof walletConnect> | null = null
|
|
28
36
|
function getWalletConnectConnectorSingleton() {
|
|
@@ -39,10 +47,6 @@ function getWalletConnectConnectorSingleton() {
|
|
|
39
47
|
export const walletConnectConnector: Connector =
|
|
40
48
|
getWalletConnectConnectorSingleton()
|
|
41
49
|
|
|
42
|
-
export const injectedConnector = injected()
|
|
43
|
-
export const baseAccountConnector: Connector = baseAccount()
|
|
44
|
-
export const geminiConnector: Connector = gemini()
|
|
45
|
-
|
|
46
50
|
function isInIframe() {
|
|
47
51
|
// check if we're in an iframe
|
|
48
52
|
if (window?.parent === window) {
|
|
@@ -93,201 +97,321 @@ export function windowProviderOrWalletConnect(
|
|
|
93
97
|
return walletConnectConnector
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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: {
|
|
99
255
|
id: "metamask",
|
|
100
|
-
name: "
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
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
|
+
}
|
|
106
357
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"OKX Wallet",
|
|
126
|
-
)
|
|
127
|
-
export const zerionConnector = windowProviderOrWalletConnect(
|
|
128
|
-
"zerion",
|
|
129
|
-
"zerionWallet",
|
|
130
|
-
"Zerion",
|
|
131
|
-
)
|
|
132
|
-
export const ambireConnector = windowProviderOrWalletConnect(
|
|
133
|
-
"ambire",
|
|
134
|
-
"ambire",
|
|
135
|
-
"Ambire",
|
|
136
|
-
)
|
|
137
|
-
export const rabbyConnector = windowProviderOrWalletConnect(
|
|
138
|
-
"rabby",
|
|
139
|
-
"rabby",
|
|
140
|
-
"Rabby",
|
|
141
|
-
)
|
|
142
|
-
export const coinbaseWalletConnector = windowProviderOrWalletConnect(
|
|
143
|
-
"coinbase",
|
|
144
|
-
"coinbaseWalletExtension",
|
|
145
|
-
"Coinbase Wallet",
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
export const sequenceConnector: any = sequenceWallet({
|
|
149
|
-
connect: {
|
|
150
|
-
app: "Trails",
|
|
151
|
-
projectAccessKey: getConfig("trailsApiKey"),
|
|
152
|
-
},
|
|
153
|
-
defaultNetwork: 1,
|
|
154
|
-
walletAppURL: "https://sequence.app",
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
export const safeConnector: Connector = safeProviderOrWalletConnect()
|
|
158
|
-
|
|
159
|
-
export const connectors = [
|
|
160
|
-
injectedConnector,
|
|
161
|
-
walletConnectConnector,
|
|
162
|
-
safeConnector,
|
|
163
|
-
baseAccountConnector,
|
|
164
|
-
geminiConnector,
|
|
165
|
-
coinbaseWalletConnector,
|
|
166
|
-
metamaskConnector,
|
|
167
|
-
rainbowConnector,
|
|
168
|
-
trustwalletConnector,
|
|
169
|
-
phantomConnector,
|
|
170
|
-
okxwalletConnector,
|
|
171
|
-
zerionConnector,
|
|
172
|
-
ambireConnector,
|
|
173
|
-
rabbyConnector,
|
|
174
|
-
sequenceConnector,
|
|
175
|
-
]
|
|
358
|
+
/**
|
|
359
|
+
* Hook to get QR code wallet options
|
|
360
|
+
*/
|
|
361
|
+
export function useQRCodeWallets(): QRCodeWalletOption[] {
|
|
362
|
+
const { trailsApiKey } = useTrails()
|
|
363
|
+
|
|
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)
|
|
176
376
|
|
|
177
|
-
|
|
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
|
-
id: "trust",
|
|
216
|
-
name: "Trust",
|
|
217
|
-
connector: trustwalletConnector,
|
|
218
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/7677b54f-3486-46e2-4e37-bf8747814f00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
219
|
-
},
|
|
220
|
-
ambire: {
|
|
221
|
-
id: "ambire",
|
|
222
|
-
name: "Ambire Wallet",
|
|
223
|
-
connector: ambireConnector,
|
|
224
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/c39b3a16-1a38-4588-f089-cb7aeb584700?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
225
|
-
},
|
|
226
|
-
argent: {
|
|
227
|
-
id: "argent",
|
|
228
|
-
name: "Argent",
|
|
229
|
-
connector: walletConnectConnector,
|
|
230
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/215158d2-614b-49c9-410f-77aa661c3900?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
231
|
-
},
|
|
232
|
-
binance: {
|
|
233
|
-
id: "binance",
|
|
234
|
-
name: "Binance Wallet",
|
|
235
|
-
connector: walletConnectConnector,
|
|
236
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/ebac7b39-688c-41e3-7912-a4fefba74600?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
237
|
-
},
|
|
238
|
-
okx: {
|
|
239
|
-
id: "okx",
|
|
240
|
-
name: "OKX Wallet",
|
|
241
|
-
connector: okxwalletConnector,
|
|
242
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/c55df831-3c52-49fc-d1d1-97a926dc0c00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
243
|
-
},
|
|
244
|
-
zerion: {
|
|
245
|
-
id: "zerion",
|
|
246
|
-
name: "Zerion",
|
|
247
|
-
connector: zerionConnector,
|
|
248
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/73f6f52f-7862-49e7-bb85-ba93ab72cc00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
249
|
-
},
|
|
250
|
-
phantom: {
|
|
251
|
-
id: "phantom",
|
|
252
|
-
name: "Phantom",
|
|
253
|
-
connector: phantomConnector,
|
|
254
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/b6ec7b81-bb4f-427d-e290-7631e6e50d00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
255
|
-
},
|
|
256
|
-
coinbase: {
|
|
257
|
-
id: "coinbase",
|
|
258
|
-
name: "Coinbase Wallet",
|
|
259
|
-
connector: coinbaseWalletConnector,
|
|
260
|
-
icon: "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",
|
|
261
|
-
},
|
|
262
|
-
rabby: {
|
|
263
|
-
id: "rabby",
|
|
264
|
-
name: "Rabby",
|
|
265
|
-
connector: rabbyConnector,
|
|
266
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/255e6ba2-8dfd-43ad-e88e-57cbb98f6800?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
267
|
-
},
|
|
268
|
-
privy: {
|
|
269
|
-
id: "privy",
|
|
270
|
-
name: "Privy",
|
|
271
|
-
icon: "https://avatars.githubusercontent.com/u/81824329?s=200&v=4",
|
|
272
|
-
},
|
|
273
|
-
gemini: {
|
|
274
|
-
id: "gemini",
|
|
275
|
-
name: "Gemini",
|
|
276
|
-
connector: geminiConnector,
|
|
277
|
-
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/56a3fd87-2627-4903-fddd-205224dac500?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
278
|
-
},
|
|
279
|
-
sequence: {
|
|
280
|
-
id: "sequence",
|
|
281
|
-
name: "Sequence",
|
|
282
|
-
connector: sequenceConnector,
|
|
283
|
-
icon: SequenceLogo as string,
|
|
284
|
-
},
|
|
285
|
-
"sequence-waas": {
|
|
286
|
-
id: "sequence-waas",
|
|
287
|
-
name: "Sequence WaaS",
|
|
288
|
-
connector: sequenceConnector,
|
|
289
|
-
icon: SequenceLogo as string,
|
|
290
|
-
},
|
|
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[]
|
|
291
415
|
}
|
|
292
416
|
|
|
293
417
|
export const topShownWallets = [
|
|
@@ -298,14 +422,47 @@ export const topShownWallets = [
|
|
|
298
422
|
"phantom",
|
|
299
423
|
]
|
|
300
424
|
|
|
301
|
-
|
|
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 => {
|
|
302
454
|
if (!walletId) return ""
|
|
303
|
-
|
|
455
|
+
const walletConfigs = getWalletConfigsInternal(projectAccessKey)
|
|
456
|
+
return (walletConfigs[walletId]?.icon || "") as string
|
|
304
457
|
}
|
|
305
458
|
|
|
306
|
-
export const getWalletName = (
|
|
459
|
+
export const getWalletName = (
|
|
460
|
+
walletId?: string,
|
|
461
|
+
projectAccessKey?: string,
|
|
462
|
+
): string => {
|
|
307
463
|
if (!walletId) return ""
|
|
308
|
-
|
|
464
|
+
const walletConfigs = getWalletConfigsInternal(projectAccessKey)
|
|
465
|
+
return (walletConfigs[walletId]?.name || "") as string
|
|
309
466
|
}
|
|
310
467
|
|
|
311
468
|
export const wagmiConnectorToWalletId = (wagmiConnector: any): string => {
|
|
@@ -331,13 +488,14 @@ export const wagmiConnectorToWalletId = (wagmiConnector: any): string => {
|
|
|
331
488
|
return wagmiConnector.id || "injected"
|
|
332
489
|
}
|
|
333
490
|
|
|
334
|
-
// Hook to get combined wallets from
|
|
491
|
+
// Hook to get combined wallets from wallet configs and wagmi connectors
|
|
335
492
|
export const useWallets = () => {
|
|
336
493
|
const { connectors } = useConnect()
|
|
494
|
+
const walletConfigs = useWalletConfigs()
|
|
337
495
|
|
|
338
496
|
const allWallets = React.useMemo(() => {
|
|
339
497
|
// Get config wallets that have connectors
|
|
340
|
-
const configWallets = Object.values(
|
|
498
|
+
const configWallets = Object.values(walletConfigs)
|
|
341
499
|
.filter((config) => config.connector)
|
|
342
500
|
.map((config) => ({
|
|
343
501
|
id: config.id,
|
|
@@ -400,7 +558,7 @@ export const useWallets = () => {
|
|
|
400
558
|
}
|
|
401
559
|
|
|
402
560
|
return allWallets
|
|
403
|
-
}, [connectors])
|
|
561
|
+
}, [connectors, walletConfigs])
|
|
404
562
|
|
|
405
563
|
return {
|
|
406
564
|
wallets: allWallets,
|