@reown/appkit-cdn 0.0.3
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/LICENSE +190 -0
- package/dist/W3MFrameProviderSingleton-BpWUndnw.cjs +11014 -0
- package/dist/W3MFrameProviderSingleton-CuVI_88U.js +65026 -0
- package/dist/ethers.cjs +1 -0
- package/dist/ethers.js +17800 -0
- package/dist/hooks.module-BmccViTi.cjs +1 -0
- package/dist/hooks.module-C2zxEs4Z.js +764 -0
- package/dist/index--u0BBJui.js +128 -0
- package/dist/index-B5dlb2GK.cjs +1 -0
- package/dist/index-BGcCLdgU.js +3175 -0
- package/dist/index-BgSdiVHK.cjs +64 -0
- package/dist/index-BzzLy8QO.js +2055 -0
- package/dist/index-CEbNT_sk.cjs +41 -0
- package/dist/index-Cbfs_-YJ.js +254 -0
- package/dist/index-CjczsdX0.js +9034 -0
- package/dist/index-CytFwM4F.cjs +1 -0
- package/dist/index-DIBheNE_.js +250 -0
- package/dist/index-DTZ3zFoi.js +931 -0
- package/dist/index-DoNvH4sY.cjs +1 -0
- package/dist/index-DxKsnlAL.cjs +7 -0
- package/dist/index-_fb0kPJf.js +161 -0
- package/dist/index-e2XnZub2.cjs +1 -0
- package/dist/index-qHZ88Aei.cjs +47 -0
- package/dist/index.es-Dzy36BN7.js +11685 -0
- package/dist/index.es-wptiKBWB.cjs +43 -0
- package/dist/metamask-sdk-CH4ak2WC.cjs +217 -0
- package/dist/metamask-sdk-vSsaK2qA.js +40484 -0
- package/dist/native-DUnMHCku.cjs +1 -0
- package/dist/native-DZv9b0EL.js +16 -0
- package/dist/w3m-modal-Cb8iN1Y9.js +290 -0
- package/dist/w3m-modal-pgEnMCmq.cjs +149 -0
- package/dist/wagmi-Cz2I9r-O.cjs +47 -0
- package/dist/wagmi-Dnkdlm7T.js +26712 -0
- package/dist/wagmi.cjs +1 -0
- package/dist/wagmi.js +9 -0
- package/package.json +38 -0
|
@@ -0,0 +1,931 @@
|
|
|
1
|
+
import { k as m } from "./W3MFrameProviderSingleton-CuVI_88U.js";
|
|
2
|
+
import { e as P, h as We, a as Ve } from "./wagmi-Dnkdlm7T.js";
|
|
3
|
+
const qe = () => "9.1.0", ke = (e) => e.toString(16).padStart(2, "0"), Fe = (e) => {
|
|
4
|
+
const n = new Uint8Array(e / 2);
|
|
5
|
+
return window.crypto.getRandomValues(n), Array.from(n, ke).join("");
|
|
6
|
+
}, Ke = () => typeof window < "u" ? Fe(10) : (/* @__PURE__ */ new Date()).getTime().toString(36);
|
|
7
|
+
class N {
|
|
8
|
+
}
|
|
9
|
+
N.makeRequest = (e, n) => ({
|
|
10
|
+
id: Ke(),
|
|
11
|
+
method: e,
|
|
12
|
+
params: n,
|
|
13
|
+
env: {
|
|
14
|
+
sdkVersion: qe()
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
N.makeResponse = (e, n, t) => ({
|
|
18
|
+
id: e,
|
|
19
|
+
success: !0,
|
|
20
|
+
version: t,
|
|
21
|
+
data: n
|
|
22
|
+
});
|
|
23
|
+
N.makeErrorResponse = (e, n, t) => ({
|
|
24
|
+
id: e,
|
|
25
|
+
success: !1,
|
|
26
|
+
error: n,
|
|
27
|
+
version: t
|
|
28
|
+
});
|
|
29
|
+
var f;
|
|
30
|
+
(function(e) {
|
|
31
|
+
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";
|
|
32
|
+
})(f || (f = {}));
|
|
33
|
+
var D;
|
|
34
|
+
(function(e) {
|
|
35
|
+
e.requestAddressBook = "requestAddressBook";
|
|
36
|
+
})(D || (D = {}));
|
|
37
|
+
class Xe {
|
|
38
|
+
constructor(n = null, t = !1) {
|
|
39
|
+
this.allowedOrigins = null, this.callbacks = /* @__PURE__ */ new Map(), this.debugMode = !1, this.isServer = typeof window > "u", this.isValidMessage = ({ origin: i, data: r, source: s }) => {
|
|
40
|
+
const d = !r, l = !this.isServer && s === window.parent, g = typeof r.version < "u" && parseInt(r.version.split(".")[0]), I = typeof g == "number" && g >= 1;
|
|
41
|
+
let E = !0;
|
|
42
|
+
return Array.isArray(this.allowedOrigins) && (E = this.allowedOrigins.find((S) => S.test(i)) !== void 0), !d && l && I && E;
|
|
43
|
+
}, this.logIncomingMessage = (i) => {
|
|
44
|
+
console.info(`Safe Apps SDK v1: A message was received from origin ${i.origin}. `, i.data);
|
|
45
|
+
}, this.onParentMessage = (i) => {
|
|
46
|
+
this.isValidMessage(i) && (this.debugMode && this.logIncomingMessage(i), this.handleIncomingMessage(i.data));
|
|
47
|
+
}, this.handleIncomingMessage = (i) => {
|
|
48
|
+
const { id: r } = i, s = this.callbacks.get(r);
|
|
49
|
+
s && (s(i), this.callbacks.delete(r));
|
|
50
|
+
}, this.send = (i, r) => {
|
|
51
|
+
const s = N.makeRequest(i, r);
|
|
52
|
+
if (this.isServer)
|
|
53
|
+
throw new Error("Window doesn't exist");
|
|
54
|
+
return window.parent.postMessage(s, "*"), new Promise((d, l) => {
|
|
55
|
+
this.callbacks.set(s.id, (g) => {
|
|
56
|
+
if (!g.success) {
|
|
57
|
+
l(new Error(g.error));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
d(g);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}, this.allowedOrigins = n, this.debugMode = t, this.isServer || window.addEventListener("message", this.onParentMessage);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const p = (e) => typeof e == "object" && e != null && "domain" in e && "types" in e && "message" in e;
|
|
67
|
+
var Qe = {}, _ = {}, T = {}, w = m && m.__awaiter || function(e, n, t, i) {
|
|
68
|
+
function r(s) {
|
|
69
|
+
return s instanceof t ? s : new t(function(d) {
|
|
70
|
+
d(s);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return new (t || (t = Promise))(function(s, d) {
|
|
74
|
+
function l(E) {
|
|
75
|
+
try {
|
|
76
|
+
I(i.next(E));
|
|
77
|
+
} catch (S) {
|
|
78
|
+
d(S);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function g(E) {
|
|
82
|
+
try {
|
|
83
|
+
I(i.throw(E));
|
|
84
|
+
} catch (S) {
|
|
85
|
+
d(S);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function I(E) {
|
|
89
|
+
E.done ? s(E.value) : r(E.value).then(l, g);
|
|
90
|
+
}
|
|
91
|
+
I((i = i.apply(e, n || [])).next());
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
Object.defineProperty(T, "__esModule", { value: !0 });
|
|
95
|
+
T.getData = T.fetchData = T.stringifyQuery = T.insertParams = void 0;
|
|
96
|
+
const $e = (e) => typeof e == "object" && e !== null && "code" in e && "message" in e;
|
|
97
|
+
function Ye(e, n, t) {
|
|
98
|
+
return e.replace(new RegExp(`\\{${n}\\}`, "g"), t);
|
|
99
|
+
}
|
|
100
|
+
function Je(e, n) {
|
|
101
|
+
return n ? Object.keys(n).reduce((t, i) => Ye(t, i, String(n[i])), e) : e;
|
|
102
|
+
}
|
|
103
|
+
T.insertParams = Je;
|
|
104
|
+
function ze(e) {
|
|
105
|
+
if (!e)
|
|
106
|
+
return "";
|
|
107
|
+
const n = new URLSearchParams();
|
|
108
|
+
Object.keys(e).forEach((i) => {
|
|
109
|
+
e[i] != null && n.append(i, String(e[i]));
|
|
110
|
+
});
|
|
111
|
+
const t = n.toString();
|
|
112
|
+
return t ? `?${t}` : "";
|
|
113
|
+
}
|
|
114
|
+
T.stringifyQuery = ze;
|
|
115
|
+
function L(e) {
|
|
116
|
+
return w(this, void 0, void 0, function* () {
|
|
117
|
+
let n;
|
|
118
|
+
try {
|
|
119
|
+
n = yield e.json();
|
|
120
|
+
} catch {
|
|
121
|
+
n = {};
|
|
122
|
+
}
|
|
123
|
+
if (!e.ok) {
|
|
124
|
+
const t = $e(n) ? `CGW error - ${n.code}: ${n.message}` : `CGW error - status ${e.statusText}`;
|
|
125
|
+
throw new Error(t);
|
|
126
|
+
}
|
|
127
|
+
return n;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function Ze(e, n, t, i, r) {
|
|
131
|
+
return w(this, void 0, void 0, function* () {
|
|
132
|
+
const s = Object.assign({ "Content-Type": "application/json" }, i), d = {
|
|
133
|
+
method: n ?? "POST",
|
|
134
|
+
headers: s
|
|
135
|
+
};
|
|
136
|
+
r && (d.credentials = r), t != null && (d.body = typeof t == "string" ? t : JSON.stringify(t));
|
|
137
|
+
const l = yield fetch(e, d);
|
|
138
|
+
return L(l);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
T.fetchData = Ze;
|
|
142
|
+
function xe(e, n, t) {
|
|
143
|
+
return w(this, void 0, void 0, function* () {
|
|
144
|
+
const i = {
|
|
145
|
+
method: "GET"
|
|
146
|
+
};
|
|
147
|
+
n && (i.headers = Object.assign(Object.assign({}, n), { "Content-Type": "application/json" })), t && (i.credentials = t);
|
|
148
|
+
const r = yield fetch(e, i);
|
|
149
|
+
return L(r);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
T.getData = xe;
|
|
153
|
+
Object.defineProperty(_, "__esModule", { value: !0 });
|
|
154
|
+
_.getEndpoint = _.deleteEndpoint = _.putEndpoint = _.postEndpoint = void 0;
|
|
155
|
+
const y = T;
|
|
156
|
+
function C(e, n, t, i) {
|
|
157
|
+
const r = (0, y.insertParams)(n, t), s = (0, y.stringifyQuery)(i);
|
|
158
|
+
return `${e}${r}${s}`;
|
|
159
|
+
}
|
|
160
|
+
function en(e, n, t) {
|
|
161
|
+
const i = C(e, n, t == null ? void 0 : t.path, t == null ? void 0 : t.query);
|
|
162
|
+
return (0, y.fetchData)(i, "POST", t == null ? void 0 : t.body, t == null ? void 0 : t.headers, t == null ? void 0 : t.credentials);
|
|
163
|
+
}
|
|
164
|
+
_.postEndpoint = en;
|
|
165
|
+
function nn(e, n, t) {
|
|
166
|
+
const i = C(e, n, t == null ? void 0 : t.path, t == null ? void 0 : t.query);
|
|
167
|
+
return (0, y.fetchData)(i, "PUT", t == null ? void 0 : t.body, t == null ? void 0 : t.headers, t == null ? void 0 : t.credentials);
|
|
168
|
+
}
|
|
169
|
+
_.putEndpoint = nn;
|
|
170
|
+
function tn(e, n, t) {
|
|
171
|
+
const i = C(e, n, t == null ? void 0 : t.path, t == null ? void 0 : t.query);
|
|
172
|
+
return (0, y.fetchData)(i, "DELETE", t == null ? void 0 : t.body, t == null ? void 0 : t.headers, t == null ? void 0 : t.credentials);
|
|
173
|
+
}
|
|
174
|
+
_.deleteEndpoint = tn;
|
|
175
|
+
function an(e, n, t, i) {
|
|
176
|
+
if (i)
|
|
177
|
+
return (0, y.getData)(i, void 0, t == null ? void 0 : t.credentials);
|
|
178
|
+
const r = C(e, n, t == null ? void 0 : t.path, t == null ? void 0 : t.query);
|
|
179
|
+
return (0, y.getData)(r, t == null ? void 0 : t.headers, t == null ? void 0 : t.credentials);
|
|
180
|
+
}
|
|
181
|
+
_.getEndpoint = an;
|
|
182
|
+
var b = {};
|
|
183
|
+
Object.defineProperty(b, "__esModule", { value: !0 });
|
|
184
|
+
b.DEFAULT_BASE_URL = void 0;
|
|
185
|
+
b.DEFAULT_BASE_URL = "https://safe-client.safe.global";
|
|
186
|
+
var B = {};
|
|
187
|
+
(function(e) {
|
|
188
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.ImplementationVersionState = void 0, function(n) {
|
|
189
|
+
n.UP_TO_DATE = "UP_TO_DATE", n.OUTDATED = "OUTDATED", n.UNKNOWN = "UNKNOWN";
|
|
190
|
+
}(e.ImplementationVersionState || (e.ImplementationVersionState = {}));
|
|
191
|
+
})(B);
|
|
192
|
+
var H = {};
|
|
193
|
+
(function(e) {
|
|
194
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.SafeAppSocialPlatforms = e.SafeAppFeatures = e.SafeAppAccessPolicyTypes = void 0, function(n) {
|
|
195
|
+
n.NoRestrictions = "NO_RESTRICTIONS", n.DomainAllowlist = "DOMAIN_ALLOWLIST";
|
|
196
|
+
}(e.SafeAppAccessPolicyTypes || (e.SafeAppAccessPolicyTypes = {})), function(n) {
|
|
197
|
+
n.BATCHED_TRANSACTIONS = "BATCHED_TRANSACTIONS";
|
|
198
|
+
}(e.SafeAppFeatures || (e.SafeAppFeatures = {})), function(n) {
|
|
199
|
+
n.TWITTER = "TWITTER", n.GITHUB = "GITHUB", n.DISCORD = "DISCORD";
|
|
200
|
+
}(e.SafeAppSocialPlatforms || (e.SafeAppSocialPlatforms = {}));
|
|
201
|
+
})(H);
|
|
202
|
+
var U = {};
|
|
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(n) {
|
|
205
|
+
n[n.CALL = 0] = "CALL", n[n.DELEGATE = 1] = "DELEGATE";
|
|
206
|
+
}(e.Operation || (e.Operation = {})), function(n) {
|
|
207
|
+
n.AWAITING_CONFIRMATIONS = "AWAITING_CONFIRMATIONS", n.AWAITING_EXECUTION = "AWAITING_EXECUTION", n.CANCELLED = "CANCELLED", n.FAILED = "FAILED", n.SUCCESS = "SUCCESS";
|
|
208
|
+
}(e.TransactionStatus || (e.TransactionStatus = {})), function(n) {
|
|
209
|
+
n.INCOMING = "INCOMING", n.OUTGOING = "OUTGOING", n.UNKNOWN = "UNKNOWN";
|
|
210
|
+
}(e.TransferDirection || (e.TransferDirection = {})), function(n) {
|
|
211
|
+
n.ERC20 = "ERC20", n.ERC721 = "ERC721", n.NATIVE_COIN = "NATIVE_COIN";
|
|
212
|
+
}(e.TransactionTokenType || (e.TransactionTokenType = {})), function(n) {
|
|
213
|
+
n.SET_FALLBACK_HANDLER = "SET_FALLBACK_HANDLER", n.ADD_OWNER = "ADD_OWNER", n.REMOVE_OWNER = "REMOVE_OWNER", n.SWAP_OWNER = "SWAP_OWNER", n.CHANGE_THRESHOLD = "CHANGE_THRESHOLD", n.CHANGE_IMPLEMENTATION = "CHANGE_IMPLEMENTATION", n.ENABLE_MODULE = "ENABLE_MODULE", n.DISABLE_MODULE = "DISABLE_MODULE", n.SET_GUARD = "SET_GUARD", n.DELETE_GUARD = "DELETE_GUARD";
|
|
214
|
+
}(e.SettingsInfoType || (e.SettingsInfoType = {})), function(n) {
|
|
215
|
+
n.TRANSFER = "Transfer", n.SETTINGS_CHANGE = "SettingsChange", n.CUSTOM = "Custom", n.CREATION = "Creation", n.SWAP_ORDER = "SwapOrder", n.TWAP_ORDER = "TwapOrder", n.SWAP_TRANSFER = "SwapTransfer";
|
|
216
|
+
}(e.TransactionInfoType || (e.TransactionInfoType = {})), function(n) {
|
|
217
|
+
n.NONE = "None", n.HAS_NEXT = "HasNext", n.END = "End";
|
|
218
|
+
}(e.ConflictType || (e.ConflictType = {})), function(n) {
|
|
219
|
+
n.TRANSACTION = "TRANSACTION", n.LABEL = "LABEL", n.CONFLICT_HEADER = "CONFLICT_HEADER", n.DATE_LABEL = "DATE_LABEL";
|
|
220
|
+
}(e.TransactionListItemType || (e.TransactionListItemType = {})), function(n) {
|
|
221
|
+
n.MULTISIG = "MULTISIG", n.MODULE = "MODULE";
|
|
222
|
+
}(e.DetailedExecutionInfoType || (e.DetailedExecutionInfoType = {})), function(n) {
|
|
223
|
+
n.AUTO = "AUTO", n.LIMIT_DURATION = "LIMIT_DURATION";
|
|
224
|
+
}(e.DurationType || (e.DurationType = {})), function(n) {
|
|
225
|
+
n.AT_MINING_TIME = "AT_MINING_TIME", n.AT_EPOCH = "AT_EPOCH";
|
|
226
|
+
}(e.StartTimeValue || (e.StartTimeValue = {})), function(n) {
|
|
227
|
+
n.Queued = "Queued", n.Next = "Next";
|
|
228
|
+
}(e.LabelValue || (e.LabelValue = {}));
|
|
229
|
+
})(U);
|
|
230
|
+
var j = {};
|
|
231
|
+
(function(e) {
|
|
232
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.FEATURES = e.GAS_PRICE_TYPE = e.RPC_AUTHENTICATION = void 0, function(n) {
|
|
233
|
+
n.API_KEY_PATH = "API_KEY_PATH", n.NO_AUTHENTICATION = "NO_AUTHENTICATION", n.UNKNOWN = "UNKNOWN";
|
|
234
|
+
}(e.RPC_AUTHENTICATION || (e.RPC_AUTHENTICATION = {})), function(n) {
|
|
235
|
+
n.ORACLE = "ORACLE", n.FIXED = "FIXED", n.FIXED_1559 = "FIXED1559", n.UNKNOWN = "UNKNOWN";
|
|
236
|
+
}(e.GAS_PRICE_TYPE || (e.GAS_PRICE_TYPE = {})), function(n) {
|
|
237
|
+
n.ERC721 = "ERC721", n.SAFE_APPS = "SAFE_APPS", n.CONTRACT_INTERACTION = "CONTRACT_INTERACTION", n.DOMAIN_LOOKUP = "DOMAIN_LOOKUP", n.SPENDING_LIMIT = "SPENDING_LIMIT", n.EIP1559 = "EIP1559", n.SAFE_TX_GAS_OPTIONAL = "SAFE_TX_GAS_OPTIONAL", n.TX_SIMULATION = "TX_SIMULATION", n.EIP1271 = "EIP1271";
|
|
238
|
+
}(e.FEATURES || (e.FEATURES = {}));
|
|
239
|
+
})(j);
|
|
240
|
+
var G = {};
|
|
241
|
+
(function(e) {
|
|
242
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.TokenType = void 0, function(n) {
|
|
243
|
+
n.ERC20 = "ERC20", n.ERC721 = "ERC721", n.NATIVE_TOKEN = "NATIVE_TOKEN";
|
|
244
|
+
}(e.TokenType || (e.TokenType = {}));
|
|
245
|
+
})(G);
|
|
246
|
+
var W = {};
|
|
247
|
+
Object.defineProperty(W, "__esModule", { value: !0 });
|
|
248
|
+
var V = {};
|
|
249
|
+
(function(e) {
|
|
250
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.ConfirmationViewTypes = void 0, function(n) {
|
|
251
|
+
n.COW_SWAP_ORDER = "COW_SWAP_ORDER", n.COW_SWAP_TWAP_ORDER = "COW_SWAP_TWAP_ORDER";
|
|
252
|
+
}(e.ConfirmationViewTypes || (e.ConfirmationViewTypes = {}));
|
|
253
|
+
})(V);
|
|
254
|
+
var q = {};
|
|
255
|
+
(function(e) {
|
|
256
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.SafeMessageStatus = e.SafeMessageListItemType = void 0, function(n) {
|
|
257
|
+
n.DATE_LABEL = "DATE_LABEL", n.MESSAGE = "MESSAGE";
|
|
258
|
+
}(e.SafeMessageListItemType || (e.SafeMessageListItemType = {})), function(n) {
|
|
259
|
+
n.NEEDS_CONFIRMATION = "NEEDS_CONFIRMATION", n.CONFIRMED = "CONFIRMED";
|
|
260
|
+
}(e.SafeMessageStatus || (e.SafeMessageStatus = {}));
|
|
261
|
+
})(q);
|
|
262
|
+
var k = {};
|
|
263
|
+
(function(e) {
|
|
264
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.DeviceType = void 0, function(n) {
|
|
265
|
+
n.ANDROID = "ANDROID", n.IOS = "IOS", n.WEB = "WEB";
|
|
266
|
+
}(e.DeviceType || (e.DeviceType = {}));
|
|
267
|
+
})(k);
|
|
268
|
+
var F = {};
|
|
269
|
+
Object.defineProperty(F, "__esModule", { value: !0 });
|
|
270
|
+
(function(e) {
|
|
271
|
+
var n = m && m.__createBinding || (Object.create ? function(a, c, o, u) {
|
|
272
|
+
u === void 0 && (u = o);
|
|
273
|
+
var A = Object.getOwnPropertyDescriptor(c, o);
|
|
274
|
+
(!A || ("get" in A ? !c.__esModule : A.writable || A.configurable)) && (A = { enumerable: !0, get: function() {
|
|
275
|
+
return c[o];
|
|
276
|
+
} }), Object.defineProperty(a, u, A);
|
|
277
|
+
} : function(a, c, o, u) {
|
|
278
|
+
u === void 0 && (u = o), a[u] = c[o];
|
|
279
|
+
}), t = m && m.__exportStar || function(a, c) {
|
|
280
|
+
for (var o in a)
|
|
281
|
+
o !== "default" && !Object.prototype.hasOwnProperty.call(c, o) && n(c, a, o);
|
|
282
|
+
};
|
|
283
|
+
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;
|
|
284
|
+
const i = _, r = b;
|
|
285
|
+
t(B, e), t(H, e), t(U, e), t(j, e), t(G, e), t(W, e), t(V, e), t(q, e), t(k, e), t(F, e);
|
|
286
|
+
let s = r.DEFAULT_BASE_URL;
|
|
287
|
+
const d = (a) => {
|
|
288
|
+
s = a;
|
|
289
|
+
};
|
|
290
|
+
e.setBaseUrl = d;
|
|
291
|
+
function l(a, c) {
|
|
292
|
+
return (0, i.postEndpoint)(s, "/v1/chains/{chainId}/relay", { path: { chainId: a }, body: c });
|
|
293
|
+
}
|
|
294
|
+
e.relayTransaction = l;
|
|
295
|
+
function g(a, c) {
|
|
296
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/relay/{address}", { path: { chainId: a, address: c } });
|
|
297
|
+
}
|
|
298
|
+
e.getRelayCount = g;
|
|
299
|
+
function I(a, c) {
|
|
300
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{address}", { path: { chainId: a, address: c } });
|
|
301
|
+
}
|
|
302
|
+
e.getSafeInfo = I;
|
|
303
|
+
function E(a, c, o, u) {
|
|
304
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{address}/incoming-transfers/", {
|
|
305
|
+
path: { chainId: a, address: c },
|
|
306
|
+
query: o
|
|
307
|
+
}, u);
|
|
308
|
+
}
|
|
309
|
+
e.getIncomingTransfers = E;
|
|
310
|
+
function S(a, c, o, u) {
|
|
311
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{address}/module-transactions/", {
|
|
312
|
+
path: { chainId: a, address: c },
|
|
313
|
+
query: o
|
|
314
|
+
}, u);
|
|
315
|
+
}
|
|
316
|
+
e.getModuleTransactions = S;
|
|
317
|
+
function Q(a, c, o, u) {
|
|
318
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{address}/multisig-transactions/", {
|
|
319
|
+
path: { chainId: a, address: c },
|
|
320
|
+
query: o
|
|
321
|
+
}, u);
|
|
322
|
+
}
|
|
323
|
+
e.getMultisigTransactions = Q;
|
|
324
|
+
function $(a, c, o = "usd", u = {}) {
|
|
325
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{address}/balances/{currency}", {
|
|
326
|
+
path: { chainId: a, address: c, currency: o },
|
|
327
|
+
query: u
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
e.getBalances = $;
|
|
331
|
+
function Y() {
|
|
332
|
+
return (0, i.getEndpoint)(s, "/v1/balances/supported-fiat-codes");
|
|
333
|
+
}
|
|
334
|
+
e.getFiatCurrencies = Y;
|
|
335
|
+
function J(a, c) {
|
|
336
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/owners/{address}/safes", { path: { chainId: a, address: c } });
|
|
337
|
+
}
|
|
338
|
+
e.getOwnedSafes = J;
|
|
339
|
+
function z(a) {
|
|
340
|
+
return (0, i.getEndpoint)(s, "/v1/owners/{address}/safes", { path: { address: a } });
|
|
341
|
+
}
|
|
342
|
+
e.getAllOwnedSafes = z;
|
|
343
|
+
function Z(a, c, o = {}) {
|
|
344
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{address}/collectibles", {
|
|
345
|
+
path: { chainId: a, address: c },
|
|
346
|
+
query: o
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
e.getCollectibles = Z;
|
|
350
|
+
function x(a, c, o = {}, u) {
|
|
351
|
+
return (0, i.getEndpoint)(s, "/v2/chains/{chainId}/safes/{address}/collectibles", { path: { chainId: a, address: c }, query: o }, u);
|
|
352
|
+
}
|
|
353
|
+
e.getCollectiblesPage = x;
|
|
354
|
+
function ee(a, c, o = {}, u) {
|
|
355
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/transactions/history", { path: { chainId: a, safe_address: c }, query: o }, u);
|
|
356
|
+
}
|
|
357
|
+
e.getTransactionHistory = ee;
|
|
358
|
+
function ne(a, c, o = {}, u) {
|
|
359
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/transactions/queued", { path: { chainId: a, safe_address: c }, query: o }, u);
|
|
360
|
+
}
|
|
361
|
+
e.getTransactionQueue = ne;
|
|
362
|
+
function te(a, c) {
|
|
363
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/transactions/{transactionId}", {
|
|
364
|
+
path: { chainId: a, transactionId: c }
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
e.getTransactionDetails = te;
|
|
368
|
+
function ie(a, c, o) {
|
|
369
|
+
return (0, i.deleteEndpoint)(s, "/v1/chains/{chainId}/transactions/{safeTxHash}", {
|
|
370
|
+
path: { chainId: a, safeTxHash: c },
|
|
371
|
+
body: { signature: o }
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
e.deleteTransaction = ie;
|
|
375
|
+
function ae(a, c, o) {
|
|
376
|
+
return (0, i.postEndpoint)(s, "/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations", {
|
|
377
|
+
path: { chainId: a, safe_address: c },
|
|
378
|
+
body: o
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
e.postSafeGasEstimation = ae;
|
|
382
|
+
function se(a, c) {
|
|
383
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/nonces", {
|
|
384
|
+
path: { chainId: a, safe_address: c }
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
e.getNonces = se;
|
|
388
|
+
function ce(a, c, o) {
|
|
389
|
+
return (0, i.postEndpoint)(s, "/v1/chains/{chainId}/transactions/{safe_address}/propose", {
|
|
390
|
+
path: { chainId: a, safe_address: c },
|
|
391
|
+
body: o
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
e.proposeTransaction = ce;
|
|
395
|
+
function oe(a, c, o, u) {
|
|
396
|
+
return (0, i.postEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation", {
|
|
397
|
+
path: { chainId: a, safe_address: c },
|
|
398
|
+
body: { data: o, to: u }
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
e.getConfirmationView = oe;
|
|
402
|
+
function re(a) {
|
|
403
|
+
return (0, i.getEndpoint)(s, "/v1/chains", {
|
|
404
|
+
query: a
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
e.getChainsConfig = re;
|
|
408
|
+
function ue(a) {
|
|
409
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}", {
|
|
410
|
+
path: { chainId: a }
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
e.getChainConfig = ue;
|
|
414
|
+
function de(a, c = {}) {
|
|
415
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safe-apps", {
|
|
416
|
+
path: { chainId: a },
|
|
417
|
+
query: c
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
e.getSafeApps = de;
|
|
421
|
+
function le(a) {
|
|
422
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/about/master-copies", {
|
|
423
|
+
path: { chainId: a }
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
e.getMasterCopies = le;
|
|
427
|
+
function fe(a, c, o) {
|
|
428
|
+
return (0, i.postEndpoint)(s, "/v1/chains/{chainId}/data-decoder", {
|
|
429
|
+
path: { chainId: a },
|
|
430
|
+
body: { data: c, to: o }
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
e.getDecodedData = fe;
|
|
434
|
+
function ge(a, c, o) {
|
|
435
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/messages", { path: { chainId: a, safe_address: c }, query: {} }, o);
|
|
436
|
+
}
|
|
437
|
+
e.getSafeMessages = ge;
|
|
438
|
+
function he(a, c) {
|
|
439
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/messages/{message_hash}", {
|
|
440
|
+
path: { chainId: a, message_hash: c }
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
e.getSafeMessage = he;
|
|
444
|
+
function Ee(a, c, o) {
|
|
445
|
+
return (0, i.postEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/messages", {
|
|
446
|
+
path: { chainId: a, safe_address: c },
|
|
447
|
+
body: o
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
e.proposeSafeMessage = Ee;
|
|
451
|
+
function _e(a, c, o) {
|
|
452
|
+
return (0, i.postEndpoint)(s, "/v1/chains/{chainId}/messages/{message_hash}/signatures", {
|
|
453
|
+
path: { chainId: a, message_hash: c },
|
|
454
|
+
body: o
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
e.confirmSafeMessage = _e;
|
|
458
|
+
function Te(a, c = {}) {
|
|
459
|
+
return (0, i.getEndpoint)(s, "/v2/chains/{chainId}/delegates", {
|
|
460
|
+
path: { chainId: a },
|
|
461
|
+
query: c
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
e.getDelegates = Te;
|
|
465
|
+
function ve(a) {
|
|
466
|
+
return (0, i.postEndpoint)(s, "/v1/register/notifications", {
|
|
467
|
+
body: a
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
e.registerDevice = ve;
|
|
471
|
+
function Ae(a, c, o) {
|
|
472
|
+
return (0, i.deleteEndpoint)(s, "/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}", {
|
|
473
|
+
path: { chainId: a, safe_address: c, uuid: o }
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
e.unregisterSafe = Ae;
|
|
477
|
+
function Ie(a, c) {
|
|
478
|
+
return (0, i.deleteEndpoint)(s, "/v1/chains/{chainId}/notifications/devices/{uuid}", {
|
|
479
|
+
path: { chainId: a, uuid: c }
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
e.unregisterDevice = Ie;
|
|
483
|
+
function Se(a, c, o, u) {
|
|
484
|
+
return (0, i.postEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/emails", {
|
|
485
|
+
path: { chainId: a, safe_address: c },
|
|
486
|
+
body: o,
|
|
487
|
+
headers: u
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
e.registerEmail = Se;
|
|
491
|
+
function ye(a, c, o, u, A) {
|
|
492
|
+
return (0, i.putEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
|
|
493
|
+
path: { chainId: a, safe_address: c, signer: o },
|
|
494
|
+
body: u,
|
|
495
|
+
headers: A
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
e.changeEmail = ye;
|
|
499
|
+
function me(a, c, o) {
|
|
500
|
+
return (0, i.postEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend", {
|
|
501
|
+
path: { chainId: a, safe_address: c, signer: o },
|
|
502
|
+
body: ""
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
e.resendEmailVerificationCode = me;
|
|
506
|
+
function Oe(a, c, o, u) {
|
|
507
|
+
return (0, i.putEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify", {
|
|
508
|
+
path: { chainId: a, safe_address: c, signer: o },
|
|
509
|
+
body: u
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
e.verifyEmail = Oe;
|
|
513
|
+
function Ne(a, c, o, u) {
|
|
514
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
|
|
515
|
+
path: { chainId: a, safe_address: c, signer: o },
|
|
516
|
+
headers: u
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
e.getRegisteredEmail = Ne;
|
|
520
|
+
function Ce(a, c, o, u) {
|
|
521
|
+
return (0, i.deleteEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
|
|
522
|
+
path: { chainId: a, safe_address: c, signer: o },
|
|
523
|
+
headers: u
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
e.deleteRegisteredEmail = Ce;
|
|
527
|
+
function be(a, c, o) {
|
|
528
|
+
return (0, i.postEndpoint)(s, "/v1/chains/{chainId}/safes/{safe_address}/recovery", {
|
|
529
|
+
path: { chainId: a, safe_address: c },
|
|
530
|
+
body: o
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
e.registerRecoveryModule = be;
|
|
534
|
+
function De(a) {
|
|
535
|
+
return (0, i.deleteEndpoint)(s, "/v1/subscriptions", { query: a });
|
|
536
|
+
}
|
|
537
|
+
e.unsubscribeSingle = De;
|
|
538
|
+
function Re(a) {
|
|
539
|
+
return (0, i.deleteEndpoint)(s, "/v1/subscriptions/all", { query: a });
|
|
540
|
+
}
|
|
541
|
+
e.unsubscribeAll = Re;
|
|
542
|
+
function we(a, c) {
|
|
543
|
+
return (0, i.getEndpoint)(s, "/v1/safes", {
|
|
544
|
+
query: Object.assign(Object.assign({}, c), { safes: a.join(",") })
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
e.getSafeOverviews = we;
|
|
548
|
+
function Pe(a, c) {
|
|
549
|
+
return (0, i.getEndpoint)(s, "/v1/chains/{chainId}/contracts/{contractAddress}", {
|
|
550
|
+
path: {
|
|
551
|
+
chainId: a,
|
|
552
|
+
contractAddress: c
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
e.getContract = Pe;
|
|
557
|
+
function Me() {
|
|
558
|
+
return (0, i.getEndpoint)(s, "/v1/auth/nonce", { credentials: "include" });
|
|
559
|
+
}
|
|
560
|
+
e.getAuthNonce = Me;
|
|
561
|
+
function pe(a) {
|
|
562
|
+
return (0, i.postEndpoint)(s, "/v1/auth/verify", {
|
|
563
|
+
body: a,
|
|
564
|
+
credentials: "include"
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
e.verifyAuth = pe;
|
|
568
|
+
function Le(a) {
|
|
569
|
+
return (0, i.postEndpoint)(s, "/v1/accounts", {
|
|
570
|
+
body: a,
|
|
571
|
+
credentials: "include"
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
e.createAccount = Le;
|
|
575
|
+
function Be(a) {
|
|
576
|
+
return (0, i.getEndpoint)(s, "/v1/accounts/{address}", {
|
|
577
|
+
path: { address: a },
|
|
578
|
+
credentials: "include"
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
e.getAccount = Be;
|
|
582
|
+
function He(a) {
|
|
583
|
+
return (0, i.deleteEndpoint)(s, "/v1/accounts/{address}", {
|
|
584
|
+
path: { address: a },
|
|
585
|
+
credentials: "include"
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
e.deleteAccount = He;
|
|
589
|
+
function Ue() {
|
|
590
|
+
return (0, i.getEndpoint)(s, "/v1/accounts/data-types");
|
|
591
|
+
}
|
|
592
|
+
e.getAccountDataTypes = Ue;
|
|
593
|
+
function je(a) {
|
|
594
|
+
return (0, i.getEndpoint)(s, "/v1/accounts/{address}/data-settings", {
|
|
595
|
+
path: { address: a },
|
|
596
|
+
credentials: "include"
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
e.getAccountDataSettings = je;
|
|
600
|
+
function Ge(a, c) {
|
|
601
|
+
return (0, i.putEndpoint)(s, "/v1/accounts/{address}/data-settings", {
|
|
602
|
+
path: { address: a },
|
|
603
|
+
body: c,
|
|
604
|
+
credentials: "include"
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
e.putAccountDataSettings = Ge;
|
|
608
|
+
})(Qe);
|
|
609
|
+
class sn {
|
|
610
|
+
constructor(n) {
|
|
611
|
+
this.communicator = n;
|
|
612
|
+
}
|
|
613
|
+
async getBySafeTxHash(n) {
|
|
614
|
+
if (!n)
|
|
615
|
+
throw new Error("Invalid safeTxHash");
|
|
616
|
+
return (await this.communicator.send(f.getTxBySafeTxHash, { safeTxHash: n })).data;
|
|
617
|
+
}
|
|
618
|
+
async signMessage(n) {
|
|
619
|
+
const t = {
|
|
620
|
+
message: n
|
|
621
|
+
};
|
|
622
|
+
return (await this.communicator.send(f.signMessage, t)).data;
|
|
623
|
+
}
|
|
624
|
+
async signTypedMessage(n) {
|
|
625
|
+
if (!p(n))
|
|
626
|
+
throw new Error("Invalid typed data");
|
|
627
|
+
return (await this.communicator.send(f.signTypedMessage, { typedData: n })).data;
|
|
628
|
+
}
|
|
629
|
+
async send({ txs: n, params: t }) {
|
|
630
|
+
if (!n || !n.length)
|
|
631
|
+
throw new Error("No transactions were passed");
|
|
632
|
+
const i = {
|
|
633
|
+
txs: n,
|
|
634
|
+
params: t
|
|
635
|
+
};
|
|
636
|
+
return (await this.communicator.send(f.sendTransactions, i)).data;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
const h = {
|
|
640
|
+
eth_call: "eth_call",
|
|
641
|
+
eth_gasPrice: "eth_gasPrice",
|
|
642
|
+
eth_getLogs: "eth_getLogs",
|
|
643
|
+
eth_getBalance: "eth_getBalance",
|
|
644
|
+
eth_getCode: "eth_getCode",
|
|
645
|
+
eth_getBlockByHash: "eth_getBlockByHash",
|
|
646
|
+
eth_getBlockByNumber: "eth_getBlockByNumber",
|
|
647
|
+
eth_getStorageAt: "eth_getStorageAt",
|
|
648
|
+
eth_getTransactionByHash: "eth_getTransactionByHash",
|
|
649
|
+
eth_getTransactionReceipt: "eth_getTransactionReceipt",
|
|
650
|
+
eth_getTransactionCount: "eth_getTransactionCount",
|
|
651
|
+
eth_estimateGas: "eth_estimateGas",
|
|
652
|
+
safe_setSettings: "safe_setSettings"
|
|
653
|
+
}, v = {
|
|
654
|
+
defaultBlockParam: (e = "latest") => e,
|
|
655
|
+
returnFullTxObjectParam: (e = !1) => e,
|
|
656
|
+
blockNumberToHex: (e) => Number.isInteger(e) ? `0x${e.toString(16)}` : e
|
|
657
|
+
};
|
|
658
|
+
class cn {
|
|
659
|
+
constructor(n) {
|
|
660
|
+
this.communicator = n, this.call = this.buildRequest({
|
|
661
|
+
call: h.eth_call,
|
|
662
|
+
formatters: [null, v.defaultBlockParam]
|
|
663
|
+
}), this.getBalance = this.buildRequest({
|
|
664
|
+
call: h.eth_getBalance,
|
|
665
|
+
formatters: [null, v.defaultBlockParam]
|
|
666
|
+
}), this.getCode = this.buildRequest({
|
|
667
|
+
call: h.eth_getCode,
|
|
668
|
+
formatters: [null, v.defaultBlockParam]
|
|
669
|
+
}), this.getStorageAt = this.buildRequest({
|
|
670
|
+
call: h.eth_getStorageAt,
|
|
671
|
+
formatters: [null, v.blockNumberToHex, v.defaultBlockParam]
|
|
672
|
+
}), this.getPastLogs = this.buildRequest({
|
|
673
|
+
call: h.eth_getLogs
|
|
674
|
+
}), this.getBlockByHash = this.buildRequest({
|
|
675
|
+
call: h.eth_getBlockByHash,
|
|
676
|
+
formatters: [null, v.returnFullTxObjectParam]
|
|
677
|
+
}), this.getBlockByNumber = this.buildRequest({
|
|
678
|
+
call: h.eth_getBlockByNumber,
|
|
679
|
+
formatters: [v.blockNumberToHex, v.returnFullTxObjectParam]
|
|
680
|
+
}), this.getTransactionByHash = this.buildRequest({
|
|
681
|
+
call: h.eth_getTransactionByHash
|
|
682
|
+
}), this.getTransactionReceipt = this.buildRequest({
|
|
683
|
+
call: h.eth_getTransactionReceipt
|
|
684
|
+
}), this.getTransactionCount = this.buildRequest({
|
|
685
|
+
call: h.eth_getTransactionCount,
|
|
686
|
+
formatters: [null, v.defaultBlockParam]
|
|
687
|
+
}), this.getGasPrice = this.buildRequest({
|
|
688
|
+
call: h.eth_gasPrice
|
|
689
|
+
}), this.getEstimateGas = (t) => this.buildRequest({
|
|
690
|
+
call: h.eth_estimateGas
|
|
691
|
+
})([t]), this.setSafeSettings = this.buildRequest({
|
|
692
|
+
call: h.safe_setSettings
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
buildRequest(n) {
|
|
696
|
+
const { call: t, formatters: i } = n;
|
|
697
|
+
return async (r) => {
|
|
698
|
+
i && Array.isArray(r) && i.forEach((l, g) => {
|
|
699
|
+
l && (r[g] = l(r[g]));
|
|
700
|
+
});
|
|
701
|
+
const s = {
|
|
702
|
+
call: t,
|
|
703
|
+
params: r || []
|
|
704
|
+
};
|
|
705
|
+
return (await this.communicator.send(f.rpcCall, s)).data;
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
const on = "0x1626ba7e", rn = "0x20c13b0b", R = 4001;
|
|
710
|
+
class O extends Error {
|
|
711
|
+
constructor(n, t, i) {
|
|
712
|
+
super(n), this.code = t, this.data = i, Object.setPrototypeOf(this, O.prototype);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
class K {
|
|
716
|
+
constructor(n) {
|
|
717
|
+
this.communicator = n;
|
|
718
|
+
}
|
|
719
|
+
async getPermissions() {
|
|
720
|
+
return (await this.communicator.send(f.wallet_getPermissions, void 0)).data;
|
|
721
|
+
}
|
|
722
|
+
async requestPermissions(n) {
|
|
723
|
+
if (!this.isPermissionRequestValid(n))
|
|
724
|
+
throw new O("Permissions request is invalid", R);
|
|
725
|
+
try {
|
|
726
|
+
return (await this.communicator.send(f.wallet_requestPermissions, n)).data;
|
|
727
|
+
} catch {
|
|
728
|
+
throw new O("Permissions rejected", R);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
isPermissionRequestValid(n) {
|
|
732
|
+
return n.every((t) => typeof t == "object" ? Object.keys(t).every((i) => !!Object.values(D).includes(i)) : !1);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
const M = (e, n) => n.some((t) => t.parentCapability === e), un = () => (e, n, t) => {
|
|
736
|
+
const i = t.value;
|
|
737
|
+
return t.value = async function() {
|
|
738
|
+
const r = new K(this.communicator);
|
|
739
|
+
let s = await r.getPermissions();
|
|
740
|
+
if (M(n, s) || (s = await r.requestPermissions([{ [n]: {} }])), !M(n, s))
|
|
741
|
+
throw new O("Permissions rejected", R);
|
|
742
|
+
return i.apply(this);
|
|
743
|
+
}, t;
|
|
744
|
+
};
|
|
745
|
+
var dn = function(e, n, t, i) {
|
|
746
|
+
var r = arguments.length, s = r < 3 ? n : i === null ? i = Object.getOwnPropertyDescriptor(n, t) : i, d;
|
|
747
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
748
|
+
s = Reflect.decorate(e, n, t, i);
|
|
749
|
+
else
|
|
750
|
+
for (var l = e.length - 1; l >= 0; l--)
|
|
751
|
+
(d = e[l]) && (s = (r < 3 ? d(s) : r > 3 ? d(n, t, s) : d(n, t)) || s);
|
|
752
|
+
return r > 3 && s && Object.defineProperty(n, t, s), s;
|
|
753
|
+
};
|
|
754
|
+
class X {
|
|
755
|
+
constructor(n) {
|
|
756
|
+
this.communicator = n;
|
|
757
|
+
}
|
|
758
|
+
async getChainInfo() {
|
|
759
|
+
return (await this.communicator.send(f.getChainInfo, void 0)).data;
|
|
760
|
+
}
|
|
761
|
+
async getInfo() {
|
|
762
|
+
return (await this.communicator.send(f.getSafeInfo, void 0)).data;
|
|
763
|
+
}
|
|
764
|
+
// There is a possibility that this method will change because we may add pagination to the endpoint
|
|
765
|
+
async experimental_getBalances({ currency: n = "usd" } = {}) {
|
|
766
|
+
return (await this.communicator.send(f.getSafeBalances, {
|
|
767
|
+
currency: n
|
|
768
|
+
})).data;
|
|
769
|
+
}
|
|
770
|
+
async check1271Signature(n, t = "0x") {
|
|
771
|
+
const i = await this.getInfo(), r = P({
|
|
772
|
+
abi: [
|
|
773
|
+
{
|
|
774
|
+
constant: !1,
|
|
775
|
+
inputs: [
|
|
776
|
+
{
|
|
777
|
+
name: "_dataHash",
|
|
778
|
+
type: "bytes32"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
name: "_signature",
|
|
782
|
+
type: "bytes"
|
|
783
|
+
}
|
|
784
|
+
],
|
|
785
|
+
name: "isValidSignature",
|
|
786
|
+
outputs: [
|
|
787
|
+
{
|
|
788
|
+
name: "",
|
|
789
|
+
type: "bytes4"
|
|
790
|
+
}
|
|
791
|
+
],
|
|
792
|
+
payable: !1,
|
|
793
|
+
stateMutability: "nonpayable",
|
|
794
|
+
type: "function"
|
|
795
|
+
}
|
|
796
|
+
],
|
|
797
|
+
functionName: "isValidSignature",
|
|
798
|
+
args: [n, t]
|
|
799
|
+
}), s = {
|
|
800
|
+
call: h.eth_call,
|
|
801
|
+
params: [
|
|
802
|
+
{
|
|
803
|
+
to: i.safeAddress,
|
|
804
|
+
data: r
|
|
805
|
+
},
|
|
806
|
+
"latest"
|
|
807
|
+
]
|
|
808
|
+
};
|
|
809
|
+
try {
|
|
810
|
+
return (await this.communicator.send(f.rpcCall, s)).data.slice(0, 10).toLowerCase() === on;
|
|
811
|
+
} catch {
|
|
812
|
+
return !1;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
async check1271SignatureBytes(n, t = "0x") {
|
|
816
|
+
const i = await this.getInfo(), r = P({
|
|
817
|
+
abi: [
|
|
818
|
+
{
|
|
819
|
+
constant: !1,
|
|
820
|
+
inputs: [
|
|
821
|
+
{
|
|
822
|
+
name: "_data",
|
|
823
|
+
type: "bytes"
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
name: "_signature",
|
|
827
|
+
type: "bytes"
|
|
828
|
+
}
|
|
829
|
+
],
|
|
830
|
+
name: "isValidSignature",
|
|
831
|
+
outputs: [
|
|
832
|
+
{
|
|
833
|
+
name: "",
|
|
834
|
+
type: "bytes4"
|
|
835
|
+
}
|
|
836
|
+
],
|
|
837
|
+
payable: !1,
|
|
838
|
+
stateMutability: "nonpayable",
|
|
839
|
+
type: "function"
|
|
840
|
+
}
|
|
841
|
+
],
|
|
842
|
+
functionName: "isValidSignature",
|
|
843
|
+
args: [n, t]
|
|
844
|
+
}), s = {
|
|
845
|
+
call: h.eth_call,
|
|
846
|
+
params: [
|
|
847
|
+
{
|
|
848
|
+
to: i.safeAddress,
|
|
849
|
+
data: r
|
|
850
|
+
},
|
|
851
|
+
"latest"
|
|
852
|
+
]
|
|
853
|
+
};
|
|
854
|
+
try {
|
|
855
|
+
return (await this.communicator.send(f.rpcCall, s)).data.slice(0, 10).toLowerCase() === rn;
|
|
856
|
+
} catch {
|
|
857
|
+
return !1;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
calculateMessageHash(n) {
|
|
861
|
+
return We(n);
|
|
862
|
+
}
|
|
863
|
+
calculateTypedMessageHash(n) {
|
|
864
|
+
const t = typeof n.domain.chainId == "object" ? n.domain.chainId.toNumber() : Number(n.domain.chainId);
|
|
865
|
+
let i = n.primaryType;
|
|
866
|
+
if (!i) {
|
|
867
|
+
const r = Object.values(n.types), s = Object.keys(n.types).filter((d) => r.every((l) => l.every(({ type: g }) => g.replace("[", "").replace("]", "") !== d)));
|
|
868
|
+
if (s.length === 0 || s.length > 1)
|
|
869
|
+
throw new Error("Please specify primaryType");
|
|
870
|
+
i = s[0];
|
|
871
|
+
}
|
|
872
|
+
return Ve({
|
|
873
|
+
message: n.message,
|
|
874
|
+
domain: {
|
|
875
|
+
...n.domain,
|
|
876
|
+
chainId: t,
|
|
877
|
+
verifyingContract: n.domain.verifyingContract,
|
|
878
|
+
salt: n.domain.salt
|
|
879
|
+
},
|
|
880
|
+
types: n.types,
|
|
881
|
+
primaryType: i
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
async getOffChainSignature(n) {
|
|
885
|
+
return (await this.communicator.send(f.getOffChainSignature, n)).data;
|
|
886
|
+
}
|
|
887
|
+
async isMessageSigned(n, t = "0x") {
|
|
888
|
+
let i;
|
|
889
|
+
if (typeof n == "string" && (i = async () => {
|
|
890
|
+
const r = this.calculateMessageHash(n);
|
|
891
|
+
return await this.isMessageHashSigned(r, t);
|
|
892
|
+
}), p(n) && (i = async () => {
|
|
893
|
+
const r = this.calculateTypedMessageHash(n);
|
|
894
|
+
return await this.isMessageHashSigned(r, t);
|
|
895
|
+
}), i)
|
|
896
|
+
return await i();
|
|
897
|
+
throw new Error("Invalid message type");
|
|
898
|
+
}
|
|
899
|
+
async isMessageHashSigned(n, t = "0x") {
|
|
900
|
+
const i = [this.check1271Signature.bind(this), this.check1271SignatureBytes.bind(this)];
|
|
901
|
+
for (const r of i)
|
|
902
|
+
if (await r(n, t))
|
|
903
|
+
return !0;
|
|
904
|
+
return !1;
|
|
905
|
+
}
|
|
906
|
+
async getEnvironmentInfo() {
|
|
907
|
+
return (await this.communicator.send(f.getEnvironmentInfo, void 0)).data;
|
|
908
|
+
}
|
|
909
|
+
async requestAddressBook() {
|
|
910
|
+
return (await this.communicator.send(f.requestAddressBook, void 0)).data;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
dn([
|
|
914
|
+
un()
|
|
915
|
+
], X.prototype, "requestAddressBook", null);
|
|
916
|
+
class ln {
|
|
917
|
+
constructor(n = {}) {
|
|
918
|
+
const { allowedDomains: t = null, debug: i = !1 } = n;
|
|
919
|
+
this.communicator = new Xe(t, i), this.eth = new cn(this.communicator), this.txs = new sn(this.communicator), this.safe = new X(this.communicator), this.wallet = new K(this.communicator);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
const hn = ln;
|
|
923
|
+
export {
|
|
924
|
+
N as MessageFormatter,
|
|
925
|
+
f as Methods,
|
|
926
|
+
h as RPC_CALLS,
|
|
927
|
+
D as RestrictedMethods,
|
|
928
|
+
hn as default,
|
|
929
|
+
qe as getSDKVersion,
|
|
930
|
+
p as isObjectEIP712TypedData
|
|
931
|
+
};
|