@paywithglide/glide-react 0.0.41 → 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 +2 -0
- package/dist/glide.js +444 -314
- package/dist/index.d.ts +1 -0
- package/dist/theme.d.ts +1 -0
- package/dist/useGlideDeposit.d.ts +2 -1
- package/dist/walletProviderBridge.d.ts +32 -0
- package/package.json +1 -1
package/dist/GlideDeposit.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ export type GlideDepositOptions = {
|
|
|
133
133
|
showOnrampFirst?: boolean;
|
|
134
134
|
debitCardAlias?: DebitCardAlias;
|
|
135
135
|
copyOverrides?: Record<string, string>;
|
|
136
|
+
stableDepositAddressKey?: string;
|
|
136
137
|
theme?: GlideWidgetTheme;
|
|
137
138
|
popupsBlocked?: boolean;
|
|
138
139
|
baseUrl?: string;
|
|
@@ -147,6 +148,7 @@ export declare class GlideDeposit {
|
|
|
147
148
|
private destroy;
|
|
148
149
|
private get baseUrl();
|
|
149
150
|
private get iframe();
|
|
151
|
+
private getSafeInsetBottom;
|
|
150
152
|
private iframeEventHandler;
|
|
151
153
|
private openUrl;
|
|
152
154
|
private createIframe;
|
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
|
-
const
|
|
12
|
-
let
|
|
11
|
+
const N = "2.21.51";
|
|
12
|
+
let L = {
|
|
13
13
|
getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
|
|
14
|
-
version: `viem@${
|
|
14
|
+
version: `viem@${N}`
|
|
15
15
|
};
|
|
16
|
-
class
|
|
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
|
|
22
|
-
})(), o = e.cause instanceof
|
|
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", {
|
|
@@ -58,40 +58,40 @@ class A extends Error {
|
|
|
58
58
|
configurable: !0,
|
|
59
59
|
writable: !0,
|
|
60
60
|
value: "BaseError"
|
|
61
|
-
}), this.details = i, this.docsPath = o, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version =
|
|
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
|
-
class
|
|
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 O {
|
|
|
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,
|
|
@@ -210,9 +320,11 @@ class O {
|
|
|
210
320
|
showOnrampFirst: this.opts.showOnrampFirst,
|
|
211
321
|
debitCardAlias: this.opts.debitCardAlias,
|
|
212
322
|
copyOverrides: this.opts.copyOverrides,
|
|
323
|
+
stableDepositAddressKey: this.opts.stableDepositAddressKey,
|
|
213
324
|
theme: {
|
|
214
325
|
...this.opts.theme || {},
|
|
215
|
-
colorScheme: ((
|
|
326
|
+
colorScheme: ((a = this.opts.theme) == null ? void 0 : a.colorScheme) || getComputedStyle(document.documentElement).colorScheme || "",
|
|
327
|
+
safeInsetBottom: this.getSafeInsetBottom()
|
|
216
328
|
},
|
|
217
329
|
didProvideLocalStorage: !!this.opts.localStorageProvider,
|
|
218
330
|
debug: this.opts.debug,
|
|
@@ -224,17 +336,17 @@ class O {
|
|
|
224
336
|
break;
|
|
225
337
|
}
|
|
226
338
|
case "didOpen": {
|
|
227
|
-
this.iframe.style.opacity = "1", (
|
|
339
|
+
this.iframe.style.opacity = "1", (n = (c = this.opts).onOpen) == null || n.call(c);
|
|
228
340
|
break;
|
|
229
341
|
}
|
|
230
342
|
case "localStorage.getKeys": {
|
|
231
343
|
if (!this.opts.localStorageProvider)
|
|
232
344
|
throw new Error("localStorageProvider is not set");
|
|
233
|
-
const
|
|
234
|
-
(
|
|
345
|
+
const b = await this.opts.localStorageProvider.getKeys();
|
|
346
|
+
(l = (h = this.iframe) == null ? void 0 : h.contentWindow) == null || l.postMessage(
|
|
235
347
|
{
|
|
236
348
|
type: "localStorage.didGetKeys",
|
|
237
|
-
keys:
|
|
349
|
+
keys: b
|
|
238
350
|
},
|
|
239
351
|
this.baseUrl
|
|
240
352
|
);
|
|
@@ -256,25 +368,25 @@ class O {
|
|
|
256
368
|
case "localStorage.getItem": {
|
|
257
369
|
if (!this.opts.localStorageProvider)
|
|
258
370
|
throw new Error("localStorageProvider is not set");
|
|
259
|
-
const
|
|
260
|
-
(
|
|
371
|
+
const b = await this.opts.localStorageProvider.getItem(e.key);
|
|
372
|
+
(u = (m = this.iframe) == null ? void 0 : m.contentWindow) == null || u.postMessage(
|
|
261
373
|
{
|
|
262
374
|
type: "localStorage.didGetItem",
|
|
263
375
|
key: e.key,
|
|
264
|
-
value:
|
|
376
|
+
value: b
|
|
265
377
|
},
|
|
266
378
|
this.baseUrl
|
|
267
379
|
);
|
|
268
380
|
break;
|
|
269
381
|
}
|
|
270
382
|
case "success":
|
|
271
|
-
(
|
|
383
|
+
($ = (g = this.opts) == null ? void 0 : g.onSuccess) == null || $.call(g, e.hash, e.session);
|
|
272
384
|
break;
|
|
273
385
|
case "close":
|
|
274
|
-
this.removeIframe(), this.destroy(), (
|
|
386
|
+
this.removeIframe(), this.destroy(), (I = (y = this.opts) == null ? void 0 : y.onClose) == null || I.call(y);
|
|
275
387
|
break;
|
|
276
388
|
case "setMode":
|
|
277
|
-
(x = (
|
|
389
|
+
(x = (w = this.opts) == null ? void 0 : w.onSetMode) == null || x.call(w, e.mode);
|
|
278
390
|
break;
|
|
279
391
|
case "switchChain":
|
|
280
392
|
if (!this.opts.walletProvider)
|
|
@@ -282,7 +394,7 @@ class O {
|
|
|
282
394
|
try {
|
|
283
395
|
await this.opts.walletProvider.switchChainAsync({
|
|
284
396
|
chainId: e.chainId
|
|
285
|
-
}), (
|
|
397
|
+
}), (S = (v = this.iframe) == null ? void 0 : v.contentWindow) == null || S.postMessage(
|
|
286
398
|
{
|
|
287
399
|
type: "didSwitchChain",
|
|
288
400
|
success: !0,
|
|
@@ -290,12 +402,12 @@ class O {
|
|
|
290
402
|
},
|
|
291
403
|
this.baseUrl
|
|
292
404
|
);
|
|
293
|
-
} catch (
|
|
294
|
-
(
|
|
405
|
+
} catch (b) {
|
|
406
|
+
(U = (E = this.iframe) == null ? void 0 : E.contentWindow) == null || U.postMessage(
|
|
295
407
|
{
|
|
296
408
|
type: "didSwitchChain",
|
|
297
409
|
success: !1,
|
|
298
|
-
error:
|
|
410
|
+
error: b
|
|
299
411
|
},
|
|
300
412
|
this.baseUrl
|
|
301
413
|
);
|
|
@@ -306,23 +418,23 @@ class O {
|
|
|
306
418
|
if (!this.opts.walletProvider)
|
|
307
419
|
throw new Error("walletProvider is not set");
|
|
308
420
|
try {
|
|
309
|
-
const
|
|
421
|
+
const b = await this.opts.walletProvider.sendTransactionAsync(
|
|
310
422
|
e.tx
|
|
311
423
|
);
|
|
312
|
-
(
|
|
424
|
+
(C = (M = this.iframe) == null ? void 0 : M.contentWindow) == null || C.postMessage(
|
|
313
425
|
{
|
|
314
426
|
type: "didSendTransaction",
|
|
315
427
|
success: !0,
|
|
316
|
-
txHash:
|
|
428
|
+
txHash: b
|
|
317
429
|
},
|
|
318
430
|
this.baseUrl
|
|
319
431
|
);
|
|
320
|
-
} catch (
|
|
321
|
-
(P = (
|
|
432
|
+
} catch (b) {
|
|
433
|
+
(P = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || P.postMessage(
|
|
322
434
|
{
|
|
323
435
|
type: "didSendTransaction",
|
|
324
436
|
success: !1,
|
|
325
|
-
error:
|
|
437
|
+
error: b
|
|
326
438
|
},
|
|
327
439
|
this.baseUrl
|
|
328
440
|
);
|
|
@@ -334,7 +446,7 @@ class O {
|
|
|
334
446
|
if (!this.opts.walletProvider)
|
|
335
447
|
throw new Error("walletProvider is not set");
|
|
336
448
|
if (!this.opts.walletProvider.signTypedDataAsync) {
|
|
337
|
-
(
|
|
449
|
+
(T = (D = this.iframe) == null ? void 0 : D.contentWindow) == null || T.postMessage(
|
|
338
450
|
{
|
|
339
451
|
type: "didSignTypedData",
|
|
340
452
|
success: !1,
|
|
@@ -345,23 +457,23 @@ class O {
|
|
|
345
457
|
return;
|
|
346
458
|
}
|
|
347
459
|
try {
|
|
348
|
-
const
|
|
460
|
+
const b = await this.opts.walletProvider.signTypedDataAsync(
|
|
349
461
|
e.data
|
|
350
462
|
);
|
|
351
|
-
(
|
|
463
|
+
(B = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || B.postMessage(
|
|
352
464
|
{
|
|
353
465
|
type: "didSignTypedData",
|
|
354
466
|
success: !0,
|
|
355
|
-
signature:
|
|
467
|
+
signature: b
|
|
356
468
|
},
|
|
357
469
|
this.baseUrl
|
|
358
470
|
);
|
|
359
|
-
} catch (
|
|
360
|
-
(
|
|
471
|
+
} catch (b) {
|
|
472
|
+
(A = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || A.postMessage(
|
|
361
473
|
{
|
|
362
474
|
type: "didSignTypedData",
|
|
363
475
|
success: !1,
|
|
364
|
-
error:
|
|
476
|
+
error: b
|
|
365
477
|
},
|
|
366
478
|
this.baseUrl
|
|
367
479
|
);
|
|
@@ -373,13 +485,15 @@ class O {
|
|
|
373
485
|
this.opts = t;
|
|
374
486
|
}
|
|
375
487
|
get externalUrl() {
|
|
376
|
-
var t, e, i, o, r, p,
|
|
377
|
-
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(
|
|
378
490
|
this.opts.evm.value || 0n
|
|
379
|
-
)}` : ""}${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))}` : ""}`;
|
|
380
492
|
}
|
|
381
493
|
initialize() {
|
|
382
494
|
window.addEventListener("message", this.iframeEventHandler);
|
|
495
|
+
const t = new URL(this.baseUrl).origin;
|
|
496
|
+
ue(t);
|
|
383
497
|
}
|
|
384
498
|
destroy() {
|
|
385
499
|
window.removeEventListener("message", this.iframeEventHandler);
|
|
@@ -390,6 +504,18 @@ class O {
|
|
|
390
504
|
get iframe() {
|
|
391
505
|
return document.getElementById("glide-deposit-iframe");
|
|
392
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
|
+
}
|
|
393
519
|
openUrl(t) {
|
|
394
520
|
this.createIframe(t);
|
|
395
521
|
}
|
|
@@ -411,7 +537,7 @@ class O {
|
|
|
411
537
|
t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
|
|
412
538
|
}
|
|
413
539
|
}
|
|
414
|
-
const
|
|
540
|
+
const fe = ({
|
|
415
541
|
app: s,
|
|
416
542
|
recipient: t,
|
|
417
543
|
chainId: e,
|
|
@@ -419,35 +545,36 @@ const me = ({
|
|
|
419
545
|
amount: o,
|
|
420
546
|
gasRefuelAmountPerChain: r,
|
|
421
547
|
preferGaslessPayment: p,
|
|
422
|
-
chainIds:
|
|
423
|
-
excludeChainIds:
|
|
424
|
-
excludeCurrencyTiers:
|
|
425
|
-
excludeFundingSources:
|
|
426
|
-
fundingSources:
|
|
427
|
-
appMetadata:
|
|
428
|
-
enableRefundEmails:
|
|
429
|
-
payerEmail:
|
|
430
|
-
mode:
|
|
431
|
-
hideSettlementCopy:
|
|
432
|
-
showAppLogo:
|
|
433
|
-
showOnrampFirst:
|
|
434
|
-
debitCardAlias:
|
|
435
|
-
copyOverrides:
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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,
|
|
562
|
+
stableDepositAddressKey: x,
|
|
563
|
+
sessionId: v,
|
|
564
|
+
sessionMetadata: S,
|
|
565
|
+
disableWithdrawToSelfSuggestion: E,
|
|
439
566
|
theme: U,
|
|
440
|
-
walletProvider:
|
|
441
|
-
localStorageProvider:
|
|
442
|
-
onOpen:
|
|
443
|
-
onSuccess:
|
|
444
|
-
onClose:
|
|
567
|
+
walletProvider: M,
|
|
568
|
+
localStorageProvider: C,
|
|
569
|
+
onOpen: k,
|
|
570
|
+
onSuccess: P,
|
|
571
|
+
onClose: D,
|
|
445
572
|
autoCloseOnSuccess: T,
|
|
446
|
-
popupsBlocked:
|
|
447
|
-
baseUrl:
|
|
448
|
-
debug:
|
|
573
|
+
popupsBlocked: R,
|
|
574
|
+
baseUrl: B,
|
|
575
|
+
debug: W
|
|
449
576
|
}) => {
|
|
450
|
-
const
|
|
577
|
+
const A = G(() => new H({
|
|
451
578
|
app: s,
|
|
452
579
|
recipient: t,
|
|
453
580
|
chainId: e,
|
|
@@ -455,33 +582,34 @@ const me = ({
|
|
|
455
582
|
amount: o,
|
|
456
583
|
gasRefuelAmountPerChain: r,
|
|
457
584
|
preferGaslessPayment: p,
|
|
458
|
-
chainIds:
|
|
459
|
-
excludeChainIds:
|
|
460
|
-
excludeCurrencyTiers:
|
|
461
|
-
excludeFundingSources:
|
|
462
|
-
fundingSources:
|
|
463
|
-
appMetadata:
|
|
464
|
-
enableRefundEmails:
|
|
465
|
-
payerEmail:
|
|
466
|
-
mode:
|
|
467
|
-
hideSettlementCopy:
|
|
468
|
-
showAppLogo:
|
|
469
|
-
showOnrampFirst:
|
|
470
|
-
debitCardAlias:
|
|
471
|
-
copyOverrides:
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
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,
|
|
599
|
+
stableDepositAddressKey: x,
|
|
600
|
+
sessionId: v,
|
|
601
|
+
sessionMetadata: S,
|
|
602
|
+
disableWithdrawToSelfSuggestion: E,
|
|
475
603
|
theme: U,
|
|
476
|
-
walletProvider:
|
|
477
|
-
localStorageProvider:
|
|
478
|
-
onOpen:
|
|
479
|
-
onSuccess:
|
|
480
|
-
onClose:
|
|
604
|
+
walletProvider: M,
|
|
605
|
+
localStorageProvider: C,
|
|
606
|
+
onOpen: k,
|
|
607
|
+
onSuccess: P,
|
|
608
|
+
onClose: D,
|
|
481
609
|
autoCloseOnSuccess: T,
|
|
482
|
-
popupsBlocked:
|
|
483
|
-
baseUrl:
|
|
484
|
-
debug:
|
|
610
|
+
popupsBlocked: R,
|
|
611
|
+
baseUrl: B,
|
|
612
|
+
debug: W
|
|
485
613
|
}), [
|
|
486
614
|
s,
|
|
487
615
|
t,
|
|
@@ -490,40 +618,41 @@ const me = ({
|
|
|
490
618
|
o,
|
|
491
619
|
r,
|
|
492
620
|
p,
|
|
621
|
+
d,
|
|
493
622
|
a,
|
|
623
|
+
f,
|
|
624
|
+
c,
|
|
494
625
|
n,
|
|
495
|
-
|
|
626
|
+
h,
|
|
627
|
+
l,
|
|
628
|
+
m,
|
|
629
|
+
u,
|
|
496
630
|
g,
|
|
497
|
-
|
|
631
|
+
$,
|
|
498
632
|
y,
|
|
633
|
+
I,
|
|
499
634
|
w,
|
|
500
|
-
|
|
501
|
-
$,
|
|
502
|
-
l,
|
|
635
|
+
x,
|
|
503
636
|
v,
|
|
504
|
-
c,
|
|
505
637
|
S,
|
|
506
|
-
h,
|
|
507
|
-
x,
|
|
508
|
-
u,
|
|
509
|
-
I,
|
|
510
|
-
U,
|
|
511
638
|
E,
|
|
512
|
-
|
|
639
|
+
U,
|
|
513
640
|
M,
|
|
514
641
|
C,
|
|
642
|
+
k,
|
|
515
643
|
P,
|
|
516
|
-
T,
|
|
517
644
|
D,
|
|
518
|
-
|
|
519
|
-
R
|
|
645
|
+
T,
|
|
646
|
+
R,
|
|
647
|
+
B,
|
|
648
|
+
W
|
|
520
649
|
]);
|
|
521
650
|
return {
|
|
522
|
-
openGlideDeposit:
|
|
523
|
-
externalUrl:
|
|
524
|
-
opts:
|
|
651
|
+
openGlideDeposit: A.open,
|
|
652
|
+
externalUrl: A.externalUrl,
|
|
653
|
+
opts: A.opts
|
|
525
654
|
};
|
|
526
|
-
},
|
|
655
|
+
}, ye = ({
|
|
527
656
|
app: s,
|
|
528
657
|
preferGaslessPayment: t,
|
|
529
658
|
chainIds: e,
|
|
@@ -531,30 +660,30 @@ const me = ({
|
|
|
531
660
|
excludeCurrencyTiers: o,
|
|
532
661
|
excludeFundingSources: r,
|
|
533
662
|
fundingSources: p,
|
|
534
|
-
allowedPaymentCurrencies:
|
|
535
|
-
appMetadata:
|
|
536
|
-
enableRefundEmails:
|
|
537
|
-
payerEmail:
|
|
538
|
-
hideSettlementCopy:
|
|
539
|
-
showAppLogo:
|
|
540
|
-
showOnrampFirst:
|
|
541
|
-
debitCardAlias:
|
|
542
|
-
copyOverrides:
|
|
543
|
-
amount:
|
|
544
|
-
sessionId:
|
|
545
|
-
sessionMetadata:
|
|
546
|
-
theme:
|
|
547
|
-
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,
|
|
548
677
|
localStorageProvider: x,
|
|
549
|
-
onOpen:
|
|
550
|
-
onSuccess:
|
|
551
|
-
onClose:
|
|
552
|
-
autoCloseOnSuccess:
|
|
553
|
-
popupsBlocked:
|
|
554
|
-
baseUrl:
|
|
555
|
-
debug:
|
|
678
|
+
onOpen: v,
|
|
679
|
+
onSuccess: S,
|
|
680
|
+
onClose: E,
|
|
681
|
+
autoCloseOnSuccess: U,
|
|
682
|
+
popupsBlocked: M,
|
|
683
|
+
baseUrl: C,
|
|
684
|
+
debug: k
|
|
556
685
|
}) => {
|
|
557
|
-
const P =
|
|
686
|
+
const P = G(() => new H({
|
|
558
687
|
app: s,
|
|
559
688
|
preferGaslessPayment: t,
|
|
560
689
|
chainIds: e,
|
|
@@ -562,29 +691,29 @@ const me = ({
|
|
|
562
691
|
excludeCurrencyTiers: o,
|
|
563
692
|
excludeFundingSources: r,
|
|
564
693
|
fundingSources: p,
|
|
565
|
-
allowedPaymentCurrencies:
|
|
566
|
-
appMetadata:
|
|
567
|
-
enableRefundEmails:
|
|
568
|
-
payerEmail:
|
|
694
|
+
allowedPaymentCurrencies: d,
|
|
695
|
+
appMetadata: a,
|
|
696
|
+
enableRefundEmails: f,
|
|
697
|
+
payerEmail: c,
|
|
569
698
|
mode: "pay",
|
|
570
|
-
hideSettlementCopy:
|
|
571
|
-
showAppLogo:
|
|
572
|
-
showOnrampFirst:
|
|
573
|
-
debitCardAlias:
|
|
574
|
-
copyOverrides:
|
|
575
|
-
sessionId:
|
|
576
|
-
amount:
|
|
577
|
-
sessionMetadata:
|
|
578
|
-
theme:
|
|
579
|
-
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,
|
|
580
709
|
localStorageProvider: x,
|
|
581
|
-
onOpen:
|
|
582
|
-
onSuccess:
|
|
583
|
-
onClose:
|
|
584
|
-
autoCloseOnSuccess:
|
|
585
|
-
popupsBlocked:
|
|
586
|
-
baseUrl:
|
|
587
|
-
debug:
|
|
710
|
+
onOpen: v,
|
|
711
|
+
onSuccess: S,
|
|
712
|
+
onClose: E,
|
|
713
|
+
autoCloseOnSuccess: U,
|
|
714
|
+
popupsBlocked: M,
|
|
715
|
+
baseUrl: C,
|
|
716
|
+
debug: k
|
|
588
717
|
}), [
|
|
589
718
|
s,
|
|
590
719
|
t,
|
|
@@ -593,35 +722,35 @@ const me = ({
|
|
|
593
722
|
o,
|
|
594
723
|
r,
|
|
595
724
|
p,
|
|
725
|
+
d,
|
|
596
726
|
a,
|
|
727
|
+
f,
|
|
728
|
+
c,
|
|
597
729
|
n,
|
|
598
|
-
|
|
730
|
+
h,
|
|
731
|
+
l,
|
|
732
|
+
m,
|
|
733
|
+
u,
|
|
734
|
+
$,
|
|
599
735
|
g,
|
|
600
|
-
f,
|
|
601
736
|
y,
|
|
737
|
+
I,
|
|
602
738
|
w,
|
|
603
|
-
|
|
604
|
-
$,
|
|
739
|
+
x,
|
|
605
740
|
v,
|
|
606
|
-
l,
|
|
607
|
-
c,
|
|
608
741
|
S,
|
|
609
|
-
h,
|
|
610
|
-
x,
|
|
611
|
-
u,
|
|
612
|
-
I,
|
|
613
|
-
U,
|
|
614
742
|
E,
|
|
615
|
-
|
|
743
|
+
U,
|
|
616
744
|
M,
|
|
617
|
-
C
|
|
745
|
+
C,
|
|
746
|
+
k
|
|
618
747
|
]);
|
|
619
748
|
return {
|
|
620
749
|
openGlidePay: P.open,
|
|
621
750
|
externalUrl: P.externalUrl,
|
|
622
751
|
opts: P.opts
|
|
623
752
|
};
|
|
624
|
-
},
|
|
753
|
+
}, we = ({
|
|
625
754
|
app: s,
|
|
626
755
|
evm: t,
|
|
627
756
|
approval: e,
|
|
@@ -629,24 +758,24 @@ const me = ({
|
|
|
629
758
|
chainIds: o,
|
|
630
759
|
excludeChainIds: r,
|
|
631
760
|
excludeCurrencyTiers: p,
|
|
632
|
-
excludeFundingSources:
|
|
633
|
-
sessionMetadata:
|
|
634
|
-
showAppLogo:
|
|
635
|
-
showOnrampFirst:
|
|
636
|
-
debitCardAlias:
|
|
637
|
-
copyOverrides:
|
|
638
|
-
theme:
|
|
639
|
-
walletProvider:
|
|
640
|
-
localStorageProvider:
|
|
641
|
-
onOpen:
|
|
642
|
-
onSuccess:
|
|
643
|
-
onClose:
|
|
644
|
-
autoCloseOnSuccess:
|
|
645
|
-
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,
|
|
646
775
|
baseUrl: x,
|
|
647
|
-
debug:
|
|
776
|
+
debug: v
|
|
648
777
|
}) => {
|
|
649
|
-
const
|
|
778
|
+
const S = G(() => new H({
|
|
650
779
|
app: s,
|
|
651
780
|
evm: t,
|
|
652
781
|
approval: e,
|
|
@@ -654,23 +783,23 @@ const me = ({
|
|
|
654
783
|
chainIds: o,
|
|
655
784
|
excludeChainIds: r,
|
|
656
785
|
excludeCurrencyTiers: p,
|
|
657
|
-
excludeFundingSources:
|
|
658
|
-
sessionMetadata:
|
|
659
|
-
showAppLogo:
|
|
660
|
-
showOnrampFirst:
|
|
661
|
-
debitCardAlias:
|
|
662
|
-
copyOverrides:
|
|
786
|
+
excludeFundingSources: d,
|
|
787
|
+
sessionMetadata: a,
|
|
788
|
+
showAppLogo: f,
|
|
789
|
+
showOnrampFirst: c,
|
|
790
|
+
debitCardAlias: n,
|
|
791
|
+
copyOverrides: h,
|
|
663
792
|
mode: "call",
|
|
664
|
-
theme:
|
|
665
|
-
walletProvider:
|
|
666
|
-
localStorageProvider:
|
|
667
|
-
onOpen:
|
|
668
|
-
onSuccess:
|
|
669
|
-
onClose:
|
|
670
|
-
autoCloseOnSuccess:
|
|
671
|
-
popupsBlocked:
|
|
793
|
+
theme: l,
|
|
794
|
+
walletProvider: m,
|
|
795
|
+
localStorageProvider: u,
|
|
796
|
+
onOpen: g,
|
|
797
|
+
onSuccess: $,
|
|
798
|
+
onClose: y,
|
|
799
|
+
autoCloseOnSuccess: I,
|
|
800
|
+
popupsBlocked: w,
|
|
672
801
|
baseUrl: x,
|
|
673
|
-
debug:
|
|
802
|
+
debug: v
|
|
674
803
|
}), [
|
|
675
804
|
s,
|
|
676
805
|
t,
|
|
@@ -679,29 +808,29 @@ const me = ({
|
|
|
679
808
|
o,
|
|
680
809
|
r,
|
|
681
810
|
p,
|
|
811
|
+
d,
|
|
682
812
|
a,
|
|
813
|
+
f,
|
|
814
|
+
c,
|
|
683
815
|
n,
|
|
684
|
-
|
|
816
|
+
h,
|
|
817
|
+
l,
|
|
818
|
+
m,
|
|
819
|
+
u,
|
|
685
820
|
g,
|
|
686
|
-
|
|
821
|
+
$,
|
|
687
822
|
y,
|
|
823
|
+
I,
|
|
688
824
|
w,
|
|
689
|
-
b,
|
|
690
|
-
$,
|
|
691
|
-
l,
|
|
692
|
-
v,
|
|
693
|
-
c,
|
|
694
|
-
S,
|
|
695
|
-
h,
|
|
696
825
|
x,
|
|
697
|
-
|
|
826
|
+
v
|
|
698
827
|
]);
|
|
699
828
|
return {
|
|
700
|
-
openGlideCall:
|
|
701
|
-
externalUrl:
|
|
702
|
-
opts:
|
|
829
|
+
openGlideCall: S.open,
|
|
830
|
+
externalUrl: S.externalUrl,
|
|
831
|
+
opts: S.opts
|
|
703
832
|
};
|
|
704
|
-
},
|
|
833
|
+
}, ve = ({
|
|
705
834
|
app: s,
|
|
706
835
|
recipient: t,
|
|
707
836
|
chainId: e,
|
|
@@ -709,23 +838,23 @@ const me = ({
|
|
|
709
838
|
preferGaslessPayment: o,
|
|
710
839
|
chainIds: r,
|
|
711
840
|
excludeChainIds: p,
|
|
712
|
-
excludeCurrencyTiers:
|
|
713
|
-
excludeFundingSources:
|
|
714
|
-
sessionMetadata:
|
|
715
|
-
showAppLogo:
|
|
716
|
-
showOnrampFirst:
|
|
717
|
-
debitCardAlias:
|
|
718
|
-
copyOverrides:
|
|
719
|
-
theme:
|
|
720
|
-
walletProvider:
|
|
721
|
-
localStorageProvider:
|
|
722
|
-
onOpen:
|
|
723
|
-
onSuccess:
|
|
724
|
-
onClose:
|
|
725
|
-
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,
|
|
726
855
|
baseUrl: x
|
|
727
856
|
}) => {
|
|
728
|
-
const
|
|
857
|
+
const v = G(() => new H({
|
|
729
858
|
app: s,
|
|
730
859
|
recipient: t,
|
|
731
860
|
chainId: e,
|
|
@@ -733,21 +862,21 @@ const me = ({
|
|
|
733
862
|
preferGaslessPayment: o,
|
|
734
863
|
chainIds: r,
|
|
735
864
|
excludeChainIds: p,
|
|
736
|
-
excludeCurrencyTiers:
|
|
737
|
-
excludeFundingSources:
|
|
738
|
-
sessionMetadata:
|
|
739
|
-
showAppLogo:
|
|
740
|
-
showOnrampFirst:
|
|
741
|
-
debitCardAlias:
|
|
742
|
-
copyOverrides:
|
|
865
|
+
excludeCurrencyTiers: d,
|
|
866
|
+
excludeFundingSources: a,
|
|
867
|
+
sessionMetadata: f,
|
|
868
|
+
showAppLogo: c,
|
|
869
|
+
showOnrampFirst: n,
|
|
870
|
+
debitCardAlias: h,
|
|
871
|
+
copyOverrides: l,
|
|
743
872
|
mode: "buy",
|
|
744
|
-
theme:
|
|
745
|
-
walletProvider:
|
|
746
|
-
localStorageProvider:
|
|
747
|
-
onOpen:
|
|
748
|
-
onSuccess:
|
|
749
|
-
onClose:
|
|
750
|
-
autoCloseOnSuccess:
|
|
873
|
+
theme: m,
|
|
874
|
+
walletProvider: u,
|
|
875
|
+
localStorageProvider: g,
|
|
876
|
+
onOpen: $,
|
|
877
|
+
onSuccess: y,
|
|
878
|
+
onClose: I,
|
|
879
|
+
autoCloseOnSuccess: w,
|
|
751
880
|
baseUrl: x
|
|
752
881
|
}), [
|
|
753
882
|
s,
|
|
@@ -757,28 +886,28 @@ const me = ({
|
|
|
757
886
|
o,
|
|
758
887
|
r,
|
|
759
888
|
p,
|
|
889
|
+
d,
|
|
760
890
|
a,
|
|
891
|
+
f,
|
|
892
|
+
c,
|
|
761
893
|
n,
|
|
762
|
-
|
|
894
|
+
h,
|
|
895
|
+
l,
|
|
896
|
+
m,
|
|
897
|
+
u,
|
|
763
898
|
g,
|
|
764
|
-
|
|
899
|
+
$,
|
|
765
900
|
y,
|
|
901
|
+
I,
|
|
766
902
|
w,
|
|
767
|
-
b,
|
|
768
|
-
$,
|
|
769
|
-
l,
|
|
770
|
-
v,
|
|
771
|
-
c,
|
|
772
|
-
S,
|
|
773
|
-
h,
|
|
774
903
|
x
|
|
775
904
|
]);
|
|
776
905
|
return {
|
|
777
|
-
openGlideBuy:
|
|
778
|
-
externalUrl:
|
|
779
|
-
opts:
|
|
906
|
+
openGlideBuy: v.open,
|
|
907
|
+
externalUrl: v.externalUrl,
|
|
908
|
+
opts: v.opts
|
|
780
909
|
};
|
|
781
|
-
},
|
|
910
|
+
}, be = Object.freeze({
|
|
782
911
|
getItem: (s) => new Promise((t, e) => {
|
|
783
912
|
try {
|
|
784
913
|
const i = localStorage.getItem(s);
|
|
@@ -811,10 +940,11 @@ const me = ({
|
|
|
811
940
|
})
|
|
812
941
|
});
|
|
813
942
|
export {
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
943
|
+
H as GlideDeposit,
|
|
944
|
+
be as browserLocalStorageProvider,
|
|
945
|
+
ue as initializeParentBridge,
|
|
946
|
+
ve as useGlideBuy,
|
|
947
|
+
we as useGlideCall,
|
|
948
|
+
fe as useGlideDeposit,
|
|
949
|
+
ye as useGlidePay
|
|
820
950
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/theme.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ interface UseGlideDepositProps {
|
|
|
28
28
|
showOnrampFirst?: boolean;
|
|
29
29
|
debitCardAlias?: DebitCardAlias;
|
|
30
30
|
copyOverrides?: Record<string, string>;
|
|
31
|
+
stableDepositAddressKey?: string;
|
|
31
32
|
sessionId?: string;
|
|
32
33
|
sessionMetadata?: string;
|
|
33
34
|
disableWithdrawToSelfSuggestion?: boolean;
|
|
@@ -42,7 +43,7 @@ interface UseGlideDepositProps {
|
|
|
42
43
|
baseUrl?: string;
|
|
43
44
|
debug?: boolean;
|
|
44
45
|
}
|
|
45
|
-
export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, appMetadata, enableRefundEmails, payerEmail, mode, hideSettlementCopy, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
|
|
46
|
+
export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, appMetadata, enableRefundEmails, payerEmail, mode, hideSettlementCopy, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, stableDepositAddressKey, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
|
|
46
47
|
openGlideDeposit: () => void;
|
|
47
48
|
externalUrl: string;
|
|
48
49
|
opts: import('./GlideDeposit.ts').GlideDepositOptions;
|
|
@@ -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;
|