@ant-design/web3-wagmi 2.4.0 → 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 CHANGED
@@ -1,5 +1,33 @@
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
+
20
+ ## 2.4.1
21
+
22
+ ### Patch Changes
23
+
24
+ - 813ec32: chore: modify NFTCard className prefix
25
+ - Updated dependencies [b5eccf9]
26
+ - Updated dependencies [cb0a288]
27
+ - Updated dependencies [6f4c55f]
28
+ - @ant-design/web3-assets@1.5.0
29
+ - @ant-design/web3-common@1.7.0
30
+
3
31
  ## 2.4.0
4
32
 
5
33
  ### Minor 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
  });
@@ -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 (!chain) {
251
- // hava not connected any chain
252
- setCurrentChain(c);
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
- case 1:
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
@@ -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(() => {
@@ -171,11 +170,11 @@ const AntDesignWeb3ConfigProvider = props => {
171
170
  if (!chain) {
172
171
  // hava not connected any chain
173
172
  setCurrentChain(c);
174
- } else {
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.0",
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
- "viem": "2.0.0",
42
- "@tanstack/react-query": "^5.21.7",
43
- "@ant-design/web3-common": "1.6.0",
44
- "@ant-design/web3-assets": "1.4.1"
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.2",
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",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,OAAO,CAAC;AAGzD,QAAA,MAAM,WAAW,cAAe,MAAM,mBAErC,CAAC;AAEF,QAAA,MAAM,kBAAkB,cAAe,cAAc,YAKpD,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAuB,MAAM,uBAAuB,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGjE,MAAM,MAAM,4BAA4B,GAAG;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,OAAY,EACZ,MAAW,EACX,GAAG,EACH,MAAM,EACN,OAAO,EACP,MAAM,EACN,WAAW,EACX,OAAO,EACP,GAAG,SAAS,EACb,EAAE,KAAK,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,GAAG,KAAK,CAAC,YAAY,CAyB5E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"addNameToAccount.d.ts","sourceRoot":"","sources":["addNameToAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAEtD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CASlB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNFTMetadata.d.ts","sourceRoot":"","sources":["getNFTMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAExD,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC,CAuBtB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"coinbase-wallet.d.ts","sourceRoot":"","sources":["coinbase-wallet.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,cAAc,EAAE,cAa5B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"eip6963.d.ts","sourceRoot":"","sources":["eip6963.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAG3C,eAAO,MAAM,aAAa,EAAE,cAuB3B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"im-token.d.ts","sourceRoot":"","sources":["im-token.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,OAAO,EAAE,cAKrB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"meta-mask.d.ts","sourceRoot":"","sources":["meta-mask.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,QAAQ,EAAE,cAKtB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"okx-wallet.d.ts","sourceRoot":"","sources":["okx-wallet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,SAAS,EAAE,cAKvB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"safeheron.d.ts","sourceRoot":"","sources":["safeheron.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,eAAe,EAAE,cAgB7B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-pocket.d.ts","sourceRoot":"","sources":["token-pocket.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,WAAW,EAAE,cAKzB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"wallet-connect.d.ts","sourceRoot":"","sources":["wallet-connect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,KAAK,qBAAqB,GAAG,CAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG;IACnC,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC,KACE,aAAa,CAAC;AAEnB,eAAO,MAAM,aAAa,EAAE,qBAiC3B,CAAC"}