UNPKG

@etherspot/remote-signer

Version:

Etherspot Permissioned Signer SDK - signs the UserOp with SessionKey and sends it to the Bundler

2,385 lines 70.5 kB
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// node_modules/viem/_esm/utils/data/isHex.js
function isHex(value, { strict = true } = {}) {
  if (!value)
    return false;
  if (typeof value !== "string")
    return false;
  return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
}
var init_isHex = __esm({
  "node_modules/viem/_esm/utils/data/isHex.js"() {
  }
});

// node_modules/viem/_esm/utils/data/size.js
function size(value) {
  if (isHex(value, { strict: false }))
    return Math.ceil((value.length - 2) / 2);
  return value.length;
}
var init_size = __esm({
  "node_modules/viem/_esm/utils/data/size.js"() {
    init_isHex();
  }
});

// node_modules/viem/_esm/errors/version.js
var version;
var init_version = __esm({
  "node_modules/viem/_esm/errors/version.js"() {
    version = "2.16.3";
  }
});

// node_modules/viem/_esm/errors/utils.js
var getVersion;
var init_utils = __esm({
  "node_modules/viem/_esm/errors/utils.js"() {
    init_version();
    getVersion = () => `viem@${version}`;
  }
});

// node_modules/viem/_esm/errors/base.js
function walk(err, fn) {
  if (fn?.(err))
    return err;
  if (err && typeof err === "object" && "cause" in err)
    return walk(err.cause, fn);
  return fn ? null : err;
}
var BaseError;
var init_base = __esm({
  "node_modules/viem/_esm/errors/base.js"() {
    init_utils();
    BaseError = class _BaseError extends Error {
      constructor(shortMessage, args = {}) {
        super();
        Object.defineProperty(this, "details", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "docsPath", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "metaMessages", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "shortMessage", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "name", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: "ViemError"
        });
        Object.defineProperty(this, "version", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: getVersion()
        });
        const details = args.cause instanceof _BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
        const docsPath = args.cause instanceof _BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
        this.message = [
          shortMessage || "An error occurred.",
          "",
          ...args.metaMessages ? [...args.metaMessages, ""] : [],
          ...docsPath ? [
            `Docs: ${args.docsBaseUrl ?? "https://viem.sh"}${docsPath}${args.docsSlug ? `#${args.docsSlug}` : ""}`
          ] : [],
          ...details ? [`Details: ${details}`] : [],
          `Version: ${this.version}`
        ].join("\n");
        if (args.cause)
          this.cause = args.cause;
        this.details = details;
        this.docsPath = docsPath;
        this.metaMessages = args.metaMessages;
        this.shortMessage = shortMessage;
      }
      walk(fn) {
        return walk(this, fn);
      }
    };
  }
});

// node_modules/viem/_esm/errors/data.js
var SizeExceedsPaddingSizeError;
var init_data = __esm({
  "node_modules/viem/_esm/errors/data.js"() {
    init_base();
    SizeExceedsPaddingSizeError = class extends BaseError {
      constructor({ size: size2, targetSize, type }) {
        super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`);
        Object.defineProperty(this, "name", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: "SizeExceedsPaddingSizeError"
        });
      }
    };
  }
});

// node_modules/viem/_esm/utils/data/pad.js
function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
  if (typeof hexOrBytes === "string")
    return padHex(hexOrBytes, { dir, size: size2 });
  return padBytes(hexOrBytes, { dir, size: size2 });
}
function padHex(hex_, { dir, size: size2 = 32 } = {}) {
  if (size2 === null)
    return hex_;
  const hex = hex_.replace("0x", "");
  if (hex.length > size2 * 2)
    throw new SizeExceedsPaddingSizeError({
      size: Math.ceil(hex.length / 2),
      targetSize: size2,
      type: "hex"
    });
  return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
}
function padBytes(bytes2, { dir, size: size2 = 32 } = {}) {
  if (size2 === null)
    return bytes2;
  if (bytes2.length > size2)
    throw new SizeExceedsPaddingSizeError({
      size: bytes2.length,
      targetSize: size2,
      type: "bytes"
    });
  const paddedBytes = new Uint8Array(size2);
  for (let i = 0; i < size2; i++) {
    const padEnd = dir === "right";
    paddedBytes[padEnd ? i : size2 - i - 1] = bytes2[padEnd ? i : bytes2.length - i - 1];
  }
  return paddedBytes;
}
var init_pad = __esm({
  "node_modules/viem/_esm/utils/data/pad.js"() {
    init_data();
  }
});

// node_modules/viem/_esm/errors/encoding.js
var IntegerOutOfRangeError, SizeOverflowError;
var init_encoding = __esm({
  "node_modules/viem/_esm/errors/encoding.js"() {
    init_base();
    IntegerOutOfRangeError = class extends BaseError {
      constructor({ max, min, signed, size: size2, value }) {
        super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`);
        Object.defineProperty(this, "name", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: "IntegerOutOfRangeError"
        });
      }
    };
    SizeOverflowError = class extends BaseError {
      constructor({ givenSize, maxSize }) {
        super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`);
        Object.defineProperty(this, "name", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: "SizeOverflowError"
        });
      }
    };
  }
});

// node_modules/viem/_esm/utils/encoding/fromHex.js
function assertSize(hexOrBytes, { size: size2 }) {
  if (size(hexOrBytes) > size2)
    throw new SizeOverflowError({
      givenSize: size(hexOrBytes),
      maxSize: size2
    });
}
var init_fromHex = __esm({
  "node_modules/viem/_esm/utils/encoding/fromHex.js"() {
    init_encoding();
    init_size();
  }
});

// node_modules/viem/_esm/utils/encoding/toHex.js
function toHex(value, opts = {}) {
  if (typeof value === "number" || typeof value === "bigint")
    return numberToHex(value, opts);
  if (typeof value === "string") {
    return stringToHex(value, opts);
  }
  if (typeof value === "boolean")
    return boolToHex(value, opts);
  return bytesToHex(value, opts);
}
function boolToHex(value, opts = {}) {
  const hex = `0x${Number(value)}`;
  if (typeof opts.size === "number") {
    assertSize(hex, { size: opts.size });
    return pad(hex, { size: opts.size });
  }
  return hex;
}
function bytesToHex(value, opts = {}) {
  let string = "";
  for (let i = 0; i < value.length; i++) {
    string += hexes[value[i]];
  }
  const hex = `0x${string}`;
  if (typeof opts.size === "number") {
    assertSize(hex, { size: opts.size });
    return pad(hex, { dir: "right", size: opts.size });
  }
  return hex;
}
function numberToHex(value_, opts = {}) {
  const { signed, size: size2 } = opts;
  const value = BigInt(value_);
  let maxValue;
  if (size2) {
    if (signed)
      maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
    else
      maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
  } else if (typeof value_ === "number") {
    maxValue = BigInt(Number.MAX_SAFE_INTEGER);
  }
  const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
  if (maxValue && value > maxValue || value < minValue) {
    const suffix = typeof value_ === "bigint" ? "n" : "";
    throw new IntegerOutOfRangeError({
      max: maxValue ? `${maxValue}${suffix}` : void 0,
      min: `${minValue}${suffix}`,
      signed,
      size: size2,
      value: `${value_}${suffix}`
    });
  }
  const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
  if (size2)
    return pad(hex, { size: size2 });
  return hex;
}
function stringToHex(value_, opts = {}) {
  const value = encoder.encode(value_);
  return bytesToHex(value, opts);
}
var hexes, encoder;
var init_toHex = __esm({
  "node_modules/viem/_esm/utils/encoding/toHex.js"() {
    init_encoding();
    init_pad();
    init_fromHex();
    hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
    encoder = /* @__PURE__ */ new TextEncoder();
  }
});

// node_modules/viem/_esm/utils/encoding/toBytes.js
function toBytes(value, opts = {}) {
  if (typeof value === "number" || typeof value === "bigint")
    return numberToBytes(value, opts);
  if (typeof value === "boolean")
    return boolToBytes(value, opts);
  if (isHex(value))
    return hexToBytes(value, opts);
  return stringToBytes(value, opts);
}
function boolToBytes(value, opts = {}) {
  const bytes2 = new Uint8Array(1);
  bytes2[0] = Number(value);
  if (typeof opts.size === "number") {
    assertSize(bytes2, { size: opts.size });
    return pad(bytes2, { size: opts.size });
  }
  return bytes2;
}
function charCodeToBase16(char) {
  if (char >= charCodeMap.zero && char <= charCodeMap.nine)
    return char - charCodeMap.zero;
  if (char >= charCodeMap.A && char <= charCodeMap.F)
    return char - (charCodeMap.A - 10);
  if (char >= charCodeMap.a && char <= charCodeMap.f)
    return char - (charCodeMap.a - 10);
  return void 0;
}
function hexToBytes(hex_, opts = {}) {
  let hex = hex_;
  if (opts.size) {
    assertSize(hex, { size: opts.size });
    hex = pad(hex, { dir: "right", size: opts.size });
  }
  let hexString = hex.slice(2);
  if (hexString.length % 2)
    hexString = `0${hexString}`;
  const length = hexString.length / 2;
  const bytes2 = new Uint8Array(length);
  for (let index = 0, j = 0; index < length; index++) {
    const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
    const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
    if (nibbleLeft === void 0 || nibbleRight === void 0) {
      throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
    }
    bytes2[index] = nibbleLeft * 16 + nibbleRight;
  }
  return bytes2;
}
function numberToBytes(value, opts) {
  const hex = numberToHex(value, opts);
  return hexToBytes(hex);
}
function stringToBytes(value, opts = {}) {
  const bytes2 = encoder2.encode(value);
  if (typeof opts.size === "number") {
    assertSize(bytes2, { size: opts.size });
    return pad(bytes2, { dir: "right", size: opts.size });
  }
  return bytes2;
}
var encoder2, charCodeMap;
var init_toBytes = __esm({
  "node_modules/viem/_esm/utils/encoding/toBytes.js"() {
    init_base();
    init_isHex();
    init_pad();
    init_fromHex();
    init_toHex();
    encoder2 = /* @__PURE__ */ new TextEncoder();
    charCodeMap = {
      zero: 48,
      nine: 57,
      A: 65,
      F: 70,
      a: 97,
      f: 102
    };
  }
});

// node_modules/@noble/hashes/esm/_assert.js
function number(n) {
  if (!Number.isSafeInteger(n) || n < 0)
    throw new Error(`Wrong positive integer: ${n}`);
}
function bytes(b, ...lengths) {
  if (!(b instanceof Uint8Array))
    throw new Error("Expected Uint8Array");
  if (lengths.length > 0 && !lengths.includes(b.length))
    throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
}
function exists(instance, checkFinished = true) {
  if (instance.destroyed)
    throw new Error("Hash instance has been destroyed");
  if (checkFinished && instance.finished)
    throw new Error("Hash#digest() has already been called");
}
function output(out, instance) {
  bytes(out);
  const min = instance.outputLen;
  if (out.length < min) {
    throw new Error(`digestInto() expects output buffer of length at least ${min}`);
  }
}
var init_assert = __esm({
  "node_modules/@noble/hashes/esm/_assert.js"() {
  }
});

// node_modules/@noble/hashes/esm/_u64.js
function fromBig(n, le = false) {
  if (le)
    return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
  return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
}
function split(lst, le = false) {
  let Ah = new Uint32Array(lst.length);
  let Al = new Uint32Array(lst.length);
  for (let i = 0; i < lst.length; i++) {
    const { h, l } = fromBig(lst[i], le);
    [Ah[i], Al[i]] = [h, l];
  }
  return [Ah, Al];
}
var U32_MASK64, _32n, rotlSH, rotlSL, rotlBH, rotlBL;
var init_u64 = __esm({
  "node_modules/@noble/hashes/esm/_u64.js"() {
    U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
    _32n = /* @__PURE__ */ BigInt(32);
    rotlSH = (h, l, s) => h << s | l >>> 32 - s;
    rotlSL = (h, l, s) => l << s | h >>> 32 - s;
    rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
    rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
  }
});

// node_modules/@noble/hashes/esm/utils.js
function utf8ToBytes(str) {
  if (typeof str !== "string")
    throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
  return new Uint8Array(new TextEncoder().encode(str));
}
function toBytes2(data) {
  if (typeof data === "string")
    data = utf8ToBytes(data);
  if (!u8a(data))
    throw new Error(`expected Uint8Array, got ${typeof data}`);
  return data;
}
function wrapConstructor(hashCons) {
  const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
  const tmp = hashCons();
  hashC.outputLen = tmp.outputLen;
  hashC.blockLen = tmp.blockLen;
  hashC.create = () => hashCons();
  return hashC;
}
function wrapXOFConstructorWithOpts(hashCons) {
  const hashC = (msg, opts) => hashCons(opts).update(toBytes2(msg)).digest();
  const tmp = hashCons({});
  hashC.outputLen = tmp.outputLen;
  hashC.blockLen = tmp.blockLen;
  hashC.create = (opts) => hashCons(opts);
  return hashC;
}
var u8a, u32, isLE, Hash, toStr;
var init_utils2 = __esm({
  "node_modules/@noble/hashes/esm/utils.js"() {
    u8a = (a) => a instanceof Uint8Array;
    u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
    isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
    if (!isLE)
      throw new Error("Non little-endian hardware is not supported");
    Hash = class {
      // Safe version that clones internal state
      clone() {
        return this._cloneInto();
      }
    };
    toStr = {}.toString;
  }
});

// node_modules/@noble/hashes/esm/sha3.js
function keccakP(s, rounds = 24) {
  const B = new Uint32Array(5 * 2);
  for (let round = 24 - rounds; round < 24; round++) {
    for (let x = 0; x < 10; x++)
      B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
    for (let x = 0; x < 10; x += 2) {
      const idx1 = (x + 8) % 10;
      const idx0 = (x + 2) % 10;
      const B0 = B[idx0];
      const B1 = B[idx0 + 1];
      const Th = rotlH(B0, B1, 1) ^ B[idx1];
      const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
      for (let y = 0; y < 50; y += 10) {
        s[x + y] ^= Th;
        s[x + y + 1] ^= Tl;
      }
    }
    let curH = s[2];
    let curL = s[3];
    for (let t = 0; t < 24; t++) {
      const shift = SHA3_ROTL[t];
      const Th = rotlH(curH, curL, shift);
      const Tl = rotlL(curH, curL, shift);
      const PI = SHA3_PI[t];
      curH = s[PI];
      curL = s[PI + 1];
      s[PI] = Th;
      s[PI + 1] = Tl;
    }
    for (let y = 0; y < 50; y += 10) {
      for (let x = 0; x < 10; x++)
        B[x] = s[y + x];
      for (let x = 0; x < 10; x++)
        s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
    }
    s[0] ^= SHA3_IOTA_H[round];
    s[1] ^= SHA3_IOTA_L[round];
  }
  B.fill(0);
}
var SHA3_PI, SHA3_ROTL, _SHA3_IOTA, _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_IOTA_H, SHA3_IOTA_L, rotlH, rotlL, Keccak, gen, sha3_224, sha3_256, sha3_384, sha3_512, keccak_224, keccak_256, keccak_384, keccak_512, genShake, shake128, shake256;
var init_sha3 = __esm({
  "node_modules/@noble/hashes/esm/sha3.js"() {
    init_assert();
    init_u64();
    init_utils2();
    [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
    _0n = /* @__PURE__ */ BigInt(0);
    _1n = /* @__PURE__ */ BigInt(1);
    _2n = /* @__PURE__ */ BigInt(2);
    _7n = /* @__PURE__ */ BigInt(7);
    _256n = /* @__PURE__ */ BigInt(256);
    _0x71n = /* @__PURE__ */ BigInt(113);
    for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
      [x, y] = [y, (2 * x + 3 * y) % 5];
      SHA3_PI.push(2 * (5 * y + x));
      SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
      let t = _0n;
      for (let j = 0; j < 7; j++) {
        R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
        if (R & _2n)
          t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
      }
      _SHA3_IOTA.push(t);
    }
    [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
    rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
    rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
    Keccak = class _Keccak extends Hash {
      // NOTE: we accept arguments in bytes instead of bits here.
      constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
        super();
        this.blockLen = blockLen;
        this.suffix = suffix;
        this.outputLen = outputLen;
        this.enableXOF = enableXOF;
        this.rounds = rounds;
        this.pos = 0;
        this.posOut = 0;
        this.finished = false;
        this.destroyed = false;
        number(outputLen);
        if (0 >= this.blockLen || this.blockLen >= 200)
          throw new Error("Sha3 supports only keccak-f1600 function");
        this.state = new Uint8Array(200);
        this.state32 = u32(this.state);
      }
      keccak() {
        keccakP(this.state32, this.rounds);
        this.posOut = 0;
        this.pos = 0;
      }
      update(data) {
        exists(this);
        const { blockLen, state } = this;
        data = toBytes2(data);
        const len = data.length;
        for (let pos = 0; pos < len; ) {
          const take = Math.min(blockLen - this.pos, len - pos);
          for (let i = 0; i < take; i++)
            state[this.pos++] ^= data[pos++];
          if (this.pos === blockLen)
            this.keccak();
        }
        return this;
      }
      finish() {
        if (this.finished)
          return;
        this.finished = true;
        const { state, suffix, pos, blockLen } = this;
        state[pos] ^= suffix;
        if ((suffix & 128) !== 0 && pos === blockLen - 1)
          this.keccak();
        state[blockLen - 1] ^= 128;
        this.keccak();
      }
      writeInto(out) {
        exists(this, false);
        bytes(out);
        this.finish();
        const bufferOut = this.state;
        const { blockLen } = this;
        for (let pos = 0, len = out.length; pos < len; ) {
          if (this.posOut >= blockLen)
            this.keccak();
          const take = Math.min(blockLen - this.posOut, len - pos);
          out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
          this.posOut += take;
          pos += take;
        }
        return out;
      }
      xofInto(out) {
        if (!this.enableXOF)
          throw new Error("XOF is not possible for this instance");
        return this.writeInto(out);
      }
      xof(bytes2) {
        number(bytes2);
        return this.xofInto(new Uint8Array(bytes2));
      }
      digestInto(out) {
        output(out, this);
        if (this.finished)
          throw new Error("digest() was already called");
        this.writeInto(out);
        this.destroy();
        return out;
      }
      digest() {
        return this.digestInto(new Uint8Array(this.outputLen));
      }
      destroy() {
        this.destroyed = true;
        this.state.fill(0);
      }
      _cloneInto(to) {
        const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
        to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
        to.state32.set(this.state32);
        to.pos = this.pos;
        to.posOut = this.posOut;
        to.finished = this.finished;
        to.rounds = rounds;
        to.suffix = suffix;
        to.outputLen = outputLen;
        to.enableXOF = enableXOF;
        to.destroyed = this.destroyed;
        return to;
      }
    };
    gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
    sha3_224 = /* @__PURE__ */ gen(6, 144, 224 / 8);
    sha3_256 = /* @__PURE__ */ gen(6, 136, 256 / 8);
    sha3_384 = /* @__PURE__ */ gen(6, 104, 384 / 8);
    sha3_512 = /* @__PURE__ */ gen(6, 72, 512 / 8);
    keccak_224 = /* @__PURE__ */ gen(1, 144, 224 / 8);
    keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
    keccak_384 = /* @__PURE__ */ gen(1, 104, 384 / 8);
    keccak_512 = /* @__PURE__ */ gen(1, 72, 512 / 8);
    genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
    shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
    shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
  }
});

// node_modules/viem/_esm/utils/hash/keccak256.js
function keccak256(value, to_) {
  const to = to_ || "hex";
  const bytes2 = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
  if (to === "bytes")
    return bytes2;
  return toHex(bytes2);
}
var init_keccak256 = __esm({
  "node_modules/viem/_esm/utils/hash/keccak256.js"() {
    init_sha3();
    init_isHex();
    init_toBytes();
    init_toHex();
  }
});

// src/sdk/bundler/providers/index.ts
var providers_exports = {};
__export(providers_exports, {
  EtherspotBundler: () => EtherspotBundler,
  GenericBundler: () => GenericBundler
});
module.exports = __toCommonJS(providers_exports);

// src/sdk/bundler/providers/GenericBundler.ts
var GenericBundler = class {
  constructor(bundlerUrl) {
    this.url = bundlerUrl;
  }
};

// src/sdk/common/ERC4337Utils.ts
var import_buffer = require("buffer");

// node_modules/viem/_esm/utils/chain/defineChain.js
function defineChain(chain) {
  return {
    formatters: void 0,
    fees: void 0,
    serializers: void 0,
    ...chain
  };
}

// node_modules/viem/_esm/index.js
init_keccak256();

// src/sdk/types/bignumber.ts
var import_bn = __toESM(require("bn.js"));

// src/sdk/types/bignumber-logger.ts
var _permanentCensorErrors = false;
var _censorErrors = false;
var LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };
var _logLevel = LogLevels["default"];
var version2 = "logger/5.7.0";
var _globalLogger = null;
function _checkNormalize() {
  try {
    const missing = [];
    ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => {
      try {
        if ("test".normalize(form) !== "test") {
          throw new Error("bad normalize");
        }
        ;
      } catch (error) {
        missing.push(form);
      }
    });
    if (missing.length) {
      throw new Error("missing " + missing.join(", "));
    }
    if (String.fromCharCode(233).normalize("NFD") !== String.fromCharCode(101, 769)) {
      throw new Error("broken implementation");
    }
  } catch (error) {
    return error.message;
  }
  return null;
}
var _normalizeError = _checkNormalize();
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
  LogLevel2["DEBUG"] = "DEBUG";
  LogLevel2["INFO"] = "INFO";
  LogLevel2["WARNING"] = "WARNING";
  LogLevel2["ERROR"] = "ERROR";
  LogLevel2["OFF"] = "OFF";
  return LogLevel2;
})(LogLevel || {});
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
  ErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
  ErrorCode2["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
  ErrorCode2["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
  ErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
  ErrorCode2["SERVER_ERROR"] = "SERVER_ERROR";
  ErrorCode2["TIMEOUT"] = "TIMEOUT";
  ErrorCode2["BUFFER_OVERRUN"] = "BUFFER_OVERRUN";
  ErrorCode2["NUMERIC_FAULT"] = "NUMERIC_FAULT";
  ErrorCode2["MISSING_NEW"] = "MISSING_NEW";
  ErrorCode2["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
  ErrorCode2["MISSING_ARGUMENT"] = "MISSING_ARGUMENT";
  ErrorCode2["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT";
  ErrorCode2["CALL_EXCEPTION"] = "CALL_EXCEPTION";
  ErrorCode2["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
  ErrorCode2["NONCE_EXPIRED"] = "NONCE_EXPIRED";
  ErrorCode2["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED";
  ErrorCode2["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
  ErrorCode2["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED";
  ErrorCode2["ACTION_REJECTED"] = "ACTION_REJECTED";
  return ErrorCode2;
})(ErrorCode || {});
var HEX = "0123456789abcdef";
var _Logger = class _Logger {
  constructor(version4) {
    Object.defineProperty(this, "version", {
      enumerable: true,
      value: version4,
      writable: false
    });
  }
  _log(logLevel, args) {
    const level = logLevel.toLowerCase();
    if (LogLevels[level] == null) {
      this.throwArgumentError("invalid log level name", "logLevel", logLevel);
    }
    if (_logLevel > LogLevels[level]) {
      return;
    }
    console.log.apply(console, args);
  }
  debug(...args) {
    this._log(_Logger.levels.DEBUG, args);
  }
  info(...args) {
    this._log(_Logger.levels.INFO, args);
  }
  warn(...args) {
    this._log(_Logger.levels.WARNING, args);
  }
  makeError(message, code, params) {
    if (_censorErrors) {
      return this.makeError("censored error", code, {});
    }
    if (!code) {
      code = _Logger.errors.UNKNOWN_ERROR;
    }
    if (!params) {
      params = {};
    }
    const messageDetails = [];
    Object.keys(params).forEach((key) => {
      const value = params[key];
      try {
        if (value instanceof Uint8Array) {
          let hex = "";
          for (let i = 0; i < value.length; i++) {
            hex += HEX[value[i] >> 4];
            hex += HEX[value[i] & 15];
          }
          messageDetails.push(key + "=Uint8Array(0x" + hex + ")");
        } else {
          messageDetails.push(key + "=" + JSON.stringify(value));
        }
      } catch (error2) {
        messageDetails.push(key + "=" + JSON.stringify(params[key].toString()));
      }
    });
    messageDetails.push(`code=${code}`);
    messageDetails.push(`version=${this.version}`);
    const reason = message;
    let url = "";
    switch (code) {
      case "NUMERIC_FAULT" /* NUMERIC_FAULT */: {
        url = "NUMERIC_FAULT";
        const fault = message;
        switch (fault) {
          case "overflow":
          case "underflow":
          case "division-by-zero":
            url += "-" + fault;
            break;
          case "negative-power":
          case "negative-width":
            url += "-unsupported";
            break;
          case "unbound-bitwise-result":
            url += "-unbound-result";
            break;
        }
        break;
      }
      case "CALL_EXCEPTION" /* CALL_EXCEPTION */:
      case "INSUFFICIENT_FUNDS" /* INSUFFICIENT_FUNDS */:
      case "MISSING_NEW" /* MISSING_NEW */:
      case "NONCE_EXPIRED" /* NONCE_EXPIRED */:
      case "REPLACEMENT_UNDERPRICED" /* REPLACEMENT_UNDERPRICED */:
      case "TRANSACTION_REPLACED" /* TRANSACTION_REPLACED */:
      case "UNPREDICTABLE_GAS_LIMIT" /* UNPREDICTABLE_GAS_LIMIT */:
        url = code;
        break;
    }
    if (url) {
      message += " [ See: https://links.ethers.org/v5-errors-" + url + " ]";
    }
    if (messageDetails.length) {
      message += " (" + messageDetails.join(", ") + ")";
    }
    const error = new Error(message);
    error.reason = reason;
    error.code = code;
    Object.keys(params).forEach(function(key) {
      error[key] = params[key];
    });
    return error;
  }
  throwError(message, code, params) {
    throw this.makeError(message, code, params);
  }
  throwArgumentError(message, name, value) {
    return this.throwError(message, _Logger.errors.INVALID_ARGUMENT, {
      argument: name,
      value
    });
  }
  assert(condition, message, code, params) {
    if (!!condition) {
      return;
    }
    this.throwError(message, code, params);
  }
  assertArgument(condition, message, name, value) {
    if (!!condition) {
      return;
    }
    this.throwArgumentError(message, name, value);
  }
  checkNormalize(message) {
    if (message == null) {
      message = "platform missing String.prototype.normalize";
    }
    if (_normalizeError) {
      this.throwError("platform missing String.prototype.normalize", _Logger.errors.UNSUPPORTED_OPERATION, {
        operation: "String.prototype.normalize",
        form: _normalizeError
      });
    }
  }
  checkSafeUint53(value, message) {
    if (typeof value !== "number") {
      return;
    }
    if (message == null) {
      message = "value not safe";
    }
    if (value < 0 || value >= 9007199254740991) {
      this.throwError(message, _Logger.errors.NUMERIC_FAULT, {
        operation: "checkSafeInteger",
        fault: "out-of-safe-range",
        value
      });
    }
    if (value % 1) {
      this.throwError(message, _Logger.errors.NUMERIC_FAULT, {
        operation: "checkSafeInteger",
        fault: "non-integer",
        value
      });
    }
  }
  checkArgumentCount(count, expectedCount, message) {
    if (message) {
      message = ": " + message;
    } else {
      message = "";
    }
    if (count < expectedCount) {
      this.throwError("missing argument" + message, _Logger.errors.MISSING_ARGUMENT, {
        count,
        expectedCount
      });
    }
    if (count > expectedCount) {
      this.throwError("too many arguments" + message, _Logger.errors.UNEXPECTED_ARGUMENT, {
        count,
        expectedCount
      });
    }
  }
  checkNew(target, kind) {
    if (target === Object || target == null) {
      this.throwError("missing new", _Logger.errors.MISSING_NEW, { name: kind.name });
    }
  }
  checkAbstract(target, kind) {
    if (target === kind) {
      this.throwError(
        "cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class",
        _Logger.errors.UNSUPPORTED_OPERATION,
        { name: target.name, operation: "new" }
      );
    } else if (target === Object || target == null) {
      this.throwError("missing new", _Logger.errors.MISSING_NEW, { name: kind.name });
    }
  }
  static globalLogger() {
    if (!_globalLogger) {
      _globalLogger = new _Logger(version2);
    }
    return _globalLogger;
  }
  static setCensorship(censorship, permanent) {
    if (!censorship && permanent) {
      this.globalLogger().throwError("cannot permanently disable censorship", _Logger.errors.UNSUPPORTED_OPERATION, {
        operation: "setCensorship"
      });
    }
    if (_permanentCensorErrors) {
      if (!censorship) {
        return;
      }
      this.globalLogger().throwError("error censorship permanent", _Logger.errors.UNSUPPORTED_OPERATION, {
        operation: "setCensorship"
      });
    }
    _censorErrors = !!censorship;
    _permanentCensorErrors = !!permanent;
  }
  static setLogLevel(logLevel) {
    const level = LogLevels[logLevel.toLowerCase()];
    if (level == null) {
      _Logger.globalLogger().warn("invalid log level - " + logLevel);
      return;
    }
    _logLevel = level;
  }
  static from(version4) {
    return new _Logger(version4);
  }
};
_Logger.errors = ErrorCode;
_Logger.levels = LogLevel;
var Logger = _Logger;

// src/sdk/types/bignumber.ts
var version3 = "logger/5.7.0";
var logger = new Logger(version3);

// src/sdk/common/ERC4337Utils.ts
var ErrorSig = keccak256(import_buffer.Buffer.from("Error(string)")).slice(0, 10);
var FailedOpSig = keccak256(import_buffer.Buffer.from("FailedOp(uint256,string)")).slice(0, 10);

// node_modules/viem/_esm/chains/definitions/arbitrum.js
var arbitrum = /* @__PURE__ */ defineChain({
  id: 42161,
  name: "Arbitrum One",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://arb1.arbitrum.io/rpc"]
    }
  },
  blockExplorers: {
    default: {
      name: "Arbiscan",
      url: "https://arbiscan.io",
      apiUrl: "https://api.arbiscan.io/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 7654707
    }
  }
});

// node_modules/viem/_esm/chains/definitions/arbitrumSepolia.js
var arbitrumSepolia = /* @__PURE__ */ defineChain({
  id: 421614,
  name: "Arbitrum Sepolia",
  nativeCurrency: {
    name: "Arbitrum Sepolia Ether",
    symbol: "ETH",
    decimals: 18
  },
  rpcUrls: {
    default: {
      http: ["https://sepolia-rollup.arbitrum.io/rpc"]
    }
  },
  blockExplorers: {
    default: {
      name: "Arbiscan",
      url: "https://sepolia.arbiscan.io",
      apiUrl: "https://api-sepolia.arbiscan.io/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 81930
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/avalanche.js
var avalanche = /* @__PURE__ */ defineChain({
  id: 43114,
  name: "Avalanche",
  nativeCurrency: {
    decimals: 18,
    name: "Avalanche",
    symbol: "AVAX"
  },
  rpcUrls: {
    default: { http: ["https://api.avax.network/ext/bc/C/rpc"] }
  },
  blockExplorers: {
    default: {
      name: "SnowTrace",
      url: "https://snowtrace.io",
      apiUrl: "https://api.snowtrace.io"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 11907934
    }
  }
});

// node_modules/viem/_esm/chains/definitions/avalancheFuji.js
var avalancheFuji = /* @__PURE__ */ defineChain({
  id: 43113,
  name: "Avalanche Fuji",
  nativeCurrency: {
    decimals: 18,
    name: "Avalanche Fuji",
    symbol: "AVAX"
  },
  rpcUrls: {
    default: { http: ["https://api.avax-test.network/ext/bc/C/rpc"] }
  },
  blockExplorers: {
    default: {
      name: "SnowTrace",
      url: "https://testnet.snowtrace.io",
      apiUrl: "https://api-testnet.snowtrace.io"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 7096959
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/bsc.js
var bsc = /* @__PURE__ */ defineChain({
  id: 56,
  name: "BNB Smart Chain",
  nativeCurrency: {
    decimals: 18,
    name: "BNB",
    symbol: "BNB"
  },
  rpcUrls: {
    default: { http: ["https://rpc.ankr.com/bsc"] }
  },
  blockExplorers: {
    default: {
      name: "BscScan",
      url: "https://bscscan.com",
      apiUrl: "https://api.bscscan.com/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 15921452
    }
  }
});

// node_modules/viem/_esm/chains/definitions/bscTestnet.js
var bscTestnet = /* @__PURE__ */ defineChain({
  id: 97,
  name: "Binance Smart Chain Testnet",
  nativeCurrency: {
    decimals: 18,
    name: "BNB",
    symbol: "tBNB"
  },
  rpcUrls: {
    default: { http: ["https://data-seed-prebsc-1-s1.bnbchain.org:8545"] }
  },
  blockExplorers: {
    default: {
      name: "BscScan",
      url: "https://testnet.bscscan.com",
      apiUrl: "https://testnet.bscscan.com/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 17422483
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/flare.js
var flare = /* @__PURE__ */ defineChain({
  id: 14,
  name: "Flare Mainnet",
  nativeCurrency: {
    decimals: 18,
    name: "flare",
    symbol: "FLR"
  },
  rpcUrls: {
    default: { http: ["https://flare-api.flare.network/ext/C/rpc"] }
  },
  blockExplorers: {
    default: {
      name: "Flare Explorer",
      url: "https://flare-explorer.flare.network",
      apiUrl: "https://flare-explorer.flare.network/api"
    }
  }
});

// node_modules/viem/_esm/chains/definitions/flareTestnet.js
var flareTestnet = /* @__PURE__ */ defineChain({
  id: 114,
  name: "Coston2",
  nativeCurrency: {
    decimals: 18,
    name: "coston2flare",
    symbol: "C2FLR"
  },
  rpcUrls: {
    default: { http: ["https://coston2-api.flare.network/ext/C/rpc"] }
  },
  blockExplorers: {
    default: {
      name: "Coston2 Explorer",
      url: "https://coston2-explorer.flare.network",
      apiUrl: "https://coston2-explorer.flare.network/api"
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/fuse.js
var fuse = /* @__PURE__ */ defineChain({
  id: 122,
  name: "Fuse",
  nativeCurrency: { name: "Fuse", symbol: "FUSE", decimals: 18 },
  rpcUrls: {
    default: { http: ["https://rpc.fuse.io"] }
  },
  blockExplorers: {
    default: {
      name: "Fuse Explorer",
      url: "https://explorer.fuse.io",
      apiUrl: "https://explorer.fuse.io/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 16146628
    }
  }
});

// node_modules/viem/_esm/chains/definitions/gnosis.js
var gnosis = /* @__PURE__ */ defineChain({
  id: 100,
  name: "Gnosis",
  nativeCurrency: {
    decimals: 18,
    name: "Gnosis",
    symbol: "xDAI"
  },
  rpcUrls: {
    default: {
      http: ["https://rpc.gnosischain.com"],
      webSocket: ["wss://rpc.gnosischain.com/wss"]
    }
  },
  blockExplorers: {
    default: {
      name: "Gnosisscan",
      url: "https://gnosisscan.io",
      apiUrl: "https://api.gnosisscan.io/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 21022491
    }
  }
});

// node_modules/viem/_esm/chains/definitions/linea.js
var linea = /* @__PURE__ */ defineChain({
  id: 59144,
  name: "Linea Mainnet",
  nativeCurrency: { name: "Linea Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://rpc.linea.build"],
      webSocket: ["wss://rpc.linea.build"]
    }
  },
  blockExplorers: {
    default: {
      name: "Etherscan",
      url: "https://lineascan.build",
      apiUrl: "https://api.lineascan.build/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xcA11bde05977b3631167028862bE2a173976CA11",
      blockCreated: 42
    }
  },
  testnet: false
});

// node_modules/viem/_esm/chains/definitions/lineaGoerli.js
var lineaGoerli = /* @__PURE__ */ defineChain({
  id: 59140,
  name: "Linea Goerli Testnet",
  nativeCurrency: { name: "Linea Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://rpc.goerli.linea.build"],
      webSocket: ["wss://rpc.goerli.linea.build"]
    }
  },
  blockExplorers: {
    default: {
      name: "Etherscan",
      url: "https://goerli.lineascan.build",
      apiUrl: "https://api-goerli.lineascan.build/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 498623
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/mainnet.js
var mainnet = /* @__PURE__ */ defineChain({
  id: 1,
  name: "Ethereum",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://cloudflare-eth.com"]
    }
  },
  blockExplorers: {
    default: {
      name: "Etherscan",
      url: "https://etherscan.io",
      apiUrl: "https://api.etherscan.io/api"
    }
  },
  contracts: {
    ensRegistry: {
      address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
    },
    ensUniversalResolver: {
      address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
      blockCreated: 19258213
    },
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 14353601
    }
  }
});

// node_modules/viem/_esm/chains/definitions/mantle.js
var mantle = /* @__PURE__ */ defineChain({
  id: 5e3,
  name: "Mantle",
  nativeCurrency: {
    decimals: 18,
    name: "MNT",
    symbol: "MNT"
  },
  rpcUrls: {
    default: { http: ["https://rpc.mantle.xyz"] }
  },
  blockExplorers: {
    default: {
      name: "Mantle Explorer",
      url: "https://mantlescan.xyz/",
      apiUrl: "https://api.mantlescan.xyz/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xcA11bde05977b3631167028862bE2a173976CA11",
      blockCreated: 304717
    }
  }
});

// node_modules/viem/_esm/chains/definitions/mantleSepoliaTestnet.js
var mantleSepoliaTestnet = /* @__PURE__ */ defineChain({
  id: 5003,
  name: "Mantle Sepolia Testnet",
  nativeCurrency: {
    decimals: 18,
    name: "MNT",
    symbol: "MNT"
  },
  rpcUrls: {
    default: { http: ["https://rpc.sepolia.mantle.xyz"] }
  },
  blockExplorers: {
    default: {
      name: "Mantle Testnet Explorer",
      url: "https://explorer.sepolia.mantle.xyz/",
      apiUrl: "https://explorer.sepolia.mantle.xyz/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xcA11bde05977b3631167028862bE2a173976CA11",
      blockCreated: 4584012
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/polygon.js
var polygon = /* @__PURE__ */ defineChain({
  id: 137,
  name: "Polygon",
  nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://polygon-rpc.com"]
    }
  },
  blockExplorers: {
    default: {
      name: "PolygonScan",
      url: "https://polygonscan.com",
      apiUrl: "https://api.polygonscan.com/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 25770160
    }
  }
});

// node_modules/viem/_esm/chains/definitions/polygonAmoy.js
var polygonAmoy = /* @__PURE__ */ defineChain({
  id: 80002,
  name: "Polygon Amoy",
  nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://rpc-amoy.polygon.technology"]
    }
  },
  blockExplorers: {
    default: {
      name: "PolygonScan",
      url: "https://amoy.polygonscan.com",
      apiUrl: "https://api-amoy.polygonscan.com/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 3127388
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/rootstock.js
var rootstock = /* @__PURE__ */ defineChain({
  id: 30,
  name: "Rootstock Mainnet",
  network: "rootstock",
  nativeCurrency: {
    decimals: 18,
    name: "Rootstock Bitcoin",
    symbol: "RBTC"
  },
  rpcUrls: {
    default: { http: ["https://public-node.rsk.co"] }
  },
  blockExplorers: {
    default: {
      name: "RSK Explorer",
      url: "https://explorer.rsk.co"
    }
  },
  contracts: {
    multicall3: {
      address: "0xcA11bde05977b3631167028862bE2a173976CA11",
      blockCreated: 4249540
    }
  }
});

// node_modules/viem/_esm/chains/definitions/rootstockTestnet.js
var rootstockTestnet = /* @__PURE__ */ defineChain({
  id: 31,
  name: "Rootstock Testnet",
  network: "rootstock",
  nativeCurrency: {
    decimals: 18,
    name: "Rootstock Bitcoin",
    symbol: "tRBTC"
  },
  rpcUrls: {
    default: { http: ["https://public-node.testnet.rsk.co"] }
  },
  blockExplorers: {
    default: {
      name: "RSK Explorer",
      url: "https://explorer.testnet.rootstock.io"
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/scroll.js
var scroll = /* @__PURE__ */ defineChain({
  id: 534352,
  name: "Scroll",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://rpc.scroll.io"],
      webSocket: ["wss://wss-rpc.scroll.io/ws"]
    }
  },
  blockExplorers: {
    default: {
      name: "Scrollscan",
      url: "https://scrollscan.com",
      apiUrl: "https://api.scrollscan.com/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 14
    }
  },
  testnet: false
});

// node_modules/viem/_esm/chains/definitions/scrollSepolia.js
var scrollSepolia = /* @__PURE__ */ defineChain({
  id: 534351,
  name: "Scroll Sepolia",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://sepolia-rpc.scroll.io"]
    }
  },
  blockExplorers: {
    default: {
      name: "Scrollscan",
      url: "https://sepolia.scrollscan.com",
      apiUrl: "https://api-sepolia.scrollscan.com/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 9473
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/sepolia.js
var sepolia = /* @__PURE__ */ defineChain({
  id: 11155111,
  name: "Sepolia",
  nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://rpc.sepolia.org"]
    }
  },
  blockExplorers: {
    default: {
      name: "Etherscan",
      url: "https://sepolia.etherscan.io",
      apiUrl: "https://api-sepolia.etherscan.io/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 751532
    },
    ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
    ensUniversalResolver: {
      address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
      blockCreated: 5317080
    }
  },
  testnet: true
});

// node_modules/viem/_esm/chains/definitions/xdc.js
var xdc = /* @__PURE__ */ defineChain({
  id: 50,
  name: "XinFin Network",
  nativeCurrency: {
    decimals: 18,
    name: "XDC",
    symbol: "XDC"
  },
  rpcUrls: {
    default: { http: ["https://rpc.xinfin.network"] }
  },
  blockExplorers: {
    xinfin: {
      name: "XinFin",
      url: "https://explorer.xinfin.network"
    },
    default: {
      name: "Blocksscan",
      url: "https://xdc.blocksscan.io"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 71542788
    }
  }
});

// node_modules/viem/_esm/chains/definitions/xdcTestnet.js
var xdcTestnet = /* @__PURE__ */ defineChain({
  id: 51,
  name: "Apothem Network",
  nativeCurrency: {
    decimals: 18,
    name: "TXDC",
    symbol: "TXDC"
  },
  rpcUrls: {
    default: { http: ["https://erpc.apothem.network"] }
  },
  blockExplorers: {
    default: {
      name: "Blocksscan",
      url: "https://apothem.blocksscan.io"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 59765389
    }
  }
});

// src/sdk/network/ViemChainConfig.ts
var sourceId = 1;
var optimism = /* @__PURE__ */ defineChain({
  id: 10,
  name: "OP Mainnet",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://mainnet.optimism.io"]
    }
  },
  blockExplorers: {
    default: {
      name: "Optimism Explorer",
      url: "https://optimistic.etherscan.io",
      apiUrl: "https://api-optimistic.etherscan.io/api"
    }
  },
  contracts: {
    disputeGameFactory: {
      [sourceId]: {
        address: "0xe5965Ab5962eDc7477C8520243A95517CD252fA9"
      }
    },
    l2OutputOracle: {
      [sourceId]: {
        address: "0xdfe97868233d1aa22e815a266982f2cf17685a27"
      }
    },
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 4286263
    },
    portal: {
      [sourceId]: {
        address: "0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"
      }
    },
    l1StandardBridge: {
      [sourceId]: {
        address: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"
      }
    }
  },
  sourceId
});
var base = /* @__PURE__ */ defineChain({
  id: 8453,
  name: "Base",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://mainnet.base.org"]
    }
  },
  blockExplorers: {
    default: {
      name: "Basescan",
      url: "https://basescan.org",
      apiUrl: "https://api.basescan.org/api"
    }
  },
  contracts: {
    l2OutputOracle: {
      [sourceId]: {
        address: "0x56315b90c40730925ec5485cf004d835058518A0"
      }
    },
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 5022
    },
    portal: {
      [sourceId]: {
        address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
        blockCreated: 17482143
      }
    },
    l1StandardBridge: {
      [sourceId]: {
        address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
        blockCreated: 17482143
      }
    }
  },
  sourceId
});
var ancient8 = /* @__PURE__ */ defineChain({
  id: 888888888,
  name: "Ancient8",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://rpc.ancient8.gg"]
    }
  },
  blockExplorers: {
    default: {
      name: "Ancient8 explorer",
      url: "https://scan.ancient8.gg",
      apiUrl: "https://scan.ancient8.gg/api"
    }
  },
  contracts: {
    l2OutputOracle: {
      [sourceId]: {
        address: "0xB09DC08428C8b4EFB4ff9C0827386CDF34277996"
      }
    },
    portal: {
      [sourceId]: {
        address: "0x639F2AECE398Aa76b07e59eF6abe2cFe32bacb68",
        blockCreated: 19070571
      }
    },
    l1StandardBridge: {
      [sourceId]: {
        address: "0xd5e3eDf5b68135D559D572E26bF863FBC1950033",
        blockCreated: 19070571
      }
    }
  },
  sourceId
});
sourceId = 11155111;
var optimismSepolia = /* @__PURE__ */ defineChain({
  id: 11155420,
  name: "OP Sepolia",
  nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://sepolia.optimism.io"]
    }
  },
  blockExplorers: {
    default: {
      name: "Blockscout",
      url: "https://optimism-sepolia.blockscout.com",
      apiUrl: "https://optimism-sepolia.blockscout.com/api"
    }
  },
  contracts: {
    disputeGameFactory: {
      [sourceId]: {
        address: "0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"
      }
    },
    l2OutputOracle: {
      [sourceId]: {
        address: "0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F"
      }
    },
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 1620204
    },
    portal: {
      [sourceId]: {
        address: "0x16Fc5058F25648194471939df75CF27A2fdC48BC"
      }
    },
    l1StandardBridge: {
      [sourceId]: {
        address: "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1"
      }
    }
  },
  testnet: true,
  sourceId
});
var ancient8Sepolia = /* @__PURE__ */ defineChain({
  id: 28122024,
  name: "Ancient8 Testnet",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://rpcv2-testnet.ancient8.gg"]
    }
  },
  blockExplorers: {
    default: {
      name: "Ancient8 Celestia Testnet explorer",
      url: "https://scanv2-testnet.ancient8.gg",
      apiUrl: "https://scanv2-testnet.ancient8.gg/api"
    }
  },
  contracts: {
    l2OutputOracle: {
      [sourceId]: {
        address: "0x942fD5017c0F60575930D8574Eaca13BEcD6e1bB"
      }
    },
    portal: {
      [sourceId]: {
        address: "0xfa1d9E26A6aCD7b22115D27572c1221B9803c960",
        blockCreated: 4972908
      }
    },
    l1StandardBridge: {
      [sourceId]: {
        address: "0xF6Bc0146d3c74D48306e79Ae134A260E418C9335",
        blockCreated: 4972908
      }
    }
  },
  sourceId
});

// src/sdk/network/constants.ts
var NETWORK_NAME_TO_CHAIN_ID = {
  ["baseSepolia" /* BaseSepolia */]: 84532,
  ["sepolia" /* Sepolia */]: 11155111,
  ["optimism" /* Optimism */]: 10,
  ["polygon" /* Polygon */]: 137,
  ["arbitrum" /* Arbitrum */]: 42161,
  ["arbitrumSepolia" /* ArbitrumSepolia */]: 421614,
  ["chiado" /* Chiado */]: 10200,
  ["fuse" /* Fuse */]: 122,
  ["fuseSparknet" /* FuseSparknet */]: 123,
  ["gnosis" /* Gnosis */]: 100,
  ["kromaTestnet" /* KromaTestnet */]: 2357,
  ["mainnet" /* Mainnet */]: 1,
  ["optimismSepolia" /* OptimismSepolia */]: 11155420,
  ["rootstock" /* Rootstock */]: 30,
  ["rootstockTestnet" /* RootstockTestnet */]: 31,
  ["Mantle" /* Mantle */]: 5e3,
  ["MantleSepolia" /* MantleSepolia */]: 5003,
  ["avalanche" /* Avalanche */]: 43114,
  ["base" /* Base */]: 8453,
  ["bsc" /* Bsc */]: 56,
  ["bscTestnet" /* BscTestnet */]: 97,
  ["fuji" /* Fuji */]: 43113,
  ["linea" /* Linea */]: 59144,
  ["lineaTestnet" /* LineaTestnet */]: 59140,
  ["flareTestnet" /* FlareTestnet */]: 114,
  ["flare" /* Flare */]: 14,
  ["scrollSepolia" /* ScrollSepolia */]: 534351,
  ["scroll" /* Scroll */]: 534352,
  ["ancient8Testnet" /* Ancient8Testnet */]: 28122024,
  ["ancient8" /* Ancient8 */]: 888888888,
  ["amoy" /* Amoy */]: 80002,
  ["xdcTestnet" /* XDCTestnet */]: 51,
  ["xdcMainnet" /* XDCMainnet */]: 50
};
var Networks = {
  [84532]: {
    chainId: 84532,
    // TODO fix to identify this chainId
    chain: null,
    bundler: "https://testnet-rpc.etherspot.io/v2/84532",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [11155111]: {
    chainId: 11155111,
    chain: sepolia,
    bundler: "https://testnet-rpc.etherspot.io/v2/11155111",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: "0x5C661169084EA82254c8200a6134507Ef88f6b23"
    }
  },
  [10]: {
    chainId: 10,
    // compilation issue for optimism mainnet, using custom config
    chain: optimism,
    bundler: "https://rpc.etherspot.io/v2/10",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [137]: {
    chainId: 137,
    chain: polygon,
    bundler: "https://rpc.etherspot.io/v2/137",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [42161]: {
    chainId: 42161,
    chain: arbitrum,
    bundler: "https://rpc.etherspot.io/v2/42161",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [1]: {
    chainId: 1,
    chain: mainnet,
    bundler: "https://rpc.etherspot.io/v2/1",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [10200]: {
    chainId: 10200,
    chain: null,
    bundler: "",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [122]: {
    chainId: 122,
    chain: fuse,
    bundler: "https://rpc.etherspot.io/v2/122",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [123]: {
    chainId: 123,
    // TODO no-support for ultron mainnet
    chain: null,
    bundler: "https://testnet-rpc.etherspot.io/v2/123",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [100]: {
    chainId: 100,
    chain: gnosis,
    bundler: "https://rpc.etherspot.io/v2/100",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [2357]: {
    chainId: 2357,
    chain: null,
    bundler: "",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [30]: {
    chainId: 30,
    chain: rootstock,
    bundler: "https://rpc.etherspot.io/v2/30",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [31]: {
    chainId: 31,
    chain: rootstockTestnet,
    bundler: "https://testnet-rpc.etherspot.io/v2/31",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [5e3]: {
    chainId: 5e3,
    chain: mantle,
    bundler: "https://rpc.etherspot.io/v2/5000",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [5003]: {
    chainId: 5003,
    chain: mantleSepoliaTestnet,
    bundler: "https://testnet-rpc.etherspot.io/v2/5003",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [43114]: {
    chainId: 43114,
    chain: avalanche,
    bundler: "https://rpc.etherspot.io/v2/43114",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [8453]: {
    chainId: 8453,
    chain: base,
    bundler: "https://rpc.etherspot.io/v2/8453",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [56]: {
    chainId: 56,
    chain: bsc,
    bundler: "https://rpc.etherspot.io/v2/56",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [97]: {
    chainId: 97,
    chain: bscTestnet,
    bundler: "https://testnet-rpc.etherspot.io/v2/97",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [43113]: {
    chainId: 43113,
    chain: avalancheFuji,
    bundler: "",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [59144]: {
    chainId: 59144,
    chain: linea,
    bundler: "https://rpc.etherspot.io/v2/59144",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [59140]: {
    chainId: 59140,
    chain: lineaGoerli,
    bundler: "",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [114]: {
    chainId: 114,
    chain: flareTestnet,
    bundler: "https://testnet-rpc.etherspot.io/v2/114",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [14]: {
    chainId: 14,
    chain: flare,
    bundler: "https://rpc.etherspot.io/v2/14",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [534351]: {
    chainId: 534351,
    chain: scrollSepolia,
    bundler: "https://testnet-rpc.etherspot.io/v2/534351",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [534352]: {
    chainId: 534352,
    chain: scroll,
    bundler: "https://rpc.etherspot.io/v2/534352",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [11155420]: {
    chainId: 11155420,
    // TODO check compilation issue
    chain: optimismSepolia,
    bundler: "https://testnet-rpc.etherspot.io/v2/11155420",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [28122024]: {
    chainId: 28122024,
    chain: ancient8Sepolia,
    bundler: "https://testnet-rpc.etherspot.io/v2/28122024",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [888888888]: {
    chainId: 888888888,
    chain: ancient8,
    bundler: "https://rpc.etherspot.io/v2/888888888",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [80002]: {
    chainId: 80002,
    chain: polygonAmoy,
    bundler: "https://testnet-rpc.etherspot.io/v2/80002",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0x93FB56A4a0B7160fbf8903d251Cc7A3fb9bA0933",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: "0x22A55192a663591586241D42E603221eac49ed09"
    }
  },
  [421614]: {
    chainId: 421614,
    chain: arbitrumSepolia,
    bundler: "https://testnet-rpc.etherspot.io/v2/421614",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: ""
    }
  },
  [51]: {
    chainId: 51,
    chain: xdcTestnet,
    bundler: "https://testnet-rpc.etherspot.io/v2/51",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0x5952653F151e844346825050d7157A9a6b46A23A",
      bootstrap: "0x805650ce74561C85baA44a8Bd13E19633Fd0F79d",
      multipleOwnerECDSAValidator: "0x68BA597bf6B9097b1D89b8E0D34646D30997f773",
      erc20SessionKeyValidator: ""
    }
  },
  [50]: {
    chainId: 50,
    chain: xdc,
    bundler: "https://rpc.etherspot.io/v2/50",
    contracts: {
      entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
      walletFactory: "0xf80D543Ca10B48AF07c65Ff508605c1737EFAF3F",
      bootstrap: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
      multipleOwnerECDSAValidator: "0x8c4496Ba340aFe5ac4148cfEA9ccbBCD54093143",
      erc20SessionKeyValidator: "0xb61723Bc251A2b556d48C420779Da805e2D4b7D6"
    }
  }
};
var CHAIN_ID_TO_NETWORK_NAME = Object.entries(
  NETWORK_NAME_TO_CHAIN_ID
).reduce(
  (result, [networkName, chainId]) => ({
    ...result,
    [chainId]: networkName
  }),
  {}
);
function getNetworkConfig(key) {
  return Networks[key];
}

// src/sdk/common/exceptions/exception.ts
var Exception = class extends Error {
  //
};

// src/sdk/bundler/providers/EtherspotBundler.ts
var EtherspotBundler = class {
  constructor(chainId, apiKey, bundlerUrl) {
    if (!bundlerUrl) {
      const networkConfig = getNetworkConfig(chainId);
      if (!networkConfig || networkConfig.bundler == "") throw new Exception("No bundler url provided");
      bundlerUrl = networkConfig.bundler;
    }
    if (apiKey) {
      if (bundlerUrl.includes("?api-key=")) this.url = bundlerUrl + apiKey;
      else this.url = bundlerUrl + "?api-key=" + apiKey;
    } else this.url = bundlerUrl;
    this.apiKey = apiKey;
  }
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  EtherspotBundler,
  GenericBundler
});
/*! Bundled license information:

@noble/hashes/esm/utils.js:
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
*/
//# sourceMappingURL=index.js.map