@reown/appkit-cdn 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appkit.js +11430 -0
- package/dist/appkit.js.map +1 -0
- package/package.json +11 -8
- package/dist/W3MFrameProviderSingleton--HSg3nEz.js +0 -66075
- package/dist/W3MFrameProviderSingleton-SRLqDWgO.cjs +0 -11301
- package/dist/ethers.cjs +0 -1
- package/dist/ethers.js +0 -17811
- package/dist/hooks.module-B_N3JvEN.js +0 -763
- package/dist/hooks.module-CmpdbiRp.cjs +0 -1
- package/dist/index-2d-aRmQF.js +0 -250
- package/dist/index-3Tles8GF.js +0 -2055
- package/dist/index-3jinrfKR.cjs +0 -1
- package/dist/index-BBwc05vi.cjs +0 -64
- package/dist/index-BmU807V9.cjs +0 -7
- package/dist/index-CDAn9JfZ.cjs +0 -47
- package/dist/index-CIzqgU5q.cjs +0 -1
- package/dist/index-CJq05jyL.js +0 -129
- package/dist/index-CO1X8Cxc.js +0 -254
- package/dist/index-CQ4-w5mp.cjs +0 -1
- package/dist/index-DDwvGjhD.js +0 -161
- package/dist/index-DSzXjBUF.js +0 -3175
- package/dist/index-Dlv7g3Jh.js +0 -9034
- package/dist/index-_Sw9VWRf.js +0 -930
- package/dist/index-sfhFJZJt.cjs +0 -1
- package/dist/index-v7RnFZTP.cjs +0 -41
- package/dist/index.es-CXs4mA1g.cjs +0 -43
- package/dist/index.es-TVTbcEaP.js +0 -11685
- package/dist/metamask-sdk-CaVruToV.js +0 -40484
- package/dist/metamask-sdk-CsUP8MhX.cjs +0 -217
- package/dist/native-BiFy-msx.js +0 -16
- package/dist/native-gXKXtBE3.cjs +0 -1
- package/dist/w3m-modal-Dc1peoIh.cjs +0 -150
- package/dist/w3m-modal-DwtACkc9.js +0 -276
- package/dist/wagmi-GgXheXd8.cjs +0 -46
- package/dist/wagmi-IogORaa7.js +0 -18186
- package/dist/wagmi.cjs +0 -1
- package/dist/wagmi.js +0 -9
package/dist/index-CO1X8Cxc.js
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { u, w as h, c1 as R } from "./W3MFrameProviderSingleton--HSg3nEz.js";
|
|
2
|
-
const n = u({ history: ["ConnectWallet"], view: "ConnectWallet", data: void 0 }), x = { state: n, subscribe(e) {
|
|
3
|
-
return h(n, () => e(n));
|
|
4
|
-
}, push(e, t) {
|
|
5
|
-
e !== n.view && (n.view = e, t && (n.data = t), n.history.push(e));
|
|
6
|
-
}, reset(e) {
|
|
7
|
-
n.view = e, n.history = [e];
|
|
8
|
-
}, replace(e) {
|
|
9
|
-
n.history.length > 1 && (n.history[n.history.length - 1] = e, n.view = e);
|
|
10
|
-
}, goBack() {
|
|
11
|
-
if (n.history.length > 1) {
|
|
12
|
-
n.history.pop();
|
|
13
|
-
const [e] = n.history.slice(-1);
|
|
14
|
-
n.view = e;
|
|
15
|
-
}
|
|
16
|
-
}, setData(e) {
|
|
17
|
-
n.data = e;
|
|
18
|
-
} }, r = { WALLETCONNECT_DEEPLINK_CHOICE: "WALLETCONNECT_DEEPLINK_CHOICE", WCM_VERSION: "WCM_VERSION", RECOMMENDED_WALLET_AMOUNT: 9, isMobile() {
|
|
19
|
-
return typeof window < "u" ? !!(window.matchMedia("(pointer:coarse)").matches || /Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)) : !1;
|
|
20
|
-
}, isAndroid() {
|
|
21
|
-
return r.isMobile() && navigator.userAgent.toLowerCase().includes("android");
|
|
22
|
-
}, isIos() {
|
|
23
|
-
const e = navigator.userAgent.toLowerCase();
|
|
24
|
-
return r.isMobile() && (e.includes("iphone") || e.includes("ipad"));
|
|
25
|
-
}, isHttpUrl(e) {
|
|
26
|
-
return e.startsWith("http://") || e.startsWith("https://");
|
|
27
|
-
}, isArray(e) {
|
|
28
|
-
return Array.isArray(e) && e.length > 0;
|
|
29
|
-
}, formatNativeUrl(e, t, s) {
|
|
30
|
-
if (r.isHttpUrl(e))
|
|
31
|
-
return this.formatUniversalUrl(e, t, s);
|
|
32
|
-
let o = e;
|
|
33
|
-
o.includes("://") || (o = e.replaceAll("/", "").replaceAll(":", ""), o = `${o}://`), o.endsWith("/") || (o = `${o}/`), this.setWalletConnectDeepLink(o, s);
|
|
34
|
-
const i = encodeURIComponent(t);
|
|
35
|
-
return `${o}wc?uri=${i}`;
|
|
36
|
-
}, formatUniversalUrl(e, t, s) {
|
|
37
|
-
if (!r.isHttpUrl(e))
|
|
38
|
-
return this.formatNativeUrl(e, t, s);
|
|
39
|
-
let o = e;
|
|
40
|
-
o.endsWith("/") || (o = `${o}/`), this.setWalletConnectDeepLink(o, s);
|
|
41
|
-
const i = encodeURIComponent(t);
|
|
42
|
-
return `${o}wc?uri=${i}`;
|
|
43
|
-
}, async wait(e) {
|
|
44
|
-
return new Promise((t) => {
|
|
45
|
-
setTimeout(t, e);
|
|
46
|
-
});
|
|
47
|
-
}, openHref(e, t) {
|
|
48
|
-
window.open(e, t, "noreferrer noopener");
|
|
49
|
-
}, setWalletConnectDeepLink(e, t) {
|
|
50
|
-
try {
|
|
51
|
-
localStorage.setItem(r.WALLETCONNECT_DEEPLINK_CHOICE, JSON.stringify({ href: e, name: t }));
|
|
52
|
-
} catch {
|
|
53
|
-
console.info("Unable to set WalletConnect deep link");
|
|
54
|
-
}
|
|
55
|
-
}, setWalletConnectAndroidDeepLink(e) {
|
|
56
|
-
try {
|
|
57
|
-
const [t] = e.split("?");
|
|
58
|
-
localStorage.setItem(r.WALLETCONNECT_DEEPLINK_CHOICE, JSON.stringify({ href: t, name: "Android" }));
|
|
59
|
-
} catch {
|
|
60
|
-
console.info("Unable to set WalletConnect android deep link");
|
|
61
|
-
}
|
|
62
|
-
}, removeWalletConnectDeepLink() {
|
|
63
|
-
try {
|
|
64
|
-
localStorage.removeItem(r.WALLETCONNECT_DEEPLINK_CHOICE);
|
|
65
|
-
} catch {
|
|
66
|
-
console.info("Unable to remove WalletConnect deep link");
|
|
67
|
-
}
|
|
68
|
-
}, setModalVersionInStorage() {
|
|
69
|
-
try {
|
|
70
|
-
typeof localStorage < "u" && localStorage.setItem(r.WCM_VERSION, "2.6.2");
|
|
71
|
-
} catch {
|
|
72
|
-
console.info("Unable to set Web3Modal version in storage");
|
|
73
|
-
}
|
|
74
|
-
}, getWalletRouterData() {
|
|
75
|
-
var e;
|
|
76
|
-
const t = (e = x.state.data) == null ? void 0 : e.Wallet;
|
|
77
|
-
if (!t)
|
|
78
|
-
throw new Error('Missing "Wallet" view data');
|
|
79
|
-
return t;
|
|
80
|
-
} }, V = typeof location < "u" && (location.hostname.includes("localhost") || location.protocol.includes("https")), a = u({ enabled: V, userSessionId: "", events: [], connectedWalletId: void 0 }), H = { state: a, subscribe(e) {
|
|
81
|
-
return h(a.events, () => e(R(a.events[a.events.length - 1])));
|
|
82
|
-
}, initialize() {
|
|
83
|
-
a.enabled && typeof (crypto == null ? void 0 : crypto.randomUUID) < "u" && (a.userSessionId = crypto.randomUUID());
|
|
84
|
-
}, setConnectedWalletId(e) {
|
|
85
|
-
a.connectedWalletId = e;
|
|
86
|
-
}, click(e) {
|
|
87
|
-
if (a.enabled) {
|
|
88
|
-
const t = { type: "CLICK", name: e.name, userSessionId: a.userSessionId, timestamp: Date.now(), data: e };
|
|
89
|
-
a.events.push(t);
|
|
90
|
-
}
|
|
91
|
-
}, track(e) {
|
|
92
|
-
if (a.enabled) {
|
|
93
|
-
const t = { type: "TRACK", name: e.name, userSessionId: a.userSessionId, timestamp: Date.now(), data: e };
|
|
94
|
-
a.events.push(t);
|
|
95
|
-
}
|
|
96
|
-
}, view(e) {
|
|
97
|
-
if (a.enabled) {
|
|
98
|
-
const t = { type: "VIEW", name: e.name, userSessionId: a.userSessionId, timestamp: Date.now(), data: e };
|
|
99
|
-
a.events.push(t);
|
|
100
|
-
}
|
|
101
|
-
} }, d = u({ chains: void 0, walletConnectUri: void 0, isAuth: !1, isCustomDesktop: !1, isCustomMobile: !1, isDataLoaded: !1, isUiLoaded: !1 }), c = { state: d, subscribe(e) {
|
|
102
|
-
return h(d, () => e(d));
|
|
103
|
-
}, setChains(e) {
|
|
104
|
-
d.chains = e;
|
|
105
|
-
}, setWalletConnectUri(e) {
|
|
106
|
-
d.walletConnectUri = e;
|
|
107
|
-
}, setIsCustomDesktop(e) {
|
|
108
|
-
d.isCustomDesktop = e;
|
|
109
|
-
}, setIsCustomMobile(e) {
|
|
110
|
-
d.isCustomMobile = e;
|
|
111
|
-
}, setIsDataLoaded(e) {
|
|
112
|
-
d.isDataLoaded = e;
|
|
113
|
-
}, setIsUiLoaded(e) {
|
|
114
|
-
d.isUiLoaded = e;
|
|
115
|
-
}, setIsAuth(e) {
|
|
116
|
-
d.isAuth = e;
|
|
117
|
-
} }, w = u({ projectId: "", mobileWallets: void 0, desktopWallets: void 0, walletImages: void 0, chains: void 0, enableAuthMode: !1, enableExplorer: !0, explorerExcludedWalletIds: void 0, explorerRecommendedWalletIds: void 0, termsOfServiceUrl: void 0, privacyPolicyUrl: void 0 }), v = { state: w, subscribe(e) {
|
|
118
|
-
return h(w, () => e(w));
|
|
119
|
-
}, setConfig(e) {
|
|
120
|
-
var t, s;
|
|
121
|
-
H.initialize(), c.setChains(e.chains), c.setIsAuth(!!e.enableAuthMode), c.setIsCustomMobile(!!((t = e.mobileWallets) != null && t.length)), c.setIsCustomDesktop(!!((s = e.desktopWallets) != null && s.length)), r.setModalVersionInStorage(), Object.assign(w, e);
|
|
122
|
-
} };
|
|
123
|
-
var B = Object.defineProperty, j = Object.getOwnPropertySymbols, K = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable, D = (e, t, s) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, J = (e, t) => {
|
|
124
|
-
for (var s in t || (t = {}))
|
|
125
|
-
K.call(t, s) && D(e, s, t[s]);
|
|
126
|
-
if (j)
|
|
127
|
-
for (var s of j(t))
|
|
128
|
-
z.call(t, s) && D(e, s, t[s]);
|
|
129
|
-
return e;
|
|
130
|
-
};
|
|
131
|
-
const O = "https://explorer-api.walletconnect.com", E = "wcm", A = "js-2.6.2";
|
|
132
|
-
async function W(e, t) {
|
|
133
|
-
const s = J({ sdkType: E, sdkVersion: A }, t), o = new URL(e, O);
|
|
134
|
-
return o.searchParams.append("projectId", v.state.projectId), Object.entries(s).forEach(([i, l]) => {
|
|
135
|
-
l && o.searchParams.append(i, String(l));
|
|
136
|
-
}), (await fetch(o)).json();
|
|
137
|
-
}
|
|
138
|
-
const m = { async getDesktopListings(e) {
|
|
139
|
-
return W("/w3m/v1/getDesktopListings", e);
|
|
140
|
-
}, async getMobileListings(e) {
|
|
141
|
-
return W("/w3m/v1/getMobileListings", e);
|
|
142
|
-
}, async getInjectedListings(e) {
|
|
143
|
-
return W("/w3m/v1/getInjectedListings", e);
|
|
144
|
-
}, async getAllListings(e) {
|
|
145
|
-
return W("/w3m/v1/getAllListings", e);
|
|
146
|
-
}, getWalletImageUrl(e) {
|
|
147
|
-
return `${O}/w3m/v1/getWalletImage/${e}?projectId=${v.state.projectId}&sdkType=${E}&sdkVersion=${A}`;
|
|
148
|
-
}, getAssetImageUrl(e) {
|
|
149
|
-
return `${O}/w3m/v1/getAssetImage/${e}?projectId=${v.state.projectId}&sdkType=${E}&sdkVersion=${A}`;
|
|
150
|
-
} };
|
|
151
|
-
var q = Object.defineProperty, k = Object.getOwnPropertySymbols, F = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable, S = (e, t, s) => t in e ? q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, Q = (e, t) => {
|
|
152
|
-
for (var s in t || (t = {}))
|
|
153
|
-
F.call(t, s) && S(e, s, t[s]);
|
|
154
|
-
if (k)
|
|
155
|
-
for (var s of k(t))
|
|
156
|
-
G.call(t, s) && S(e, s, t[s]);
|
|
157
|
-
return e;
|
|
158
|
-
};
|
|
159
|
-
const N = r.isMobile(), p = u({ wallets: { listings: [], total: 0, page: 1 }, search: { listings: [], total: 0, page: 1 }, recomendedWallets: [] }), ne = { state: p, async getRecomendedWallets() {
|
|
160
|
-
const { explorerRecommendedWalletIds: e, explorerExcludedWalletIds: t } = v.state;
|
|
161
|
-
if (e === "NONE" || t === "ALL" && !e)
|
|
162
|
-
return p.recomendedWallets;
|
|
163
|
-
if (r.isArray(e)) {
|
|
164
|
-
const s = { recommendedIds: e.join(",") }, { listings: o } = await m.getAllListings(s), i = Object.values(o);
|
|
165
|
-
i.sort((l, b) => {
|
|
166
|
-
const y = e.indexOf(l.id), C = e.indexOf(b.id);
|
|
167
|
-
return y - C;
|
|
168
|
-
}), p.recomendedWallets = i;
|
|
169
|
-
} else {
|
|
170
|
-
const { chains: s, isAuth: o } = c.state, i = s == null ? void 0 : s.join(","), l = r.isArray(t), b = { page: 1, sdks: o ? "auth_v1" : void 0, entries: r.RECOMMENDED_WALLET_AMOUNT, chains: i, version: 2, excludedIds: l ? t.join(",") : void 0 }, { listings: y } = N ? await m.getMobileListings(b) : await m.getDesktopListings(b);
|
|
171
|
-
p.recomendedWallets = Object.values(y);
|
|
172
|
-
}
|
|
173
|
-
return p.recomendedWallets;
|
|
174
|
-
}, async getWallets(e) {
|
|
175
|
-
const t = Q({}, e), { explorerRecommendedWalletIds: s, explorerExcludedWalletIds: o } = v.state, { recomendedWallets: i } = p;
|
|
176
|
-
if (o === "ALL")
|
|
177
|
-
return p.wallets;
|
|
178
|
-
i.length ? t.excludedIds = i.map(($) => $.id).join(",") : r.isArray(s) && (t.excludedIds = s.join(",")), r.isArray(o) && (t.excludedIds = [t.excludedIds, o].filter(Boolean).join(",")), c.state.isAuth && (t.sdks = "auth_v1");
|
|
179
|
-
const { page: l, search: b } = e, { listings: y, total: C } = N ? await m.getMobileListings(t) : await m.getDesktopListings(t), U = Object.values(y), M = b ? "search" : "wallets";
|
|
180
|
-
return p[M] = { listings: [...p[M].listings, ...U], total: C, page: l ?? 1 }, { listings: U, total: C };
|
|
181
|
-
}, getWalletImageUrl(e) {
|
|
182
|
-
return m.getWalletImageUrl(e);
|
|
183
|
-
}, getAssetImageUrl(e) {
|
|
184
|
-
return m.getAssetImageUrl(e);
|
|
185
|
-
}, resetSearch() {
|
|
186
|
-
p.search = { listings: [], total: 0, page: 1 };
|
|
187
|
-
} }, I = u({ open: !1 }), L = { state: I, subscribe(e) {
|
|
188
|
-
return h(I, () => e(I));
|
|
189
|
-
}, async open(e) {
|
|
190
|
-
return new Promise((t) => {
|
|
191
|
-
const { isUiLoaded: s, isDataLoaded: o } = c.state;
|
|
192
|
-
if (r.removeWalletConnectDeepLink(), c.setWalletConnectUri(e == null ? void 0 : e.uri), c.setChains(e == null ? void 0 : e.chains), x.reset("ConnectWallet"), s && o)
|
|
193
|
-
I.open = !0, t();
|
|
194
|
-
else {
|
|
195
|
-
const i = setInterval(() => {
|
|
196
|
-
const l = c.state;
|
|
197
|
-
l.isUiLoaded && l.isDataLoaded && (clearInterval(i), I.open = !0, t());
|
|
198
|
-
}, 200);
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
}, close() {
|
|
202
|
-
I.open = !1;
|
|
203
|
-
} };
|
|
204
|
-
var X = Object.defineProperty, T = Object.getOwnPropertySymbols, Y = Object.prototype.hasOwnProperty, Z = Object.prototype.propertyIsEnumerable, _ = (e, t, s) => t in e ? X(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, ee = (e, t) => {
|
|
205
|
-
for (var s in t || (t = {}))
|
|
206
|
-
Y.call(t, s) && _(e, s, t[s]);
|
|
207
|
-
if (T)
|
|
208
|
-
for (var s of T(t))
|
|
209
|
-
Z.call(t, s) && _(e, s, t[s]);
|
|
210
|
-
return e;
|
|
211
|
-
};
|
|
212
|
-
function te() {
|
|
213
|
-
return typeof matchMedia < "u" && matchMedia("(prefers-color-scheme: dark)").matches;
|
|
214
|
-
}
|
|
215
|
-
const f = u({ themeMode: te() ? "dark" : "light" }), P = { state: f, subscribe(e) {
|
|
216
|
-
return h(f, () => e(f));
|
|
217
|
-
}, setThemeConfig(e) {
|
|
218
|
-
const { themeMode: t, themeVariables: s } = e;
|
|
219
|
-
t && (f.themeMode = t), s && (f.themeVariables = ee({}, s));
|
|
220
|
-
} }, g = u({ open: !1, message: "", variant: "success" }), ae = { state: g, subscribe(e) {
|
|
221
|
-
return h(g, () => e(g));
|
|
222
|
-
}, openToast(e, t) {
|
|
223
|
-
g.open = !0, g.message = e, g.variant = t;
|
|
224
|
-
}, closeToast() {
|
|
225
|
-
g.open = !1;
|
|
226
|
-
} };
|
|
227
|
-
class se {
|
|
228
|
-
constructor(t) {
|
|
229
|
-
this.openModal = L.open, this.closeModal = L.close, this.subscribeModal = L.subscribe, this.setTheme = P.setThemeConfig, P.setThemeConfig(t), v.setConfig(t), this.initUi();
|
|
230
|
-
}
|
|
231
|
-
async initUi() {
|
|
232
|
-
if (typeof window < "u") {
|
|
233
|
-
await import("./index-3Tles8GF.js");
|
|
234
|
-
const t = document.createElement("wcm-modal");
|
|
235
|
-
document.body.insertAdjacentElement("beforeend", t), c.setIsUiLoaded(!0);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
const re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
240
|
-
__proto__: null,
|
|
241
|
-
WalletConnectModal: se
|
|
242
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
243
|
-
export {
|
|
244
|
-
H as R,
|
|
245
|
-
x as T,
|
|
246
|
-
r as a,
|
|
247
|
-
re as i,
|
|
248
|
-
P as n,
|
|
249
|
-
ae as o,
|
|
250
|
-
c as p,
|
|
251
|
-
L as s,
|
|
252
|
-
ne as t,
|
|
253
|
-
v as y
|
|
254
|
-
};
|
package/dist/index-CQ4-w5mp.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const p=require("./W3MFrameProviderSingleton-SRLqDWgO.cjs");function _(n,a){for(var i=0;i<a.length;i++){const e=a[i];if(typeof e!="string"&&!Array.isArray(e)){for(const s in e)if(s!=="default"&&!(s in n)){const o=Object.getOwnPropertyDescriptor(e,s);o&&Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:()=>e[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var l={},g={},f={};Object.defineProperty(f,"__esModule",{value:!0});f.getLowerCase=void 0;function w(n){return n&&n.toLowerCase()}f.getLowerCase=w;Object.defineProperty(g,"__esModule",{value:!0});g.SafeAppProvider=void 0;const m=p.eventsExports,u=f;class k extends m.EventEmitter{constructor(a,i){super(),this.submittedTxs=new Map,this.safe=a,this.sdk=i}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(a){const{method:i,params:e=[]}=a;switch(i){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[t,r]=e;if(this.safe.safeAddress.toLowerCase()!==r.toLowerCase())throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(t);return("signature"in h?h.signature:void 0)||"0x"}case"eth_sign":{const[t,r]=e;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase()||!r.startsWith("0x"))throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(r);return("signature"in h?h.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[t,r]=e,h=typeof r=="string"?JSON.parse(r):r;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address is invalid");const c=await this.sdk.txs.signTypedMessage(h);return("signature"in c?c.signature:void 0)||"0x"}case"eth_sendTransaction":const s={...e[0],value:e[0].value||"0",data:e[0].data||"0x"};typeof s.gas=="string"&&s.gas.startsWith("0x")&&(s.gas=parseInt(s.gas,16));const o=await this.sdk.txs.send({txs:[s],params:{safeTxGas:s.gas}});return this.submittedTxs.set(o.safeTxHash,{from:this.safe.safeAddress,hash:o.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:s.data,value:s.value,to:s.to,blockHash:null,blockNumber:null,transactionIndex:null}),o.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,u.getLowerCase)(e[0]),e[1],e[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([e[0],e[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([e[0],e[1]]);case"eth_getTransactionByHash":let d=e[0];try{d=(await this.sdk.txs.getBySafeTxHash(d)).txHash||d}catch{}return this.submittedTxs.has(d)?this.submittedTxs.get(d):this.sdk.eth.getTransactionByHash([d]).then(t=>(t&&(t.hash=e[0]),t));case"eth_getTransactionReceipt":{let t=e[0];try{t=(await this.sdk.txs.getBySafeTxHash(t)).txHash||t}catch{}return this.sdk.eth.getTransactionReceipt([t]).then(r=>(r&&(r.transactionHash=e[0]),r))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(e[0]);case"eth_call":return this.sdk.eth.call([e[0],e[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([e[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(e[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([e[0]]);default:throw Error(`"${a.method}" not implemented`)}}send(a,i){a||i("Undefined request"),this.request(a).then(e=>i(null,{jsonrpc:"2.0",id:a.id,result:e})).catch(e=>i(e,null))}}g.SafeAppProvider=k;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.SafeAppProvider=void 0;var a=g;Object.defineProperty(n,"SafeAppProvider",{enumerable:!0,get:function(){return a.SafeAppProvider}})})(l);const y=_({__proto__:null},[l]);exports.index=y;
|
package/dist/index-DDwvGjhD.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { bf as p } from "./W3MFrameProviderSingleton--HSg3nEz.js";
|
|
2
|
-
function _(n, r) {
|
|
3
|
-
for (var i = 0; i < r.length; i++) {
|
|
4
|
-
const e = r[i];
|
|
5
|
-
if (typeof e != "string" && !Array.isArray(e)) {
|
|
6
|
-
for (const s in e)
|
|
7
|
-
if (s !== "default" && !(s in n)) {
|
|
8
|
-
const o = Object.getOwnPropertyDescriptor(e, s);
|
|
9
|
-
o && Object.defineProperty(n, s, o.get ? o : {
|
|
10
|
-
enumerable: !0,
|
|
11
|
-
get: () => e[s]
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
|
|
17
|
-
}
|
|
18
|
-
var l = {}, g = {}, f = {};
|
|
19
|
-
Object.defineProperty(f, "__esModule", { value: !0 });
|
|
20
|
-
f.getLowerCase = void 0;
|
|
21
|
-
function m(n) {
|
|
22
|
-
return n && n.toLowerCase();
|
|
23
|
-
}
|
|
24
|
-
f.getLowerCase = m;
|
|
25
|
-
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
26
|
-
g.SafeAppProvider = void 0;
|
|
27
|
-
const w = p, u = f;
|
|
28
|
-
class k extends w.EventEmitter {
|
|
29
|
-
constructor(r, i) {
|
|
30
|
-
super(), this.submittedTxs = /* @__PURE__ */ new Map(), this.safe = r, this.sdk = i;
|
|
31
|
-
}
|
|
32
|
-
async connect() {
|
|
33
|
-
this.emit("connect", { chainId: this.chainId });
|
|
34
|
-
}
|
|
35
|
-
async disconnect() {
|
|
36
|
-
}
|
|
37
|
-
get chainId() {
|
|
38
|
-
return this.safe.chainId;
|
|
39
|
-
}
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
-
async request(r) {
|
|
42
|
-
const { method: i, params: e = [] } = r;
|
|
43
|
-
switch (i) {
|
|
44
|
-
case "eth_accounts":
|
|
45
|
-
return [this.safe.safeAddress];
|
|
46
|
-
case "net_version":
|
|
47
|
-
case "eth_chainId":
|
|
48
|
-
return `0x${this.chainId.toString(16)}`;
|
|
49
|
-
case "personal_sign": {
|
|
50
|
-
const [t, a] = e;
|
|
51
|
-
if (this.safe.safeAddress.toLowerCase() !== a.toLowerCase())
|
|
52
|
-
throw new Error("The address or message hash is invalid");
|
|
53
|
-
const h = await this.sdk.txs.signMessage(t);
|
|
54
|
-
return ("signature" in h ? h.signature : void 0) || "0x";
|
|
55
|
-
}
|
|
56
|
-
case "eth_sign": {
|
|
57
|
-
const [t, a] = e;
|
|
58
|
-
if (this.safe.safeAddress.toLowerCase() !== t.toLowerCase() || !a.startsWith("0x"))
|
|
59
|
-
throw new Error("The address or message hash is invalid");
|
|
60
|
-
const h = await this.sdk.txs.signMessage(a);
|
|
61
|
-
return ("signature" in h ? h.signature : void 0) || "0x";
|
|
62
|
-
}
|
|
63
|
-
case "eth_signTypedData":
|
|
64
|
-
case "eth_signTypedData_v4": {
|
|
65
|
-
const [t, a] = e, h = typeof a == "string" ? JSON.parse(a) : a;
|
|
66
|
-
if (this.safe.safeAddress.toLowerCase() !== t.toLowerCase())
|
|
67
|
-
throw new Error("The address is invalid");
|
|
68
|
-
const c = await this.sdk.txs.signTypedMessage(h);
|
|
69
|
-
return ("signature" in c ? c.signature : void 0) || "0x";
|
|
70
|
-
}
|
|
71
|
-
case "eth_sendTransaction":
|
|
72
|
-
const s = {
|
|
73
|
-
...e[0],
|
|
74
|
-
value: e[0].value || "0",
|
|
75
|
-
data: e[0].data || "0x"
|
|
76
|
-
};
|
|
77
|
-
typeof s.gas == "string" && s.gas.startsWith("0x") && (s.gas = parseInt(s.gas, 16));
|
|
78
|
-
const o = await this.sdk.txs.send({
|
|
79
|
-
txs: [s],
|
|
80
|
-
params: { safeTxGas: s.gas }
|
|
81
|
-
});
|
|
82
|
-
return this.submittedTxs.set(o.safeTxHash, {
|
|
83
|
-
from: this.safe.safeAddress,
|
|
84
|
-
hash: o.safeTxHash,
|
|
85
|
-
gas: 0,
|
|
86
|
-
gasPrice: "0x00",
|
|
87
|
-
nonce: 0,
|
|
88
|
-
input: s.data,
|
|
89
|
-
value: s.value,
|
|
90
|
-
to: s.to,
|
|
91
|
-
blockHash: null,
|
|
92
|
-
blockNumber: null,
|
|
93
|
-
transactionIndex: null
|
|
94
|
-
}), o.safeTxHash;
|
|
95
|
-
case "eth_blockNumber":
|
|
96
|
-
return (await this.sdk.eth.getBlockByNumber(["latest"])).number;
|
|
97
|
-
case "eth_getBalance":
|
|
98
|
-
return this.sdk.eth.getBalance([(0, u.getLowerCase)(e[0]), e[1]]);
|
|
99
|
-
case "eth_getCode":
|
|
100
|
-
return this.sdk.eth.getCode([(0, u.getLowerCase)(e[0]), e[1]]);
|
|
101
|
-
case "eth_getTransactionCount":
|
|
102
|
-
return this.sdk.eth.getTransactionCount([(0, u.getLowerCase)(e[0]), e[1]]);
|
|
103
|
-
case "eth_getStorageAt":
|
|
104
|
-
return this.sdk.eth.getStorageAt([(0, u.getLowerCase)(e[0]), e[1], e[2]]);
|
|
105
|
-
case "eth_getBlockByNumber":
|
|
106
|
-
return this.sdk.eth.getBlockByNumber([e[0], e[1]]);
|
|
107
|
-
case "eth_getBlockByHash":
|
|
108
|
-
return this.sdk.eth.getBlockByHash([e[0], e[1]]);
|
|
109
|
-
case "eth_getTransactionByHash":
|
|
110
|
-
let d = e[0];
|
|
111
|
-
try {
|
|
112
|
-
d = (await this.sdk.txs.getBySafeTxHash(d)).txHash || d;
|
|
113
|
-
} catch {
|
|
114
|
-
}
|
|
115
|
-
return this.submittedTxs.has(d) ? this.submittedTxs.get(d) : this.sdk.eth.getTransactionByHash([d]).then((t) => (t && (t.hash = e[0]), t));
|
|
116
|
-
case "eth_getTransactionReceipt": {
|
|
117
|
-
let t = e[0];
|
|
118
|
-
try {
|
|
119
|
-
t = (await this.sdk.txs.getBySafeTxHash(t)).txHash || t;
|
|
120
|
-
} catch {
|
|
121
|
-
}
|
|
122
|
-
return this.sdk.eth.getTransactionReceipt([t]).then((a) => (a && (a.transactionHash = e[0]), a));
|
|
123
|
-
}
|
|
124
|
-
case "eth_estimateGas":
|
|
125
|
-
return this.sdk.eth.getEstimateGas(e[0]);
|
|
126
|
-
case "eth_call":
|
|
127
|
-
return this.sdk.eth.call([e[0], e[1]]);
|
|
128
|
-
case "eth_getLogs":
|
|
129
|
-
return this.sdk.eth.getPastLogs([e[0]]);
|
|
130
|
-
case "eth_gasPrice":
|
|
131
|
-
return this.sdk.eth.getGasPrice();
|
|
132
|
-
case "wallet_getPermissions":
|
|
133
|
-
return this.sdk.wallet.getPermissions();
|
|
134
|
-
case "wallet_requestPermissions":
|
|
135
|
-
return this.sdk.wallet.requestPermissions(e[0]);
|
|
136
|
-
case "safe_setSettings":
|
|
137
|
-
return this.sdk.eth.setSafeSettings([e[0]]);
|
|
138
|
-
default:
|
|
139
|
-
throw Error(`"${r.method}" not implemented`);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// this method is needed for ethers v4
|
|
143
|
-
// https://github.com/ethers-io/ethers.js/blob/427e16826eb15d52d25c4f01027f8db22b74b76c/src.ts/providers/web3-provider.ts#L41-L55
|
|
144
|
-
send(r, i) {
|
|
145
|
-
r || i("Undefined request"), this.request(r).then((e) => i(null, { jsonrpc: "2.0", id: r.id, result: e })).catch((e) => i(e, null));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
g.SafeAppProvider = k;
|
|
149
|
-
(function(n) {
|
|
150
|
-
Object.defineProperty(n, "__esModule", { value: !0 }), n.SafeAppProvider = void 0;
|
|
151
|
-
var r = g;
|
|
152
|
-
Object.defineProperty(n, "SafeAppProvider", { enumerable: !0, get: function() {
|
|
153
|
-
return r.SafeAppProvider;
|
|
154
|
-
} });
|
|
155
|
-
})(l);
|
|
156
|
-
const b = /* @__PURE__ */ _({
|
|
157
|
-
__proto__: null
|
|
158
|
-
}, [l]);
|
|
159
|
-
export {
|
|
160
|
-
b as i
|
|
161
|
-
};
|