@paywithglide/glide-react 0.0.29 → 0.0.31
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 +185 -168
- package/dist/useGlideBuy.d.ts +3 -1
- package/dist/useGlideDeposit.d.ts +4 -1
- package/package.json +1 -1
package/dist/GlideDeposit.d.ts
CHANGED
package/dist/glide.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Z = Object.defineProperty;
|
|
2
2
|
var _ = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
-
var
|
|
4
|
-
import { useMemo as
|
|
3
|
+
var E = (s, t, e) => _(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { useMemo as k } from "react";
|
|
5
5
|
function ee(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
|
}
|
|
@@ -9,23 +9,23 @@ function R(s) {
|
|
|
9
9
|
return ee(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
|
|
10
10
|
}
|
|
11
11
|
const N = "2.21.51";
|
|
12
|
-
let
|
|
12
|
+
let S = {
|
|
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
|
-
class
|
|
16
|
+
class x extends Error {
|
|
17
17
|
constructor(t, e = {}) {
|
|
18
18
|
var a;
|
|
19
19
|
const i = (() => {
|
|
20
20
|
var n;
|
|
21
|
-
return e.cause instanceof
|
|
22
|
-
})(), r = e.cause instanceof
|
|
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 = S.getDocsUrl) == null ? void 0 : a.call(S, { ...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
|
+
...S.version ? [`Version: ${S.version}`] : []
|
|
29
29
|
].join(`
|
|
30
30
|
`);
|
|
31
31
|
super(c, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -67,12 +67,12 @@ class $ extends Error {
|
|
|
67
67
|
function K(s, t) {
|
|
68
68
|
return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? K(s.cause, t) : t ? null : s;
|
|
69
69
|
}
|
|
70
|
-
class F extends
|
|
70
|
+
class F 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
|
-
function
|
|
75
|
+
function z(s, { dir: t, size: e = 32 } = {}) {
|
|
76
76
|
return typeof s == "string" ? te(s, { dir: t, size: e }) : se(s, { dir: t, size: e });
|
|
77
77
|
}
|
|
78
78
|
function te(s, { dir: t, size: e = 32 } = {}) {
|
|
@@ -103,12 +103,12 @@ function se(s, { dir: t, size: e = 32 } = {}) {
|
|
|
103
103
|
}
|
|
104
104
|
return i;
|
|
105
105
|
}
|
|
106
|
-
class ie extends
|
|
106
|
+
class ie 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 re extends
|
|
111
|
+
class re 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
|
}
|
|
@@ -122,18 +122,18 @@ function V(s, { size: t }) {
|
|
|
122
122
|
}
|
|
123
123
|
const oe = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
|
|
124
124
|
function ne(s, t = {}) {
|
|
125
|
-
return typeof s == "number" || typeof s == "bigint" ? ce(s, t) : typeof s == "string" ?
|
|
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
126
|
}
|
|
127
127
|
function ae(s, t = {}) {
|
|
128
128
|
const e = `0x${Number(s)}`;
|
|
129
|
-
return typeof t.size == "number" ? (V(e, { size: t.size }),
|
|
129
|
+
return typeof t.size == "number" ? (V(e, { size: t.size }), z(e, { size: t.size })) : e;
|
|
130
130
|
}
|
|
131
131
|
function q(s, t = {}) {
|
|
132
132
|
let e = "";
|
|
133
133
|
for (let r = 0; r < s.length; r++)
|
|
134
134
|
e += oe[s[r]];
|
|
135
135
|
const i = `0x${e}`;
|
|
136
|
-
return typeof t.size == "number" ? (V(i, { size: t.size }),
|
|
136
|
+
return typeof t.size == "number" ? (V(i, { size: t.size }), z(i, { dir: "right", size: t.size })) : i;
|
|
137
137
|
}
|
|
138
138
|
function ce(s, t = {}) {
|
|
139
139
|
const { signed: e, size: i } = t, r = BigInt(s);
|
|
@@ -151,17 +151,17 @@ function ce(s, t = {}) {
|
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
const a = `0x${(e && r < 0 ? (1n << BigInt(i * 8)) + BigInt(r) : r).toString(16)}`;
|
|
154
|
-
return i ?
|
|
154
|
+
return i ? z(a, { size: i }) : a;
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
158
|
-
const e =
|
|
156
|
+
const de = /* @__PURE__ */ new TextEncoder();
|
|
157
|
+
function le(s, t = {}) {
|
|
158
|
+
const e = de.encode(s);
|
|
159
159
|
return q(e, t);
|
|
160
160
|
}
|
|
161
|
-
class
|
|
161
|
+
class U {
|
|
162
162
|
constructor(t) {
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
E(this, "opts");
|
|
164
|
+
E(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,17 +172,17 @@ class S {
|
|
|
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
|
+
E(this, "iframeEventHandler", async (t) => {
|
|
176
|
+
var i, r, o, c, a, n, h, u, m, f, g, y, l, w, d, b, v, I, P, $, A, M, T, D, C, G, j, B, W, H, L, O;
|
|
177
177
|
const e = t.data;
|
|
178
178
|
switch (e.type) {
|
|
179
179
|
case "sendInit": {
|
|
180
|
-
const
|
|
180
|
+
const p = this.opts.recipient, J = (i = this.opts.walletProvider) == null ? void 0 : i.address, X = (r = this.opts.walletProvider) == null ? void 0 : r.availableChainIds, Q = (o = this.opts.walletProvider) == null ? void 0 : o.currentChainId, Y = this.opts.preferGaslessPayment || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
|
|
181
181
|
(n = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || n.postMessage(
|
|
182
182
|
{
|
|
183
183
|
type: "initialize",
|
|
184
184
|
sessionId: this.opts.sessionId,
|
|
185
|
-
recipient:
|
|
185
|
+
recipient: p,
|
|
186
186
|
connectedWalletAddress: J,
|
|
187
187
|
availableChainIds: X,
|
|
188
188
|
currentChainId: Q,
|
|
@@ -192,6 +192,8 @@ class S {
|
|
|
192
192
|
excludeFundingSources: this.opts.excludeFundingSources,
|
|
193
193
|
mode: this.opts.mode,
|
|
194
194
|
amount: this.opts.amount,
|
|
195
|
+
chainId: this.opts.chainId,
|
|
196
|
+
currencyId: this.opts.currencyId,
|
|
195
197
|
evmTx: this.opts.evm,
|
|
196
198
|
tokenApproval: this.opts.approval,
|
|
197
199
|
sessionMetadata: this.opts.sessionMetadata,
|
|
@@ -203,17 +205,17 @@ class S {
|
|
|
203
205
|
gasRefuelAmountPerChain: this.opts.gasRefuelAmountPerChain
|
|
204
206
|
},
|
|
205
207
|
new URL(this.baseUrl).origin
|
|
206
|
-
), this.iframe.style.opacity = "1", (
|
|
208
|
+
), this.iframe.style.opacity = "1", (u = (h = this.opts).onOpen) == null || u.call(h);
|
|
207
209
|
break;
|
|
208
210
|
}
|
|
209
211
|
case "localStorage.getKeys": {
|
|
210
212
|
if (!this.opts.localStorageProvider)
|
|
211
213
|
throw new Error("localStorageProvider is not set");
|
|
212
|
-
const
|
|
213
|
-
(
|
|
214
|
+
const p = await this.opts.localStorageProvider.getKeys();
|
|
215
|
+
(f = (m = this.iframe) == null ? void 0 : m.contentWindow) == null || f.postMessage(
|
|
214
216
|
{
|
|
215
217
|
type: "localStorage.didGetKeys",
|
|
216
|
-
keys:
|
|
218
|
+
keys: p
|
|
217
219
|
},
|
|
218
220
|
this.baseUrl
|
|
219
221
|
);
|
|
@@ -235,25 +237,25 @@ class S {
|
|
|
235
237
|
case "localStorage.getItem": {
|
|
236
238
|
if (!this.opts.localStorageProvider)
|
|
237
239
|
throw new Error("localStorageProvider is not set");
|
|
238
|
-
const
|
|
239
|
-
(
|
|
240
|
+
const p = await this.opts.localStorageProvider.getItem(e.key);
|
|
241
|
+
(y = (g = this.iframe) == null ? void 0 : g.contentWindow) == null || y.postMessage(
|
|
240
242
|
{
|
|
241
243
|
type: "localStorage.didGetItem",
|
|
242
244
|
key: e.key,
|
|
243
|
-
value:
|
|
245
|
+
value: p
|
|
244
246
|
},
|
|
245
247
|
this.baseUrl
|
|
246
248
|
);
|
|
247
249
|
break;
|
|
248
250
|
}
|
|
249
251
|
case "success":
|
|
250
|
-
(
|
|
252
|
+
(w = (l = this.opts) == null ? void 0 : l.onSuccess) == null || w.call(l, e.hash);
|
|
251
253
|
break;
|
|
252
254
|
case "close":
|
|
253
|
-
this.removeIframe(), this.destroy(), (
|
|
255
|
+
this.removeIframe(), this.destroy(), (b = (d = this.opts) == null ? void 0 : d.onClose) == null || b.call(d);
|
|
254
256
|
break;
|
|
255
257
|
case "setMode":
|
|
256
|
-
(
|
|
258
|
+
(I = (v = this.opts) == null ? void 0 : v.onSetMode) == null || I.call(v, e.mode);
|
|
257
259
|
break;
|
|
258
260
|
case "switchChain":
|
|
259
261
|
if (!this.opts.walletProvider)
|
|
@@ -261,7 +263,7 @@ class S {
|
|
|
261
263
|
try {
|
|
262
264
|
await this.opts.walletProvider.switchChainAsync({
|
|
263
265
|
chainId: e.chainId
|
|
264
|
-
}), (
|
|
266
|
+
}), ($ = (P = this.iframe) == null ? void 0 : P.contentWindow) == null || $.postMessage(
|
|
265
267
|
{
|
|
266
268
|
type: "didSwitchChain",
|
|
267
269
|
success: !0,
|
|
@@ -269,12 +271,12 @@ class S {
|
|
|
269
271
|
},
|
|
270
272
|
this.baseUrl
|
|
271
273
|
);
|
|
272
|
-
} catch (
|
|
274
|
+
} catch (p) {
|
|
273
275
|
(M = (A = this.iframe) == null ? void 0 : A.contentWindow) == null || M.postMessage(
|
|
274
276
|
{
|
|
275
277
|
type: "didSwitchChain",
|
|
276
278
|
success: !1,
|
|
277
|
-
error:
|
|
279
|
+
error: p
|
|
278
280
|
},
|
|
279
281
|
this.baseUrl
|
|
280
282
|
);
|
|
@@ -285,23 +287,23 @@ class S {
|
|
|
285
287
|
if (!this.opts.walletProvider)
|
|
286
288
|
throw new Error("walletProvider is not set");
|
|
287
289
|
try {
|
|
288
|
-
const
|
|
290
|
+
const p = await this.opts.walletProvider.sendTransactionAsync(
|
|
289
291
|
e.tx
|
|
290
292
|
);
|
|
291
293
|
(D = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || D.postMessage(
|
|
292
294
|
{
|
|
293
295
|
type: "didSendTransaction",
|
|
294
296
|
success: !0,
|
|
295
|
-
txHash:
|
|
297
|
+
txHash: p
|
|
296
298
|
},
|
|
297
299
|
this.baseUrl
|
|
298
300
|
);
|
|
299
|
-
} catch (
|
|
301
|
+
} catch (p) {
|
|
300
302
|
(G = (C = this.iframe) == null ? void 0 : C.contentWindow) == null || G.postMessage(
|
|
301
303
|
{
|
|
302
304
|
type: "didSendTransaction",
|
|
303
305
|
success: !1,
|
|
304
|
-
error:
|
|
306
|
+
error: p
|
|
305
307
|
},
|
|
306
308
|
this.baseUrl
|
|
307
309
|
);
|
|
@@ -324,23 +326,23 @@ class S {
|
|
|
324
326
|
return;
|
|
325
327
|
}
|
|
326
328
|
try {
|
|
327
|
-
const
|
|
329
|
+
const p = await this.opts.walletProvider.signTypedDataAsync(
|
|
328
330
|
e.data
|
|
329
331
|
);
|
|
330
332
|
(H = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || H.postMessage(
|
|
331
333
|
{
|
|
332
334
|
type: "didSignTypedData",
|
|
333
335
|
success: !0,
|
|
334
|
-
signature:
|
|
336
|
+
signature: p
|
|
335
337
|
},
|
|
336
338
|
this.baseUrl
|
|
337
339
|
);
|
|
338
|
-
} catch (
|
|
340
|
+
} catch (p) {
|
|
339
341
|
(O = (L = this.iframe) == null ? void 0 : L.contentWindow) == null || O.postMessage(
|
|
340
342
|
{
|
|
341
343
|
type: "didSignTypedData",
|
|
342
344
|
success: !1,
|
|
343
|
-
error:
|
|
345
|
+
error: p
|
|
344
346
|
},
|
|
345
347
|
this.baseUrl
|
|
346
348
|
);
|
|
@@ -353,9 +355,9 @@ class S {
|
|
|
353
355
|
}
|
|
354
356
|
get externalUrl() {
|
|
355
357
|
var t, e, i;
|
|
356
|
-
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.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${ne(
|
|
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=${ne(
|
|
357
359
|
this.opts.evm.value || 0n
|
|
358
|
-
)}` : ""}${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))}` : ""}`;
|
|
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))}` : ""}`;
|
|
359
361
|
}
|
|
360
362
|
initialize() {
|
|
361
363
|
window.addEventListener("message", this.iframeEventHandler);
|
|
@@ -393,44 +395,50 @@ class S {
|
|
|
393
395
|
const ue = ({
|
|
394
396
|
app: s,
|
|
395
397
|
recipient: t,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
398
|
+
chainId: e,
|
|
399
|
+
currencyId: i,
|
|
400
|
+
amount: r,
|
|
401
|
+
gasRefuelAmountPerChain: o,
|
|
402
|
+
preferGaslessPayment: c,
|
|
403
|
+
excludeChainIds: a,
|
|
404
|
+
excludeCurrencyTiers: n,
|
|
405
|
+
excludeFundingSources: h,
|
|
406
|
+
mode: u,
|
|
407
|
+
sessionMetadata: m,
|
|
408
|
+
theme: f,
|
|
409
|
+
walletProvider: g,
|
|
410
|
+
localStorageProvider: y,
|
|
411
|
+
onOpen: l,
|
|
412
|
+
onSuccess: w,
|
|
413
|
+
onClose: d,
|
|
414
|
+
autoCloseOnSuccess: b,
|
|
415
|
+
popupsBlocked: v,
|
|
416
|
+
baseUrl: I,
|
|
417
|
+
debug: P
|
|
413
418
|
}) => {
|
|
414
|
-
const
|
|
419
|
+
const $ = k(() => new U({
|
|
415
420
|
app: s,
|
|
416
421
|
recipient: t,
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
422
|
+
chainId: e,
|
|
423
|
+
currencyId: i,
|
|
424
|
+
amount: r,
|
|
425
|
+
gasRefuelAmountPerChain: o,
|
|
426
|
+
preferGaslessPayment: c,
|
|
427
|
+
excludeChainIds: a,
|
|
428
|
+
excludeCurrencyTiers: n,
|
|
429
|
+
excludeFundingSources: h,
|
|
430
|
+
mode: u,
|
|
431
|
+
sessionMetadata: m,
|
|
432
|
+
theme: f,
|
|
433
|
+
walletProvider: g,
|
|
434
|
+
localStorageProvider: y,
|
|
435
|
+
onOpen: l,
|
|
436
|
+
onSuccess: w,
|
|
437
|
+
onClose: d,
|
|
438
|
+
autoCloseOnSuccess: b,
|
|
439
|
+
popupsBlocked: v,
|
|
440
|
+
baseUrl: I,
|
|
441
|
+
debug: P
|
|
434
442
|
}), [
|
|
435
443
|
s,
|
|
436
444
|
t,
|
|
@@ -441,21 +449,24 @@ const ue = ({
|
|
|
441
449
|
c,
|
|
442
450
|
a,
|
|
443
451
|
n,
|
|
444
|
-
p,
|
|
445
452
|
h,
|
|
446
453
|
u,
|
|
447
454
|
m,
|
|
448
455
|
f,
|
|
449
456
|
g,
|
|
457
|
+
y,
|
|
450
458
|
l,
|
|
459
|
+
w,
|
|
460
|
+
d,
|
|
451
461
|
b,
|
|
452
|
-
|
|
453
|
-
|
|
462
|
+
v,
|
|
463
|
+
I,
|
|
464
|
+
P
|
|
454
465
|
]);
|
|
455
466
|
return {
|
|
456
|
-
openGlideDeposit:
|
|
457
|
-
externalUrl:
|
|
458
|
-
opts:
|
|
467
|
+
openGlideDeposit: $.open,
|
|
468
|
+
externalUrl: $.externalUrl,
|
|
469
|
+
opts: $.opts
|
|
459
470
|
};
|
|
460
471
|
}, me = ({
|
|
461
472
|
app: s,
|
|
@@ -467,17 +478,17 @@ const ue = ({
|
|
|
467
478
|
sessionId: c,
|
|
468
479
|
sessionMetadata: a,
|
|
469
480
|
theme: n,
|
|
470
|
-
walletProvider:
|
|
471
|
-
localStorageProvider:
|
|
472
|
-
onOpen:
|
|
473
|
-
onSuccess:
|
|
474
|
-
onClose:
|
|
475
|
-
autoCloseOnSuccess:
|
|
481
|
+
walletProvider: h,
|
|
482
|
+
localStorageProvider: u,
|
|
483
|
+
onOpen: m,
|
|
484
|
+
onSuccess: f,
|
|
485
|
+
onClose: g,
|
|
486
|
+
autoCloseOnSuccess: y,
|
|
476
487
|
popupsBlocked: l,
|
|
477
|
-
baseUrl:
|
|
478
|
-
debug:
|
|
488
|
+
baseUrl: w,
|
|
489
|
+
debug: d
|
|
479
490
|
}) => {
|
|
480
|
-
const
|
|
491
|
+
const b = k(() => new U({
|
|
481
492
|
app: s,
|
|
482
493
|
preferGaslessPayment: t,
|
|
483
494
|
excludeChainIds: e,
|
|
@@ -488,15 +499,15 @@ const ue = ({
|
|
|
488
499
|
amount: o,
|
|
489
500
|
sessionMetadata: a,
|
|
490
501
|
theme: n,
|
|
491
|
-
walletProvider:
|
|
492
|
-
localStorageProvider:
|
|
493
|
-
onOpen:
|
|
494
|
-
onSuccess:
|
|
495
|
-
onClose:
|
|
496
|
-
autoCloseOnSuccess:
|
|
502
|
+
walletProvider: h,
|
|
503
|
+
localStorageProvider: u,
|
|
504
|
+
onOpen: m,
|
|
505
|
+
onSuccess: f,
|
|
506
|
+
onClose: g,
|
|
507
|
+
autoCloseOnSuccess: y,
|
|
497
508
|
popupsBlocked: l,
|
|
498
|
-
baseUrl:
|
|
499
|
-
debug:
|
|
509
|
+
baseUrl: w,
|
|
510
|
+
debug: d
|
|
500
511
|
}), [
|
|
501
512
|
s,
|
|
502
513
|
t,
|
|
@@ -507,20 +518,20 @@ const ue = ({
|
|
|
507
518
|
o,
|
|
508
519
|
a,
|
|
509
520
|
n,
|
|
510
|
-
p,
|
|
511
521
|
h,
|
|
512
522
|
u,
|
|
513
523
|
m,
|
|
514
524
|
f,
|
|
515
525
|
g,
|
|
526
|
+
y,
|
|
516
527
|
l,
|
|
517
|
-
|
|
518
|
-
|
|
528
|
+
w,
|
|
529
|
+
d
|
|
519
530
|
]);
|
|
520
531
|
return {
|
|
521
|
-
openGlidePay:
|
|
522
|
-
externalUrl:
|
|
523
|
-
opts:
|
|
532
|
+
openGlidePay: b.open,
|
|
533
|
+
externalUrl: b.externalUrl,
|
|
534
|
+
opts: b.opts
|
|
524
535
|
};
|
|
525
536
|
}, fe = ({
|
|
526
537
|
app: s,
|
|
@@ -532,17 +543,17 @@ const ue = ({
|
|
|
532
543
|
excludeFundingSources: c,
|
|
533
544
|
sessionMetadata: a,
|
|
534
545
|
theme: n,
|
|
535
|
-
walletProvider:
|
|
536
|
-
localStorageProvider:
|
|
537
|
-
onOpen:
|
|
538
|
-
onSuccess:
|
|
539
|
-
onClose:
|
|
540
|
-
autoCloseOnSuccess:
|
|
546
|
+
walletProvider: h,
|
|
547
|
+
localStorageProvider: u,
|
|
548
|
+
onOpen: m,
|
|
549
|
+
onSuccess: f,
|
|
550
|
+
onClose: g,
|
|
551
|
+
autoCloseOnSuccess: y,
|
|
541
552
|
popupsBlocked: l,
|
|
542
|
-
baseUrl:
|
|
543
|
-
debug:
|
|
553
|
+
baseUrl: w,
|
|
554
|
+
debug: d
|
|
544
555
|
}) => {
|
|
545
|
-
const
|
|
556
|
+
const b = k(() => new U({
|
|
546
557
|
app: s,
|
|
547
558
|
evm: t,
|
|
548
559
|
approval: e,
|
|
@@ -553,15 +564,15 @@ const ue = ({
|
|
|
553
564
|
sessionMetadata: a,
|
|
554
565
|
mode: "call",
|
|
555
566
|
theme: n,
|
|
556
|
-
walletProvider:
|
|
557
|
-
localStorageProvider:
|
|
558
|
-
onOpen:
|
|
559
|
-
onSuccess:
|
|
560
|
-
onClose:
|
|
561
|
-
autoCloseOnSuccess:
|
|
567
|
+
walletProvider: h,
|
|
568
|
+
localStorageProvider: u,
|
|
569
|
+
onOpen: m,
|
|
570
|
+
onSuccess: f,
|
|
571
|
+
onClose: g,
|
|
572
|
+
autoCloseOnSuccess: y,
|
|
562
573
|
popupsBlocked: l,
|
|
563
|
-
baseUrl:
|
|
564
|
-
debug:
|
|
574
|
+
baseUrl: w,
|
|
575
|
+
debug: d
|
|
565
576
|
}), [
|
|
566
577
|
s,
|
|
567
578
|
t,
|
|
@@ -572,55 +583,59 @@ const ue = ({
|
|
|
572
583
|
c,
|
|
573
584
|
a,
|
|
574
585
|
n,
|
|
575
|
-
p,
|
|
576
586
|
h,
|
|
577
587
|
u,
|
|
578
588
|
m,
|
|
579
589
|
f,
|
|
580
590
|
g,
|
|
591
|
+
y,
|
|
581
592
|
l,
|
|
582
|
-
|
|
583
|
-
|
|
593
|
+
w,
|
|
594
|
+
d
|
|
584
595
|
]);
|
|
585
596
|
return {
|
|
586
|
-
openGlideCall:
|
|
587
|
-
externalUrl:
|
|
588
|
-
opts:
|
|
597
|
+
openGlideCall: b.open,
|
|
598
|
+
externalUrl: b.externalUrl,
|
|
599
|
+
opts: b.opts
|
|
589
600
|
};
|
|
590
601
|
}, ge = ({
|
|
591
602
|
app: s,
|
|
592
603
|
recipient: t,
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
604
|
+
chainId: e,
|
|
605
|
+
currencyId: i,
|
|
606
|
+
preferGaslessPayment: r,
|
|
607
|
+
excludeChainIds: o,
|
|
608
|
+
excludeCurrencyTiers: c,
|
|
609
|
+
excludeFundingSources: a,
|
|
610
|
+
sessionMetadata: n,
|
|
611
|
+
theme: h,
|
|
612
|
+
walletProvider: u,
|
|
613
|
+
localStorageProvider: m,
|
|
614
|
+
onOpen: f,
|
|
615
|
+
onSuccess: g,
|
|
616
|
+
onClose: y,
|
|
617
|
+
autoCloseOnSuccess: l,
|
|
618
|
+
baseUrl: w
|
|
606
619
|
}) => {
|
|
607
|
-
const
|
|
620
|
+
const d = k(() => new U({
|
|
608
621
|
app: s,
|
|
609
622
|
recipient: t,
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
623
|
+
chainId: e,
|
|
624
|
+
currencyId: i,
|
|
625
|
+
preferGaslessPayment: r,
|
|
626
|
+
excludeChainIds: o,
|
|
627
|
+
excludeCurrencyTiers: c,
|
|
628
|
+
excludeFundingSources: a,
|
|
629
|
+
sessionMetadata: n,
|
|
615
630
|
mode: "buy",
|
|
616
|
-
theme:
|
|
617
|
-
walletProvider:
|
|
618
|
-
localStorageProvider:
|
|
619
|
-
onOpen:
|
|
620
|
-
onSuccess:
|
|
621
|
-
onClose:
|
|
622
|
-
autoCloseOnSuccess:
|
|
623
|
-
baseUrl:
|
|
631
|
+
theme: h,
|
|
632
|
+
walletProvider: u,
|
|
633
|
+
localStorageProvider: m,
|
|
634
|
+
onOpen: f,
|
|
635
|
+
onSuccess: g,
|
|
636
|
+
onClose: y,
|
|
637
|
+
autoCloseOnSuccess: l,
|
|
638
|
+
baseUrl: w
|
|
624
639
|
}), [
|
|
625
640
|
s,
|
|
626
641
|
t,
|
|
@@ -631,17 +646,19 @@ const ue = ({
|
|
|
631
646
|
c,
|
|
632
647
|
a,
|
|
633
648
|
n,
|
|
634
|
-
p,
|
|
635
649
|
h,
|
|
636
650
|
u,
|
|
637
651
|
m,
|
|
638
652
|
f,
|
|
639
|
-
g
|
|
653
|
+
g,
|
|
654
|
+
y,
|
|
655
|
+
l,
|
|
656
|
+
w
|
|
640
657
|
]);
|
|
641
658
|
return {
|
|
642
|
-
openGlideBuy:
|
|
643
|
-
externalUrl:
|
|
644
|
-
opts:
|
|
659
|
+
openGlideBuy: d.open,
|
|
660
|
+
externalUrl: d.externalUrl,
|
|
661
|
+
opts: d.opts
|
|
645
662
|
};
|
|
646
663
|
}, ye = Object.freeze({
|
|
647
664
|
getItem: (s) => new Promise((t, e) => {
|
|
@@ -676,7 +693,7 @@ const ue = ({
|
|
|
676
693
|
})
|
|
677
694
|
});
|
|
678
695
|
export {
|
|
679
|
-
|
|
696
|
+
U as GlideDeposit,
|
|
680
697
|
ye as browserLocalStorageProvider,
|
|
681
698
|
ge as useGlideBuy,
|
|
682
699
|
fe as useGlideCall,
|
package/dist/useGlideBuy.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { CAIP2 } from '@paywithglide/glide-js';
|
|
|
4
4
|
interface UseGlideBuyProps {
|
|
5
5
|
app: string;
|
|
6
6
|
recipient?: string;
|
|
7
|
+
chainId?: CAIP2;
|
|
8
|
+
currencyId?: string;
|
|
7
9
|
preferGaslessPayment?: boolean;
|
|
8
10
|
excludeChainIds?: CAIP2[];
|
|
9
11
|
excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
|
|
@@ -18,7 +20,7 @@ interface UseGlideBuyProps {
|
|
|
18
20
|
autoCloseOnSuccess?: boolean;
|
|
19
21
|
baseUrl?: string;
|
|
20
22
|
}
|
|
21
|
-
export declare const useGlideBuy: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
|
|
23
|
+
export declare const useGlideBuy: ({ app, recipient, chainId, currencyId, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
|
|
22
24
|
openGlideBuy: () => void;
|
|
23
25
|
externalUrl: string;
|
|
24
26
|
opts: import('./GlideDeposit.ts').GlideDepositOptions;
|
|
@@ -4,6 +4,9 @@ import { CAIP2 } from '@paywithglide/glide-js';
|
|
|
4
4
|
interface UseGlideDepositProps {
|
|
5
5
|
app: string;
|
|
6
6
|
recipient?: string;
|
|
7
|
+
chainId?: CAIP2;
|
|
8
|
+
currencyId?: string;
|
|
9
|
+
amount?: string;
|
|
7
10
|
gasRefuelAmountPerChain?: Record<CAIP2, string>;
|
|
8
11
|
preferGaslessPayment?: boolean;
|
|
9
12
|
excludeChainIds?: CAIP2[];
|
|
@@ -22,7 +25,7 @@ interface UseGlideDepositProps {
|
|
|
22
25
|
baseUrl?: string;
|
|
23
26
|
debug?: boolean;
|
|
24
27
|
}
|
|
25
|
-
export declare const useGlideDeposit: ({ app, recipient, gasRefuelAmountPerChain, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
|
|
28
|
+
export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
|
|
26
29
|
openGlideDeposit: () => void;
|
|
27
30
|
externalUrl: string;
|
|
28
31
|
opts: import('./GlideDeposit.ts').GlideDepositOptions;
|