@ant-design/web3-eth-web3js 0.0.0-alpha-20260209094036
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/CHANGELOG.md +252 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/esm/global.d.ts +5 -0
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/use-web3js.d.ts +4 -0
- package/dist/esm/hooks/use-web3js.js +21 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/wagmi.d.ts +4 -0
- package/dist/esm/wagmi.js +8 -0
- package/dist/esm/wallets/index.d.ts +1 -0
- package/dist/esm/wallets/index.js +1 -0
- package/dist/esm/web3js-provider/index.d.ts +1 -0
- package/dist/esm/web3js-provider/index.js +1 -0
- package/dist/esm/web3js-provider/web3js-provider.d.ts +7 -0
- package/dist/esm/web3js-provider/web3js-provider.js +58 -0
- package/dist/lib/global.d.ts +5 -0
- package/dist/lib/hooks/index.d.ts +1 -0
- package/dist/lib/hooks/index.js +16 -0
- package/dist/lib/hooks/use-web3js.d.ts +4 -0
- package/dist/lib/hooks/use-web3js.js +28 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +38 -0
- package/dist/lib/wagmi.d.ts +4 -0
- package/dist/lib/wagmi.js +31 -0
- package/dist/lib/wallets/index.d.ts +1 -0
- package/dist/lib/wallets/index.js +48 -0
- package/dist/lib/web3js-provider/index.d.ts +1 -0
- package/dist/lib/web3js-provider/index.js +16 -0
- package/dist/lib/web3js-provider/web3js-provider.d.ts +7 -0
- package/dist/lib/web3js-provider/web3js-provider.js +68 -0
- package/package.json +79 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# @ant-design/web3-eth-web3js
|
|
2
|
+
|
|
3
|
+
## 0.0.0-alpha-20260209094036
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [01dc595]
|
|
8
|
+
- @ant-design/web3-common@0.0.0-alpha-20260209094036
|
|
9
|
+
- @ant-design/web3-assets@0.0.0-alpha-20260209094036
|
|
10
|
+
- @ant-design/web3-wagmi@0.0.0-alpha-20260209094036
|
|
11
|
+
|
|
12
|
+
## 1.1.23
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [dfa67c5]
|
|
17
|
+
- Updated dependencies [2ae483c]
|
|
18
|
+
- @ant-design/web3-common@1.22.0
|
|
19
|
+
- @ant-design/web3-wagmi@2.13.0
|
|
20
|
+
- @ant-design/web3-assets@1.14.3
|
|
21
|
+
|
|
22
|
+
## 1.1.22
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- @ant-design/web3-assets@1.14.2
|
|
27
|
+
- @ant-design/web3-wagmi@2.12.2
|
|
28
|
+
|
|
29
|
+
## 1.1.21
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- @ant-design/web3-assets@1.14.1
|
|
34
|
+
- @ant-design/web3-wagmi@2.12.1
|
|
35
|
+
|
|
36
|
+
## 1.1.20
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [640bce9]
|
|
41
|
+
- Updated dependencies [3d6d7c6]
|
|
42
|
+
- @ant-design/web3-assets@1.14.0
|
|
43
|
+
- @ant-design/web3-common@1.21.0
|
|
44
|
+
- @ant-design/web3-wagmi@2.12.0
|
|
45
|
+
|
|
46
|
+
## 1.1.19
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [98dc8ef]
|
|
51
|
+
- Updated dependencies [b309635]
|
|
52
|
+
- Updated dependencies [d9629ed]
|
|
53
|
+
- @ant-design/web3-assets@1.13.0
|
|
54
|
+
- @ant-design/web3-wagmi@2.11.0
|
|
55
|
+
- @ant-design/web3-common@1.20.0
|
|
56
|
+
|
|
57
|
+
## 1.1.18
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [0f83657]
|
|
62
|
+
- @ant-design/web3-common@1.19.0
|
|
63
|
+
- @ant-design/web3-assets@1.12.1
|
|
64
|
+
- @ant-design/web3-wagmi@2.10.3
|
|
65
|
+
|
|
66
|
+
## 1.1.17
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- Updated dependencies [b6f1f1d]
|
|
71
|
+
- @ant-design/web3-assets@1.12.0
|
|
72
|
+
- @ant-design/web3-common@1.18.0
|
|
73
|
+
- @ant-design/web3-wagmi@2.10.2
|
|
74
|
+
|
|
75
|
+
## 1.1.16
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [f896044]
|
|
80
|
+
- @ant-design/web3-common@1.17.0
|
|
81
|
+
- @ant-design/web3-assets@1.11.8
|
|
82
|
+
- @ant-design/web3-wagmi@2.10.1
|
|
83
|
+
|
|
84
|
+
## 1.1.15
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- 8b857d3: chore: update wagmi version
|
|
89
|
+
- Updated dependencies [ad278cd]
|
|
90
|
+
- Updated dependencies [8b857d3]
|
|
91
|
+
- @ant-design/web3-common@1.16.0
|
|
92
|
+
- @ant-design/web3-wagmi@2.10.0
|
|
93
|
+
- @ant-design/web3-assets@1.11.7
|
|
94
|
+
|
|
95
|
+
## 1.1.14
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- @ant-design/web3-assets@1.11.6
|
|
100
|
+
- @ant-design/web3-wagmi@2.9.5
|
|
101
|
+
|
|
102
|
+
## 1.1.13
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- e0db15a: chore: upgrade pnpm version from 8.9.0 to 9.14.4
|
|
107
|
+
- Updated dependencies [14fae53]
|
|
108
|
+
- Updated dependencies [e0db15a]
|
|
109
|
+
- @ant-design/web3-assets@1.11.5
|
|
110
|
+
- @ant-design/web3-common@1.15.1
|
|
111
|
+
- @ant-design/web3-wagmi@2.9.4
|
|
112
|
+
|
|
113
|
+
## 1.1.12
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- Updated dependencies [0b2a19d]
|
|
118
|
+
- @ant-design/web3-common@1.15.0
|
|
119
|
+
- @ant-design/web3-assets@1.11.4
|
|
120
|
+
- @ant-design/web3-wagmi@2.9.3
|
|
121
|
+
|
|
122
|
+
## 1.1.11
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- @ant-design/web3-assets@1.11.3
|
|
127
|
+
- @ant-design/web3-wagmi@2.9.2
|
|
128
|
+
|
|
129
|
+
## 1.1.10
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- @ant-design/web3-assets@1.11.2
|
|
134
|
+
- @ant-design/web3-wagmi@2.9.1
|
|
135
|
+
|
|
136
|
+
## 1.1.9
|
|
137
|
+
|
|
138
|
+
### Patch Changes
|
|
139
|
+
|
|
140
|
+
- Updated dependencies [c32f8e2]
|
|
141
|
+
- Updated dependencies [613b265]
|
|
142
|
+
- @ant-design/web3-common@1.14.0
|
|
143
|
+
- @ant-design/web3-wagmi@2.9.0
|
|
144
|
+
- @ant-design/web3-assets@1.11.1
|
|
145
|
+
|
|
146
|
+
## 1.1.8
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- Updated dependencies [c22eb4d]
|
|
151
|
+
- @ant-design/web3-assets@1.11.0
|
|
152
|
+
- @ant-design/web3-wagmi@2.8.0
|
|
153
|
+
|
|
154
|
+
## 1.1.7
|
|
155
|
+
|
|
156
|
+
### Patch Changes
|
|
157
|
+
|
|
158
|
+
- Updated dependencies [efbd948]
|
|
159
|
+
- Updated dependencies [9bb1ea1]
|
|
160
|
+
- @ant-design/web3-wagmi@2.7.4
|
|
161
|
+
- @ant-design/web3-common@1.13.0
|
|
162
|
+
- @ant-design/web3-assets@1.10.2
|
|
163
|
+
|
|
164
|
+
## 1.1.6
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- Updated dependencies [615d403]
|
|
169
|
+
- Updated dependencies [8760a03]
|
|
170
|
+
- @ant-design/web3-wagmi@2.7.3
|
|
171
|
+
|
|
172
|
+
## 1.1.5
|
|
173
|
+
|
|
174
|
+
### Patch Changes
|
|
175
|
+
|
|
176
|
+
- 3f7d7a6: build: set targets chrome 100
|
|
177
|
+
- Updated dependencies [3f7d7a6]
|
|
178
|
+
- @ant-design/web3-assets@1.10.1
|
|
179
|
+
- @ant-design/web3-common@1.12.1
|
|
180
|
+
- @ant-design/web3-wagmi@2.7.2
|
|
181
|
+
|
|
182
|
+
## 1.1.4
|
|
183
|
+
|
|
184
|
+
### Patch Changes
|
|
185
|
+
|
|
186
|
+
- Updated dependencies [8f3430b]
|
|
187
|
+
- Updated dependencies [d663c3b]
|
|
188
|
+
- Updated dependencies [3727e20]
|
|
189
|
+
- @ant-design/web3-assets@1.10.0
|
|
190
|
+
- @ant-design/web3-wagmi@2.7.1
|
|
191
|
+
|
|
192
|
+
## 1.1.3
|
|
193
|
+
|
|
194
|
+
### Patch Changes
|
|
195
|
+
|
|
196
|
+
- Updated dependencies [f1b85b9]
|
|
197
|
+
- Updated dependencies [66aaab4]
|
|
198
|
+
- Updated dependencies [9321e7d]
|
|
199
|
+
- @ant-design/web3-common@1.12.0
|
|
200
|
+
- @ant-design/web3-wagmi@2.7.0
|
|
201
|
+
- @ant-design/web3-assets@1.9.0
|
|
202
|
+
|
|
203
|
+
## 1.1.2
|
|
204
|
+
|
|
205
|
+
### Patch Changes
|
|
206
|
+
|
|
207
|
+
- Updated dependencies [0d33add]
|
|
208
|
+
- Updated dependencies [4abe7c0]
|
|
209
|
+
- Updated dependencies [61c17c5]
|
|
210
|
+
- @ant-design/web3-assets@1.8.1
|
|
211
|
+
- @ant-design/web3-common@1.11.0
|
|
212
|
+
- @ant-design/web3-wagmi@2.6.0
|
|
213
|
+
|
|
214
|
+
## 1.1.1
|
|
215
|
+
|
|
216
|
+
### Patch Changes
|
|
217
|
+
|
|
218
|
+
- Updated dependencies [752dddd]
|
|
219
|
+
- Updated dependencies [6511134]
|
|
220
|
+
- Updated dependencies [8a6d1c7]
|
|
221
|
+
- @ant-design/web3-wagmi@2.5.0
|
|
222
|
+
- @ant-design/web3-assets@1.8.0
|
|
223
|
+
- @ant-design/web3-common@1.10.1
|
|
224
|
+
|
|
225
|
+
## 1.1.0
|
|
226
|
+
|
|
227
|
+
### Minor Changes
|
|
228
|
+
|
|
229
|
+
- 518fd83: chore: add storage props to config
|
|
230
|
+
|
|
231
|
+
### Patch Changes
|
|
232
|
+
|
|
233
|
+
- Updated dependencies [518fd83]
|
|
234
|
+
- Updated dependencies [dd6366c]
|
|
235
|
+
- Updated dependencies [518fd83]
|
|
236
|
+
- @ant-design/web3-wagmi@2.4.5
|
|
237
|
+
- @ant-design/web3-common@1.10.0
|
|
238
|
+
- @ant-design/web3-assets@1.7.2
|
|
239
|
+
|
|
240
|
+
## 1.0.0
|
|
241
|
+
|
|
242
|
+
### Major Changes
|
|
243
|
+
|
|
244
|
+
- 17c450f: feat(web3js): support web3js adapter for ethereum
|
|
245
|
+
|
|
246
|
+
### Patch Changes
|
|
247
|
+
|
|
248
|
+
- Updated dependencies [1270c95]
|
|
249
|
+
- Updated dependencies [02e74aa]
|
|
250
|
+
- @ant-design/web3-wagmi@2.4.4
|
|
251
|
+
- @ant-design/web3-assets@1.7.1
|
|
252
|
+
- @ant-design/web3-common@1.9.1
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Ant Design Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-web3js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useConnectorClient } from 'wagmi';
|
|
3
|
+
import { Web3 } from 'web3';
|
|
4
|
+
|
|
5
|
+
/* v8 ignore next 7 */
|
|
6
|
+
export const clientToWeb3js = client => {
|
|
7
|
+
const {
|
|
8
|
+
transport
|
|
9
|
+
} = client;
|
|
10
|
+
if (transport.type === 'fallback') {
|
|
11
|
+
return new Web3(transport.transports[0].value.url);
|
|
12
|
+
}
|
|
13
|
+
return new Web3(transport);
|
|
14
|
+
};
|
|
15
|
+
export function useWeb3js() {
|
|
16
|
+
const {
|
|
17
|
+
data: client
|
|
18
|
+
} = useConnectorClient();
|
|
19
|
+
/* v8 ignore next */
|
|
20
|
+
return useMemo(() => client ? clientToWeb3js(client) : null, [client]);
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* v8 ignore start */
|
|
2
|
+
export * from 'wagmi';
|
|
3
|
+
import * as _actions from 'wagmi/actions';
|
|
4
|
+
export { _actions as actions };
|
|
5
|
+
import * as _chains from 'wagmi/chains';
|
|
6
|
+
export { _chains as chains };
|
|
7
|
+
import * as _connectors from 'wagmi/connectors';
|
|
8
|
+
export { _connectors as connectors };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MetaMask, CoinbaseWallet, TokenPocket, SafeheronWallet, UniversalWallet, OkxWallet, ImToken, } from '@ant-design/web3-wagmi';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MetaMask, CoinbaseWallet, TokenPocket, SafeheronWallet, UniversalWallet, OkxWallet, ImToken } from '@ant-design/web3-wagmi';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './web3js-provider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./web3js-provider";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type WagmiWeb3ConfigProviderProps } from '@ant-design/web3-wagmi';
|
|
3
|
+
import { type Storage } from 'wagmi';
|
|
4
|
+
export interface EthWeb3jsConfigProviderProps extends Omit<WagmiWeb3ConfigProviderProps, 'config'> {
|
|
5
|
+
storage?: Storage | false;
|
|
6
|
+
}
|
|
7
|
+
export declare const EthWeb3jsConfigProvider: React.FC<React.PropsWithChildren<EthWeb3jsConfigProviderProps>>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Mainnet, WagmiWeb3ConfigProvider, WalletConnect } from '@ant-design/web3-wagmi';
|
|
3
|
+
import { createConfig, http } from 'wagmi';
|
|
4
|
+
import * as wagmiChains from 'wagmi/chains';
|
|
5
|
+
import * as wagmiConnectors from 'wagmi/connectors';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export const EthWeb3jsConfigProvider = ({
|
|
8
|
+
children,
|
|
9
|
+
walletConnect,
|
|
10
|
+
storage,
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
const chains = React.useMemo(() => (props.chains ?? [Mainnet]).map(chain => {
|
|
14
|
+
const wagmiChain = Object.values(wagmiChains).find(wc => wc.id === chain.id) ?? null;
|
|
15
|
+
if (!wagmiChain?.id) console.warn(`Chain ${chain.id} is not supported`);
|
|
16
|
+
return wagmiChain;
|
|
17
|
+
}).filter(chain => chain !== null),
|
|
18
|
+
// only check chains id
|
|
19
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
+
[props.chains?.map(chain => chain.id).join()]);
|
|
21
|
+
const wallets = React.useMemo(() => {
|
|
22
|
+
const targetWallets = [...(props.wallets ?? [])];
|
|
23
|
+
// biome-ignore lint/complexity/useOptionalChain: <explanation>
|
|
24
|
+
if (walletConnect && walletConnect.projectId) targetWallets.push(WalletConnect());
|
|
25
|
+
return targetWallets;
|
|
26
|
+
}, [props.wallets, walletConnect]);
|
|
27
|
+
const wagmiConfig = React.useMemo(() => {
|
|
28
|
+
const transports = Object.fromEntries(chains.map(chain => [chain.id, http()]));
|
|
29
|
+
const connectors = [wagmiConnectors.injected()];
|
|
30
|
+
(props.wallets ?? []).forEach(wallet => {
|
|
31
|
+
if (wallet.name) {
|
|
32
|
+
connectors.push(wagmiConnectors.injected({
|
|
33
|
+
target: wallet.name
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// biome-ignore lint/complexity/useOptionalChain: <explanation>
|
|
39
|
+
if (walletConnect && walletConnect.projectId) {
|
|
40
|
+
connectors.push(wagmiConnectors.walletConnect({
|
|
41
|
+
...walletConnect,
|
|
42
|
+
showQrModal: walletConnect.useWalletConnectOfficialModal ?? false
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
return createConfig({
|
|
46
|
+
chains,
|
|
47
|
+
transports,
|
|
48
|
+
connectors,
|
|
49
|
+
storage: storage === false ? null : storage
|
|
50
|
+
});
|
|
51
|
+
}, [chains, walletConnect, props.wallets, storage]);
|
|
52
|
+
return /*#__PURE__*/_jsx(WagmiWeb3ConfigProvider, {
|
|
53
|
+
...props,
|
|
54
|
+
config: wagmiConfig,
|
|
55
|
+
wallets: wallets,
|
|
56
|
+
children: children
|
|
57
|
+
});
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-web3js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _useWeb3js = require("./use-web3js");
|
|
7
|
+
Object.keys(_useWeb3js).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _useWeb3js[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _useWeb3js[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clientToWeb3js = void 0;
|
|
7
|
+
exports.useWeb3js = useWeb3js;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _wagmi = require("wagmi");
|
|
10
|
+
var _web = require("web3");
|
|
11
|
+
/* v8 ignore next 7 */
|
|
12
|
+
const clientToWeb3js = client => {
|
|
13
|
+
const {
|
|
14
|
+
transport
|
|
15
|
+
} = client;
|
|
16
|
+
if (transport.type === 'fallback') {
|
|
17
|
+
return new _web.Web3(transport.transports[0].value.url);
|
|
18
|
+
}
|
|
19
|
+
return new _web.Web3(transport);
|
|
20
|
+
};
|
|
21
|
+
exports.clientToWeb3js = clientToWeb3js;
|
|
22
|
+
function useWeb3js() {
|
|
23
|
+
const {
|
|
24
|
+
data: client
|
|
25
|
+
} = (0, _wagmi.useConnectorClient)();
|
|
26
|
+
/* v8 ignore next */
|
|
27
|
+
return (0, _react.useMemo)(() => client ? clientToWeb3js(client) : null, [client]);
|
|
28
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _web3jsProvider = require("./web3js-provider");
|
|
7
|
+
Object.keys(_web3jsProvider).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _web3jsProvider[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _web3jsProvider[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _wallets = require("./wallets");
|
|
18
|
+
Object.keys(_wallets).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _wallets[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _wallets[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _hooks = require("./hooks");
|
|
29
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _hooks[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _hooks[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
actions: true,
|
|
8
|
+
chains: true,
|
|
9
|
+
connectors: true
|
|
10
|
+
};
|
|
11
|
+
exports.connectors = exports.chains = exports.actions = void 0;
|
|
12
|
+
var _wagmi = require("wagmi");
|
|
13
|
+
Object.keys(_wagmi).forEach(function (key) {
|
|
14
|
+
if (key === "default" || key === "__esModule") return;
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
+
if (key in exports && exports[key] === _wagmi[key]) return;
|
|
17
|
+
Object.defineProperty(exports, key, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _wagmi[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
var _actions = _interopRequireWildcard(require("wagmi/actions"));
|
|
25
|
+
exports.actions = _actions;
|
|
26
|
+
var _chains = _interopRequireWildcard(require("wagmi/chains"));
|
|
27
|
+
exports.chains = _chains;
|
|
28
|
+
var _connectors = _interopRequireWildcard(require("wagmi/connectors"));
|
|
29
|
+
exports.connectors = _connectors;
|
|
30
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
31
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MetaMask, CoinbaseWallet, TokenPocket, SafeheronWallet, UniversalWallet, OkxWallet, ImToken, } from '@ant-design/web3-wagmi';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CoinbaseWallet", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _web3Wagmi.CoinbaseWallet;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ImToken", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _web3Wagmi.ImToken;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "MetaMask", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _web3Wagmi.MetaMask;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "OkxWallet", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _web3Wagmi.OkxWallet;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "SafeheronWallet", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _web3Wagmi.SafeheronWallet;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "TokenPocket", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _web3Wagmi.TokenPocket;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "UniversalWallet", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _web3Wagmi.UniversalWallet;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var _web3Wagmi = require("@ant-design/web3-wagmi");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './web3js-provider';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _web3jsProvider = require("./web3js-provider");
|
|
7
|
+
Object.keys(_web3jsProvider).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _web3jsProvider[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _web3jsProvider[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type WagmiWeb3ConfigProviderProps } from '@ant-design/web3-wagmi';
|
|
3
|
+
import { type Storage } from 'wagmi';
|
|
4
|
+
export interface EthWeb3jsConfigProviderProps extends Omit<WagmiWeb3ConfigProviderProps, 'config'> {
|
|
5
|
+
storage?: Storage | false;
|
|
6
|
+
}
|
|
7
|
+
export declare const EthWeb3jsConfigProvider: React.FC<React.PropsWithChildren<EthWeb3jsConfigProviderProps>>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EthWeb3jsConfigProvider = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _web3Wagmi = require("@ant-design/web3-wagmi");
|
|
9
|
+
var _wagmi = require("wagmi");
|
|
10
|
+
var wagmiChains = _interopRequireWildcard(require("wagmi/chains"));
|
|
11
|
+
var wagmiConnectors = _interopRequireWildcard(require("wagmi/connectors"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
const EthWeb3jsConfigProvider = ({
|
|
17
|
+
children,
|
|
18
|
+
walletConnect,
|
|
19
|
+
storage,
|
|
20
|
+
...props
|
|
21
|
+
}) => {
|
|
22
|
+
const chains = _react.default.useMemo(() => (props.chains ?? [_web3Wagmi.Mainnet]).map(chain => {
|
|
23
|
+
const wagmiChain = Object.values(wagmiChains).find(wc => wc.id === chain.id) ?? null;
|
|
24
|
+
if (!wagmiChain?.id) console.warn(`Chain ${chain.id} is not supported`);
|
|
25
|
+
return wagmiChain;
|
|
26
|
+
}).filter(chain => chain !== null),
|
|
27
|
+
// only check chains id
|
|
28
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
+
[props.chains?.map(chain => chain.id).join()]);
|
|
30
|
+
const wallets = _react.default.useMemo(() => {
|
|
31
|
+
const targetWallets = [...(props.wallets ?? [])];
|
|
32
|
+
// biome-ignore lint/complexity/useOptionalChain: <explanation>
|
|
33
|
+
if (walletConnect && walletConnect.projectId) targetWallets.push((0, _web3Wagmi.WalletConnect)());
|
|
34
|
+
return targetWallets;
|
|
35
|
+
}, [props.wallets, walletConnect]);
|
|
36
|
+
const wagmiConfig = _react.default.useMemo(() => {
|
|
37
|
+
const transports = Object.fromEntries(chains.map(chain => [chain.id, (0, _wagmi.http)()]));
|
|
38
|
+
const connectors = [wagmiConnectors.injected()];
|
|
39
|
+
(props.wallets ?? []).forEach(wallet => {
|
|
40
|
+
if (wallet.name) {
|
|
41
|
+
connectors.push(wagmiConnectors.injected({
|
|
42
|
+
target: wallet.name
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// biome-ignore lint/complexity/useOptionalChain: <explanation>
|
|
48
|
+
if (walletConnect && walletConnect.projectId) {
|
|
49
|
+
connectors.push(wagmiConnectors.walletConnect({
|
|
50
|
+
...walletConnect,
|
|
51
|
+
showQrModal: walletConnect.useWalletConnectOfficialModal ?? false
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
return (0, _wagmi.createConfig)({
|
|
55
|
+
chains,
|
|
56
|
+
transports,
|
|
57
|
+
connectors,
|
|
58
|
+
storage: storage === false ? null : storage
|
|
59
|
+
});
|
|
60
|
+
}, [chains, walletConnect, props.wallets, storage]);
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_web3Wagmi.WagmiWeb3ConfigProvider, {
|
|
62
|
+
...props,
|
|
63
|
+
config: wagmiConfig,
|
|
64
|
+
wallets: wallets,
|
|
65
|
+
children: children
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
exports.EthWeb3jsConfigProvider = EthWeb3jsConfigProvider;
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ant-design/web3-eth-web3js",
|
|
3
|
+
"version": "0.0.0-alpha-20260209094036",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/esm/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"typings": "dist/esm/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/esm/index.js",
|
|
11
|
+
"require": "./dist/lib/index.js",
|
|
12
|
+
"types": "./dist/esm/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./wagmi": {
|
|
15
|
+
"import": "./dist/esm/wagmi.js",
|
|
16
|
+
"require": "./dist/lib/wagmi.js",
|
|
17
|
+
"types": "./dist/esm/wagmi.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"CHANGELOG.md",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"keywords": [
|
|
26
|
+
"ant",
|
|
27
|
+
"design",
|
|
28
|
+
"web3",
|
|
29
|
+
"antd",
|
|
30
|
+
"component",
|
|
31
|
+
"components",
|
|
32
|
+
"framework",
|
|
33
|
+
"frontend",
|
|
34
|
+
"react",
|
|
35
|
+
"react-component",
|
|
36
|
+
"ui",
|
|
37
|
+
"web3js"
|
|
38
|
+
],
|
|
39
|
+
"homepage": "https://web3.ant.design",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/ant-design/ant-design-web3/issues"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/ant-design/ant-design-web3"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@tanstack/react-query": "^5.51.11",
|
|
49
|
+
"debug": "^4.4.0",
|
|
50
|
+
"viem": "^2.33.2",
|
|
51
|
+
"wagmi": "^2.14.16",
|
|
52
|
+
"@ant-design/web3-assets": "0.0.0-alpha-20260209094036",
|
|
53
|
+
"@ant-design/web3-common": "0.0.0-alpha-20260209094036",
|
|
54
|
+
"@ant-design/web3-wagmi": "0.0.0-alpha-20260209094036"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/debug": "^4.1.12",
|
|
58
|
+
"father": "^4.6.2",
|
|
59
|
+
"typescript": "^5.6.2",
|
|
60
|
+
"web3": "^4.16.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"web3": "^4.0.0"
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"registry": "https://registry.npmjs.org",
|
|
67
|
+
"access": "public"
|
|
68
|
+
},
|
|
69
|
+
"browserslist": [
|
|
70
|
+
"last 2 versions",
|
|
71
|
+
"Firefox ESR",
|
|
72
|
+
"> 1%",
|
|
73
|
+
"ie >= 11"
|
|
74
|
+
],
|
|
75
|
+
"scripts": {
|
|
76
|
+
"dev": "father dev",
|
|
77
|
+
"build": "father build"
|
|
78
|
+
}
|
|
79
|
+
}
|