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