@nibgate/sdk 0.2.12 → 0.2.14

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/nibgate.js CHANGED
@@ -1,8 +1,16 @@
1
1
  var Nibgate = (() => {
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
6
14
  var __esm = (fn, res) => function __init() {
7
15
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
16
  };
@@ -18,6 +26,14 @@ var Nibgate = (() => {
18
26
  }
19
27
  return to;
20
28
  };
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
+ // If the importer is in node compatibility mode or this is not an ESM
31
+ // file that has been converted to a CommonJS file using a Babel-
32
+ // compatible transform (i.e. "__esModule" has not been set), then set
33
+ // "default" to the CommonJS "module.exports" for node compatibility.
34
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
+ mod
36
+ ));
21
37
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
38
 
23
39
  // src/core/payment.js
@@ -448,6 +464,14 @@ var Nibgate = (() => {
448
464
  });
449
465
 
450
466
  // src/browser/schemes/batch-scheme.js
467
+ var batch_scheme_exports = {};
468
+ __export(batch_scheme_exports, {
469
+ BatchEvmScheme: () => BatchEvmScheme,
470
+ CIRCLE_BATCHING_NAME: () => CIRCLE_BATCHING_NAME,
471
+ CIRCLE_BATCHING_VERSION: () => CIRCLE_BATCHING_VERSION,
472
+ GATEWAY_AUTH_VALIDITY_WINDOW_SECONDS: () => GATEWAY_AUTH_VALIDITY_WINDOW_SECONDS,
473
+ GATEWAY_MIN_AUTH_VALIDITY_SECONDS: () => GATEWAY_MIN_AUTH_VALIDITY_SECONDS
474
+ });
451
475
  function supportsBatching(requirements) {
452
476
  const extra = requirements.extra;
453
477
  if (!extra) return false;
@@ -611,7 +635,17 @@ var Nibgate = (() => {
611
635
  if (!signer?.address || typeof signer.signTypedData !== "function") {
612
636
  throw new Error("Circle Gateway browser adapter requires an EVM signer with address and signTypedData.");
613
637
  }
614
- const scheme = options.clientModule?.BatchEvmScheme ? new options.clientModule.BatchEvmScheme(signer) : new BatchEvmScheme(signer);
638
+ let BatchEvmScheme2;
639
+ try {
640
+ const circle = await import("@circle-fin/x402-batching/client");
641
+ BatchEvmScheme2 = circle.BatchEvmScheme;
642
+ } catch (err) {
643
+ console.warn("[nibgate] Failed to import @circle-fin/x402-batching/client:", err.message);
644
+ console.warn("[nibgate] Falling back to custom BatchEvmScheme");
645
+ const local = await Promise.resolve().then(() => (init_batch_scheme(), batch_scheme_exports));
646
+ BatchEvmScheme2 = local.BatchEvmScheme;
647
+ }
648
+ const scheme = options.clientModule?.BatchEvmScheme ? new options.clientModule.BatchEvmScheme(signer) : new BatchEvmScheme2(signer);
615
649
  const network = options.network || options.chainId && `eip155:${options.chainId}` || "eip155:5042002";
616
650
  function parsePaymentRequired(input) {
617
651
  if (input && typeof input === "object") return input;
@@ -669,7 +703,6 @@ var Nibgate = (() => {
669
703
  }
670
704
  var init_gateway = __esm({
671
705
  "src/browser/gateway.js"() {
672
- init_batch_scheme();
673
706
  init_json();
674
707
  }
675
708
  });