@paywithglide/glide-react 0.0.30 → 0.0.32
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 +4 -4
- package/dist/glide.js +200 -194
- package/dist/useGlideBuy.d.ts +5 -5
- package/dist/useGlideCall.d.ts +2 -2
- package/dist/useGlideDeposit.d.ts +7 -5
- package/dist/useGlidePay.d.ts +2 -2
- 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, Session } 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;
|
|
@@ -110,7 +110,7 @@ export type GlideDepositOptions = {
|
|
|
110
110
|
walletProvider?: GlideDepositWalletProvider;
|
|
111
111
|
localStorageProvider?: GlideLocalStorageProvider;
|
|
112
112
|
onOpen?: () => void;
|
|
113
|
-
onSuccess?: (
|
|
113
|
+
onSuccess?: (fulfillmentTxHash: Hex, session: Session) => void;
|
|
114
114
|
onClose?: () => void;
|
|
115
115
|
onSetMode?: (mode: "deposit" | "withdraw") => void;
|
|
116
116
|
autoCloseOnSuccess?: boolean;
|
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 k = (s, t, e) => _(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { useMemo as U } 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 E = {
|
|
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 = E.getDocsUrl) == null ? void 0 : a.call(E, { ...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
|
+
...E.version ? [`Version: ${E.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 A(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 }), A(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 }), A(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 ? A(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 z {
|
|
162
162
|
constructor(t) {
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
k(this, "opts");
|
|
164
|
+
k(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
|
+
k(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, S, $, 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, e.session);
|
|
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
|
+
}), (S = (P = this.iframe) == null ? void 0 : P.contentWindow) == null || S.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 = ($ = this.iframe) == null ? void 0 : $.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,55 @@ 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
|
+
sessionId: m,
|
|
408
|
+
sessionMetadata: f,
|
|
409
|
+
theme: g,
|
|
410
|
+
walletProvider: y,
|
|
411
|
+
localStorageProvider: l,
|
|
412
|
+
onOpen: w,
|
|
413
|
+
onSuccess: d,
|
|
414
|
+
onClose: b,
|
|
415
|
+
autoCloseOnSuccess: v,
|
|
416
|
+
popupsBlocked: I,
|
|
417
|
+
baseUrl: P,
|
|
418
|
+
debug: S
|
|
417
419
|
}) => {
|
|
418
|
-
const
|
|
420
|
+
const $ = U(() => new z({
|
|
419
421
|
app: s,
|
|
420
422
|
recipient: t,
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
423
|
+
chainId: e,
|
|
424
|
+
currencyId: i,
|
|
425
|
+
amount: r,
|
|
426
|
+
gasRefuelAmountPerChain: o,
|
|
427
|
+
preferGaslessPayment: c,
|
|
428
|
+
excludeChainIds: a,
|
|
429
|
+
excludeCurrencyTiers: n,
|
|
430
|
+
excludeFundingSources: h,
|
|
431
|
+
mode: u,
|
|
432
|
+
sessionId: m,
|
|
433
|
+
sessionMetadata: f,
|
|
434
|
+
theme: g,
|
|
435
|
+
walletProvider: y,
|
|
436
|
+
localStorageProvider: l,
|
|
437
|
+
onOpen: w,
|
|
438
|
+
onSuccess: d,
|
|
439
|
+
onClose: b,
|
|
440
|
+
autoCloseOnSuccess: v,
|
|
441
|
+
popupsBlocked: I,
|
|
442
|
+
baseUrl: P,
|
|
443
|
+
debug: S
|
|
440
444
|
}), [
|
|
441
445
|
s,
|
|
442
446
|
t,
|
|
@@ -447,25 +451,27 @@ const fe = ({
|
|
|
447
451
|
c,
|
|
448
452
|
a,
|
|
449
453
|
n,
|
|
450
|
-
p,
|
|
451
454
|
h,
|
|
452
455
|
u,
|
|
453
456
|
m,
|
|
454
457
|
f,
|
|
455
458
|
g,
|
|
456
459
|
y,
|
|
460
|
+
l,
|
|
457
461
|
w,
|
|
458
462
|
d,
|
|
459
463
|
b,
|
|
460
|
-
|
|
461
|
-
I
|
|
464
|
+
v,
|
|
465
|
+
I,
|
|
466
|
+
P,
|
|
467
|
+
S
|
|
462
468
|
]);
|
|
463
469
|
return {
|
|
464
|
-
openGlideDeposit:
|
|
465
|
-
externalUrl:
|
|
466
|
-
opts:
|
|
470
|
+
openGlideDeposit: $.open,
|
|
471
|
+
externalUrl: $.externalUrl,
|
|
472
|
+
opts: $.opts
|
|
467
473
|
};
|
|
468
|
-
},
|
|
474
|
+
}, me = ({
|
|
469
475
|
app: s,
|
|
470
476
|
preferGaslessPayment: t,
|
|
471
477
|
excludeChainIds: e,
|
|
@@ -475,17 +481,17 @@ const fe = ({
|
|
|
475
481
|
sessionId: c,
|
|
476
482
|
sessionMetadata: a,
|
|
477
483
|
theme: n,
|
|
478
|
-
walletProvider:
|
|
479
|
-
localStorageProvider:
|
|
480
|
-
onOpen:
|
|
481
|
-
onSuccess:
|
|
482
|
-
onClose:
|
|
483
|
-
autoCloseOnSuccess:
|
|
484
|
-
popupsBlocked:
|
|
484
|
+
walletProvider: h,
|
|
485
|
+
localStorageProvider: u,
|
|
486
|
+
onOpen: m,
|
|
487
|
+
onSuccess: f,
|
|
488
|
+
onClose: g,
|
|
489
|
+
autoCloseOnSuccess: y,
|
|
490
|
+
popupsBlocked: l,
|
|
485
491
|
baseUrl: w,
|
|
486
492
|
debug: d
|
|
487
493
|
}) => {
|
|
488
|
-
const b =
|
|
494
|
+
const b = U(() => new z({
|
|
489
495
|
app: s,
|
|
490
496
|
preferGaslessPayment: t,
|
|
491
497
|
excludeChainIds: e,
|
|
@@ -496,13 +502,13 @@ const fe = ({
|
|
|
496
502
|
amount: o,
|
|
497
503
|
sessionMetadata: a,
|
|
498
504
|
theme: n,
|
|
499
|
-
walletProvider:
|
|
500
|
-
localStorageProvider:
|
|
501
|
-
onOpen:
|
|
502
|
-
onSuccess:
|
|
503
|
-
onClose:
|
|
504
|
-
autoCloseOnSuccess:
|
|
505
|
-
popupsBlocked:
|
|
505
|
+
walletProvider: h,
|
|
506
|
+
localStorageProvider: u,
|
|
507
|
+
onOpen: m,
|
|
508
|
+
onSuccess: f,
|
|
509
|
+
onClose: g,
|
|
510
|
+
autoCloseOnSuccess: y,
|
|
511
|
+
popupsBlocked: l,
|
|
506
512
|
baseUrl: w,
|
|
507
513
|
debug: d
|
|
508
514
|
}), [
|
|
@@ -515,13 +521,13 @@ const fe = ({
|
|
|
515
521
|
o,
|
|
516
522
|
a,
|
|
517
523
|
n,
|
|
518
|
-
p,
|
|
519
524
|
h,
|
|
520
525
|
u,
|
|
521
526
|
m,
|
|
522
527
|
f,
|
|
523
528
|
g,
|
|
524
529
|
y,
|
|
530
|
+
l,
|
|
525
531
|
w,
|
|
526
532
|
d
|
|
527
533
|
]);
|
|
@@ -530,7 +536,7 @@ const fe = ({
|
|
|
530
536
|
externalUrl: b.externalUrl,
|
|
531
537
|
opts: b.opts
|
|
532
538
|
};
|
|
533
|
-
},
|
|
539
|
+
}, fe = ({
|
|
534
540
|
app: s,
|
|
535
541
|
evm: t,
|
|
536
542
|
approval: e,
|
|
@@ -540,17 +546,17 @@ const fe = ({
|
|
|
540
546
|
excludeFundingSources: c,
|
|
541
547
|
sessionMetadata: a,
|
|
542
548
|
theme: n,
|
|
543
|
-
walletProvider:
|
|
544
|
-
localStorageProvider:
|
|
545
|
-
onOpen:
|
|
546
|
-
onSuccess:
|
|
547
|
-
onClose:
|
|
548
|
-
autoCloseOnSuccess:
|
|
549
|
-
popupsBlocked:
|
|
549
|
+
walletProvider: h,
|
|
550
|
+
localStorageProvider: u,
|
|
551
|
+
onOpen: m,
|
|
552
|
+
onSuccess: f,
|
|
553
|
+
onClose: g,
|
|
554
|
+
autoCloseOnSuccess: y,
|
|
555
|
+
popupsBlocked: l,
|
|
550
556
|
baseUrl: w,
|
|
551
557
|
debug: d
|
|
552
558
|
}) => {
|
|
553
|
-
const b =
|
|
559
|
+
const b = U(() => new z({
|
|
554
560
|
app: s,
|
|
555
561
|
evm: t,
|
|
556
562
|
approval: e,
|
|
@@ -561,13 +567,13 @@ const fe = ({
|
|
|
561
567
|
sessionMetadata: a,
|
|
562
568
|
mode: "call",
|
|
563
569
|
theme: n,
|
|
564
|
-
walletProvider:
|
|
565
|
-
localStorageProvider:
|
|
566
|
-
onOpen:
|
|
567
|
-
onSuccess:
|
|
568
|
-
onClose:
|
|
569
|
-
autoCloseOnSuccess:
|
|
570
|
-
popupsBlocked:
|
|
570
|
+
walletProvider: h,
|
|
571
|
+
localStorageProvider: u,
|
|
572
|
+
onOpen: m,
|
|
573
|
+
onSuccess: f,
|
|
574
|
+
onClose: g,
|
|
575
|
+
autoCloseOnSuccess: y,
|
|
576
|
+
popupsBlocked: l,
|
|
571
577
|
baseUrl: w,
|
|
572
578
|
debug: d
|
|
573
579
|
}), [
|
|
@@ -580,13 +586,13 @@ const fe = ({
|
|
|
580
586
|
c,
|
|
581
587
|
a,
|
|
582
588
|
n,
|
|
583
|
-
p,
|
|
584
589
|
h,
|
|
585
590
|
u,
|
|
586
591
|
m,
|
|
587
592
|
f,
|
|
588
593
|
g,
|
|
589
594
|
y,
|
|
595
|
+
l,
|
|
590
596
|
w,
|
|
591
597
|
d
|
|
592
598
|
]);
|
|
@@ -595,43 +601,43 @@ const fe = ({
|
|
|
595
601
|
externalUrl: b.externalUrl,
|
|
596
602
|
opts: b.opts
|
|
597
603
|
};
|
|
598
|
-
},
|
|
604
|
+
}, ge = ({
|
|
599
605
|
app: s,
|
|
600
606
|
recipient: t,
|
|
601
|
-
|
|
602
|
-
|
|
607
|
+
chainId: e,
|
|
608
|
+
currencyId: i,
|
|
603
609
|
preferGaslessPayment: r,
|
|
604
610
|
excludeChainIds: o,
|
|
605
611
|
excludeCurrencyTiers: c,
|
|
606
612
|
excludeFundingSources: a,
|
|
607
613
|
sessionMetadata: n,
|
|
608
|
-
theme:
|
|
609
|
-
walletProvider:
|
|
610
|
-
localStorageProvider:
|
|
611
|
-
onOpen:
|
|
612
|
-
onSuccess:
|
|
613
|
-
onClose:
|
|
614
|
-
autoCloseOnSuccess:
|
|
614
|
+
theme: h,
|
|
615
|
+
walletProvider: u,
|
|
616
|
+
localStorageProvider: m,
|
|
617
|
+
onOpen: f,
|
|
618
|
+
onSuccess: g,
|
|
619
|
+
onClose: y,
|
|
620
|
+
autoCloseOnSuccess: l,
|
|
615
621
|
baseUrl: w
|
|
616
622
|
}) => {
|
|
617
|
-
const d =
|
|
623
|
+
const d = U(() => new z({
|
|
618
624
|
app: s,
|
|
619
625
|
recipient: t,
|
|
620
|
-
|
|
621
|
-
|
|
626
|
+
chainId: e,
|
|
627
|
+
currencyId: i,
|
|
622
628
|
preferGaslessPayment: r,
|
|
623
629
|
excludeChainIds: o,
|
|
624
630
|
excludeCurrencyTiers: c,
|
|
625
631
|
excludeFundingSources: a,
|
|
626
632
|
sessionMetadata: n,
|
|
627
633
|
mode: "buy",
|
|
628
|
-
theme:
|
|
629
|
-
walletProvider:
|
|
630
|
-
localStorageProvider:
|
|
631
|
-
onOpen:
|
|
632
|
-
onSuccess:
|
|
633
|
-
onClose:
|
|
634
|
-
autoCloseOnSuccess:
|
|
634
|
+
theme: h,
|
|
635
|
+
walletProvider: u,
|
|
636
|
+
localStorageProvider: m,
|
|
637
|
+
onOpen: f,
|
|
638
|
+
onSuccess: g,
|
|
639
|
+
onClose: y,
|
|
640
|
+
autoCloseOnSuccess: l,
|
|
635
641
|
baseUrl: w
|
|
636
642
|
}), [
|
|
637
643
|
s,
|
|
@@ -643,13 +649,13 @@ const fe = ({
|
|
|
643
649
|
c,
|
|
644
650
|
a,
|
|
645
651
|
n,
|
|
646
|
-
p,
|
|
647
652
|
h,
|
|
648
653
|
u,
|
|
649
654
|
m,
|
|
650
655
|
f,
|
|
651
656
|
g,
|
|
652
657
|
y,
|
|
658
|
+
l,
|
|
653
659
|
w
|
|
654
660
|
]);
|
|
655
661
|
return {
|
|
@@ -657,7 +663,7 @@ const fe = ({
|
|
|
657
663
|
externalUrl: d.externalUrl,
|
|
658
664
|
opts: d.opts
|
|
659
665
|
};
|
|
660
|
-
},
|
|
666
|
+
}, ye = Object.freeze({
|
|
661
667
|
getItem: (s) => new Promise((t, e) => {
|
|
662
668
|
try {
|
|
663
669
|
const i = localStorage.getItem(s);
|
|
@@ -690,10 +696,10 @@ const fe = ({
|
|
|
690
696
|
})
|
|
691
697
|
});
|
|
692
698
|
export {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
+
z as GlideDeposit,
|
|
700
|
+
ye as browserLocalStorageProvider,
|
|
701
|
+
ge as useGlideBuy,
|
|
702
|
+
fe as useGlideCall,
|
|
703
|
+
ue as useGlideDeposit,
|
|
704
|
+
me as useGlidePay
|
|
699
705
|
};
|
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, Session } 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")[];
|
|
@@ -15,12 +15,12 @@ interface UseGlideBuyProps {
|
|
|
15
15
|
walletProvider?: GlideDepositWalletProvider;
|
|
16
16
|
localStorageProvider?: GlideLocalStorageProvider;
|
|
17
17
|
onOpen?: () => void;
|
|
18
|
-
onSuccess?: (hash: Hex) => void;
|
|
18
|
+
onSuccess?: (hash: Hex, session: Session) => void;
|
|
19
19
|
onClose?: () => void;
|
|
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;
|
package/dist/useGlideCall.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FundingSource, GlideDepositWalletProvider, GlideLocalStorageProvider, Hex } from './GlideDeposit.ts';
|
|
2
2
|
import { GlideWidgetTheme } from './theme.ts';
|
|
3
|
-
import { CAIP2 } from '@paywithglide/glide-js';
|
|
3
|
+
import { CAIP2, Session } from '@paywithglide/glide-js';
|
|
4
4
|
interface UseGlideCallProps {
|
|
5
5
|
app: string;
|
|
6
6
|
evm: {
|
|
@@ -22,7 +22,7 @@ interface UseGlideCallProps {
|
|
|
22
22
|
walletProvider?: GlideDepositWalletProvider;
|
|
23
23
|
localStorageProvider?: GlideLocalStorageProvider;
|
|
24
24
|
onOpen?: () => void;
|
|
25
|
-
onSuccess?: (hash: Hex) => void;
|
|
25
|
+
onSuccess?: (hash: Hex, session: Session) => void;
|
|
26
26
|
onClose?: () => void;
|
|
27
27
|
autoCloseOnSuccess?: boolean;
|
|
28
28
|
popupsBlocked?: boolean;
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import { FundingSource, GlideDepositWalletProvider, GlideLocalStorageProvider } from './GlideDeposit.ts';
|
|
2
2
|
import { GlideWidgetTheme } from './theme.ts';
|
|
3
|
-
import { CAIP2,
|
|
3
|
+
import { CAIP2, Hex, Session } 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[];
|
|
12
13
|
excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
|
|
13
14
|
excludeFundingSources?: FundingSource[];
|
|
14
15
|
mode?: "deposit" | "withdraw";
|
|
16
|
+
sessionId?: string;
|
|
15
17
|
sessionMetadata?: string;
|
|
16
18
|
theme?: GlideWidgetTheme;
|
|
17
19
|
walletProvider?: GlideDepositWalletProvider;
|
|
18
20
|
localStorageProvider?: GlideLocalStorageProvider;
|
|
19
21
|
onOpen?: () => void;
|
|
20
|
-
onSuccess?: (hash:
|
|
22
|
+
onSuccess?: (hash: Hex, session: Session) => void;
|
|
21
23
|
onClose?: () => void;
|
|
22
24
|
autoCloseOnSuccess?: boolean;
|
|
23
25
|
popupsBlocked?: boolean;
|
|
24
26
|
baseUrl?: string;
|
|
25
27
|
debug?: boolean;
|
|
26
28
|
}
|
|
27
|
-
export declare const useGlideDeposit: ({ app, recipient,
|
|
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) => {
|
|
28
30
|
openGlideDeposit: () => void;
|
|
29
31
|
externalUrl: string;
|
|
30
32
|
opts: import('./GlideDeposit.ts').GlideDepositOptions;
|
package/dist/useGlidePay.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FundingSource, GlideDepositWalletProvider, GlideLocalStorageProvider } from './GlideDeposit.ts';
|
|
2
2
|
import { GlideWidgetTheme } from './theme.ts';
|
|
3
|
-
import { CAIP2 } from '@paywithglide/glide-js';
|
|
3
|
+
import { CAIP2, Hex, Session } from '@paywithglide/glide-js';
|
|
4
4
|
type UseGlidePayProps = {
|
|
5
5
|
app: string;
|
|
6
6
|
amount?: string;
|
|
@@ -14,7 +14,7 @@ type UseGlidePayProps = {
|
|
|
14
14
|
walletProvider?: GlideDepositWalletProvider;
|
|
15
15
|
localStorageProvider?: GlideLocalStorageProvider;
|
|
16
16
|
onOpen?: () => void;
|
|
17
|
-
onSuccess?: (hash:
|
|
17
|
+
onSuccess?: (hash: Hex, session: Session) => void;
|
|
18
18
|
onClose?: () => void;
|
|
19
19
|
autoCloseOnSuccess?: boolean;
|
|
20
20
|
popupsBlocked?: boolean;
|