@paywithglide/glide-react 0.0.29 → 0.0.31

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