@paywithglide/glide-react 0.0.32 → 0.0.34
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 +197 -186
- package/dist/theme.d.ts +1 -0
- package/dist/useGlideDeposit.d.ts +3 -1
- package/package.json +1 -1
package/dist/GlideDeposit.d.ts
CHANGED
|
@@ -115,6 +115,7 @@ export type GlideDepositOptions = {
|
|
|
115
115
|
onSetMode?: (mode: "deposit" | "withdraw") => void;
|
|
116
116
|
autoCloseOnSuccess?: boolean;
|
|
117
117
|
container?: HTMLElement;
|
|
118
|
+
disableWithdrawToSelfSuggestion?: boolean;
|
|
118
119
|
theme?: GlideWidgetTheme;
|
|
119
120
|
popupsBlocked?: boolean;
|
|
120
121
|
baseUrl?: string;
|
package/dist/glide.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useMemo as
|
|
5
|
-
function
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var ee = (s, t, e) => t in s ? _(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var U = (s, t, e) => ee(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { useMemo as z } from "react";
|
|
5
|
+
function te(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 N(s) {
|
|
9
|
+
return te(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
let
|
|
11
|
+
const K = "2.21.51";
|
|
12
|
+
let k = {
|
|
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@${K}`
|
|
15
15
|
};
|
|
16
16
|
class x extends Error {
|
|
17
17
|
constructor(t, e = {}) {
|
|
@@ -19,13 +19,13 @@ class x extends Error {
|
|
|
19
19
|
const i = (() => {
|
|
20
20
|
var n;
|
|
21
21
|
return e.cause instanceof x ? e.cause.details : (n = e.cause) != null && n.message ? e.cause.message : e.details;
|
|
22
|
-
})(), r = e.cause instanceof x && e.cause.docsPath || e.docsPath, o = (a =
|
|
22
|
+
})(), r = e.cause instanceof x && e.cause.docsPath || e.docsPath, o = (a = k.getDocsUrl) == null ? void 0 : a.call(k, { ...e, docsPath: r }), c = [
|
|
23
23
|
t || "An error occurred.",
|
|
24
24
|
"",
|
|
25
25
|
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
26
26
|
...o ? [`Docs: ${o}`] : [],
|
|
27
27
|
...i ? [`Details: ${i}`] : [],
|
|
28
|
-
...
|
|
28
|
+
...k.version ? [`Version: ${k.version}`] : []
|
|
29
29
|
].join(`
|
|
30
30
|
`);
|
|
31
31
|
super(c, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -58,40 +58,40 @@ class x extends Error {
|
|
|
58
58
|
configurable: !0,
|
|
59
59
|
writable: !0,
|
|
60
60
|
value: "BaseError"
|
|
61
|
-
}), this.details = i, this.docsPath = r, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version =
|
|
61
|
+
}), this.details = i, this.docsPath = r, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = K;
|
|
62
62
|
}
|
|
63
63
|
walk(t) {
|
|
64
|
-
return
|
|
64
|
+
return F(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 F(s, t) {
|
|
68
|
+
return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? F(s.cause, t) : t ? null : s;
|
|
69
69
|
}
|
|
70
|
-
class
|
|
70
|
+
class V extends x {
|
|
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
75
|
function A(s, { dir: t, size: e = 32 } = {}) {
|
|
76
|
-
return typeof s == "string" ?
|
|
76
|
+
return typeof s == "string" ? se(s, { dir: t, size: e }) : ie(s, { dir: t, size: e });
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function se(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 V({
|
|
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 ie(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 V({
|
|
95
95
|
size: s.length,
|
|
96
96
|
targetSize: e,
|
|
97
97
|
type: "bytes"
|
|
@@ -103,46 +103,46 @@ function se(s, { dir: t, size: e = 32 } = {}) {
|
|
|
103
103
|
}
|
|
104
104
|
return i;
|
|
105
105
|
}
|
|
106
|
-
class
|
|
106
|
+
class re extends x {
|
|
107
107
|
constructor({ max: t, min: e, signed: i, size: r, value: o }) {
|
|
108
108
|
super(`Number "${o}" is not in safe ${r ? `${r * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
class
|
|
111
|
+
class oe extends x {
|
|
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 q(s, { size: t }) {
|
|
117
|
+
if (N(s) > t)
|
|
118
|
+
throw new oe({
|
|
119
|
+
givenSize: N(s),
|
|
120
120
|
maxSize: t
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
const
|
|
124
|
-
function ne(s, t = {}) {
|
|
125
|
-
return typeof s == "number" || typeof s == "bigint" ? ce(s, t) : typeof s == "string" ? le(s, t) : typeof s == "boolean" ? ae(s, t) : q(s, t);
|
|
126
|
-
}
|
|
123
|
+
const ne = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
|
|
127
124
|
function ae(s, t = {}) {
|
|
125
|
+
return typeof s == "number" || typeof s == "bigint" ? de(s, t) : typeof s == "string" ? pe(s, t) : typeof s == "boolean" ? ce(s, t) : J(s, t);
|
|
126
|
+
}
|
|
127
|
+
function ce(s, t = {}) {
|
|
128
128
|
const e = `0x${Number(s)}`;
|
|
129
|
-
return typeof t.size == "number" ? (
|
|
129
|
+
return typeof t.size == "number" ? (q(e, { size: t.size }), A(e, { size: t.size })) : e;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function J(s, t = {}) {
|
|
132
132
|
let e = "";
|
|
133
133
|
for (let r = 0; r < s.length; r++)
|
|
134
|
-
e +=
|
|
134
|
+
e += ne[s[r]];
|
|
135
135
|
const i = `0x${e}`;
|
|
136
|
-
return typeof t.size == "number" ? (
|
|
136
|
+
return typeof t.size == "number" ? (q(i, { size: t.size }), A(i, { dir: "right", size: t.size })) : i;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function de(s, t = {}) {
|
|
139
139
|
const { signed: e, size: i } = t, r = BigInt(s);
|
|
140
140
|
let o;
|
|
141
141
|
i ? e ? o = (1n << BigInt(i) * 8n - 1n) - 1n : o = 2n ** (BigInt(i) * 8n) - 1n : typeof s == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
|
|
142
142
|
const c = typeof o == "bigint" && e ? -o - 1n : 0;
|
|
143
143
|
if (o && r > o || r < c) {
|
|
144
144
|
const n = typeof s == "bigint" ? "n" : "";
|
|
145
|
-
throw new
|
|
145
|
+
throw new re({
|
|
146
146
|
max: o ? `${o}${n}` : void 0,
|
|
147
147
|
min: `${c}${n}`,
|
|
148
148
|
signed: e,
|
|
@@ -153,15 +153,15 @@ function ce(s, t = {}) {
|
|
|
153
153
|
const a = `0x${(e && r < 0 ? (1n << BigInt(i * 8)) + BigInt(r) : r).toString(16)}`;
|
|
154
154
|
return i ? A(a, { size: i }) : a;
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
158
|
-
const e =
|
|
159
|
-
return
|
|
156
|
+
const le = /* @__PURE__ */ new TextEncoder();
|
|
157
|
+
function pe(s, t = {}) {
|
|
158
|
+
const e = le.encode(s);
|
|
159
|
+
return J(e, t);
|
|
160
160
|
}
|
|
161
|
-
class
|
|
161
|
+
class T {
|
|
162
162
|
constructor(t) {
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
U(this, "opts");
|
|
164
|
+
U(this, "open", () => {
|
|
165
165
|
if (!(!this.opts.container && document.body.classList.contains("glide-deposit-open"))) {
|
|
166
166
|
if (this.opts.container || document.body.classList.add("glide-deposit-open"), (this.opts.mode === "deposit" || this.opts.mode === "buy") && !this.opts.recipient)
|
|
167
167
|
throw new Error("recipient is required for deposit/buy mode");
|
|
@@ -172,21 +172,21 @@ class z {
|
|
|
172
172
|
this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
|
-
|
|
176
|
-
var i, r, o, c, a, n,
|
|
175
|
+
U(this, "iframeEventHandler", async (t) => {
|
|
176
|
+
var i, r, o, c, a, n, u, m, g, f, y, w, b, d, l, p, S, v, I, P, E, $, M, D, C, G, W, j, B, H, O, L, R;
|
|
177
177
|
const e = t.data;
|
|
178
178
|
switch (e.type) {
|
|
179
179
|
case "sendInit": {
|
|
180
|
-
const
|
|
181
|
-
(
|
|
180
|
+
const h = this.opts.recipient, X = (i = this.opts.walletProvider) == null ? void 0 : i.address, Q = (r = this.opts.walletProvider) == null ? void 0 : r.availableChainIds, Y = (o = this.opts.walletProvider) == null ? void 0 : o.currentChainId, Z = this.opts.preferGaslessPayment || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
|
|
181
|
+
(u = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || u.postMessage(
|
|
182
182
|
{
|
|
183
183
|
type: "initialize",
|
|
184
184
|
sessionId: this.opts.sessionId,
|
|
185
|
-
recipient:
|
|
186
|
-
connectedWalletAddress:
|
|
187
|
-
availableChainIds:
|
|
188
|
-
currentChainId:
|
|
189
|
-
preferGaslessPayment:
|
|
185
|
+
recipient: h,
|
|
186
|
+
connectedWalletAddress: X,
|
|
187
|
+
availableChainIds: Q,
|
|
188
|
+
currentChainId: Y,
|
|
189
|
+
preferGaslessPayment: Z,
|
|
190
190
|
excludeChainIds: this.opts.excludeChainIds,
|
|
191
191
|
excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
|
|
192
192
|
excludeFundingSources: this.opts.excludeFundingSources,
|
|
@@ -198,24 +198,32 @@ class z {
|
|
|
198
198
|
tokenApproval: this.opts.approval,
|
|
199
199
|
sessionMetadata: this.opts.sessionMetadata,
|
|
200
200
|
autoCloseOnSuccess: this.opts.autoCloseOnSuccess,
|
|
201
|
-
|
|
201
|
+
disableWithdrawToSelfSuggestion: this.opts.disableWithdrawToSelfSuggestion,
|
|
202
|
+
theme: {
|
|
203
|
+
...this.opts.theme || {},
|
|
204
|
+
colorScheme: ((n = this.opts.theme) == null ? void 0 : n.colorScheme) || getComputedStyle(document.documentElement).colorScheme || ""
|
|
205
|
+
},
|
|
202
206
|
didProvideLocalStorage: !!this.opts.localStorageProvider,
|
|
203
207
|
debug: this.opts.debug,
|
|
204
208
|
popupsBlocked: this.opts.popupsBlocked,
|
|
205
209
|
gasRefuelAmountPerChain: this.opts.gasRefuelAmountPerChain
|
|
206
210
|
},
|
|
207
211
|
new URL(this.baseUrl).origin
|
|
208
|
-
)
|
|
212
|
+
);
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
case "didOpen": {
|
|
216
|
+
this.iframe.style.opacity = "1", (g = (m = this.opts).onOpen) == null || g.call(m);
|
|
209
217
|
break;
|
|
210
218
|
}
|
|
211
219
|
case "localStorage.getKeys": {
|
|
212
220
|
if (!this.opts.localStorageProvider)
|
|
213
221
|
throw new Error("localStorageProvider is not set");
|
|
214
|
-
const
|
|
215
|
-
(
|
|
222
|
+
const h = await this.opts.localStorageProvider.getKeys();
|
|
223
|
+
(y = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || y.postMessage(
|
|
216
224
|
{
|
|
217
225
|
type: "localStorage.didGetKeys",
|
|
218
|
-
keys:
|
|
226
|
+
keys: h
|
|
219
227
|
},
|
|
220
228
|
this.baseUrl
|
|
221
229
|
);
|
|
@@ -237,22 +245,22 @@ class z {
|
|
|
237
245
|
case "localStorage.getItem": {
|
|
238
246
|
if (!this.opts.localStorageProvider)
|
|
239
247
|
throw new Error("localStorageProvider is not set");
|
|
240
|
-
const
|
|
241
|
-
(
|
|
248
|
+
const h = await this.opts.localStorageProvider.getItem(e.key);
|
|
249
|
+
(b = (w = this.iframe) == null ? void 0 : w.contentWindow) == null || b.postMessage(
|
|
242
250
|
{
|
|
243
251
|
type: "localStorage.didGetItem",
|
|
244
252
|
key: e.key,
|
|
245
|
-
value:
|
|
253
|
+
value: h
|
|
246
254
|
},
|
|
247
255
|
this.baseUrl
|
|
248
256
|
);
|
|
249
257
|
break;
|
|
250
258
|
}
|
|
251
259
|
case "success":
|
|
252
|
-
(
|
|
260
|
+
(l = (d = this.opts) == null ? void 0 : d.onSuccess) == null || l.call(d, e.hash, e.session);
|
|
253
261
|
break;
|
|
254
262
|
case "close":
|
|
255
|
-
this.removeIframe(), this.destroy(), (
|
|
263
|
+
this.removeIframe(), this.destroy(), (S = (p = this.opts) == null ? void 0 : p.onClose) == null || S.call(p);
|
|
256
264
|
break;
|
|
257
265
|
case "setMode":
|
|
258
266
|
(I = (v = this.opts) == null ? void 0 : v.onSetMode) == null || I.call(v, e.mode);
|
|
@@ -263,7 +271,7 @@ class z {
|
|
|
263
271
|
try {
|
|
264
272
|
await this.opts.walletProvider.switchChainAsync({
|
|
265
273
|
chainId: e.chainId
|
|
266
|
-
}), (
|
|
274
|
+
}), (E = (P = this.iframe) == null ? void 0 : P.contentWindow) == null || E.postMessage(
|
|
267
275
|
{
|
|
268
276
|
type: "didSwitchChain",
|
|
269
277
|
success: !0,
|
|
@@ -271,12 +279,12 @@ class z {
|
|
|
271
279
|
},
|
|
272
280
|
this.baseUrl
|
|
273
281
|
);
|
|
274
|
-
} catch (
|
|
282
|
+
} catch (h) {
|
|
275
283
|
(M = ($ = this.iframe) == null ? void 0 : $.contentWindow) == null || M.postMessage(
|
|
276
284
|
{
|
|
277
285
|
type: "didSwitchChain",
|
|
278
286
|
success: !1,
|
|
279
|
-
error:
|
|
287
|
+
error: h
|
|
280
288
|
},
|
|
281
289
|
this.baseUrl
|
|
282
290
|
);
|
|
@@ -287,23 +295,23 @@ class z {
|
|
|
287
295
|
if (!this.opts.walletProvider)
|
|
288
296
|
throw new Error("walletProvider is not set");
|
|
289
297
|
try {
|
|
290
|
-
const
|
|
298
|
+
const h = await this.opts.walletProvider.sendTransactionAsync(
|
|
291
299
|
e.tx
|
|
292
300
|
);
|
|
293
|
-
(
|
|
301
|
+
(C = (D = this.iframe) == null ? void 0 : D.contentWindow) == null || C.postMessage(
|
|
294
302
|
{
|
|
295
303
|
type: "didSendTransaction",
|
|
296
304
|
success: !0,
|
|
297
|
-
txHash:
|
|
305
|
+
txHash: h
|
|
298
306
|
},
|
|
299
307
|
this.baseUrl
|
|
300
308
|
);
|
|
301
|
-
} catch (
|
|
302
|
-
(
|
|
309
|
+
} catch (h) {
|
|
310
|
+
(W = (G = this.iframe) == null ? void 0 : G.contentWindow) == null || W.postMessage(
|
|
303
311
|
{
|
|
304
312
|
type: "didSendTransaction",
|
|
305
313
|
success: !1,
|
|
306
|
-
error:
|
|
314
|
+
error: h
|
|
307
315
|
},
|
|
308
316
|
this.baseUrl
|
|
309
317
|
);
|
|
@@ -326,23 +334,23 @@ class z {
|
|
|
326
334
|
return;
|
|
327
335
|
}
|
|
328
336
|
try {
|
|
329
|
-
const
|
|
337
|
+
const h = await this.opts.walletProvider.signTypedDataAsync(
|
|
330
338
|
e.data
|
|
331
339
|
);
|
|
332
|
-
(
|
|
340
|
+
(O = (H = this.iframe) == null ? void 0 : H.contentWindow) == null || O.postMessage(
|
|
333
341
|
{
|
|
334
342
|
type: "didSignTypedData",
|
|
335
343
|
success: !0,
|
|
336
|
-
signature:
|
|
344
|
+
signature: h
|
|
337
345
|
},
|
|
338
346
|
this.baseUrl
|
|
339
347
|
);
|
|
340
|
-
} catch (
|
|
341
|
-
(
|
|
348
|
+
} catch (h) {
|
|
349
|
+
(R = (L = this.iframe) == null ? void 0 : L.contentWindow) == null || R.postMessage(
|
|
342
350
|
{
|
|
343
351
|
type: "didSignTypedData",
|
|
344
352
|
success: !1,
|
|
345
|
-
error:
|
|
353
|
+
error: h
|
|
346
354
|
},
|
|
347
355
|
this.baseUrl
|
|
348
356
|
);
|
|
@@ -355,9 +363,9 @@ class z {
|
|
|
355
363
|
}
|
|
356
364
|
get externalUrl() {
|
|
357
365
|
var t, e, i;
|
|
358
|
-
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=${
|
|
366
|
+
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=${ae(
|
|
359
367
|
this.opts.evm.value || 0n
|
|
360
|
-
)}` : ""}${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.excludeChainIds) != null && t.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(e = this.opts.excludeCurrencyTiers) != null && e.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(i = this.opts.excludeFundingSources) != null && i.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
|
|
368
|
+
)}` : ""}${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.excludeChainIds) != null && t.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(e = this.opts.excludeCurrencyTiers) != null && e.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(i = this.opts.excludeFundingSources) != null && i.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.disableWithdrawToSelfSuggestion ? "&disableWithdrawToSelfSuggestion=true" : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
|
|
361
369
|
}
|
|
362
370
|
initialize() {
|
|
363
371
|
window.addEventListener("message", this.iframeEventHandler);
|
|
@@ -392,7 +400,7 @@ class z {
|
|
|
392
400
|
t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
|
|
393
401
|
}
|
|
394
402
|
}
|
|
395
|
-
const
|
|
403
|
+
const me = ({
|
|
396
404
|
app: s,
|
|
397
405
|
recipient: t,
|
|
398
406
|
chainId: e,
|
|
@@ -402,22 +410,23 @@ const ue = ({
|
|
|
402
410
|
preferGaslessPayment: c,
|
|
403
411
|
excludeChainIds: a,
|
|
404
412
|
excludeCurrencyTiers: n,
|
|
405
|
-
excludeFundingSources:
|
|
406
|
-
mode:
|
|
407
|
-
sessionId:
|
|
413
|
+
excludeFundingSources: u,
|
|
414
|
+
mode: m,
|
|
415
|
+
sessionId: g,
|
|
408
416
|
sessionMetadata: f,
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
417
|
+
disableWithdrawToSelfSuggestion: y,
|
|
418
|
+
theme: w,
|
|
419
|
+
walletProvider: b,
|
|
420
|
+
localStorageProvider: d,
|
|
421
|
+
onOpen: l,
|
|
422
|
+
onSuccess: p,
|
|
423
|
+
onClose: S,
|
|
415
424
|
autoCloseOnSuccess: v,
|
|
416
425
|
popupsBlocked: I,
|
|
417
426
|
baseUrl: P,
|
|
418
|
-
debug:
|
|
427
|
+
debug: E
|
|
419
428
|
}) => {
|
|
420
|
-
const $ =
|
|
429
|
+
const $ = z(() => new T({
|
|
421
430
|
app: s,
|
|
422
431
|
recipient: t,
|
|
423
432
|
chainId: e,
|
|
@@ -427,20 +436,21 @@ const ue = ({
|
|
|
427
436
|
preferGaslessPayment: c,
|
|
428
437
|
excludeChainIds: a,
|
|
429
438
|
excludeCurrencyTiers: n,
|
|
430
|
-
excludeFundingSources:
|
|
431
|
-
mode:
|
|
432
|
-
sessionId:
|
|
439
|
+
excludeFundingSources: u,
|
|
440
|
+
mode: m,
|
|
441
|
+
sessionId: g,
|
|
433
442
|
sessionMetadata: f,
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
443
|
+
disableWithdrawToSelfSuggestion: y,
|
|
444
|
+
theme: w,
|
|
445
|
+
walletProvider: b,
|
|
446
|
+
localStorageProvider: d,
|
|
447
|
+
onOpen: l,
|
|
448
|
+
onSuccess: p,
|
|
449
|
+
onClose: S,
|
|
440
450
|
autoCloseOnSuccess: v,
|
|
441
451
|
popupsBlocked: I,
|
|
442
452
|
baseUrl: P,
|
|
443
|
-
debug:
|
|
453
|
+
debug: E
|
|
444
454
|
}), [
|
|
445
455
|
s,
|
|
446
456
|
t,
|
|
@@ -451,27 +461,28 @@ const ue = ({
|
|
|
451
461
|
c,
|
|
452
462
|
a,
|
|
453
463
|
n,
|
|
454
|
-
h,
|
|
455
464
|
u,
|
|
456
465
|
m,
|
|
457
|
-
f,
|
|
458
466
|
g,
|
|
467
|
+
f,
|
|
459
468
|
y,
|
|
460
|
-
l,
|
|
461
469
|
w,
|
|
462
|
-
d,
|
|
463
470
|
b,
|
|
471
|
+
d,
|
|
472
|
+
l,
|
|
473
|
+
p,
|
|
474
|
+
S,
|
|
464
475
|
v,
|
|
465
476
|
I,
|
|
466
477
|
P,
|
|
467
|
-
|
|
478
|
+
E
|
|
468
479
|
]);
|
|
469
480
|
return {
|
|
470
481
|
openGlideDeposit: $.open,
|
|
471
482
|
externalUrl: $.externalUrl,
|
|
472
483
|
opts: $.opts
|
|
473
484
|
};
|
|
474
|
-
},
|
|
485
|
+
}, ge = ({
|
|
475
486
|
app: s,
|
|
476
487
|
preferGaslessPayment: t,
|
|
477
488
|
excludeChainIds: e,
|
|
@@ -481,17 +492,17 @@ const ue = ({
|
|
|
481
492
|
sessionId: c,
|
|
482
493
|
sessionMetadata: a,
|
|
483
494
|
theme: n,
|
|
484
|
-
walletProvider:
|
|
485
|
-
localStorageProvider:
|
|
486
|
-
onOpen:
|
|
495
|
+
walletProvider: u,
|
|
496
|
+
localStorageProvider: m,
|
|
497
|
+
onOpen: g,
|
|
487
498
|
onSuccess: f,
|
|
488
|
-
onClose:
|
|
489
|
-
autoCloseOnSuccess:
|
|
490
|
-
popupsBlocked:
|
|
491
|
-
baseUrl:
|
|
492
|
-
debug:
|
|
499
|
+
onClose: y,
|
|
500
|
+
autoCloseOnSuccess: w,
|
|
501
|
+
popupsBlocked: b,
|
|
502
|
+
baseUrl: d,
|
|
503
|
+
debug: l
|
|
493
504
|
}) => {
|
|
494
|
-
const
|
|
505
|
+
const p = z(() => new T({
|
|
495
506
|
app: s,
|
|
496
507
|
preferGaslessPayment: t,
|
|
497
508
|
excludeChainIds: e,
|
|
@@ -502,15 +513,15 @@ const ue = ({
|
|
|
502
513
|
amount: o,
|
|
503
514
|
sessionMetadata: a,
|
|
504
515
|
theme: n,
|
|
505
|
-
walletProvider:
|
|
506
|
-
localStorageProvider:
|
|
507
|
-
onOpen:
|
|
516
|
+
walletProvider: u,
|
|
517
|
+
localStorageProvider: m,
|
|
518
|
+
onOpen: g,
|
|
508
519
|
onSuccess: f,
|
|
509
|
-
onClose:
|
|
510
|
-
autoCloseOnSuccess:
|
|
511
|
-
popupsBlocked:
|
|
512
|
-
baseUrl:
|
|
513
|
-
debug:
|
|
520
|
+
onClose: y,
|
|
521
|
+
autoCloseOnSuccess: w,
|
|
522
|
+
popupsBlocked: b,
|
|
523
|
+
baseUrl: d,
|
|
524
|
+
debug: l
|
|
514
525
|
}), [
|
|
515
526
|
s,
|
|
516
527
|
t,
|
|
@@ -521,20 +532,20 @@ const ue = ({
|
|
|
521
532
|
o,
|
|
522
533
|
a,
|
|
523
534
|
n,
|
|
524
|
-
h,
|
|
525
535
|
u,
|
|
526
536
|
m,
|
|
527
|
-
f,
|
|
528
537
|
g,
|
|
538
|
+
f,
|
|
529
539
|
y,
|
|
530
|
-
l,
|
|
531
540
|
w,
|
|
532
|
-
|
|
541
|
+
b,
|
|
542
|
+
d,
|
|
543
|
+
l
|
|
533
544
|
]);
|
|
534
545
|
return {
|
|
535
|
-
openGlidePay:
|
|
536
|
-
externalUrl:
|
|
537
|
-
opts:
|
|
546
|
+
openGlidePay: p.open,
|
|
547
|
+
externalUrl: p.externalUrl,
|
|
548
|
+
opts: p.opts
|
|
538
549
|
};
|
|
539
550
|
}, fe = ({
|
|
540
551
|
app: s,
|
|
@@ -546,17 +557,17 @@ const ue = ({
|
|
|
546
557
|
excludeFundingSources: c,
|
|
547
558
|
sessionMetadata: a,
|
|
548
559
|
theme: n,
|
|
549
|
-
walletProvider:
|
|
550
|
-
localStorageProvider:
|
|
551
|
-
onOpen:
|
|
560
|
+
walletProvider: u,
|
|
561
|
+
localStorageProvider: m,
|
|
562
|
+
onOpen: g,
|
|
552
563
|
onSuccess: f,
|
|
553
|
-
onClose:
|
|
554
|
-
autoCloseOnSuccess:
|
|
555
|
-
popupsBlocked:
|
|
556
|
-
baseUrl:
|
|
557
|
-
debug:
|
|
564
|
+
onClose: y,
|
|
565
|
+
autoCloseOnSuccess: w,
|
|
566
|
+
popupsBlocked: b,
|
|
567
|
+
baseUrl: d,
|
|
568
|
+
debug: l
|
|
558
569
|
}) => {
|
|
559
|
-
const
|
|
570
|
+
const p = z(() => new T({
|
|
560
571
|
app: s,
|
|
561
572
|
evm: t,
|
|
562
573
|
approval: e,
|
|
@@ -567,15 +578,15 @@ const ue = ({
|
|
|
567
578
|
sessionMetadata: a,
|
|
568
579
|
mode: "call",
|
|
569
580
|
theme: n,
|
|
570
|
-
walletProvider:
|
|
571
|
-
localStorageProvider:
|
|
572
|
-
onOpen:
|
|
581
|
+
walletProvider: u,
|
|
582
|
+
localStorageProvider: m,
|
|
583
|
+
onOpen: g,
|
|
573
584
|
onSuccess: f,
|
|
574
|
-
onClose:
|
|
575
|
-
autoCloseOnSuccess:
|
|
576
|
-
popupsBlocked:
|
|
577
|
-
baseUrl:
|
|
578
|
-
debug:
|
|
585
|
+
onClose: y,
|
|
586
|
+
autoCloseOnSuccess: w,
|
|
587
|
+
popupsBlocked: b,
|
|
588
|
+
baseUrl: d,
|
|
589
|
+
debug: l
|
|
579
590
|
}), [
|
|
580
591
|
s,
|
|
581
592
|
t,
|
|
@@ -586,22 +597,22 @@ const ue = ({
|
|
|
586
597
|
c,
|
|
587
598
|
a,
|
|
588
599
|
n,
|
|
589
|
-
h,
|
|
590
600
|
u,
|
|
591
601
|
m,
|
|
592
|
-
f,
|
|
593
602
|
g,
|
|
603
|
+
f,
|
|
594
604
|
y,
|
|
595
|
-
l,
|
|
596
605
|
w,
|
|
597
|
-
|
|
606
|
+
b,
|
|
607
|
+
d,
|
|
608
|
+
l
|
|
598
609
|
]);
|
|
599
610
|
return {
|
|
600
|
-
openGlideCall:
|
|
601
|
-
externalUrl:
|
|
602
|
-
opts:
|
|
611
|
+
openGlideCall: p.open,
|
|
612
|
+
externalUrl: p.externalUrl,
|
|
613
|
+
opts: p.opts
|
|
603
614
|
};
|
|
604
|
-
},
|
|
615
|
+
}, ye = ({
|
|
605
616
|
app: s,
|
|
606
617
|
recipient: t,
|
|
607
618
|
chainId: e,
|
|
@@ -611,16 +622,16 @@ const ue = ({
|
|
|
611
622
|
excludeCurrencyTiers: c,
|
|
612
623
|
excludeFundingSources: a,
|
|
613
624
|
sessionMetadata: n,
|
|
614
|
-
theme:
|
|
615
|
-
walletProvider:
|
|
616
|
-
localStorageProvider:
|
|
625
|
+
theme: u,
|
|
626
|
+
walletProvider: m,
|
|
627
|
+
localStorageProvider: g,
|
|
617
628
|
onOpen: f,
|
|
618
|
-
onSuccess:
|
|
619
|
-
onClose:
|
|
620
|
-
autoCloseOnSuccess:
|
|
621
|
-
baseUrl:
|
|
629
|
+
onSuccess: y,
|
|
630
|
+
onClose: w,
|
|
631
|
+
autoCloseOnSuccess: b,
|
|
632
|
+
baseUrl: d
|
|
622
633
|
}) => {
|
|
623
|
-
const
|
|
634
|
+
const l = z(() => new T({
|
|
624
635
|
app: s,
|
|
625
636
|
recipient: t,
|
|
626
637
|
chainId: e,
|
|
@@ -631,14 +642,14 @@ const ue = ({
|
|
|
631
642
|
excludeFundingSources: a,
|
|
632
643
|
sessionMetadata: n,
|
|
633
644
|
mode: "buy",
|
|
634
|
-
theme:
|
|
635
|
-
walletProvider:
|
|
636
|
-
localStorageProvider:
|
|
645
|
+
theme: u,
|
|
646
|
+
walletProvider: m,
|
|
647
|
+
localStorageProvider: g,
|
|
637
648
|
onOpen: f,
|
|
638
|
-
onSuccess:
|
|
639
|
-
onClose:
|
|
640
|
-
autoCloseOnSuccess:
|
|
641
|
-
baseUrl:
|
|
649
|
+
onSuccess: y,
|
|
650
|
+
onClose: w,
|
|
651
|
+
autoCloseOnSuccess: b,
|
|
652
|
+
baseUrl: d
|
|
642
653
|
}), [
|
|
643
654
|
s,
|
|
644
655
|
t,
|
|
@@ -649,21 +660,21 @@ const ue = ({
|
|
|
649
660
|
c,
|
|
650
661
|
a,
|
|
651
662
|
n,
|
|
652
|
-
h,
|
|
653
663
|
u,
|
|
654
664
|
m,
|
|
655
|
-
f,
|
|
656
665
|
g,
|
|
666
|
+
f,
|
|
657
667
|
y,
|
|
658
|
-
|
|
659
|
-
|
|
668
|
+
w,
|
|
669
|
+
b,
|
|
670
|
+
d
|
|
660
671
|
]);
|
|
661
672
|
return {
|
|
662
|
-
openGlideBuy:
|
|
663
|
-
externalUrl:
|
|
664
|
-
opts:
|
|
673
|
+
openGlideBuy: l.open,
|
|
674
|
+
externalUrl: l.externalUrl,
|
|
675
|
+
opts: l.opts
|
|
665
676
|
};
|
|
666
|
-
},
|
|
677
|
+
}, we = Object.freeze({
|
|
667
678
|
getItem: (s) => new Promise((t, e) => {
|
|
668
679
|
try {
|
|
669
680
|
const i = localStorage.getItem(s);
|
|
@@ -696,10 +707,10 @@ const ue = ({
|
|
|
696
707
|
})
|
|
697
708
|
});
|
|
698
709
|
export {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
710
|
+
T as GlideDeposit,
|
|
711
|
+
we as browserLocalStorageProvider,
|
|
712
|
+
ye as useGlideBuy,
|
|
702
713
|
fe as useGlideCall,
|
|
703
|
-
|
|
704
|
-
|
|
714
|
+
me as useGlideDeposit,
|
|
715
|
+
ge as useGlidePay
|
|
705
716
|
};
|
package/dist/theme.d.ts
CHANGED
|
@@ -13,8 +13,10 @@ interface UseGlideDepositProps {
|
|
|
13
13
|
excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
|
|
14
14
|
excludeFundingSources?: FundingSource[];
|
|
15
15
|
mode?: "deposit" | "withdraw";
|
|
16
|
+
hideWithdrawAddress?: boolean;
|
|
16
17
|
sessionId?: string;
|
|
17
18
|
sessionMetadata?: string;
|
|
19
|
+
disableWithdrawToSelfSuggestion?: boolean;
|
|
18
20
|
theme?: GlideWidgetTheme;
|
|
19
21
|
walletProvider?: GlideDepositWalletProvider;
|
|
20
22
|
localStorageProvider?: GlideLocalStorageProvider;
|
|
@@ -26,7 +28,7 @@ interface UseGlideDepositProps {
|
|
|
26
28
|
baseUrl?: string;
|
|
27
29
|
debug?: boolean;
|
|
28
30
|
}
|
|
29
|
-
export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionId, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
|
|
31
|
+
export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
|
|
30
32
|
openGlideDeposit: () => void;
|
|
31
33
|
externalUrl: string;
|
|
32
34
|
opts: import('./GlideDeposit.ts').GlideDepositOptions;
|