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