@paywithglide/glide-react 0.0.42 → 0.0.43
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/GlideDeposit.d.ts +1 -0
- package/dist/glide.js +422 -296
- package/dist/index.d.ts +1 -0
- package/dist/theme.d.ts +1 -0
- package/dist/walletProviderBridge.d.ts +32 -0
- package/package.json +1 -1
package/dist/GlideDeposit.d.ts
CHANGED
package/dist/glide.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useMemo as
|
|
5
|
-
function
|
|
1
|
+
var ee = Object.defineProperty;
|
|
2
|
+
var te = (s, t, e) => t in s ? ee(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var j = (s, t, e) => te(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { useMemo as G } from "react";
|
|
5
|
+
function se(s, { strict: t = !0 } = {}) {
|
|
6
6
|
return !s || typeof s != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(s) : s.startsWith("0x");
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function q(s) {
|
|
9
|
+
return se(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
|
|
10
10
|
}
|
|
11
11
|
const N = "2.21.51";
|
|
12
|
-
let
|
|
12
|
+
let L = {
|
|
13
13
|
getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
|
|
14
14
|
version: `viem@${N}`
|
|
15
15
|
};
|
|
16
16
|
class z extends Error {
|
|
17
17
|
constructor(t, e = {}) {
|
|
18
|
-
var
|
|
18
|
+
var d;
|
|
19
19
|
const i = (() => {
|
|
20
|
-
var
|
|
21
|
-
return e.cause instanceof z ? e.cause.details : (
|
|
22
|
-
})(), o = e.cause instanceof z && e.cause.docsPath || e.docsPath, r = (
|
|
20
|
+
var a;
|
|
21
|
+
return e.cause instanceof z ? e.cause.details : (a = e.cause) != null && a.message ? e.cause.message : e.details;
|
|
22
|
+
})(), o = e.cause instanceof z && e.cause.docsPath || e.docsPath, r = (d = L.getDocsUrl) == null ? void 0 : d.call(L, { ...e, docsPath: o }), p = [
|
|
23
23
|
t || "An error occurred.",
|
|
24
24
|
"",
|
|
25
25
|
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
26
26
|
...r ? [`Docs: ${r}`] : [],
|
|
27
27
|
...i ? [`Details: ${i}`] : [],
|
|
28
|
-
...
|
|
28
|
+
...L.version ? [`Version: ${L.version}`] : []
|
|
29
29
|
].join(`
|
|
30
30
|
`);
|
|
31
31
|
super(p, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -61,37 +61,37 @@ class z extends Error {
|
|
|
61
61
|
}), this.details = i, this.docsPath = o, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = N;
|
|
62
62
|
}
|
|
63
63
|
walk(t) {
|
|
64
|
-
return
|
|
64
|
+
return V(this, t);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ?
|
|
67
|
+
function V(s, t) {
|
|
68
|
+
return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? V(s.cause, t) : t ? null : s;
|
|
69
69
|
}
|
|
70
|
-
class
|
|
70
|
+
class F extends z {
|
|
71
71
|
constructor({ size: t, targetSize: e, type: i }) {
|
|
72
72
|
super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
return typeof s == "string" ?
|
|
75
|
+
function O(s, { dir: t, size: e = 32 } = {}) {
|
|
76
|
+
return typeof s == "string" ? ie(s, { dir: t, size: e }) : oe(s, { dir: t, size: e });
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function ie(s, { dir: t, size: e = 32 } = {}) {
|
|
79
79
|
if (e === null)
|
|
80
80
|
return s;
|
|
81
81
|
const i = s.replace("0x", "");
|
|
82
82
|
if (i.length > e * 2)
|
|
83
|
-
throw new
|
|
83
|
+
throw new F({
|
|
84
84
|
size: Math.ceil(i.length / 2),
|
|
85
85
|
targetSize: e,
|
|
86
86
|
type: "hex"
|
|
87
87
|
});
|
|
88
88
|
return `0x${i[t === "right" ? "padEnd" : "padStart"](e * 2, "0")}`;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function oe(s, { dir: t, size: e = 32 } = {}) {
|
|
91
91
|
if (e === null)
|
|
92
92
|
return s;
|
|
93
93
|
if (s.length > e)
|
|
94
|
-
throw new
|
|
94
|
+
throw new F({
|
|
95
95
|
size: s.length,
|
|
96
96
|
targetSize: e,
|
|
97
97
|
type: "bytes"
|
|
@@ -103,65 +103,175 @@ function ie(s, { dir: t, size: e = 32 } = {}) {
|
|
|
103
103
|
}
|
|
104
104
|
return i;
|
|
105
105
|
}
|
|
106
|
-
class
|
|
106
|
+
class re extends z {
|
|
107
107
|
constructor({ max: t, min: e, signed: i, size: o, value: r }) {
|
|
108
108
|
super(`Number "${r}" is not in safe ${o ? `${o * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
class
|
|
111
|
+
class ne extends z {
|
|
112
112
|
constructor({ givenSize: t, maxSize: e }) {
|
|
113
113
|
super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
if (
|
|
118
|
-
throw new
|
|
119
|
-
givenSize:
|
|
116
|
+
function J(s, { size: t }) {
|
|
117
|
+
if (q(s) > t)
|
|
118
|
+
throw new ne({
|
|
119
|
+
givenSize: q(s),
|
|
120
120
|
maxSize: t
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
const
|
|
124
|
-
function
|
|
125
|
-
return typeof s == "number" || typeof s == "bigint" ?
|
|
123
|
+
const ae = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
|
|
124
|
+
function de(s, t = {}) {
|
|
125
|
+
return typeof s == "number" || typeof s == "bigint" ? ce(s, t) : typeof s == "string" ? he(s, t) : typeof s == "boolean" ? pe(s, t) : X(s, t);
|
|
126
126
|
}
|
|
127
127
|
function pe(s, t = {}) {
|
|
128
128
|
const e = `0x${Number(s)}`;
|
|
129
|
-
return typeof t.size == "number" ? (
|
|
129
|
+
return typeof t.size == "number" ? (J(e, { size: t.size }), O(e, { size: t.size })) : e;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function X(s, t = {}) {
|
|
132
132
|
let e = "";
|
|
133
133
|
for (let o = 0; o < s.length; o++)
|
|
134
|
-
e +=
|
|
134
|
+
e += ae[s[o]];
|
|
135
135
|
const i = `0x${e}`;
|
|
136
|
-
return typeof t.size == "number" ? (
|
|
136
|
+
return typeof t.size == "number" ? (J(i, { size: t.size }), O(i, { dir: "right", size: t.size })) : i;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function ce(s, t = {}) {
|
|
139
139
|
const { signed: e, size: i } = t, o = BigInt(s);
|
|
140
140
|
let r;
|
|
141
141
|
i ? e ? r = (1n << BigInt(i) * 8n - 1n) - 1n : r = 2n ** (BigInt(i) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
|
|
142
142
|
const p = typeof r == "bigint" && e ? -r - 1n : 0;
|
|
143
143
|
if (r && o > r || o < p) {
|
|
144
|
-
const
|
|
145
|
-
throw new
|
|
146
|
-
max: r ? `${r}${
|
|
147
|
-
min: `${p}${
|
|
144
|
+
const a = typeof s == "bigint" ? "n" : "";
|
|
145
|
+
throw new re({
|
|
146
|
+
max: r ? `${r}${a}` : void 0,
|
|
147
|
+
min: `${p}${a}`,
|
|
148
148
|
signed: e,
|
|
149
149
|
size: i,
|
|
150
|
-
value: `${s}${
|
|
150
|
+
value: `${s}${a}`
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
return i ?
|
|
153
|
+
const d = `0x${(e && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
|
|
154
|
+
return i ? O(d, { size: i }) : d;
|
|
155
155
|
}
|
|
156
156
|
const le = /* @__PURE__ */ new TextEncoder();
|
|
157
|
-
function
|
|
157
|
+
function he(s, t = {}) {
|
|
158
158
|
const e = le.encode(s);
|
|
159
|
-
return
|
|
159
|
+
return X(e, t);
|
|
160
|
+
}
|
|
161
|
+
let K = !1;
|
|
162
|
+
function ue(s) {
|
|
163
|
+
if (K)
|
|
164
|
+
return;
|
|
165
|
+
K = !0;
|
|
166
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), o = (p) => {
|
|
167
|
+
const d = p.detail;
|
|
168
|
+
t.has(d.info.uuid) || t.set(d.info.uuid, d);
|
|
169
|
+
};
|
|
170
|
+
window.addEventListener("eip6963:announceProvider", o), window.dispatchEvent(new Event("eip6963:requestProvider")), window.addEventListener("message", async (p) => {
|
|
171
|
+
var f;
|
|
172
|
+
if (p.origin !== s) return;
|
|
173
|
+
const { type: d, data: a } = p.data;
|
|
174
|
+
switch (d) {
|
|
175
|
+
case "glide:getProviders": {
|
|
176
|
+
const c = Array.from(t.values()).map(
|
|
177
|
+
({ info: h, provider: l }) => ({
|
|
178
|
+
info: h,
|
|
179
|
+
isConnected: typeof l.isConnected == "boolean" ? l.isConnected : void 0,
|
|
180
|
+
chainId: l.chainId,
|
|
181
|
+
selectedAddress: l.selectedAddress
|
|
182
|
+
})
|
|
183
|
+
), n = document.getElementById(
|
|
184
|
+
"glide-deposit-iframe"
|
|
185
|
+
);
|
|
186
|
+
n != null && n.contentWindow && n.contentWindow.postMessage(
|
|
187
|
+
{
|
|
188
|
+
type: "glide:providers",
|
|
189
|
+
providers: c
|
|
190
|
+
},
|
|
191
|
+
s
|
|
192
|
+
);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
case "glide:providerRequest": {
|
|
196
|
+
const { uuid: c, requestId: n, method: h, params: l } = a;
|
|
197
|
+
if (i.has(n))
|
|
198
|
+
return;
|
|
199
|
+
i.set(n, !0);
|
|
200
|
+
const m = t.get(c);
|
|
201
|
+
if (!m) {
|
|
202
|
+
i.delete(n), r(n, { error: "Provider not found" });
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
const u = await m.provider.request({
|
|
207
|
+
method: h,
|
|
208
|
+
params: l
|
|
209
|
+
});
|
|
210
|
+
i.delete(n), r(n, { result: u });
|
|
211
|
+
} catch (u) {
|
|
212
|
+
i.delete(n), r(n, {
|
|
213
|
+
error: u.message || String(u),
|
|
214
|
+
code: u.code,
|
|
215
|
+
data: u.data
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
case "glide:addEventListener": {
|
|
221
|
+
const { uuid: c, requestId: n, eventName: h } = a, l = t.get(c);
|
|
222
|
+
if (!l || !l.provider.on) {
|
|
223
|
+
r(n, { error: "Provider or method not found" });
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const m = (...u) => {
|
|
227
|
+
const g = document.getElementById(
|
|
228
|
+
"glide-deposit-iframe"
|
|
229
|
+
);
|
|
230
|
+
g != null && g.contentWindow && g.contentWindow.postMessage(
|
|
231
|
+
{
|
|
232
|
+
type: "glide:providerEvent",
|
|
233
|
+
uuid: c,
|
|
234
|
+
eventName: h,
|
|
235
|
+
args: u
|
|
236
|
+
},
|
|
237
|
+
s
|
|
238
|
+
);
|
|
239
|
+
};
|
|
240
|
+
e.has(c) || e.set(c, /* @__PURE__ */ new Map()), e.get(c).has(h) || e.get(c).set(h, /* @__PURE__ */ new Set()), e.get(c).get(h).add(m), l.provider.on(h, m), r(n, { result: !0 });
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
case "glide:removeEventListener": {
|
|
244
|
+
const { uuid: c, requestId: n, eventName: h } = a, l = t.get(c);
|
|
245
|
+
if (!l || !l.provider.removeListener) {
|
|
246
|
+
r(n, { error: "Provider or method not found" });
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const m = (f = e.get(c)) == null ? void 0 : f.get(h);
|
|
250
|
+
m && (m.forEach((u) => {
|
|
251
|
+
l.provider.removeListener(h, u);
|
|
252
|
+
}), m.clear()), r(n, { result: !0 });
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
function r(p, d) {
|
|
258
|
+
const a = document.getElementById(
|
|
259
|
+
"glide-deposit-iframe"
|
|
260
|
+
);
|
|
261
|
+
a != null && a.contentWindow && a.contentWindow.postMessage(
|
|
262
|
+
{
|
|
263
|
+
type: "glide:providerResponse",
|
|
264
|
+
requestId: p,
|
|
265
|
+
...d
|
|
266
|
+
},
|
|
267
|
+
s
|
|
268
|
+
);
|
|
269
|
+
}
|
|
160
270
|
}
|
|
161
271
|
class H {
|
|
162
272
|
constructor(t) {
|
|
163
|
-
|
|
164
|
-
|
|
273
|
+
j(this, "opts");
|
|
274
|
+
j(this, "open", () => {
|
|
165
275
|
if (!(!this.opts.container && document.body.classList.contains("glide-deposit-open"))) {
|
|
166
276
|
if (this.opts.container || document.body.classList.add("glide-deposit-open"), (this.opts.mode === "deposit" || this.opts.mode === "buy") && !this.opts.recipient)
|
|
167
277
|
throw new Error("recipient is required for deposit/buy mode");
|
|
@@ -172,21 +282,21 @@ class H {
|
|
|
172
282
|
this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
|
|
173
283
|
}
|
|
174
284
|
});
|
|
175
|
-
|
|
176
|
-
var i, o, r, p,
|
|
285
|
+
j(this, "iframeEventHandler", async (t) => {
|
|
286
|
+
var i, o, r, p, d, a, f, c, n, h, l, m, u, g, $, y, I, w, x, v, S, E, U, M, C, k, P, D, T, R, B, W, A;
|
|
177
287
|
const e = t.data;
|
|
178
288
|
switch (e.type) {
|
|
179
289
|
case "sendInit": {
|
|
180
|
-
const
|
|
181
|
-
(
|
|
290
|
+
const b = this.opts.recipient, Q = (i = this.opts.walletProvider) == null ? void 0 : i.address, Y = (o = this.opts.walletProvider) == null ? void 0 : o.availableChainIds, Z = (r = this.opts.walletProvider) == null ? void 0 : r.currentChainId, _ = this.opts.preferGaslessPayment || !!((p = this.opts.walletProvider) != null && p.signTypedDataAsync);
|
|
291
|
+
(f = (d = this.iframe) == null ? void 0 : d.contentWindow) == null || f.postMessage(
|
|
182
292
|
{
|
|
183
293
|
type: "initialize",
|
|
184
294
|
sessionId: this.opts.sessionId,
|
|
185
|
-
recipient:
|
|
186
|
-
connectedWalletAddress:
|
|
187
|
-
availableChainIds:
|
|
188
|
-
currentChainId:
|
|
189
|
-
preferGaslessPayment:
|
|
295
|
+
recipient: b,
|
|
296
|
+
connectedWalletAddress: Q,
|
|
297
|
+
availableChainIds: Y,
|
|
298
|
+
currentChainId: Z,
|
|
299
|
+
preferGaslessPayment: _,
|
|
190
300
|
chainIds: this.opts.chainIds,
|
|
191
301
|
excludeChainIds: this.opts.excludeChainIds,
|
|
192
302
|
excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
|
|
@@ -213,7 +323,8 @@ class H {
|
|
|
213
323
|
stableDepositAddressKey: this.opts.stableDepositAddressKey,
|
|
214
324
|
theme: {
|
|
215
325
|
...this.opts.theme || {},
|
|
216
|
-
colorScheme: ((
|
|
326
|
+
colorScheme: ((a = this.opts.theme) == null ? void 0 : a.colorScheme) || getComputedStyle(document.documentElement).colorScheme || "",
|
|
327
|
+
safeInsetBottom: this.getSafeInsetBottom()
|
|
217
328
|
},
|
|
218
329
|
didProvideLocalStorage: !!this.opts.localStorageProvider,
|
|
219
330
|
debug: this.opts.debug,
|
|
@@ -225,17 +336,17 @@ class H {
|
|
|
225
336
|
break;
|
|
226
337
|
}
|
|
227
338
|
case "didOpen": {
|
|
228
|
-
this.iframe.style.opacity = "1", (
|
|
339
|
+
this.iframe.style.opacity = "1", (n = (c = this.opts).onOpen) == null || n.call(c);
|
|
229
340
|
break;
|
|
230
341
|
}
|
|
231
342
|
case "localStorage.getKeys": {
|
|
232
343
|
if (!this.opts.localStorageProvider)
|
|
233
344
|
throw new Error("localStorageProvider is not set");
|
|
234
|
-
const
|
|
235
|
-
(
|
|
345
|
+
const b = await this.opts.localStorageProvider.getKeys();
|
|
346
|
+
(l = (h = this.iframe) == null ? void 0 : h.contentWindow) == null || l.postMessage(
|
|
236
347
|
{
|
|
237
348
|
type: "localStorage.didGetKeys",
|
|
238
|
-
keys:
|
|
349
|
+
keys: b
|
|
239
350
|
},
|
|
240
351
|
this.baseUrl
|
|
241
352
|
);
|
|
@@ -257,25 +368,25 @@ class H {
|
|
|
257
368
|
case "localStorage.getItem": {
|
|
258
369
|
if (!this.opts.localStorageProvider)
|
|
259
370
|
throw new Error("localStorageProvider is not set");
|
|
260
|
-
const
|
|
261
|
-
(
|
|
371
|
+
const b = await this.opts.localStorageProvider.getItem(e.key);
|
|
372
|
+
(u = (m = this.iframe) == null ? void 0 : m.contentWindow) == null || u.postMessage(
|
|
262
373
|
{
|
|
263
374
|
type: "localStorage.didGetItem",
|
|
264
375
|
key: e.key,
|
|
265
|
-
value:
|
|
376
|
+
value: b
|
|
266
377
|
},
|
|
267
378
|
this.baseUrl
|
|
268
379
|
);
|
|
269
380
|
break;
|
|
270
381
|
}
|
|
271
382
|
case "success":
|
|
272
|
-
(
|
|
383
|
+
($ = (g = this.opts) == null ? void 0 : g.onSuccess) == null || $.call(g, e.hash, e.session);
|
|
273
384
|
break;
|
|
274
385
|
case "close":
|
|
275
|
-
this.removeIframe(), this.destroy(), (
|
|
386
|
+
this.removeIframe(), this.destroy(), (I = (y = this.opts) == null ? void 0 : y.onClose) == null || I.call(y);
|
|
276
387
|
break;
|
|
277
388
|
case "setMode":
|
|
278
|
-
(x = (
|
|
389
|
+
(x = (w = this.opts) == null ? void 0 : w.onSetMode) == null || x.call(w, e.mode);
|
|
279
390
|
break;
|
|
280
391
|
case "switchChain":
|
|
281
392
|
if (!this.opts.walletProvider)
|
|
@@ -283,7 +394,7 @@ class H {
|
|
|
283
394
|
try {
|
|
284
395
|
await this.opts.walletProvider.switchChainAsync({
|
|
285
396
|
chainId: e.chainId
|
|
286
|
-
}), (
|
|
397
|
+
}), (S = (v = this.iframe) == null ? void 0 : v.contentWindow) == null || S.postMessage(
|
|
287
398
|
{
|
|
288
399
|
type: "didSwitchChain",
|
|
289
400
|
success: !0,
|
|
@@ -291,12 +402,12 @@ class H {
|
|
|
291
402
|
},
|
|
292
403
|
this.baseUrl
|
|
293
404
|
);
|
|
294
|
-
} catch (
|
|
295
|
-
(
|
|
405
|
+
} catch (b) {
|
|
406
|
+
(U = (E = this.iframe) == null ? void 0 : E.contentWindow) == null || U.postMessage(
|
|
296
407
|
{
|
|
297
408
|
type: "didSwitchChain",
|
|
298
409
|
success: !1,
|
|
299
|
-
error:
|
|
410
|
+
error: b
|
|
300
411
|
},
|
|
301
412
|
this.baseUrl
|
|
302
413
|
);
|
|
@@ -307,23 +418,23 @@ class H {
|
|
|
307
418
|
if (!this.opts.walletProvider)
|
|
308
419
|
throw new Error("walletProvider is not set");
|
|
309
420
|
try {
|
|
310
|
-
const
|
|
421
|
+
const b = await this.opts.walletProvider.sendTransactionAsync(
|
|
311
422
|
e.tx
|
|
312
423
|
);
|
|
313
|
-
(C = (
|
|
424
|
+
(C = (M = this.iframe) == null ? void 0 : M.contentWindow) == null || C.postMessage(
|
|
314
425
|
{
|
|
315
426
|
type: "didSendTransaction",
|
|
316
427
|
success: !0,
|
|
317
|
-
txHash:
|
|
428
|
+
txHash: b
|
|
318
429
|
},
|
|
319
430
|
this.baseUrl
|
|
320
431
|
);
|
|
321
|
-
} catch (
|
|
322
|
-
(P = (
|
|
432
|
+
} catch (b) {
|
|
433
|
+
(P = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || P.postMessage(
|
|
323
434
|
{
|
|
324
435
|
type: "didSendTransaction",
|
|
325
436
|
success: !1,
|
|
326
|
-
error:
|
|
437
|
+
error: b
|
|
327
438
|
},
|
|
328
439
|
this.baseUrl
|
|
329
440
|
);
|
|
@@ -346,23 +457,23 @@ class H {
|
|
|
346
457
|
return;
|
|
347
458
|
}
|
|
348
459
|
try {
|
|
349
|
-
const
|
|
460
|
+
const b = await this.opts.walletProvider.signTypedDataAsync(
|
|
350
461
|
e.data
|
|
351
462
|
);
|
|
352
|
-
(
|
|
463
|
+
(B = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || B.postMessage(
|
|
353
464
|
{
|
|
354
465
|
type: "didSignTypedData",
|
|
355
466
|
success: !0,
|
|
356
|
-
signature:
|
|
467
|
+
signature: b
|
|
357
468
|
},
|
|
358
469
|
this.baseUrl
|
|
359
470
|
);
|
|
360
|
-
} catch (
|
|
361
|
-
(A = (
|
|
471
|
+
} catch (b) {
|
|
472
|
+
(A = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || A.postMessage(
|
|
362
473
|
{
|
|
363
474
|
type: "didSignTypedData",
|
|
364
475
|
success: !1,
|
|
365
|
-
error:
|
|
476
|
+
error: b
|
|
366
477
|
},
|
|
367
478
|
this.baseUrl
|
|
368
479
|
);
|
|
@@ -374,13 +485,15 @@ class H {
|
|
|
374
485
|
this.opts = t;
|
|
375
486
|
}
|
|
376
487
|
get externalUrl() {
|
|
377
|
-
var t, e, i, o, r, p,
|
|
378
|
-
return `${this.baseUrl}${this.opts.app}?${this.opts.recipient ? `&recipient=${this.opts.recipient}` : ""}${this.opts.preferGaslessPayment ? "&preferGaslessPayment=true" : ""}${this.opts.mode ? `&mode=${this.opts.mode}` : ""}${this.opts.amount ? `&amount=${this.opts.amount}` : ""}${this.opts.chainId ? `&chainId=${this.opts.chainId}` : ""}${this.opts.currencyId ? `¤cyId=${this.opts.currencyId}` : ""}${this.opts.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${
|
|
488
|
+
var t, e, i, o, r, p, d, a, f;
|
|
489
|
+
return `${this.baseUrl}${this.opts.app}?${this.opts.recipient ? `&recipient=${this.opts.recipient}` : ""}${this.opts.preferGaslessPayment ? "&preferGaslessPayment=true" : ""}${this.opts.mode ? `&mode=${this.opts.mode}` : ""}${this.opts.amount ? `&amount=${this.opts.amount}` : ""}${this.opts.chainId ? `&chainId=${this.opts.chainId}` : ""}${this.opts.currencyId ? `¤cyId=${this.opts.currencyId}` : ""}${this.opts.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${de(
|
|
379
490
|
this.opts.evm.value || 0n
|
|
380
|
-
)}` : ""}${this.opts.approval ? `&approval.token=${this.opts.approval.token}&approval.amount=${this.opts.approval.amount}` : ""}${this.opts.sessionMetadata ? `&metadata=${this.opts.sessionMetadata}` : ""}${this.opts.autoCloseOnSuccess ? "&autoCloseOnSuccess=true" : ""}${this.opts.sessionId ? `&sessionId=${this.opts.sessionId}` : ""}${(t = this.opts.chainIds) != null && t.length ? `&chainIds=${this.opts.chainIds.join(",")}` : ""}${(e = this.opts.excludeChainIds) != null && e.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(i = this.opts.excludeCurrencyTiers) != null && i.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(o = this.opts.excludeFundingSources) != null && o.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${(r = this.opts.fundingSources) != null && r.length ? `&fundingSources=${this.opts.fundingSources.join(",")}` : ""}${(p = this.opts.allowedPaymentCurrencies) != null && p.length ? `&allowedPaymentCurrencies=${this.opts.allowedPaymentCurrencies.join(",")}` : ""}${(
|
|
491
|
+
)}` : ""}${this.opts.approval ? `&approval.token=${this.opts.approval.token}&approval.amount=${this.opts.approval.amount}` : ""}${this.opts.sessionMetadata ? `&metadata=${this.opts.sessionMetadata}` : ""}${this.opts.autoCloseOnSuccess ? "&autoCloseOnSuccess=true" : ""}${this.opts.sessionId ? `&sessionId=${this.opts.sessionId}` : ""}${(t = this.opts.chainIds) != null && t.length ? `&chainIds=${this.opts.chainIds.join(",")}` : ""}${(e = this.opts.excludeChainIds) != null && e.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(i = this.opts.excludeCurrencyTiers) != null && i.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(o = this.opts.excludeFundingSources) != null && o.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${(r = this.opts.fundingSources) != null && r.length ? `&fundingSources=${this.opts.fundingSources.join(",")}` : ""}${(p = this.opts.allowedPaymentCurrencies) != null && p.length ? `&allowedPaymentCurrencies=${this.opts.allowedPaymentCurrencies.join(",")}` : ""}${(d = this.opts.appMetadata) != null && d.name ? `&appMetadata.name=${encodeURIComponent(this.opts.appMetadata.name)}` : ""}${(a = this.opts.appMetadata) != null && a.logoUrl ? `&appMetadata.logoUrl=${encodeURIComponent(this.opts.appMetadata.logoUrl)}` : ""}${(f = this.opts.appMetadata) != null && f.faviconUrl ? `&appMetadata.faviconUrl=${encodeURIComponent(this.opts.appMetadata.faviconUrl)}` : ""}${this.opts.enableRefundEmails ? "&enableRefundEmails=true" : ""}${this.opts.payerEmail ? `&payerEmail=${encodeURIComponent(this.opts.payerEmail)}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.disableWithdrawToSelfSuggestion ? "&disableWithdrawToSelfSuggestion=true" : ""}${this.opts.hideSettlementCopy ? "&hideSettlementCopy=true" : ""}${this.opts.showAppLogo ? `&showAppLogo=${this.opts.showAppLogo}` : ""}${this.opts.showOnrampFirst ? "&showOnrampFirst=true" : ""}${this.opts.debitCardAlias ? `&debitCardAlias=${this.opts.debitCardAlias}` : ""}${this.opts.copyOverrides ? `©Overrides=${encodeURIComponent(JSON.stringify(this.opts.copyOverrides))}` : ""}${this.opts.stableDepositAddressKey ? `&stableDepositAddressKey=${encodeURIComponent(this.opts.stableDepositAddressKey)}` : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
|
|
381
492
|
}
|
|
382
493
|
initialize() {
|
|
383
494
|
window.addEventListener("message", this.iframeEventHandler);
|
|
495
|
+
const t = new URL(this.baseUrl).origin;
|
|
496
|
+
ue(t);
|
|
384
497
|
}
|
|
385
498
|
destroy() {
|
|
386
499
|
window.removeEventListener("message", this.iframeEventHandler);
|
|
@@ -391,6 +504,18 @@ class H {
|
|
|
391
504
|
get iframe() {
|
|
392
505
|
return document.getElementById("glide-deposit-iframe");
|
|
393
506
|
}
|
|
507
|
+
getSafeInsetBottom() {
|
|
508
|
+
if (typeof window > "u" || typeof document > "u")
|
|
509
|
+
return 0;
|
|
510
|
+
try {
|
|
511
|
+
const t = document.createElement("div");
|
|
512
|
+
t.style.cssText = "position: fixed; bottom: 0; left: 0; width: 1px; height: 1px; padding: 0; margin: 0; padding-bottom: env(safe-area-inset-bottom, 0px); visibility: hidden; pointer-events: none; z-index: -1;", document.body.appendChild(t);
|
|
513
|
+
const e = window.getComputedStyle(t).paddingBottom;
|
|
514
|
+
return document.body.removeChild(t), parseFloat(e) || 0;
|
|
515
|
+
} catch {
|
|
516
|
+
return 0;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
394
519
|
openUrl(t) {
|
|
395
520
|
this.createIframe(t);
|
|
396
521
|
}
|
|
@@ -412,7 +537,7 @@ class H {
|
|
|
412
537
|
t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
|
|
413
538
|
}
|
|
414
539
|
}
|
|
415
|
-
const
|
|
540
|
+
const fe = ({
|
|
416
541
|
app: s,
|
|
417
542
|
recipient: t,
|
|
418
543
|
chainId: e,
|
|
@@ -420,36 +545,36 @@ const me = ({
|
|
|
420
545
|
amount: o,
|
|
421
546
|
gasRefuelAmountPerChain: r,
|
|
422
547
|
preferGaslessPayment: p,
|
|
423
|
-
chainIds:
|
|
424
|
-
excludeChainIds:
|
|
425
|
-
excludeCurrencyTiers:
|
|
426
|
-
excludeFundingSources:
|
|
427
|
-
fundingSources:
|
|
428
|
-
appMetadata:
|
|
429
|
-
enableRefundEmails:
|
|
430
|
-
payerEmail:
|
|
431
|
-
mode:
|
|
432
|
-
hideSettlementCopy:
|
|
433
|
-
showAppLogo:
|
|
434
|
-
showOnrampFirst:
|
|
435
|
-
debitCardAlias:
|
|
436
|
-
copyOverrides:
|
|
548
|
+
chainIds: d,
|
|
549
|
+
excludeChainIds: a,
|
|
550
|
+
excludeCurrencyTiers: f,
|
|
551
|
+
excludeFundingSources: c,
|
|
552
|
+
fundingSources: n,
|
|
553
|
+
appMetadata: h,
|
|
554
|
+
enableRefundEmails: l,
|
|
555
|
+
payerEmail: m,
|
|
556
|
+
mode: u,
|
|
557
|
+
hideSettlementCopy: g,
|
|
558
|
+
showAppLogo: $,
|
|
559
|
+
showOnrampFirst: y,
|
|
560
|
+
debitCardAlias: I,
|
|
561
|
+
copyOverrides: w,
|
|
437
562
|
stableDepositAddressKey: x,
|
|
438
|
-
sessionId:
|
|
439
|
-
sessionMetadata:
|
|
440
|
-
disableWithdrawToSelfSuggestion:
|
|
441
|
-
theme:
|
|
442
|
-
walletProvider:
|
|
563
|
+
sessionId: v,
|
|
564
|
+
sessionMetadata: S,
|
|
565
|
+
disableWithdrawToSelfSuggestion: E,
|
|
566
|
+
theme: U,
|
|
567
|
+
walletProvider: M,
|
|
443
568
|
localStorageProvider: C,
|
|
444
|
-
onOpen:
|
|
569
|
+
onOpen: k,
|
|
445
570
|
onSuccess: P,
|
|
446
571
|
onClose: D,
|
|
447
572
|
autoCloseOnSuccess: T,
|
|
448
573
|
popupsBlocked: R,
|
|
449
|
-
baseUrl:
|
|
450
|
-
debug:
|
|
574
|
+
baseUrl: B,
|
|
575
|
+
debug: W
|
|
451
576
|
}) => {
|
|
452
|
-
const A =
|
|
577
|
+
const A = G(() => new H({
|
|
453
578
|
app: s,
|
|
454
579
|
recipient: t,
|
|
455
580
|
chainId: e,
|
|
@@ -457,34 +582,34 @@ const me = ({
|
|
|
457
582
|
amount: o,
|
|
458
583
|
gasRefuelAmountPerChain: r,
|
|
459
584
|
preferGaslessPayment: p,
|
|
460
|
-
chainIds:
|
|
461
|
-
excludeChainIds:
|
|
462
|
-
excludeCurrencyTiers:
|
|
463
|
-
excludeFundingSources:
|
|
464
|
-
fundingSources:
|
|
465
|
-
appMetadata:
|
|
466
|
-
enableRefundEmails:
|
|
467
|
-
payerEmail:
|
|
468
|
-
mode:
|
|
469
|
-
hideSettlementCopy:
|
|
470
|
-
showAppLogo:
|
|
471
|
-
showOnrampFirst:
|
|
472
|
-
debitCardAlias:
|
|
473
|
-
copyOverrides:
|
|
585
|
+
chainIds: d,
|
|
586
|
+
excludeChainIds: a,
|
|
587
|
+
excludeCurrencyTiers: f,
|
|
588
|
+
excludeFundingSources: c,
|
|
589
|
+
fundingSources: n,
|
|
590
|
+
appMetadata: h,
|
|
591
|
+
enableRefundEmails: l,
|
|
592
|
+
payerEmail: m,
|
|
593
|
+
mode: u,
|
|
594
|
+
hideSettlementCopy: g,
|
|
595
|
+
showAppLogo: $,
|
|
596
|
+
showOnrampFirst: y,
|
|
597
|
+
debitCardAlias: I,
|
|
598
|
+
copyOverrides: w,
|
|
474
599
|
stableDepositAddressKey: x,
|
|
475
|
-
sessionId:
|
|
476
|
-
sessionMetadata:
|
|
477
|
-
disableWithdrawToSelfSuggestion:
|
|
478
|
-
theme:
|
|
479
|
-
walletProvider:
|
|
600
|
+
sessionId: v,
|
|
601
|
+
sessionMetadata: S,
|
|
602
|
+
disableWithdrawToSelfSuggestion: E,
|
|
603
|
+
theme: U,
|
|
604
|
+
walletProvider: M,
|
|
480
605
|
localStorageProvider: C,
|
|
481
|
-
onOpen:
|
|
606
|
+
onOpen: k,
|
|
482
607
|
onSuccess: P,
|
|
483
608
|
onClose: D,
|
|
484
609
|
autoCloseOnSuccess: T,
|
|
485
610
|
popupsBlocked: R,
|
|
486
|
-
baseUrl:
|
|
487
|
-
debug:
|
|
611
|
+
baseUrl: B,
|
|
612
|
+
debug: W
|
|
488
613
|
}), [
|
|
489
614
|
s,
|
|
490
615
|
t,
|
|
@@ -493,41 +618,41 @@ const me = ({
|
|
|
493
618
|
o,
|
|
494
619
|
r,
|
|
495
620
|
p,
|
|
621
|
+
d,
|
|
496
622
|
a,
|
|
623
|
+
f,
|
|
624
|
+
c,
|
|
497
625
|
n,
|
|
498
|
-
|
|
626
|
+
h,
|
|
627
|
+
l,
|
|
628
|
+
m,
|
|
629
|
+
u,
|
|
499
630
|
g,
|
|
500
|
-
|
|
631
|
+
$,
|
|
501
632
|
y,
|
|
633
|
+
I,
|
|
502
634
|
w,
|
|
503
|
-
|
|
504
|
-
$,
|
|
505
|
-
l,
|
|
635
|
+
x,
|
|
506
636
|
v,
|
|
507
|
-
c,
|
|
508
637
|
S,
|
|
509
|
-
h,
|
|
510
|
-
x,
|
|
511
|
-
u,
|
|
512
|
-
I,
|
|
513
|
-
U,
|
|
514
638
|
E,
|
|
515
|
-
|
|
516
|
-
C,
|
|
639
|
+
U,
|
|
517
640
|
M,
|
|
641
|
+
C,
|
|
642
|
+
k,
|
|
518
643
|
P,
|
|
519
644
|
D,
|
|
520
645
|
T,
|
|
521
646
|
R,
|
|
522
|
-
|
|
523
|
-
|
|
647
|
+
B,
|
|
648
|
+
W
|
|
524
649
|
]);
|
|
525
650
|
return {
|
|
526
651
|
openGlideDeposit: A.open,
|
|
527
652
|
externalUrl: A.externalUrl,
|
|
528
653
|
opts: A.opts
|
|
529
654
|
};
|
|
530
|
-
},
|
|
655
|
+
}, ye = ({
|
|
531
656
|
app: s,
|
|
532
657
|
preferGaslessPayment: t,
|
|
533
658
|
chainIds: e,
|
|
@@ -535,30 +660,30 @@ const me = ({
|
|
|
535
660
|
excludeCurrencyTiers: o,
|
|
536
661
|
excludeFundingSources: r,
|
|
537
662
|
fundingSources: p,
|
|
538
|
-
allowedPaymentCurrencies:
|
|
539
|
-
appMetadata:
|
|
540
|
-
enableRefundEmails:
|
|
541
|
-
payerEmail:
|
|
542
|
-
hideSettlementCopy:
|
|
543
|
-
showAppLogo:
|
|
544
|
-
showOnrampFirst:
|
|
545
|
-
debitCardAlias:
|
|
546
|
-
copyOverrides:
|
|
547
|
-
amount:
|
|
548
|
-
sessionId:
|
|
549
|
-
sessionMetadata:
|
|
550
|
-
theme:
|
|
551
|
-
walletProvider:
|
|
663
|
+
allowedPaymentCurrencies: d,
|
|
664
|
+
appMetadata: a,
|
|
665
|
+
enableRefundEmails: f,
|
|
666
|
+
payerEmail: c,
|
|
667
|
+
hideSettlementCopy: n,
|
|
668
|
+
showAppLogo: h,
|
|
669
|
+
showOnrampFirst: l,
|
|
670
|
+
debitCardAlias: m,
|
|
671
|
+
copyOverrides: u,
|
|
672
|
+
amount: g,
|
|
673
|
+
sessionId: $,
|
|
674
|
+
sessionMetadata: y,
|
|
675
|
+
theme: I,
|
|
676
|
+
walletProvider: w,
|
|
552
677
|
localStorageProvider: x,
|
|
553
|
-
onOpen:
|
|
554
|
-
onSuccess:
|
|
555
|
-
onClose:
|
|
556
|
-
autoCloseOnSuccess:
|
|
557
|
-
popupsBlocked:
|
|
678
|
+
onOpen: v,
|
|
679
|
+
onSuccess: S,
|
|
680
|
+
onClose: E,
|
|
681
|
+
autoCloseOnSuccess: U,
|
|
682
|
+
popupsBlocked: M,
|
|
558
683
|
baseUrl: C,
|
|
559
|
-
debug:
|
|
684
|
+
debug: k
|
|
560
685
|
}) => {
|
|
561
|
-
const P =
|
|
686
|
+
const P = G(() => new H({
|
|
562
687
|
app: s,
|
|
563
688
|
preferGaslessPayment: t,
|
|
564
689
|
chainIds: e,
|
|
@@ -566,29 +691,29 @@ const me = ({
|
|
|
566
691
|
excludeCurrencyTiers: o,
|
|
567
692
|
excludeFundingSources: r,
|
|
568
693
|
fundingSources: p,
|
|
569
|
-
allowedPaymentCurrencies:
|
|
570
|
-
appMetadata:
|
|
571
|
-
enableRefundEmails:
|
|
572
|
-
payerEmail:
|
|
694
|
+
allowedPaymentCurrencies: d,
|
|
695
|
+
appMetadata: a,
|
|
696
|
+
enableRefundEmails: f,
|
|
697
|
+
payerEmail: c,
|
|
573
698
|
mode: "pay",
|
|
574
|
-
hideSettlementCopy:
|
|
575
|
-
showAppLogo:
|
|
576
|
-
showOnrampFirst:
|
|
577
|
-
debitCardAlias:
|
|
578
|
-
copyOverrides:
|
|
579
|
-
sessionId:
|
|
580
|
-
amount:
|
|
581
|
-
sessionMetadata:
|
|
582
|
-
theme:
|
|
583
|
-
walletProvider:
|
|
699
|
+
hideSettlementCopy: n,
|
|
700
|
+
showAppLogo: h,
|
|
701
|
+
showOnrampFirst: l,
|
|
702
|
+
debitCardAlias: m,
|
|
703
|
+
copyOverrides: u,
|
|
704
|
+
sessionId: $,
|
|
705
|
+
amount: g,
|
|
706
|
+
sessionMetadata: y,
|
|
707
|
+
theme: I,
|
|
708
|
+
walletProvider: w,
|
|
584
709
|
localStorageProvider: x,
|
|
585
|
-
onOpen:
|
|
586
|
-
onSuccess:
|
|
587
|
-
onClose:
|
|
588
|
-
autoCloseOnSuccess:
|
|
589
|
-
popupsBlocked:
|
|
710
|
+
onOpen: v,
|
|
711
|
+
onSuccess: S,
|
|
712
|
+
onClose: E,
|
|
713
|
+
autoCloseOnSuccess: U,
|
|
714
|
+
popupsBlocked: M,
|
|
590
715
|
baseUrl: C,
|
|
591
|
-
debug:
|
|
716
|
+
debug: k
|
|
592
717
|
}), [
|
|
593
718
|
s,
|
|
594
719
|
t,
|
|
@@ -597,35 +722,35 @@ const me = ({
|
|
|
597
722
|
o,
|
|
598
723
|
r,
|
|
599
724
|
p,
|
|
725
|
+
d,
|
|
600
726
|
a,
|
|
727
|
+
f,
|
|
728
|
+
c,
|
|
601
729
|
n,
|
|
602
|
-
|
|
730
|
+
h,
|
|
731
|
+
l,
|
|
732
|
+
m,
|
|
733
|
+
u,
|
|
734
|
+
$,
|
|
603
735
|
g,
|
|
604
|
-
f,
|
|
605
736
|
y,
|
|
737
|
+
I,
|
|
606
738
|
w,
|
|
607
|
-
|
|
608
|
-
$,
|
|
739
|
+
x,
|
|
609
740
|
v,
|
|
610
|
-
l,
|
|
611
|
-
c,
|
|
612
741
|
S,
|
|
613
|
-
h,
|
|
614
|
-
x,
|
|
615
|
-
u,
|
|
616
|
-
I,
|
|
617
|
-
U,
|
|
618
742
|
E,
|
|
619
|
-
|
|
743
|
+
U,
|
|
744
|
+
M,
|
|
620
745
|
C,
|
|
621
|
-
|
|
746
|
+
k
|
|
622
747
|
]);
|
|
623
748
|
return {
|
|
624
749
|
openGlidePay: P.open,
|
|
625
750
|
externalUrl: P.externalUrl,
|
|
626
751
|
opts: P.opts
|
|
627
752
|
};
|
|
628
|
-
},
|
|
753
|
+
}, we = ({
|
|
629
754
|
app: s,
|
|
630
755
|
evm: t,
|
|
631
756
|
approval: e,
|
|
@@ -633,24 +758,24 @@ const me = ({
|
|
|
633
758
|
chainIds: o,
|
|
634
759
|
excludeChainIds: r,
|
|
635
760
|
excludeCurrencyTiers: p,
|
|
636
|
-
excludeFundingSources:
|
|
637
|
-
sessionMetadata:
|
|
638
|
-
showAppLogo:
|
|
639
|
-
showOnrampFirst:
|
|
640
|
-
debitCardAlias:
|
|
641
|
-
copyOverrides:
|
|
642
|
-
theme:
|
|
643
|
-
walletProvider:
|
|
644
|
-
localStorageProvider:
|
|
645
|
-
onOpen:
|
|
646
|
-
onSuccess:
|
|
647
|
-
onClose:
|
|
648
|
-
autoCloseOnSuccess:
|
|
649
|
-
popupsBlocked:
|
|
761
|
+
excludeFundingSources: d,
|
|
762
|
+
sessionMetadata: a,
|
|
763
|
+
showAppLogo: f,
|
|
764
|
+
showOnrampFirst: c,
|
|
765
|
+
debitCardAlias: n,
|
|
766
|
+
copyOverrides: h,
|
|
767
|
+
theme: l,
|
|
768
|
+
walletProvider: m,
|
|
769
|
+
localStorageProvider: u,
|
|
770
|
+
onOpen: g,
|
|
771
|
+
onSuccess: $,
|
|
772
|
+
onClose: y,
|
|
773
|
+
autoCloseOnSuccess: I,
|
|
774
|
+
popupsBlocked: w,
|
|
650
775
|
baseUrl: x,
|
|
651
|
-
debug:
|
|
776
|
+
debug: v
|
|
652
777
|
}) => {
|
|
653
|
-
const
|
|
778
|
+
const S = G(() => new H({
|
|
654
779
|
app: s,
|
|
655
780
|
evm: t,
|
|
656
781
|
approval: e,
|
|
@@ -658,23 +783,23 @@ const me = ({
|
|
|
658
783
|
chainIds: o,
|
|
659
784
|
excludeChainIds: r,
|
|
660
785
|
excludeCurrencyTiers: p,
|
|
661
|
-
excludeFundingSources:
|
|
662
|
-
sessionMetadata:
|
|
663
|
-
showAppLogo:
|
|
664
|
-
showOnrampFirst:
|
|
665
|
-
debitCardAlias:
|
|
666
|
-
copyOverrides:
|
|
786
|
+
excludeFundingSources: d,
|
|
787
|
+
sessionMetadata: a,
|
|
788
|
+
showAppLogo: f,
|
|
789
|
+
showOnrampFirst: c,
|
|
790
|
+
debitCardAlias: n,
|
|
791
|
+
copyOverrides: h,
|
|
667
792
|
mode: "call",
|
|
668
|
-
theme:
|
|
669
|
-
walletProvider:
|
|
670
|
-
localStorageProvider:
|
|
671
|
-
onOpen:
|
|
672
|
-
onSuccess:
|
|
673
|
-
onClose:
|
|
674
|
-
autoCloseOnSuccess:
|
|
675
|
-
popupsBlocked:
|
|
793
|
+
theme: l,
|
|
794
|
+
walletProvider: m,
|
|
795
|
+
localStorageProvider: u,
|
|
796
|
+
onOpen: g,
|
|
797
|
+
onSuccess: $,
|
|
798
|
+
onClose: y,
|
|
799
|
+
autoCloseOnSuccess: I,
|
|
800
|
+
popupsBlocked: w,
|
|
676
801
|
baseUrl: x,
|
|
677
|
-
debug:
|
|
802
|
+
debug: v
|
|
678
803
|
}), [
|
|
679
804
|
s,
|
|
680
805
|
t,
|
|
@@ -683,29 +808,29 @@ const me = ({
|
|
|
683
808
|
o,
|
|
684
809
|
r,
|
|
685
810
|
p,
|
|
811
|
+
d,
|
|
686
812
|
a,
|
|
813
|
+
f,
|
|
814
|
+
c,
|
|
687
815
|
n,
|
|
688
|
-
|
|
816
|
+
h,
|
|
817
|
+
l,
|
|
818
|
+
m,
|
|
819
|
+
u,
|
|
689
820
|
g,
|
|
690
|
-
|
|
821
|
+
$,
|
|
691
822
|
y,
|
|
823
|
+
I,
|
|
692
824
|
w,
|
|
693
|
-
b,
|
|
694
|
-
$,
|
|
695
|
-
l,
|
|
696
|
-
v,
|
|
697
|
-
c,
|
|
698
|
-
S,
|
|
699
|
-
h,
|
|
700
825
|
x,
|
|
701
|
-
|
|
826
|
+
v
|
|
702
827
|
]);
|
|
703
828
|
return {
|
|
704
|
-
openGlideCall:
|
|
705
|
-
externalUrl:
|
|
706
|
-
opts:
|
|
829
|
+
openGlideCall: S.open,
|
|
830
|
+
externalUrl: S.externalUrl,
|
|
831
|
+
opts: S.opts
|
|
707
832
|
};
|
|
708
|
-
},
|
|
833
|
+
}, ve = ({
|
|
709
834
|
app: s,
|
|
710
835
|
recipient: t,
|
|
711
836
|
chainId: e,
|
|
@@ -713,23 +838,23 @@ const me = ({
|
|
|
713
838
|
preferGaslessPayment: o,
|
|
714
839
|
chainIds: r,
|
|
715
840
|
excludeChainIds: p,
|
|
716
|
-
excludeCurrencyTiers:
|
|
717
|
-
excludeFundingSources:
|
|
718
|
-
sessionMetadata:
|
|
719
|
-
showAppLogo:
|
|
720
|
-
showOnrampFirst:
|
|
721
|
-
debitCardAlias:
|
|
722
|
-
copyOverrides:
|
|
723
|
-
theme:
|
|
724
|
-
walletProvider:
|
|
725
|
-
localStorageProvider:
|
|
726
|
-
onOpen:
|
|
727
|
-
onSuccess:
|
|
728
|
-
onClose:
|
|
729
|
-
autoCloseOnSuccess:
|
|
841
|
+
excludeCurrencyTiers: d,
|
|
842
|
+
excludeFundingSources: a,
|
|
843
|
+
sessionMetadata: f,
|
|
844
|
+
showAppLogo: c,
|
|
845
|
+
showOnrampFirst: n,
|
|
846
|
+
debitCardAlias: h,
|
|
847
|
+
copyOverrides: l,
|
|
848
|
+
theme: m,
|
|
849
|
+
walletProvider: u,
|
|
850
|
+
localStorageProvider: g,
|
|
851
|
+
onOpen: $,
|
|
852
|
+
onSuccess: y,
|
|
853
|
+
onClose: I,
|
|
854
|
+
autoCloseOnSuccess: w,
|
|
730
855
|
baseUrl: x
|
|
731
856
|
}) => {
|
|
732
|
-
const
|
|
857
|
+
const v = G(() => new H({
|
|
733
858
|
app: s,
|
|
734
859
|
recipient: t,
|
|
735
860
|
chainId: e,
|
|
@@ -737,21 +862,21 @@ const me = ({
|
|
|
737
862
|
preferGaslessPayment: o,
|
|
738
863
|
chainIds: r,
|
|
739
864
|
excludeChainIds: p,
|
|
740
|
-
excludeCurrencyTiers:
|
|
741
|
-
excludeFundingSources:
|
|
742
|
-
sessionMetadata:
|
|
743
|
-
showAppLogo:
|
|
744
|
-
showOnrampFirst:
|
|
745
|
-
debitCardAlias:
|
|
746
|
-
copyOverrides:
|
|
865
|
+
excludeCurrencyTiers: d,
|
|
866
|
+
excludeFundingSources: a,
|
|
867
|
+
sessionMetadata: f,
|
|
868
|
+
showAppLogo: c,
|
|
869
|
+
showOnrampFirst: n,
|
|
870
|
+
debitCardAlias: h,
|
|
871
|
+
copyOverrides: l,
|
|
747
872
|
mode: "buy",
|
|
748
|
-
theme:
|
|
749
|
-
walletProvider:
|
|
750
|
-
localStorageProvider:
|
|
751
|
-
onOpen:
|
|
752
|
-
onSuccess:
|
|
753
|
-
onClose:
|
|
754
|
-
autoCloseOnSuccess:
|
|
873
|
+
theme: m,
|
|
874
|
+
walletProvider: u,
|
|
875
|
+
localStorageProvider: g,
|
|
876
|
+
onOpen: $,
|
|
877
|
+
onSuccess: y,
|
|
878
|
+
onClose: I,
|
|
879
|
+
autoCloseOnSuccess: w,
|
|
755
880
|
baseUrl: x
|
|
756
881
|
}), [
|
|
757
882
|
s,
|
|
@@ -761,28 +886,28 @@ const me = ({
|
|
|
761
886
|
o,
|
|
762
887
|
r,
|
|
763
888
|
p,
|
|
889
|
+
d,
|
|
764
890
|
a,
|
|
891
|
+
f,
|
|
892
|
+
c,
|
|
765
893
|
n,
|
|
766
|
-
|
|
894
|
+
h,
|
|
895
|
+
l,
|
|
896
|
+
m,
|
|
897
|
+
u,
|
|
767
898
|
g,
|
|
768
|
-
|
|
899
|
+
$,
|
|
769
900
|
y,
|
|
901
|
+
I,
|
|
770
902
|
w,
|
|
771
|
-
b,
|
|
772
|
-
$,
|
|
773
|
-
l,
|
|
774
|
-
v,
|
|
775
|
-
c,
|
|
776
|
-
S,
|
|
777
|
-
h,
|
|
778
903
|
x
|
|
779
904
|
]);
|
|
780
905
|
return {
|
|
781
|
-
openGlideBuy:
|
|
782
|
-
externalUrl:
|
|
783
|
-
opts:
|
|
906
|
+
openGlideBuy: v.open,
|
|
907
|
+
externalUrl: v.externalUrl,
|
|
908
|
+
opts: v.opts
|
|
784
909
|
};
|
|
785
|
-
},
|
|
910
|
+
}, be = Object.freeze({
|
|
786
911
|
getItem: (s) => new Promise((t, e) => {
|
|
787
912
|
try {
|
|
788
913
|
const i = localStorage.getItem(s);
|
|
@@ -816,9 +941,10 @@ const me = ({
|
|
|
816
941
|
});
|
|
817
942
|
export {
|
|
818
943
|
H as GlideDeposit,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
944
|
+
be as browserLocalStorageProvider,
|
|
945
|
+
ue as initializeParentBridge,
|
|
946
|
+
ve as useGlideBuy,
|
|
947
|
+
we as useGlideCall,
|
|
948
|
+
fe as useGlideDeposit,
|
|
949
|
+
ye as useGlidePay
|
|
824
950
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/theme.d.ts
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet Provider Bridge for Parent Window (glide-react)
|
|
3
|
+
*
|
|
4
|
+
* This module detects wallet providers (including Rainbow) in the parent window
|
|
5
|
+
* and creates a message bridge to make them available in the iframe.
|
|
6
|
+
*
|
|
7
|
+
* Since Rainbow and some other wallets don't inject into iframes for security,
|
|
8
|
+
* this bridge proxies all EIP-1193 provider calls between parent and iframe.
|
|
9
|
+
*/
|
|
10
|
+
export interface EIP1193Provider {
|
|
11
|
+
request(args: {
|
|
12
|
+
method: string;
|
|
13
|
+
params?: unknown[] | Record<string, unknown>;
|
|
14
|
+
}): Promise<unknown>;
|
|
15
|
+
on?(event: string, listener: (...args: unknown[]) => void): void;
|
|
16
|
+
removeListener?(event: string, listener: (...args: unknown[]) => void): void;
|
|
17
|
+
}
|
|
18
|
+
export interface EIP6963ProviderInfo {
|
|
19
|
+
uuid: string;
|
|
20
|
+
name: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
rdns: string;
|
|
23
|
+
}
|
|
24
|
+
export interface EIP6963ProviderDetail {
|
|
25
|
+
info: EIP6963ProviderInfo;
|
|
26
|
+
provider: EIP1193Provider;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Initialize wallet provider bridge in parent window
|
|
30
|
+
* Detects all EIP-6963 providers and sets up message handlers
|
|
31
|
+
*/
|
|
32
|
+
export declare function initializeParentBridge(iframeOrigin: string): void;
|