@ant-design/web3-wagmi 2.4.4 → 2.5.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,30 @@
1
1
  # @ant-design/web3-wagmi
2
2
 
3
+ ## 2.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8a6d1c7: feat: add mobile wallet
8
+
9
+ ### Patch Changes
10
+
11
+ - 752dddd: refactor(wagmi): use ens hook instead of low-level api
12
+ - 6511134: refactor: remove useless proxyConnectorName
13
+ - Updated dependencies [6511134]
14
+ - Updated dependencies [8a6d1c7]
15
+ - @ant-design/web3-assets@1.8.0
16
+ - @ant-design/web3-common@1.10.1
17
+
18
+ ## 2.4.5
19
+
20
+ ### Patch Changes
21
+
22
+ - 518fd83: fix(wagmi): react max depth update exceeded
23
+ - 518fd83: chore: add storage props to config
24
+ - Updated dependencies [dd6366c]
25
+ - @ant-design/web3-common@1.10.0
26
+ - @ant-design/web3-assets@1.7.2
27
+
3
28
  ## 2.4.4
4
29
 
5
30
  ### Patch Changes
@@ -1,11 +1,11 @@
1
+ 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; }
2
+ 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); } }
3
+ 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
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
5
  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."); }
3
6
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
7
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
8
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
6
- 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; }
7
- 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); } }
8
- 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); }); }; }
9
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
10
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
11
  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); }
@@ -14,12 +14,14 @@ 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 { useAccount, useBalance, useConfig, useConnect, useDisconnect, useSwitchChain } from 'wagmi';
17
+ import { disconnect, getAccount } from '@wagmi/core';
18
+ import { useAccount, useBalance, useConfig, useConnect, useEnsName, useSwitchChain } from 'wagmi';
18
19
  import { isEIP6963Connector } from "../utils";
19
20
  import { EIP6963Wallet } from "../wallets/eip6963";
20
- import { addNameToAccount, getNFTMetadata } from "./methods";
21
+ import { getNFTMetadata } from "./methods";
21
22
  import { jsx as _jsx } from "react/jsx-runtime";
22
23
  export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(props) {
24
+ var _availableChains$, _availableChains$2;
23
25
  var children = props.children,
24
26
  chainAssets = props.chainAssets,
25
27
  walletFactorys = props.walletFactorys,
@@ -42,53 +44,28 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
42
44
  connectAsync = _useConnect.connectAsync;
43
45
  var _useSwitchChain = useSwitchChain(),
44
46
  switchChain = _useSwitchChain.switchChain;
45
- var _useDisconnect = useDisconnect(),
46
- disconnectAsync = _useDisconnect.disconnectAsync;
47
- var _React$useState3 = React.useState(undefined),
48
- _React$useState4 = _slicedToArray(_React$useState3, 2),
49
- currentChain = _React$useState4[0],
50
- setCurrentChain = _React$useState4[1];
51
47
  var _useBalance = useBalance({
52
48
  address: balance && account ? fillAddressWith0x(account.address) : undefined
53
49
  }),
54
50
  balanceData = _useBalance.data;
51
+ var _useEnsName = useEnsName({
52
+ address: address
53
+ }),
54
+ ensName = _useEnsName.data;
55
55
  React.useEffect(function () {
56
56
  if (!address || isDisconnected) {
57
57
  setAccount(undefined);
58
- return;
58
+ } else if (ens && ensName) {
59
+ setAccount({
60
+ address: fillAddressWith0x(address),
61
+ name: ensName
62
+ });
63
+ } else {
64
+ setAccount({
65
+ address: fillAddressWith0x(address)
66
+ });
59
67
  }
60
- var updateAccounts = /*#__PURE__*/function () {
61
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
62
- var a;
63
- return _regeneratorRuntime().wrap(function _callee$(_context) {
64
- while (1) switch (_context.prev = _context.next) {
65
- case 0:
66
- a = {
67
- address: address
68
- };
69
- setAccount(a);
70
- if (!ens) {
71
- _context.next = 8;
72
- break;
73
- }
74
- _context.t0 = setAccount;
75
- _context.next = 6;
76
- return addNameToAccount(config, a);
77
- case 6:
78
- _context.t1 = _context.sent;
79
- (0, _context.t0)(_context.t1);
80
- case 8:
81
- case "end":
82
- return _context.stop();
83
- }
84
- }, _callee);
85
- }));
86
- return function updateAccounts() {
87
- return _ref.apply(this, arguments);
88
- };
89
- }();
90
- updateAccounts();
91
- }, [address, isDisconnected, chain, ens]);
68
+ }, [address, isDisconnected, ens, ensName]);
92
69
  var findConnectorByName = function findConnectorByName(name) {
93
70
  var commonConnector = availableConnectors.find(function (item) {
94
71
  return item.name === name && !isEIP6963Connector(item);
@@ -158,45 +135,44 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
158
135
  return item !== null;
159
136
  });
160
137
  }, [availableChains, chainAssets]);
138
+ var chainId = (chain === null || chain === void 0 ? void 0 : chain.id) || (availableChains === null || availableChains === void 0 || (_availableChains$ = availableChains[0]) === null || _availableChains$ === void 0 ? void 0 : _availableChains$.id);
139
+ var chainName = (chain === null || chain === void 0 ? void 0 : chain.name) || (availableChains === null || availableChains === void 0 || (_availableChains$2 = availableChains[0]) === null || _availableChains$2 === void 0 ? void 0 : _availableChains$2.name);
140
+ var _React$useState3 = React.useState(undefined),
141
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
142
+ currentChain = _React$useState4[0],
143
+ setCurrentChain = _React$useState4[1];
161
144
  React.useEffect(function () {
162
- var _c;
163
- if (!chain && currentChain) {
145
+ setCurrentChain(function (prevChain) {
164
146
  // not connected any chain, keep current chain
165
- return;
166
- }
167
- var currentWagmiChain = chain !== null && chain !== void 0 ? chain : availableChains[0];
168
- if (!currentWagmiChain) {
169
- return;
170
- }
171
- var c = chainAssets === null || chainAssets === void 0 ? void 0 : chainAssets.find(function (item) {
172
- return item.id === (currentWagmiChain === null || currentWagmiChain === void 0 ? void 0 : currentWagmiChain.id);
147
+ var newChain = chainAssets === null || chainAssets === void 0 ? void 0 : chainAssets.find(function (item) {
148
+ return (item === null || item === void 0 ? void 0 : item.id) === chainId;
149
+ });
150
+ if (!newChain && chainId) {
151
+ newChain = {
152
+ id: chainId,
153
+ name: chainName
154
+ };
155
+ }
156
+ return newChain || prevChain;
173
157
  });
174
- if (!((_c = c) !== null && _c !== void 0 && _c.id)) {
175
- c = {
176
- id: currentWagmiChain.id,
177
- name: currentWagmiChain.name
178
- };
179
- }
180
- setCurrentChain(c);
181
- return;
182
- }, [chain, chainAssets, availableChains, currentChain]);
158
+ }, [chainAssets, availableChains, chainId, chainName]);
183
159
  var currency = currentChain === null || currentChain === void 0 ? void 0 : currentChain.nativeCurrency;
184
160
  var getNFTMetadataFunc = React.useCallback( /*#__PURE__*/function () {
185
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
161
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
186
162
  var contractAddress, tokenId;
187
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
188
- while (1) switch (_context2.prev = _context2.next) {
163
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
164
+ while (1) switch (_context.prev = _context.next) {
189
165
  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));
166
+ contractAddress = _ref.address, tokenId = _ref.tokenId;
167
+ return _context.abrupt("return", getNFTMetadata(config, contractAddress, tokenId, chain === null || chain === void 0 ? void 0 : chain.id));
192
168
  case 2:
193
169
  case "end":
194
- return _context2.stop();
170
+ return _context.stop();
195
171
  }
196
- }, _callee2);
172
+ }, _callee);
197
173
  }));
198
174
  return function (_x) {
199
- return _ref3.apply(this, arguments);
175
+ return _ref2.apply(this, arguments);
200
176
  };
201
177
  }(), [chain === null || chain === void 0 ? void 0 : chain.id]);
202
178
  return /*#__PURE__*/_jsx(Web3ConfigProvider, {
@@ -213,76 +189,80 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
213
189
  availableWallets: wallets,
214
190
  addressPrefix: "0x",
215
191
  connect: ( /*#__PURE__*/function () {
216
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(wallet, options) {
217
- var _getWagmiConnector, _ref5;
192
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(wallet, options) {
193
+ var _getWagmiConnector, _ref4;
218
194
  var connector;
219
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
220
- while (1) switch (_context3.prev = _context3.next) {
195
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
196
+ while (1) switch (_context2.prev = _context2.next) {
221
197
  case 0:
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);
198
+ _context2.next = 2;
199
+ return wallet === null || wallet === void 0 || (_getWagmiConnector = (_ref4 = wallet).getWagmiConnector) === null || _getWagmiConnector === void 0 ? void 0 : _getWagmiConnector.call(_ref4, options);
224
200
  case 2:
225
- connector = _context3.sent;
201
+ connector = _context2.sent;
226
202
  if (!connector && wallet) {
227
203
  connector = findConnectorByName(wallet.name);
228
204
  }
229
205
  if (connector) {
230
- _context3.next = 6;
206
+ _context2.next = 6;
231
207
  break;
232
208
  }
233
209
  throw new Error("Can not find connector for ".concat(wallet === null || wallet === void 0 ? void 0 : wallet.name));
234
210
  case 6:
235
- _context3.next = 8;
211
+ _context2.next = 8;
236
212
  return connectAsync({
237
213
  connector: connector,
238
214
  chainId: currentChain === null || currentChain === void 0 ? void 0 : currentChain.id
239
215
  });
240
216
  case 8:
241
217
  case "end":
242
- return _context3.stop();
218
+ return _context2.stop();
243
219
  }
244
- }, _callee3);
220
+ }, _callee2);
245
221
  }));
246
222
  return function (_x2, _x3) {
247
- return _ref4.apply(this, arguments);
223
+ return _ref3.apply(this, arguments);
248
224
  };
249
225
  }()),
250
- disconnect: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
251
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
252
- while (1) switch (_context4.prev = _context4.next) {
226
+ disconnect: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
227
+ var _getAccount, connector;
228
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
229
+ while (1) switch (_context3.prev = _context3.next) {
253
230
  case 0:
254
- _context4.next = 2;
255
- return disconnectAsync();
256
- case 2:
231
+ // await disconnectAsync();
232
+ // TODO@jeasonstudio: wagmi useDisconnect hook 在处理多实例(config)共存时,
233
+ // 存在一些状态处理的 bug,暂时用更低阶 API 代替。
234
+ _getAccount = getAccount(config), connector = _getAccount.connector;
235
+ _context3.next = 3;
236
+ return disconnect(config, {
237
+ connector: connector
238
+ });
239
+ case 3:
257
240
  case "end":
258
- return _context4.stop();
241
+ return _context3.stop();
259
242
  }
260
- }, _callee4);
243
+ }, _callee3);
261
244
  })),
262
245
  switchChain: ( /*#__PURE__*/function () {
263
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(c) {
264
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
265
- while (1) switch (_context5.prev = _context5.next) {
246
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(newChain) {
247
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
248
+ while (1) switch (_context4.prev = _context4.next) {
266
249
  case 0:
267
- if (chain) {
268
- _context5.next = 3;
269
- break;
250
+ if (!chain) {
251
+ // hava not connected any chain
252
+ setCurrentChain(newChain);
253
+ } else {
254
+ switchChain === null || switchChain === void 0 || switchChain({
255
+ chainId: newChain.id
256
+ });
270
257
  }
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:
258
+ case 1:
279
259
  case "end":
280
- return _context5.stop();
260
+ return _context4.stop();
281
261
  }
282
- }, _callee5);
262
+ }, _callee4);
283
263
  }));
284
264
  return function (_x4) {
285
- return _ref7.apply(this, arguments);
265
+ return _ref6.apply(this, arguments);
286
266
  };
287
267
  }()),
288
268
  getNFTMetadata: getNFTMetadataFunc,
@@ -1,2 +1 @@
1
- export * from './addNameToAccount';
2
1
  export * from './getNFTMetadata';
@@ -1,2 +1 @@
1
- export * from "./addNameToAccount";
2
1
  export * from "./getNFTMetadata";
@@ -6,3 +6,4 @@ export * from './safeheron';
6
6
  export * from './universal-wallet';
7
7
  export * from './okx-wallet';
8
8
  export * from './im-token';
9
+ export * from './mobile-wallet';
@@ -5,4 +5,5 @@ export * from "./token-pocket";
5
5
  export * from "./safeheron";
6
6
  export * from "./universal-wallet";
7
7
  export * from "./okx-wallet";
8
- export * from "./im-token";
8
+ export * from "./im-token";
9
+ export * from "./mobile-wallet";
@@ -0,0 +1,2 @@
1
+ import { type EthereumWalletConnect } from './wallet-connect';
2
+ export declare const MobileWallet: EthereumWalletConnect;
@@ -0,0 +1,11 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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
+ 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
+ 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(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
+ import { metadata_MobileConnect } from '@ant-design/web3-assets';
8
+ import { WalletConnect } from "./wallet-connect";
9
+ export var MobileWallet = function MobileWallet(metadata) {
10
+ return WalletConnect(_objectSpread(_objectSpread({}, metadata_MobileConnect), metadata));
11
+ };
@@ -1,7 +1,6 @@
1
1
  import type { WalletMetadata } from '@ant-design/web3-common';
2
2
  import type { WalletFactory } from '../interface';
3
- type EthereumWalletConnect = (metadata?: Partial<WalletMetadata> & {
3
+ export type EthereumWalletConnect = (metadata?: Partial<WalletMetadata> & {
4
4
  useWalletConnectOfficialModal?: boolean;
5
5
  }) => WalletFactory;
6
6
  export declare const WalletConnect: EthereumWalletConnect;
7
- export {};
@@ -56,18 +56,35 @@ export var WalletConnect = function WalletConnect(metadata) {
56
56
  };
57
57
  }();
58
58
  return _objectSpread(_objectSpread({}, metadata_WalletConnect), {}, {
59
- hasWalletReady: function () {
60
- var _hasWalletReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
59
+ getWagmiConnector: function () {
60
+ var _getWagmiConnector = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
61
61
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
62
62
  while (1) switch (_context2.prev = _context2.next) {
63
63
  case 0:
64
- return _context2.abrupt("return", true);
64
+ return _context2.abrupt("return", connectors === null || connectors === void 0 ? void 0 : connectors[0]);
65
65
  case 1:
66
66
  case "end":
67
67
  return _context2.stop();
68
68
  }
69
69
  }, _callee2);
70
70
  }));
71
+ function getWagmiConnector() {
72
+ return _getWagmiConnector.apply(this, arguments);
73
+ }
74
+ return getWagmiConnector;
75
+ }(),
76
+ hasWalletReady: function () {
77
+ var _hasWalletReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
78
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
79
+ while (1) switch (_context3.prev = _context3.next) {
80
+ case 0:
81
+ return _context3.abrupt("return", true);
82
+ case 1:
83
+ case "end":
84
+ return _context3.stop();
85
+ }
86
+ }, _callee3);
87
+ }));
71
88
  function hasWalletReady() {
72
89
  return _hasWalletReady.apply(this, arguments);
73
90
  }
@@ -6,6 +6,7 @@ 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");
9
10
  var _wagmi = require("wagmi");
10
11
  var _utils = require("../utils");
11
12
  var _eip = require("../wallets/eip6963");
@@ -37,31 +38,30 @@ const AntDesignWeb3ConfigProvider = props => {
37
38
  const {
38
39
  switchChain
39
40
  } = (0, _wagmi.useSwitchChain)();
40
- const {
41
- disconnectAsync
42
- } = (0, _wagmi.useDisconnect)();
43
- const [currentChain, setCurrentChain] = _react.default.useState(undefined);
44
41
  const {
45
42
  data: balanceData
46
43
  } = (0, _wagmi.useBalance)({
47
44
  address: balance && account ? (0, _web3Common.fillAddressWith0x)(account.address) : undefined
48
45
  });
46
+ const {
47
+ data: ensName
48
+ } = (0, _wagmi.useEnsName)({
49
+ address
50
+ });
49
51
  _react.default.useEffect(() => {
50
52
  if (!address || isDisconnected) {
51
53
  setAccount(undefined);
52
- return;
54
+ } else if (ens && ensName) {
55
+ setAccount({
56
+ address: (0, _web3Common.fillAddressWith0x)(address),
57
+ name: ensName
58
+ });
59
+ } else {
60
+ setAccount({
61
+ address: (0, _web3Common.fillAddressWith0x)(address)
62
+ });
53
63
  }
54
- const updateAccounts = async () => {
55
- const a = {
56
- address
57
- };
58
- setAccount(a);
59
- if (ens) {
60
- setAccount(await (0, _methods.addNameToAccount)(config, a));
61
- }
62
- };
63
- updateAccounts();
64
- }, [address, isDisconnected, chain, ens]);
64
+ }, [address, isDisconnected, ens, ensName]);
65
65
  const findConnectorByName = name => {
66
66
  const commonConnector = availableConnectors.find(item => item.name === name && !(0, _utils.isEIP6963Connector)(item));
67
67
  if (!eip6963) {
@@ -117,25 +117,22 @@ const AntDesignWeb3ConfigProvider = props => {
117
117
  return null;
118
118
  }).filter(item => item !== null);
119
119
  }, [availableChains, chainAssets]);
120
+ const chainId = chain?.id || availableChains?.[0]?.id;
121
+ const chainName = chain?.name || availableChains?.[0]?.name;
122
+ const [currentChain, setCurrentChain] = _react.default.useState(undefined);
120
123
  _react.default.useEffect(() => {
121
- if (!chain && currentChain) {
124
+ setCurrentChain(prevChain => {
122
125
  // not connected any chain, keep current chain
123
- return;
124
- }
125
- const currentWagmiChain = chain ?? availableChains[0];
126
- if (!currentWagmiChain) {
127
- return;
128
- }
129
- let c = chainAssets?.find(item => item.id === currentWagmiChain?.id);
130
- if (!c?.id) {
131
- c = {
132
- id: currentWagmiChain.id,
133
- name: currentWagmiChain.name
134
- };
135
- }
136
- setCurrentChain(c);
137
- return;
138
- }, [chain, chainAssets, availableChains, currentChain]);
126
+ let newChain = chainAssets?.find(item => item?.id === chainId);
127
+ if (!newChain && chainId) {
128
+ newChain = {
129
+ id: chainId,
130
+ name: chainName
131
+ };
132
+ }
133
+ return newChain || prevChain;
134
+ });
135
+ }, [chainAssets, availableChains, chainId, chainName]);
139
136
  const currency = currentChain?.nativeCurrency;
140
137
  const getNFTMetadataFunc = _react.default.useCallback(async ({
141
138
  address: contractAddress,
@@ -168,17 +165,25 @@ const AntDesignWeb3ConfigProvider = props => {
168
165
  });
169
166
  },
170
167
  disconnect: async () => {
171
- await disconnectAsync();
168
+ // await disconnectAsync();
169
+ // TODO@jeasonstudio: wagmi useDisconnect hook 在处理多实例(config)共存时,
170
+ // 存在一些状态处理的 bug,暂时用更低阶 API 代替。
171
+ const {
172
+ connector
173
+ } = (0, _core.getAccount)(config);
174
+ await (0, _core.disconnect)(config, {
175
+ connector
176
+ });
172
177
  },
173
- switchChain: async c => {
178
+ switchChain: async newChain => {
174
179
  if (!chain) {
175
180
  // hava not connected any chain
176
- setCurrentChain(c);
177
- return;
181
+ setCurrentChain(newChain);
182
+ } else {
183
+ switchChain?.({
184
+ chainId: newChain.id
185
+ });
178
186
  }
179
- switchChain?.({
180
- chainId: c.id
181
- });
182
187
  },
183
188
  getNFTMetadata: getNFTMetadataFunc,
184
189
  children: children
@@ -1,2 +1 @@
1
- export * from './addNameToAccount';
2
1
  export * from './getNFTMetadata';
@@ -3,17 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _addNameToAccount = require("./addNameToAccount");
7
- Object.keys(_addNameToAccount).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _addNameToAccount[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _addNameToAccount[key];
14
- }
15
- });
16
- });
17
6
  var _getNFTMetadata = require("./getNFTMetadata");
18
7
  Object.keys(_getNFTMetadata).forEach(function (key) {
19
8
  if (key === "default" || key === "__esModule") return;
@@ -6,3 +6,4 @@ export * from './safeheron';
6
6
  export * from './universal-wallet';
7
7
  export * from './okx-wallet';
8
8
  export * from './im-token';
9
+ export * from './mobile-wallet';
@@ -90,4 +90,15 @@ Object.keys(_imToken).forEach(function (key) {
90
90
  return _imToken[key];
91
91
  }
92
92
  });
93
+ });
94
+ var _mobileWallet = require("./mobile-wallet");
95
+ Object.keys(_mobileWallet).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _mobileWallet[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function () {
101
+ return _mobileWallet[key];
102
+ }
103
+ });
93
104
  });
@@ -0,0 +1,2 @@
1
+ import { type EthereumWalletConnect } from './wallet-connect';
2
+ export declare const MobileWallet: EthereumWalletConnect;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MobileWallet = void 0;
7
+ var _web3Assets = require("@ant-design/web3-assets");
8
+ var _walletConnect = require("./wallet-connect");
9
+ const MobileWallet = metadata => {
10
+ return (0, _walletConnect.WalletConnect)({
11
+ ..._web3Assets.metadata_MobileConnect,
12
+ ...metadata
13
+ });
14
+ };
15
+ exports.MobileWallet = MobileWallet;
@@ -1,7 +1,6 @@
1
1
  import type { WalletMetadata } from '@ant-design/web3-common';
2
2
  import type { WalletFactory } from '../interface';
3
- type EthereumWalletConnect = (metadata?: Partial<WalletMetadata> & {
3
+ export type EthereumWalletConnect = (metadata?: Partial<WalletMetadata> & {
4
4
  useWalletConnectOfficialModal?: boolean;
5
5
  }) => WalletFactory;
6
6
  export declare const WalletConnect: EthereumWalletConnect;
7
- export {};
@@ -33,6 +33,9 @@ const WalletConnect = metadata => {
33
33
  };
34
34
  return {
35
35
  ..._web3Assets.metadata_WalletConnect,
36
+ getWagmiConnector: async () => {
37
+ return connectors?.[0];
38
+ },
36
39
  hasWalletReady: async () => {
37
40
  return true;
38
41
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/web3-wagmi",
3
- "version": "2.4.4",
3
+ "version": "2.5.0",
4
4
  "type": "module",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -39,21 +39,21 @@
39
39
  "dependencies": {
40
40
  "debug": "^4.3.4",
41
41
  "@wagmi/core": "^2.9.6",
42
- "@ant-design/web3-assets": "1.7.1",
43
- "@ant-design/web3-common": "1.9.1"
42
+ "@ant-design/web3-assets": "1.8.0",
43
+ "@ant-design/web3-common": "1.10.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/debug": "^4.1.12",
47
47
  "@wagmi/core": "^2.9.3",
48
48
  "father": "^4.4.0",
49
- "typescript": "^5.4.4",
49
+ "typescript": "^5.4.5",
50
50
  "wagmi": "^2.8.6",
51
- "@tanstack/react-query": "^5.28.4",
51
+ "@tanstack/react-query": "^5.37.1",
52
52
  "viem": "^2.10.3"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "wagmi": "^2.8.6",
56
- "@tanstack/react-query": "^5.28.4",
56
+ "@tanstack/react-query": "^5.37.1",
57
57
  "viem": ">=2.0.0"
58
58
  },
59
59
  "publishConfig": {
@@ -1,3 +0,0 @@
1
- import type { Account } from '@ant-design/web3-common';
2
- import type { Config } from 'wagmi';
3
- export declare function addNameToAccount(config: Config, account: Account, chainId?: number): Promise<Account>;
@@ -1,37 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- 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; }
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
- 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
- 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(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
- 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
- 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
- import { getEnsName } from '@wagmi/core';
11
- export function addNameToAccount(_x, _x2, _x3) {
12
- return _addNameToAccount.apply(this, arguments);
13
- }
14
- function _addNameToAccount() {
15
- _addNameToAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, account, chainId) {
16
- var name;
17
- return _regeneratorRuntime().wrap(function _callee$(_context) {
18
- while (1) switch (_context.prev = _context.next) {
19
- case 0:
20
- _context.next = 2;
21
- return getEnsName(config, {
22
- address: account.address,
23
- chainId: chainId
24
- });
25
- case 2:
26
- name = _context.sent;
27
- return _context.abrupt("return", _objectSpread(_objectSpread({}, account), {}, {
28
- name: name !== null && name !== void 0 ? name : undefined
29
- }));
30
- case 4:
31
- case "end":
32
- return _context.stop();
33
- }
34
- }, _callee);
35
- }));
36
- return _addNameToAccount.apply(this, arguments);
37
- }
@@ -1,3 +0,0 @@
1
- import type { Account } from '@ant-design/web3-common';
2
- import type { Config } from 'wagmi';
3
- export declare function addNameToAccount(config: Config, account: Account, chainId?: number): Promise<Account>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.addNameToAccount = addNameToAccount;
7
- var _core = require("@wagmi/core");
8
- async function addNameToAccount(config, account, chainId) {
9
- const name = await (0, _core.getEnsName)(config, {
10
- address: account.address,
11
- chainId
12
- });
13
- return {
14
- ...account,
15
- name: name ?? undefined
16
- };
17
- }