@ant-design/web3-wagmi 2.4.1 → 2.4.3

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,32 @@
1
1
  # @ant-design/web3-wagmi
2
2
 
3
+ ## 2.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - a90c674: refactor: remove unused code
8
+ - b9977a2: fix: useCallback for getNFTMetadata for avoid `Error: Maximum update depth exceeded`
9
+ - Updated dependencies [994ead5]
10
+ - @ant-design/web3-assets@1.7.0
11
+ - @ant-design/web3-common@1.9.0
12
+
13
+ ## 2.4.2
14
+
15
+ ### Patch Changes
16
+
17
+ - b1b8a46: feat: supoort ethers adapter
18
+ - 6ac3c69: fix: Correct typos for connect
19
+ - f4f80a7: chore: Optimize if-else statements
20
+ - 176299c: fix: move @tanstack/react-query to peerDependencies for fix react-query context error
21
+ - Updated dependencies [7fb2d02]
22
+ - Updated dependencies [dfef374]
23
+ - Updated dependencies [71d281a]
24
+ - Updated dependencies [b1b8a46]
25
+ - Updated dependencies [ab3eac4]
26
+ - Updated dependencies [b950d50]
27
+ - @ant-design/web3-common@1.8.0
28
+ - @ant-design/web3-assets@1.6.0
29
+
3
30
  ## 2.4.1
4
31
 
5
32
  ### Patch Changes
@@ -1,3 +1,4 @@
1
1
  export * from './wagmi-provider';
2
2
  export * from './wallets';
3
+ export * from './interface';
3
4
  export * from '@ant-design/web3-assets';
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./wagmi-provider";
2
2
  export * from "./wallets";
3
+ export * from "./interface";
3
4
  export * from '@ant-design/web3-assets';
@@ -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
  });
@@ -182,6 +181,24 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
182
181
  return;
183
182
  }, [chain, chainAssets, availableChains, currentChain]);
184
183
  var currency = currentChain === null || currentChain === void 0 ? void 0 : currentChain.nativeCurrency;
184
+ var getNFTMetadataFunc = React.useCallback( /*#__PURE__*/function () {
185
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
186
+ var contractAddress, tokenId;
187
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
188
+ while (1) switch (_context2.prev = _context2.next) {
189
+ case 0:
190
+ contractAddress = _ref2.address, tokenId = _ref2.tokenId;
191
+ return _context2.abrupt("return", getNFTMetadata(config, contractAddress, tokenId, chain === null || chain === void 0 ? void 0 : chain.id));
192
+ case 2:
193
+ case "end":
194
+ return _context2.stop();
195
+ }
196
+ }, _callee2);
197
+ }));
198
+ return function (_x) {
199
+ return _ref3.apply(this, arguments);
200
+ };
201
+ }(), [chain === null || chain === void 0 ? void 0 : chain.id]);
185
202
  return /*#__PURE__*/_jsx(Web3ConfigProvider, {
186
203
  locale: locale,
187
204
  availableChains: chainList,
@@ -195,85 +212,70 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
195
212
  } : undefined,
196
213
  availableWallets: wallets,
197
214
  addressPrefix: "0x",
198
- connect: /*#__PURE__*/function () {
199
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(wallet, options) {
200
- var _getWagmiConnector, _ref3;
215
+ connect: ( /*#__PURE__*/function () {
216
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(wallet, options) {
217
+ var _getWagmiConnector, _ref5;
201
218
  var connector;
202
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
203
- while (1) switch (_context2.prev = _context2.next) {
219
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
220
+ while (1) switch (_context3.prev = _context3.next) {
204
221
  case 0:
205
- _context2.next = 2;
206
- return wallet === null || wallet === void 0 || (_getWagmiConnector = (_ref3 = wallet).getWagmiConnector) === null || _getWagmiConnector === void 0 ? void 0 : _getWagmiConnector.call(_ref3, options);
222
+ _context3.next = 2;
223
+ return wallet === null || wallet === void 0 || (_getWagmiConnector = (_ref5 = wallet).getWagmiConnector) === null || _getWagmiConnector === void 0 ? void 0 : _getWagmiConnector.call(_ref5, options);
207
224
  case 2:
208
- connector = _context2.sent;
225
+ connector = _context3.sent;
209
226
  if (!connector && wallet) {
210
227
  connector = findConnectorByName(wallet.name);
211
228
  }
212
229
  if (connector) {
213
- _context2.next = 6;
230
+ _context3.next = 6;
214
231
  break;
215
232
  }
216
233
  throw new Error("Can not find connector for ".concat(wallet === null || wallet === void 0 ? void 0 : wallet.name));
217
234
  case 6:
218
- _context2.next = 8;
235
+ _context3.next = 8;
219
236
  return connectAsync({
220
237
  connector: connector,
221
238
  chainId: currentChain === null || currentChain === void 0 ? void 0 : currentChain.id
222
239
  });
223
240
  case 8:
224
241
  case "end":
225
- return _context2.stop();
242
+ return _context3.stop();
226
243
  }
227
- }, _callee2);
244
+ }, _callee3);
228
245
  }));
229
- return function (_x, _x2) {
230
- return _ref2.apply(this, arguments);
246
+ return function (_x2, _x3) {
247
+ return _ref4.apply(this, arguments);
231
248
  };
232
- }(),
233
- disconnect: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
234
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
235
- while (1) switch (_context3.prev = _context3.next) {
249
+ }()),
250
+ disconnect: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
251
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
252
+ while (1) switch (_context4.prev = _context4.next) {
236
253
  case 0:
237
- _context3.next = 2;
254
+ _context4.next = 2;
238
255
  return disconnectAsync();
239
256
  case 2:
240
257
  case "end":
241
- return _context3.stop();
258
+ return _context4.stop();
242
259
  }
243
- }, _callee3);
260
+ }, _callee4);
244
261
  })),
245
- switchChain: /*#__PURE__*/function () {
246
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(c) {
247
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
248
- while (1) switch (_context4.prev = _context4.next) {
249
- case 0:
250
- if (!chain) {
251
- // hava not connected any chain
252
- setCurrentChain(c);
253
- } else {
254
- switchChain === null || switchChain === void 0 || switchChain({
255
- chainId: c.id
256
- });
257
- }
258
- case 1:
259
- case "end":
260
- return _context4.stop();
261
- }
262
- }, _callee4);
263
- }));
264
- return function (_x3) {
265
- return _ref5.apply(this, arguments);
266
- };
267
- }(),
268
- getNFTMetadata: /*#__PURE__*/function () {
269
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref6) {
270
- var contractAddress, tokenId;
262
+ switchChain: ( /*#__PURE__*/function () {
263
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(c) {
271
264
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
272
265
  while (1) switch (_context5.prev = _context5.next) {
273
266
  case 0:
274
- contractAddress = _ref6.address, tokenId = _ref6.tokenId;
275
- return _context5.abrupt("return", getNFTMetadata(config, contractAddress, tokenId, chain === null || chain === void 0 ? void 0 : chain.id));
276
- case 2:
267
+ if (chain) {
268
+ _context5.next = 3;
269
+ break;
270
+ }
271
+ // hava not connected any chain
272
+ setCurrentChain(c);
273
+ return _context5.abrupt("return");
274
+ case 3:
275
+ switchChain === null || switchChain === void 0 || switchChain({
276
+ chainId: c.id
277
+ });
278
+ case 4:
277
279
  case "end":
278
280
  return _context5.stop();
279
281
  }
@@ -282,7 +284,8 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
282
284
  return function (_x4) {
283
285
  return _ref7.apply(this, arguments);
284
286
  };
285
- }(),
287
+ }()),
288
+ getNFTMetadata: getNFTMetadataFunc,
286
289
  children: children
287
290
  });
288
291
  };
@@ -3,8 +3,8 @@ var _excluded = ["children", "wallets", "chains", "ens", "locale", "balance", "c
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
9
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
10
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -3,8 +3,8 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  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); } }
9
9
  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); }); }; }
10
10
  import { getEnsName } from '@wagmi/core';
@@ -5,8 +5,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
10
  import { metadata_CoinbaseWallet } from '@ant-design/web3-assets';
11
11
  export var CoinbaseWallet = function CoinbaseWallet(metadata) {
12
12
  return {
@@ -5,8 +5,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
10
  export var EIP6963_CONNECTOR = 'EIP6963';
11
11
 
12
12
  // EIP6963Wallet not export from @ant-design/web3-wagmi, only used in internal
@@ -2,8 +2,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import { metadata_imToken } from '@ant-design/web3-assets';
8
8
  import { UniversalWallet } from "./universal-wallet";
9
9
  export var ImToken = function ImToken(metadata) {
@@ -2,8 +2,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import { metadata_MetaMask } from '@ant-design/web3-assets';
8
8
  import { UniversalWallet } from "./universal-wallet";
9
9
  export var MetaMask = function MetaMask(metadata) {
@@ -2,8 +2,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import { metadata_OkxWallet } from '@ant-design/web3-assets';
8
8
  import { UniversalWallet } from "./universal-wallet";
9
9
  export var OkxWallet = function OkxWallet(metadata) {
@@ -5,8 +5,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
10
  import { metadata_Safeheron } from '@ant-design/web3-assets';
11
11
  export var SafeheronWallet = function SafeheronWallet(metadata) {
12
12
  return {
@@ -2,8 +2,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import { metadata_TokenPocket } from '@ant-design/web3-assets';
8
8
  import { UniversalWallet } from "./universal-wallet";
9
9
  export var TokenPocket = function TokenPocket(metadata) {
@@ -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;
@@ -8,11 +8,12 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
8
8
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
9
9
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
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
@@ -3,8 +3,8 @@ var _excluded = ["useWalletConnectOfficialModal"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
9
9
  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); } }
10
10
  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); }); }; }
@@ -1,3 +1,4 @@
1
1
  export * from './wagmi-provider';
2
2
  export * from './wallets';
3
+ export * from './interface';
3
4
  export * from '@ant-design/web3-assets';
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;
@@ -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(() => {
@@ -138,6 +137,10 @@ const AntDesignWeb3ConfigProvider = props => {
138
137
  return;
139
138
  }, [chain, chainAssets, availableChains, currentChain]);
140
139
  const currency = currentChain?.nativeCurrency;
140
+ const getNFTMetadataFunc = _react.default.useCallback(async ({
141
+ address: contractAddress,
142
+ tokenId
143
+ }) => (0, _methods.getNFTMetadata)(config, contractAddress, tokenId, chain?.id), [chain?.id]);
141
144
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_web3Common.Web3ConfigProvider, {
142
145
  locale: locale,
143
146
  availableChains: chainList,
@@ -171,16 +174,13 @@ const AntDesignWeb3ConfigProvider = props => {
171
174
  if (!chain) {
172
175
  // hava not connected any chain
173
176
  setCurrentChain(c);
174
- } else {
175
- switchChain?.({
176
- chainId: c.id
177
- });
177
+ return;
178
178
  }
179
+ switchChain?.({
180
+ chainId: c.id
181
+ });
179
182
  },
180
- getNFTMetadata: async ({
181
- address: contractAddress,
182
- tokenId
183
- }) => (0, _methods.getNFTMetadata)(config, contractAddress, tokenId, chain?.id),
183
+ getNFTMetadata: getNFTMetadataFunc,
184
184
  children: children
185
185
  });
186
186
  };
@@ -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.1",
3
+ "version": "2.4.3",
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
- "viem": "2.0.0",
42
- "@tanstack/react-query": "^5.28.4",
43
- "@ant-design/web3-assets": "1.5.0",
44
- "@ant-design/web3-common": "1.7.0"
41
+ "@ant-design/web3-assets": "1.7.0",
42
+ "@ant-design/web3-common": "1.9.0"
45
43
  },
46
44
  "devDependencies": {
47
45
  "@types/debug": "^4.1.12",
48
- "father": "^4.3.8",
49
- "typescript": "^5.4.2",
50
- "wagmi": "^2.5.7"
46
+ "father": "^4.4.0",
47
+ "typescript": "^5.4.4",
48
+ "wagmi": "^2.5.7",
49
+ "@tanstack/react-query": "^5.28.4",
50
+ "viem": ">=2.9.25"
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.9.25"
54
56
  },
55
57
  "publishConfig": {
56
58
  "registry": "https://registry.npmjs.org",