@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.
@@ -1,5 +1,5 @@
1
1
  import { GlideWidgetTheme } from './theme.ts';
2
- import { CAIP2, Chain, Currency } from '@paywithglide/glide-js';
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
- chain?: Chain;
93
- currency?: Currency;
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 ee = Object.defineProperty;
2
- var te = (s, t, e) => t in s ? ee(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var S = (s, t, e) => te(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { useMemo as E } from "react";
5
- function se(s, { strict: t = !0 } = {}) {
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 K(s) {
9
- return se(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
8
+ function R(s) {
9
+ return ee(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
10
10
  }
11
- const F = "2.21.51";
12
- let P = {
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@${F}`
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 = P.getDocsUrl) == null ? void 0 : a.call(P, { ...e, docsPath: r }), c = [
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
- ...P.version ? [`Version: ${P.version}`] : []
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 = F;
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 V(this, t);
64
+ return K(this, t);
65
65
  }
66
66
  }
67
- function V(s, t) {
68
- return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? V(s.cause, t) : t ? null : s;
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 q extends x {
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 U(s, { dir: t, size: e = 32 } = {}) {
76
- return typeof s == "string" ? ie(s, { dir: t, size: e }) : re(s, { dir: t, size: e });
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 ie(s, { dir: t, size: e = 32 } = {}) {
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 q({
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 re(s, { dir: t, size: e = 32 } = {}) {
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 q({
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 oe extends x {
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 ne extends x {
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 J(s, { size: t }) {
117
- if (K(s) > t)
118
- throw new ne({
119
- givenSize: K(s),
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 ae = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
124
- function ce(s, t = {}) {
125
- return typeof s == "number" || typeof s == "bigint" ? le(s, t) : typeof s == "string" ? he(s, t) : typeof s == "boolean" ? de(s, t) : X(s, t);
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 de(s, t = {}) {
127
+ function ae(s, t = {}) {
128
128
  const e = `0x${Number(s)}`;
129
- return typeof t.size == "number" ? (J(e, { size: t.size }), U(e, { size: t.size })) : e;
129
+ return typeof t.size == "number" ? (V(e, { size: t.size }), z(e, { size: t.size })) : e;
130
130
  }
131
- function X(s, t = {}) {
131
+ function q(s, t = {}) {
132
132
  let e = "";
133
133
  for (let r = 0; r < s.length; r++)
134
- e += ae[s[r]];
134
+ e += oe[s[r]];
135
135
  const i = `0x${e}`;
136
- return typeof t.size == "number" ? (J(i, { size: t.size }), U(i, { dir: "right", size: t.size })) : i;
136
+ return typeof t.size == "number" ? (V(i, { size: t.size }), z(i, { dir: "right", size: t.size })) : i;
137
137
  }
138
- function le(s, t = {}) {
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 oe({
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 ? U(a, { size: i }) : a;
154
+ return i ? z(a, { size: i }) : a;
155
155
  }
156
- const pe = /* @__PURE__ */ new TextEncoder();
157
- function he(s, t = {}) {
158
- const e = pe.encode(s);
159
- return X(e, t);
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 k {
161
+ class U {
162
162
  constructor(t) {
163
- S(this, "opts");
164
- S(this, "open", () => {
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
- S(this, "iframeEventHandler", async (t) => {
176
- var i, r, o, c, a, n, p, h, u, m, f, g, y, w, d, b, $, I, v, z, A, M, T, D, C, G, j, B, W, H, L, O, R, 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 l = this.opts.recipient, Q = (i = this.opts.walletProvider) == null ? void 0 : i.address, Y = (r = this.opts.walletProvider) == null ? void 0 : r.availableChainIds, Z = (o = this.opts.walletProvider) == null ? void 0 : o.currentChainId, _ = this.opts.preferGaslessPayment || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
181
- (h = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || h.postMessage(
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: l,
186
- connectedWalletAddress: Q,
187
- availableChainIds: Y,
188
- currentChainId: Z,
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: (n = this.opts.chain) == null ? void 0 : n.id,
196
- currencyId: (p = this.opts.currency) == null ? void 0 : p.id,
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", (m = (u = this.opts).onOpen) == null || m.call(u);
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 l = await this.opts.localStorageProvider.getKeys();
215
- (g = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || g.postMessage(
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: l
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 l = await this.opts.localStorageProvider.getItem(e.key);
241
- (w = (y = this.iframe) == null ? void 0 : y.contentWindow) == null || w.postMessage(
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: l
245
+ value: p
246
246
  },
247
247
  this.baseUrl
248
248
  );
249
249
  break;
250
250
  }
251
251
  case "success":
252
- (b = (d = this.opts) == null ? void 0 : d.onSuccess) == null || b.call(d, e.hash);
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(), (I = ($ = this.opts) == null ? void 0 : $.onClose) == null || I.call($);
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
- (z = (v = this.opts) == null ? void 0 : v.onSetMode) == null || z.call(v, e.mode);
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
- }), (M = (A = this.iframe) == null ? void 0 : A.contentWindow) == null || M.postMessage(
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 (l) {
275
- (D = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || D.postMessage(
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: l
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 l = await this.opts.walletProvider.sendTransactionAsync(
290
+ const p = await this.opts.walletProvider.sendTransactionAsync(
291
291
  e.tx
292
292
  );
293
- (G = (C = this.iframe) == null ? void 0 : C.contentWindow) == null || G.postMessage(
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: l
297
+ txHash: p
298
298
  },
299
299
  this.baseUrl
300
300
  );
301
- } catch (l) {
302
- (B = (j = this.iframe) == null ? void 0 : j.contentWindow) == null || B.postMessage(
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: l
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
- (H = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || H.postMessage(
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 l = await this.opts.walletProvider.signTypedDataAsync(
329
+ const p = await this.opts.walletProvider.signTypedDataAsync(
330
330
  e.data
331
331
  );
332
- (O = (L = this.iframe) == null ? void 0 : L.contentWindow) == null || O.postMessage(
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: l
336
+ signature: p
337
337
  },
338
338
  this.baseUrl
339
339
  );
340
- } catch (l) {
341
- (N = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || N.postMessage(
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: l
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.chain ? `&chainId=${this.opts.chain.id}` : ""}${this.opts.currency ? `&currencyId=${this.opts.currency.id}` : ""}${this.opts.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${ce(
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 ? `&currencyId=${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 fe = ({
395
+ const ue = ({
396
396
  app: s,
397
397
  recipient: t,
398
- chain: e,
399
- currency: i,
400
- gasRefuelAmountPerChain: r,
401
- preferGaslessPayment: o,
402
- excludeChainIds: c,
403
- excludeCurrencyTiers: a,
404
- excludeFundingSources: n,
405
- mode: p,
406
- sessionMetadata: h,
407
- theme: u,
408
- walletProvider: m,
409
- localStorageProvider: f,
410
- onOpen: g,
411
- onSuccess: y,
412
- onClose: w,
413
- autoCloseOnSuccess: d,
414
- popupsBlocked: b,
415
- baseUrl: $,
416
- debug: I
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 v = E(() => new k({
419
+ const $ = k(() => new U({
419
420
  app: s,
420
421
  recipient: t,
421
- chain: e,
422
- currency: i,
423
- gasRefuelAmountPerChain: r,
424
- preferGaslessPayment: o,
425
- excludeChainIds: c,
426
- excludeCurrencyTiers: a,
427
- excludeFundingSources: n,
428
- mode: p,
429
- sessionMetadata: h,
430
- theme: u,
431
- walletProvider: m,
432
- localStorageProvider: f,
433
- onOpen: g,
434
- onSuccess: y,
435
- onClose: w,
436
- autoCloseOnSuccess: d,
437
- popupsBlocked: b,
438
- baseUrl: $,
439
- debug: I
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: v.open,
465
- externalUrl: v.externalUrl,
466
- opts: v.opts
467
+ openGlideDeposit: $.open,
468
+ externalUrl: $.externalUrl,
469
+ opts: $.opts
467
470
  };
468
- }, ge = ({
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: p,
479
- localStorageProvider: h,
480
- onOpen: u,
481
- onSuccess: m,
482
- onClose: f,
483
- autoCloseOnSuccess: g,
484
- popupsBlocked: y,
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 = E(() => new k({
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: p,
500
- localStorageProvider: h,
501
- onOpen: u,
502
- onSuccess: m,
503
- onClose: f,
504
- autoCloseOnSuccess: g,
505
- popupsBlocked: y,
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
- }, ye = ({
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: p,
544
- localStorageProvider: h,
545
- onOpen: u,
546
- onSuccess: m,
547
- onClose: f,
548
- autoCloseOnSuccess: g,
549
- popupsBlocked: y,
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 = E(() => new k({
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: p,
565
- localStorageProvider: h,
566
- onOpen: u,
567
- onSuccess: m,
568
- onClose: f,
569
- autoCloseOnSuccess: g,
570
- popupsBlocked: y,
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
- }, we = ({
601
+ }, ge = ({
599
602
  app: s,
600
603
  recipient: t,
601
- chain: e,
602
- currency: i,
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: p,
609
- walletProvider: h,
610
- localStorageProvider: u,
611
- onOpen: m,
612
- onSuccess: f,
613
- onClose: g,
614
- autoCloseOnSuccess: y,
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 = E(() => new k({
620
+ const d = k(() => new U({
618
621
  app: s,
619
622
  recipient: t,
620
- chain: e,
621
- currency: i,
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: p,
629
- walletProvider: h,
630
- localStorageProvider: u,
631
- onOpen: m,
632
- onSuccess: f,
633
- onClose: g,
634
- autoCloseOnSuccess: y,
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
- }, be = Object.freeze({
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
- k as GlideDeposit,
694
- be as browserLocalStorageProvider,
695
- we as useGlideBuy,
696
- ye as useGlideCall,
697
- fe as useGlideDeposit,
698
- ge as useGlidePay
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
  };
@@ -1,11 +1,11 @@
1
1
  import { FundingSource, GlideDepositWalletProvider, GlideLocalStorageProvider, Hex } from './GlideDeposit.ts';
2
2
  import { GlideWidgetTheme } from './theme.ts';
3
- import { CAIP2, Chain, Currency } from '@paywithglide/glide-js';
3
+ import { CAIP2 } from '@paywithglide/glide-js';
4
4
  interface UseGlideBuyProps {
5
5
  app: string;
6
6
  recipient?: string;
7
- chain?: Chain;
8
- currency?: Currency;
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, chain, currency, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
23
+ export declare const useGlideBuy: ({ app, recipient, chainId, currencyId, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
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, Chain, Currency } from '@paywithglide/glide-js';
3
+ import { CAIP2 } from '@paywithglide/glide-js';
4
4
  interface UseGlideDepositProps {
5
5
  app: string;
6
6
  recipient?: string;
7
- chain?: Chain;
8
- currency?: Currency;
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, chain, currency, gasRefuelAmountPerChain, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
28
+ export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
28
29
  openGlideDeposit: () => void;
29
30
  externalUrl: string;
30
31
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paywithglide/glide-react",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"