0xtrails 0.1.2 → 0.1.4
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/address.d.ts.map +1 -1
- package/dist/analytics.d.ts +86 -1
- 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-BmFTEOaB.js → ccip-dLSEJjCf.js} +55 -55
- package/dist/cctpqueue.d.ts +1 -1
- package/dist/cctpqueue.d.ts.map +1 -1
- package/dist/chains.d.ts +9 -3
- package/dist/chains.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/decoders.d.ts +58 -0
- package/dist/decoders.d.ts.map +1 -0
- package/dist/ens.d.ts +13 -0
- package/dist/ens.d.ts.map +1 -0
- package/dist/error.d.ts +9 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/{index-BPsVj7zK.js → index-BXbaLmtt.js} +28779 -25738
- package/dist/index.js +2 -2
- package/dist/intents.d.ts +4 -4
- package/dist/intents.d.ts.map +1 -1
- package/dist/lifi.d.ts +4 -0
- package/dist/lifi.d.ts.map +1 -0
- package/dist/metaTxns.d.ts +1 -1
- package/dist/metaTxns.d.ts.map +1 -1
- package/dist/mode.d.ts +1 -1
- package/dist/mode.d.ts.map +1 -1
- package/dist/preconditions.d.ts +1 -1
- package/dist/preconditions.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +32 -24
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +3 -1
- package/dist/prices.d.ts.map +1 -1
- package/dist/proxyCaller.d.ts +0 -1
- package/dist/proxyCaller.d.ts.map +1 -1
- package/dist/relaySdk.d.ts.map +1 -1
- package/dist/relayer.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts +1 -1
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +2 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trails.d.ts +4 -4
- package/dist/trails.d.ts.map +1 -1
- package/dist/transactions.d.ts +4 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/wallets.d.ts +247 -5
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/ChainFilterDropdown.d.ts +2 -0
- package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts +1 -0
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/DebugScreensDropdown.d.ts.map +1 -1
- package/dist/widget/components/ErrorDisplay.d.ts +9 -0
- package/dist/widget/components/ErrorDisplay.d.ts.map +1 -0
- package/dist/widget/components/FundSendForm.d.ts +2 -2
- package/dist/widget/components/FundSendForm.d.ts.map +1 -1
- package/dist/widget/components/OriginTransferInformation.d.ts +10 -0
- package/dist/widget/components/OriginTransferInformation.d.ts.map +1 -0
- package/dist/widget/components/PaySendForm.d.ts +2 -2
- package/dist/widget/components/PaySendForm.d.ts.map +1 -1
- package/dist/widget/components/QrCode.d.ts +1 -1
- package/dist/widget/components/QrCode.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/Receive.d.ts +12 -0
- package/dist/widget/components/Receive.d.ts.map +1 -0
- package/dist/widget/components/RefundAddressInput.d.ts +13 -0
- package/dist/widget/components/RefundAddressInput.d.ts.map +1 -0
- package/dist/widget/components/Swap.d.ts +47 -0
- package/dist/widget/components/Swap.d.ts.map +1 -0
- package/dist/widget/components/SwapDisplay.d.ts +9 -0
- package/dist/widget/components/SwapDisplay.d.ts.map +1 -0
- package/dist/widget/components/TokenList.d.ts +0 -2
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts +26 -0
- package/dist/widget/components/TokenSelector.d.ts.map +1 -0
- package/dist/widget/components/TransferPendingVertical.d.ts +2 -0
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/components/WalletConnectionPending.d.ts +12 -0
- package/dist/widget/components/WalletConnectionPending.d.ts.map +1 -0
- package/dist/widget/components/WalletList.d.ts.map +1 -1
- package/dist/widget/components/YellowWarningAnimation.d.ts +2 -0
- package/dist/widget/components/YellowWarningAnimation.d.ts.map +1 -0
- package/dist/widget/hooks/useAmountUsd.d.ts +1 -3
- package/dist/widget/hooks/useAmountUsd.d.ts.map +1 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useDebugScreens.d.ts +22 -0
- package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -0
- package/dist/widget/hooks/useSendForm.d.ts +12 -6
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts +2 -3
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +19 -15
- package/src/aave.ts +13 -13
- package/src/address.ts +3 -0
- package/src/analytics.ts +192 -8
- package/src/apiClient.ts +1 -1
- package/src/cctpqueue.ts +1 -1
- package/src/chains.ts +45 -7
- package/src/constants.ts +7 -4
- package/src/decoders.ts +310 -0
- package/src/ens.ts +32 -0
- package/src/error.ts +101 -1
- package/src/intents.ts +10 -2
- package/src/lifi.ts +58 -0
- package/src/metaTxns.ts +1 -1
- package/src/mode.ts +1 -1
- package/src/morpho.ts +3 -3
- package/src/pools.ts +18 -18
- package/src/preconditions.ts +1 -1
- package/src/prepareSend.ts +463 -113
- package/src/prices.ts +26 -1
- package/src/proxyCaller.ts +2 -14
- package/src/relaySdk.ts +1 -0
- package/src/relayer.ts +8 -0
- package/src/tokenBalances.ts +24 -17
- package/src/tokens.ts +147 -22
- package/src/trails.ts +4 -4
- package/src/transactions.ts +35 -17
- package/src/utils.ts +28 -0
- package/src/wallets.ts +275 -35
- package/src/widget/compiled.css +2 -2
- package/src/widget/components/ChainFilterDropdown.tsx +42 -33
- package/src/widget/components/ChainImage.tsx +1 -1
- package/src/widget/components/ConnectWallet.tsx +92 -128
- package/src/widget/components/DebugScreensDropdown.tsx +6 -0
- package/src/widget/components/ErrorDisplay.tsx +150 -0
- package/src/widget/components/FundSendForm.tsx +78 -11
- package/src/widget/components/OriginTransferInformation.tsx +59 -0
- package/src/widget/components/PaySendForm.tsx +80 -13
- package/src/widget/components/QRCodeDeposit.tsx +6 -6
- package/src/widget/components/QrCode.tsx +278 -17
- package/src/widget/components/QuoteDetails.tsx +93 -25
- package/src/widget/components/Receipt.tsx +296 -103
- package/src/widget/components/Receive.tsx +146 -0
- package/src/widget/components/RecentTokens.tsx +1 -1
- package/src/widget/components/RefundAddressInput.tsx +149 -0
- package/src/widget/components/Swap.tsx +769 -0
- package/src/widget/components/SwapDisplay.tsx +68 -0
- package/src/widget/components/TokenList.tsx +27 -363
- package/src/widget/components/TokenSelector.tsx +405 -0
- package/src/widget/components/TransferPendingVertical.tsx +162 -112
- package/src/widget/components/WalletConnect.tsx +9 -7
- package/src/widget/components/WalletConnectionPending.tsx +157 -0
- package/src/widget/components/WalletList.tsx +6 -5
- package/src/widget/components/YellowWarningAnimation.tsx +146 -0
- package/src/widget/hooks/useAmountUsd.ts +3 -8
- package/src/widget/hooks/useCheckout.ts +3 -2
- package/src/widget/hooks/useDebugScreens.ts +583 -0
- package/src/widget/hooks/useSendForm.ts +111 -35
- package/src/widget/hooks/useTokenList.ts +155 -122
- package/src/widget/widget.tsx +503 -523
package/src/wallets.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { getWalletConnectProjectId } from "./config.js"
|
|
2
2
|
import WalletConnectLogo from "./widget/assets/WalletConnect-logo-blue-bg.svg"
|
|
3
3
|
import { Wallet as WalletIcon } from "lucide-react"
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
injected,
|
|
6
|
+
walletConnect,
|
|
7
|
+
safe,
|
|
8
|
+
baseAccount,
|
|
9
|
+
gemini,
|
|
10
|
+
} from "wagmi/connectors"
|
|
11
|
+
import { useConnect } from "wagmi"
|
|
12
|
+
import React from "react"
|
|
6
13
|
|
|
7
14
|
type Connector = any
|
|
8
15
|
|
|
9
16
|
export interface WalletConfig {
|
|
10
17
|
id: string
|
|
11
18
|
name: string
|
|
12
|
-
|
|
13
|
-
connector
|
|
19
|
+
icon: string
|
|
20
|
+
connector?: Connector
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
// WalletConnect connector singleton to avoid multiple Core initializations
|
|
@@ -25,97 +32,226 @@ function getWalletConnectConnectorSingleton() {
|
|
|
25
32
|
return wcConnectorSingleton
|
|
26
33
|
}
|
|
27
34
|
|
|
28
|
-
export const walletConnectConnector:
|
|
29
|
-
getWalletConnectConnectorSingleton
|
|
35
|
+
export const walletConnectConnector: Connector =
|
|
36
|
+
getWalletConnectConnectorSingleton()
|
|
37
|
+
|
|
38
|
+
export const injectedConnector = injected()
|
|
39
|
+
export const safeConnector: Connector = safe()
|
|
40
|
+
export const baseAccountConnector: Connector = baseAccount()
|
|
41
|
+
export const geminiConnector: Connector = gemini()
|
|
42
|
+
|
|
43
|
+
export function windowProviderOrWalletConnect(
|
|
44
|
+
walletId: string,
|
|
45
|
+
windowObjectIdentifier: string | string[],
|
|
46
|
+
name: string,
|
|
47
|
+
) {
|
|
48
|
+
if (typeof window !== "undefined") {
|
|
49
|
+
let provider: any
|
|
50
|
+
if (Array.isArray(windowObjectIdentifier)) {
|
|
51
|
+
// Handle array case: ["phantom", "ethereum"] -> window.phantom.ethereum
|
|
52
|
+
provider = windowObjectIdentifier.reduce(
|
|
53
|
+
(obj, key) => obj?.[key],
|
|
54
|
+
window as any,
|
|
55
|
+
)
|
|
56
|
+
} else {
|
|
57
|
+
// Handle string case: "phantom" -> window.phantom
|
|
58
|
+
provider = (window as any)[windowObjectIdentifier]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (provider) {
|
|
62
|
+
return injected({
|
|
63
|
+
target() {
|
|
64
|
+
return {
|
|
65
|
+
id: walletId,
|
|
66
|
+
name: name || walletId,
|
|
67
|
+
provider: provider,
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return walletConnectConnector
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const metamaskConnector = injected({
|
|
77
|
+
target() {
|
|
78
|
+
return {
|
|
79
|
+
id: "metamask",
|
|
80
|
+
name: "metamask",
|
|
81
|
+
provider:
|
|
82
|
+
typeof window !== "undefined" ? (window as any).ethereum : undefined,
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
export const rainbowConnector = windowProviderOrWalletConnect(
|
|
88
|
+
"rainbow",
|
|
89
|
+
"rainbow",
|
|
90
|
+
"Rainbow",
|
|
91
|
+
)
|
|
92
|
+
export const trustwalletConnector = windowProviderOrWalletConnect(
|
|
93
|
+
"trustwallet",
|
|
94
|
+
"trustwallet",
|
|
95
|
+
"Trust",
|
|
96
|
+
)
|
|
97
|
+
export const phantomConnector = windowProviderOrWalletConnect(
|
|
98
|
+
"phantom",
|
|
99
|
+
["phantom", "ethereum"],
|
|
100
|
+
"Phantom",
|
|
101
|
+
)
|
|
102
|
+
export const okxwalletConnector = windowProviderOrWalletConnect(
|
|
103
|
+
"okxwallet",
|
|
104
|
+
"okxwallet",
|
|
105
|
+
"OKX Wallet",
|
|
106
|
+
)
|
|
107
|
+
export const zerionConnector = windowProviderOrWalletConnect(
|
|
108
|
+
"zerion",
|
|
109
|
+
"zerionWallet",
|
|
110
|
+
"Zerion",
|
|
111
|
+
)
|
|
112
|
+
export const ambireConnector = windowProviderOrWalletConnect(
|
|
113
|
+
"ambire",
|
|
114
|
+
"ambire",
|
|
115
|
+
"Ambire",
|
|
116
|
+
)
|
|
117
|
+
export const rabbyConnector = windowProviderOrWalletConnect(
|
|
118
|
+
"rabby",
|
|
119
|
+
"rabby",
|
|
120
|
+
"Rabby",
|
|
121
|
+
)
|
|
122
|
+
export const coinbaseWalletConnector = windowProviderOrWalletConnect(
|
|
123
|
+
"coinbase",
|
|
124
|
+
"coinbaseWalletExtension",
|
|
125
|
+
"Coinbase Wallet",
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
export const connectors = [
|
|
129
|
+
injectedConnector,
|
|
130
|
+
walletConnectConnector,
|
|
131
|
+
safeConnector,
|
|
132
|
+
baseAccountConnector,
|
|
133
|
+
geminiConnector,
|
|
134
|
+
coinbaseWalletConnector,
|
|
135
|
+
metamaskConnector,
|
|
136
|
+
rainbowConnector,
|
|
137
|
+
trustwalletConnector,
|
|
138
|
+
phantomConnector,
|
|
139
|
+
okxwalletConnector,
|
|
140
|
+
zerionConnector,
|
|
141
|
+
ambireConnector,
|
|
142
|
+
rabbyConnector,
|
|
143
|
+
]
|
|
30
144
|
|
|
31
145
|
export const WALLET_CONFIGS: Record<string, WalletConfig> = {
|
|
32
146
|
injected: {
|
|
33
147
|
id: "injected",
|
|
34
|
-
name: "
|
|
35
|
-
connector:
|
|
36
|
-
|
|
148
|
+
name: "Browser Wallet",
|
|
149
|
+
connector: injectedConnector,
|
|
150
|
+
icon: WalletIcon as unknown as string,
|
|
37
151
|
},
|
|
38
152
|
walletconnect: {
|
|
39
153
|
id: "walletconnect",
|
|
40
154
|
name: "WalletConnect",
|
|
41
155
|
connector: walletConnectConnector,
|
|
42
|
-
|
|
156
|
+
icon: WalletConnectLogo as string,
|
|
43
157
|
},
|
|
44
158
|
metamask: {
|
|
45
159
|
id: "metamask",
|
|
46
160
|
name: "MetaMask",
|
|
47
|
-
connector:
|
|
48
|
-
|
|
161
|
+
connector: metamaskConnector,
|
|
162
|
+
icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMzAiIHZpZXdC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U0eiIvPjwvc3ZnPjwvc3ZnPg==",
|
|
49
163
|
},
|
|
50
164
|
baseAccount: {
|
|
51
165
|
id: "baseAccount",
|
|
52
166
|
name: "Base",
|
|
53
|
-
connector:
|
|
54
|
-
|
|
167
|
+
connector: baseAccountConnector,
|
|
168
|
+
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAALZJREFUaEPtmjEOhDAMBNc/O14GvOzys3CAKK6eAlmaVGl2Zc+kTOU685vkc9/bnD2prZK5/TZY24z9P+g4F5hNh7/GdoG37WlAA5CATwgCxHENYISwQAMQII5rACOEBRqAAHFcAxghLNAABIjjGsAIYYEGIEAc1wBGCAs0AAHiuAYwQligAQgQxzWAEcICDUCAOK4BjBAWaAACxHENYISwQAMQII6fBjr+VHkW3+u+tfyxMpJaDgYzYxb/ALZVAAAAAElFTkSuQmCC",
|
|
55
169
|
},
|
|
56
170
|
safe: {
|
|
57
171
|
id: "safe",
|
|
58
172
|
name: "Safe",
|
|
59
|
-
connector:
|
|
60
|
-
|
|
173
|
+
connector: safeConnector,
|
|
174
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/3913df81-63c2-4413-d60b-8ff83cbed500?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
61
175
|
},
|
|
62
176
|
rainbow: {
|
|
63
177
|
id: "rainbow",
|
|
64
178
|
name: "Rainbow",
|
|
65
|
-
connector:
|
|
66
|
-
|
|
179
|
+
connector: rainbowConnector,
|
|
180
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
67
181
|
},
|
|
68
182
|
trust: {
|
|
69
183
|
id: "trust",
|
|
70
184
|
name: "Trust",
|
|
71
|
-
connector:
|
|
72
|
-
|
|
185
|
+
connector: trustwalletConnector,
|
|
186
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/7677b54f-3486-46e2-4e37-bf8747814f00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
73
187
|
},
|
|
74
188
|
ambire: {
|
|
75
189
|
id: "ambire",
|
|
76
190
|
name: "Ambire Wallet",
|
|
77
|
-
connector:
|
|
78
|
-
|
|
191
|
+
connector: ambireConnector,
|
|
192
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/c39b3a16-1a38-4588-f089-cb7aeb584700?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
79
193
|
},
|
|
80
194
|
argent: {
|
|
81
195
|
id: "argent",
|
|
82
196
|
name: "Argent",
|
|
83
197
|
connector: walletConnectConnector,
|
|
84
|
-
|
|
198
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/215158d2-614b-49c9-410f-77aa661c3900?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
85
199
|
},
|
|
86
200
|
binance: {
|
|
87
201
|
id: "binance",
|
|
88
202
|
name: "Binance Wallet",
|
|
89
203
|
connector: walletConnectConnector,
|
|
90
|
-
|
|
204
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/ebac7b39-688c-41e3-7912-a4fefba74600?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
91
205
|
},
|
|
92
206
|
okx: {
|
|
93
207
|
id: "okx",
|
|
94
208
|
name: "OKX Wallet",
|
|
95
|
-
connector:
|
|
96
|
-
|
|
209
|
+
connector: okxwalletConnector,
|
|
210
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/c55df831-3c52-49fc-d1d1-97a926dc0c00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
97
211
|
},
|
|
98
212
|
zerion: {
|
|
99
213
|
id: "zerion",
|
|
100
214
|
name: "Zerion",
|
|
101
|
-
connector:
|
|
102
|
-
|
|
215
|
+
connector: zerionConnector,
|
|
216
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/73f6f52f-7862-49e7-bb85-ba93ab72cc00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
103
217
|
},
|
|
104
218
|
phantom: {
|
|
105
219
|
id: "phantom",
|
|
106
220
|
name: "Phantom",
|
|
107
|
-
connector:
|
|
108
|
-
|
|
221
|
+
connector: phantomConnector,
|
|
222
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/b6ec7b81-bb4f-427d-e290-7631e6e50d00?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
109
223
|
},
|
|
110
224
|
coinbase: {
|
|
111
225
|
id: "coinbase",
|
|
112
226
|
name: "Coinbase Wallet",
|
|
113
|
-
connector:
|
|
114
|
-
|
|
227
|
+
connector: coinbaseWalletConnector,
|
|
228
|
+
icon: "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",
|
|
229
|
+
},
|
|
230
|
+
rabby: {
|
|
231
|
+
id: "rabby",
|
|
232
|
+
name: "Rabby",
|
|
233
|
+
connector: rabbyConnector,
|
|
234
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/255e6ba2-8dfd-43ad-e88e-57cbb98f6800?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
235
|
+
},
|
|
236
|
+
privy: {
|
|
237
|
+
id: "privy",
|
|
238
|
+
name: "Privy",
|
|
239
|
+
icon: "https://avatars.githubusercontent.com/u/81824329?s=200&v=4",
|
|
240
|
+
},
|
|
241
|
+
gemini: {
|
|
242
|
+
id: "gemini",
|
|
243
|
+
name: "Gemini",
|
|
244
|
+
connector: geminiConnector,
|
|
245
|
+
icon: "https://explorer-api.walletconnect.com/v3/logo/sm/56a3fd87-2627-4903-fddd-205224dac500?projectId=34357d3c125c2bcf2ce2bc3309d98715",
|
|
246
|
+
},
|
|
247
|
+
sequence: {
|
|
248
|
+
id: "sequence",
|
|
249
|
+
name: "Sequence",
|
|
250
|
+
icon: "https://v3.sequence-dev.app/icon.svg",
|
|
115
251
|
},
|
|
116
252
|
}
|
|
117
253
|
|
|
118
|
-
export const
|
|
254
|
+
export const topShownWallets = [
|
|
119
255
|
"metamask",
|
|
120
256
|
"walletconnect",
|
|
121
257
|
"baseAccount",
|
|
@@ -123,12 +259,116 @@ export const featuredWallets = [
|
|
|
123
259
|
"phantom",
|
|
124
260
|
]
|
|
125
261
|
|
|
126
|
-
export const
|
|
262
|
+
export const getWalletIcon = (walletId?: string): string => {
|
|
127
263
|
if (!walletId) return ""
|
|
128
|
-
return (WALLET_CONFIGS[walletId]?.
|
|
264
|
+
return (WALLET_CONFIGS[walletId]?.icon || "") as string
|
|
129
265
|
}
|
|
130
266
|
|
|
131
267
|
export const getWalletName = (walletId?: string): string => {
|
|
132
268
|
if (!walletId) return ""
|
|
133
269
|
return (WALLET_CONFIGS[walletId]?.name || "") as string
|
|
134
270
|
}
|
|
271
|
+
|
|
272
|
+
export const wagmiConnectorToWalletId = (wagmiConnector: any): string => {
|
|
273
|
+
const wagmiConnectorName = (
|
|
274
|
+
wagmiConnector?.name ||
|
|
275
|
+
wagmiConnector?.id ||
|
|
276
|
+
""
|
|
277
|
+
).toLowerCase()
|
|
278
|
+
if (wagmiConnectorName.includes("rabby")) return "rabby"
|
|
279
|
+
if (wagmiConnectorName.includes("metamask")) return "metamask"
|
|
280
|
+
if (wagmiConnectorName.includes("walletconnect")) return "walletconnect"
|
|
281
|
+
if (wagmiConnectorName.includes("coinbase")) return "coinbase"
|
|
282
|
+
if (wagmiConnectorName.includes("base")) return "baseAccount"
|
|
283
|
+
if (wagmiConnectorName.includes("rainbow")) return "rainbow"
|
|
284
|
+
if (wagmiConnectorName.includes("trust")) return "trust"
|
|
285
|
+
if (wagmiConnectorName.includes("ambire")) return "ambire"
|
|
286
|
+
if (wagmiConnectorName.includes("argent")) return "argent"
|
|
287
|
+
if (wagmiConnectorName.includes("okx")) return "okxwallet"
|
|
288
|
+
if (wagmiConnectorName.includes("privy")) return "privy"
|
|
289
|
+
if (wagmiConnectorName.includes("gemini")) return "gemini"
|
|
290
|
+
if (wagmiConnectorName.includes("sequence")) return "sequence"
|
|
291
|
+
return wagmiConnector.id || "injected"
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Hook to get combined wallets from WALLET_CONFIGS and wagmi connectors
|
|
295
|
+
export const useWallets = () => {
|
|
296
|
+
const { connectors } = useConnect()
|
|
297
|
+
|
|
298
|
+
const allWallets = React.useMemo(() => {
|
|
299
|
+
// Get config wallets that have connectors
|
|
300
|
+
const configWallets = Object.values(WALLET_CONFIGS)
|
|
301
|
+
.filter((config) => config.connector)
|
|
302
|
+
.map((config) => ({
|
|
303
|
+
id: config.id,
|
|
304
|
+
name: config.name,
|
|
305
|
+
icon: config.icon,
|
|
306
|
+
connector: config.connector,
|
|
307
|
+
source: "config" as const,
|
|
308
|
+
}))
|
|
309
|
+
|
|
310
|
+
// Get wagmi wallets
|
|
311
|
+
const wagmiWallets =
|
|
312
|
+
connectors?.map((connector: any) => ({
|
|
313
|
+
id: wagmiConnectorToWalletId(connector),
|
|
314
|
+
name: connector.name || "",
|
|
315
|
+
icon:
|
|
316
|
+
getWalletIcon(wagmiConnectorToWalletId(connector)) ||
|
|
317
|
+
connector.icon ||
|
|
318
|
+
"",
|
|
319
|
+
connector: connector,
|
|
320
|
+
source: "wagmi" as const,
|
|
321
|
+
})) || []
|
|
322
|
+
|
|
323
|
+
// Combine and deduplicate, prioritizing wagmi over config
|
|
324
|
+
const allWallets: any[] = []
|
|
325
|
+
|
|
326
|
+
for (const wallet of configWallets) {
|
|
327
|
+
if (!wallet.connector) {
|
|
328
|
+
wallet.connector = connectors?.find(
|
|
329
|
+
(connector: any) => wagmiConnectorToWalletId(connector) === wallet.id,
|
|
330
|
+
)
|
|
331
|
+
if (!wallet.connector) {
|
|
332
|
+
continue
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
allWallets.push({
|
|
336
|
+
id: wallet.id,
|
|
337
|
+
name: wallet.name,
|
|
338
|
+
icon: wallet.icon,
|
|
339
|
+
connector: wallet.connector,
|
|
340
|
+
source: "config" as const,
|
|
341
|
+
})
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
for (const wallet of wagmiWallets) {
|
|
345
|
+
if (
|
|
346
|
+
!allWallets.find((w: any) => w.id === wagmiConnectorToWalletId(wallet))
|
|
347
|
+
) {
|
|
348
|
+
const configWallet = configWallets.find(
|
|
349
|
+
(config: any) => config.id === wallet.id,
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
allWallets.push({
|
|
353
|
+
id: wallet.id,
|
|
354
|
+
name: configWallet?.name || wallet.name,
|
|
355
|
+
icon: configWallet?.icon || wallet.icon,
|
|
356
|
+
connector: wallet.connector,
|
|
357
|
+
source: "wagmi" as const,
|
|
358
|
+
})
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return allWallets
|
|
363
|
+
}, [connectors])
|
|
364
|
+
|
|
365
|
+
return {
|
|
366
|
+
wallets: allWallets,
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Helper method to find wallet by ID using the hook (for use in components)
|
|
371
|
+
export const useFindWalletById = (walletId: string) => {
|
|
372
|
+
const { wallets } = useWallets()
|
|
373
|
+
return wallets.find((wallet: any) => wallet.id === walletId) || null
|
|
374
|
+
}
|