@springmicro/auth 0.2.0-alpha.4 → 0.3.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/dist/{Index-652aeb8c-BTQ1rBi7.js → Index-652aeb8c-Cr1mbyJJ.js} +1 -1
- package/dist/{Index-c419311f-BOZhAAW3.js → Index-c419311f-DolmVisI.js} +1 -1
- package/dist/{Web3Auth-hACKSouN.js → Web3Auth-C5tucK1E.js} +4712 -4694
- package/dist/{index-BHkXn9Ss.js → index-Boi-WcMK.js} +2 -2
- package/dist/{index-BaYEABY7.js → index-C4uVsW-I.js} +2 -2
- package/dist/{index-klU8YB0c.js → index-CLfsMiG4.js} +417 -379
- package/dist/{index-CynP9H3X.js → index-DOUI-2vv.js} +4 -4
- package/dist/{index-Dt6M8ha9.js → index-DPq81SIn.js} +1 -1
- package/dist/{index-Dg8m-Szw.js → index-DzOmdGpF.js} +1 -1
- package/dist/{index-DtJfAdfq.js → index-YKlm7xSx.js} +14 -7
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +94 -94
- package/dist/{number-BXHWhlom.js → number-UhidYs-H.js} +1 -1
- package/package.json +2 -2
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { bN as R } from "./Web3Auth-
|
|
2
|
-
const
|
|
1
|
+
import { bN as R } from "./Web3Auth-C5tucK1E.js";
|
|
2
|
+
const Qt = () => "9.1.0", Yt = (e) => e.toString(16).padStart(2, "0"), Jt = (e) => {
|
|
3
3
|
const t = new Uint8Array(e / 2);
|
|
4
|
-
return window.crypto.getRandomValues(t), Array.from(t,
|
|
5
|
-
},
|
|
4
|
+
return window.crypto.getRandomValues(t), Array.from(t, Yt).join("");
|
|
5
|
+
}, Zt = () => typeof window < "u" ? Jt(10) : (/* @__PURE__ */ new Date()).getTime().toString(36);
|
|
6
6
|
class V {
|
|
7
7
|
}
|
|
8
8
|
V.makeRequest = (e, t) => ({
|
|
9
|
-
id:
|
|
9
|
+
id: Zt(),
|
|
10
10
|
method: e,
|
|
11
11
|
params: t,
|
|
12
12
|
env: {
|
|
13
|
-
sdkVersion:
|
|
13
|
+
sdkVersion: Qt()
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
V.makeResponse = (e, t, n) => ({
|
|
@@ -33,12 +33,12 @@ var J;
|
|
|
33
33
|
(function(e) {
|
|
34
34
|
e.requestAddressBook = "requestAddressBook";
|
|
35
35
|
})(J || (J = {}));
|
|
36
|
-
class
|
|
36
|
+
class xt {
|
|
37
37
|
constructor(t = null, n = !1) {
|
|
38
38
|
this.allowedOrigins = null, this.callbacks = /* @__PURE__ */ new Map(), this.debugMode = !1, this.isServer = typeof window > "u", this.isValidMessage = ({ origin: i, data: s, source: r }) => {
|
|
39
|
-
const o = !s,
|
|
39
|
+
const o = !s, c = !this.isServer && r === window.parent, l = typeof s.version < "u" && parseInt(s.version.split(".")[0]), g = typeof l == "number" && l >= 1;
|
|
40
40
|
let h = !0;
|
|
41
|
-
return Array.isArray(this.allowedOrigins) && (h = this.allowedOrigins.find((y) => y.test(i)) !== void 0), !o &&
|
|
41
|
+
return Array.isArray(this.allowedOrigins) && (h = this.allowedOrigins.find((y) => y.test(i)) !== void 0), !o && c && g && h;
|
|
42
42
|
}, this.logIncomingMessage = (i) => {
|
|
43
43
|
console.info(`Safe Apps SDK v1: A message was received from origin ${i.origin}. `, i.data);
|
|
44
44
|
}, this.onParentMessage = (i) => {
|
|
@@ -50,10 +50,10 @@ class Kt {
|
|
|
50
50
|
const r = V.makeRequest(i, s);
|
|
51
51
|
if (this.isServer)
|
|
52
52
|
throw new Error("Window doesn't exist");
|
|
53
|
-
return window.parent.postMessage(r, "*"), new Promise((o,
|
|
53
|
+
return window.parent.postMessage(r, "*"), new Promise((o, c) => {
|
|
54
54
|
this.callbacks.set(r.id, (l) => {
|
|
55
55
|
if (!l.success) {
|
|
56
|
-
|
|
56
|
+
c(new Error(l.error));
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
o(l);
|
|
@@ -62,15 +62,15 @@ class Kt {
|
|
|
62
62
|
}, this.allowedOrigins = t, this.debugMode = n, this.isServer || window.addEventListener("message", this.onParentMessage);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
const
|
|
66
|
-
var
|
|
65
|
+
const Se = (e) => typeof e == "object" && e != null && "domain" in e && "types" in e && "message" in e;
|
|
66
|
+
var en = {}, A = {}, T = {}, ne = R && R.__awaiter || function(e, t, n, i) {
|
|
67
67
|
function s(r) {
|
|
68
68
|
return r instanceof n ? r : new n(function(o) {
|
|
69
69
|
o(r);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
return new (n || (n = Promise))(function(r, o) {
|
|
73
|
-
function
|
|
73
|
+
function c(h) {
|
|
74
74
|
try {
|
|
75
75
|
g(i.next(h));
|
|
76
76
|
} catch (y) {
|
|
@@ -85,22 +85,22 @@ var Xt = {}, A = {}, T = {}, ne = R && R.__awaiter || function(e, t, n, i) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
function g(h) {
|
|
88
|
-
h.done ? r(h.value) : s(h.value).then(
|
|
88
|
+
h.done ? r(h.value) : s(h.value).then(c, l);
|
|
89
89
|
}
|
|
90
90
|
g((i = i.apply(e, t || [])).next());
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
93
|
Object.defineProperty(T, "__esModule", { value: !0 });
|
|
94
94
|
T.getData = T.fetchData = T.stringifyQuery = T.insertParams = void 0;
|
|
95
|
-
const
|
|
96
|
-
function
|
|
95
|
+
const tn = (e) => typeof e == "object" && e !== null && "code" in e && "message" in e;
|
|
96
|
+
function nn(e, t, n) {
|
|
97
97
|
return e.replace(new RegExp(`\\{${t}\\}`, "g"), n);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return t ? Object.keys(t).reduce((n, i) =>
|
|
99
|
+
function sn(e, t) {
|
|
100
|
+
return t ? Object.keys(t).reduce((n, i) => nn(n, i, String(t[i])), e) : e;
|
|
101
101
|
}
|
|
102
|
-
T.insertParams =
|
|
103
|
-
function
|
|
102
|
+
T.insertParams = sn;
|
|
103
|
+
function rn(e) {
|
|
104
104
|
if (!e)
|
|
105
105
|
return "";
|
|
106
106
|
const t = new URLSearchParams();
|
|
@@ -110,46 +110,45 @@ function Zt(e) {
|
|
|
110
110
|
const n = t.toString();
|
|
111
111
|
return n ? `?${n}` : "";
|
|
112
112
|
}
|
|
113
|
-
T.stringifyQuery =
|
|
114
|
-
function
|
|
113
|
+
T.stringifyQuery = rn;
|
|
114
|
+
function Ie(e) {
|
|
115
115
|
return ne(this, void 0, void 0, function* () {
|
|
116
116
|
let t;
|
|
117
117
|
try {
|
|
118
|
-
t =
|
|
118
|
+
t = yield e.json();
|
|
119
119
|
} catch {
|
|
120
|
-
|
|
121
|
-
throw new Error(`Invalid response content: ${e.statusText}`);
|
|
120
|
+
t = {};
|
|
122
121
|
}
|
|
123
122
|
if (!e.ok) {
|
|
124
|
-
const n =
|
|
123
|
+
const n = tn(t) ? `CGW error - ${t.code}: ${t.message}` : `CGW error - status ${e.statusText}`;
|
|
125
124
|
throw new Error(n);
|
|
126
125
|
}
|
|
127
126
|
return t;
|
|
128
127
|
});
|
|
129
128
|
}
|
|
130
|
-
function
|
|
129
|
+
function on(e, t, n, i, s) {
|
|
131
130
|
return ne(this, void 0, void 0, function* () {
|
|
132
131
|
const r = Object.assign({ "Content-Type": "application/json" }, i), o = {
|
|
133
132
|
method: t ?? "POST",
|
|
134
133
|
headers: r
|
|
135
134
|
};
|
|
136
135
|
s && (o.credentials = s), n != null && (o.body = typeof n == "string" ? n : JSON.stringify(n));
|
|
137
|
-
const
|
|
138
|
-
return
|
|
136
|
+
const c = yield fetch(e, o);
|
|
137
|
+
return Ie(c);
|
|
139
138
|
});
|
|
140
139
|
}
|
|
141
|
-
T.fetchData =
|
|
142
|
-
function
|
|
140
|
+
T.fetchData = on;
|
|
141
|
+
function an(e, t, n) {
|
|
143
142
|
return ne(this, void 0, void 0, function* () {
|
|
144
143
|
const i = {
|
|
145
144
|
method: "GET"
|
|
146
145
|
};
|
|
147
146
|
t && (i.headers = Object.assign(Object.assign({}, t), { "Content-Type": "application/json" })), n && (i.credentials = n);
|
|
148
147
|
const s = yield fetch(e, i);
|
|
149
|
-
return
|
|
148
|
+
return Ie(s);
|
|
150
149
|
});
|
|
151
150
|
}
|
|
152
|
-
T.getData =
|
|
151
|
+
T.getData = an;
|
|
153
152
|
Object.defineProperty(A, "__esModule", { value: !0 });
|
|
154
153
|
A.getEndpoint = A.deleteEndpoint = A.putEndpoint = A.postEndpoint = void 0;
|
|
155
154
|
const D = T;
|
|
@@ -157,39 +156,39 @@ function W(e, t, n, i) {
|
|
|
157
156
|
const s = (0, D.insertParams)(t, n), r = (0, D.stringifyQuery)(i);
|
|
158
157
|
return `${e}${s}${r}`;
|
|
159
158
|
}
|
|
160
|
-
function
|
|
159
|
+
function cn(e, t, n) {
|
|
161
160
|
const i = W(e, t, n == null ? void 0 : n.path, n == null ? void 0 : n.query);
|
|
162
161
|
return (0, D.fetchData)(i, "POST", n == null ? void 0 : n.body, n == null ? void 0 : n.headers, n == null ? void 0 : n.credentials);
|
|
163
162
|
}
|
|
164
|
-
A.postEndpoint =
|
|
165
|
-
function
|
|
163
|
+
A.postEndpoint = cn;
|
|
164
|
+
function un(e, t, n) {
|
|
166
165
|
const i = W(e, t, n == null ? void 0 : n.path, n == null ? void 0 : n.query);
|
|
167
166
|
return (0, D.fetchData)(i, "PUT", n == null ? void 0 : n.body, n == null ? void 0 : n.headers, n == null ? void 0 : n.credentials);
|
|
168
167
|
}
|
|
169
|
-
A.putEndpoint =
|
|
170
|
-
function
|
|
168
|
+
A.putEndpoint = un;
|
|
169
|
+
function fn(e, t, n) {
|
|
171
170
|
const i = W(e, t, n == null ? void 0 : n.path, n == null ? void 0 : n.query);
|
|
172
171
|
return (0, D.fetchData)(i, "DELETE", n == null ? void 0 : n.body, n == null ? void 0 : n.headers, n == null ? void 0 : n.credentials);
|
|
173
172
|
}
|
|
174
|
-
A.deleteEndpoint =
|
|
175
|
-
function
|
|
173
|
+
A.deleteEndpoint = fn;
|
|
174
|
+
function dn(e, t, n, i) {
|
|
176
175
|
if (i)
|
|
177
176
|
return (0, D.getData)(i, void 0, n == null ? void 0 : n.credentials);
|
|
178
177
|
const s = W(e, t, n == null ? void 0 : n.path, n == null ? void 0 : n.query);
|
|
179
178
|
return (0, D.getData)(s, n == null ? void 0 : n.headers, n == null ? void 0 : n.credentials);
|
|
180
179
|
}
|
|
181
|
-
A.getEndpoint =
|
|
180
|
+
A.getEndpoint = dn;
|
|
182
181
|
var q = {};
|
|
183
182
|
Object.defineProperty(q, "__esModule", { value: !0 });
|
|
184
183
|
q.DEFAULT_BASE_URL = void 0;
|
|
185
184
|
q.DEFAULT_BASE_URL = "https://safe-client.safe.global";
|
|
186
|
-
var
|
|
185
|
+
var ve = {};
|
|
187
186
|
(function(e) {
|
|
188
187
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.ImplementationVersionState = void 0, function(t) {
|
|
189
188
|
t.UP_TO_DATE = "UP_TO_DATE", t.OUTDATED = "OUTDATED", t.UNKNOWN = "UNKNOWN";
|
|
190
189
|
}(e.ImplementationVersionState || (e.ImplementationVersionState = {}));
|
|
191
|
-
})(
|
|
192
|
-
var
|
|
190
|
+
})(ve);
|
|
191
|
+
var we = {};
|
|
193
192
|
(function(e) {
|
|
194
193
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.SafeAppSocialPlatforms = e.SafeAppFeatures = e.SafeAppAccessPolicyTypes = void 0, function(t) {
|
|
195
194
|
t.NoRestrictions = "NO_RESTRICTIONS", t.DomainAllowlist = "DOMAIN_ALLOWLIST";
|
|
@@ -198,7 +197,7 @@ var ve = {};
|
|
|
198
197
|
}(e.SafeAppFeatures || (e.SafeAppFeatures = {})), function(t) {
|
|
199
198
|
t.TWITTER = "TWITTER", t.GITHUB = "GITHUB", t.DISCORD = "DISCORD";
|
|
200
199
|
}(e.SafeAppSocialPlatforms || (e.SafeAppSocialPlatforms = {}));
|
|
201
|
-
})(
|
|
200
|
+
})(we);
|
|
202
201
|
var Oe = {};
|
|
203
202
|
(function(e) {
|
|
204
203
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.LabelValue = e.StartTimeValue = e.DurationType = e.DetailedExecutionInfoType = e.TransactionListItemType = e.ConflictType = e.TransactionInfoType = e.SettingsInfoType = e.TransactionTokenType = e.TransferDirection = e.TransactionStatus = e.Operation = void 0, function(t) {
|
|
@@ -268,286 +267,286 @@ var Re = {};
|
|
|
268
267
|
var $e = {};
|
|
269
268
|
Object.defineProperty($e, "__esModule", { value: !0 });
|
|
270
269
|
(function(e) {
|
|
271
|
-
var t = R && R.__createBinding || (Object.create ? function(
|
|
270
|
+
var t = R && R.__createBinding || (Object.create ? function(a, u, f, d) {
|
|
272
271
|
d === void 0 && (d = f);
|
|
273
|
-
var
|
|
274
|
-
(!
|
|
272
|
+
var w = Object.getOwnPropertyDescriptor(u, f);
|
|
273
|
+
(!w || ("get" in w ? !u.__esModule : w.writable || w.configurable)) && (w = { enumerable: !0, get: function() {
|
|
275
274
|
return u[f];
|
|
276
|
-
} }), Object.defineProperty(
|
|
277
|
-
} : function(
|
|
278
|
-
d === void 0 && (d = f),
|
|
279
|
-
}), n = R && R.__exportStar || function(
|
|
280
|
-
for (var f in
|
|
275
|
+
} }), Object.defineProperty(a, d, w);
|
|
276
|
+
} : function(a, u, f, d) {
|
|
277
|
+
d === void 0 && (d = f), a[d] = u[f];
|
|
278
|
+
}), n = R && R.__exportStar || function(a, u) {
|
|
279
|
+
for (var f in a) f !== "default" && !Object.prototype.hasOwnProperty.call(u, f) && t(u, a, f);
|
|
281
280
|
};
|
|
282
|
-
Object.defineProperty(e, "__esModule", { value: !0 }), e.verifyAuth = e.getAuthNonce = e.getContract = e.getSafeOverviews = e.unsubscribeAll = e.unsubscribeSingle = e.registerRecoveryModule = e.deleteRegisteredEmail = e.getRegisteredEmail = e.verifyEmail = e.resendEmailVerificationCode = e.changeEmail = e.registerEmail = e.unregisterDevice = e.unregisterSafe = e.registerDevice = e.getDelegates = e.confirmSafeMessage = e.proposeSafeMessage = e.getSafeMessage = e.getSafeMessages = e.getDecodedData = e.getMasterCopies = e.getSafeApps = e.getChainConfig = e.getChainsConfig = e.getConfirmationView = e.proposeTransaction = e.getNonces = e.postSafeGasEstimation = e.deleteTransaction = e.getTransactionDetails = e.getTransactionQueue = e.getTransactionHistory = e.getCollectiblesPage = e.getCollectibles = e.getAllOwnedSafes = e.getOwnedSafes = e.getFiatCurrencies = e.getBalances = e.getMultisigTransactions = e.getModuleTransactions = e.getIncomingTransfers = e.getSafeInfo = e.getRelayCount = e.relayTransaction = e.setBaseUrl = void 0;
|
|
281
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.deleteAccount = e.getAccount = e.createAccount = e.verifyAuth = e.getAuthNonce = e.getContract = e.getSafeOverviews = e.unsubscribeAll = e.unsubscribeSingle = e.registerRecoveryModule = e.deleteRegisteredEmail = e.getRegisteredEmail = e.verifyEmail = e.resendEmailVerificationCode = e.changeEmail = e.registerEmail = e.unregisterDevice = e.unregisterSafe = e.registerDevice = e.getDelegates = e.confirmSafeMessage = e.proposeSafeMessage = e.getSafeMessage = e.getSafeMessages = e.getDecodedData = e.getMasterCopies = e.getSafeApps = e.getChainConfig = e.getChainsConfig = e.getConfirmationView = e.proposeTransaction = e.getNonces = e.postSafeGasEstimation = e.deleteTransaction = e.getTransactionDetails = e.getTransactionQueue = e.getTransactionHistory = e.getCollectiblesPage = e.getCollectibles = e.getAllOwnedSafes = e.getOwnedSafes = e.getFiatCurrencies = e.getBalances = e.getMultisigTransactions = e.getModuleTransactions = e.getIncomingTransfers = e.getSafeInfo = e.getRelayCount = e.relayTransaction = e.setBaseUrl = void 0, e.putAccountDataSettings = e.getAccountDataSettings = e.getAccountDataTypes = void 0;
|
|
283
282
|
const i = A, s = q;
|
|
284
|
-
n(
|
|
283
|
+
n(ve, e), n(we, e), n(Oe, e), n(Ne, e), n(Ce, e), n(Pe, e), n(De, e), n(Me, e), n(Re, e), n($e, e);
|
|
285
284
|
let r = s.DEFAULT_BASE_URL;
|
|
286
|
-
const o = (
|
|
287
|
-
r =
|
|
285
|
+
const o = (a) => {
|
|
286
|
+
r = a;
|
|
288
287
|
};
|
|
289
288
|
e.setBaseUrl = o;
|
|
290
|
-
function a
|
|
291
|
-
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/relay", { path: { chainId:
|
|
289
|
+
function c(a, u) {
|
|
290
|
+
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/relay", { path: { chainId: a }, body: u });
|
|
292
291
|
}
|
|
293
|
-
e.relayTransaction =
|
|
294
|
-
function l(
|
|
295
|
-
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/relay/{address}", { path: { chainId:
|
|
292
|
+
e.relayTransaction = c;
|
|
293
|
+
function l(a, u) {
|
|
294
|
+
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/relay/{address}", { path: { chainId: a, address: u } });
|
|
296
295
|
}
|
|
297
296
|
e.getRelayCount = l;
|
|
298
|
-
function g(
|
|
299
|
-
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{address}", { path: { chainId:
|
|
297
|
+
function g(a, u) {
|
|
298
|
+
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{address}", { path: { chainId: a, address: u } });
|
|
300
299
|
}
|
|
301
300
|
e.getSafeInfo = g;
|
|
302
|
-
function h(
|
|
301
|
+
function h(a, u, f, d) {
|
|
303
302
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{address}/incoming-transfers/", {
|
|
304
|
-
path: { chainId:
|
|
303
|
+
path: { chainId: a, address: u },
|
|
305
304
|
query: f
|
|
306
305
|
}, d);
|
|
307
306
|
}
|
|
308
307
|
e.getIncomingTransfers = h;
|
|
309
|
-
function y(
|
|
308
|
+
function y(a, u, f, d) {
|
|
310
309
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{address}/module-transactions/", {
|
|
311
|
-
path: { chainId:
|
|
310
|
+
path: { chainId: a, address: u },
|
|
312
311
|
query: f
|
|
313
312
|
}, d);
|
|
314
313
|
}
|
|
315
314
|
e.getModuleTransactions = y;
|
|
316
|
-
function M(
|
|
315
|
+
function M(a, u, f, d) {
|
|
317
316
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{address}/multisig-transactions/", {
|
|
318
|
-
path: { chainId:
|
|
317
|
+
path: { chainId: a, address: u },
|
|
319
318
|
query: f
|
|
320
319
|
}, d);
|
|
321
320
|
}
|
|
322
321
|
e.getMultisigTransactions = M;
|
|
323
|
-
function
|
|
322
|
+
function S(a, u, f = "usd", d = {}) {
|
|
324
323
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{address}/balances/{currency}", {
|
|
325
|
-
path: { chainId:
|
|
324
|
+
path: { chainId: a, address: u, currency: f },
|
|
326
325
|
query: d
|
|
327
326
|
});
|
|
328
327
|
}
|
|
329
|
-
e.getBalances =
|
|
328
|
+
e.getBalances = S;
|
|
330
329
|
function z() {
|
|
331
330
|
return (0, i.getEndpoint)(r, "/v1/balances/supported-fiat-codes");
|
|
332
331
|
}
|
|
333
332
|
e.getFiatCurrencies = z;
|
|
334
|
-
function K(
|
|
335
|
-
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/owners/{address}/safes", { path: { chainId:
|
|
333
|
+
function K(a, u) {
|
|
334
|
+
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/owners/{address}/safes", { path: { chainId: a, address: u } });
|
|
336
335
|
}
|
|
337
336
|
e.getOwnedSafes = K;
|
|
338
|
-
function P(
|
|
339
|
-
return (0, i.getEndpoint)(r, "/v1/owners/{address}/safes", { path: { address:
|
|
337
|
+
function P(a) {
|
|
338
|
+
return (0, i.getEndpoint)(r, "/v1/owners/{address}/safes", { path: { address: a } });
|
|
340
339
|
}
|
|
341
340
|
e.getAllOwnedSafes = P;
|
|
342
|
-
function X(
|
|
341
|
+
function X(a, u, f = {}) {
|
|
343
342
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{address}/collectibles", {
|
|
344
|
-
path: { chainId:
|
|
343
|
+
path: { chainId: a, address: u },
|
|
345
344
|
query: f
|
|
346
345
|
});
|
|
347
346
|
}
|
|
348
347
|
e.getCollectibles = X;
|
|
349
|
-
function ct(
|
|
350
|
-
return (0, i.getEndpoint)(r, "/v2/chains/{chainId}/safes/{address}/collectibles", { path: { chainId:
|
|
348
|
+
function ct(a, u, f = {}, d) {
|
|
349
|
+
return (0, i.getEndpoint)(r, "/v2/chains/{chainId}/safes/{address}/collectibles", { path: { chainId: a, address: u }, query: f }, d);
|
|
351
350
|
}
|
|
352
351
|
e.getCollectiblesPage = ct;
|
|
353
|
-
function ut(
|
|
354
|
-
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/transactions/history", { path: { chainId:
|
|
352
|
+
function ut(a, u, f = {}, d) {
|
|
353
|
+
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/transactions/history", { path: { chainId: a, safe_address: u }, query: f }, d);
|
|
355
354
|
}
|
|
356
355
|
e.getTransactionHistory = ut;
|
|
357
|
-
function ft(
|
|
358
|
-
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/transactions/queued", { path: { chainId:
|
|
356
|
+
function ft(a, u, f = {}, d) {
|
|
357
|
+
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/transactions/queued", { path: { chainId: a, safe_address: u }, query: f }, d);
|
|
359
358
|
}
|
|
360
359
|
e.getTransactionQueue = ft;
|
|
361
|
-
function dt(
|
|
360
|
+
function dt(a, u) {
|
|
362
361
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/transactions/{transactionId}", {
|
|
363
|
-
path: { chainId:
|
|
362
|
+
path: { chainId: a, transactionId: u }
|
|
364
363
|
});
|
|
365
364
|
}
|
|
366
365
|
e.getTransactionDetails = dt;
|
|
367
|
-
function lt(
|
|
366
|
+
function lt(a, u, f) {
|
|
368
367
|
return (0, i.deleteEndpoint)(r, "/v1/chains/{chainId}/transactions/{safeTxHash}", {
|
|
369
|
-
path: { chainId:
|
|
368
|
+
path: { chainId: a, safeTxHash: u },
|
|
370
369
|
body: { signature: f }
|
|
371
370
|
});
|
|
372
371
|
}
|
|
373
372
|
e.deleteTransaction = lt;
|
|
374
|
-
function ht(
|
|
373
|
+
function ht(a, u, f) {
|
|
375
374
|
return (0, i.postEndpoint)(r, "/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations", {
|
|
376
|
-
path: { chainId:
|
|
375
|
+
path: { chainId: a, safe_address: u },
|
|
377
376
|
body: f
|
|
378
377
|
});
|
|
379
378
|
}
|
|
380
379
|
e.postSafeGasEstimation = ht;
|
|
381
|
-
function gt(
|
|
380
|
+
function gt(a, u) {
|
|
382
381
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/nonces", {
|
|
383
|
-
path: { chainId:
|
|
382
|
+
path: { chainId: a, safe_address: u }
|
|
384
383
|
});
|
|
385
384
|
}
|
|
386
385
|
e.getNonces = gt;
|
|
387
|
-
function yt(
|
|
386
|
+
function yt(a, u, f) {
|
|
388
387
|
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/transactions/{safe_address}/propose", {
|
|
389
|
-
path: { chainId:
|
|
388
|
+
path: { chainId: a, safe_address: u },
|
|
390
389
|
body: f
|
|
391
390
|
});
|
|
392
391
|
}
|
|
393
392
|
e.proposeTransaction = yt;
|
|
394
|
-
function pt(
|
|
393
|
+
function pt(a, u, f, d) {
|
|
395
394
|
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation", {
|
|
396
|
-
path: { chainId:
|
|
395
|
+
path: { chainId: a, safe_address: u },
|
|
397
396
|
body: { data: f, to: d }
|
|
398
397
|
});
|
|
399
398
|
}
|
|
400
399
|
e.getConfirmationView = pt;
|
|
401
|
-
function bt(
|
|
400
|
+
function bt(a) {
|
|
402
401
|
return (0, i.getEndpoint)(r, "/v1/chains", {
|
|
403
|
-
query:
|
|
402
|
+
query: a
|
|
404
403
|
});
|
|
405
404
|
}
|
|
406
405
|
e.getChainsConfig = bt;
|
|
407
|
-
function mt(
|
|
406
|
+
function mt(a) {
|
|
408
407
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}", {
|
|
409
|
-
path: { chainId:
|
|
408
|
+
path: { chainId: a }
|
|
410
409
|
});
|
|
411
410
|
}
|
|
412
411
|
e.getChainConfig = mt;
|
|
413
|
-
function Et(
|
|
412
|
+
function Et(a, u = {}) {
|
|
414
413
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safe-apps", {
|
|
415
|
-
path: { chainId:
|
|
414
|
+
path: { chainId: a },
|
|
416
415
|
query: u
|
|
417
416
|
});
|
|
418
417
|
}
|
|
419
418
|
e.getSafeApps = Et;
|
|
420
|
-
function At(
|
|
419
|
+
function At(a) {
|
|
421
420
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/about/master-copies", {
|
|
422
|
-
path: { chainId:
|
|
421
|
+
path: { chainId: a }
|
|
423
422
|
});
|
|
424
423
|
}
|
|
425
424
|
e.getMasterCopies = At;
|
|
426
|
-
function Tt(
|
|
425
|
+
function Tt(a, u, f) {
|
|
427
426
|
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/data-decoder", {
|
|
428
|
-
path: { chainId:
|
|
427
|
+
path: { chainId: a },
|
|
429
428
|
body: { data: u, to: f }
|
|
430
429
|
});
|
|
431
430
|
}
|
|
432
431
|
e.getDecodedData = Tt;
|
|
433
|
-
function _t(
|
|
434
|
-
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/messages", { path: { chainId:
|
|
432
|
+
function _t(a, u, f) {
|
|
433
|
+
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/messages", { path: { chainId: a, safe_address: u }, query: {} }, f);
|
|
435
434
|
}
|
|
436
435
|
e.getSafeMessages = _t;
|
|
437
|
-
function
|
|
436
|
+
function St(a, u) {
|
|
438
437
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/messages/{message_hash}", {
|
|
439
|
-
path: { chainId:
|
|
438
|
+
path: { chainId: a, message_hash: u }
|
|
440
439
|
});
|
|
441
440
|
}
|
|
442
|
-
e.getSafeMessage =
|
|
443
|
-
function
|
|
441
|
+
e.getSafeMessage = St;
|
|
442
|
+
function It(a, u, f) {
|
|
444
443
|
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/messages", {
|
|
445
|
-
path: { chainId:
|
|
444
|
+
path: { chainId: a, safe_address: u },
|
|
446
445
|
body: f
|
|
447
446
|
});
|
|
448
447
|
}
|
|
449
|
-
e.proposeSafeMessage =
|
|
450
|
-
function
|
|
448
|
+
e.proposeSafeMessage = It;
|
|
449
|
+
function vt(a, u, f) {
|
|
451
450
|
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/messages/{message_hash}/signatures", {
|
|
452
|
-
path: { chainId:
|
|
451
|
+
path: { chainId: a, message_hash: u },
|
|
453
452
|
body: f
|
|
454
453
|
});
|
|
455
454
|
}
|
|
456
|
-
e.confirmSafeMessage =
|
|
457
|
-
function
|
|
455
|
+
e.confirmSafeMessage = vt;
|
|
456
|
+
function wt(a, u = {}) {
|
|
458
457
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/delegates", {
|
|
459
|
-
path: { chainId:
|
|
458
|
+
path: { chainId: a },
|
|
460
459
|
query: u
|
|
461
460
|
});
|
|
462
461
|
}
|
|
463
|
-
e.getDelegates =
|
|
464
|
-
function Ot(
|
|
462
|
+
e.getDelegates = wt;
|
|
463
|
+
function Ot(a) {
|
|
465
464
|
return (0, i.postEndpoint)(r, "/v1/register/notifications", {
|
|
466
|
-
body:
|
|
465
|
+
body: a
|
|
467
466
|
});
|
|
468
467
|
}
|
|
469
468
|
e.registerDevice = Ot;
|
|
470
|
-
function Nt(
|
|
469
|
+
function Nt(a, u, f) {
|
|
471
470
|
return (0, i.deleteEndpoint)(r, "/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}", {
|
|
472
|
-
path: { chainId:
|
|
471
|
+
path: { chainId: a, safe_address: u, uuid: f }
|
|
473
472
|
});
|
|
474
473
|
}
|
|
475
474
|
e.unregisterSafe = Nt;
|
|
476
|
-
function Ct(
|
|
475
|
+
function Ct(a, u) {
|
|
477
476
|
return (0, i.deleteEndpoint)(r, "/v1/chains/{chainId}/notifications/devices/{uuid}", {
|
|
478
|
-
path: { chainId:
|
|
477
|
+
path: { chainId: a, uuid: u }
|
|
479
478
|
});
|
|
480
479
|
}
|
|
481
480
|
e.unregisterDevice = Ct;
|
|
482
|
-
function Pt(
|
|
481
|
+
function Pt(a, u, f, d) {
|
|
483
482
|
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/emails", {
|
|
484
|
-
path: { chainId:
|
|
483
|
+
path: { chainId: a, safe_address: u },
|
|
485
484
|
body: f,
|
|
486
485
|
headers: d
|
|
487
486
|
});
|
|
488
487
|
}
|
|
489
488
|
e.registerEmail = Pt;
|
|
490
|
-
function Dt(
|
|
489
|
+
function Dt(a, u, f, d, w) {
|
|
491
490
|
return (0, i.putEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
|
|
492
|
-
path: { chainId:
|
|
491
|
+
path: { chainId: a, safe_address: u, signer: f },
|
|
493
492
|
body: d,
|
|
494
|
-
headers:
|
|
493
|
+
headers: w
|
|
495
494
|
});
|
|
496
495
|
}
|
|
497
496
|
e.changeEmail = Dt;
|
|
498
|
-
function Mt(
|
|
497
|
+
function Mt(a, u, f) {
|
|
499
498
|
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend", {
|
|
500
|
-
path: { chainId:
|
|
499
|
+
path: { chainId: a, safe_address: u, signer: f },
|
|
501
500
|
body: ""
|
|
502
501
|
});
|
|
503
502
|
}
|
|
504
503
|
e.resendEmailVerificationCode = Mt;
|
|
505
|
-
function Rt(
|
|
504
|
+
function Rt(a, u, f, d) {
|
|
506
505
|
return (0, i.putEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify", {
|
|
507
|
-
path: { chainId:
|
|
506
|
+
path: { chainId: a, safe_address: u, signer: f },
|
|
508
507
|
body: d
|
|
509
508
|
});
|
|
510
509
|
}
|
|
511
510
|
e.verifyEmail = Rt;
|
|
512
|
-
function $t(
|
|
511
|
+
function $t(a, u, f, d) {
|
|
513
512
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
|
|
514
|
-
path: { chainId:
|
|
513
|
+
path: { chainId: a, safe_address: u, signer: f },
|
|
515
514
|
headers: d
|
|
516
515
|
});
|
|
517
516
|
}
|
|
518
517
|
e.getRegisteredEmail = $t;
|
|
519
|
-
function Lt(
|
|
518
|
+
function Lt(a, u, f, d) {
|
|
520
519
|
return (0, i.deleteEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
|
|
521
|
-
path: { chainId:
|
|
520
|
+
path: { chainId: a, safe_address: u, signer: f },
|
|
522
521
|
headers: d
|
|
523
522
|
});
|
|
524
523
|
}
|
|
525
524
|
e.deleteRegisteredEmail = Lt;
|
|
526
|
-
function Bt(
|
|
525
|
+
function Bt(a, u, f) {
|
|
527
526
|
return (0, i.postEndpoint)(r, "/v1/chains/{chainId}/safes/{safe_address}/recovery", {
|
|
528
|
-
path: { chainId:
|
|
527
|
+
path: { chainId: a, safe_address: u },
|
|
529
528
|
body: f
|
|
530
529
|
});
|
|
531
530
|
}
|
|
532
531
|
e.registerRecoveryModule = Bt;
|
|
533
|
-
function jt(
|
|
534
|
-
return (0, i.deleteEndpoint)(r, "/v1/subscriptions", { query:
|
|
532
|
+
function jt(a) {
|
|
533
|
+
return (0, i.deleteEndpoint)(r, "/v1/subscriptions", { query: a });
|
|
535
534
|
}
|
|
536
535
|
e.unsubscribeSingle = jt;
|
|
537
|
-
function Ht(
|
|
538
|
-
return (0, i.deleteEndpoint)(r, "/v1/subscriptions/all", { query:
|
|
536
|
+
function Ht(a) {
|
|
537
|
+
return (0, i.deleteEndpoint)(r, "/v1/subscriptions/all", { query: a });
|
|
539
538
|
}
|
|
540
539
|
e.unsubscribeAll = Ht;
|
|
541
|
-
function Ut(
|
|
540
|
+
function Ut(a, u) {
|
|
542
541
|
return (0, i.getEndpoint)(r, "/v1/safes", {
|
|
543
|
-
query: Object.assign(Object.assign({}, u), { safes:
|
|
542
|
+
query: Object.assign(Object.assign({}, u), { safes: a.join(",") })
|
|
544
543
|
});
|
|
545
544
|
}
|
|
546
545
|
e.getSafeOverviews = Ut;
|
|
547
|
-
function kt(
|
|
546
|
+
function kt(a, u) {
|
|
548
547
|
return (0, i.getEndpoint)(r, "/v1/chains/{chainId}/contracts/{contractAddress}", {
|
|
549
548
|
path: {
|
|
550
|
-
chainId:
|
|
549
|
+
chainId: a,
|
|
551
550
|
contractAddress: u
|
|
552
551
|
}
|
|
553
552
|
});
|
|
@@ -557,15 +556,55 @@ Object.defineProperty($e, "__esModule", { value: !0 });
|
|
|
557
556
|
return (0, i.getEndpoint)(r, "/v1/auth/nonce", { credentials: "include" });
|
|
558
557
|
}
|
|
559
558
|
e.getAuthNonce = zt;
|
|
560
|
-
function Ft(
|
|
559
|
+
function Ft(a) {
|
|
561
560
|
return (0, i.postEndpoint)(r, "/v1/auth/verify", {
|
|
562
|
-
body:
|
|
561
|
+
body: a,
|
|
563
562
|
credentials: "include"
|
|
564
563
|
});
|
|
565
564
|
}
|
|
566
565
|
e.verifyAuth = Ft;
|
|
567
|
-
|
|
568
|
-
|
|
566
|
+
function Gt(a) {
|
|
567
|
+
return (0, i.postEndpoint)(r, "/v1/accounts", {
|
|
568
|
+
body: a,
|
|
569
|
+
credentials: "include"
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
e.createAccount = Gt;
|
|
573
|
+
function Vt(a) {
|
|
574
|
+
return (0, i.getEndpoint)(r, "/v1/accounts/{address}", {
|
|
575
|
+
path: { address: a },
|
|
576
|
+
credentials: "include"
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
e.getAccount = Vt;
|
|
580
|
+
function Wt(a) {
|
|
581
|
+
return (0, i.deleteEndpoint)(r, "/v1/accounts/{address}", {
|
|
582
|
+
path: { address: a },
|
|
583
|
+
credentials: "include"
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
e.deleteAccount = Wt;
|
|
587
|
+
function qt() {
|
|
588
|
+
return (0, i.getEndpoint)(r, "/v1/accounts/data-types");
|
|
589
|
+
}
|
|
590
|
+
e.getAccountDataTypes = qt;
|
|
591
|
+
function Kt(a) {
|
|
592
|
+
return (0, i.getEndpoint)(r, "/v1/accounts/{address}/data-settings", {
|
|
593
|
+
path: { address: a },
|
|
594
|
+
credentials: "include"
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
e.getAccountDataSettings = Kt;
|
|
598
|
+
function Xt(a, u) {
|
|
599
|
+
return (0, i.putEndpoint)(r, "/v1/accounts/{address}/data-settings", {
|
|
600
|
+
path: { address: a },
|
|
601
|
+
body: u,
|
|
602
|
+
credentials: "include"
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
e.putAccountDataSettings = Xt;
|
|
606
|
+
})(en);
|
|
607
|
+
class ln {
|
|
569
608
|
constructor(t) {
|
|
570
609
|
this.communicator = t;
|
|
571
610
|
}
|
|
@@ -581,7 +620,7 @@ class on {
|
|
|
581
620
|
return (await this.communicator.send(b.signMessage, n)).data;
|
|
582
621
|
}
|
|
583
622
|
async signTypedMessage(t) {
|
|
584
|
-
if (!
|
|
623
|
+
if (!Se(t))
|
|
585
624
|
throw new Error("Invalid typed data");
|
|
586
625
|
return (await this.communicator.send(b.signTypedMessage, { typedData: t })).data;
|
|
587
626
|
}
|
|
@@ -609,40 +648,40 @@ const m = {
|
|
|
609
648
|
eth_getTransactionCount: "eth_getTransactionCount",
|
|
610
649
|
eth_estimateGas: "eth_estimateGas",
|
|
611
650
|
safe_setSettings: "safe_setSettings"
|
|
612
|
-
},
|
|
651
|
+
}, I = {
|
|
613
652
|
defaultBlockParam: (e = "latest") => e,
|
|
614
653
|
returnFullTxObjectParam: (e = !1) => e,
|
|
615
654
|
blockNumberToHex: (e) => Number.isInteger(e) ? `0x${e.toString(16)}` : e
|
|
616
655
|
};
|
|
617
|
-
class
|
|
656
|
+
class hn {
|
|
618
657
|
constructor(t) {
|
|
619
658
|
this.communicator = t, this.call = this.buildRequest({
|
|
620
659
|
call: m.eth_call,
|
|
621
|
-
formatters: [null,
|
|
660
|
+
formatters: [null, I.defaultBlockParam]
|
|
622
661
|
}), this.getBalance = this.buildRequest({
|
|
623
662
|
call: m.eth_getBalance,
|
|
624
|
-
formatters: [null,
|
|
663
|
+
formatters: [null, I.defaultBlockParam]
|
|
625
664
|
}), this.getCode = this.buildRequest({
|
|
626
665
|
call: m.eth_getCode,
|
|
627
|
-
formatters: [null,
|
|
666
|
+
formatters: [null, I.defaultBlockParam]
|
|
628
667
|
}), this.getStorageAt = this.buildRequest({
|
|
629
668
|
call: m.eth_getStorageAt,
|
|
630
|
-
formatters: [null,
|
|
669
|
+
formatters: [null, I.blockNumberToHex, I.defaultBlockParam]
|
|
631
670
|
}), this.getPastLogs = this.buildRequest({
|
|
632
671
|
call: m.eth_getLogs
|
|
633
672
|
}), this.getBlockByHash = this.buildRequest({
|
|
634
673
|
call: m.eth_getBlockByHash,
|
|
635
|
-
formatters: [null,
|
|
674
|
+
formatters: [null, I.returnFullTxObjectParam]
|
|
636
675
|
}), this.getBlockByNumber = this.buildRequest({
|
|
637
676
|
call: m.eth_getBlockByNumber,
|
|
638
|
-
formatters: [
|
|
677
|
+
formatters: [I.blockNumberToHex, I.returnFullTxObjectParam]
|
|
639
678
|
}), this.getTransactionByHash = this.buildRequest({
|
|
640
679
|
call: m.eth_getTransactionByHash
|
|
641
680
|
}), this.getTransactionReceipt = this.buildRequest({
|
|
642
681
|
call: m.eth_getTransactionReceipt
|
|
643
682
|
}), this.getTransactionCount = this.buildRequest({
|
|
644
683
|
call: m.eth_getTransactionCount,
|
|
645
|
-
formatters: [null,
|
|
684
|
+
formatters: [null, I.defaultBlockParam]
|
|
646
685
|
}), this.getGasPrice = this.buildRequest({
|
|
647
686
|
call: m.eth_gasPrice
|
|
648
687
|
}), this.getEstimateGas = (n) => this.buildRequest({
|
|
@@ -654,8 +693,8 @@ class an {
|
|
|
654
693
|
buildRequest(t) {
|
|
655
694
|
const { call: n, formatters: i } = t;
|
|
656
695
|
return async (s) => {
|
|
657
|
-
i && Array.isArray(s) && i.forEach((
|
|
658
|
-
|
|
696
|
+
i && Array.isArray(s) && i.forEach((c, l) => {
|
|
697
|
+
c && (s[l] = c(s[l]));
|
|
659
698
|
});
|
|
660
699
|
const r = {
|
|
661
700
|
call: n,
|
|
@@ -665,7 +704,7 @@ class an {
|
|
|
665
704
|
};
|
|
666
705
|
}
|
|
667
706
|
}
|
|
668
|
-
function
|
|
707
|
+
function gn(e, t) {
|
|
669
708
|
const n = e.exec(t);
|
|
670
709
|
return n == null ? void 0 : n.groups;
|
|
671
710
|
}
|
|
@@ -679,7 +718,7 @@ function Z(e) {
|
|
|
679
718
|
const r = e.components[s];
|
|
680
719
|
t += Z(r), s < n - 1 && (t += ", ");
|
|
681
720
|
}
|
|
682
|
-
const i =
|
|
721
|
+
const i = gn(fe, e.type);
|
|
683
722
|
return t += `)${(i == null ? void 0 : i.array) ?? ""}`, Z({
|
|
684
723
|
...e,
|
|
685
724
|
type: t
|
|
@@ -696,18 +735,18 @@ function L(e) {
|
|
|
696
735
|
}
|
|
697
736
|
return t;
|
|
698
737
|
}
|
|
699
|
-
function
|
|
738
|
+
function yn(e) {
|
|
700
739
|
return e.type === "function" ? `function ${e.name}(${L(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${e.outputs.length ? ` returns (${L(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${L(e.inputs)})` : e.type === "error" ? `error ${e.name}(${L(e.inputs)})` : e.type === "constructor" ? `constructor(${L(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? "fallback()" : "receive() external payable";
|
|
701
740
|
}
|
|
702
741
|
function x(e, { includeName: t = !1 } = {}) {
|
|
703
742
|
if (e.type !== "function" && e.type !== "event" && e.type !== "error")
|
|
704
|
-
throw new
|
|
743
|
+
throw new wn(e.type);
|
|
705
744
|
return `${e.name}(${Le(e.inputs, { includeName: t })})`;
|
|
706
745
|
}
|
|
707
746
|
function Le(e, { includeName: t = !1 } = {}) {
|
|
708
|
-
return e ? e.map((n) =>
|
|
747
|
+
return e ? e.map((n) => pn(n, { includeName: t })).join(t ? ", " : ",") : "";
|
|
709
748
|
}
|
|
710
|
-
function
|
|
749
|
+
function pn(e, { includeName: t }) {
|
|
711
750
|
return e.type.startsWith("tuple") ? `(${Le(e.components, { includeName: t })})${e.type.slice(5)}` : e.type + (t && e.name ? ` ${e.name}` : "");
|
|
712
751
|
}
|
|
713
752
|
function U(e, { strict: t = !0 } = {}) {
|
|
@@ -716,11 +755,22 @@ function U(e, { strict: t = !0 } = {}) {
|
|
|
716
755
|
function E(e) {
|
|
717
756
|
return U(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
718
757
|
}
|
|
719
|
-
const
|
|
758
|
+
const bn = "2.18.5", mn = () => `viem@${bn}`;
|
|
720
759
|
class p extends Error {
|
|
721
760
|
constructor(t, n = {}) {
|
|
722
|
-
var
|
|
723
|
-
|
|
761
|
+
var c;
|
|
762
|
+
const i = n.cause instanceof p ? n.cause.details : (c = n.cause) != null && c.message ? n.cause.message : n.details, s = n.cause instanceof p && n.cause.docsPath || n.docsPath, r = mn(), o = [
|
|
763
|
+
t || "An error occurred.",
|
|
764
|
+
"",
|
|
765
|
+
...n.metaMessages ? [...n.metaMessages, ""] : [],
|
|
766
|
+
...s ? [
|
|
767
|
+
`Docs: ${n.docsBaseUrl ?? "https://viem.sh"}${s}${n.docsSlug ? `#${n.docsSlug}` : ""}`
|
|
768
|
+
] : [],
|
|
769
|
+
...i ? [`Details: ${i}`] : [],
|
|
770
|
+
`Version: ${r}`
|
|
771
|
+
].join(`
|
|
772
|
+
`);
|
|
773
|
+
super(o, n.cause ? { cause: n.cause } : void 0), Object.defineProperty(this, "details", {
|
|
724
774
|
enumerable: !0,
|
|
725
775
|
configurable: !0,
|
|
726
776
|
writable: !0,
|
|
@@ -740,29 +790,17 @@ class p extends Error {
|
|
|
740
790
|
configurable: !0,
|
|
741
791
|
writable: !0,
|
|
742
792
|
value: void 0
|
|
743
|
-
}), Object.defineProperty(this, "
|
|
793
|
+
}), Object.defineProperty(this, "version", {
|
|
744
794
|
enumerable: !0,
|
|
745
795
|
configurable: !0,
|
|
746
796
|
writable: !0,
|
|
747
|
-
value:
|
|
748
|
-
}), Object.defineProperty(this, "
|
|
797
|
+
value: void 0
|
|
798
|
+
}), Object.defineProperty(this, "name", {
|
|
749
799
|
enumerable: !0,
|
|
750
800
|
configurable: !0,
|
|
751
801
|
writable: !0,
|
|
752
|
-
value:
|
|
753
|
-
});
|
|
754
|
-
const i = n.cause instanceof p ? n.cause.details : (r = n.cause) != null && r.message ? n.cause.message : n.details, s = n.cause instanceof p && n.cause.docsPath || n.docsPath;
|
|
755
|
-
this.message = [
|
|
756
|
-
t || "An error occurred.",
|
|
757
|
-
"",
|
|
758
|
-
...n.metaMessages ? [...n.metaMessages, ""] : [],
|
|
759
|
-
...s ? [
|
|
760
|
-
`Docs: ${n.docsBaseUrl ?? "https://viem.sh"}${s}${n.docsSlug ? `#${n.docsSlug}` : ""}`
|
|
761
|
-
] : [],
|
|
762
|
-
...i ? [`Details: ${i}`] : [],
|
|
763
|
-
`Version: ${this.version}`
|
|
764
|
-
].join(`
|
|
765
|
-
`), n.cause && (this.cause = n.cause), this.details = i, this.docsPath = s, this.metaMessages = n.metaMessages, this.shortMessage = t;
|
|
802
|
+
value: "ViemError"
|
|
803
|
+
}), this.details = i, this.docsPath = s, this.metaMessages = n.metaMessages, this.shortMessage = t, this.version = r;
|
|
766
804
|
}
|
|
767
805
|
walk(t) {
|
|
768
806
|
return Be(this, t);
|
|
@@ -771,7 +809,7 @@ class p extends Error {
|
|
|
771
809
|
function Be(e, t) {
|
|
772
810
|
return t != null && t(e) ? e : e && typeof e == "object" && "cause" in e ? Be(e.cause, t) : t ? null : e;
|
|
773
811
|
}
|
|
774
|
-
class
|
|
812
|
+
class En extends p {
|
|
775
813
|
constructor({ expectedLength: t, givenLength: n, type: i }) {
|
|
776
814
|
super([
|
|
777
815
|
`ABI encoding array length mismatch for type ${i}.`,
|
|
@@ -786,7 +824,7 @@ class hn extends p {
|
|
|
786
824
|
});
|
|
787
825
|
}
|
|
788
826
|
}
|
|
789
|
-
class
|
|
827
|
+
class An extends p {
|
|
790
828
|
constructor({ expectedSize: t, value: n }) {
|
|
791
829
|
super(`Size of bytes "${n}" (bytes${E(n)}) does not match expected size (bytes${t}).`), Object.defineProperty(this, "name", {
|
|
792
830
|
enumerable: !0,
|
|
@@ -796,7 +834,7 @@ class gn extends p {
|
|
|
796
834
|
});
|
|
797
835
|
}
|
|
798
836
|
}
|
|
799
|
-
class
|
|
837
|
+
class Tn extends p {
|
|
800
838
|
constructor({ expectedLength: t, givenLength: n }) {
|
|
801
839
|
super([
|
|
802
840
|
"ABI encoding params/values length mismatch.",
|
|
@@ -827,7 +865,7 @@ class de extends p {
|
|
|
827
865
|
});
|
|
828
866
|
}
|
|
829
867
|
}
|
|
830
|
-
class
|
|
868
|
+
class _n extends p {
|
|
831
869
|
constructor(t, n) {
|
|
832
870
|
super("Found ambiguous types in overloaded ABI items.", {
|
|
833
871
|
metaMessages: [
|
|
@@ -845,7 +883,7 @@ class pn extends p {
|
|
|
845
883
|
});
|
|
846
884
|
}
|
|
847
885
|
}
|
|
848
|
-
class
|
|
886
|
+
class Sn extends p {
|
|
849
887
|
constructor({ expectedSize: t, givenSize: n }) {
|
|
850
888
|
super(`Expected bytes${t}, got bytes${n}.`), Object.defineProperty(this, "name", {
|
|
851
889
|
enumerable: !0,
|
|
@@ -855,7 +893,7 @@ class bn extends p {
|
|
|
855
893
|
});
|
|
856
894
|
}
|
|
857
895
|
}
|
|
858
|
-
class
|
|
896
|
+
class In extends p {
|
|
859
897
|
constructor(t, { docsPath: n }) {
|
|
860
898
|
super([
|
|
861
899
|
`Type "${t}" is not a valid encoding type.`,
|
|
@@ -869,7 +907,7 @@ class mn extends p {
|
|
|
869
907
|
});
|
|
870
908
|
}
|
|
871
909
|
}
|
|
872
|
-
class
|
|
910
|
+
class vn extends p {
|
|
873
911
|
constructor(t) {
|
|
874
912
|
super([`Value "${t}" is not a valid array.`].join(`
|
|
875
913
|
`)), Object.defineProperty(this, "name", {
|
|
@@ -880,7 +918,7 @@ class En extends p {
|
|
|
880
918
|
});
|
|
881
919
|
}
|
|
882
920
|
}
|
|
883
|
-
class
|
|
921
|
+
class wn extends p {
|
|
884
922
|
constructor(t) {
|
|
885
923
|
super([
|
|
886
924
|
`"${t}" is not a valid definition type.`,
|
|
@@ -915,7 +953,7 @@ class He extends p {
|
|
|
915
953
|
}
|
|
916
954
|
}
|
|
917
955
|
function $(e, { dir: t, size: n = 32 } = {}) {
|
|
918
|
-
return typeof e == "string" ? O(e, { dir: t, size: n }) :
|
|
956
|
+
return typeof e == "string" ? O(e, { dir: t, size: n }) : On(e, { dir: t, size: n });
|
|
919
957
|
}
|
|
920
958
|
function O(e, { dir: t, size: n = 32 } = {}) {
|
|
921
959
|
if (n === null)
|
|
@@ -929,7 +967,7 @@ function O(e, { dir: t, size: n = 32 } = {}) {
|
|
|
929
967
|
});
|
|
930
968
|
return `0x${i[t === "right" ? "padEnd" : "padStart"](n * 2, "0")}`;
|
|
931
969
|
}
|
|
932
|
-
function
|
|
970
|
+
function On(e, { dir: t, size: n = 32 } = {}) {
|
|
933
971
|
if (n === null)
|
|
934
972
|
return e;
|
|
935
973
|
if (e.length > n)
|
|
@@ -945,7 +983,7 @@ function Tn(e, { dir: t, size: n = 32 } = {}) {
|
|
|
945
983
|
}
|
|
946
984
|
return i;
|
|
947
985
|
}
|
|
948
|
-
class
|
|
986
|
+
class Nn extends p {
|
|
949
987
|
constructor({ max: t, min: n, signed: i, size: s, value: r }) {
|
|
950
988
|
super(`Number "${r}" is not in safe ${s ? `${s * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${n} to ${t})` : `(above ${n})`}`), Object.defineProperty(this, "name", {
|
|
951
989
|
enumerable: !0,
|
|
@@ -955,7 +993,7 @@ class _n extends p {
|
|
|
955
993
|
});
|
|
956
994
|
}
|
|
957
995
|
}
|
|
958
|
-
class
|
|
996
|
+
class Cn extends p {
|
|
959
997
|
constructor({ givenSize: t, maxSize: n }) {
|
|
960
998
|
super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`), Object.defineProperty(this, "name", {
|
|
961
999
|
enumerable: !0,
|
|
@@ -967,12 +1005,12 @@ class In extends p {
|
|
|
967
1005
|
}
|
|
968
1006
|
function k(e, { size: t }) {
|
|
969
1007
|
if (E(e) > t)
|
|
970
|
-
throw new
|
|
1008
|
+
throw new Cn({
|
|
971
1009
|
givenSize: E(e),
|
|
972
1010
|
maxSize: t
|
|
973
1011
|
});
|
|
974
1012
|
}
|
|
975
|
-
const
|
|
1013
|
+
const Pn = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
|
|
976
1014
|
function ie(e, t = {}) {
|
|
977
1015
|
return typeof e == "number" || typeof e == "bigint" ? C(e, t) : typeof e == "string" ? G(e, t) : typeof e == "boolean" ? Ue(e, t) : se(e, t);
|
|
978
1016
|
}
|
|
@@ -983,7 +1021,7 @@ function Ue(e, t = {}) {
|
|
|
983
1021
|
function se(e, t = {}) {
|
|
984
1022
|
let n = "";
|
|
985
1023
|
for (let s = 0; s < e.length; s++)
|
|
986
|
-
n +=
|
|
1024
|
+
n += Pn[e[s]];
|
|
987
1025
|
const i = `0x${n}`;
|
|
988
1026
|
return typeof t.size == "number" ? (k(i, { size: t.size }), $(i, { dir: "right", size: t.size })) : i;
|
|
989
1027
|
}
|
|
@@ -994,7 +1032,7 @@ function C(e, t = {}) {
|
|
|
994
1032
|
const o = typeof r == "bigint" && n ? -r - 1n : 0;
|
|
995
1033
|
if (r && s > r || s < o) {
|
|
996
1034
|
const l = typeof e == "bigint" ? "n" : "";
|
|
997
|
-
throw new
|
|
1035
|
+
throw new Nn({
|
|
998
1036
|
max: r ? `${r}${l}` : void 0,
|
|
999
1037
|
min: `${o}${l}`,
|
|
1000
1038
|
signed: n,
|
|
@@ -1002,23 +1040,23 @@ function C(e, t = {}) {
|
|
|
1002
1040
|
value: `${e}${l}`
|
|
1003
1041
|
});
|
|
1004
1042
|
}
|
|
1005
|
-
const
|
|
1006
|
-
return i ? $(
|
|
1043
|
+
const c = `0x${(n && s < 0 ? (1n << BigInt(i * 8)) + BigInt(s) : s).toString(16)}`;
|
|
1044
|
+
return i ? $(c, { size: i }) : c;
|
|
1007
1045
|
}
|
|
1008
|
-
const
|
|
1046
|
+
const Dn = /* @__PURE__ */ new TextEncoder();
|
|
1009
1047
|
function G(e, t = {}) {
|
|
1010
|
-
const n =
|
|
1048
|
+
const n = Dn.encode(e);
|
|
1011
1049
|
return se(n, t);
|
|
1012
1050
|
}
|
|
1013
|
-
const
|
|
1051
|
+
const Mn = /* @__PURE__ */ new TextEncoder();
|
|
1014
1052
|
function ke(e, t = {}) {
|
|
1015
|
-
return typeof e == "number" || typeof e == "bigint" ?
|
|
1053
|
+
return typeof e == "number" || typeof e == "bigint" ? $n(e, t) : typeof e == "boolean" ? Rn(e, t) : U(e) ? ze(e, t) : Fe(e, t);
|
|
1016
1054
|
}
|
|
1017
|
-
function
|
|
1055
|
+
function Rn(e, t = {}) {
|
|
1018
1056
|
const n = new Uint8Array(1);
|
|
1019
1057
|
return n[0] = Number(e), typeof t.size == "number" ? (k(n, { size: t.size }), $(n, { size: t.size })) : n;
|
|
1020
1058
|
}
|
|
1021
|
-
const
|
|
1059
|
+
const v = {
|
|
1022
1060
|
zero: 48,
|
|
1023
1061
|
nine: 57,
|
|
1024
1062
|
A: 65,
|
|
@@ -1027,12 +1065,12 @@ const w = {
|
|
|
1027
1065
|
f: 102
|
|
1028
1066
|
};
|
|
1029
1067
|
function le(e) {
|
|
1030
|
-
if (e >=
|
|
1031
|
-
return e -
|
|
1032
|
-
if (e >=
|
|
1033
|
-
return e - (
|
|
1034
|
-
if (e >=
|
|
1035
|
-
return e - (
|
|
1068
|
+
if (e >= v.zero && e <= v.nine)
|
|
1069
|
+
return e - v.zero;
|
|
1070
|
+
if (e >= v.A && e <= v.F)
|
|
1071
|
+
return e - (v.A - 10);
|
|
1072
|
+
if (e >= v.a && e <= v.f)
|
|
1073
|
+
return e - (v.a - 10);
|
|
1036
1074
|
}
|
|
1037
1075
|
function ze(e, t = {}) {
|
|
1038
1076
|
let n = e;
|
|
@@ -1040,31 +1078,31 @@ function ze(e, t = {}) {
|
|
|
1040
1078
|
let i = n.slice(2);
|
|
1041
1079
|
i.length % 2 && (i = `0${i}`);
|
|
1042
1080
|
const s = i.length / 2, r = new Uint8Array(s);
|
|
1043
|
-
for (let o = 0,
|
|
1044
|
-
const l = le(i.charCodeAt(
|
|
1081
|
+
for (let o = 0, c = 0; o < s; o++) {
|
|
1082
|
+
const l = le(i.charCodeAt(c++)), g = le(i.charCodeAt(c++));
|
|
1045
1083
|
if (l === void 0 || g === void 0)
|
|
1046
|
-
throw new p(`Invalid byte sequence ("${i[
|
|
1084
|
+
throw new p(`Invalid byte sequence ("${i[c - 2]}${i[c - 1]}" in "${i}").`);
|
|
1047
1085
|
r[o] = l * 16 + g;
|
|
1048
1086
|
}
|
|
1049
1087
|
return r;
|
|
1050
1088
|
}
|
|
1051
|
-
function
|
|
1089
|
+
function $n(e, t) {
|
|
1052
1090
|
const n = C(e, t);
|
|
1053
1091
|
return ze(n);
|
|
1054
1092
|
}
|
|
1055
1093
|
function Fe(e, t = {}) {
|
|
1056
|
-
const n =
|
|
1094
|
+
const n = Mn.encode(e);
|
|
1057
1095
|
return typeof t.size == "number" ? (k(n, { size: t.size }), $(n, { dir: "right", size: t.size })) : n;
|
|
1058
1096
|
}
|
|
1059
1097
|
function he(e) {
|
|
1060
1098
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
1061
1099
|
throw new Error(`positive integer expected, not ${e}`);
|
|
1062
1100
|
}
|
|
1063
|
-
function
|
|
1101
|
+
function Ln(e) {
|
|
1064
1102
|
return e instanceof Uint8Array || e != null && typeof e == "object" && e.constructor.name === "Uint8Array";
|
|
1065
1103
|
}
|
|
1066
1104
|
function re(e, ...t) {
|
|
1067
|
-
if (!
|
|
1105
|
+
if (!Ln(e))
|
|
1068
1106
|
throw new Error("Uint8Array expected");
|
|
1069
1107
|
if (t.length > 0 && !t.includes(e.length))
|
|
1070
1108
|
throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`);
|
|
@@ -1075,92 +1113,92 @@ function ge(e, t = !0) {
|
|
|
1075
1113
|
if (t && e.finished)
|
|
1076
1114
|
throw new Error("Hash#digest() has already been called");
|
|
1077
1115
|
}
|
|
1078
|
-
function
|
|
1116
|
+
function Bn(e, t) {
|
|
1079
1117
|
re(e);
|
|
1080
1118
|
const n = t.outputLen;
|
|
1081
1119
|
if (e.length < n)
|
|
1082
1120
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1083
1121
|
}
|
|
1084
1122
|
const F = /* @__PURE__ */ BigInt(2 ** 32 - 1), ye = /* @__PURE__ */ BigInt(32);
|
|
1085
|
-
function
|
|
1123
|
+
function jn(e, t = !1) {
|
|
1086
1124
|
return t ? { h: Number(e & F), l: Number(e >> ye & F) } : { h: Number(e >> ye & F) | 0, l: Number(e & F) | 0 };
|
|
1087
1125
|
}
|
|
1088
|
-
function
|
|
1126
|
+
function Hn(e, t = !1) {
|
|
1089
1127
|
let n = new Uint32Array(e.length), i = new Uint32Array(e.length);
|
|
1090
1128
|
for (let s = 0; s < e.length; s++) {
|
|
1091
|
-
const { h: r, l: o } =
|
|
1129
|
+
const { h: r, l: o } = jn(e[s], t);
|
|
1092
1130
|
[n[s], i[s]] = [r, o];
|
|
1093
1131
|
}
|
|
1094
1132
|
return [n, i];
|
|
1095
1133
|
}
|
|
1096
|
-
const
|
|
1134
|
+
const Un = (e, t, n) => e << n | t >>> 32 - n, kn = (e, t, n) => t << n | e >>> 32 - n, zn = (e, t, n) => t << n - 32 | e >>> 64 - n, Fn = (e, t, n) => e << n - 32 | t >>> 64 - n;
|
|
1097
1135
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1098
|
-
const
|
|
1136
|
+
const Gn = (e) => new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)), pe = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, Vn = (e) => e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
1099
1137
|
function be(e) {
|
|
1100
1138
|
for (let t = 0; t < e.length; t++)
|
|
1101
|
-
e[t] =
|
|
1139
|
+
e[t] = Vn(e[t]);
|
|
1102
1140
|
}
|
|
1103
|
-
function
|
|
1141
|
+
function Wn(e) {
|
|
1104
1142
|
if (typeof e != "string")
|
|
1105
1143
|
throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
|
|
1106
1144
|
return new Uint8Array(new TextEncoder().encode(e));
|
|
1107
1145
|
}
|
|
1108
1146
|
function Ge(e) {
|
|
1109
|
-
return typeof e == "string" && (e =
|
|
1147
|
+
return typeof e == "string" && (e = Wn(e)), re(e), e;
|
|
1110
1148
|
}
|
|
1111
|
-
class
|
|
1149
|
+
class qn {
|
|
1112
1150
|
// Safe version that clones internal state
|
|
1113
1151
|
clone() {
|
|
1114
1152
|
return this._cloneInto();
|
|
1115
1153
|
}
|
|
1116
1154
|
}
|
|
1117
|
-
function
|
|
1155
|
+
function Kn(e) {
|
|
1118
1156
|
const t = (i) => e().update(Ge(i)).digest(), n = e();
|
|
1119
1157
|
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
|
|
1120
1158
|
}
|
|
1121
|
-
const Ve = [], We = [], qe = [],
|
|
1159
|
+
const Ve = [], We = [], qe = [], Xn = /* @__PURE__ */ BigInt(0), B = /* @__PURE__ */ BigInt(1), Qn = /* @__PURE__ */ BigInt(2), Yn = /* @__PURE__ */ BigInt(7), Jn = /* @__PURE__ */ BigInt(256), Zn = /* @__PURE__ */ BigInt(113);
|
|
1122
1160
|
for (let e = 0, t = B, n = 1, i = 0; e < 24; e++) {
|
|
1123
1161
|
[n, i] = [i, (2 * n + 3 * i) % 5], Ve.push(2 * (5 * i + n)), We.push((e + 1) * (e + 2) / 2 % 64);
|
|
1124
|
-
let s =
|
|
1162
|
+
let s = Xn;
|
|
1125
1163
|
for (let r = 0; r < 7; r++)
|
|
1126
|
-
t = (t << B ^ (t >>
|
|
1164
|
+
t = (t << B ^ (t >> Yn) * Zn) % Jn, t & Qn && (s ^= B << (B << /* @__PURE__ */ BigInt(r)) - B);
|
|
1127
1165
|
qe.push(s);
|
|
1128
1166
|
}
|
|
1129
|
-
const [
|
|
1130
|
-
function
|
|
1167
|
+
const [xn, ei] = /* @__PURE__ */ Hn(qe, !0), me = (e, t, n) => n > 32 ? zn(e, t, n) : Un(e, t, n), Ee = (e, t, n) => n > 32 ? Fn(e, t, n) : kn(e, t, n);
|
|
1168
|
+
function ti(e, t = 24) {
|
|
1131
1169
|
const n = new Uint32Array(10);
|
|
1132
1170
|
for (let i = 24 - t; i < 24; i++) {
|
|
1133
1171
|
for (let o = 0; o < 10; o++)
|
|
1134
1172
|
n[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
|
|
1135
1173
|
for (let o = 0; o < 10; o += 2) {
|
|
1136
|
-
const
|
|
1137
|
-
for (let
|
|
1138
|
-
e[o +
|
|
1174
|
+
const c = (o + 8) % 10, l = (o + 2) % 10, g = n[l], h = n[l + 1], y = me(g, h, 1) ^ n[c], M = Ee(g, h, 1) ^ n[c + 1];
|
|
1175
|
+
for (let S = 0; S < 50; S += 10)
|
|
1176
|
+
e[o + S] ^= y, e[o + S + 1] ^= M;
|
|
1139
1177
|
}
|
|
1140
1178
|
let s = e[2], r = e[3];
|
|
1141
1179
|
for (let o = 0; o < 24; o++) {
|
|
1142
|
-
const
|
|
1180
|
+
const c = We[o], l = me(s, r, c), g = Ee(s, r, c), h = Ve[o];
|
|
1143
1181
|
s = e[h], r = e[h + 1], e[h] = l, e[h + 1] = g;
|
|
1144
1182
|
}
|
|
1145
1183
|
for (let o = 0; o < 50; o += 10) {
|
|
1146
|
-
for (let
|
|
1147
|
-
n[
|
|
1148
|
-
for (let
|
|
1149
|
-
e[o +
|
|
1184
|
+
for (let c = 0; c < 10; c++)
|
|
1185
|
+
n[c] = e[o + c];
|
|
1186
|
+
for (let c = 0; c < 10; c++)
|
|
1187
|
+
e[o + c] ^= ~n[(c + 2) % 10] & n[(c + 4) % 10];
|
|
1150
1188
|
}
|
|
1151
|
-
e[0] ^=
|
|
1189
|
+
e[0] ^= xn[i], e[1] ^= ei[i];
|
|
1152
1190
|
}
|
|
1153
1191
|
n.fill(0);
|
|
1154
1192
|
}
|
|
1155
|
-
class oe extends
|
|
1193
|
+
class oe extends qn {
|
|
1156
1194
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1157
1195
|
constructor(t, n, i, s = !1, r = 24) {
|
|
1158
1196
|
if (super(), this.blockLen = t, this.suffix = n, this.outputLen = i, this.enableXOF = s, this.rounds = r, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, he(i), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1159
1197
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1160
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
1198
|
+
this.state = new Uint8Array(200), this.state32 = Gn(this.state);
|
|
1161
1199
|
}
|
|
1162
1200
|
keccak() {
|
|
1163
|
-
pe || be(this.state32),
|
|
1201
|
+
pe || be(this.state32), ti(this.state32, this.rounds), pe || be(this.state32), this.posOut = 0, this.pos = 0;
|
|
1164
1202
|
}
|
|
1165
1203
|
update(t) {
|
|
1166
1204
|
ge(this);
|
|
@@ -1169,7 +1207,7 @@ class oe extends kn {
|
|
|
1169
1207
|
const s = t.length;
|
|
1170
1208
|
for (let r = 0; r < s; ) {
|
|
1171
1209
|
const o = Math.min(n - this.pos, s - r);
|
|
1172
|
-
for (let
|
|
1210
|
+
for (let c = 0; c < o; c++)
|
|
1173
1211
|
i[this.pos++] ^= t[r++];
|
|
1174
1212
|
this.pos === n && this.keccak();
|
|
1175
1213
|
}
|
|
@@ -1201,7 +1239,7 @@ class oe extends kn {
|
|
|
1201
1239
|
return he(t), this.xofInto(new Uint8Array(t));
|
|
1202
1240
|
}
|
|
1203
1241
|
digestInto(t) {
|
|
1204
|
-
if (
|
|
1242
|
+
if (Bn(t, this), this.finished)
|
|
1205
1243
|
throw new Error("digest() was already called");
|
|
1206
1244
|
return this.writeInto(t), this.destroy(), t;
|
|
1207
1245
|
}
|
|
@@ -1216,48 +1254,48 @@ class oe extends kn {
|
|
|
1216
1254
|
return t || (t = new oe(n, i, s, o, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = i, t.outputLen = s, t.enableXOF = o, t.destroyed = this.destroyed, t;
|
|
1217
1255
|
}
|
|
1218
1256
|
}
|
|
1219
|
-
const
|
|
1257
|
+
const ni = (e, t, n) => Kn(() => new oe(t, e, n)), ii = /* @__PURE__ */ ni(1, 136, 256 / 8);
|
|
1220
1258
|
function _(e, t) {
|
|
1221
|
-
const n = t || "hex", i =
|
|
1259
|
+
const n = t || "hex", i = ii(U(e, { strict: !1 }) ? ke(e) : e);
|
|
1222
1260
|
return n === "bytes" ? i : ie(i);
|
|
1223
1261
|
}
|
|
1224
|
-
const
|
|
1225
|
-
function
|
|
1226
|
-
return
|
|
1262
|
+
const si = (e) => _(ke(e));
|
|
1263
|
+
function ri(e) {
|
|
1264
|
+
return si(e);
|
|
1227
1265
|
}
|
|
1228
|
-
function
|
|
1266
|
+
function oi(e) {
|
|
1229
1267
|
let t = !0, n = "", i = 0, s = "", r = !1;
|
|
1230
1268
|
for (let o = 0; o < e.length; o++) {
|
|
1231
|
-
const
|
|
1232
|
-
if (["(", ")", ","].includes(
|
|
1269
|
+
const c = e[o];
|
|
1270
|
+
if (["(", ")", ","].includes(c) && (t = !0), c === "(" && i++, c === ")" && i--, !!t) {
|
|
1233
1271
|
if (i === 0) {
|
|
1234
|
-
if (
|
|
1272
|
+
if (c === " " && ["event", "function", ""].includes(s))
|
|
1235
1273
|
s = "";
|
|
1236
|
-
else if (s +=
|
|
1274
|
+
else if (s += c, c === ")") {
|
|
1237
1275
|
r = !0;
|
|
1238
1276
|
break;
|
|
1239
1277
|
}
|
|
1240
1278
|
continue;
|
|
1241
1279
|
}
|
|
1242
|
-
if (
|
|
1280
|
+
if (c === " ") {
|
|
1243
1281
|
e[o - 1] !== "," && n !== "," && n !== ",(" && (n = "", t = !1);
|
|
1244
1282
|
continue;
|
|
1245
1283
|
}
|
|
1246
|
-
s +=
|
|
1284
|
+
s += c, n += c;
|
|
1247
1285
|
}
|
|
1248
1286
|
}
|
|
1249
1287
|
if (!r)
|
|
1250
1288
|
throw new p("Unable to normalize signature.");
|
|
1251
1289
|
return s;
|
|
1252
1290
|
}
|
|
1253
|
-
const
|
|
1254
|
-
const t = typeof e == "string" ? e :
|
|
1255
|
-
return
|
|
1291
|
+
const ai = (e) => {
|
|
1292
|
+
const t = typeof e == "string" ? e : yn(e);
|
|
1293
|
+
return oi(t);
|
|
1256
1294
|
};
|
|
1257
1295
|
function Ke(e) {
|
|
1258
|
-
return
|
|
1296
|
+
return ri(ai(e));
|
|
1259
1297
|
}
|
|
1260
|
-
const
|
|
1298
|
+
const ci = Ke;
|
|
1261
1299
|
class Xe extends p {
|
|
1262
1300
|
constructor({ address: t }) {
|
|
1263
1301
|
super(`Address "${t}" is invalid.`, {
|
|
@@ -1287,7 +1325,7 @@ class Qe extends Map {
|
|
|
1287
1325
|
}
|
|
1288
1326
|
}
|
|
1289
1327
|
const Q = /* @__PURE__ */ new Qe(8192);
|
|
1290
|
-
function
|
|
1328
|
+
function ui(e, t) {
|
|
1291
1329
|
if (Q.has(`${e}.${t}`))
|
|
1292
1330
|
return Q.get(`${e}.${t}`);
|
|
1293
1331
|
const n = e.substring(2).toLowerCase(), i = _(Fe(n), "bytes"), s = n.split("");
|
|
@@ -1296,18 +1334,18 @@ function ii(e, t) {
|
|
|
1296
1334
|
const r = `0x${s.join("")}`;
|
|
1297
1335
|
return Q.set(`${e}.${t}`, r), r;
|
|
1298
1336
|
}
|
|
1299
|
-
const
|
|
1337
|
+
const fi = /^0x[a-fA-F0-9]{40}$/, Y = /* @__PURE__ */ new Qe(8192);
|
|
1300
1338
|
function j(e, t) {
|
|
1301
1339
|
const { strict: n = !0 } = t ?? {}, i = `${e}.${n}`;
|
|
1302
1340
|
if (Y.has(i))
|
|
1303
1341
|
return Y.get(i);
|
|
1304
|
-
const s =
|
|
1342
|
+
const s = fi.test(e) ? e.toLowerCase() === e ? !0 : n ? ui(e) === e : !0 : !1;
|
|
1305
1343
|
return Y.set(i, s), s;
|
|
1306
1344
|
}
|
|
1307
1345
|
function N(e) {
|
|
1308
|
-
return typeof e[0] == "string" ? Ye(e) :
|
|
1346
|
+
return typeof e[0] == "string" ? Ye(e) : di(e);
|
|
1309
1347
|
}
|
|
1310
|
-
function
|
|
1348
|
+
function di(e) {
|
|
1311
1349
|
let t = 0;
|
|
1312
1350
|
for (const s of e)
|
|
1313
1351
|
t += s.length;
|
|
@@ -1321,9 +1359,9 @@ function Ye(e) {
|
|
|
1321
1359
|
return `0x${e.reduce((t, n) => t + n.replace("0x", ""), "")}`;
|
|
1322
1360
|
}
|
|
1323
1361
|
function Je(e, t, n, { strict: i } = {}) {
|
|
1324
|
-
return U(e, { strict: !1 }) ?
|
|
1362
|
+
return U(e, { strict: !1 }) ? hi(e, t, n, {
|
|
1325
1363
|
strict: i
|
|
1326
|
-
}) :
|
|
1364
|
+
}) : li(e, t, n, {
|
|
1327
1365
|
strict: i
|
|
1328
1366
|
});
|
|
1329
1367
|
}
|
|
@@ -1343,85 +1381,85 @@ function xe(e, t, n) {
|
|
|
1343
1381
|
size: E(e)
|
|
1344
1382
|
});
|
|
1345
1383
|
}
|
|
1346
|
-
function
|
|
1384
|
+
function li(e, t, n, { strict: i } = {}) {
|
|
1347
1385
|
Ze(e, t);
|
|
1348
1386
|
const s = e.slice(t, n);
|
|
1349
1387
|
return i && xe(s, t, n), s;
|
|
1350
1388
|
}
|
|
1351
|
-
function
|
|
1389
|
+
function hi(e, t, n, { strict: i } = {}) {
|
|
1352
1390
|
Ze(e, t);
|
|
1353
1391
|
const s = `0x${e.replace("0x", "").slice((t ?? 0) * 2, (n ?? e.length) * 2)}`;
|
|
1354
1392
|
return i && xe(s, t, n), s;
|
|
1355
1393
|
}
|
|
1356
1394
|
function ae(e, t) {
|
|
1357
1395
|
if (e.length !== t.length)
|
|
1358
|
-
throw new
|
|
1396
|
+
throw new Tn({
|
|
1359
1397
|
expectedLength: e.length,
|
|
1360
1398
|
givenLength: t.length
|
|
1361
1399
|
});
|
|
1362
|
-
const n =
|
|
1400
|
+
const n = gi({
|
|
1363
1401
|
params: e,
|
|
1364
1402
|
values: t
|
|
1365
1403
|
}), i = ue(n);
|
|
1366
1404
|
return i.length === 0 ? "0x" : i;
|
|
1367
1405
|
}
|
|
1368
|
-
function
|
|
1406
|
+
function gi({ params: e, values: t }) {
|
|
1369
1407
|
const n = [];
|
|
1370
1408
|
for (let i = 0; i < e.length; i++)
|
|
1371
1409
|
n.push(ce({ param: e[i], value: t[i] }));
|
|
1372
1410
|
return n;
|
|
1373
1411
|
}
|
|
1374
1412
|
function ce({ param: e, value: t }) {
|
|
1375
|
-
const n =
|
|
1413
|
+
const n = _i(e.type);
|
|
1376
1414
|
if (n) {
|
|
1377
1415
|
const [i, s] = n;
|
|
1378
|
-
return
|
|
1416
|
+
return pi(t, { length: i, param: { ...e, type: s } });
|
|
1379
1417
|
}
|
|
1380
1418
|
if (e.type === "tuple")
|
|
1381
|
-
return
|
|
1419
|
+
return Ti(t, {
|
|
1382
1420
|
param: e
|
|
1383
1421
|
});
|
|
1384
1422
|
if (e.type === "address")
|
|
1385
|
-
return
|
|
1423
|
+
return yi(t);
|
|
1386
1424
|
if (e.type === "bool")
|
|
1387
|
-
return
|
|
1425
|
+
return mi(t);
|
|
1388
1426
|
if (e.type.startsWith("uint") || e.type.startsWith("int")) {
|
|
1389
1427
|
const i = e.type.startsWith("int");
|
|
1390
|
-
return
|
|
1428
|
+
return Ei(t, { signed: i });
|
|
1391
1429
|
}
|
|
1392
1430
|
if (e.type.startsWith("bytes"))
|
|
1393
|
-
return
|
|
1431
|
+
return bi(t, { param: e });
|
|
1394
1432
|
if (e.type === "string")
|
|
1395
|
-
return
|
|
1396
|
-
throw new
|
|
1433
|
+
return Ai(t);
|
|
1434
|
+
throw new In(e.type, {
|
|
1397
1435
|
docsPath: "/docs/contract/encodeAbiParameters"
|
|
1398
1436
|
});
|
|
1399
1437
|
}
|
|
1400
1438
|
function ue(e) {
|
|
1401
1439
|
let t = 0;
|
|
1402
1440
|
for (let r = 0; r < e.length; r++) {
|
|
1403
|
-
const { dynamic: o, encoded:
|
|
1404
|
-
o ? t += 32 : t += E(
|
|
1441
|
+
const { dynamic: o, encoded: c } = e[r];
|
|
1442
|
+
o ? t += 32 : t += E(c);
|
|
1405
1443
|
}
|
|
1406
1444
|
const n = [], i = [];
|
|
1407
1445
|
let s = 0;
|
|
1408
1446
|
for (let r = 0; r < e.length; r++) {
|
|
1409
|
-
const { dynamic: o, encoded:
|
|
1410
|
-
o ? (n.push(C(t + s, { size: 32 })), i.push(
|
|
1447
|
+
const { dynamic: o, encoded: c } = e[r];
|
|
1448
|
+
o ? (n.push(C(t + s, { size: 32 })), i.push(c), s += E(c)) : n.push(c);
|
|
1411
1449
|
}
|
|
1412
1450
|
return N([...n, ...i]);
|
|
1413
1451
|
}
|
|
1414
|
-
function
|
|
1452
|
+
function yi(e) {
|
|
1415
1453
|
if (!j(e))
|
|
1416
1454
|
throw new Xe({ address: e });
|
|
1417
1455
|
return { dynamic: !1, encoded: O(e.toLowerCase()) };
|
|
1418
1456
|
}
|
|
1419
|
-
function
|
|
1457
|
+
function pi(e, { length: t, param: n }) {
|
|
1420
1458
|
const i = t === null;
|
|
1421
1459
|
if (!Array.isArray(e))
|
|
1422
|
-
throw new
|
|
1460
|
+
throw new vn(e);
|
|
1423
1461
|
if (!i && e.length !== t)
|
|
1424
|
-
throw new
|
|
1462
|
+
throw new En({
|
|
1425
1463
|
expectedLength: t,
|
|
1426
1464
|
givenLength: e.length,
|
|
1427
1465
|
type: `${n.type}[${t}]`
|
|
@@ -1429,16 +1467,16 @@ function fi(e, { length: t, param: n }) {
|
|
|
1429
1467
|
let s = !1;
|
|
1430
1468
|
const r = [];
|
|
1431
1469
|
for (let o = 0; o < e.length; o++) {
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1470
|
+
const c = ce({ param: n, value: e[o] });
|
|
1471
|
+
c.dynamic && (s = !0), r.push(c);
|
|
1434
1472
|
}
|
|
1435
1473
|
if (i || s) {
|
|
1436
1474
|
const o = ue(r);
|
|
1437
1475
|
if (i) {
|
|
1438
|
-
const
|
|
1476
|
+
const c = C(r.length, { size: 32 });
|
|
1439
1477
|
return {
|
|
1440
1478
|
dynamic: !0,
|
|
1441
|
-
encoded: r.length > 0 ? N([
|
|
1479
|
+
encoded: r.length > 0 ? N([c, o]) : c
|
|
1442
1480
|
};
|
|
1443
1481
|
}
|
|
1444
1482
|
if (s)
|
|
@@ -1449,7 +1487,7 @@ function fi(e, { length: t, param: n }) {
|
|
|
1449
1487
|
encoded: N(r.map(({ encoded: o }) => o))
|
|
1450
1488
|
};
|
|
1451
1489
|
}
|
|
1452
|
-
function
|
|
1490
|
+
function bi(e, { param: t }) {
|
|
1453
1491
|
const [, n] = t.type.split("bytes"), i = E(e);
|
|
1454
1492
|
if (!n) {
|
|
1455
1493
|
let s = e;
|
|
@@ -1462,18 +1500,18 @@ function di(e, { param: t }) {
|
|
|
1462
1500
|
};
|
|
1463
1501
|
}
|
|
1464
1502
|
if (i !== Number.parseInt(n))
|
|
1465
|
-
throw new
|
|
1503
|
+
throw new An({
|
|
1466
1504
|
expectedSize: Number.parseInt(n),
|
|
1467
1505
|
value: e
|
|
1468
1506
|
});
|
|
1469
1507
|
return { dynamic: !1, encoded: O(e, { dir: "right" }) };
|
|
1470
1508
|
}
|
|
1471
|
-
function
|
|
1509
|
+
function mi(e) {
|
|
1472
1510
|
if (typeof e != "boolean")
|
|
1473
1511
|
throw new p(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
|
|
1474
1512
|
return { dynamic: !1, encoded: O(Ue(e)) };
|
|
1475
1513
|
}
|
|
1476
|
-
function
|
|
1514
|
+
function Ei(e, { signed: t }) {
|
|
1477
1515
|
return {
|
|
1478
1516
|
dynamic: !1,
|
|
1479
1517
|
encoded: C(e, {
|
|
@@ -1482,7 +1520,7 @@ function hi(e, { signed: t }) {
|
|
|
1482
1520
|
})
|
|
1483
1521
|
};
|
|
1484
1522
|
}
|
|
1485
|
-
function
|
|
1523
|
+
function Ai(e) {
|
|
1486
1524
|
const t = G(e), n = Math.ceil(E(t) / 32), i = [];
|
|
1487
1525
|
for (let s = 0; s < n; s++)
|
|
1488
1526
|
i.push(O(Je(t, s * 32, (s + 1) * 32), {
|
|
@@ -1496,22 +1534,22 @@ function gi(e) {
|
|
|
1496
1534
|
])
|
|
1497
1535
|
};
|
|
1498
1536
|
}
|
|
1499
|
-
function
|
|
1537
|
+
function Ti(e, { param: t }) {
|
|
1500
1538
|
let n = !1;
|
|
1501
1539
|
const i = [];
|
|
1502
1540
|
for (let s = 0; s < t.components.length; s++) {
|
|
1503
|
-
const r = t.components[s], o = Array.isArray(e) ? s : r.name,
|
|
1541
|
+
const r = t.components[s], o = Array.isArray(e) ? s : r.name, c = ce({
|
|
1504
1542
|
param: r,
|
|
1505
1543
|
value: e[o]
|
|
1506
1544
|
});
|
|
1507
|
-
i.push(
|
|
1545
|
+
i.push(c), c.dynamic && (n = !0);
|
|
1508
1546
|
}
|
|
1509
1547
|
return {
|
|
1510
1548
|
dynamic: n,
|
|
1511
1549
|
encoded: n ? ue(i) : N(i.map(({ encoded: s }) => s))
|
|
1512
1550
|
};
|
|
1513
1551
|
}
|
|
1514
|
-
function
|
|
1552
|
+
function _i(e) {
|
|
1515
1553
|
const t = e.match(/^(.*)\[(\d+)?\]$/);
|
|
1516
1554
|
return t ? (
|
|
1517
1555
|
// Return `null` if the array is dynamic.
|
|
@@ -1519,39 +1557,39 @@ function pi(e) {
|
|
|
1519
1557
|
) : void 0;
|
|
1520
1558
|
}
|
|
1521
1559
|
const et = (e) => Je(Ke(e), 0, 4);
|
|
1522
|
-
function
|
|
1523
|
-
const { abi: t, args: n = [], name: i } = e, s = U(i, { strict: !1 }), r = t.filter((
|
|
1560
|
+
function Si(e) {
|
|
1561
|
+
const { abi: t, args: n = [], name: i } = e, s = U(i, { strict: !1 }), r = t.filter((c) => s ? c.type === "function" ? et(c) === i : c.type === "event" ? ci(c) === i : !1 : "name" in c && c.name === i);
|
|
1524
1562
|
if (r.length === 0)
|
|
1525
1563
|
return;
|
|
1526
1564
|
if (r.length === 1)
|
|
1527
1565
|
return r[0];
|
|
1528
1566
|
let o;
|
|
1529
|
-
for (const
|
|
1530
|
-
if (!("inputs" in
|
|
1567
|
+
for (const c of r) {
|
|
1568
|
+
if (!("inputs" in c))
|
|
1531
1569
|
continue;
|
|
1532
1570
|
if (!n || n.length === 0) {
|
|
1533
|
-
if (!
|
|
1534
|
-
return
|
|
1571
|
+
if (!c.inputs || c.inputs.length === 0)
|
|
1572
|
+
return c;
|
|
1535
1573
|
continue;
|
|
1536
1574
|
}
|
|
1537
|
-
if (!
|
|
1575
|
+
if (!c.inputs || c.inputs.length === 0 || c.inputs.length !== n.length)
|
|
1538
1576
|
continue;
|
|
1539
1577
|
if (n.every((g, h) => {
|
|
1540
|
-
const y = "inputs" in
|
|
1578
|
+
const y = "inputs" in c && c.inputs[h];
|
|
1541
1579
|
return y ? ee(g, y) : !1;
|
|
1542
1580
|
})) {
|
|
1543
1581
|
if (o && "inputs" in o && o.inputs) {
|
|
1544
|
-
const g = tt(
|
|
1582
|
+
const g = tt(c.inputs, o.inputs, n);
|
|
1545
1583
|
if (g)
|
|
1546
|
-
throw new
|
|
1547
|
-
abiItem:
|
|
1584
|
+
throw new _n({
|
|
1585
|
+
abiItem: c,
|
|
1548
1586
|
type: g[0]
|
|
1549
1587
|
}, {
|
|
1550
1588
|
abiItem: o,
|
|
1551
1589
|
type: g[1]
|
|
1552
1590
|
});
|
|
1553
1591
|
}
|
|
1554
|
-
o =
|
|
1592
|
+
o = c;
|
|
1555
1593
|
}
|
|
1556
1594
|
}
|
|
1557
1595
|
return o || r[0];
|
|
@@ -1586,11 +1624,11 @@ function tt(e, t, n) {
|
|
|
1586
1624
|
}
|
|
1587
1625
|
}
|
|
1588
1626
|
const Ae = "/docs/contract/encodeFunctionData";
|
|
1589
|
-
function
|
|
1627
|
+
function Ii(e) {
|
|
1590
1628
|
const { abi: t, args: n, functionName: i } = e;
|
|
1591
1629
|
let s = t[0];
|
|
1592
1630
|
if (i) {
|
|
1593
|
-
const r =
|
|
1631
|
+
const r = Si({
|
|
1594
1632
|
abi: t,
|
|
1595
1633
|
args: n,
|
|
1596
1634
|
name: i
|
|
@@ -1608,25 +1646,25 @@ function mi(e) {
|
|
|
1608
1646
|
}
|
|
1609
1647
|
function Te(e) {
|
|
1610
1648
|
const { args: t } = e, { abi: n, functionName: i } = (() => {
|
|
1611
|
-
var
|
|
1612
|
-
return e.abi.length === 1 && ((
|
|
1649
|
+
var c;
|
|
1650
|
+
return e.abi.length === 1 && ((c = e.functionName) != null && c.startsWith("0x")) ? e : Ii(e);
|
|
1613
1651
|
})(), s = n[0], r = i, o = "inputs" in s && s.inputs ? ae(s.inputs, t ?? []) : void 0;
|
|
1614
1652
|
return Ye([r, o ?? "0x"]);
|
|
1615
1653
|
}
|
|
1616
|
-
const
|
|
1617
|
-
function
|
|
1654
|
+
const vi = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, wi = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
1655
|
+
function Oi(e) {
|
|
1618
1656
|
const { domain: t = {}, message: n, primaryType: i } = e, s = {
|
|
1619
|
-
EIP712Domain:
|
|
1657
|
+
EIP712Domain: Mi({ domain: t }),
|
|
1620
1658
|
...e.types
|
|
1621
1659
|
};
|
|
1622
|
-
|
|
1660
|
+
Di({
|
|
1623
1661
|
domain: t,
|
|
1624
1662
|
message: n,
|
|
1625
1663
|
primaryType: i,
|
|
1626
1664
|
types: s
|
|
1627
1665
|
});
|
|
1628
1666
|
const r = ["0x1901"];
|
|
1629
|
-
return t && r.push(
|
|
1667
|
+
return t && r.push(Ni({
|
|
1630
1668
|
domain: t,
|
|
1631
1669
|
types: s
|
|
1632
1670
|
})), i !== "EIP712Domain" && r.push(nt({
|
|
@@ -1635,7 +1673,7 @@ function Ti(e) {
|
|
|
1635
1673
|
types: s
|
|
1636
1674
|
})), _(N(r));
|
|
1637
1675
|
}
|
|
1638
|
-
function
|
|
1676
|
+
function Ni({ domain: e, types: t }) {
|
|
1639
1677
|
return nt({
|
|
1640
1678
|
data: e,
|
|
1641
1679
|
primaryType: "EIP712Domain",
|
|
@@ -1651,29 +1689,29 @@ function nt({ data: e, primaryType: t, types: n }) {
|
|
|
1651
1689
|
return _(i);
|
|
1652
1690
|
}
|
|
1653
1691
|
function it({ data: e, primaryType: t, types: n }) {
|
|
1654
|
-
const i = [{ type: "bytes32" }], s = [
|
|
1692
|
+
const i = [{ type: "bytes32" }], s = [Ci({ primaryType: t, types: n })];
|
|
1655
1693
|
for (const r of n[t]) {
|
|
1656
|
-
const [o,
|
|
1694
|
+
const [o, c] = rt({
|
|
1657
1695
|
types: n,
|
|
1658
1696
|
name: r.name,
|
|
1659
1697
|
type: r.type,
|
|
1660
1698
|
value: e[r.name]
|
|
1661
1699
|
});
|
|
1662
|
-
i.push(o), s.push(
|
|
1700
|
+
i.push(o), s.push(c);
|
|
1663
1701
|
}
|
|
1664
1702
|
return ae(i, s);
|
|
1665
1703
|
}
|
|
1666
|
-
function
|
|
1667
|
-
const n = ie(
|
|
1704
|
+
function Ci({ primaryType: e, types: t }) {
|
|
1705
|
+
const n = ie(Pi({ primaryType: e, types: t }));
|
|
1668
1706
|
return _(n);
|
|
1669
1707
|
}
|
|
1670
|
-
function
|
|
1708
|
+
function Pi({ primaryType: e, types: t }) {
|
|
1671
1709
|
let n = "";
|
|
1672
1710
|
const i = st({ primaryType: e, types: t });
|
|
1673
1711
|
i.delete(e);
|
|
1674
1712
|
const s = [e, ...Array.from(i).sort()];
|
|
1675
1713
|
for (const r of s)
|
|
1676
|
-
n += `${r}(${t[r].map(({ name: o, type:
|
|
1714
|
+
n += `${r}(${t[r].map(({ name: o, type: c }) => `${c} ${o}`).join(",")})`;
|
|
1677
1715
|
return n;
|
|
1678
1716
|
}
|
|
1679
1717
|
function st({ primaryType: e, types: t }, n = /* @__PURE__ */ new Set()) {
|
|
@@ -1709,10 +1747,10 @@ function rt({ types: e, name: t, type: n, value: i }) {
|
|
|
1709
1747
|
}
|
|
1710
1748
|
return [{ type: n }, i];
|
|
1711
1749
|
}
|
|
1712
|
-
function
|
|
1713
|
-
const { domain: t, message: n, primaryType: i, types: s } = e, r = (o,
|
|
1750
|
+
function Di(e) {
|
|
1751
|
+
const { domain: t, message: n, primaryType: i, types: s } = e, r = (o, c) => {
|
|
1714
1752
|
for (const l of o) {
|
|
1715
|
-
const { name: g, type: h } = l, y =
|
|
1753
|
+
const { name: g, type: h } = l, y = c[g], M = h.match(wi);
|
|
1716
1754
|
if (M && (typeof y == "number" || typeof y == "bigint")) {
|
|
1717
1755
|
const [K, P, X] = M;
|
|
1718
1756
|
C(y, {
|
|
@@ -1722,11 +1760,11 @@ function wi(e) {
|
|
|
1722
1760
|
}
|
|
1723
1761
|
if (h === "address" && typeof y == "string" && !j(y))
|
|
1724
1762
|
throw new Xe({ address: y });
|
|
1725
|
-
const
|
|
1726
|
-
if (
|
|
1727
|
-
const [K, P] =
|
|
1763
|
+
const S = h.match(vi);
|
|
1764
|
+
if (S) {
|
|
1765
|
+
const [K, P] = S;
|
|
1728
1766
|
if (P && E(y) !== Number.parseInt(P))
|
|
1729
|
-
throw new
|
|
1767
|
+
throw new Sn({
|
|
1730
1768
|
expectedSize: Number.parseInt(P),
|
|
1731
1769
|
givenSize: E(y)
|
|
1732
1770
|
});
|
|
@@ -1737,7 +1775,7 @@ function wi(e) {
|
|
|
1737
1775
|
};
|
|
1738
1776
|
s.EIP712Domain && t && r(s.EIP712Domain, t), i !== "EIP712Domain" && r(s[i], n);
|
|
1739
1777
|
}
|
|
1740
|
-
function
|
|
1778
|
+
function Mi({ domain: e }) {
|
|
1741
1779
|
return [
|
|
1742
1780
|
typeof (e == null ? void 0 : e.name) == "string" && { name: "name", type: "string" },
|
|
1743
1781
|
(e == null ? void 0 : e.version) && { name: "version", type: "string" },
|
|
@@ -1752,16 +1790,16 @@ function vi({ domain: e }) {
|
|
|
1752
1790
|
(e == null ? void 0 : e.salt) && { name: "salt", type: "bytes32" }
|
|
1753
1791
|
].filter(Boolean);
|
|
1754
1792
|
}
|
|
1755
|
-
const
|
|
1793
|
+
const Ri = `Ethereum Signed Message:
|
|
1756
1794
|
`;
|
|
1757
|
-
function
|
|
1758
|
-
const t = typeof e == "string" ? G(e) : typeof e.raw == "string" ? e.raw : se(e.raw), n = G(`${
|
|
1795
|
+
function $i(e) {
|
|
1796
|
+
const t = typeof e == "string" ? G(e) : typeof e.raw == "string" ? e.raw : se(e.raw), n = G(`${Ri}${E(t)}`);
|
|
1759
1797
|
return N([n, t]);
|
|
1760
1798
|
}
|
|
1761
|
-
function
|
|
1762
|
-
return _(
|
|
1799
|
+
function Li(e, t) {
|
|
1800
|
+
return _($i(e), t);
|
|
1763
1801
|
}
|
|
1764
|
-
const
|
|
1802
|
+
const Bi = "0x1626ba7e", ji = "0x20c13b0b", te = 4001;
|
|
1765
1803
|
class H extends Error {
|
|
1766
1804
|
constructor(t, n, i) {
|
|
1767
1805
|
super(t), this.code = n, this.data = i, Object.setPrototypeOf(this, H.prototype);
|
|
@@ -1787,7 +1825,7 @@ class ot {
|
|
|
1787
1825
|
return t.every((n) => typeof n == "object" ? Object.keys(n).every((i) => !!Object.values(J).includes(i)) : !1);
|
|
1788
1826
|
}
|
|
1789
1827
|
}
|
|
1790
|
-
const _e = (e, t) => t.some((n) => n.parentCapability === e),
|
|
1828
|
+
const _e = (e, t) => t.some((n) => n.parentCapability === e), Hi = () => (e, t, n) => {
|
|
1791
1829
|
const i = n.value;
|
|
1792
1830
|
return n.value = async function() {
|
|
1793
1831
|
const s = new ot(this.communicator);
|
|
@@ -1797,10 +1835,10 @@ const _e = (e, t) => t.some((n) => n.parentCapability === e), Mi = () => (e, t,
|
|
|
1797
1835
|
return i.apply(this);
|
|
1798
1836
|
}, n;
|
|
1799
1837
|
};
|
|
1800
|
-
var
|
|
1838
|
+
var Ui = function(e, t, n, i) {
|
|
1801
1839
|
var s = arguments.length, r = s < 3 ? t : i === null ? i = Object.getOwnPropertyDescriptor(t, n) : i, o;
|
|
1802
1840
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(e, t, n, i);
|
|
1803
|
-
else for (var
|
|
1841
|
+
else for (var c = e.length - 1; c >= 0; c--) (o = e[c]) && (r = (s < 3 ? o(r) : s > 3 ? o(t, n, r) : o(t, n)) || r);
|
|
1804
1842
|
return s > 3 && r && Object.defineProperty(t, n, r), r;
|
|
1805
1843
|
};
|
|
1806
1844
|
class at {
|
|
@@ -1859,7 +1897,7 @@ class at {
|
|
|
1859
1897
|
]
|
|
1860
1898
|
};
|
|
1861
1899
|
try {
|
|
1862
|
-
return (await this.communicator.send(b.rpcCall, r)).data.slice(0, 10).toLowerCase() ===
|
|
1900
|
+
return (await this.communicator.send(b.rpcCall, r)).data.slice(0, 10).toLowerCase() === Bi;
|
|
1863
1901
|
} catch {
|
|
1864
1902
|
return !1;
|
|
1865
1903
|
}
|
|
@@ -1904,24 +1942,24 @@ class at {
|
|
|
1904
1942
|
]
|
|
1905
1943
|
};
|
|
1906
1944
|
try {
|
|
1907
|
-
return (await this.communicator.send(b.rpcCall, r)).data.slice(0, 10).toLowerCase() ===
|
|
1945
|
+
return (await this.communicator.send(b.rpcCall, r)).data.slice(0, 10).toLowerCase() === ji;
|
|
1908
1946
|
} catch {
|
|
1909
1947
|
return !1;
|
|
1910
1948
|
}
|
|
1911
1949
|
}
|
|
1912
1950
|
calculateMessageHash(t) {
|
|
1913
|
-
return
|
|
1951
|
+
return Li(t);
|
|
1914
1952
|
}
|
|
1915
1953
|
calculateTypedMessageHash(t) {
|
|
1916
1954
|
const n = typeof t.domain.chainId == "object" ? t.domain.chainId.toNumber() : Number(t.domain.chainId);
|
|
1917
1955
|
let i = t.primaryType;
|
|
1918
1956
|
if (!i) {
|
|
1919
|
-
const s = Object.values(t.types), r = Object.keys(t.types).filter((o) => s.every((
|
|
1957
|
+
const s = Object.values(t.types), r = Object.keys(t.types).filter((o) => s.every((c) => c.every(({ type: l }) => l.replace("[", "").replace("]", "") !== o)));
|
|
1920
1958
|
if (r.length === 0 || r.length > 1)
|
|
1921
1959
|
throw new Error("Please specify primaryType");
|
|
1922
1960
|
i = r[0];
|
|
1923
1961
|
}
|
|
1924
|
-
return
|
|
1962
|
+
return Oi({
|
|
1925
1963
|
message: t.message,
|
|
1926
1964
|
domain: {
|
|
1927
1965
|
...t.domain,
|
|
@@ -1941,7 +1979,7 @@ class at {
|
|
|
1941
1979
|
if (typeof t == "string" && (i = async () => {
|
|
1942
1980
|
const s = this.calculateMessageHash(t);
|
|
1943
1981
|
return await this.isMessageHashSigned(s, n);
|
|
1944
|
-
}),
|
|
1982
|
+
}), Se(t) && (i = async () => {
|
|
1945
1983
|
const s = this.calculateTypedMessageHash(t);
|
|
1946
1984
|
return await this.isMessageHashSigned(s, n);
|
|
1947
1985
|
}), i)
|
|
@@ -1962,22 +2000,22 @@ class at {
|
|
|
1962
2000
|
return (await this.communicator.send(b.requestAddressBook, void 0)).data;
|
|
1963
2001
|
}
|
|
1964
2002
|
}
|
|
1965
|
-
|
|
1966
|
-
|
|
2003
|
+
Ui([
|
|
2004
|
+
Hi()
|
|
1967
2005
|
], at.prototype, "requestAddressBook", null);
|
|
1968
|
-
class
|
|
2006
|
+
class ki {
|
|
1969
2007
|
constructor(t = {}) {
|
|
1970
2008
|
const { allowedDomains: n = null, debug: i = !1 } = t;
|
|
1971
|
-
this.communicator = new
|
|
2009
|
+
this.communicator = new xt(n, i), this.eth = new hn(this.communicator), this.txs = new ln(this.communicator), this.safe = new at(this.communicator), this.wallet = new ot(this.communicator);
|
|
1972
2010
|
}
|
|
1973
2011
|
}
|
|
1974
|
-
const
|
|
2012
|
+
const Fi = ki;
|
|
1975
2013
|
export {
|
|
1976
2014
|
V as MessageFormatter,
|
|
1977
2015
|
b as Methods,
|
|
1978
2016
|
m as RPC_CALLS,
|
|
1979
2017
|
J as RestrictedMethods,
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
2018
|
+
Fi as default,
|
|
2019
|
+
Qt as getSDKVersion,
|
|
2020
|
+
Se as isObjectEIP712TypedData
|
|
1983
2021
|
};
|