UNPKG

@leapwallet/buffer-boba

Version:

Buffer Boba is a library for decoding protocol buffers in the cosmos ecosystem.

1,648 lines 2.19 MB
var cw = Object.defineProperty; var mw = (e, t, n) => t in e ? cw(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var Ee = (e, t, n) => (mw(e, typeof t != "symbol" ? t + "" : t, n), n); import { encodePubkey as $T, decodePubkey as OT } from "@cosmjs/proto-signing"; function fw(e) { let t = 0, n = 0; for (let o = 0; o < e.length; ++o) n = e.charCodeAt(o), n < 128 ? t += 1 : n < 2048 ? t += 2 : (n & 64512) === 55296 && (e.charCodeAt(o + 1) & 64512) === 56320 ? (++o, t += 4) : t += 3; return t; } function gw(e, t, n) { if (n - t < 1) return ""; const r = []; let i = [], P = 0, $; for (; t < n; ) $ = e[t++], $ < 128 ? r[P++] = $ : $ > 191 && $ < 224 ? r[P++] = ($ & 31) << 6 | e[t++] & 63 : $ > 239 && $ < 365 ? ($ = (($ & 7) << 18 | (e[t++] & 63) << 12 | (e[t++] & 63) << 6 | e[t++] & 63) - 65536, r[P++] = 55296 + ($ >> 10), r[P++] = 56320 + ($ & 1023)) : r[P++] = ($ & 15) << 12 | (e[t++] & 63) << 6 | e[t++] & 63, P > 8191 && ((i || (i = [])).push(String.fromCharCode(...r)), P = 0); return i ? (P && i.push(String.fromCharCode(...r.slice(0, P))), i.join("")) : String.fromCharCode(...r.slice(0, P)); } function yw(e, t, n) { const o = n; let r, i; for (let P = 0; P < e.length; ++P) r = e.charCodeAt(P), r < 128 ? t[n++] = r : r < 2048 ? (t[n++] = r >> 6 | 192, t[n++] = r & 63 | 128) : (r & 64512) === 55296 && ((i = e.charCodeAt(P + 1)) & 64512) === 56320 ? (r = 65536 + ((r & 1023) << 10) + (i & 1023), ++P, t[n++] = r >> 18 | 240, t[n++] = r >> 12 & 63 | 128, t[n++] = r >> 6 & 63 | 128, t[n++] = r & 63 | 128) : (t[n++] = r >> 12 | 224, t[n++] = r >> 6 & 63 | 128, t[n++] = r & 63 | 128); return n - o; } function Pg() { let e = 0, t = 0; for (let o = 0; o < 28; o += 7) { let r = this.buf[this.pos++]; if (e |= (r & 127) << o, !(r & 128)) return this.assertBounds(), [e, t]; } let n = this.buf[this.pos++]; if (e |= (n & 15) << 28, t = (n & 112) >> 4, !(n & 128)) return this.assertBounds(), [e, t]; for (let o = 3; o <= 31; o += 7) { let r = this.buf[this.pos++]; if (t |= (r & 127) << o, !(r & 128)) return this.assertBounds(), [e, t]; } throw new Error("invalid varint"); } const wg = 4294967296; function Ig(e) { const t = e[0] === "-"; t && (e = e.slice(1)); const n = 1e6; let o = 0, r = 0; function i(P, $) { const q = Number(e.slice(P, $)); r *= n, o = o * n + q, o >= wg && (r = r + (o / wg | 0), o = o % wg); } return i(-24, -18), i(-18, -12), i(-12, -6), i(-6), t ? ET(o, r) : KS(o, r); } function _y(e, t) { let n = KS(e, t); const o = n.hi & 2147483648; o && (n = ET(n.lo, n.hi)); const r = CS(n.lo, n.hi); return o ? "-" + r : r; } function CS(e, t) { if ({ lo: e, hi: t } = vw(e, t), t <= 2097151) return String(wg * t + e); const n = e & 16777215, o = (e >>> 24 | t << 8) & 16777215, r = t >> 16 & 65535; let i = n + o * 6777216 + r * 6710656, P = o + r * 8147497, $ = r * 2; const q = 1e7; return i >= q && (P += Math.floor(i / q), i %= q), P >= q && ($ += Math.floor(P / q), P %= q), $.toString() + _T(P) + _T(i); } function vw(e, t) { return { lo: e >>> 0, hi: t >>> 0 }; } function KS(e, t) { return { lo: e | 0, hi: t | 0 }; } function ET(e, t) { return t = ~t, e ? e = ~e + 1 : t += 1, KS(e, t); } const _T = (e) => { const t = String(e); return "0000000".slice(t.length) + t; }; function hw() { let e = this.buf[this.pos++], t = e & 127; if (!(e & 128)) return this.assertBounds(), t; if (e = this.buf[this.pos++], t |= (e & 127) << 7, !(e & 128)) return this.assertBounds(), t; if (e = this.buf[this.pos++], t |= (e & 127) << 14, !(e & 128)) return this.assertBounds(), t; if (e = this.buf[this.pos++], t |= (e & 127) << 21, !(e & 128)) return this.assertBounds(), t; e = this.buf[this.pos++], t |= (e & 15) << 28; for (let n = 5; e & 128 && n < 10; n++) e = this.buf[this.pos++]; if (e & 128) throw new Error("invalid varint"); return this.assertBounds(), t >>> 0; } function Aw(e, t) { let n = t >> 31; return t = ((t << 1 | e >>> 31) ^ n) >>> 0, e = (e << 1 ^ n) >>> 0, [e, t]; } function kw(e, t) { let n = -(e & 1); return e = ((e >>> 1 | t << 31) ^ n) >>> 0, t = (t >>> 1 ^ n) >>> 0, [e, t]; } function _w(e, t) { return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + e[t + 3] * 16777216; } function Uw(e, t) { return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + (e[t + 3] << 24); } function Mw(e, t, n) { for (; e > 127; ) t[n++] = e & 127 | 128, e >>>= 7; t[n] = e; } function Uy(e, t, n) { for (; e.hi; ) t[n++] = e.lo & 127 | 128, e.lo = (e.lo >>> 7 | e.hi << 25) >>> 0, e.hi >>>= 7; for (; e.lo > 127; ) t[n++] = e.lo & 127 | 128, e.lo = e.lo >>> 7; t[n++] = e.lo; } function UT(e, t) { let n = e, o = (e >>> 28 | t << 4) >>> 0, r = t >>> 24; return r === 0 ? o === 0 ? n < 16384 ? n < 128 ? 1 : 2 : n < 2097152 ? 3 : 4 : o < 16384 ? o < 128 ? 5 : 6 : o < 2097152 ? 7 : 8 : r < 128 ? 9 : 10; } function My(e, t, n) { t[n] = e & 255, t[n + 1] = e >>> 8 & 255, t[n + 2] = e >>> 16 & 255, t[n + 3] = e >>> 24; } function Py(e, t, n) { t[n] = e & 255; } let s = class { constructor(t) { Ee(this, "buf"); Ee(this, "pos"); Ee(this, "type"); Ee(this, "len"); this.buf = t ? new Uint8Array(t) : new Uint8Array(0), this.pos = 0, this.type = 0, this.len = this.buf.length; } assertBounds() { if (this.pos > this.len) throw new RangeError("premature EOF"); } tag() { const t = this.uint32(), n = t >>> 3, o = t & 7; if (n <= 0 || o < 0 || o > 5) throw new Error( "illegal tag: field no " + n + " wire type " + o ); return [n, o, t]; } skip(t) { if (typeof t == "number") { if (this.pos + t > this.len) throw MT(this, t); this.pos += t; } else do if (this.pos >= this.len) throw MT(this); while (this.buf[this.pos++] & 128); return this; } skipType(t) { switch (t) { case 0: this.skip(); break; case 1: this.skip(8); break; case 2: this.skip(this.uint32()); break; case 3: for (; (t = this.uint32() & 7) !== 4; ) this.skipType(t); break; case 5: this.skip(4); break; default: throw Error("invalid wire type " + t + " at offset " + this.pos); } return this; } uint32() { return hw.bind(this)(); } int32() { return this.uint32() | 0; } sint32() { const t = this.uint32(); return t % 2 === 1 ? (t + 1) / -2 : t / 2; } fixed32() { const t = _w(this.buf, this.pos); return this.pos += 4, t; } sfixed32() { const t = Uw(this.buf, this.pos); return this.pos += 4, t; } int64() { const [t, n] = Pg.bind(this)(); return BigInt(_y(t, n)); } uint64() { const [t, n] = Pg.bind(this)(); return BigInt(CS(t, n)); } sint64() { let [t, n] = Pg.bind(this)(); return [t, n] = kw(t, n), BigInt(_y(t, n)); } fixed64() { const t = this.sfixed32(), n = this.sfixed32(); return BigInt(CS(t, n)); } sfixed64() { const t = this.sfixed32(), n = this.sfixed32(); return BigInt(_y(t, n)); } float() { throw new Error("float not supported"); } double() { throw new Error("double not supported"); } bool() { const [t, n] = Pg.bind(this)(); return t !== 0 || n !== 0; } bytes() { const t = this.uint32(), n = this.pos; return this.pos += t, this.assertBounds(), this.buf.subarray(n, n + t); } string() { const t = this.bytes(); return gw(t, 0, t.length); } }, of = class { constructor(t, n, o) { Ee(this, "fn"); Ee(this, "len"); Ee(this, "val"); Ee(this, "next"); this.fn = t, this.len = n, this.val = o; } proceed(t, n) { this.fn && this.fn(this.val, t, n); } }, Pw = class { constructor(t) { Ee(this, "head"); Ee(this, "tail"); Ee(this, "len"); Ee(this, "next"); this.head = t.head, this.tail = t.tail, this.len = t.len, this.next = t.states; } }, d = class Vm { constructor() { Ee(this, "len", 0); Ee(this, "head"); Ee(this, "tail"); Ee(this, "states"); // uint64 is the same with int64 Ee(this, "uint64", Vm.prototype.int64); // sfixed64 is the same with fixed64 Ee(this, "sfixed64", Vm.prototype.fixed64); // sfixed32 is the same with fixed32 Ee(this, "sfixed32", Vm.prototype.fixed32); this.head = new of(null, 0, 0), this.tail = this.head, this.states = null; } static create() { return new Vm(); } static alloc(t) { return typeof Uint8Array < "u" ? Sw( (n) => new Uint8Array(n), Uint8Array.prototype.subarray )(t) : new Array(t); } _push(t, n, o) { return this.tail = this.tail.next = new of(t, n, o), this.len += n, this; } finish() { let t = this.head.next, n = 0; const o = Vm.alloc(this.len); for (; t; ) t.proceed(o, n), n += t.len, t = t.next; return o; } fork() { return this.states = new Pw(this), this.head = this.tail = new of(null, 0, 0), this.len = 0, this; } reset() { return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new of(null, 0, 0), this.len = 0), this; } ldelim() { const t = this.head, n = this.tail, o = this.len; return this.reset().uint32(o), o && (this.tail.next = t.next, this.tail = n, this.len += o), this; } tag(t, n) { return this.uint32((t << 3 | n) >>> 0); } uint32(t) { return this.len += (this.tail = this.tail.next = new of( Mw, (t = t >>> 0) < 128 ? 1 : t < 16384 ? 2 : t < 2097152 ? 3 : t < 268435456 ? 4 : 5, t )).len, this; } int32(t) { return t < 0 ? this._push(Uy, 10, Ig(t.toString())) : this.uint32(t); } sint32(t) { return this.uint32((t << 1 ^ t >> 31) >>> 0); } int64(t) { const { lo: n, hi: o } = Ig(t.toString()); return this._push(Uy, UT(n, o), { lo: n, hi: o }); } sint64(t) { let { lo: n, hi: o } = Ig(t.toString()); return [n, o] = Aw(n, o), this._push(Uy, UT(n, o), { lo: n, hi: o }); } fixed64(t) { const { lo: n, hi: o } = Ig(t.toString()); return this._push(My, 4, n)._push(My, 4, o); } bool(t) { return this._push(Py, 1, t ? 1 : 0); } fixed32(t) { return this._push(My, 4, t >>> 0); } float(t) { throw new Error("float not supported" + t); } double(t) { throw new Error("double not supported" + t); } bytes(t) { const n = t.length >>> 0; return n ? this.uint32(n)._push(Iw, n, t) : this._push(Py, 1, 0); } string(t) { const n = fw(t); return n ? this.uint32(n)._push(yw, n, t) : this._push(Py, 1, 0); } }; function Iw(e, t, n) { if (typeof Uint8Array < "u") t.set(e, n); else for (let o = 0; o < e.length; ++o) t[n + o] = e[o]; } function Sw(e, t, n) { const o = n || 8192, r = o >>> 1; let i = null, P = o; return function(q) { if (q < 1 || q > r) return e(q); P + q > o && (i = e(o), P = 0); const rt = t.call(i, P, P += q); return P & 7 && (P = (P | 7) + 1), rt; }; } function MT(e, t) { return RangeError( "index out of range: " + e.pos + " + " + (t || 1) + " > " + e.len ); } var Qm = (() => { if (typeof Qm < "u") return Qm; if (typeof self < "u") return self; if (typeof window < "u") return window; if (typeof global < "u") return global; throw "Unable to locate global object"; })(); const Tw = Qm.atob || ((e) => Qm.Buffer.from(e, "base64").toString("binary")); function w(e) { const t = Tw(e), n = new Uint8Array(t.length); for (let o = 0; o < t.length; ++o) n[o] = t.charCodeAt(o); return n; } const ww = Qm.btoa || ((e) => Qm.Buffer.from(e, "binary").toString("base64")); function R(e) { const t = []; return e.forEach((n) => { t.push(String.fromCharCode(n)); }), ww(t.join("")); } function C(e) { return e != null; } function H(e) { const t = Cw(e.getTime() / 1e3), n = e.getTime() % 1e3 * 1e6; return { seconds: t, nanos: n }; } function N(e) { let t = Number(e.seconds) * 1e3; return t += e.nanos / 1e6, new Date(t); } const Rw = (e) => ({ seconds: C(e.seconds) ? BigInt(e.seconds.toString()) : BigInt(0), nanos: C(e.nanos) ? Number(e.nanos) : 0 }); function Bw(e) { return e instanceof Date ? H(e) : typeof e == "string" ? H(new Date(e)) : Rw(e); } function Cw(e) { return BigInt(Math.trunc(e)); } function PT() { return { $typeUrl: "/google.protobuf.Any", typeUrl: "", value: new Uint8Array() }; } const B = { typeUrl: "/google.protobuf.Any", is(e) { return e && (e.$typeUrl === B.typeUrl || typeof e.typeUrl == "string" && (e.value instanceof Uint8Array || typeof e.value == "string")); }, isSDK(e) { return e && (e.$typeUrl === B.typeUrl || typeof e.type_url == "string" && (e.value instanceof Uint8Array || typeof e.value == "string")); }, isAmino(e) { return e && (e.$typeUrl === B.typeUrl || typeof e.type == "string" && (e.value instanceof Uint8Array || typeof e.value == "string")); }, encode(e, t = d.create()) { return e.typeUrl !== "" && t.uint32(10).string(e.typeUrl), e.value.length !== 0 && t.uint32(18).bytes(e.value), t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = PT(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.typeUrl = n.string(); break; case 2: r.value = n.bytes(); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { const t = PT(); return t.typeUrl = e.typeUrl ?? "", t.value = e.value ?? new Uint8Array(), t; }, fromAmino(e) { return { typeUrl: e.type, value: e.value }; }, toAmino(e) { const t = {}; return t.type = e.typeUrl, t.value = e.value, t; }, fromAminoMsg(e) { return B.fromAmino(e.value); }, fromProtoMsg(e) { return B.decode(e.value); }, toProto(e) { return B.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/google.protobuf.Any", value: B.encode(e).finish() }; } }, no = class { static registerAminoProtoMapping(t, n) { no.aminoProtoMapping[t] = n; } static register(t, n) { no.registry[t] = n; } static getDecoder(t) { return no.registry[t]; } static getDecoderByInstance(t) { if (t == null) return null; const n = t; if (n.$typeUrl) return no.getDecoder(n.$typeUrl); for (const o in no.registry) if (Object.prototype.hasOwnProperty.call( no.registry, o )) { const r = no.registry[o]; if (r.is(t) || r.isSDK && r.isSDK(t) || r.isAmino && r.isAmino(t)) return r; } return null; } static getDecoderByAminoType(t) { if (t == null) return null; const n = no.aminoProtoMapping[t]; return n ? no.getDecoder(n) : null; } static wrapAny(t) { if (B.is(t)) return t; const n = Jc(t); return { typeUrl: n.typeUrl, value: n.encode(t).finish() }; } static unwrapAny(t) { let n; if (B.is(t)) n = t; else { const r = t instanceof s ? t : new s(t); n = B.decode(r, r.uint32()); } const o = no.getDecoder( n.typeUrl ); return o ? o.decode(n.value) : n; } static fromJSON(t) { return Jc(t).fromJSON(t); } static toJSON(t) { return Jc(t).toJSON(t); } static fromPartial(t) { const n = Jc(t); return n ? n.fromPartial(t) : t; } static fromSDK(t) { return Jc(t).fromSDK(t); } static fromSDKJSON(t) { return Jc(t).fromSDKJSON(t); } static toSDK(t) { return Jc(t).toSDK(t); } static fromAmino(t) { return Jc(t).fromAmino(t); } static fromAminoMsg(t) { const n = no.getDecoderByAminoType(t.type); if (!n) throw new Error(`There's no decoder for the amino type ${t.type}`); return n.fromAminoMsg(t); } static toAmino(t) { let n, o; return B.is(t) ? (n = no.unwrapAny(t), o = no.getDecoder(t.typeUrl), o || (o = B)) : (n = t, o = Jc(t)), o.toAmino(n); } static toAminoMsg(t) { let n, o; return B.is(t) ? (n = no.unwrapAny(t), o = no.getDecoder(t.typeUrl), o || (o = B)) : (n = t, o = Jc(t)), o.toAminoMsg(n); } }; let a = no; Ee(a, "registry", {}), Ee(a, "aminoProtoMapping", {}); function Jc(e) { const t = a.getDecoderByInstance(e); if (!t) throw new Error( `There's no decoder for the instance ${JSON.stringify(e)}` ); return t; } a.register(B.typeUrl, B); var $g = /* @__PURE__ */ ((e) => (e[e.NO_HASH = 0] = "NO_HASH", e[e.SHA256 = 1] = "SHA256", e[e.SHA512 = 2] = "SHA512", e[e.KECCAK256 = 3] = "KECCAK256", e[e.RIPEMD160 = 4] = "RIPEMD160", e[e.BITCOIN = 5] = "BITCOIN", e[e.SHA512_256 = 6] = "SHA512_256", e[e.BLAKE2B_512 = 7] = "BLAKE2B_512", e[e.BLAKE2S_256 = 8] = "BLAKE2S_256", e[e.BLAKE3 = 9] = "BLAKE3", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))($g || {}); const Dw = $g, bw = $g; function xw(e) { switch (e) { case 0: case "NO_HASH": return 0; case 1: case "SHA256": return 1; case 2: case "SHA512": return 2; case 3: case "KECCAK256": return 3; case 4: case "RIPEMD160": return 4; case 5: case "BITCOIN": return 5; case 6: case "SHA512_256": return 6; case 7: case "BLAKE2B_512": return 7; case 8: case "BLAKE2S_256": return 8; case 9: case "BLAKE3": return 9; case -1: case "UNRECOGNIZED": default: return -1; } } function $w(e) { switch (e) { case 0: return "NO_HASH"; case 1: return "SHA256"; case 2: return "SHA512"; case 3: return "KECCAK256"; case 4: return "RIPEMD160"; case 5: return "BITCOIN"; case 6: return "SHA512_256"; case 7: return "BLAKE2B_512"; case 8: return "BLAKE2S_256"; case 9: return "BLAKE3"; case -1: default: return "UNRECOGNIZED"; } } var Og = /* @__PURE__ */ ((e) => (e[e.NO_PREFIX = 0] = "NO_PREFIX", e[e.VAR_PROTO = 1] = "VAR_PROTO", e[e.VAR_RLP = 2] = "VAR_RLP", e[e.FIXED32_BIG = 3] = "FIXED32_BIG", e[e.FIXED32_LITTLE = 4] = "FIXED32_LITTLE", e[e.FIXED64_BIG = 5] = "FIXED64_BIG", e[e.FIXED64_LITTLE = 6] = "FIXED64_LITTLE", e[e.REQUIRE_32_BYTES = 7] = "REQUIRE_32_BYTES", e[e.REQUIRE_64_BYTES = 8] = "REQUIRE_64_BYTES", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(Og || {}); const Ow = Og, Ew = Og; function Kw(e) { switch (e) { case 0: case "NO_PREFIX": return 0; case 1: case "VAR_PROTO": return 1; case 2: case "VAR_RLP": return 2; case 3: case "FIXED32_BIG": return 3; case 4: case "FIXED32_LITTLE": return 4; case 5: case "FIXED64_BIG": return 5; case 6: case "FIXED64_LITTLE": return 6; case 7: case "REQUIRE_32_BYTES": return 7; case 8: case "REQUIRE_64_BYTES": return 8; case -1: case "UNRECOGNIZED": default: return -1; } } function Hw(e) { switch (e) { case 0: return "NO_PREFIX"; case 1: return "VAR_PROTO"; case 2: return "VAR_RLP"; case 3: return "FIXED32_BIG"; case 4: return "FIXED32_LITTLE"; case 5: return "FIXED64_BIG"; case 6: return "FIXED64_LITTLE"; case 7: return "REQUIRE_32_BYTES"; case 8: return "REQUIRE_64_BYTES"; case -1: default: return "UNRECOGNIZED"; } } function Iy() { return { key: new Uint8Array(), value: new Uint8Array(), leaf: void 0, path: [] }; } const ve = { typeUrl: "/cosmos.ics23.v1.ExistenceProof", aminoType: "cosmos-sdk/ExistenceProof", is(e) { return e && (e.$typeUrl === ve.typeUrl || (e.key instanceof Uint8Array || typeof e.key == "string") && (e.value instanceof Uint8Array || typeof e.value == "string") && Array.isArray(e.path) && (!e.path.length || Te.is(e.path[0]))); }, isSDK(e) { return e && (e.$typeUrl === ve.typeUrl || (e.key instanceof Uint8Array || typeof e.key == "string") && (e.value instanceof Uint8Array || typeof e.value == "string") && Array.isArray(e.path) && (!e.path.length || Te.isSDK(e.path[0]))); }, isAmino(e) { return e && (e.$typeUrl === ve.typeUrl || (e.key instanceof Uint8Array || typeof e.key == "string") && (e.value instanceof Uint8Array || typeof e.value == "string") && Array.isArray(e.path) && (!e.path.length || Te.isAmino(e.path[0]))); }, encode(e, t = d.create()) { e.key.length !== 0 && t.uint32(10).bytes(e.key), e.value.length !== 0 && t.uint32(18).bytes(e.value), e.leaf !== void 0 && be.encode(e.leaf, t.uint32(26).fork()).ldelim(); for (const n of e.path) Te.encode(n, t.uint32(34).fork()).ldelim(); return t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = Iy(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.key = n.bytes(); break; case 2: r.value = n.bytes(); break; case 3: r.leaf = be.decode(n, n.uint32()); break; case 4: r.path.push(Te.decode(n, n.uint32())); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { var n; const t = Iy(); return t.key = e.key ?? new Uint8Array(), t.value = e.value ?? new Uint8Array(), t.leaf = e.leaf !== void 0 && e.leaf !== null ? be.fromPartial(e.leaf) : void 0, t.path = ((n = e.path) == null ? void 0 : n.map((o) => Te.fromPartial(o))) || [], t; }, fromAmino(e) { var n; const t = Iy(); return e.key !== void 0 && e.key !== null && (t.key = w(e.key)), e.value !== void 0 && e.value !== null && (t.value = w(e.value)), e.leaf !== void 0 && e.leaf !== null && (t.leaf = be.fromAmino(e.leaf)), t.path = ((n = e.path) == null ? void 0 : n.map((o) => Te.fromAmino(o))) || [], t; }, toAmino(e) { const t = {}; return t.key = e.key ? R(e.key) : void 0, t.value = e.value ? R(e.value) : void 0, t.leaf = e.leaf ? be.toAmino(e.leaf) : void 0, e.path ? t.path = e.path.map((n) => n ? Te.toAmino(n) : void 0) : t.path = e.path, t; }, fromAminoMsg(e) { return ve.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/ExistenceProof", value: ve.toAmino(e) }; }, fromProtoMsg(e) { return ve.decode(e.value); }, toProto(e) { return ve.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.ExistenceProof", value: ve.encode(e).finish() }; } }; a.register(ve.typeUrl, ve); a.registerAminoProtoMapping( ve.aminoType, ve.typeUrl ); function Sy() { return { key: new Uint8Array(), left: void 0, right: void 0 }; } const st = { typeUrl: "/cosmos.ics23.v1.NonExistenceProof", aminoType: "cosmos-sdk/NonExistenceProof", is(e) { return e && (e.$typeUrl === st.typeUrl || e.key instanceof Uint8Array || typeof e.key == "string"); }, isSDK(e) { return e && (e.$typeUrl === st.typeUrl || e.key instanceof Uint8Array || typeof e.key == "string"); }, isAmino(e) { return e && (e.$typeUrl === st.typeUrl || e.key instanceof Uint8Array || typeof e.key == "string"); }, encode(e, t = d.create()) { return e.key.length !== 0 && t.uint32(10).bytes(e.key), e.left !== void 0 && ve.encode(e.left, t.uint32(18).fork()).ldelim(), e.right !== void 0 && ve.encode(e.right, t.uint32(26).fork()).ldelim(), t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = Sy(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.key = n.bytes(); break; case 2: r.left = ve.decode(n, n.uint32()); break; case 3: r.right = ve.decode(n, n.uint32()); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { const t = Sy(); return t.key = e.key ?? new Uint8Array(), t.left = e.left !== void 0 && e.left !== null ? ve.fromPartial(e.left) : void 0, t.right = e.right !== void 0 && e.right !== null ? ve.fromPartial(e.right) : void 0, t; }, fromAmino(e) { const t = Sy(); return e.key !== void 0 && e.key !== null && (t.key = w(e.key)), e.left !== void 0 && e.left !== null && (t.left = ve.fromAmino(e.left)), e.right !== void 0 && e.right !== null && (t.right = ve.fromAmino(e.right)), t; }, toAmino(e) { const t = {}; return t.key = e.key ? R(e.key) : void 0, t.left = e.left ? ve.toAmino(e.left) : void 0, t.right = e.right ? ve.toAmino(e.right) : void 0, t; }, fromAminoMsg(e) { return st.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/NonExistenceProof", value: st.toAmino(e) }; }, fromProtoMsg(e) { return st.decode(e.value); }, toProto(e) { return st.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.NonExistenceProof", value: st.encode(e).finish() }; } }; a.register(st.typeUrl, st); a.registerAminoProtoMapping( st.aminoType, st.typeUrl ); function Ty() { return { exist: void 0, nonexist: void 0, batch: void 0, compressed: void 0 }; } const vt = { typeUrl: "/cosmos.ics23.v1.CommitmentProof", aminoType: "cosmos-sdk/CommitmentProof", is(e) { return e && e.$typeUrl === vt.typeUrl; }, isSDK(e) { return e && e.$typeUrl === vt.typeUrl; }, isAmino(e) { return e && e.$typeUrl === vt.typeUrl; }, encode(e, t = d.create()) { return e.exist !== void 0 && ve.encode(e.exist, t.uint32(10).fork()).ldelim(), e.nonexist !== void 0 && st.encode( e.nonexist, t.uint32(18).fork() ).ldelim(), e.batch !== void 0 && Jn.encode(e.batch, t.uint32(26).fork()).ldelim(), e.compressed !== void 0 && Qn.encode( e.compressed, t.uint32(34).fork() ).ldelim(), t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = Ty(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.exist = ve.decode(n, n.uint32()); break; case 2: r.nonexist = st.decode(n, n.uint32()); break; case 3: r.batch = Jn.decode(n, n.uint32()); break; case 4: r.compressed = Qn.decode( n, n.uint32() ); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { const t = Ty(); return t.exist = e.exist !== void 0 && e.exist !== null ? ve.fromPartial(e.exist) : void 0, t.nonexist = e.nonexist !== void 0 && e.nonexist !== null ? st.fromPartial(e.nonexist) : void 0, t.batch = e.batch !== void 0 && e.batch !== null ? Jn.fromPartial(e.batch) : void 0, t.compressed = e.compressed !== void 0 && e.compressed !== null ? Qn.fromPartial(e.compressed) : void 0, t; }, fromAmino(e) { const t = Ty(); return e.exist !== void 0 && e.exist !== null && (t.exist = ve.fromAmino(e.exist)), e.nonexist !== void 0 && e.nonexist !== null && (t.nonexist = st.fromAmino(e.nonexist)), e.batch !== void 0 && e.batch !== null && (t.batch = Jn.fromAmino(e.batch)), e.compressed !== void 0 && e.compressed !== null && (t.compressed = Qn.fromAmino(e.compressed)), t; }, toAmino(e) { const t = {}; return t.exist = e.exist ? ve.toAmino(e.exist) : void 0, t.nonexist = e.nonexist ? st.toAmino(e.nonexist) : void 0, t.batch = e.batch ? Jn.toAmino(e.batch) : void 0, t.compressed = e.compressed ? Qn.toAmino(e.compressed) : void 0, t; }, fromAminoMsg(e) { return vt.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/CommitmentProof", value: vt.toAmino(e) }; }, fromProtoMsg(e) { return vt.decode(e.value); }, toProto(e) { return vt.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.CommitmentProof", value: vt.encode(e).finish() }; } }; a.register(vt.typeUrl, vt); a.registerAminoProtoMapping( vt.aminoType, vt.typeUrl ); function wy() { return { hash: 0, prehashKey: 0, prehashValue: 0, length: 0, prefix: new Uint8Array() }; } const be = { typeUrl: "/cosmos.ics23.v1.LeafOp", aminoType: "cosmos-sdk/LeafOp", is(e) { return e && (e.$typeUrl === be.typeUrl || C(e.hash) && C(e.prehashKey) && C(e.prehashValue) && C(e.length) && (e.prefix instanceof Uint8Array || typeof e.prefix == "string")); }, isSDK(e) { return e && (e.$typeUrl === be.typeUrl || C(e.hash) && C(e.prehash_key) && C(e.prehash_value) && C(e.length) && (e.prefix instanceof Uint8Array || typeof e.prefix == "string")); }, isAmino(e) { return e && (e.$typeUrl === be.typeUrl || C(e.hash) && C(e.prehash_key) && C(e.prehash_value) && C(e.length) && (e.prefix instanceof Uint8Array || typeof e.prefix == "string")); }, encode(e, t = d.create()) { return e.hash !== 0 && t.uint32(8).int32(e.hash), e.prehashKey !== 0 && t.uint32(16).int32(e.prehashKey), e.prehashValue !== 0 && t.uint32(24).int32(e.prehashValue), e.length !== 0 && t.uint32(32).int32(e.length), e.prefix.length !== 0 && t.uint32(42).bytes(e.prefix), t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = wy(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.hash = n.int32(); break; case 2: r.prehashKey = n.int32(); break; case 3: r.prehashValue = n.int32(); break; case 4: r.length = n.int32(); break; case 5: r.prefix = n.bytes(); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { const t = wy(); return t.hash = e.hash ?? 0, t.prehashKey = e.prehashKey ?? 0, t.prehashValue = e.prehashValue ?? 0, t.length = e.length ?? 0, t.prefix = e.prefix ?? new Uint8Array(), t; }, fromAmino(e) { const t = wy(); return e.hash !== void 0 && e.hash !== null && (t.hash = e.hash), e.prehash_key !== void 0 && e.prehash_key !== null && (t.prehashKey = e.prehash_key), e.prehash_value !== void 0 && e.prehash_value !== null && (t.prehashValue = e.prehash_value), e.length !== void 0 && e.length !== null && (t.length = e.length), e.prefix !== void 0 && e.prefix !== null && (t.prefix = w(e.prefix)), t; }, toAmino(e) { const t = {}; return t.hash = e.hash === 0 ? void 0 : e.hash, t.prehash_key = e.prehashKey === 0 ? void 0 : e.prehashKey, t.prehash_value = e.prehashValue === 0 ? void 0 : e.prehashValue, t.length = e.length === 0 ? void 0 : e.length, t.prefix = e.prefix ? R(e.prefix) : void 0, t; }, fromAminoMsg(e) { return be.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/LeafOp", value: be.toAmino(e) }; }, fromProtoMsg(e) { return be.decode(e.value); }, toProto(e) { return be.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.LeafOp", value: be.encode(e).finish() }; } }; a.register(be.typeUrl, be); a.registerAminoProtoMapping( be.aminoType, be.typeUrl ); function Ry() { return { hash: 0, prefix: new Uint8Array(), suffix: new Uint8Array() }; } const Te = { typeUrl: "/cosmos.ics23.v1.InnerOp", aminoType: "cosmos-sdk/InnerOp", is(e) { return e && (e.$typeUrl === Te.typeUrl || C(e.hash) && (e.prefix instanceof Uint8Array || typeof e.prefix == "string") && (e.suffix instanceof Uint8Array || typeof e.suffix == "string")); }, isSDK(e) { return e && (e.$typeUrl === Te.typeUrl || C(e.hash) && (e.prefix instanceof Uint8Array || typeof e.prefix == "string") && (e.suffix instanceof Uint8Array || typeof e.suffix == "string")); }, isAmino(e) { return e && (e.$typeUrl === Te.typeUrl || C(e.hash) && (e.prefix instanceof Uint8Array || typeof e.prefix == "string") && (e.suffix instanceof Uint8Array || typeof e.suffix == "string")); }, encode(e, t = d.create()) { return e.hash !== 0 && t.uint32(8).int32(e.hash), e.prefix.length !== 0 && t.uint32(18).bytes(e.prefix), e.suffix.length !== 0 && t.uint32(26).bytes(e.suffix), t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = Ry(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.hash = n.int32(); break; case 2: r.prefix = n.bytes(); break; case 3: r.suffix = n.bytes(); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { const t = Ry(); return t.hash = e.hash ?? 0, t.prefix = e.prefix ?? new Uint8Array(), t.suffix = e.suffix ?? new Uint8Array(), t; }, fromAmino(e) { const t = Ry(); return e.hash !== void 0 && e.hash !== null && (t.hash = e.hash), e.prefix !== void 0 && e.prefix !== null && (t.prefix = w(e.prefix)), e.suffix !== void 0 && e.suffix !== null && (t.suffix = w(e.suffix)), t; }, toAmino(e) { const t = {}; return t.hash = e.hash === 0 ? void 0 : e.hash, t.prefix = e.prefix ? R(e.prefix) : void 0, t.suffix = e.suffix ? R(e.suffix) : void 0, t; }, fromAminoMsg(e) { return Te.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/InnerOp", value: Te.toAmino(e) }; }, fromProtoMsg(e) { return Te.decode(e.value); }, toProto(e) { return Te.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.InnerOp", value: Te.encode(e).finish() }; } }; a.register(Te.typeUrl, Te); a.registerAminoProtoMapping( Te.aminoType, Te.typeUrl ); function By() { return { leafSpec: void 0, innerSpec: void 0, maxDepth: 0, minDepth: 0, prehashKeyBeforeComparison: !1 }; } const Xs = { typeUrl: "/cosmos.ics23.v1.ProofSpec", aminoType: "cosmos-sdk/ProofSpec", is(e) { return e && (e.$typeUrl === Xs.typeUrl || typeof e.maxDepth == "number" && typeof e.minDepth == "number" && typeof e.prehashKeyBeforeComparison == "boolean"); }, isSDK(e) { return e && (e.$typeUrl === Xs.typeUrl || typeof e.max_depth == "number" && typeof e.min_depth == "number" && typeof e.prehash_key_before_comparison == "boolean"); }, isAmino(e) { return e && (e.$typeUrl === Xs.typeUrl || typeof e.max_depth == "number" && typeof e.min_depth == "number" && typeof e.prehash_key_before_comparison == "boolean"); }, encode(e, t = d.create()) { return e.leafSpec !== void 0 && be.encode(e.leafSpec, t.uint32(10).fork()).ldelim(), e.innerSpec !== void 0 && Zn.encode(e.innerSpec, t.uint32(18).fork()).ldelim(), e.maxDepth !== 0 && t.uint32(24).int32(e.maxDepth), e.minDepth !== 0 && t.uint32(32).int32(e.minDepth), e.prehashKeyBeforeComparison === !0 && t.uint32(40).bool(e.prehashKeyBeforeComparison), t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = By(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.leafSpec = be.decode(n, n.uint32()); break; case 2: r.innerSpec = Zn.decode(n, n.uint32()); break; case 3: r.maxDepth = n.int32(); break; case 4: r.minDepth = n.int32(); break; case 5: r.prehashKeyBeforeComparison = n.bool(); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { const t = By(); return t.leafSpec = e.leafSpec !== void 0 && e.leafSpec !== null ? be.fromPartial(e.leafSpec) : void 0, t.innerSpec = e.innerSpec !== void 0 && e.innerSpec !== null ? Zn.fromPartial(e.innerSpec) : void 0, t.maxDepth = e.maxDepth ?? 0, t.minDepth = e.minDepth ?? 0, t.prehashKeyBeforeComparison = e.prehashKeyBeforeComparison ?? !1, t; }, fromAmino(e) { const t = By(); return e.leaf_spec !== void 0 && e.leaf_spec !== null && (t.leafSpec = be.fromAmino(e.leaf_spec)), e.inner_spec !== void 0 && e.inner_spec !== null && (t.innerSpec = Zn.fromAmino(e.inner_spec)), e.max_depth !== void 0 && e.max_depth !== null && (t.maxDepth = e.max_depth), e.min_depth !== void 0 && e.min_depth !== null && (t.minDepth = e.min_depth), e.prehash_key_before_comparison !== void 0 && e.prehash_key_before_comparison !== null && (t.prehashKeyBeforeComparison = e.prehash_key_before_comparison), t; }, toAmino(e) { const t = {}; return t.leaf_spec = e.leafSpec ? be.toAmino(e.leafSpec) : void 0, t.inner_spec = e.innerSpec ? Zn.toAmino(e.innerSpec) : void 0, t.max_depth = e.maxDepth === 0 ? void 0 : e.maxDepth, t.min_depth = e.minDepth === 0 ? void 0 : e.minDepth, t.prehash_key_before_comparison = e.prehashKeyBeforeComparison === !1 ? void 0 : e.prehashKeyBeforeComparison, t; }, fromAminoMsg(e) { return Xs.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/ProofSpec", value: Xs.toAmino(e) }; }, fromProtoMsg(e) { return Xs.decode(e.value); }, toProto(e) { return Xs.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.ProofSpec", value: Xs.encode(e).finish() }; } }; a.register(Xs.typeUrl, Xs); a.registerAminoProtoMapping( Xs.aminoType, Xs.typeUrl ); function Cy() { return { childOrder: [], childSize: 0, minPrefixLength: 0, maxPrefixLength: 0, emptyChild: new Uint8Array(), hash: 0 }; } const Zn = { typeUrl: "/cosmos.ics23.v1.InnerSpec", aminoType: "cosmos-sdk/InnerSpec", is(e) { return e && (e.$typeUrl === Zn.typeUrl || Array.isArray(e.childOrder) && (!e.childOrder.length || typeof e.childOrder[0] == "number") && typeof e.childSize == "number" && typeof e.minPrefixLength == "number" && typeof e.maxPrefixLength == "number" && (e.emptyChild instanceof Uint8Array || typeof e.emptyChild == "string") && C(e.hash)); }, isSDK(e) { return e && (e.$typeUrl === Zn.typeUrl || Array.isArray(e.child_order) && (!e.child_order.length || typeof e.child_order[0] == "number") && typeof e.child_size == "number" && typeof e.min_prefix_length == "number" && typeof e.max_prefix_length == "number" && (e.empty_child instanceof Uint8Array || typeof e.empty_child == "string") && C(e.hash)); }, isAmino(e) { return e && (e.$typeUrl === Zn.typeUrl || Array.isArray(e.child_order) && (!e.child_order.length || typeof e.child_order[0] == "number") && typeof e.child_size == "number" && typeof e.min_prefix_length == "number" && typeof e.max_prefix_length == "number" && (e.empty_child instanceof Uint8Array || typeof e.empty_child == "string") && C(e.hash)); }, encode(e, t = d.create()) { t.uint32(10).fork(); for (const n of e.childOrder) t.int32(n); return t.ldelim(), e.childSize !== 0 && t.uint32(16).int32(e.childSize), e.minPrefixLength !== 0 && t.uint32(24).int32(e.minPrefixLength), e.maxPrefixLength !== 0 && t.uint32(32).int32(e.maxPrefixLength), e.emptyChild.length !== 0 && t.uint32(42).bytes(e.emptyChild), e.hash !== 0 && t.uint32(48).int32(e.hash), t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = Cy(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: if ((i & 7) === 2) { const P = n.uint32() + n.pos; for (; n.pos < P; ) r.childOrder.push(n.int32()); } else r.childOrder.push(n.int32()); break; case 2: r.childSize = n.int32(); break; case 3: r.minPrefixLength = n.int32(); break; case 4: r.maxPrefixLength = n.int32(); break; case 5: r.emptyChild = n.bytes(); break; case 6: r.hash = n.int32(); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { var n; const t = Cy(); return t.childOrder = ((n = e.childOrder) == null ? void 0 : n.map((o) => o)) || [], t.childSize = e.childSize ?? 0, t.minPrefixLength = e.minPrefixLength ?? 0, t.maxPrefixLength = e.maxPrefixLength ?? 0, t.emptyChild = e.emptyChild ?? new Uint8Array(), t.hash = e.hash ?? 0, t; }, fromAmino(e) { var n; const t = Cy(); return t.childOrder = ((n = e.child_order) == null ? void 0 : n.map((o) => o)) || [], e.child_size !== void 0 && e.child_size !== null && (t.childSize = e.child_size), e.min_prefix_length !== void 0 && e.min_prefix_length !== null && (t.minPrefixLength = e.min_prefix_length), e.max_prefix_length !== void 0 && e.max_prefix_length !== null && (t.maxPrefixLength = e.max_prefix_length), e.empty_child !== void 0 && e.empty_child !== null && (t.emptyChild = w(e.empty_child)), e.hash !== void 0 && e.hash !== null && (t.hash = e.hash), t; }, toAmino(e) { const t = {}; return e.childOrder ? t.child_order = e.childOrder.map((n) => n) : t.child_order = e.childOrder, t.child_size = e.childSize === 0 ? void 0 : e.childSize, t.min_prefix_length = e.minPrefixLength === 0 ? void 0 : e.minPrefixLength, t.max_prefix_length = e.maxPrefixLength === 0 ? void 0 : e.maxPrefixLength, t.empty_child = e.emptyChild ? R(e.emptyChild) : void 0, t.hash = e.hash === 0 ? void 0 : e.hash, t; }, fromAminoMsg(e) { return Zn.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/InnerSpec", value: Zn.toAmino(e) }; }, fromProtoMsg(e) { return Zn.decode(e.value); }, toProto(e) { return Zn.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.InnerSpec", value: Zn.encode(e).finish() }; } }; a.register(Zn.typeUrl, Zn); a.registerAminoProtoMapping( Zn.aminoType, Zn.typeUrl ); function Dy() { return { entries: [] }; } const Jn = { typeUrl: "/cosmos.ics23.v1.BatchProof", aminoType: "cosmos-sdk/BatchProof", is(e) { return e && (e.$typeUrl === Jn.typeUrl || Array.isArray(e.entries) && (!e.entries.length || ht.is(e.entries[0]))); }, isSDK(e) { return e && (e.$typeUrl === Jn.typeUrl || Array.isArray(e.entries) && (!e.entries.length || ht.isSDK(e.entries[0]))); }, isAmino(e) { return e && (e.$typeUrl === Jn.typeUrl || Array.isArray(e.entries) && (!e.entries.length || ht.isAmino(e.entries[0]))); }, encode(e, t = d.create()) { for (const n of e.entries) ht.encode(n, t.uint32(10).fork()).ldelim(); return t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = Dy(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.entries.push(ht.decode(n, n.uint32())); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { var n; const t = Dy(); return t.entries = ((n = e.entries) == null ? void 0 : n.map((o) => ht.fromPartial(o))) || [], t; }, fromAmino(e) { var n; const t = Dy(); return t.entries = ((n = e.entries) == null ? void 0 : n.map((o) => ht.fromAmino(o))) || [], t; }, toAmino(e) { const t = {}; return e.entries ? t.entries = e.entries.map( (n) => n ? ht.toAmino(n) : void 0 ) : t.entries = e.entries, t; }, fromAminoMsg(e) { return Jn.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/BatchProof", value: Jn.toAmino(e) }; }, fromProtoMsg(e) { return Jn.decode(e.value); }, toProto(e) { return Jn.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.BatchProof", value: Jn.encode(e).finish() }; } }; a.register(Jn.typeUrl, Jn); a.registerAminoProtoMapping( Jn.aminoType, Jn.typeUrl ); function by() { return { exist: void 0, nonexist: void 0 }; } const ht = { typeUrl: "/cosmos.ics23.v1.BatchEntry", aminoType: "cosmos-sdk/BatchEntry", is(e) { return e && e.$typeUrl === ht.typeUrl; }, isSDK(e) { return e && e.$typeUrl === ht.typeUrl; }, isAmino(e) { return e && e.$typeUrl === ht.typeUrl; }, encode(e, t = d.create()) { return e.exist !== void 0 && ve.encode(e.exist, t.uint32(10).fork()).ldelim(), e.nonexist !== void 0 && st.encode( e.nonexist, t.uint32(18).fork() ).ldelim(), t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = by(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.exist = ve.decode(n, n.uint32()); break; case 2: r.nonexist = st.decode(n, n.uint32()); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { const t = by(); return t.exist = e.exist !== void 0 && e.exist !== null ? ve.fromPartial(e.exist) : void 0, t.nonexist = e.nonexist !== void 0 && e.nonexist !== null ? st.fromPartial(e.nonexist) : void 0, t; }, fromAmino(e) { const t = by(); return e.exist !== void 0 && e.exist !== null && (t.exist = ve.fromAmino(e.exist)), e.nonexist !== void 0 && e.nonexist !== null && (t.nonexist = st.fromAmino(e.nonexist)), t; }, toAmino(e) { const t = {}; return t.exist = e.exist ? ve.toAmino(e.exist) : void 0, t.nonexist = e.nonexist ? st.toAmino(e.nonexist) : void 0, t; }, fromAminoMsg(e) { return ht.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/BatchEntry", value: ht.toAmino(e) }; }, fromProtoMsg(e) { return ht.decode(e.value); }, toProto(e) { return ht.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.BatchEntry", value: ht.encode(e).finish() }; } }; a.register(ht.typeUrl, ht); a.registerAminoProtoMapping( ht.aminoType, ht.typeUrl ); function xy() { return { entries: [], lookupInners: [] }; } const Qn = { typeUrl: "/cosmos.ics23.v1.CompressedBatchProof", aminoType: "cosmos-sdk/CompressedBatchProof", is(e) { return e && (e.$typeUrl === Qn.typeUrl || Array.isArray(e.entries) && (!e.entries.length || At.is(e.entries[0])) && Array.isArray(e.lookupInners) && (!e.lookupInners.length || Te.is(e.lookupInners[0]))); }, isSDK(e) { return e && (e.$typeUrl === Qn.typeUrl || Array.isArray(e.entries) && (!e.entries.length || At.isSDK(e.entries[0])) && Array.isArray(e.lookup_inners) && (!e.lookup_inners.length || Te.isSDK(e.lookup_inners[0]))); }, isAmino(e) { return e && (e.$typeUrl === Qn.typeUrl || Array.isArray(e.entries) && (!e.entries.length || At.isAmino(e.entries[0])) && Array.isArray(e.lookup_inners) && (!e.lookup_inners.length || Te.isAmino(e.lookup_inners[0]))); }, encode(e, t = d.create()) { for (const n of e.entries) At.encode(n, t.uint32(10).fork()).ldelim(); for (const n of e.lookupInners) Te.encode(n, t.uint32(18).fork()).ldelim(); return t; }, decode(e, t) { const n = e instanceof s ? e : new s(e); let o = t === void 0 ? n.len : n.pos + t; const r = xy(); for (; n.pos < o; ) { const i = n.uint32(); switch (i >>> 3) { case 1: r.entries.push( At.decode(n, n.uint32()) ); break; case 2: r.lookupInners.push(Te.decode(n, n.uint32())); break; default: n.skipType(i & 7); break; } } return r; }, fromPartial(e) { var n, o; const t = xy(); return t.entries = ((n = e.entries) == null ? void 0 : n.map((r) => At.fromPartial(r))) || [], t.lookupInners = ((o = e.lookupInners) == null ? void 0 : o.map((r) => Te.fromPartial(r))) || [], t; }, fromAmino(e) { var n, o; const t = xy(); return t.entries = ((n = e.entries) == null ? void 0 : n.map((r) => At.fromAmino(r))) || [], t.lookupInners = ((o = e.lookup_inners) == null ? void 0 : o.map((r) => Te.fromAmino(r))) || [], t; }, toAmino(e) { const t = {}; return e.entries ? t.entries = e.entries.map( (n) => n ? At.toAmino(n) : void 0 ) : t.entries = e.entries, e.lookupInners ? t.lookup_inners = e.lookupInners.map( (n) => n ? Te.toAmino(n) : void 0 ) : t.lookup_inners = e.lookupInners, t; }, fromAminoMsg(e) { return Qn.fromAmino(e.value); }, toAminoMsg(e) { return { type: "cosmos-sdk/CompressedBatchProof", value: Qn.toAmino(e) }; }, fromProtoMsg(e) { return Qn.decode(e.value); }, toProto(e) { return Qn.encode(e).finish(); }, toProtoMsg(e) { return { typeUrl: "/cosmos.ics23.v1.CompressedBatchProof", value: Qn.encode(e).finish() }; } }; a.register( Qn.typeUrl, Qn ); a.registerAminoProtoMapping( Qn.aminoType, Qn.typeUrl ); function $y() { return { exist: void 0, nonexist: void 0 }; } const At = { typeUr