@ant-design/web3-wagmi 2.4.1 → 2.4.2
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 +17 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/interface.d.ts +3 -4
- package/dist/esm/wagmi-provider/config-provider.js +13 -11
- package/dist/esm/wallets/universal-wallet.d.ts +1 -0
- package/dist/esm/wallets/universal-wallet.js +2 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +11 -0
- package/dist/lib/interface.d.ts +3 -4
- package/dist/lib/wagmi-provider/config-provider.js +6 -7
- package/dist/lib/wallets/universal-wallet.d.ts +1 -0
- package/dist/lib/wallets/universal-wallet.js +2 -0
- package/package.json +10 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @ant-design/web3-wagmi
|
|
2
2
|
|
|
3
|
+
## 2.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b1b8a46: feat: supoort ethers adapter
|
|
8
|
+
- 6ac3c69: fix: Correct typos for connect
|
|
9
|
+
- f4f80a7: chore: Optimize if-else statements
|
|
10
|
+
- 176299c: fix: move @tanstack/react-query to peerDependencies for fix react-query context error
|
|
11
|
+
- Updated dependencies [7fb2d02]
|
|
12
|
+
- Updated dependencies [dfef374]
|
|
13
|
+
- Updated dependencies [71d281a]
|
|
14
|
+
- Updated dependencies [b1b8a46]
|
|
15
|
+
- Updated dependencies [ab3eac4]
|
|
16
|
+
- Updated dependencies [b950d50]
|
|
17
|
+
- @ant-design/web3-common@1.8.0
|
|
18
|
+
- @ant-design/web3-assets@1.6.0
|
|
19
|
+
|
|
3
20
|
## 2.4.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
package/dist/esm/interface.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type { ConnectOptions, Wallet, WalletMetadata } from '@ant-design/web3-common';
|
|
1
|
+
import type { ConnectOptions, UniversalEIP6963Config, Wallet, WalletMetadata } from '@ant-design/web3-common';
|
|
2
2
|
import type { Connector } from 'wagmi';
|
|
3
3
|
export interface WalletUseInWagmiAdapter extends Wallet {
|
|
4
4
|
getWagmiConnector?: (options?: ConnectOptions) => Promise<Connector | undefined>;
|
|
5
5
|
}
|
|
6
6
|
export type EthereumWallet = (metadata?: Partial<WalletMetadata>) => WalletFactory;
|
|
7
7
|
export interface WalletFactory {
|
|
8
|
+
name?: string;
|
|
8
9
|
connectors: Connector['name'][];
|
|
9
10
|
create: (connector?: readonly Connector[]) => WalletUseInWagmiAdapter;
|
|
10
11
|
}
|
|
11
|
-
export type EIP6963Config = boolean |
|
|
12
|
-
autoAddInjectedWallets?: boolean;
|
|
13
|
-
};
|
|
12
|
+
export type EIP6963Config = boolean | UniversalEIP6963Config;
|
|
@@ -151,10 +151,9 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
|
|
|
151
151
|
name: c.name,
|
|
152
152
|
icon: c.icon
|
|
153
153
|
};
|
|
154
|
-
} else {
|
|
155
|
-
console.error("Can not find chain ".concat(item.id, ", you should config it in WagmiWeb3ConfigProvider 'chains'."));
|
|
156
|
-
return null;
|
|
157
154
|
}
|
|
155
|
+
console.error("Can not find chain ".concat(item.id, ", you should config it in WagmiWeb3ConfigProvider 'chains'."));
|
|
156
|
+
return null;
|
|
158
157
|
}).filter(function (item) {
|
|
159
158
|
return item !== null;
|
|
160
159
|
});
|
|
@@ -247,15 +246,18 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
|
|
|
247
246
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
248
247
|
while (1) switch (_context4.prev = _context4.next) {
|
|
249
248
|
case 0:
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
} else {
|
|
254
|
-
switchChain === null || switchChain === void 0 || switchChain({
|
|
255
|
-
chainId: c.id
|
|
256
|
-
});
|
|
249
|
+
if (chain) {
|
|
250
|
+
_context4.next = 3;
|
|
251
|
+
break;
|
|
257
252
|
}
|
|
258
|
-
|
|
253
|
+
// hava not connected any chain
|
|
254
|
+
setCurrentChain(c);
|
|
255
|
+
return _context4.abrupt("return");
|
|
256
|
+
case 3:
|
|
257
|
+
switchChain === null || switchChain === void 0 || switchChain({
|
|
258
|
+
chainId: c.id
|
|
259
|
+
});
|
|
260
|
+
case 4:
|
|
259
261
|
case "end":
|
|
260
262
|
return _context4.stop();
|
|
261
263
|
}
|
|
@@ -3,6 +3,7 @@ import type { Connector } from 'wagmi';
|
|
|
3
3
|
import type { WalletFactory, WalletUseInWagmiAdapter } from '../interface';
|
|
4
4
|
export declare class UniversalWallet implements WalletFactory {
|
|
5
5
|
private wallet;
|
|
6
|
+
name?: string;
|
|
6
7
|
connectors: string[];
|
|
7
8
|
constructor(wallet: WalletMetadata);
|
|
8
9
|
create: (connectors?: readonly Connector[]) => WalletUseInWagmiAdapter;
|
|
@@ -13,6 +13,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
13
13
|
export var UniversalWallet = /*#__PURE__*/_createClass(function UniversalWallet(wallet) {
|
|
14
14
|
var _this = this;
|
|
15
15
|
_classCallCheck(this, UniversalWallet);
|
|
16
|
+
_defineProperty(this, "name", void 0);
|
|
16
17
|
_defineProperty(this, "connectors", []);
|
|
17
18
|
_defineProperty(this, "create", function (connectors) {
|
|
18
19
|
var walletConnector = connectors === null || connectors === void 0 ? void 0 : connectors.find(function (item) {
|
|
@@ -154,6 +155,7 @@ export var UniversalWallet = /*#__PURE__*/_createClass(function UniversalWallet(
|
|
|
154
155
|
});
|
|
155
156
|
});
|
|
156
157
|
this.wallet = wallet;
|
|
158
|
+
this.name = wallet.name;
|
|
157
159
|
if (wallet.extensions) {
|
|
158
160
|
// support injected connector
|
|
159
161
|
// https://wagmi.sh/react/connectors/injected
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.js
CHANGED
|
@@ -25,6 +25,17 @@ Object.keys(_wallets).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
+
var _interface = require("./interface");
|
|
29
|
+
Object.keys(_interface).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _interface[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
28
39
|
var _web3Assets = require("@ant-design/web3-assets");
|
|
29
40
|
Object.keys(_web3Assets).forEach(function (key) {
|
|
30
41
|
if (key === "default" || key === "__esModule") return;
|
package/dist/lib/interface.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type { ConnectOptions, Wallet, WalletMetadata } from '@ant-design/web3-common';
|
|
1
|
+
import type { ConnectOptions, UniversalEIP6963Config, Wallet, WalletMetadata } from '@ant-design/web3-common';
|
|
2
2
|
import type { Connector } from 'wagmi';
|
|
3
3
|
export interface WalletUseInWagmiAdapter extends Wallet {
|
|
4
4
|
getWagmiConnector?: (options?: ConnectOptions) => Promise<Connector | undefined>;
|
|
5
5
|
}
|
|
6
6
|
export type EthereumWallet = (metadata?: Partial<WalletMetadata>) => WalletFactory;
|
|
7
7
|
export interface WalletFactory {
|
|
8
|
+
name?: string;
|
|
8
9
|
connectors: Connector['name'][];
|
|
9
10
|
create: (connector?: readonly Connector[]) => WalletUseInWagmiAdapter;
|
|
10
11
|
}
|
|
11
|
-
export type EIP6963Config = boolean |
|
|
12
|
-
autoAddInjectedWallets?: boolean;
|
|
13
|
-
};
|
|
12
|
+
export type EIP6963Config = boolean | UniversalEIP6963Config;
|
|
@@ -112,10 +112,9 @@ const AntDesignWeb3ConfigProvider = props => {
|
|
|
112
112
|
name: c.name,
|
|
113
113
|
icon: c.icon
|
|
114
114
|
};
|
|
115
|
-
} else {
|
|
116
|
-
console.error(`Can not find chain ${item.id}, you should config it in WagmiWeb3ConfigProvider 'chains'.`);
|
|
117
|
-
return null;
|
|
118
115
|
}
|
|
116
|
+
console.error(`Can not find chain ${item.id}, you should config it in WagmiWeb3ConfigProvider 'chains'.`);
|
|
117
|
+
return null;
|
|
119
118
|
}).filter(item => item !== null);
|
|
120
119
|
}, [availableChains, chainAssets]);
|
|
121
120
|
_react.default.useEffect(() => {
|
|
@@ -171,11 +170,11 @@ const AntDesignWeb3ConfigProvider = props => {
|
|
|
171
170
|
if (!chain) {
|
|
172
171
|
// hava not connected any chain
|
|
173
172
|
setCurrentChain(c);
|
|
174
|
-
|
|
175
|
-
switchChain?.({
|
|
176
|
-
chainId: c.id
|
|
177
|
-
});
|
|
173
|
+
return;
|
|
178
174
|
}
|
|
175
|
+
switchChain?.({
|
|
176
|
+
chainId: c.id
|
|
177
|
+
});
|
|
179
178
|
},
|
|
180
179
|
getNFTMetadata: async ({
|
|
181
180
|
address: contractAddress,
|
|
@@ -3,6 +3,7 @@ import type { Connector } from 'wagmi';
|
|
|
3
3
|
import type { WalletFactory, WalletUseInWagmiAdapter } from '../interface';
|
|
4
4
|
export declare class UniversalWallet implements WalletFactory {
|
|
5
5
|
private wallet;
|
|
6
|
+
name?: string;
|
|
6
7
|
connectors: string[];
|
|
7
8
|
constructor(wallet: WalletMetadata);
|
|
8
9
|
create: (connectors?: readonly Connector[]) => WalletUseInWagmiAdapter;
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.UniversalWallet = void 0;
|
|
7
7
|
class UniversalWallet {
|
|
8
|
+
name;
|
|
8
9
|
connectors = [];
|
|
9
10
|
constructor(wallet) {
|
|
10
11
|
this.wallet = wallet;
|
|
12
|
+
this.name = wallet.name;
|
|
11
13
|
if (wallet.extensions) {
|
|
12
14
|
// support injected connector
|
|
13
15
|
// https://wagmi.sh/react/connectors/injected
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/web3-wagmi",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -38,19 +38,21 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"debug": "^4.3.4",
|
|
40
40
|
"@wagmi/core": "^2.6.5",
|
|
41
|
-
"
|
|
42
|
-
"@
|
|
43
|
-
"@ant-design/web3-assets": "1.5.0",
|
|
44
|
-
"@ant-design/web3-common": "1.7.0"
|
|
41
|
+
"@ant-design/web3-assets": "1.6.0",
|
|
42
|
+
"@ant-design/web3-common": "1.8.0"
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
45
|
"@types/debug": "^4.1.12",
|
|
48
46
|
"father": "^4.3.8",
|
|
49
|
-
"typescript": "^5.4.
|
|
50
|
-
"wagmi": "^2.5.7"
|
|
47
|
+
"typescript": "^5.4.4",
|
|
48
|
+
"wagmi": "^2.5.7",
|
|
49
|
+
"@tanstack/react-query": "^5.28.4",
|
|
50
|
+
"viem": ">=2.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"wagmi": "^2.5.7"
|
|
53
|
+
"wagmi": "^2.5.7",
|
|
54
|
+
"@tanstack/react-query": "^5.28.4",
|
|
55
|
+
"viem": ">=2.0.0"
|
|
54
56
|
},
|
|
55
57
|
"publishConfig": {
|
|
56
58
|
"registry": "https://registry.npmjs.org",
|