@ant-design/web3-wagmi 2.5.0 → 2.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ant-design/web3-wagmi
|
|
2
2
|
|
|
3
|
+
## 2.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4abe7c0: feat: onConnected callback support provider account
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 61c17c5: chore(wagmi): use wagmi/actions instead of wagmi/core
|
|
12
|
+
- Updated dependencies [0d33add]
|
|
13
|
+
- Updated dependencies [4abe7c0]
|
|
14
|
+
- @ant-design/web3-assets@1.8.1
|
|
15
|
+
- @ant-design/web3-common@1.11.0
|
|
16
|
+
|
|
3
17
|
## 2.5.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -14,8 +14,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import { fillAddressWith0x, Web3ConfigProvider } from '@ant-design/web3-common';
|
|
17
|
-
import { disconnect, getAccount } from '@wagmi/core';
|
|
18
17
|
import { useAccount, useBalance, useConfig, useConnect, useEnsName, useSwitchChain } from 'wagmi';
|
|
18
|
+
import { disconnect, getAccount } from 'wagmi/actions';
|
|
19
19
|
import { isEIP6963Connector } from "../utils";
|
|
20
20
|
import { EIP6963Wallet } from "../wallets/eip6963";
|
|
21
21
|
import { getNFTMetadata } from "./methods";
|
|
@@ -191,7 +191,7 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
|
|
|
191
191
|
connect: ( /*#__PURE__*/function () {
|
|
192
192
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(wallet, options) {
|
|
193
193
|
var _getWagmiConnector, _ref4;
|
|
194
|
-
var connector;
|
|
194
|
+
var connector, _yield$connectAsync, accounts;
|
|
195
195
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
196
196
|
while (1) switch (_context2.prev = _context2.next) {
|
|
197
197
|
case 0:
|
|
@@ -214,6 +214,12 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
|
|
|
214
214
|
chainId: currentChain === null || currentChain === void 0 ? void 0 : currentChain.id
|
|
215
215
|
});
|
|
216
216
|
case 8:
|
|
217
|
+
_yield$connectAsync = _context2.sent;
|
|
218
|
+
accounts = _yield$connectAsync.accounts;
|
|
219
|
+
return _context2.abrupt("return", {
|
|
220
|
+
address: accounts === null || accounts === void 0 ? void 0 : accounts[0]
|
|
221
|
+
});
|
|
222
|
+
case 11:
|
|
217
223
|
case "end":
|
|
218
224
|
return _context2.stop();
|
|
219
225
|
}
|
|
@@ -3,7 +3,7 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
|
|
|
3
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
5
|
import { fillAddressWith0x, requestWeb3Asset } from '@ant-design/web3-common';
|
|
6
|
-
import { readContract } from '
|
|
6
|
+
import { readContract } from 'wagmi/actions';
|
|
7
7
|
export function getNFTMetadata(_x, _x2, _x3, _x4) {
|
|
8
8
|
return _getNFTMetadata.apply(this, arguments);
|
|
9
9
|
}
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.AntDesignWeb3ConfigProvider = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _web3Common = require("@ant-design/web3-common");
|
|
9
|
-
var _core = require("@wagmi/core");
|
|
10
9
|
var _wagmi = require("wagmi");
|
|
10
|
+
var _actions = require("wagmi/actions");
|
|
11
11
|
var _utils = require("../utils");
|
|
12
12
|
var _eip = require("../wallets/eip6963");
|
|
13
13
|
var _methods = require("./methods");
|
|
@@ -159,10 +159,15 @@ const AntDesignWeb3ConfigProvider = props => {
|
|
|
159
159
|
if (!connector) {
|
|
160
160
|
throw new Error(`Can not find connector for ${wallet?.name}`);
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
const {
|
|
163
|
+
accounts
|
|
164
|
+
} = await connectAsync({
|
|
163
165
|
connector,
|
|
164
166
|
chainId: currentChain?.id
|
|
165
167
|
});
|
|
168
|
+
return {
|
|
169
|
+
address: accounts?.[0]
|
|
170
|
+
};
|
|
166
171
|
},
|
|
167
172
|
disconnect: async () => {
|
|
168
173
|
// await disconnectAsync();
|
|
@@ -170,8 +175,8 @@ const AntDesignWeb3ConfigProvider = props => {
|
|
|
170
175
|
// 存在一些状态处理的 bug,暂时用更低阶 API 代替。
|
|
171
176
|
const {
|
|
172
177
|
connector
|
|
173
|
-
} = (0,
|
|
174
|
-
await (0,
|
|
178
|
+
} = (0, _actions.getAccount)(config);
|
|
179
|
+
await (0, _actions.disconnect)(config, {
|
|
175
180
|
connector
|
|
176
181
|
});
|
|
177
182
|
},
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getNFTMetadata = getNFTMetadata;
|
|
7
7
|
var _web3Common = require("@ant-design/web3-common");
|
|
8
|
-
var
|
|
8
|
+
var _actions = require("wagmi/actions");
|
|
9
9
|
async function getNFTMetadata(config, address, tokenId, chainId) {
|
|
10
|
-
const tokenURI = await (0,
|
|
10
|
+
const tokenURI = await (0, _actions.readContract)(config, {
|
|
11
11
|
address: (0, _web3Common.fillAddressWith0x)(address),
|
|
12
12
|
args: [tokenId],
|
|
13
13
|
chainId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/web3-wagmi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -38,22 +38,20 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"debug": "^4.3.4",
|
|
41
|
-
"@
|
|
42
|
-
"@ant-design/web3-
|
|
43
|
-
"@ant-design/web3-common": "1.10.1"
|
|
41
|
+
"@ant-design/web3-assets": "1.8.1",
|
|
42
|
+
"@ant-design/web3-common": "1.11.0"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
45
|
"@types/debug": "^4.1.12",
|
|
47
|
-
"
|
|
48
|
-
"father": "^4.4.0",
|
|
46
|
+
"father": "^4.4.4",
|
|
49
47
|
"typescript": "^5.4.5",
|
|
50
48
|
"wagmi": "^2.8.6",
|
|
51
|
-
"@tanstack/react-query": "^5.
|
|
52
|
-
"viem": "^2.
|
|
49
|
+
"@tanstack/react-query": "^5.40.1",
|
|
50
|
+
"viem": "^2.13.3"
|
|
53
51
|
},
|
|
54
52
|
"peerDependencies": {
|
|
55
53
|
"wagmi": "^2.8.6",
|
|
56
|
-
"@tanstack/react-query": "^5.
|
|
54
|
+
"@tanstack/react-query": "^5.40.1",
|
|
57
55
|
"viem": ">=2.0.0"
|
|
58
56
|
},
|
|
59
57
|
"publishConfig": {
|