@ant-design/web3-wagmi 2.4.5 → 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 +15 -0
- package/dist/esm/wagmi-provider/config-provider.js +50 -69
- package/dist/esm/wagmi-provider/methods/index.d.ts +0 -1
- package/dist/esm/wagmi-provider/methods/index.js +0 -1
- package/dist/esm/wallets/index.d.ts +1 -0
- package/dist/esm/wallets/index.js +2 -1
- package/dist/esm/wallets/mobile-wallet.d.ts +2 -0
- package/dist/esm/wallets/mobile-wallet.js +11 -0
- package/dist/esm/wallets/wallet-connect.d.ts +1 -2
- package/dist/esm/wallets/wallet-connect.js +20 -3
- package/dist/lib/wagmi-provider/config-provider.js +14 -11
- package/dist/lib/wagmi-provider/methods/index.d.ts +0 -1
- package/dist/lib/wagmi-provider/methods/index.js +0 -11
- package/dist/lib/wallets/index.d.ts +1 -0
- package/dist/lib/wallets/index.js +11 -0
- package/dist/lib/wallets/mobile-wallet.d.ts +2 -0
- package/dist/lib/wallets/mobile-wallet.js +15 -0
- package/dist/lib/wallets/wallet-connect.d.ts +1 -2
- package/dist/lib/wallets/wallet-connect.js +3 -0
- package/package.json +4 -4
- package/dist/esm/wagmi-provider/methods/addNameToAccount.d.ts +0 -3
- package/dist/esm/wagmi-provider/methods/addNameToAccount.js +0 -37
- package/dist/lib/wagmi-provider/methods/addNameToAccount.d.ts +0 -3
- package/dist/lib/wagmi-provider/methods/addNameToAccount.js +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
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
|
+
|
|
3
18
|
## 2.4.5
|
|
4
19
|
|
|
5
20
|
### 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); }
|
|
@@ -15,10 +15,10 @@ 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
17
|
import { disconnect, getAccount } from '@wagmi/core';
|
|
18
|
-
import { useAccount, useBalance, useConfig, useConnect, useSwitchChain } from 'wagmi';
|
|
18
|
+
import { useAccount, useBalance, useConfig, useConnect, useEnsName, useSwitchChain } from 'wagmi';
|
|
19
19
|
import { isEIP6963Connector } from "../utils";
|
|
20
20
|
import { EIP6963Wallet } from "../wallets/eip6963";
|
|
21
|
-
import {
|
|
21
|
+
import { getNFTMetadata } from "./methods";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(props) {
|
|
24
24
|
var _availableChains$, _availableChains$2;
|
|
@@ -48,43 +48,24 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
|
|
|
48
48
|
address: balance && account ? fillAddressWith0x(account.address) : undefined
|
|
49
49
|
}),
|
|
50
50
|
balanceData = _useBalance.data;
|
|
51
|
+
var _useEnsName = useEnsName({
|
|
52
|
+
address: address
|
|
53
|
+
}),
|
|
54
|
+
ensName = _useEnsName.data;
|
|
51
55
|
React.useEffect(function () {
|
|
52
56
|
if (!address || isDisconnected) {
|
|
53
57
|
setAccount(undefined);
|
|
58
|
+
} else if (ens && ensName) {
|
|
59
|
+
setAccount({
|
|
60
|
+
address: fillAddressWith0x(address),
|
|
61
|
+
name: ensName
|
|
62
|
+
});
|
|
54
63
|
} else {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
59
|
-
while (1) switch (_context.prev = _context.next) {
|
|
60
|
-
case 0:
|
|
61
|
-
a = {
|
|
62
|
-
address: address
|
|
63
|
-
};
|
|
64
|
-
setAccount(a);
|
|
65
|
-
if (!ens) {
|
|
66
|
-
_context.next = 8;
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
_context.t0 = setAccount;
|
|
70
|
-
_context.next = 6;
|
|
71
|
-
return addNameToAccount(config, a);
|
|
72
|
-
case 6:
|
|
73
|
-
_context.t1 = _context.sent;
|
|
74
|
-
(0, _context.t0)(_context.t1);
|
|
75
|
-
case 8:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
79
|
-
}, _callee);
|
|
80
|
-
}));
|
|
81
|
-
return function updateAccounts() {
|
|
82
|
-
return _ref.apply(this, arguments);
|
|
83
|
-
};
|
|
84
|
-
}();
|
|
85
|
-
updateAccounts();
|
|
64
|
+
setAccount({
|
|
65
|
+
address: fillAddressWith0x(address)
|
|
66
|
+
});
|
|
86
67
|
}
|
|
87
|
-
}, [address, isDisconnected,
|
|
68
|
+
}, [address, isDisconnected, ens, ensName]);
|
|
88
69
|
var findConnectorByName = function findConnectorByName(name) {
|
|
89
70
|
var commonConnector = availableConnectors.find(function (item) {
|
|
90
71
|
return item.name === name && !isEIP6963Connector(item);
|
|
@@ -177,21 +158,21 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
|
|
|
177
158
|
}, [chainAssets, availableChains, chainId, chainName]);
|
|
178
159
|
var currency = currentChain === null || currentChain === void 0 ? void 0 : currentChain.nativeCurrency;
|
|
179
160
|
var getNFTMetadataFunc = React.useCallback( /*#__PURE__*/function () {
|
|
180
|
-
var
|
|
161
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
181
162
|
var contractAddress, tokenId;
|
|
182
|
-
return _regeneratorRuntime().wrap(function
|
|
183
|
-
while (1) switch (
|
|
163
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
164
|
+
while (1) switch (_context.prev = _context.next) {
|
|
184
165
|
case 0:
|
|
185
|
-
contractAddress =
|
|
186
|
-
return
|
|
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));
|
|
187
168
|
case 2:
|
|
188
169
|
case "end":
|
|
189
|
-
return
|
|
170
|
+
return _context.stop();
|
|
190
171
|
}
|
|
191
|
-
},
|
|
172
|
+
}, _callee);
|
|
192
173
|
}));
|
|
193
174
|
return function (_x) {
|
|
194
|
-
return
|
|
175
|
+
return _ref2.apply(this, arguments);
|
|
195
176
|
};
|
|
196
177
|
}(), [chain === null || chain === void 0 ? void 0 : chain.id]);
|
|
197
178
|
return /*#__PURE__*/_jsx(Web3ConfigProvider, {
|
|
@@ -208,63 +189,63 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
|
|
|
208
189
|
availableWallets: wallets,
|
|
209
190
|
addressPrefix: "0x",
|
|
210
191
|
connect: ( /*#__PURE__*/function () {
|
|
211
|
-
var
|
|
212
|
-
var _getWagmiConnector,
|
|
192
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(wallet, options) {
|
|
193
|
+
var _getWagmiConnector, _ref4;
|
|
213
194
|
var connector;
|
|
214
|
-
return _regeneratorRuntime().wrap(function
|
|
215
|
-
while (1) switch (
|
|
195
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
196
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
216
197
|
case 0:
|
|
217
|
-
|
|
218
|
-
return wallet === null || wallet === void 0 || (_getWagmiConnector = (
|
|
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);
|
|
219
200
|
case 2:
|
|
220
|
-
connector =
|
|
201
|
+
connector = _context2.sent;
|
|
221
202
|
if (!connector && wallet) {
|
|
222
203
|
connector = findConnectorByName(wallet.name);
|
|
223
204
|
}
|
|
224
205
|
if (connector) {
|
|
225
|
-
|
|
206
|
+
_context2.next = 6;
|
|
226
207
|
break;
|
|
227
208
|
}
|
|
228
209
|
throw new Error("Can not find connector for ".concat(wallet === null || wallet === void 0 ? void 0 : wallet.name));
|
|
229
210
|
case 6:
|
|
230
|
-
|
|
211
|
+
_context2.next = 8;
|
|
231
212
|
return connectAsync({
|
|
232
213
|
connector: connector,
|
|
233
214
|
chainId: currentChain === null || currentChain === void 0 ? void 0 : currentChain.id
|
|
234
215
|
});
|
|
235
216
|
case 8:
|
|
236
217
|
case "end":
|
|
237
|
-
return
|
|
218
|
+
return _context2.stop();
|
|
238
219
|
}
|
|
239
|
-
},
|
|
220
|
+
}, _callee2);
|
|
240
221
|
}));
|
|
241
222
|
return function (_x2, _x3) {
|
|
242
|
-
return
|
|
223
|
+
return _ref3.apply(this, arguments);
|
|
243
224
|
};
|
|
244
225
|
}()),
|
|
245
|
-
disconnect: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
226
|
+
disconnect: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
246
227
|
var _getAccount, connector;
|
|
247
|
-
return _regeneratorRuntime().wrap(function
|
|
248
|
-
while (1) switch (
|
|
228
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
229
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
249
230
|
case 0:
|
|
250
231
|
// await disconnectAsync();
|
|
251
232
|
// TODO@jeasonstudio: wagmi useDisconnect hook 在处理多实例(config)共存时,
|
|
252
233
|
// 存在一些状态处理的 bug,暂时用更低阶 API 代替。
|
|
253
234
|
_getAccount = getAccount(config), connector = _getAccount.connector;
|
|
254
|
-
|
|
235
|
+
_context3.next = 3;
|
|
255
236
|
return disconnect(config, {
|
|
256
237
|
connector: connector
|
|
257
238
|
});
|
|
258
239
|
case 3:
|
|
259
240
|
case "end":
|
|
260
|
-
return
|
|
241
|
+
return _context3.stop();
|
|
261
242
|
}
|
|
262
|
-
},
|
|
243
|
+
}, _callee3);
|
|
263
244
|
})),
|
|
264
245
|
switchChain: ( /*#__PURE__*/function () {
|
|
265
|
-
var
|
|
266
|
-
return _regeneratorRuntime().wrap(function
|
|
267
|
-
while (1) switch (
|
|
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) {
|
|
268
249
|
case 0:
|
|
269
250
|
if (!chain) {
|
|
270
251
|
// hava not connected any chain
|
|
@@ -276,12 +257,12 @@ export var AntDesignWeb3ConfigProvider = function AntDesignWeb3ConfigProvider(pr
|
|
|
276
257
|
}
|
|
277
258
|
case 1:
|
|
278
259
|
case "end":
|
|
279
|
-
return
|
|
260
|
+
return _context4.stop();
|
|
280
261
|
}
|
|
281
|
-
},
|
|
262
|
+
}, _callee4);
|
|
282
263
|
}));
|
|
283
264
|
return function (_x4) {
|
|
284
|
-
return
|
|
265
|
+
return _ref6.apply(this, arguments);
|
|
285
266
|
};
|
|
286
267
|
}()),
|
|
287
268
|
getNFTMetadata: getNFTMetadataFunc,
|
|
@@ -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
|
-
|
|
60
|
-
var
|
|
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",
|
|
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
|
}
|
|
@@ -43,22 +43,25 @@ const AntDesignWeb3ConfigProvider = props => {
|
|
|
43
43
|
} = (0, _wagmi.useBalance)({
|
|
44
44
|
address: balance && account ? (0, _web3Common.fillAddressWith0x)(account.address) : undefined
|
|
45
45
|
});
|
|
46
|
+
const {
|
|
47
|
+
data: ensName
|
|
48
|
+
} = (0, _wagmi.useEnsName)({
|
|
49
|
+
address
|
|
50
|
+
});
|
|
46
51
|
_react.default.useEffect(() => {
|
|
47
52
|
if (!address || isDisconnected) {
|
|
48
53
|
setAccount(undefined);
|
|
54
|
+
} else if (ens && ensName) {
|
|
55
|
+
setAccount({
|
|
56
|
+
address: (0, _web3Common.fillAddressWith0x)(address),
|
|
57
|
+
name: ensName
|
|
58
|
+
});
|
|
49
59
|
} else {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
setAccount(a);
|
|
55
|
-
if (ens) {
|
|
56
|
-
setAccount(await (0, _methods.addNameToAccount)(config, a));
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
updateAccounts();
|
|
60
|
+
setAccount({
|
|
61
|
+
address: (0, _web3Common.fillAddressWith0x)(address)
|
|
62
|
+
});
|
|
60
63
|
}
|
|
61
|
-
}, [address, isDisconnected,
|
|
64
|
+
}, [address, isDisconnected, ens, ensName]);
|
|
62
65
|
const findConnectorByName = name => {
|
|
63
66
|
const commonConnector = availableConnectors.find(item => item.name === name && !(0, _utils.isEIP6963Connector)(item));
|
|
64
67
|
if (!eip6963) {
|
|
@@ -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;
|
|
@@ -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,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 {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/web3-wagmi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"debug": "^4.3.4",
|
|
41
41
|
"@wagmi/core": "^2.9.6",
|
|
42
|
-
"@ant-design/web3-assets": "1.
|
|
43
|
-
"@ant-design/web3-common": "1.10.
|
|
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.
|
|
49
|
+
"typescript": "^5.4.5",
|
|
50
50
|
"wagmi": "^2.8.6",
|
|
51
51
|
"@tanstack/react-query": "^5.37.1",
|
|
52
52
|
"viem": "^2.10.3"
|
|
@@ -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,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
|
-
}
|