import { C as f } from "./platform-Cil_UtAQ.mjs";
import { L as B, P as l } from "./unsignedTransaction-DCDxTFq8.mjs";
const a = (r) => {
  const c = r.decode.bind(r), s = r.encode.bind(r);
  return { decode: c, encode: s };
};
var d = {}, b;
function E() {
  if (b) return d;
  b = 1, Object.defineProperty(d, "__esModule", { value: !0 });
  function r(o) {
    {
      const e = f.from(o);
      e.reverse();
      const t = e.toString("hex");
      return t.length === 0 ? BigInt(0) : BigInt(`0x${t}`);
    }
  }
  d.toBigIntLE = r;
  function c(o) {
    {
      const e = o.toString("hex");
      return e.length === 0 ? BigInt(0) : BigInt(`0x${e}`);
    }
  }
  d.toBigIntBE = c;
  function s(o, e) {
    {
      const t = o.toString(16), n = f.from(t.padStart(e * 2, "0").slice(0, e * 2), "hex");
      return n.reverse(), n;
    }
  }
  d.toBufferLE = s;
  function u(o, e) {
    {
      const t = o.toString(16);
      return f.from(t.padStart(e * 2, "0").slice(0, e * 2), "hex");
    }
  }
  return d.toBufferBE = u, d;
}
var g = E();
const p = (r) => (c) => {
  const s = B.blob(r, c), { encode: u, decode: o } = a(s), e = s;
  return e.decode = (t, n) => {
    const i = o(t, n);
    return g.toBigIntLE(f.from(i));
  }, e.encode = (t, n, i) => {
    const x = g.toBufferLE(t, r);
    return u(x, n, i);
  }, e;
}, m = p(8), h = (r) => {
  const c = B.u8(r), { encode: s, decode: u } = a(c), o = c;
  return o.decode = (e, t) => !!u(e, t), o.encode = (e, t, n) => {
    const i = Number(e);
    return s(i, t, n);
  }, o;
}, y = (r) => {
  const c = B.blob(32, r), { encode: s, decode: u } = a(c), o = c;
  return o.decode = (e, t) => {
    const n = u(e, t);
    return new l(n);
  }, o.encode = (e, t, n) => {
    const i = e.toBuffer();
    return s(i, t, n);
  }, o;
};
export {
  h as b,
  y as p,
  m as u
};
