@paywithglide/glide-react 0.0.19 → 0.0.21
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 -0
- package/dist/glide.js +186 -165
- package/dist/useGlideBuy.d.ts +3 -2
- package/dist/useGlideCall.d.ts +3 -2
- package/dist/useGlideDeposit.d.ts +3 -2
- package/dist/useGlidePay.d.ts +3 -2
- package/package.json +1 -1
package/dist/GlideDeposit.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export type GlideDepositWalletProvider = {
|
|
|
76
76
|
sendTransactionAsync: (tx: EVMTransaction) => Promise<Hex>;
|
|
77
77
|
signTypedDataAsync?: (args: PermitTypedData<bigint>) => Promise<Hex>;
|
|
78
78
|
};
|
|
79
|
+
export type FundingSource = "transfer" | "coinbase" | "coinbase_app" | "interac" | "fiat";
|
|
79
80
|
export type GlideDepositOptions = {
|
|
80
81
|
app: string;
|
|
81
82
|
recipient?: string;
|
|
@@ -96,11 +97,14 @@ export type GlideDepositOptions = {
|
|
|
96
97
|
preferGaslessPayment?: boolean;
|
|
97
98
|
excludeChainIds?: CAIP2[];
|
|
98
99
|
excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
|
|
100
|
+
excludeFundingSources?: FundingSource[];
|
|
99
101
|
walletProvider?: GlideDepositWalletProvider;
|
|
100
102
|
onOpen?: () => void;
|
|
101
103
|
onSuccess?: (hash: Hex) => void;
|
|
102
104
|
onClose?: () => void;
|
|
105
|
+
onSetMode?: (mode: "deposit" | "withdraw") => void;
|
|
103
106
|
autoCloseOnSuccess?: boolean;
|
|
107
|
+
container?: HTMLElement;
|
|
104
108
|
theme?: GlideWidgetTheme;
|
|
105
109
|
baseUrl?: string;
|
|
106
110
|
};
|
package/dist/glide.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useMemo as
|
|
5
|
-
function
|
|
1
|
+
var j = Object.defineProperty;
|
|
2
|
+
var H = (s, t, e) => t in s ? j(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var b = (s, t, e) => H(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { useMemo as v } from "react";
|
|
5
|
+
function B(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 D(s) {
|
|
9
|
+
return B(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
let
|
|
11
|
+
const M = "2.21.51";
|
|
12
|
+
let w = {
|
|
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@${M}`
|
|
15
15
|
};
|
|
16
|
-
class
|
|
16
|
+
class y extends Error {
|
|
17
17
|
constructor(t, e = {}) {
|
|
18
|
-
var
|
|
18
|
+
var o;
|
|
19
19
|
const i = (() => {
|
|
20
|
-
var
|
|
21
|
-
return e.cause instanceof
|
|
22
|
-
})(), n = e.cause instanceof
|
|
20
|
+
var a;
|
|
21
|
+
return e.cause instanceof y ? e.cause.details : (a = e.cause) != null && a.message ? e.cause.message : e.details;
|
|
22
|
+
})(), n = e.cause instanceof y && e.cause.docsPath || e.docsPath, r = (o = w.getDocsUrl) == null ? void 0 : o.call(w, { ...e, docsPath: n }), d = [
|
|
23
23
|
t || "An error occurred.",
|
|
24
24
|
"",
|
|
25
25
|
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
26
26
|
...r ? [`Docs: ${r}`] : [],
|
|
27
27
|
...i ? [`Details: ${i}`] : [],
|
|
28
|
-
...
|
|
28
|
+
...w.version ? [`Version: ${w.version}`] : []
|
|
29
29
|
].join(`
|
|
30
30
|
`);
|
|
31
31
|
super(d, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -58,40 +58,40 @@ class g extends Error {
|
|
|
58
58
|
configurable: !0,
|
|
59
59
|
writable: !0,
|
|
60
60
|
value: "BaseError"
|
|
61
|
-
}), this.details = i, this.docsPath = n, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version =
|
|
61
|
+
}), this.details = i, this.docsPath = n, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = M;
|
|
62
62
|
}
|
|
63
63
|
walk(t) {
|
|
64
|
-
return
|
|
64
|
+
return A(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 A(s, t) {
|
|
68
|
+
return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? A(s.cause, t) : t ? null : s;
|
|
69
69
|
}
|
|
70
|
-
class
|
|
70
|
+
class k extends y {
|
|
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 x(s, { dir: t, size: e = 32 } = {}) {
|
|
76
|
+
return typeof s == "string" ? W(s, { dir: t, size: e }) : L(s, { dir: t, size: e });
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function W(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 k({
|
|
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 L(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 k({
|
|
95
95
|
size: s.length,
|
|
96
96
|
targetSize: e,
|
|
97
97
|
type: "bytes"
|
|
@@ -103,67 +103,67 @@ function B(s, { dir: t, size: e = 32 } = {}) {
|
|
|
103
103
|
}
|
|
104
104
|
return i;
|
|
105
105
|
}
|
|
106
|
-
class
|
|
106
|
+
class O extends y {
|
|
107
107
|
constructor({ max: t, min: e, signed: i, size: n, value: r }) {
|
|
108
108
|
super(`Number "${r}" is not in safe ${n ? `${n * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
class
|
|
111
|
+
class N extends y {
|
|
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 G(s, { size: t }) {
|
|
117
|
+
if (D(s) > t)
|
|
118
|
+
throw new N({
|
|
119
|
+
givenSize: D(s),
|
|
120
120
|
maxSize: t
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
const
|
|
124
|
-
function
|
|
125
|
-
return typeof s == "number" || typeof s == "bigint" ?
|
|
123
|
+
const R = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
|
|
124
|
+
function F(s, t = {}) {
|
|
125
|
+
return typeof s == "number" || typeof s == "bigint" ? q(s, t) : typeof s == "string" ? J(s, t) : typeof s == "boolean" ? V(s, t) : C(s, t);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function V(s, t = {}) {
|
|
128
128
|
const e = `0x${Number(s)}`;
|
|
129
|
-
return typeof t.size == "number" ? (
|
|
129
|
+
return typeof t.size == "number" ? (G(e, { size: t.size }), x(e, { size: t.size })) : e;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function C(s, t = {}) {
|
|
132
132
|
let e = "";
|
|
133
133
|
for (let n = 0; n < s.length; n++)
|
|
134
|
-
e +=
|
|
134
|
+
e += R[s[n]];
|
|
135
135
|
const i = `0x${e}`;
|
|
136
|
-
return typeof t.size == "number" ? (
|
|
136
|
+
return typeof t.size == "number" ? (G(i, { size: t.size }), x(i, { dir: "right", size: t.size })) : i;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function q(s, t = {}) {
|
|
139
139
|
const { signed: e, size: i } = t, n = BigInt(s);
|
|
140
140
|
let r;
|
|
141
141
|
i ? e ? r = (1n << BigInt(i) * 8n - 1n) - 1n : r = 2n ** (BigInt(i) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
|
|
142
142
|
const d = typeof r == "bigint" && e ? -r - 1n : 0;
|
|
143
143
|
if (r && n > r || n < d) {
|
|
144
|
-
const
|
|
145
|
-
throw new
|
|
146
|
-
max: r ? `${r}${
|
|
147
|
-
min: `${d}${
|
|
144
|
+
const a = typeof s == "bigint" ? "n" : "";
|
|
145
|
+
throw new O({
|
|
146
|
+
max: r ? `${r}${a}` : void 0,
|
|
147
|
+
min: `${d}${a}`,
|
|
148
148
|
signed: e,
|
|
149
149
|
size: i,
|
|
150
|
-
value: `${s}${
|
|
150
|
+
value: `${s}${a}`
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
return i ?
|
|
153
|
+
const o = `0x${(e && n < 0 ? (1n << BigInt(i * 8)) + BigInt(n) : n).toString(16)}`;
|
|
154
|
+
return i ? x(o, { size: i }) : o;
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
158
|
-
const e =
|
|
159
|
-
return
|
|
156
|
+
const X = /* @__PURE__ */ new TextEncoder();
|
|
157
|
+
function J(s, t = {}) {
|
|
158
|
+
const e = X.encode(s);
|
|
159
|
+
return C(e, t);
|
|
160
160
|
}
|
|
161
|
-
class
|
|
161
|
+
class $ {
|
|
162
162
|
constructor(t) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (!document.body.classList.contains("glide-deposit-open")) {
|
|
166
|
-
if (document.body.classList.add("glide-deposit-open"), (this.opts.mode === "deposit" || this.opts.mode === "buy") && !this.opts.recipient)
|
|
163
|
+
b(this, "opts");
|
|
164
|
+
b(this, "open", () => {
|
|
165
|
+
if (!(!this.opts.container && document.body.classList.contains("glide-deposit-open"))) {
|
|
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");
|
|
168
168
|
if (this.opts.preferGaslessPayment && this.opts.walletProvider && !this.opts.walletProvider.signTypedDataAsync)
|
|
169
169
|
throw new Error(
|
|
@@ -172,8 +172,8 @@ class v {
|
|
|
172
172
|
this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
|
-
|
|
176
|
-
var i, n, r, d, a,
|
|
175
|
+
b(this, "iframeEventHandler", async (t) => {
|
|
176
|
+
var i, n, r, d, o, a, p, l, h, u, f, c, m, I, P, E, z, U, T, S;
|
|
177
177
|
const e = t.data;
|
|
178
178
|
switch (e.type) {
|
|
179
179
|
case "success":
|
|
@@ -182,13 +182,16 @@ class v {
|
|
|
182
182
|
case "close":
|
|
183
183
|
this.removeIframe(), this.destroy(), (d = (r = this.opts) == null ? void 0 : r.onClose) == null || d.call(r);
|
|
184
184
|
break;
|
|
185
|
+
case "setMode":
|
|
186
|
+
(a = (o = this.opts) == null ? void 0 : o.onSetMode) == null || a.call(o, e.mode);
|
|
187
|
+
break;
|
|
185
188
|
case "switchChain":
|
|
186
189
|
if (!this.opts.walletProvider)
|
|
187
190
|
throw new Error("walletProvider is not set");
|
|
188
191
|
try {
|
|
189
192
|
await this.opts.walletProvider.switchChainAsync({
|
|
190
193
|
chainId: e.chainId
|
|
191
|
-
}), (
|
|
194
|
+
}), (l = (p = this.iframe) == null ? void 0 : p.contentWindow) == null || l.postMessage(
|
|
192
195
|
{
|
|
193
196
|
type: "didSwitchChain",
|
|
194
197
|
success: !0,
|
|
@@ -196,12 +199,12 @@ class v {
|
|
|
196
199
|
},
|
|
197
200
|
this.baseUrl
|
|
198
201
|
);
|
|
199
|
-
} catch (
|
|
200
|
-
(
|
|
202
|
+
} catch (g) {
|
|
203
|
+
(u = (h = this.iframe) == null ? void 0 : h.contentWindow) == null || u.postMessage(
|
|
201
204
|
{
|
|
202
205
|
type: "didSwitchChain",
|
|
203
206
|
success: !1,
|
|
204
|
-
error:
|
|
207
|
+
error: g
|
|
205
208
|
},
|
|
206
209
|
this.baseUrl
|
|
207
210
|
);
|
|
@@ -212,23 +215,23 @@ class v {
|
|
|
212
215
|
if (!this.opts.walletProvider)
|
|
213
216
|
throw new Error("walletProvider is not set");
|
|
214
217
|
try {
|
|
215
|
-
const
|
|
218
|
+
const g = await this.opts.walletProvider.sendTransactionAsync(
|
|
216
219
|
e.tx
|
|
217
220
|
);
|
|
218
|
-
(
|
|
221
|
+
(c = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || c.postMessage(
|
|
219
222
|
{
|
|
220
223
|
type: "didSendTransaction",
|
|
221
224
|
success: !0,
|
|
222
|
-
txHash:
|
|
225
|
+
txHash: g
|
|
223
226
|
},
|
|
224
227
|
this.baseUrl
|
|
225
228
|
);
|
|
226
|
-
} catch (
|
|
227
|
-
(
|
|
229
|
+
} catch (g) {
|
|
230
|
+
(I = (m = this.iframe) == null ? void 0 : m.contentWindow) == null || I.postMessage(
|
|
228
231
|
{
|
|
229
232
|
type: "didSendTransaction",
|
|
230
233
|
success: !1,
|
|
231
|
-
error:
|
|
234
|
+
error: g
|
|
232
235
|
},
|
|
233
236
|
this.baseUrl
|
|
234
237
|
);
|
|
@@ -240,7 +243,7 @@ class v {
|
|
|
240
243
|
if (!this.opts.walletProvider)
|
|
241
244
|
throw new Error("walletProvider is not set");
|
|
242
245
|
if (!this.opts.walletProvider.signTypedDataAsync) {
|
|
243
|
-
(
|
|
246
|
+
(E = (P = this.iframe) == null ? void 0 : P.contentWindow) == null || E.postMessage(
|
|
244
247
|
{
|
|
245
248
|
type: "didSignTypedData",
|
|
246
249
|
success: !1,
|
|
@@ -251,23 +254,23 @@ class v {
|
|
|
251
254
|
return;
|
|
252
255
|
}
|
|
253
256
|
try {
|
|
254
|
-
const
|
|
257
|
+
const g = await this.opts.walletProvider.signTypedDataAsync(
|
|
255
258
|
e.data
|
|
256
259
|
);
|
|
257
|
-
(
|
|
260
|
+
(U = (z = this.iframe) == null ? void 0 : z.contentWindow) == null || U.postMessage(
|
|
258
261
|
{
|
|
259
262
|
type: "didSignTypedData",
|
|
260
263
|
success: !0,
|
|
261
|
-
signature:
|
|
264
|
+
signature: g
|
|
262
265
|
},
|
|
263
266
|
this.baseUrl
|
|
264
267
|
);
|
|
265
|
-
} catch (
|
|
266
|
-
(
|
|
268
|
+
} catch (g) {
|
|
269
|
+
(S = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || S.postMessage(
|
|
267
270
|
{
|
|
268
271
|
type: "didSignTypedData",
|
|
269
272
|
success: !1,
|
|
270
|
-
error:
|
|
273
|
+
error: g
|
|
271
274
|
},
|
|
272
275
|
this.baseUrl
|
|
273
276
|
);
|
|
@@ -279,8 +282,8 @@ class v {
|
|
|
279
282
|
this.opts = t;
|
|
280
283
|
}
|
|
281
284
|
get externalUrl() {
|
|
282
|
-
var t, e;
|
|
283
|
-
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=${
|
|
285
|
+
var t, e, i;
|
|
286
|
+
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=${F(this.opts.evm.value || 0n)}` : ""}${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(",")}` : ""}`;
|
|
284
287
|
}
|
|
285
288
|
initialize() {
|
|
286
289
|
window.addEventListener("message", this.iframeEventHandler);
|
|
@@ -300,25 +303,31 @@ class v {
|
|
|
300
303
|
createIframe(t) {
|
|
301
304
|
this.removeIframe();
|
|
302
305
|
const e = document.createElement("iframe");
|
|
303
|
-
e.id = "glide-deposit-iframe"
|
|
306
|
+
e.id = "glide-deposit-iframe";
|
|
307
|
+
const i = this.opts.container;
|
|
308
|
+
i ? e.setAttribute(
|
|
309
|
+
"style",
|
|
310
|
+
"z-index: 2147483647; display: block; background-color: transparent; border: 0px none transparent; overflow-x: hidden; overflow-y: auto; visibility: visible; margin: 0px; padding: 0px; -webkit-tap-highlight-color: transparent; position: relative; width: 100%; height: 100%; opacity: 0;"
|
|
311
|
+
) : e.setAttribute(
|
|
304
312
|
"style",
|
|
305
313
|
"z-index: 2147483647; display: block; background-color: transparent; border: 0px none transparent; overflow-x: hidden; overflow-y: auto; visibility: visible; margin: 0px; padding: 0px; -webkit-tap-highlight-color: transparent; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; opacity: 0;"
|
|
306
314
|
), e.onload = () => {
|
|
307
|
-
var
|
|
308
|
-
const
|
|
315
|
+
var p, l, h, u;
|
|
316
|
+
const n = this.opts.recipient, r = (p = this.opts.walletProvider) == null ? void 0 : p.address, d = (l = this.opts.walletProvider) == null ? void 0 : l.availableChainIds, o = (h = this.opts.walletProvider) == null ? void 0 : h.currentChainId, a = this.opts.preferGaslessPayment || !!((u = this.opts.walletProvider) != null && u.signTypedDataAsync);
|
|
309
317
|
e.style.opacity = "1", setTimeout(() => {
|
|
310
|
-
var
|
|
311
|
-
(
|
|
318
|
+
var f, c, m;
|
|
319
|
+
(f = e == null ? void 0 : e.contentWindow) == null || f.postMessage(
|
|
312
320
|
{
|
|
313
321
|
type: "initialize",
|
|
314
322
|
sessionId: this.opts.sessionId,
|
|
315
|
-
recipient:
|
|
316
|
-
connectedWalletAddress:
|
|
317
|
-
availableChainIds:
|
|
318
|
-
currentChainId:
|
|
323
|
+
recipient: n,
|
|
324
|
+
connectedWalletAddress: r,
|
|
325
|
+
availableChainIds: d,
|
|
326
|
+
currentChainId: o,
|
|
319
327
|
preferGaslessPayment: a,
|
|
320
328
|
excludeChainIds: this.opts.excludeChainIds,
|
|
321
329
|
excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
|
|
330
|
+
excludeFundingSources: this.opts.excludeFundingSources,
|
|
322
331
|
mode: this.opts.mode,
|
|
323
332
|
amount: this.opts.amount,
|
|
324
333
|
evmTx: this.opts.evm,
|
|
@@ -328,45 +337,47 @@ class v {
|
|
|
328
337
|
theme: this.opts.theme
|
|
329
338
|
},
|
|
330
339
|
new URL(this.baseUrl).origin
|
|
331
|
-
), (
|
|
340
|
+
), (m = (c = this.opts).onOpen) == null || m.call(c);
|
|
332
341
|
}, 10);
|
|
333
|
-
}, e.src = t, e.allow = "payment *; clipboard-write *", document.body.appendChild(e);
|
|
342
|
+
}, e.src = t, e.allow = "payment *; clipboard-write *", i ? i.appendChild(e) : document.body.appendChild(e);
|
|
334
343
|
}
|
|
335
344
|
removeIframe() {
|
|
336
345
|
const t = document.getElementById("glide-deposit-iframe");
|
|
337
346
|
t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
|
|
338
347
|
}
|
|
339
348
|
}
|
|
340
|
-
const
|
|
349
|
+
const Y = ({
|
|
341
350
|
app: s,
|
|
342
351
|
recipient: t,
|
|
343
352
|
preferGaslessPayment: e,
|
|
344
353
|
excludeChainIds: i,
|
|
345
354
|
excludeCurrencyTiers: n,
|
|
346
|
-
|
|
347
|
-
|
|
355
|
+
excludeFundingSources: r,
|
|
356
|
+
mode: d,
|
|
357
|
+
sessionMetadata: o,
|
|
348
358
|
theme: a,
|
|
349
|
-
walletProvider:
|
|
359
|
+
walletProvider: p,
|
|
350
360
|
onOpen: l,
|
|
351
|
-
onSuccess:
|
|
361
|
+
onSuccess: h,
|
|
352
362
|
onClose: u,
|
|
353
|
-
autoCloseOnSuccess:
|
|
363
|
+
autoCloseOnSuccess: f,
|
|
354
364
|
baseUrl: c
|
|
355
365
|
}) => {
|
|
356
|
-
const
|
|
366
|
+
const m = v(() => new $({
|
|
357
367
|
app: s,
|
|
358
368
|
recipient: t,
|
|
359
369
|
preferGaslessPayment: e,
|
|
360
370
|
excludeChainIds: i,
|
|
361
371
|
excludeCurrencyTiers: n,
|
|
362
|
-
|
|
363
|
-
|
|
372
|
+
excludeFundingSources: r,
|
|
373
|
+
mode: d,
|
|
374
|
+
sessionMetadata: o,
|
|
364
375
|
theme: a,
|
|
365
|
-
walletProvider:
|
|
376
|
+
walletProvider: p,
|
|
366
377
|
onOpen: l,
|
|
367
|
-
onSuccess:
|
|
378
|
+
onSuccess: h,
|
|
368
379
|
onClose: u,
|
|
369
|
-
autoCloseOnSuccess:
|
|
380
|
+
autoCloseOnSuccess: f,
|
|
370
381
|
baseUrl: c
|
|
371
382
|
}), [
|
|
372
383
|
s,
|
|
@@ -376,103 +387,109 @@ const K = ({
|
|
|
376
387
|
n,
|
|
377
388
|
r,
|
|
378
389
|
d,
|
|
379
|
-
a,
|
|
380
390
|
o,
|
|
381
|
-
|
|
391
|
+
a,
|
|
382
392
|
p,
|
|
383
|
-
|
|
393
|
+
l,
|
|
384
394
|
h,
|
|
395
|
+
u,
|
|
396
|
+
f,
|
|
385
397
|
c
|
|
386
398
|
]);
|
|
387
399
|
return {
|
|
388
|
-
openGlideDeposit:
|
|
389
|
-
externalUrl:
|
|
390
|
-
opts:
|
|
400
|
+
openGlideDeposit: m.open,
|
|
401
|
+
externalUrl: m.externalUrl,
|
|
402
|
+
opts: m.opts
|
|
391
403
|
};
|
|
392
|
-
},
|
|
404
|
+
}, Z = ({
|
|
393
405
|
app: s,
|
|
394
406
|
preferGaslessPayment: t,
|
|
395
407
|
excludeChainIds: e,
|
|
396
408
|
excludeCurrencyTiers: i,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
409
|
+
excludeFundingSources: n,
|
|
410
|
+
amount: r,
|
|
411
|
+
sessionId: d,
|
|
412
|
+
sessionMetadata: o,
|
|
400
413
|
theme: a,
|
|
401
|
-
walletProvider:
|
|
414
|
+
walletProvider: p,
|
|
402
415
|
onOpen: l,
|
|
403
|
-
onSuccess:
|
|
416
|
+
onSuccess: h,
|
|
404
417
|
onClose: u,
|
|
405
|
-
autoCloseOnSuccess:
|
|
418
|
+
autoCloseOnSuccess: f,
|
|
406
419
|
baseUrl: c
|
|
407
420
|
}) => {
|
|
408
|
-
const
|
|
421
|
+
const m = v(() => new $({
|
|
409
422
|
app: s,
|
|
410
423
|
preferGaslessPayment: t,
|
|
411
424
|
excludeChainIds: e,
|
|
412
425
|
excludeCurrencyTiers: i,
|
|
426
|
+
excludeFundingSources: n,
|
|
413
427
|
mode: "pay",
|
|
414
|
-
sessionId:
|
|
415
|
-
amount:
|
|
416
|
-
sessionMetadata:
|
|
428
|
+
sessionId: d,
|
|
429
|
+
amount: r,
|
|
430
|
+
sessionMetadata: o,
|
|
417
431
|
theme: a,
|
|
418
|
-
walletProvider:
|
|
432
|
+
walletProvider: p,
|
|
419
433
|
onOpen: l,
|
|
420
|
-
onSuccess:
|
|
434
|
+
onSuccess: h,
|
|
421
435
|
onClose: u,
|
|
422
|
-
autoCloseOnSuccess:
|
|
436
|
+
autoCloseOnSuccess: f,
|
|
423
437
|
baseUrl: c
|
|
424
438
|
}), [
|
|
425
439
|
s,
|
|
426
440
|
t,
|
|
427
441
|
e,
|
|
428
442
|
i,
|
|
429
|
-
r,
|
|
430
443
|
n,
|
|
431
444
|
d,
|
|
432
|
-
|
|
445
|
+
r,
|
|
433
446
|
o,
|
|
434
|
-
|
|
447
|
+
a,
|
|
435
448
|
p,
|
|
436
|
-
|
|
449
|
+
l,
|
|
437
450
|
h,
|
|
451
|
+
u,
|
|
452
|
+
f,
|
|
438
453
|
c
|
|
439
454
|
]);
|
|
440
455
|
return {
|
|
441
|
-
openGlidePay:
|
|
442
|
-
externalUrl:
|
|
443
|
-
opts:
|
|
456
|
+
openGlidePay: m.open,
|
|
457
|
+
externalUrl: m.externalUrl,
|
|
458
|
+
opts: m.opts
|
|
444
459
|
};
|
|
445
|
-
},
|
|
460
|
+
}, _ = ({
|
|
446
461
|
app: s,
|
|
447
462
|
evm: t,
|
|
448
463
|
approval: e,
|
|
449
464
|
preferGaslessPayment: i,
|
|
450
465
|
excludeChainIds: n,
|
|
451
466
|
excludeCurrencyTiers: r,
|
|
452
|
-
|
|
467
|
+
excludeFundingSources: d,
|
|
468
|
+
sessionMetadata: o,
|
|
453
469
|
theme: a,
|
|
454
|
-
walletProvider:
|
|
470
|
+
walletProvider: p,
|
|
455
471
|
onOpen: l,
|
|
456
|
-
onSuccess:
|
|
472
|
+
onSuccess: h,
|
|
457
473
|
onClose: u,
|
|
458
|
-
autoCloseOnSuccess:
|
|
474
|
+
autoCloseOnSuccess: f,
|
|
459
475
|
baseUrl: c
|
|
460
476
|
}) => {
|
|
461
|
-
const
|
|
477
|
+
const m = v(() => new $({
|
|
462
478
|
app: s,
|
|
463
479
|
evm: t,
|
|
464
480
|
approval: e,
|
|
465
481
|
preferGaslessPayment: i,
|
|
466
482
|
excludeChainIds: n,
|
|
467
483
|
excludeCurrencyTiers: r,
|
|
468
|
-
|
|
484
|
+
excludeFundingSources: d,
|
|
485
|
+
sessionMetadata: o,
|
|
469
486
|
mode: "call",
|
|
470
487
|
theme: a,
|
|
471
|
-
walletProvider:
|
|
488
|
+
walletProvider: p,
|
|
472
489
|
onOpen: l,
|
|
473
|
-
onSuccess:
|
|
490
|
+
onSuccess: h,
|
|
474
491
|
onClose: u,
|
|
475
|
-
autoCloseOnSuccess:
|
|
492
|
+
autoCloseOnSuccess: f,
|
|
476
493
|
baseUrl: c
|
|
477
494
|
}), [
|
|
478
495
|
s,
|
|
@@ -482,49 +499,52 @@ const K = ({
|
|
|
482
499
|
n,
|
|
483
500
|
r,
|
|
484
501
|
d,
|
|
485
|
-
a,
|
|
486
502
|
o,
|
|
487
|
-
|
|
503
|
+
a,
|
|
488
504
|
p,
|
|
489
|
-
|
|
505
|
+
l,
|
|
490
506
|
h,
|
|
507
|
+
u,
|
|
508
|
+
f,
|
|
491
509
|
c
|
|
492
510
|
]);
|
|
493
511
|
return {
|
|
494
|
-
openGlideCall:
|
|
495
|
-
externalUrl:
|
|
496
|
-
opts:
|
|
512
|
+
openGlideCall: m.open,
|
|
513
|
+
externalUrl: m.externalUrl,
|
|
514
|
+
opts: m.opts
|
|
497
515
|
};
|
|
498
|
-
},
|
|
516
|
+
}, ee = ({
|
|
499
517
|
app: s,
|
|
500
518
|
recipient: t,
|
|
501
519
|
preferGaslessPayment: e,
|
|
502
520
|
excludeChainIds: i,
|
|
503
521
|
excludeCurrencyTiers: n,
|
|
504
|
-
|
|
505
|
-
|
|
522
|
+
excludeFundingSources: r,
|
|
523
|
+
sessionMetadata: d,
|
|
524
|
+
theme: o,
|
|
506
525
|
walletProvider: a,
|
|
507
|
-
onOpen:
|
|
526
|
+
onOpen: p,
|
|
508
527
|
onSuccess: l,
|
|
509
|
-
onClose:
|
|
528
|
+
onClose: h,
|
|
510
529
|
autoCloseOnSuccess: u,
|
|
511
|
-
baseUrl:
|
|
530
|
+
baseUrl: f
|
|
512
531
|
}) => {
|
|
513
|
-
const c =
|
|
532
|
+
const c = v(() => new $({
|
|
514
533
|
app: s,
|
|
515
534
|
recipient: t,
|
|
516
535
|
preferGaslessPayment: e,
|
|
517
536
|
excludeChainIds: i,
|
|
518
537
|
excludeCurrencyTiers: n,
|
|
519
|
-
|
|
538
|
+
excludeFundingSources: r,
|
|
539
|
+
sessionMetadata: d,
|
|
520
540
|
mode: "buy",
|
|
521
|
-
theme:
|
|
541
|
+
theme: o,
|
|
522
542
|
walletProvider: a,
|
|
523
|
-
onOpen:
|
|
543
|
+
onOpen: p,
|
|
524
544
|
onSuccess: l,
|
|
525
|
-
onClose:
|
|
545
|
+
onClose: h,
|
|
526
546
|
autoCloseOnSuccess: u,
|
|
527
|
-
baseUrl:
|
|
547
|
+
baseUrl: f
|
|
528
548
|
}), [
|
|
529
549
|
s,
|
|
530
550
|
t,
|
|
@@ -533,12 +553,13 @@ const K = ({
|
|
|
533
553
|
n,
|
|
534
554
|
r,
|
|
535
555
|
d,
|
|
536
|
-
a,
|
|
537
556
|
o,
|
|
538
|
-
|
|
557
|
+
a,
|
|
539
558
|
p,
|
|
559
|
+
l,
|
|
560
|
+
h,
|
|
540
561
|
u,
|
|
541
|
-
|
|
562
|
+
f
|
|
542
563
|
]);
|
|
543
564
|
return {
|
|
544
565
|
openGlideBuy: c.open,
|
|
@@ -547,9 +568,9 @@ const K = ({
|
|
|
547
568
|
};
|
|
548
569
|
};
|
|
549
570
|
export {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
571
|
+
$ as GlideDeposit,
|
|
572
|
+
ee as useGlideBuy,
|
|
573
|
+
_ as useGlideCall,
|
|
574
|
+
Y as useGlideDeposit,
|
|
575
|
+
Z as useGlidePay
|
|
555
576
|
};
|
package/dist/useGlideBuy.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlideDepositWalletProvider, Hex } from './GlideDeposit.ts';
|
|
1
|
+
import { FundingSource, GlideDepositWalletProvider, Hex } from './GlideDeposit.ts';
|
|
2
2
|
import { GlideWidgetTheme } from './theme.ts';
|
|
3
3
|
import { CAIP2 } from '@paywithglide/glide-js';
|
|
4
4
|
interface UseGlideBuyProps {
|
|
@@ -7,6 +7,7 @@ interface UseGlideBuyProps {
|
|
|
7
7
|
preferGaslessPayment?: boolean;
|
|
8
8
|
excludeChainIds?: CAIP2[];
|
|
9
9
|
excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
|
|
10
|
+
excludeFundingSources?: FundingSource[];
|
|
10
11
|
sessionMetadata?: string;
|
|
11
12
|
theme?: GlideWidgetTheme;
|
|
12
13
|
walletProvider?: GlideDepositWalletProvider;
|
|
@@ -16,7 +17,7 @@ interface UseGlideBuyProps {
|
|
|
16
17
|
autoCloseOnSuccess?: boolean;
|
|
17
18
|
baseUrl?: string;
|
|
18
19
|
}
|
|
19
|
-
export declare const useGlideBuy: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
|
|
20
|
+
export declare const useGlideBuy: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
|
|
20
21
|
openGlideBuy: () => void;
|
|
21
22
|
externalUrl: string;
|
|
22
23
|
opts: import('./GlideDeposit.ts').GlideDepositOptions;
|
package/dist/useGlideCall.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlideDepositWalletProvider, Hex } from './GlideDeposit.ts';
|
|
1
|
+
import { FundingSource, GlideDepositWalletProvider, Hex } from './GlideDeposit.ts';
|
|
2
2
|
import { GlideWidgetTheme } from './theme.ts';
|
|
3
3
|
import { CAIP2 } from '@paywithglide/glide-js';
|
|
4
4
|
interface UseGlideCallProps {
|
|
@@ -16,6 +16,7 @@ interface UseGlideCallProps {
|
|
|
16
16
|
preferGaslessPayment?: boolean;
|
|
17
17
|
excludeChainIds?: CAIP2[];
|
|
18
18
|
excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
|
|
19
|
+
excludeFundingSources?: FundingSource[];
|
|
19
20
|
sessionMetadata?: string;
|
|
20
21
|
theme?: GlideWidgetTheme;
|
|
21
22
|
walletProvider?: GlideDepositWalletProvider;
|
|
@@ -25,7 +26,7 @@ interface UseGlideCallProps {
|
|
|
25
26
|
autoCloseOnSuccess?: boolean;
|
|
26
27
|
baseUrl?: string;
|
|
27
28
|
}
|
|
28
|
-
export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideCallProps) => {
|
|
29
|
+
export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideCallProps) => {
|
|
29
30
|
openGlideCall: () => void;
|
|
30
31
|
externalUrl: string;
|
|
31
32
|
opts: import('./GlideDeposit.ts').GlideDepositOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlideDepositWalletProvider } from './GlideDeposit.ts';
|
|
1
|
+
import { FundingSource, GlideDepositWalletProvider } from './GlideDeposit.ts';
|
|
2
2
|
import { GlideWidgetTheme } from './theme.ts';
|
|
3
3
|
import { CAIP2 } from '@paywithglide/glide-js';
|
|
4
4
|
interface UseGlideDepositProps {
|
|
@@ -7,6 +7,7 @@ interface UseGlideDepositProps {
|
|
|
7
7
|
preferGaslessPayment?: boolean;
|
|
8
8
|
excludeChainIds?: CAIP2[];
|
|
9
9
|
excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
|
|
10
|
+
excludeFundingSources?: FundingSource[];
|
|
10
11
|
mode?: "deposit" | "withdraw";
|
|
11
12
|
sessionMetadata?: string;
|
|
12
13
|
theme?: GlideWidgetTheme;
|
|
@@ -17,7 +18,7 @@ interface UseGlideDepositProps {
|
|
|
17
18
|
autoCloseOnSuccess?: boolean;
|
|
18
19
|
baseUrl?: string;
|
|
19
20
|
}
|
|
20
|
-
export declare const useGlideDeposit: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, mode, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideDepositProps) => {
|
|
21
|
+
export declare const useGlideDeposit: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideDepositProps) => {
|
|
21
22
|
openGlideDeposit: () => void;
|
|
22
23
|
externalUrl: string;
|
|
23
24
|
opts: import('./GlideDeposit.ts').GlideDepositOptions;
|
package/dist/useGlidePay.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlideDepositWalletProvider } from './GlideDeposit.ts';
|
|
1
|
+
import { FundingSource, GlideDepositWalletProvider } from './GlideDeposit.ts';
|
|
2
2
|
import { GlideWidgetTheme } from './theme.ts';
|
|
3
3
|
import { CAIP2 } from '@paywithglide/glide-js';
|
|
4
4
|
type UseGlidePayProps = {
|
|
@@ -7,6 +7,7 @@ type UseGlidePayProps = {
|
|
|
7
7
|
preferGaslessPayment?: boolean;
|
|
8
8
|
excludeChainIds?: CAIP2[];
|
|
9
9
|
excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
|
|
10
|
+
excludeFundingSources?: FundingSource[];
|
|
10
11
|
sessionId?: string;
|
|
11
12
|
sessionMetadata?: string;
|
|
12
13
|
theme?: GlideWidgetTheme;
|
|
@@ -17,7 +18,7 @@ type UseGlidePayProps = {
|
|
|
17
18
|
autoCloseOnSuccess?: boolean;
|
|
18
19
|
baseUrl?: string;
|
|
19
20
|
};
|
|
20
|
-
export declare const useGlidePay: ({ app, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, amount, sessionId, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlidePayProps) => {
|
|
21
|
+
export declare const useGlidePay: ({ app, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, amount, sessionId, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlidePayProps) => {
|
|
21
22
|
openGlidePay: () => void;
|
|
22
23
|
externalUrl: string;
|
|
23
24
|
opts: import('./GlideDeposit.ts').GlideDepositOptions;
|