@xchainjs/xchain-aggregator 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.esm.js CHANGED
@@ -261,8 +261,8 @@ function print() { __p += __j.call(arguments, '') }
261
261
  Query: ${(0,Lue.toHex)(A)}
262
262
  Proven: ${(0,Lue.toHex)(e.key)}`);return Jue.ics23.CommitmentProof.decode(e.data)}var Epn=class e{static withExtensions(i,...A){let c=new e(i),f=A.map(l=>l(c));for(let l of f){(0,Zk.assert)((0,Zk.isNonNullObject)(l),"Extension must be a non-null object");for(let[g,w]of Object.entries(l)){(0,Zk.assert)((0,Zk.isNonNullObject)(w),`Module must be a non-null object. Found type ${typeof w} for module "${g}".`);let N=c[g]||{};c[g]=Di(Di({},N),w)}}return c}constructor(i){this.tmClient=i}queryStoreVerified(i,A,c){return Jt(this,null,function*(){let{height:f,proof:l,key:g,value:w}=yield this.queryRawProof(i,A,c),N=C3t(l.ops[0],"ics23:iavl",A),F=C3t(l.ops[1],"ics23:simple",(0,Lue.toAscii)(i));(0,Zk.assert)(F.exist),(0,Zk.assert)(F.exist.value),!w||w.length===0?((0,Zk.assert)(N.nonexist),(0,Jue.verifyNonExistence)(N.nonexist,Jue.iavlSpec,F.exist.value,A)):((0,Zk.assert)(N.exist),(0,Zk.assert)(N.exist.value),(0,Jue.verifyExistence)(N.exist,Jue.iavlSpec,F.exist.value,A,w));let j=yield this.getNextHeader(f);return(0,Jue.verifyExistence)(F.exist,Jue.tendermintSpec,j.appHash,(0,Lue.toAscii)(i),F.exist.value),{key:g,value:w,height:f}})}queryRawProof(i,A,c){return Jt(this,null,function*(){var j;let{key:f,value:l,height:g,proof:w,code:N,log:F}=yield this.tmClient.abciQuery({path:`/store/${i}/key`,data:A,prove:!0,height:c});if(N)throw new Error(`Query failed with (${N}): ${F}`);if(!(0,Zk.arrayContentEquals)(A,f))throw new Error(`Response key ${(0,Lue.toHex)(f)} doesn't match query key ${(0,Lue.toHex)(A)}`);if(!g)throw new Error("No query height returned");if(!w||w.ops.length!==2)throw new Error(`Expected 2 proof ops, got ${(j=w==null?void 0:w.ops.length)!=null?j:0}. Are you using stargate?`);return C3t(w.ops[0],"ics23:iavl",f),C3t(w.ops[1],"ics23:simple",(0,Lue.toAscii)(i)),{key:f,value:l,height:g,proof:{ops:[...w.ops]}}})}queryAbci(i,A,c){return Jt(this,null,function*(){let f=yield this.tmClient.abciQuery({path:i,data:A,prove:!1,height:c});if(f.code)throw new Error(`Query failed with (${f.code}): ${f.log}`);if(!f.height)throw new Error("No query height returned");return{value:f.value,height:f.height}})}getNextHeader(i){return Jt(this,null,function*(){if((0,Zk.assertDefined)(i),i===0)throw new Error("Query returned height 0, cannot prove it");let A=i+1,c,f;try{f=this.tmClient.subscribeNewBlockHeader()}catch(l){}if(f){let l=yield(0,c6s.firstEvent)(f);l.height===A&&(c=l)}for(;!c;){let l=(yield this.tmClient.blockchain(i,A)).blockMetas.map(g=>g.header).find(g=>g.height===A);l?c=l:yield(0,Zk.sleep)(1e3)}return(0,Zk.assert)(c.height===A,"Got wrong header. This is a bug in the logic above."),c})}};GBt.QueryClient=Epn;var lM={},u6s=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lM,"__esModule",{value:!0});lM.decodeCosmosSdkDecFromProto=lM.longify=lM.createProtobufRpcClient=lM.createPagination=lM.toAccAddress=void 0;var p$r=K2,y$r=EE,f6s=Hm,l6s=u6s(qM);function h6s(e){return(0,p$r.fromBech32)(e).data}lM.toAccAddress=h6s;function g6s(e){return e?f6s.PageRequest.fromPartial({key:e}):void 0}lM.createPagination=g6s;function p6s(e){return{request:(i,A,c)=>Jt(this,null,function*(){let f=`/${i}/${A}`;return(yield e.queryAbci(f,c,void 0)).value})}}lM.createProtobufRpcClient=p6s;function y6s(e){let i=y$r.Uint64.fromString(e.toString());return l6s.default.fromBytesBE([...i.toBytesBigEndian()],!0)}lM.longify=y6s;function m6s(e){let i=typeof e=="string"?e:(0,p$r.fromAscii)(e);return y$r.Decimal.fromAtomics(i,18)}lM.decodeCosmosSdkDecFromProto=m6s;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.longify=e.decodeCosmosSdkDecFromProto=e.createProtobufRpcClient=e.createPagination=e.QueryClient=void 0;var i=GBt;Object.defineProperty(e,"QueryClient",{enumerable:!0,get:function(){return i.QueryClient}});var A=lM;Object.defineProperty(e,"createPagination",{enumerable:!0,get:function(){return A.createPagination}}),Object.defineProperty(e,"createProtobufRpcClient",{enumerable:!0,get:function(){return A.createProtobufRpcClient}}),Object.defineProperty(e,"decodeCosmosSdkDecFromProto",{enumerable:!0,get:function(){return A.decodeCosmosSdkDecFromProto}}),Object.defineProperty(e,"longify",{enumerable:!0,get:function(){return A.longify}})})(Rw);Object.defineProperty(LBt,"__esModule",{value:!0});LBt.setupAuthExtension=void 0;var I6s=IXr,C6s=Rw;function _6s(e){let i=(0,C6s.createProtobufRpcClient)(e),A=new I6s.QueryClientImpl(i);return{auth:{account:c=>Jt(this,null,function*(){let{account:f}=yield A.Account({address:c});return f!=null?f:null})}}}LBt.setupAuthExtension=_6s;var jBt={};Object.defineProperty(jBt,"__esModule",{value:!0});jBt.createAuthzAminoConverters=void 0;function E6s(){return{}}jBt.createAuthzAminoConverters=E6s;var evt={},m$r={},kR={},k3={},B6s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),v6s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),b6s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&B6s(i,e,A);return v6s(i,e),i};Object.defineProperty(k3,"__esModule",{value:!0});k3.Timestamp=k3.protobufPackage=void 0;var hie=Ns,w2n=b6s(BA);k3.protobufPackage="google.protobuf";function oLr(){return{seconds:hie.Long.ZERO,nanos:0}}k3.Timestamp={encode(e,i=w2n.Writer.create()){return e.seconds.isZero()||i.uint32(8).int64(e.seconds),e.nanos!==0&&i.uint32(16).int32(e.nanos),i},decode(e,i){let A=e instanceof w2n.Reader?e:new w2n.Reader(e),c=i===void 0?A.len:A.pos+i,f=oLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.seconds=A.int64();break;case 2:f.nanos=A.int32();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{seconds:(0,hie.isSet)(e.seconds)?hie.Long.fromValue(e.seconds):hie.Long.ZERO,nanos:(0,hie.isSet)(e.nanos)?Number(e.nanos):0}},toJSON(e){let i={};return e.seconds!==void 0&&(i.seconds=(e.seconds||hie.Long.ZERO).toString()),e.nanos!==void 0&&(i.nanos=Math.round(e.nanos)),i},fromPartial(e){var A;let i=oLr();return i.seconds=e.seconds!==void 0&&e.seconds!==null?hie.Long.fromValue(e.seconds):hie.Long.ZERO,i.nanos=(A=e.nanos)!=null?A:0,i}};var S6s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),w6s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),Q6s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&S6s(i,e,A);return w6s(i,e),i};Object.defineProperty(kR,"__esModule",{value:!0});kR.GrantQueueItem=kR.GrantAuthorization=kR.Grant=kR.GenericAuthorization=kR.protobufPackage=void 0;var iK=fh,P8e=k3,TM=Q6s(BA),RF=Ns;kR.protobufPackage="cosmos.authz.v1beta1";function aLr(){return{msg:""}}kR.GenericAuthorization={encode(e,i=TM.Writer.create()){return e.msg!==""&&i.uint32(10).string(e.msg),i},decode(e,i){let A=e instanceof TM.Reader?e:new TM.Reader(e),c=i===void 0?A.len:A.pos+i,f=aLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.msg=A.string();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{msg:(0,RF.isSet)(e.msg)?String(e.msg):""}},toJSON(e){let i={};return e.msg!==void 0&&(i.msg=e.msg),i},fromPartial(e){var A;let i=aLr();return i.msg=(A=e.msg)!=null?A:"",i}};function sLr(){return{authorization:void 0,expiration:void 0}}kR.Grant={encode(e,i=TM.Writer.create()){return e.authorization!==void 0&&iK.Any.encode(e.authorization,i.uint32(10).fork()).ldelim(),e.expiration!==void 0&&P8e.Timestamp.encode(e.expiration,i.uint32(18).fork()).ldelim(),i},decode(e,i){let A=e instanceof TM.Reader?e:new TM.Reader(e),c=i===void 0?A.len:A.pos+i,f=sLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.authorization=iK.Any.decode(A,A.uint32());break;case 2:f.expiration=P8e.Timestamp.decode(A,A.uint32());break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{authorization:(0,RF.isSet)(e.authorization)?iK.Any.fromJSON(e.authorization):void 0,expiration:(0,RF.isSet)(e.expiration)?(0,RF.fromJsonTimestamp)(e.expiration):void 0}},toJSON(e){let i={};return e.authorization!==void 0&&(i.authorization=e.authorization?iK.Any.toJSON(e.authorization):void 0),e.expiration!==void 0&&(i.expiration=(0,RF.fromTimestamp)(e.expiration).toISOString()),i},fromPartial(e){let i=sLr();return i.authorization=e.authorization!==void 0&&e.authorization!==null?iK.Any.fromPartial(e.authorization):void 0,i.expiration=e.expiration!==void 0&&e.expiration!==null?P8e.Timestamp.fromPartial(e.expiration):void 0,i}};function ALr(){return{granter:"",grantee:"",authorization:void 0,expiration:void 0}}kR.GrantAuthorization={encode(e,i=TM.Writer.create()){return e.granter!==""&&i.uint32(10).string(e.granter),e.grantee!==""&&i.uint32(18).string(e.grantee),e.authorization!==void 0&&iK.Any.encode(e.authorization,i.uint32(26).fork()).ldelim(),e.expiration!==void 0&&P8e.Timestamp.encode(e.expiration,i.uint32(34).fork()).ldelim(),i},decode(e,i){let A=e instanceof TM.Reader?e:new TM.Reader(e),c=i===void 0?A.len:A.pos+i,f=ALr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.granter=A.string();break;case 2:f.grantee=A.string();break;case 3:f.authorization=iK.Any.decode(A,A.uint32());break;case 4:f.expiration=P8e.Timestamp.decode(A,A.uint32());break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{granter:(0,RF.isSet)(e.granter)?String(e.granter):"",grantee:(0,RF.isSet)(e.grantee)?String(e.grantee):"",authorization:(0,RF.isSet)(e.authorization)?iK.Any.fromJSON(e.authorization):void 0,expiration:(0,RF.isSet)(e.expiration)?(0,RF.fromJsonTimestamp)(e.expiration):void 0}},toJSON(e){let i={};return e.granter!==void 0&&(i.granter=e.granter),e.grantee!==void 0&&(i.grantee=e.grantee),e.authorization!==void 0&&(i.authorization=e.authorization?iK.Any.toJSON(e.authorization):void 0),e.expiration!==void 0&&(i.expiration=(0,RF.fromTimestamp)(e.expiration).toISOString()),i},fromPartial(e){var A,c;let i=ALr();return i.granter=(A=e.granter)!=null?A:"",i.grantee=(c=e.grantee)!=null?c:"",i.authorization=e.authorization!==void 0&&e.authorization!==null?iK.Any.fromPartial(e.authorization):void 0,i.expiration=e.expiration!==void 0&&e.expiration!==null?P8e.Timestamp.fromPartial(e.expiration):void 0,i}};function dLr(){return{msgTypeUrls:[]}}kR.GrantQueueItem={encode(e,i=TM.Writer.create()){for(let A of e.msgTypeUrls)i.uint32(10).string(A);return i},decode(e,i){let A=e instanceof TM.Reader?e:new TM.Reader(e),c=i===void 0?A.len:A.pos+i,f=dLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.msgTypeUrls.push(A.string());break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{msgTypeUrls:Array.isArray(e==null?void 0:e.msgTypeUrls)?e.msgTypeUrls.map(i=>String(i)):[]}},toJSON(e){let i={};return e.msgTypeUrls?i.msgTypeUrls=e.msgTypeUrls.map(A=>A):i.msgTypeUrls=[],i},fromPartial(e){var A;let i=dLr();return i.msgTypeUrls=((A=e.msgTypeUrls)==null?void 0:A.map(c=>c))||[],i}};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(R,M,U,E){E===void 0&&(E=U);var Q=Object.getOwnPropertyDescriptor(M,U);(!Q||("get"in Q?!M.__esModule:Q.writable||Q.configurable))&&(Q={enumerable:!0,get:function(){return M[U]}}),Object.defineProperty(R,E,Q)}:function(R,M,U,E){E===void 0&&(E=U),R[E]=M[U]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(R,M){Object.defineProperty(R,"default",{enumerable:!0,value:M})}:function(R,M){R.default=M}),c=Fr&&Fr.__importStar||function(R){if(R&&R.__esModule)return R;var M={};if(R!=null)for(var U in R)U!=="default"&&Object.prototype.hasOwnProperty.call(R,U)&&i(M,R,U);return A(M,R),M};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgRevokeResponse=e.MsgRevoke=e.MsgGrantResponse=e.MsgExec=e.MsgExecResponse=e.MsgGrant=e.protobufPackage=void 0;let f=kR,l=fh,g=c(BA),w=Ns;e.protobufPackage="cosmos.authz.v1beta1";function N(){return{granter:"",grantee:"",grant:void 0}}e.MsgGrant={encode(R,M=g.Writer.create()){return R.granter!==""&&M.uint32(10).string(R.granter),R.grantee!==""&&M.uint32(18).string(R.grantee),R.grant!==void 0&&f.Grant.encode(R.grant,M.uint32(26).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=N();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.granter=U.string();break;case 2:Q.grantee=U.string();break;case 3:Q.grant=f.Grant.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{granter:(0,w.isSet)(R.granter)?String(R.granter):"",grantee:(0,w.isSet)(R.grantee)?String(R.grantee):"",grant:(0,w.isSet)(R.grant)?f.Grant.fromJSON(R.grant):void 0}},toJSON(R){let M={};return R.granter!==void 0&&(M.granter=R.granter),R.grantee!==void 0&&(M.grantee=R.grantee),R.grant!==void 0&&(M.grant=R.grant?f.Grant.toJSON(R.grant):void 0),M},fromPartial(R){var U,E;let M=N();return M.granter=(U=R.granter)!=null?U:"",M.grantee=(E=R.grantee)!=null?E:"",M.grant=R.grant!==void 0&&R.grant!==null?f.Grant.fromPartial(R.grant):void 0,M}};function F(){return{results:[]}}e.MsgExecResponse={encode(R,M=g.Writer.create()){for(let U of R.results)M.uint32(10).bytes(U);return M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=F();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.results.push(U.bytes());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{results:Array.isArray(R==null?void 0:R.results)?R.results.map(M=>(0,w.bytesFromBase64)(M)):[]}},toJSON(R){let M={};return R.results?M.results=R.results.map(U=>(0,w.base64FromBytes)(U!==void 0?U:new Uint8Array)):M.results=[],M},fromPartial(R){var U;let M=F();return M.results=((U=R.results)==null?void 0:U.map(E=>E))||[],M}};function j(){return{grantee:"",msgs:[]}}e.MsgExec={encode(R,M=g.Writer.create()){R.grantee!==""&&M.uint32(10).string(R.grantee);for(let U of R.msgs)l.Any.encode(U,M.uint32(18).fork()).ldelim();return M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=j();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.grantee=U.string();break;case 2:Q.msgs.push(l.Any.decode(U,U.uint32()));break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{grantee:(0,w.isSet)(R.grantee)?String(R.grantee):"",msgs:Array.isArray(R==null?void 0:R.msgs)?R.msgs.map(M=>l.Any.fromJSON(M)):[]}},toJSON(R){let M={};return R.grantee!==void 0&&(M.grantee=R.grantee),R.msgs?M.msgs=R.msgs.map(U=>U?l.Any.toJSON(U):void 0):M.msgs=[],M},fromPartial(R){var U,E;let M=j();return M.grantee=(U=R.grantee)!=null?U:"",M.msgs=((E=R.msgs)==null?void 0:E.map(Q=>l.Any.fromPartial(Q)))||[],M}};function te(){return{}}e.MsgGrantResponse={encode(R,M=g.Writer.create()){return M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=te();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){default:U.skipType(H&7);break}}return Q},fromJSON(R){return{}},toJSON(R){return{}},fromPartial(R){return te()}};function v(){return{granter:"",grantee:"",msgTypeUrl:""}}e.MsgRevoke={encode(R,M=g.Writer.create()){return R.granter!==""&&M.uint32(10).string(R.granter),R.grantee!==""&&M.uint32(18).string(R.grantee),R.msgTypeUrl!==""&&M.uint32(26).string(R.msgTypeUrl),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=v();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.granter=U.string();break;case 2:Q.grantee=U.string();break;case 3:Q.msgTypeUrl=U.string();break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{granter:(0,w.isSet)(R.granter)?String(R.granter):"",grantee:(0,w.isSet)(R.grantee)?String(R.grantee):"",msgTypeUrl:(0,w.isSet)(R.msgTypeUrl)?String(R.msgTypeUrl):""}},toJSON(R){let M={};return R.granter!==void 0&&(M.granter=R.granter),R.grantee!==void 0&&(M.grantee=R.grantee),R.msgTypeUrl!==void 0&&(M.msgTypeUrl=R.msgTypeUrl),M},fromPartial(R){var U,E,Q;let M=v();return M.granter=(U=R.granter)!=null?U:"",M.grantee=(E=R.grantee)!=null?E:"",M.msgTypeUrl=(Q=R.msgTypeUrl)!=null?Q:"",M}};function ne(){return{}}e.MsgRevokeResponse={encode(R,M=g.Writer.create()){return M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=ne();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){default:U.skipType(H&7);break}}return Q},fromJSON(R){return{}},toJSON(R){return{}},fromPartial(R){return ne()}};class Z{constructor(M){this.rpc=M,this.Grant=this.Grant.bind(this),this.Exec=this.Exec.bind(this),this.Revoke=this.Revoke.bind(this)}Grant(M){let U=e.MsgGrant.encode(M).finish();return this.rpc.request("cosmos.authz.v1beta1.Msg","Grant",U).then(Q=>e.MsgGrantResponse.decode(new g.Reader(Q)))}Exec(M){let U=e.MsgExec.encode(M).finish();return this.rpc.request("cosmos.authz.v1beta1.Msg","Exec",U).then(Q=>e.MsgExecResponse.decode(new g.Reader(Q)))}Revoke(M){let U=e.MsgRevoke.encode(M).finish();return this.rpc.request("cosmos.authz.v1beta1.Msg","Revoke",U).then(Q=>e.MsgRevokeResponse.decode(new g.Reader(Q)))}}e.MsgClientImpl=Z})(m$r);Object.defineProperty(evt,"__esModule",{value:!0});evt.authzTypes=void 0;var Q2n=m$r;evt.authzTypes=[["/cosmos.authz.v1beta1.MsgExec",Q2n.MsgExec],["/cosmos.authz.v1beta1.MsgGrant",Q2n.MsgGrant],["/cosmos.authz.v1beta1.MsgRevoke",Q2n.MsgRevoke]];var tvt={},I$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(R,M,U,E){E===void 0&&(E=U);var Q=Object.getOwnPropertyDescriptor(M,U);(!Q||("get"in Q?!M.__esModule:Q.writable||Q.configurable))&&(Q={enumerable:!0,get:function(){return M[U]}}),Object.defineProperty(R,E,Q)}:function(R,M,U,E){E===void 0&&(E=U),R[E]=M[U]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(R,M){Object.defineProperty(R,"default",{enumerable:!0,value:M})}:function(R,M){R.default=M}),c=Fr&&Fr.__importStar||function(R){if(R&&R.__esModule)return R;var M={};if(R!=null)for(var U in R)U!=="default"&&Object.prototype.hasOwnProperty.call(R,U)&&i(M,R,U);return A(M,R),M};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryGranteeGrantsResponse=e.QueryGranteeGrantsRequest=e.QueryGranterGrantsResponse=e.QueryGranterGrantsRequest=e.QueryGrantsResponse=e.QueryGrantsRequest=e.protobufPackage=void 0;let f=Hm,l=kR,g=c(BA),w=Ns;e.protobufPackage="cosmos.authz.v1beta1";function N(){return{granter:"",grantee:"",msgTypeUrl:"",pagination:void 0}}e.QueryGrantsRequest={encode(R,M=g.Writer.create()){return R.granter!==""&&M.uint32(10).string(R.granter),R.grantee!==""&&M.uint32(18).string(R.grantee),R.msgTypeUrl!==""&&M.uint32(26).string(R.msgTypeUrl),R.pagination!==void 0&&f.PageRequest.encode(R.pagination,M.uint32(34).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=N();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.granter=U.string();break;case 2:Q.grantee=U.string();break;case 3:Q.msgTypeUrl=U.string();break;case 4:Q.pagination=f.PageRequest.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{granter:(0,w.isSet)(R.granter)?String(R.granter):"",grantee:(0,w.isSet)(R.grantee)?String(R.grantee):"",msgTypeUrl:(0,w.isSet)(R.msgTypeUrl)?String(R.msgTypeUrl):"",pagination:(0,w.isSet)(R.pagination)?f.PageRequest.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.granter!==void 0&&(M.granter=R.granter),R.grantee!==void 0&&(M.grantee=R.grantee),R.msgTypeUrl!==void 0&&(M.msgTypeUrl=R.msgTypeUrl),R.pagination!==void 0&&(M.pagination=R.pagination?f.PageRequest.toJSON(R.pagination):void 0),M},fromPartial(R){var U,E,Q;let M=N();return M.granter=(U=R.granter)!=null?U:"",M.grantee=(E=R.grantee)!=null?E:"",M.msgTypeUrl=(Q=R.msgTypeUrl)!=null?Q:"",M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageRequest.fromPartial(R.pagination):void 0,M}};function F(){return{grants:[],pagination:void 0}}e.QueryGrantsResponse={encode(R,M=g.Writer.create()){for(let U of R.grants)l.Grant.encode(U,M.uint32(10).fork()).ldelim();return R.pagination!==void 0&&f.PageResponse.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=F();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.grants.push(l.Grant.decode(U,U.uint32()));break;case 2:Q.pagination=f.PageResponse.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{grants:Array.isArray(R==null?void 0:R.grants)?R.grants.map(M=>l.Grant.fromJSON(M)):[],pagination:(0,w.isSet)(R.pagination)?f.PageResponse.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.grants?M.grants=R.grants.map(U=>U?l.Grant.toJSON(U):void 0):M.grants=[],R.pagination!==void 0&&(M.pagination=R.pagination?f.PageResponse.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=F();return M.grants=((U=R.grants)==null?void 0:U.map(E=>l.Grant.fromPartial(E)))||[],M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageResponse.fromPartial(R.pagination):void 0,M}};function j(){return{granter:"",pagination:void 0}}e.QueryGranterGrantsRequest={encode(R,M=g.Writer.create()){return R.granter!==""&&M.uint32(10).string(R.granter),R.pagination!==void 0&&f.PageRequest.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=j();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.granter=U.string();break;case 2:Q.pagination=f.PageRequest.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{granter:(0,w.isSet)(R.granter)?String(R.granter):"",pagination:(0,w.isSet)(R.pagination)?f.PageRequest.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.granter!==void 0&&(M.granter=R.granter),R.pagination!==void 0&&(M.pagination=R.pagination?f.PageRequest.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=j();return M.granter=(U=R.granter)!=null?U:"",M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageRequest.fromPartial(R.pagination):void 0,M}};function te(){return{grants:[],pagination:void 0}}e.QueryGranterGrantsResponse={encode(R,M=g.Writer.create()){for(let U of R.grants)l.GrantAuthorization.encode(U,M.uint32(10).fork()).ldelim();return R.pagination!==void 0&&f.PageResponse.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=te();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.grants.push(l.GrantAuthorization.decode(U,U.uint32()));break;case 2:Q.pagination=f.PageResponse.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{grants:Array.isArray(R==null?void 0:R.grants)?R.grants.map(M=>l.GrantAuthorization.fromJSON(M)):[],pagination:(0,w.isSet)(R.pagination)?f.PageResponse.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.grants?M.grants=R.grants.map(U=>U?l.GrantAuthorization.toJSON(U):void 0):M.grants=[],R.pagination!==void 0&&(M.pagination=R.pagination?f.PageResponse.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=te();return M.grants=((U=R.grants)==null?void 0:U.map(E=>l.GrantAuthorization.fromPartial(E)))||[],M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageResponse.fromPartial(R.pagination):void 0,M}};function v(){return{grantee:"",pagination:void 0}}e.QueryGranteeGrantsRequest={encode(R,M=g.Writer.create()){return R.grantee!==""&&M.uint32(10).string(R.grantee),R.pagination!==void 0&&f.PageRequest.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=v();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.grantee=U.string();break;case 2:Q.pagination=f.PageRequest.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{grantee:(0,w.isSet)(R.grantee)?String(R.grantee):"",pagination:(0,w.isSet)(R.pagination)?f.PageRequest.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.grantee!==void 0&&(M.grantee=R.grantee),R.pagination!==void 0&&(M.pagination=R.pagination?f.PageRequest.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=v();return M.grantee=(U=R.grantee)!=null?U:"",M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageRequest.fromPartial(R.pagination):void 0,M}};function ne(){return{grants:[],pagination:void 0}}e.QueryGranteeGrantsResponse={encode(R,M=g.Writer.create()){for(let U of R.grants)l.GrantAuthorization.encode(U,M.uint32(10).fork()).ldelim();return R.pagination!==void 0&&f.PageResponse.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=ne();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.grants.push(l.GrantAuthorization.decode(U,U.uint32()));break;case 2:Q.pagination=f.PageResponse.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{grants:Array.isArray(R==null?void 0:R.grants)?R.grants.map(M=>l.GrantAuthorization.fromJSON(M)):[],pagination:(0,w.isSet)(R.pagination)?f.PageResponse.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.grants?M.grants=R.grants.map(U=>U?l.GrantAuthorization.toJSON(U):void 0):M.grants=[],R.pagination!==void 0&&(M.pagination=R.pagination?f.PageResponse.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=ne();return M.grants=((U=R.grants)==null?void 0:U.map(E=>l.GrantAuthorization.fromPartial(E)))||[],M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageResponse.fromPartial(R.pagination):void 0,M}};class Z{constructor(M){this.rpc=M,this.Grants=this.Grants.bind(this),this.GranterGrants=this.GranterGrants.bind(this),this.GranteeGrants=this.GranteeGrants.bind(this)}Grants(M){let U=e.QueryGrantsRequest.encode(M).finish();return this.rpc.request("cosmos.authz.v1beta1.Query","Grants",U).then(Q=>e.QueryGrantsResponse.decode(new g.Reader(Q)))}GranterGrants(M){let U=e.QueryGranterGrantsRequest.encode(M).finish();return this.rpc.request("cosmos.authz.v1beta1.Query","GranterGrants",U).then(Q=>e.QueryGranterGrantsResponse.decode(new g.Reader(Q)))}GranteeGrants(M){let U=e.QueryGranteeGrantsRequest.encode(M).finish();return this.rpc.request("cosmos.authz.v1beta1.Query","GranteeGrants",U).then(Q=>e.QueryGranteeGrantsResponse.decode(new g.Reader(Q)))}}e.QueryClientImpl=Z})(I$r);Object.defineProperty(tvt,"__esModule",{value:!0});tvt.setupAuthzExtension=void 0;var k6s=I$r,_3t=Rw;function D6s(e){let i=(0,_3t.createProtobufRpcClient)(e),A=new k6s.QueryClientImpl(i);return{authz:{grants:(c,f,l,g)=>Jt(this,null,function*(){return yield A.Grants({granter:c,grantee:f,msgTypeUrl:l,pagination:(0,_3t.createPagination)(g)})}),granteeGrants:(c,f)=>Jt(this,null,function*(){return yield A.GranteeGrants({grantee:c,pagination:(0,_3t.createPagination)(f)})}),granterGrants:(c,f)=>Jt(this,null,function*(){return yield A.GranterGrants({granter:c,pagination:(0,_3t.createPagination)(f)})})}}}tvt.setupAuthzExtension=D6s;var qie={};Object.defineProperty(qie,"__esModule",{value:!0});qie.createBankAminoConverters=qie.isAminoMsgMultiSend=qie.isAminoMsgSend=void 0;function R6s(e){return e.type==="cosmos-sdk/MsgSend"}qie.isAminoMsgSend=R6s;function P6s(e){return e.type==="cosmos-sdk/MsgMultiSend"}qie.isAminoMsgMultiSend=P6s;function O6s(){return{"/cosmos.bank.v1beta1.MsgSend":{aminoType:"cosmos-sdk/MsgSend",toAmino:({fromAddress:e,toAddress:i,amount:A})=>({from_address:e,to_address:i,amount:[...A]}),fromAmino:({from_address:e,to_address:i,amount:A})=>({fromAddress:e,toAddress:i,amount:[...A]})},"/cosmos.bank.v1beta1.MsgMultiSend":{aminoType:"cosmos-sdk/MsgMultiSend",toAmino:({inputs:e,outputs:i})=>({inputs:e.map(A=>({address:A.address,coins:[...A.coins]})),outputs:i.map(A=>({address:A.address,coins:[...A.coins]}))}),fromAmino:({inputs:e,outputs:i})=>({inputs:e.map(A=>({address:A.address,coins:[...A.coins]})),outputs:i.map(A=>({address:A.address,coins:[...A.coins]}))})}}}qie.createBankAminoConverters=O6s;var ASe={};Object.defineProperty(ASe,"__esModule",{value:!0});ASe.isMsgSendEncodeObject=ASe.bankTypes=void 0;var cLr=tIn;ASe.bankTypes=[["/cosmos.bank.v1beta1.MsgMultiSend",cLr.MsgMultiSend],["/cosmos.bank.v1beta1.MsgSend",cLr.MsgSend]];function N6s(e){return e.typeUrl==="/cosmos.bank.v1beta1.MsgSend"}ASe.isMsgSendEncodeObject=N6s;var nvt={},C$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(O,J,ie,G){G===void 0&&(G=ie);var I=Object.getOwnPropertyDescriptor(J,ie);(!I||("get"in I?!J.__esModule:I.writable||I.configurable))&&(I={enumerable:!0,get:function(){return J[ie]}}),Object.defineProperty(O,G,I)}:function(O,J,ie,G){G===void 0&&(G=ie),O[G]=J[ie]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(O,J){Object.defineProperty(O,"default",{enumerable:!0,value:J})}:function(O,J){O.default=J}),c=Fr&&Fr.__importStar||function(O){if(O&&O.__esModule)return O;var J={};if(O!=null)for(var ie in O)ie!=="default"&&Object.prototype.hasOwnProperty.call(O,ie)&&i(J,O,ie);return A(J,O),J};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QuerySendEnabledResponse=e.QuerySendEnabledRequest=e.QueryDenomOwnersResponse=e.DenomOwner=e.QueryDenomOwnersRequest=e.QueryDenomMetadataResponse=e.QueryDenomMetadataRequest=e.QueryDenomsMetadataResponse=e.QueryDenomsMetadataRequest=e.QueryParamsResponse=e.QueryParamsRequest=e.QuerySupplyOfResponse=e.QuerySupplyOfRequest=e.QueryTotalSupplyResponse=e.QueryTotalSupplyRequest=e.QuerySpendableBalanceByDenomResponse=e.QuerySpendableBalanceByDenomRequest=e.QuerySpendableBalancesResponse=e.QuerySpendableBalancesRequest=e.QueryAllBalancesResponse=e.QueryAllBalancesRequest=e.QueryBalanceResponse=e.QueryBalanceRequest=e.protobufPackage=void 0;let f=Hm,l=gg,g=nIn,w=c(BA),N=Ns;e.protobufPackage="cosmos.bank.v1beta1";function F(){return{address:"",denom:""}}e.QueryBalanceRequest={encode(O,J=w.Writer.create()){return O.address!==""&&J.uint32(10).string(O.address),O.denom!==""&&J.uint32(18).string(O.denom),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=F();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.address=ie.string();break;case 2:I.denom=ie.string();break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{address:(0,N.isSet)(O.address)?String(O.address):"",denom:(0,N.isSet)(O.denom)?String(O.denom):""}},toJSON(O){let J={};return O.address!==void 0&&(J.address=O.address),O.denom!==void 0&&(J.denom=O.denom),J},fromPartial(O){var ie,G;let J=F();return J.address=(ie=O.address)!=null?ie:"",J.denom=(G=O.denom)!=null?G:"",J}};function j(){return{balance:void 0}}e.QueryBalanceResponse={encode(O,J=w.Writer.create()){return O.balance!==void 0&&l.Coin.encode(O.balance,J.uint32(10).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=j();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.balance=l.Coin.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{balance:(0,N.isSet)(O.balance)?l.Coin.fromJSON(O.balance):void 0}},toJSON(O){let J={};return O.balance!==void 0&&(J.balance=O.balance?l.Coin.toJSON(O.balance):void 0),J},fromPartial(O){let J=j();return J.balance=O.balance!==void 0&&O.balance!==null?l.Coin.fromPartial(O.balance):void 0,J}};function te(){return{address:"",pagination:void 0}}e.QueryAllBalancesRequest={encode(O,J=w.Writer.create()){return O.address!==""&&J.uint32(10).string(O.address),O.pagination!==void 0&&f.PageRequest.encode(O.pagination,J.uint32(18).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=te();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.address=ie.string();break;case 2:I.pagination=f.PageRequest.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{address:(0,N.isSet)(O.address)?String(O.address):"",pagination:(0,N.isSet)(O.pagination)?f.PageRequest.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.address!==void 0&&(J.address=O.address),O.pagination!==void 0&&(J.pagination=O.pagination?f.PageRequest.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=te();return J.address=(ie=O.address)!=null?ie:"",J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageRequest.fromPartial(O.pagination):void 0,J}};function v(){return{balances:[],pagination:void 0}}e.QueryAllBalancesResponse={encode(O,J=w.Writer.create()){for(let ie of O.balances)l.Coin.encode(ie,J.uint32(10).fork()).ldelim();return O.pagination!==void 0&&f.PageResponse.encode(O.pagination,J.uint32(18).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=v();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.balances.push(l.Coin.decode(ie,ie.uint32()));break;case 2:I.pagination=f.PageResponse.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{balances:Array.isArray(O==null?void 0:O.balances)?O.balances.map(J=>l.Coin.fromJSON(J)):[],pagination:(0,N.isSet)(O.pagination)?f.PageResponse.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.balances?J.balances=O.balances.map(ie=>ie?l.Coin.toJSON(ie):void 0):J.balances=[],O.pagination!==void 0&&(J.pagination=O.pagination?f.PageResponse.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=v();return J.balances=((ie=O.balances)==null?void 0:ie.map(G=>l.Coin.fromPartial(G)))||[],J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageResponse.fromPartial(O.pagination):void 0,J}};function ne(){return{address:"",pagination:void 0}}e.QuerySpendableBalancesRequest={encode(O,J=w.Writer.create()){return O.address!==""&&J.uint32(10).string(O.address),O.pagination!==void 0&&f.PageRequest.encode(O.pagination,J.uint32(18).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=ne();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.address=ie.string();break;case 2:I.pagination=f.PageRequest.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{address:(0,N.isSet)(O.address)?String(O.address):"",pagination:(0,N.isSet)(O.pagination)?f.PageRequest.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.address!==void 0&&(J.address=O.address),O.pagination!==void 0&&(J.pagination=O.pagination?f.PageRequest.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=ne();return J.address=(ie=O.address)!=null?ie:"",J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageRequest.fromPartial(O.pagination):void 0,J}};function Z(){return{balances:[],pagination:void 0}}e.QuerySpendableBalancesResponse={encode(O,J=w.Writer.create()){for(let ie of O.balances)l.Coin.encode(ie,J.uint32(10).fork()).ldelim();return O.pagination!==void 0&&f.PageResponse.encode(O.pagination,J.uint32(18).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=Z();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.balances.push(l.Coin.decode(ie,ie.uint32()));break;case 2:I.pagination=f.PageResponse.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{balances:Array.isArray(O==null?void 0:O.balances)?O.balances.map(J=>l.Coin.fromJSON(J)):[],pagination:(0,N.isSet)(O.pagination)?f.PageResponse.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.balances?J.balances=O.balances.map(ie=>ie?l.Coin.toJSON(ie):void 0):J.balances=[],O.pagination!==void 0&&(J.pagination=O.pagination?f.PageResponse.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=Z();return J.balances=((ie=O.balances)==null?void 0:ie.map(G=>l.Coin.fromPartial(G)))||[],J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageResponse.fromPartial(O.pagination):void 0,J}};function R(){return{address:"",denom:""}}e.QuerySpendableBalanceByDenomRequest={encode(O,J=w.Writer.create()){return O.address!==""&&J.uint32(10).string(O.address),O.denom!==""&&J.uint32(18).string(O.denom),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=R();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.address=ie.string();break;case 2:I.denom=ie.string();break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{address:(0,N.isSet)(O.address)?String(O.address):"",denom:(0,N.isSet)(O.denom)?String(O.denom):""}},toJSON(O){let J={};return O.address!==void 0&&(J.address=O.address),O.denom!==void 0&&(J.denom=O.denom),J},fromPartial(O){var ie,G;let J=R();return J.address=(ie=O.address)!=null?ie:"",J.denom=(G=O.denom)!=null?G:"",J}};function M(){return{balance:void 0}}e.QuerySpendableBalanceByDenomResponse={encode(O,J=w.Writer.create()){return O.balance!==void 0&&l.Coin.encode(O.balance,J.uint32(10).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=M();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.balance=l.Coin.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{balance:(0,N.isSet)(O.balance)?l.Coin.fromJSON(O.balance):void 0}},toJSON(O){let J={};return O.balance!==void 0&&(J.balance=O.balance?l.Coin.toJSON(O.balance):void 0),J},fromPartial(O){let J=M();return J.balance=O.balance!==void 0&&O.balance!==null?l.Coin.fromPartial(O.balance):void 0,J}};function U(){return{pagination:void 0}}e.QueryTotalSupplyRequest={encode(O,J=w.Writer.create()){return O.pagination!==void 0&&f.PageRequest.encode(O.pagination,J.uint32(10).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=U();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.pagination=f.PageRequest.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{pagination:(0,N.isSet)(O.pagination)?f.PageRequest.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.pagination!==void 0&&(J.pagination=O.pagination?f.PageRequest.toJSON(O.pagination):void 0),J},fromPartial(O){let J=U();return J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageRequest.fromPartial(O.pagination):void 0,J}};function E(){return{supply:[],pagination:void 0}}e.QueryTotalSupplyResponse={encode(O,J=w.Writer.create()){for(let ie of O.supply)l.Coin.encode(ie,J.uint32(10).fork()).ldelim();return O.pagination!==void 0&&f.PageResponse.encode(O.pagination,J.uint32(18).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=E();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.supply.push(l.Coin.decode(ie,ie.uint32()));break;case 2:I.pagination=f.PageResponse.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{supply:Array.isArray(O==null?void 0:O.supply)?O.supply.map(J=>l.Coin.fromJSON(J)):[],pagination:(0,N.isSet)(O.pagination)?f.PageResponse.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.supply?J.supply=O.supply.map(ie=>ie?l.Coin.toJSON(ie):void 0):J.supply=[],O.pagination!==void 0&&(J.pagination=O.pagination?f.PageResponse.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=E();return J.supply=((ie=O.supply)==null?void 0:ie.map(G=>l.Coin.fromPartial(G)))||[],J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageResponse.fromPartial(O.pagination):void 0,J}};function Q(){return{denom:""}}e.QuerySupplyOfRequest={encode(O,J=w.Writer.create()){return O.denom!==""&&J.uint32(10).string(O.denom),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=Q();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.denom=ie.string();break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{denom:(0,N.isSet)(O.denom)?String(O.denom):""}},toJSON(O){let J={};return O.denom!==void 0&&(J.denom=O.denom),J},fromPartial(O){var ie;let J=Q();return J.denom=(ie=O.denom)!=null?ie:"",J}};function H(){return{amount:void 0}}e.QuerySupplyOfResponse={encode(O,J=w.Writer.create()){return O.amount!==void 0&&l.Coin.encode(O.amount,J.uint32(10).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=H();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.amount=l.Coin.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{amount:(0,N.isSet)(O.amount)?l.Coin.fromJSON(O.amount):void 0}},toJSON(O){let J={};return O.amount!==void 0&&(J.amount=O.amount?l.Coin.toJSON(O.amount):void 0),J},fromPartial(O){let J=H();return J.amount=O.amount!==void 0&&O.amount!==null?l.Coin.fromPartial(O.amount):void 0,J}};function re(){return{}}e.QueryParamsRequest={encode(O,J=w.Writer.create()){return J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=re();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){default:ie.skipType(C&7);break}}return I},fromJSON(O){return{}},toJSON(O){return{}},fromPartial(O){return re()}};function ee(){return{params:void 0}}e.QueryParamsResponse={encode(O,J=w.Writer.create()){return O.params!==void 0&&g.Params.encode(O.params,J.uint32(10).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=ee();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.params=g.Params.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{params:(0,N.isSet)(O.params)?g.Params.fromJSON(O.params):void 0}},toJSON(O){let J={};return O.params!==void 0&&(J.params=O.params?g.Params.toJSON(O.params):void 0),J},fromPartial(O){let J=ee();return J.params=O.params!==void 0&&O.params!==null?g.Params.fromPartial(O.params):void 0,J}};function T(){return{pagination:void 0}}e.QueryDenomsMetadataRequest={encode(O,J=w.Writer.create()){return O.pagination!==void 0&&f.PageRequest.encode(O.pagination,J.uint32(10).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=T();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.pagination=f.PageRequest.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{pagination:(0,N.isSet)(O.pagination)?f.PageRequest.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.pagination!==void 0&&(J.pagination=O.pagination?f.PageRequest.toJSON(O.pagination):void 0),J},fromPartial(O){let J=T();return J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageRequest.fromPartial(O.pagination):void 0,J}};function se(){return{metadatas:[],pagination:void 0}}e.QueryDenomsMetadataResponse={encode(O,J=w.Writer.create()){for(let ie of O.metadatas)g.Metadata.encode(ie,J.uint32(10).fork()).ldelim();return O.pagination!==void 0&&f.PageResponse.encode(O.pagination,J.uint32(18).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=se();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.metadatas.push(g.Metadata.decode(ie,ie.uint32()));break;case 2:I.pagination=f.PageResponse.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{metadatas:Array.isArray(O==null?void 0:O.metadatas)?O.metadatas.map(J=>g.Metadata.fromJSON(J)):[],pagination:(0,N.isSet)(O.pagination)?f.PageResponse.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.metadatas?J.metadatas=O.metadatas.map(ie=>ie?g.Metadata.toJSON(ie):void 0):J.metadatas=[],O.pagination!==void 0&&(J.pagination=O.pagination?f.PageResponse.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=se();return J.metadatas=((ie=O.metadatas)==null?void 0:ie.map(G=>g.Metadata.fromPartial(G)))||[],J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageResponse.fromPartial(O.pagination):void 0,J}};function p(){return{denom:""}}e.QueryDenomMetadataRequest={encode(O,J=w.Writer.create()){return O.denom!==""&&J.uint32(10).string(O.denom),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=p();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.denom=ie.string();break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{denom:(0,N.isSet)(O.denom)?String(O.denom):""}},toJSON(O){let J={};return O.denom!==void 0&&(J.denom=O.denom),J},fromPartial(O){var ie;let J=p();return J.denom=(ie=O.denom)!=null?ie:"",J}};function L(){return{metadata:void 0}}e.QueryDenomMetadataResponse={encode(O,J=w.Writer.create()){return O.metadata!==void 0&&g.Metadata.encode(O.metadata,J.uint32(10).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=L();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.metadata=g.Metadata.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{metadata:(0,N.isSet)(O.metadata)?g.Metadata.fromJSON(O.metadata):void 0}},toJSON(O){let J={};return O.metadata!==void 0&&(J.metadata=O.metadata?g.Metadata.toJSON(O.metadata):void 0),J},fromPartial(O){let J=L();return J.metadata=O.metadata!==void 0&&O.metadata!==null?g.Metadata.fromPartial(O.metadata):void 0,J}};function V(){return{denom:"",pagination:void 0}}e.QueryDenomOwnersRequest={encode(O,J=w.Writer.create()){return O.denom!==""&&J.uint32(10).string(O.denom),O.pagination!==void 0&&f.PageRequest.encode(O.pagination,J.uint32(18).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=V();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.denom=ie.string();break;case 2:I.pagination=f.PageRequest.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{denom:(0,N.isSet)(O.denom)?String(O.denom):"",pagination:(0,N.isSet)(O.pagination)?f.PageRequest.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.denom!==void 0&&(J.denom=O.denom),O.pagination!==void 0&&(J.pagination=O.pagination?f.PageRequest.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=V();return J.denom=(ie=O.denom)!=null?ie:"",J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageRequest.fromPartial(O.pagination):void 0,J}};function K(){return{address:"",balance:void 0}}e.DenomOwner={encode(O,J=w.Writer.create()){return O.address!==""&&J.uint32(10).string(O.address),O.balance!==void 0&&l.Coin.encode(O.balance,J.uint32(18).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=K();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.address=ie.string();break;case 2:I.balance=l.Coin.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{address:(0,N.isSet)(O.address)?String(O.address):"",balance:(0,N.isSet)(O.balance)?l.Coin.fromJSON(O.balance):void 0}},toJSON(O){let J={};return O.address!==void 0&&(J.address=O.address),O.balance!==void 0&&(J.balance=O.balance?l.Coin.toJSON(O.balance):void 0),J},fromPartial(O){var ie;let J=K();return J.address=(ie=O.address)!=null?ie:"",J.balance=O.balance!==void 0&&O.balance!==null?l.Coin.fromPartial(O.balance):void 0,J}};function m(){return{denomOwners:[],pagination:void 0}}e.QueryDenomOwnersResponse={encode(O,J=w.Writer.create()){for(let ie of O.denomOwners)e.DenomOwner.encode(ie,J.uint32(10).fork()).ldelim();return O.pagination!==void 0&&f.PageResponse.encode(O.pagination,J.uint32(18).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=m();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.denomOwners.push(e.DenomOwner.decode(ie,ie.uint32()));break;case 2:I.pagination=f.PageResponse.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{denomOwners:Array.isArray(O==null?void 0:O.denomOwners)?O.denomOwners.map(J=>e.DenomOwner.fromJSON(J)):[],pagination:(0,N.isSet)(O.pagination)?f.PageResponse.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.denomOwners?J.denomOwners=O.denomOwners.map(ie=>ie?e.DenomOwner.toJSON(ie):void 0):J.denomOwners=[],O.pagination!==void 0&&(J.pagination=O.pagination?f.PageResponse.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=m();return J.denomOwners=((ie=O.denomOwners)==null?void 0:ie.map(G=>e.DenomOwner.fromPartial(G)))||[],J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageResponse.fromPartial(O.pagination):void 0,J}};function h(){return{denoms:[],pagination:void 0}}e.QuerySendEnabledRequest={encode(O,J=w.Writer.create()){for(let ie of O.denoms)J.uint32(10).string(ie);return O.pagination!==void 0&&f.PageRequest.encode(O.pagination,J.uint32(794).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=h();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.denoms.push(ie.string());break;case 99:I.pagination=f.PageRequest.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{denoms:Array.isArray(O==null?void 0:O.denoms)?O.denoms.map(J=>String(J)):[],pagination:(0,N.isSet)(O.pagination)?f.PageRequest.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.denoms?J.denoms=O.denoms.map(ie=>ie):J.denoms=[],O.pagination!==void 0&&(J.pagination=O.pagination?f.PageRequest.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=h();return J.denoms=((ie=O.denoms)==null?void 0:ie.map(G=>G))||[],J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageRequest.fromPartial(O.pagination):void 0,J}};function _(){return{sendEnabled:[],pagination:void 0}}e.QuerySendEnabledResponse={encode(O,J=w.Writer.create()){for(let ie of O.sendEnabled)g.SendEnabled.encode(ie,J.uint32(10).fork()).ldelim();return O.pagination!==void 0&&f.PageResponse.encode(O.pagination,J.uint32(794).fork()).ldelim(),J},decode(O,J){let ie=O instanceof w.Reader?O:new w.Reader(O),G=J===void 0?ie.len:ie.pos+J,I=_();for(;ie.pos<G;){let C=ie.uint32();switch(C>>>3){case 1:I.sendEnabled.push(g.SendEnabled.decode(ie,ie.uint32()));break;case 99:I.pagination=f.PageResponse.decode(ie,ie.uint32());break;default:ie.skipType(C&7);break}}return I},fromJSON(O){return{sendEnabled:Array.isArray(O==null?void 0:O.sendEnabled)?O.sendEnabled.map(J=>g.SendEnabled.fromJSON(J)):[],pagination:(0,N.isSet)(O.pagination)?f.PageResponse.fromJSON(O.pagination):void 0}},toJSON(O){let J={};return O.sendEnabled?J.sendEnabled=O.sendEnabled.map(ie=>ie?g.SendEnabled.toJSON(ie):void 0):J.sendEnabled=[],O.pagination!==void 0&&(J.pagination=O.pagination?f.PageResponse.toJSON(O.pagination):void 0),J},fromPartial(O){var ie;let J=_();return J.sendEnabled=((ie=O.sendEnabled)==null?void 0:ie.map(G=>g.SendEnabled.fromPartial(G)))||[],J.pagination=O.pagination!==void 0&&O.pagination!==null?f.PageResponse.fromPartial(O.pagination):void 0,J}};class b{constructor(J){this.rpc=J,this.Balance=this.Balance.bind(this),this.AllBalances=this.AllBalances.bind(this),this.SpendableBalances=this.SpendableBalances.bind(this),this.SpendableBalanceByDenom=this.SpendableBalanceByDenom.bind(this),this.TotalSupply=this.TotalSupply.bind(this),this.SupplyOf=this.SupplyOf.bind(this),this.Params=this.Params.bind(this),this.DenomMetadata=this.DenomMetadata.bind(this),this.DenomsMetadata=this.DenomsMetadata.bind(this),this.DenomOwners=this.DenomOwners.bind(this),this.SendEnabled=this.SendEnabled.bind(this)}Balance(J){let ie=e.QueryBalanceRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","Balance",ie).then(I=>e.QueryBalanceResponse.decode(new w.Reader(I)))}AllBalances(J){let ie=e.QueryAllBalancesRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","AllBalances",ie).then(I=>e.QueryAllBalancesResponse.decode(new w.Reader(I)))}SpendableBalances(J){let ie=e.QuerySpendableBalancesRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","SpendableBalances",ie).then(I=>e.QuerySpendableBalancesResponse.decode(new w.Reader(I)))}SpendableBalanceByDenom(J){let ie=e.QuerySpendableBalanceByDenomRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","SpendableBalanceByDenom",ie).then(I=>e.QuerySpendableBalanceByDenomResponse.decode(new w.Reader(I)))}TotalSupply(J={pagination:void 0}){let ie=e.QueryTotalSupplyRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","TotalSupply",ie).then(I=>e.QueryTotalSupplyResponse.decode(new w.Reader(I)))}SupplyOf(J){let ie=e.QuerySupplyOfRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","SupplyOf",ie).then(I=>e.QuerySupplyOfResponse.decode(new w.Reader(I)))}Params(J={}){let ie=e.QueryParamsRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","Params",ie).then(I=>e.QueryParamsResponse.decode(new w.Reader(I)))}DenomMetadata(J){let ie=e.QueryDenomMetadataRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","DenomMetadata",ie).then(I=>e.QueryDenomMetadataResponse.decode(new w.Reader(I)))}DenomsMetadata(J={pagination:void 0}){let ie=e.QueryDenomsMetadataRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","DenomsMetadata",ie).then(I=>e.QueryDenomsMetadataResponse.decode(new w.Reader(I)))}DenomOwners(J){let ie=e.QueryDenomOwnersRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","DenomOwners",ie).then(I=>e.QueryDenomOwnersResponse.decode(new w.Reader(I)))}SendEnabled(J){let ie=e.QuerySendEnabledRequest.encode(J).finish();return this.rpc.request("cosmos.bank.v1beta1.Query","SendEnabled",ie).then(I=>e.QuerySendEnabledResponse.decode(new w.Reader(I)))}}e.QueryClientImpl=b})(C$r);Object.defineProperty(nvt,"__esModule",{value:!0});nvt.setupBankExtension=void 0;var k2n=O3,x6s=C$r,uLr=Rw;function M6s(e){let i=(0,uLr.createProtobufRpcClient)(e),A=new x6s.QueryClientImpl(i);return{bank:{balance:(c,f)=>Jt(this,null,function*(){let{balance:l}=yield A.Balance({address:c,denom:f});return(0,k2n.assert)(l),l}),allBalances:c=>Jt(this,null,function*(){let{balances:f}=yield A.AllBalances({address:c});return f}),totalSupply:c=>Jt(this,null,function*(){return yield A.TotalSupply({pagination:(0,uLr.createPagination)(c)})}),supplyOf:c=>Jt(this,null,function*(){let{amount:f}=yield A.SupplyOf({denom:c});return(0,k2n.assert)(f),f}),denomMetadata:c=>Jt(this,null,function*(){let{metadata:f}=yield A.DenomMetadata({denom:c});return(0,k2n.assert)(f),f}),denomsMetadata:()=>Jt(this,null,function*(){let{metadatas:c}=yield A.DenomsMetadata({pagination:void 0});return c})}}}nvt.setupBankExtension=M6s;var dSe={};Object.defineProperty(dSe,"__esModule",{value:!0});dSe.createCrysisAminoConverters=dSe.isAminoMsgVerifyInvariant=void 0;function T6s(e){return e.type==="cosmos-sdk/MsgVerifyInvariant"}dSe.isAminoMsgVerifyInvariant=T6s;function U6s(){throw new Error("Not implemented")}dSe.createCrysisAminoConverters=U6s;var hM={};Object.defineProperty(hM,"__esModule",{value:!0});hM.createDistributionAminoConverters=hM.isAminoMsgFundCommunityPool=hM.isAminoMsgWithdrawValidatorCommission=hM.isAminoMsgWithdrawDelegatorReward=hM.isAminoMsgSetWithdrawAddress=void 0;function F6s(e){return e.type==="cosmos-sdk/MsgModifyWithdrawAddress"}hM.isAminoMsgSetWithdrawAddress=F6s;function J6s(e){return e.type==="cosmos-sdk/MsgWithdrawDelegationReward"}hM.isAminoMsgWithdrawDelegatorReward=J6s;function H6s(e){return e.type==="cosmos-sdk/MsgWithdrawValidatorCommission"}hM.isAminoMsgWithdrawValidatorCommission=H6s;function L6s(e){return e.type==="cosmos-sdk/MsgFundCommunityPool"}hM.isAminoMsgFundCommunityPool=L6s;function G6s(){return{"/cosmos.distribution.v1beta1.MsgFundCommunityPool":{aminoType:"cosmos-sdk/MsgFundCommunityPool",toAmino:({amount:e,depositor:i})=>({amount:[...e],depositor:i}),fromAmino:({amount:e,depositor:i})=>({amount:[...e],depositor:i})},"/cosmos.distribution.v1beta1.MsgSetWithdrawAddress":{aminoType:"cosmos-sdk/MsgModifyWithdrawAddress",toAmino:({delegatorAddress:e,withdrawAddress:i})=>({delegator_address:e,withdraw_address:i}),fromAmino:({delegator_address:e,withdraw_address:i})=>({delegatorAddress:e,withdrawAddress:i})},"/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward":{aminoType:"cosmos-sdk/MsgWithdrawDelegationReward",toAmino:({delegatorAddress:e,validatorAddress:i})=>({delegator_address:e,validator_address:i}),fromAmino:({delegator_address:e,validator_address:i})=>({delegatorAddress:e,validatorAddress:i})},"/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission":{aminoType:"cosmos-sdk/MsgWithdrawValidatorCommission",toAmino:({validatorAddress:e})=>({validator_address:e}),fromAmino:({validator_address:e})=>({validatorAddress:e})}}}hM.createDistributionAminoConverters=G6s;var cSe={},yIn={},mIn={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(Q,H,re,ee){ee===void 0&&(ee=re);var T=Object.getOwnPropertyDescriptor(H,re);(!T||("get"in T?!H.__esModule:T.writable||T.configurable))&&(T={enumerable:!0,get:function(){return H[re]}}),Object.defineProperty(Q,ee,T)}:function(Q,H,re,ee){ee===void 0&&(ee=re),Q[ee]=H[re]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(Q,H){Object.defineProperty(Q,"default",{enumerable:!0,value:H})}:function(Q,H){Q.default=H}),c=Fr&&Fr.__importStar||function(Q){if(Q&&Q.__esModule)return Q;var H={};if(Q!=null)for(var re in Q)re!=="default"&&Object.prototype.hasOwnProperty.call(Q,re)&&i(H,Q,re);return A(H,Q),H};Object.defineProperty(e,"__esModule",{value:!0}),e.CommunityPoolSpendProposalWithDeposit=e.DelegationDelegatorReward=e.DelegatorStartingInfo=e.CommunityPoolSpendProposal=e.FeePool=e.ValidatorSlashEvents=e.ValidatorSlashEvent=e.ValidatorOutstandingRewards=e.ValidatorAccumulatedCommission=e.ValidatorCurrentRewards=e.ValidatorHistoricalRewards=e.Params=e.protobufPackage=void 0;let f=gg,l=Ns,g=c(BA);e.protobufPackage="cosmos.distribution.v1beta1";function w(){return{communityTax:"",baseProposerReward:"",bonusProposerReward:"",withdrawAddrEnabled:!1}}e.Params={encode(Q,H=g.Writer.create()){return Q.communityTax!==""&&H.uint32(10).string(Q.communityTax),Q.baseProposerReward!==""&&H.uint32(18).string(Q.baseProposerReward),Q.bonusProposerReward!==""&&H.uint32(26).string(Q.bonusProposerReward),Q.withdrawAddrEnabled===!0&&H.uint32(32).bool(Q.withdrawAddrEnabled),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=w();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.communityTax=re.string();break;case 2:T.baseProposerReward=re.string();break;case 3:T.bonusProposerReward=re.string();break;case 4:T.withdrawAddrEnabled=re.bool();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{communityTax:(0,l.isSet)(Q.communityTax)?String(Q.communityTax):"",baseProposerReward:(0,l.isSet)(Q.baseProposerReward)?String(Q.baseProposerReward):"",bonusProposerReward:(0,l.isSet)(Q.bonusProposerReward)?String(Q.bonusProposerReward):"",withdrawAddrEnabled:(0,l.isSet)(Q.withdrawAddrEnabled)?!!Q.withdrawAddrEnabled:!1}},toJSON(Q){let H={};return Q.communityTax!==void 0&&(H.communityTax=Q.communityTax),Q.baseProposerReward!==void 0&&(H.baseProposerReward=Q.baseProposerReward),Q.bonusProposerReward!==void 0&&(H.bonusProposerReward=Q.bonusProposerReward),Q.withdrawAddrEnabled!==void 0&&(H.withdrawAddrEnabled=Q.withdrawAddrEnabled),H},fromPartial(Q){var re,ee,T,se;let H=w();return H.communityTax=(re=Q.communityTax)!=null?re:"",H.baseProposerReward=(ee=Q.baseProposerReward)!=null?ee:"",H.bonusProposerReward=(T=Q.bonusProposerReward)!=null?T:"",H.withdrawAddrEnabled=(se=Q.withdrawAddrEnabled)!=null?se:!1,H}};function N(){return{cumulativeRewardRatio:[],referenceCount:0}}e.ValidatorHistoricalRewards={encode(Q,H=g.Writer.create()){for(let re of Q.cumulativeRewardRatio)f.DecCoin.encode(re,H.uint32(10).fork()).ldelim();return Q.referenceCount!==0&&H.uint32(16).uint32(Q.referenceCount),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=N();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.cumulativeRewardRatio.push(f.DecCoin.decode(re,re.uint32()));break;case 2:T.referenceCount=re.uint32();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{cumulativeRewardRatio:Array.isArray(Q==null?void 0:Q.cumulativeRewardRatio)?Q.cumulativeRewardRatio.map(H=>f.DecCoin.fromJSON(H)):[],referenceCount:(0,l.isSet)(Q.referenceCount)?Number(Q.referenceCount):0}},toJSON(Q){let H={};return Q.cumulativeRewardRatio?H.cumulativeRewardRatio=Q.cumulativeRewardRatio.map(re=>re?f.DecCoin.toJSON(re):void 0):H.cumulativeRewardRatio=[],Q.referenceCount!==void 0&&(H.referenceCount=Math.round(Q.referenceCount)),H},fromPartial(Q){var re,ee;let H=N();return H.cumulativeRewardRatio=((re=Q.cumulativeRewardRatio)==null?void 0:re.map(T=>f.DecCoin.fromPartial(T)))||[],H.referenceCount=(ee=Q.referenceCount)!=null?ee:0,H}};function F(){return{rewards:[],period:l.Long.UZERO}}e.ValidatorCurrentRewards={encode(Q,H=g.Writer.create()){for(let re of Q.rewards)f.DecCoin.encode(re,H.uint32(10).fork()).ldelim();return Q.period.isZero()||H.uint32(16).uint64(Q.period),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=F();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.rewards.push(f.DecCoin.decode(re,re.uint32()));break;case 2:T.period=re.uint64();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{rewards:Array.isArray(Q==null?void 0:Q.rewards)?Q.rewards.map(H=>f.DecCoin.fromJSON(H)):[],period:(0,l.isSet)(Q.period)?l.Long.fromValue(Q.period):l.Long.UZERO}},toJSON(Q){let H={};return Q.rewards?H.rewards=Q.rewards.map(re=>re?f.DecCoin.toJSON(re):void 0):H.rewards=[],Q.period!==void 0&&(H.period=(Q.period||l.Long.UZERO).toString()),H},fromPartial(Q){var re;let H=F();return H.rewards=((re=Q.rewards)==null?void 0:re.map(ee=>f.DecCoin.fromPartial(ee)))||[],H.period=Q.period!==void 0&&Q.period!==null?l.Long.fromValue(Q.period):l.Long.UZERO,H}};function j(){return{commission:[]}}e.ValidatorAccumulatedCommission={encode(Q,H=g.Writer.create()){for(let re of Q.commission)f.DecCoin.encode(re,H.uint32(10).fork()).ldelim();return H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=j();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.commission.push(f.DecCoin.decode(re,re.uint32()));break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{commission:Array.isArray(Q==null?void 0:Q.commission)?Q.commission.map(H=>f.DecCoin.fromJSON(H)):[]}},toJSON(Q){let H={};return Q.commission?H.commission=Q.commission.map(re=>re?f.DecCoin.toJSON(re):void 0):H.commission=[],H},fromPartial(Q){var re;let H=j();return H.commission=((re=Q.commission)==null?void 0:re.map(ee=>f.DecCoin.fromPartial(ee)))||[],H}};function te(){return{rewards:[]}}e.ValidatorOutstandingRewards={encode(Q,H=g.Writer.create()){for(let re of Q.rewards)f.DecCoin.encode(re,H.uint32(10).fork()).ldelim();return H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=te();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.rewards.push(f.DecCoin.decode(re,re.uint32()));break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{rewards:Array.isArray(Q==null?void 0:Q.rewards)?Q.rewards.map(H=>f.DecCoin.fromJSON(H)):[]}},toJSON(Q){let H={};return Q.rewards?H.rewards=Q.rewards.map(re=>re?f.DecCoin.toJSON(re):void 0):H.rewards=[],H},fromPartial(Q){var re;let H=te();return H.rewards=((re=Q.rewards)==null?void 0:re.map(ee=>f.DecCoin.fromPartial(ee)))||[],H}};function v(){return{validatorPeriod:l.Long.UZERO,fraction:""}}e.ValidatorSlashEvent={encode(Q,H=g.Writer.create()){return Q.validatorPeriod.isZero()||H.uint32(8).uint64(Q.validatorPeriod),Q.fraction!==""&&H.uint32(18).string(Q.fraction),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=v();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.validatorPeriod=re.uint64();break;case 2:T.fraction=re.string();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{validatorPeriod:(0,l.isSet)(Q.validatorPeriod)?l.Long.fromValue(Q.validatorPeriod):l.Long.UZERO,fraction:(0,l.isSet)(Q.fraction)?String(Q.fraction):""}},toJSON(Q){let H={};return Q.validatorPeriod!==void 0&&(H.validatorPeriod=(Q.validatorPeriod||l.Long.UZERO).toString()),Q.fraction!==void 0&&(H.fraction=Q.fraction),H},fromPartial(Q){var re;let H=v();return H.validatorPeriod=Q.validatorPeriod!==void 0&&Q.validatorPeriod!==null?l.Long.fromValue(Q.validatorPeriod):l.Long.UZERO,H.fraction=(re=Q.fraction)!=null?re:"",H}};function ne(){return{validatorSlashEvents:[]}}e.ValidatorSlashEvents={encode(Q,H=g.Writer.create()){for(let re of Q.validatorSlashEvents)e.ValidatorSlashEvent.encode(re,H.uint32(10).fork()).ldelim();return H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=ne();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.validatorSlashEvents.push(e.ValidatorSlashEvent.decode(re,re.uint32()));break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{validatorSlashEvents:Array.isArray(Q==null?void 0:Q.validatorSlashEvents)?Q.validatorSlashEvents.map(H=>e.ValidatorSlashEvent.fromJSON(H)):[]}},toJSON(Q){let H={};return Q.validatorSlashEvents?H.validatorSlashEvents=Q.validatorSlashEvents.map(re=>re?e.ValidatorSlashEvent.toJSON(re):void 0):H.validatorSlashEvents=[],H},fromPartial(Q){var re;let H=ne();return H.validatorSlashEvents=((re=Q.validatorSlashEvents)==null?void 0:re.map(ee=>e.ValidatorSlashEvent.fromPartial(ee)))||[],H}};function Z(){return{communityPool:[]}}e.FeePool={encode(Q,H=g.Writer.create()){for(let re of Q.communityPool)f.DecCoin.encode(re,H.uint32(10).fork()).ldelim();return H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=Z();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.communityPool.push(f.DecCoin.decode(re,re.uint32()));break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{communityPool:Array.isArray(Q==null?void 0:Q.communityPool)?Q.communityPool.map(H=>f.DecCoin.fromJSON(H)):[]}},toJSON(Q){let H={};return Q.communityPool?H.communityPool=Q.communityPool.map(re=>re?f.DecCoin.toJSON(re):void 0):H.communityPool=[],H},fromPartial(Q){var re;let H=Z();return H.communityPool=((re=Q.communityPool)==null?void 0:re.map(ee=>f.DecCoin.fromPartial(ee)))||[],H}};function R(){return{title:"",description:"",recipient:"",amount:[]}}e.CommunityPoolSpendProposal={encode(Q,H=g.Writer.create()){Q.title!==""&&H.uint32(10).string(Q.title),Q.description!==""&&H.uint32(18).string(Q.description),Q.recipient!==""&&H.uint32(26).string(Q.recipient);for(let re of Q.amount)f.Coin.encode(re,H.uint32(34).fork()).ldelim();return H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=R();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.title=re.string();break;case 2:T.description=re.string();break;case 3:T.recipient=re.string();break;case 4:T.amount.push(f.Coin.decode(re,re.uint32()));break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{title:(0,l.isSet)(Q.title)?String(Q.title):"",description:(0,l.isSet)(Q.description)?String(Q.description):"",recipient:(0,l.isSet)(Q.recipient)?String(Q.recipient):"",amount:Array.isArray(Q==null?void 0:Q.amount)?Q.amount.map(H=>f.Coin.fromJSON(H)):[]}},toJSON(Q){let H={};return Q.title!==void 0&&(H.title=Q.title),Q.description!==void 0&&(H.description=Q.description),Q.recipient!==void 0&&(H.recipient=Q.recipient),Q.amount?H.amount=Q.amount.map(re=>re?f.Coin.toJSON(re):void 0):H.amount=[],H},fromPartial(Q){var re,ee,T,se;let H=R();return H.title=(re=Q.title)!=null?re:"",H.description=(ee=Q.description)!=null?ee:"",H.recipient=(T=Q.recipient)!=null?T:"",H.amount=((se=Q.amount)==null?void 0:se.map(p=>f.Coin.fromPartial(p)))||[],H}};function M(){return{previousPeriod:l.Long.UZERO,stake:"",height:l.Long.UZERO}}e.DelegatorStartingInfo={encode(Q,H=g.Writer.create()){return Q.previousPeriod.isZero()||H.uint32(8).uint64(Q.previousPeriod),Q.stake!==""&&H.uint32(18).string(Q.stake),Q.height.isZero()||H.uint32(24).uint64(Q.height),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=M();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.previousPeriod=re.uint64();break;case 2:T.stake=re.string();break;case 3:T.height=re.uint64();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{previousPeriod:(0,l.isSet)(Q.previousPeriod)?l.Long.fromValue(Q.previousPeriod):l.Long.UZERO,stake:(0,l.isSet)(Q.stake)?String(Q.stake):"",height:(0,l.isSet)(Q.height)?l.Long.fromValue(Q.height):l.Long.UZERO}},toJSON(Q){let H={};return Q.previousPeriod!==void 0&&(H.previousPeriod=(Q.previousPeriod||l.Long.UZERO).toString()),Q.stake!==void 0&&(H.stake=Q.stake),Q.height!==void 0&&(H.height=(Q.height||l.Long.UZERO).toString()),H},fromPartial(Q){var re;let H=M();return H.previousPeriod=Q.previousPeriod!==void 0&&Q.previousPeriod!==null?l.Long.fromValue(Q.previousPeriod):l.Long.UZERO,H.stake=(re=Q.stake)!=null?re:"",H.height=Q.height!==void 0&&Q.height!==null?l.Long.fromValue(Q.height):l.Long.UZERO,H}};function U(){return{validatorAddress:"",reward:[]}}e.DelegationDelegatorReward={encode(Q,H=g.Writer.create()){Q.validatorAddress!==""&&H.uint32(10).string(Q.validatorAddress);for(let re of Q.reward)f.DecCoin.encode(re,H.uint32(18).fork()).ldelim();return H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=U();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.validatorAddress=re.string();break;case 2:T.reward.push(f.DecCoin.decode(re,re.uint32()));break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{validatorAddress:(0,l.isSet)(Q.validatorAddress)?String(Q.validatorAddress):"",reward:Array.isArray(Q==null?void 0:Q.reward)?Q.reward.map(H=>f.DecCoin.fromJSON(H)):[]}},toJSON(Q){let H={};return Q.validatorAddress!==void 0&&(H.validatorAddress=Q.validatorAddress),Q.reward?H.reward=Q.reward.map(re=>re?f.DecCoin.toJSON(re):void 0):H.reward=[],H},fromPartial(Q){var re,ee;let H=U();return H.validatorAddress=(re=Q.validatorAddress)!=null?re:"",H.reward=((ee=Q.reward)==null?void 0:ee.map(T=>f.DecCoin.fromPartial(T)))||[],H}};function E(){return{title:"",description:"",recipient:"",amount:"",deposit:""}}e.CommunityPoolSpendProposalWithDeposit={encode(Q,H=g.Writer.create()){return Q.title!==""&&H.uint32(10).string(Q.title),Q.description!==""&&H.uint32(18).string(Q.description),Q.recipient!==""&&H.uint32(26).string(Q.recipient),Q.amount!==""&&H.uint32(34).string(Q.amount),Q.deposit!==""&&H.uint32(42).string(Q.deposit),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=E();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.title=re.string();break;case 2:T.description=re.string();break;case 3:T.recipient=re.string();break;case 4:T.amount=re.string();break;case 5:T.deposit=re.string();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{title:(0,l.isSet)(Q.title)?String(Q.title):"",description:(0,l.isSet)(Q.description)?String(Q.description):"",recipient:(0,l.isSet)(Q.recipient)?String(Q.recipient):"",amount:(0,l.isSet)(Q.amount)?String(Q.amount):"",deposit:(0,l.isSet)(Q.deposit)?String(Q.deposit):""}},toJSON(Q){let H={};return Q.title!==void 0&&(H.title=Q.title),Q.description!==void 0&&(H.description=Q.description),Q.recipient!==void 0&&(H.recipient=Q.recipient),Q.amount!==void 0&&(H.amount=Q.amount),Q.deposit!==void 0&&(H.deposit=Q.deposit),H},fromPartial(Q){var re,ee,T,se,p;let H=E();return H.title=(re=Q.title)!=null?re:"",H.description=(ee=Q.description)!=null?ee:"",H.recipient=(T=Q.recipient)!=null?T:"",H.amount=(se=Q.amount)!=null?se:"",H.deposit=(p=Q.deposit)!=null?p:"",H}}})(mIn);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(re,ee,T,se){se===void 0&&(se=T);var p=Object.getOwnPropertyDescriptor(ee,T);(!p||("get"in p?!ee.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return ee[T]}}),Object.defineProperty(re,se,p)}:function(re,ee,T,se){se===void 0&&(se=T),re[se]=ee[T]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(re,ee){Object.defineProperty(re,"default",{enumerable:!0,value:ee})}:function(re,ee){re.default=ee}),c=Fr&&Fr.__importStar||function(re){if(re&&re.__esModule)return re;var ee={};if(re!=null)for(var T in re)T!=="default"&&Object.prototype.hasOwnProperty.call(re,T)&&i(ee,re,T);return A(ee,re),ee};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgCommunityPoolSpendResponse=e.MsgCommunityPoolSpend=e.MsgUpdateParamsResponse=e.MsgUpdateParams=e.MsgFundCommunityPoolResponse=e.MsgFundCommunityPool=e.MsgWithdrawValidatorCommissionResponse=e.MsgWithdrawValidatorCommission=e.MsgWithdrawDelegatorRewardResponse=e.MsgWithdrawDelegatorReward=e.MsgSetWithdrawAddressResponse=e.MsgSetWithdrawAddress=e.protobufPackage=void 0;let f=gg,l=mIn,g=c(BA),w=Ns;e.protobufPackage="cosmos.distribution.v1beta1";function N(){return{delegatorAddress:"",withdrawAddress:""}}e.MsgSetWithdrawAddress={encode(re,ee=g.Writer.create()){return re.delegatorAddress!==""&&ee.uint32(10).string(re.delegatorAddress),re.withdrawAddress!==""&&ee.uint32(18).string(re.withdrawAddress),ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=N();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){case 1:p.delegatorAddress=T.string();break;case 2:p.withdrawAddress=T.string();break;default:T.skipType(L&7);break}}return p},fromJSON(re){return{delegatorAddress:(0,w.isSet)(re.delegatorAddress)?String(re.delegatorAddress):"",withdrawAddress:(0,w.isSet)(re.withdrawAddress)?String(re.withdrawAddress):""}},toJSON(re){let ee={};return re.delegatorAddress!==void 0&&(ee.delegatorAddress=re.delegatorAddress),re.withdrawAddress!==void 0&&(ee.withdrawAddress=re.withdrawAddress),ee},fromPartial(re){var T,se;let ee=N();return ee.delegatorAddress=(T=re.delegatorAddress)!=null?T:"",ee.withdrawAddress=(se=re.withdrawAddress)!=null?se:"",ee}};function F(){return{}}e.MsgSetWithdrawAddressResponse={encode(re,ee=g.Writer.create()){return ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=F();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){default:T.skipType(L&7);break}}return p},fromJSON(re){return{}},toJSON(re){return{}},fromPartial(re){return F()}};function j(){return{delegatorAddress:"",validatorAddress:""}}e.MsgWithdrawDelegatorReward={encode(re,ee=g.Writer.create()){return re.delegatorAddress!==""&&ee.uint32(10).string(re.delegatorAddress),re.validatorAddress!==""&&ee.uint32(18).string(re.validatorAddress),ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=j();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){case 1:p.delegatorAddress=T.string();break;case 2:p.validatorAddress=T.string();break;default:T.skipType(L&7);break}}return p},fromJSON(re){return{delegatorAddress:(0,w.isSet)(re.delegatorAddress)?String(re.delegatorAddress):"",validatorAddress:(0,w.isSet)(re.validatorAddress)?String(re.validatorAddress):""}},toJSON(re){let ee={};return re.delegatorAddress!==void 0&&(ee.delegatorAddress=re.delegatorAddress),re.validatorAddress!==void 0&&(ee.validatorAddress=re.validatorAddress),ee},fromPartial(re){var T,se;let ee=j();return ee.delegatorAddress=(T=re.delegatorAddress)!=null?T:"",ee.validatorAddress=(se=re.validatorAddress)!=null?se:"",ee}};function te(){return{amount:[]}}e.MsgWithdrawDelegatorRewardResponse={encode(re,ee=g.Writer.create()){for(let T of re.amount)f.Coin.encode(T,ee.uint32(10).fork()).ldelim();return ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=te();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){case 1:p.amount.push(f.Coin.decode(T,T.uint32()));break;default:T.skipType(L&7);break}}return p},fromJSON(re){return{amount:Array.isArray(re==null?void 0:re.amount)?re.amount.map(ee=>f.Coin.fromJSON(ee)):[]}},toJSON(re){let ee={};return re.amount?ee.amount=re.amount.map(T=>T?f.Coin.toJSON(T):void 0):ee.amount=[],ee},fromPartial(re){var T;let ee=te();return ee.amount=((T=re.amount)==null?void 0:T.map(se=>f.Coin.fromPartial(se)))||[],ee}};function v(){return{validatorAddress:""}}e.MsgWithdrawValidatorCommission={encode(re,ee=g.Writer.create()){return re.validatorAddress!==""&&ee.uint32(10).string(re.validatorAddress),ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=v();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){case 1:p.validatorAddress=T.string();break;default:T.skipType(L&7);break}}return p},fromJSON(re){return{validatorAddress:(0,w.isSet)(re.validatorAddress)?String(re.validatorAddress):""}},toJSON(re){let ee={};return re.validatorAddress!==void 0&&(ee.validatorAddress=re.validatorAddress),ee},fromPartial(re){var T;let ee=v();return ee.validatorAddress=(T=re.validatorAddress)!=null?T:"",ee}};function ne(){return{amount:[]}}e.MsgWithdrawValidatorCommissionResponse={encode(re,ee=g.Writer.create()){for(let T of re.amount)f.Coin.encode(T,ee.uint32(10).fork()).ldelim();return ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=ne();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){case 1:p.amount.push(f.Coin.decode(T,T.uint32()));break;default:T.skipType(L&7);break}}return p},fromJSON(re){return{amount:Array.isArray(re==null?void 0:re.amount)?re.amount.map(ee=>f.Coin.fromJSON(ee)):[]}},toJSON(re){let ee={};return re.amount?ee.amount=re.amount.map(T=>T?f.Coin.toJSON(T):void 0):ee.amount=[],ee},fromPartial(re){var T;let ee=ne();return ee.amount=((T=re.amount)==null?void 0:T.map(se=>f.Coin.fromPartial(se)))||[],ee}};function Z(){return{amount:[],depositor:""}}e.MsgFundCommunityPool={encode(re,ee=g.Writer.create()){for(let T of re.amount)f.Coin.encode(T,ee.uint32(10).fork()).ldelim();return re.depositor!==""&&ee.uint32(18).string(re.depositor),ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=Z();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){case 1:p.amount.push(f.Coin.decode(T,T.uint32()));break;case 2:p.depositor=T.string();break;default:T.skipType(L&7);break}}return p},fromJSON(re){return{amount:Array.isArray(re==null?void 0:re.amount)?re.amount.map(ee=>f.Coin.fromJSON(ee)):[],depositor:(0,w.isSet)(re.depositor)?String(re.depositor):""}},toJSON(re){let ee={};return re.amount?ee.amount=re.amount.map(T=>T?f.Coin.toJSON(T):void 0):ee.amount=[],re.depositor!==void 0&&(ee.depositor=re.depositor),ee},fromPartial(re){var T,se;let ee=Z();return ee.amount=((T=re.amount)==null?void 0:T.map(p=>f.Coin.fromPartial(p)))||[],ee.depositor=(se=re.depositor)!=null?se:"",ee}};function R(){return{}}e.MsgFundCommunityPoolResponse={encode(re,ee=g.Writer.create()){return ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=R();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){default:T.skipType(L&7);break}}return p},fromJSON(re){return{}},toJSON(re){return{}},fromPartial(re){return R()}};function M(){return{authority:"",params:void 0}}e.MsgUpdateParams={encode(re,ee=g.Writer.create()){return re.authority!==""&&ee.uint32(10).string(re.authority),re.params!==void 0&&l.Params.encode(re.params,ee.uint32(18).fork()).ldelim(),ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=M();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){case 1:p.authority=T.string();break;case 2:p.params=l.Params.decode(T,T.uint32());break;default:T.skipType(L&7);break}}return p},fromJSON(re){return{authority:(0,w.isSet)(re.authority)?String(re.authority):"",params:(0,w.isSet)(re.params)?l.Params.fromJSON(re.params):void 0}},toJSON(re){let ee={};return re.authority!==void 0&&(ee.authority=re.authority),re.params!==void 0&&(ee.params=re.params?l.Params.toJSON(re.params):void 0),ee},fromPartial(re){var T;let ee=M();return ee.authority=(T=re.authority)!=null?T:"",ee.params=re.params!==void 0&&re.params!==null?l.Params.fromPartial(re.params):void 0,ee}};function U(){return{}}e.MsgUpdateParamsResponse={encode(re,ee=g.Writer.create()){return ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=U();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){default:T.skipType(L&7);break}}return p},fromJSON(re){return{}},toJSON(re){return{}},fromPartial(re){return U()}};function E(){return{authority:"",recipient:"",amount:[]}}e.MsgCommunityPoolSpend={encode(re,ee=g.Writer.create()){re.authority!==""&&ee.uint32(10).string(re.authority),re.recipient!==""&&ee.uint32(18).string(re.recipient);for(let T of re.amount)f.Coin.encode(T,ee.uint32(26).fork()).ldelim();return ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=E();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){case 1:p.authority=T.string();break;case 2:p.recipient=T.string();break;case 3:p.amount.push(f.Coin.decode(T,T.uint32()));break;default:T.skipType(L&7);break}}return p},fromJSON(re){return{authority:(0,w.isSet)(re.authority)?String(re.authority):"",recipient:(0,w.isSet)(re.recipient)?String(re.recipient):"",amount:Array.isArray(re==null?void 0:re.amount)?re.amount.map(ee=>f.Coin.fromJSON(ee)):[]}},toJSON(re){let ee={};return re.authority!==void 0&&(ee.authority=re.authority),re.recipient!==void 0&&(ee.recipient=re.recipient),re.amount?ee.amount=re.amount.map(T=>T?f.Coin.toJSON(T):void 0):ee.amount=[],ee},fromPartial(re){var T,se,p;let ee=E();return ee.authority=(T=re.authority)!=null?T:"",ee.recipient=(se=re.recipient)!=null?se:"",ee.amount=((p=re.amount)==null?void 0:p.map(L=>f.Coin.fromPartial(L)))||[],ee}};function Q(){return{}}e.MsgCommunityPoolSpendResponse={encode(re,ee=g.Writer.create()){return ee},decode(re,ee){let T=re instanceof g.Reader?re:new g.Reader(re),se=ee===void 0?T.len:T.pos+ee,p=Q();for(;T.pos<se;){let L=T.uint32();switch(L>>>3){default:T.skipType(L&7);break}}return p},fromJSON(re){return{}},toJSON(re){return{}},fromPartial(re){return Q()}};class H{constructor(ee){this.rpc=ee,this.SetWithdrawAddress=this.SetWithdrawAddress.bind(this),this.WithdrawDelegatorReward=this.WithdrawDelegatorReward.bind(this),this.WithdrawValidatorCommission=this.WithdrawValidatorCommission.bind(this),this.FundCommunityPool=this.FundCommunityPool.bind(this),this.UpdateParams=this.UpdateParams.bind(this),this.CommunityPoolSpend=this.CommunityPoolSpend.bind(this)}SetWithdrawAddress(ee){let T=e.MsgSetWithdrawAddress.encode(ee).finish();return this.rpc.request("cosmos.distribution.v1beta1.Msg","SetWithdrawAddress",T).then(p=>e.MsgSetWithdrawAddressResponse.decode(new g.Reader(p)))}WithdrawDelegatorReward(ee){let T=e.MsgWithdrawDelegatorReward.encode(ee).finish();return this.rpc.request("cosmos.distribution.v1beta1.Msg","WithdrawDelegatorReward",T).then(p=>e.MsgWithdrawDelegatorRewardResponse.decode(new g.Reader(p)))}WithdrawValidatorCommission(ee){let T=e.MsgWithdrawValidatorCommission.encode(ee).finish();return this.rpc.request("cosmos.distribution.v1beta1.Msg","WithdrawValidatorCommission",T).then(p=>e.MsgWithdrawValidatorCommissionResponse.decode(new g.Reader(p)))}FundCommunityPool(ee){let T=e.MsgFundCommunityPool.encode(ee).finish();return this.rpc.request("cosmos.distribution.v1beta1.Msg","FundCommunityPool",T).then(p=>e.MsgFundCommunityPoolResponse.decode(new g.Reader(p)))}UpdateParams(ee){let T=e.MsgUpdateParams.encode(ee).finish();return this.rpc.request("cosmos.distribution.v1beta1.Msg","UpdateParams",T).then(p=>e.MsgUpdateParamsResponse.decode(new g.Reader(p)))}CommunityPoolSpend(ee){let T=e.MsgCommunityPoolSpend.encode(ee).finish();return this.rpc.request("cosmos.distribution.v1beta1.Msg","CommunityPoolSpend",T).then(p=>e.MsgCommunityPoolSpendResponse.decode(new g.Reader(p)))}}e.MsgClientImpl=H})(yIn);Object.defineProperty(cSe,"__esModule",{value:!0});cSe.isMsgWithdrawDelegatorRewardEncodeObject=cSe.distributionTypes=void 0;var E3t=yIn;cSe.distributionTypes=[["/cosmos.distribution.v1beta1.MsgFundCommunityPool",E3t.MsgFundCommunityPool],["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress",E3t.MsgSetWithdrawAddress],["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",E3t.MsgWithdrawDelegatorReward],["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission",E3t.MsgWithdrawValidatorCommission]];function q6s(e){return e.typeUrl==="/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"}cSe.isMsgWithdrawDelegatorRewardEncodeObject=q6s;var rvt={},_$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(h,_,b,O){O===void 0&&(O=b);var J=Object.getOwnPropertyDescriptor(_,b);(!J||("get"in J?!_.__esModule:J.writable||J.configurable))&&(J={enumerable:!0,get:function(){return _[b]}}),Object.defineProperty(h,O,J)}:function(h,_,b,O){O===void 0&&(O=b),h[O]=_[b]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(h,_){Object.defineProperty(h,"default",{enumerable:!0,value:_})}:function(h,_){h.default=_}),c=Fr&&Fr.__importStar||function(h){if(h&&h.__esModule)return h;var _={};if(h!=null)for(var b in h)b!=="default"&&Object.prototype.hasOwnProperty.call(h,b)&&i(_,h,b);return A(_,h),_};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryCommunityPoolResponse=e.QueryCommunityPoolRequest=e.QueryDelegatorWithdrawAddressResponse=e.QueryDelegatorWithdrawAddressRequest=e.QueryDelegatorValidatorsResponse=e.QueryDelegatorValidatorsRequest=e.QueryDelegationTotalRewardsResponse=e.QueryDelegationTotalRewardsRequest=e.QueryDelegationRewardsResponse=e.QueryDelegationRewardsRequest=e.QueryValidatorSlashesResponse=e.QueryValidatorSlashesRequest=e.QueryValidatorCommissionResponse=e.QueryValidatorCommissionRequest=e.QueryValidatorOutstandingRewardsResponse=e.QueryValidatorOutstandingRewardsRequest=e.QueryValidatorDistributionInfoResponse=e.QueryValidatorDistributionInfoRequest=e.QueryParamsResponse=e.QueryParamsRequest=e.protobufPackage=void 0;let f=Hm,l=mIn,g=gg,w=Ns,N=c(BA);e.protobufPackage="cosmos.distribution.v1beta1";function F(){return{}}e.QueryParamsRequest={encode(h,_=N.Writer.create()){return _},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=F();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){default:b.skipType(ie&7);break}}return J},fromJSON(h){return{}},toJSON(h){return{}},fromPartial(h){return F()}};function j(){return{params:void 0}}e.QueryParamsResponse={encode(h,_=N.Writer.create()){return h.params!==void 0&&l.Params.encode(h.params,_.uint32(10).fork()).ldelim(),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=j();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.params=l.Params.decode(b,b.uint32());break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{params:(0,w.isSet)(h.params)?l.Params.fromJSON(h.params):void 0}},toJSON(h){let _={};return h.params!==void 0&&(_.params=h.params?l.Params.toJSON(h.params):void 0),_},fromPartial(h){let _=j();return _.params=h.params!==void 0&&h.params!==null?l.Params.fromPartial(h.params):void 0,_}};function te(){return{validatorAddress:""}}e.QueryValidatorDistributionInfoRequest={encode(h,_=N.Writer.create()){return h.validatorAddress!==""&&_.uint32(10).string(h.validatorAddress),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=te();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.validatorAddress=b.string();break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{validatorAddress:(0,w.isSet)(h.validatorAddress)?String(h.validatorAddress):""}},toJSON(h){let _={};return h.validatorAddress!==void 0&&(_.validatorAddress=h.validatorAddress),_},fromPartial(h){var b;let _=te();return _.validatorAddress=(b=h.validatorAddress)!=null?b:"",_}};function v(){return{operatorAddress:"",selfBondRewards:[],commission:[]}}e.QueryValidatorDistributionInfoResponse={encode(h,_=N.Writer.create()){h.operatorAddress!==""&&_.uint32(10).string(h.operatorAddress);for(let b of h.selfBondRewards)g.DecCoin.encode(b,_.uint32(18).fork()).ldelim();for(let b of h.commission)g.DecCoin.encode(b,_.uint32(26).fork()).ldelim();return _},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=v();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.operatorAddress=b.string();break;case 2:J.selfBondRewards.push(g.DecCoin.decode(b,b.uint32()));break;case 3:J.commission.push(g.DecCoin.decode(b,b.uint32()));break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{operatorAddress:(0,w.isSet)(h.operatorAddress)?String(h.operatorAddress):"",selfBondRewards:Array.isArray(h==null?void 0:h.selfBondRewards)?h.selfBondRewards.map(_=>g.DecCoin.fromJSON(_)):[],commission:Array.isArray(h==null?void 0:h.commission)?h.commission.map(_=>g.DecCoin.fromJSON(_)):[]}},toJSON(h){let _={};return h.operatorAddress!==void 0&&(_.operatorAddress=h.operatorAddress),h.selfBondRewards?_.selfBondRewards=h.selfBondRewards.map(b=>b?g.DecCoin.toJSON(b):void 0):_.selfBondRewards=[],h.commission?_.commission=h.commission.map(b=>b?g.DecCoin.toJSON(b):void 0):_.commission=[],_},fromPartial(h){var b,O,J;let _=v();return _.operatorAddress=(b=h.operatorAddress)!=null?b:"",_.selfBondRewards=((O=h.selfBondRewards)==null?void 0:O.map(ie=>g.DecCoin.fromPartial(ie)))||[],_.commission=((J=h.commission)==null?void 0:J.map(ie=>g.DecCoin.fromPartial(ie)))||[],_}};function ne(){return{validatorAddress:""}}e.QueryValidatorOutstandingRewardsRequest={encode(h,_=N.Writer.create()){return h.validatorAddress!==""&&_.uint32(10).string(h.validatorAddress),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=ne();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.validatorAddress=b.string();break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{validatorAddress:(0,w.isSet)(h.validatorAddress)?String(h.validatorAddress):""}},toJSON(h){let _={};return h.validatorAddress!==void 0&&(_.validatorAddress=h.validatorAddress),_},fromPartial(h){var b;let _=ne();return _.validatorAddress=(b=h.validatorAddress)!=null?b:"",_}};function Z(){return{rewards:void 0}}e.QueryValidatorOutstandingRewardsResponse={encode(h,_=N.Writer.create()){return h.rewards!==void 0&&l.ValidatorOutstandingRewards.encode(h.rewards,_.uint32(10).fork()).ldelim(),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=Z();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.rewards=l.ValidatorOutstandingRewards.decode(b,b.uint32());break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{rewards:(0,w.isSet)(h.rewards)?l.ValidatorOutstandingRewards.fromJSON(h.rewards):void 0}},toJSON(h){let _={};return h.rewards!==void 0&&(_.rewards=h.rewards?l.ValidatorOutstandingRewards.toJSON(h.rewards):void 0),_},fromPartial(h){let _=Z();return _.rewards=h.rewards!==void 0&&h.rewards!==null?l.ValidatorOutstandingRewards.fromPartial(h.rewards):void 0,_}};function R(){return{validatorAddress:""}}e.QueryValidatorCommissionRequest={encode(h,_=N.Writer.create()){return h.validatorAddress!==""&&_.uint32(10).string(h.validatorAddress),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=R();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.validatorAddress=b.string();break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{validatorAddress:(0,w.isSet)(h.validatorAddress)?String(h.validatorAddress):""}},toJSON(h){let _={};return h.validatorAddress!==void 0&&(_.validatorAddress=h.validatorAddress),_},fromPartial(h){var b;let _=R();return _.validatorAddress=(b=h.validatorAddress)!=null?b:"",_}};function M(){return{commission:void 0}}e.QueryValidatorCommissionResponse={encode(h,_=N.Writer.create()){return h.commission!==void 0&&l.ValidatorAccumulatedCommission.encode(h.commission,_.uint32(10).fork()).ldelim(),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=M();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.commission=l.ValidatorAccumulatedCommission.decode(b,b.uint32());break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{commission:(0,w.isSet)(h.commission)?l.ValidatorAccumulatedCommission.fromJSON(h.commission):void 0}},toJSON(h){let _={};return h.commission!==void 0&&(_.commission=h.commission?l.ValidatorAccumulatedCommission.toJSON(h.commission):void 0),_},fromPartial(h){let _=M();return _.commission=h.commission!==void 0&&h.commission!==null?l.ValidatorAccumulatedCommission.fromPartial(h.commission):void 0,_}};function U(){return{validatorAddress:"",startingHeight:w.Long.UZERO,endingHeight:w.Long.UZERO,pagination:void 0}}e.QueryValidatorSlashesRequest={encode(h,_=N.Writer.create()){return h.validatorAddress!==""&&_.uint32(10).string(h.validatorAddress),h.startingHeight.isZero()||_.uint32(16).uint64(h.startingHeight),h.endingHeight.isZero()||_.uint32(24).uint64(h.endingHeight),h.pagination!==void 0&&f.PageRequest.encode(h.pagination,_.uint32(34).fork()).ldelim(),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=U();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.validatorAddress=b.string();break;case 2:J.startingHeight=b.uint64();break;case 3:J.endingHeight=b.uint64();break;case 4:J.pagination=f.PageRequest.decode(b,b.uint32());break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{validatorAddress:(0,w.isSet)(h.validatorAddress)?String(h.validatorAddress):"",startingHeight:(0,w.isSet)(h.startingHeight)?w.Long.fromValue(h.startingHeight):w.Long.UZERO,endingHeight:(0,w.isSet)(h.endingHeight)?w.Long.fromValue(h.endingHeight):w.Long.UZERO,pagination:(0,w.isSet)(h.pagination)?f.PageRequest.fromJSON(h.pagination):void 0}},toJSON(h){let _={};return h.validatorAddress!==void 0&&(_.validatorAddress=h.validatorAddress),h.startingHeight!==void 0&&(_.startingHeight=(h.startingHeight||w.Long.UZERO).toString()),h.endingHeight!==void 0&&(_.endingHeight=(h.endingHeight||w.Long.UZERO).toString()),h.pagination!==void 0&&(_.pagination=h.pagination?f.PageRequest.toJSON(h.pagination):void 0),_},fromPartial(h){var b;let _=U();return _.validatorAddress=(b=h.validatorAddress)!=null?b:"",_.startingHeight=h.startingHeight!==void 0&&h.startingHeight!==null?w.Long.fromValue(h.startingHeight):w.Long.UZERO,_.endingHeight=h.endingHeight!==void 0&&h.endingHeight!==null?w.Long.fromValue(h.endingHeight):w.Long.UZERO,_.pagination=h.pagination!==void 0&&h.pagination!==null?f.PageRequest.fromPartial(h.pagination):void 0,_}};function E(){return{slashes:[],pagination:void 0}}e.QueryValidatorSlashesResponse={encode(h,_=N.Writer.create()){for(let b of h.slashes)l.ValidatorSlashEvent.encode(b,_.uint32(10).fork()).ldelim();return h.pagination!==void 0&&f.PageResponse.encode(h.pagination,_.uint32(18).fork()).ldelim(),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=E();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.slashes.push(l.ValidatorSlashEvent.decode(b,b.uint32()));break;case 2:J.pagination=f.PageResponse.decode(b,b.uint32());break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{slashes:Array.isArray(h==null?void 0:h.slashes)?h.slashes.map(_=>l.ValidatorSlashEvent.fromJSON(_)):[],pagination:(0,w.isSet)(h.pagination)?f.PageResponse.fromJSON(h.pagination):void 0}},toJSON(h){let _={};return h.slashes?_.slashes=h.slashes.map(b=>b?l.ValidatorSlashEvent.toJSON(b):void 0):_.slashes=[],h.pagination!==void 0&&(_.pagination=h.pagination?f.PageResponse.toJSON(h.pagination):void 0),_},fromPartial(h){var b;let _=E();return _.slashes=((b=h.slashes)==null?void 0:b.map(O=>l.ValidatorSlashEvent.fromPartial(O)))||[],_.pagination=h.pagination!==void 0&&h.pagination!==null?f.PageResponse.fromPartial(h.pagination):void 0,_}};function Q(){return{delegatorAddress:"",validatorAddress:""}}e.QueryDelegationRewardsRequest={encode(h,_=N.Writer.create()){return h.delegatorAddress!==""&&_.uint32(10).string(h.delegatorAddress),h.validatorAddress!==""&&_.uint32(18).string(h.validatorAddress),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=Q();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.delegatorAddress=b.string();break;case 2:J.validatorAddress=b.string();break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{delegatorAddress:(0,w.isSet)(h.delegatorAddress)?String(h.delegatorAddress):"",validatorAddress:(0,w.isSet)(h.validatorAddress)?String(h.validatorAddress):""}},toJSON(h){let _={};return h.delegatorAddress!==void 0&&(_.delegatorAddress=h.delegatorAddress),h.validatorAddress!==void 0&&(_.validatorAddress=h.validatorAddress),_},fromPartial(h){var b,O;let _=Q();return _.delegatorAddress=(b=h.delegatorAddress)!=null?b:"",_.validatorAddress=(O=h.validatorAddress)!=null?O:"",_}};function H(){return{rewards:[]}}e.QueryDelegationRewardsResponse={encode(h,_=N.Writer.create()){for(let b of h.rewards)g.DecCoin.encode(b,_.uint32(10).fork()).ldelim();return _},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=H();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.rewards.push(g.DecCoin.decode(b,b.uint32()));break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{rewards:Array.isArray(h==null?void 0:h.rewards)?h.rewards.map(_=>g.DecCoin.fromJSON(_)):[]}},toJSON(h){let _={};return h.rewards?_.rewards=h.rewards.map(b=>b?g.DecCoin.toJSON(b):void 0):_.rewards=[],_},fromPartial(h){var b;let _=H();return _.rewards=((b=h.rewards)==null?void 0:b.map(O=>g.DecCoin.fromPartial(O)))||[],_}};function re(){return{delegatorAddress:""}}e.QueryDelegationTotalRewardsRequest={encode(h,_=N.Writer.create()){return h.delegatorAddress!==""&&_.uint32(10).string(h.delegatorAddress),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=re();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.delegatorAddress=b.string();break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{delegatorAddress:(0,w.isSet)(h.delegatorAddress)?String(h.delegatorAddress):""}},toJSON(h){let _={};return h.delegatorAddress!==void 0&&(_.delegatorAddress=h.delegatorAddress),_},fromPartial(h){var b;let _=re();return _.delegatorAddress=(b=h.delegatorAddress)!=null?b:"",_}};function ee(){return{rewards:[],total:[]}}e.QueryDelegationTotalRewardsResponse={encode(h,_=N.Writer.create()){for(let b of h.rewards)l.DelegationDelegatorReward.encode(b,_.uint32(10).fork()).ldelim();for(let b of h.total)g.DecCoin.encode(b,_.uint32(18).fork()).ldelim();return _},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=ee();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.rewards.push(l.DelegationDelegatorReward.decode(b,b.uint32()));break;case 2:J.total.push(g.DecCoin.decode(b,b.uint32()));break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{rewards:Array.isArray(h==null?void 0:h.rewards)?h.rewards.map(_=>l.DelegationDelegatorReward.fromJSON(_)):[],total:Array.isArray(h==null?void 0:h.total)?h.total.map(_=>g.DecCoin.fromJSON(_)):[]}},toJSON(h){let _={};return h.rewards?_.rewards=h.rewards.map(b=>b?l.DelegationDelegatorReward.toJSON(b):void 0):_.rewards=[],h.total?_.total=h.total.map(b=>b?g.DecCoin.toJSON(b):void 0):_.total=[],_},fromPartial(h){var b,O;let _=ee();return _.rewards=((b=h.rewards)==null?void 0:b.map(J=>l.DelegationDelegatorReward.fromPartial(J)))||[],_.total=((O=h.total)==null?void 0:O.map(J=>g.DecCoin.fromPartial(J)))||[],_}};function T(){return{delegatorAddress:""}}e.QueryDelegatorValidatorsRequest={encode(h,_=N.Writer.create()){return h.delegatorAddress!==""&&_.uint32(10).string(h.delegatorAddress),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=T();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.delegatorAddress=b.string();break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{delegatorAddress:(0,w.isSet)(h.delegatorAddress)?String(h.delegatorAddress):""}},toJSON(h){let _={};return h.delegatorAddress!==void 0&&(_.delegatorAddress=h.delegatorAddress),_},fromPartial(h){var b;let _=T();return _.delegatorAddress=(b=h.delegatorAddress)!=null?b:"",_}};function se(){return{validators:[]}}e.QueryDelegatorValidatorsResponse={encode(h,_=N.Writer.create()){for(let b of h.validators)_.uint32(10).string(b);return _},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=se();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.validators.push(b.string());break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{validators:Array.isArray(h==null?void 0:h.validators)?h.validators.map(_=>String(_)):[]}},toJSON(h){let _={};return h.validators?_.validators=h.validators.map(b=>b):_.validators=[],_},fromPartial(h){var b;let _=se();return _.validators=((b=h.validators)==null?void 0:b.map(O=>O))||[],_}};function p(){return{delegatorAddress:""}}e.QueryDelegatorWithdrawAddressRequest={encode(h,_=N.Writer.create()){return h.delegatorAddress!==""&&_.uint32(10).string(h.delegatorAddress),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=p();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.delegatorAddress=b.string();break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{delegatorAddress:(0,w.isSet)(h.delegatorAddress)?String(h.delegatorAddress):""}},toJSON(h){let _={};return h.delegatorAddress!==void 0&&(_.delegatorAddress=h.delegatorAddress),_},fromPartial(h){var b;let _=p();return _.delegatorAddress=(b=h.delegatorAddress)!=null?b:"",_}};function L(){return{withdrawAddress:""}}e.QueryDelegatorWithdrawAddressResponse={encode(h,_=N.Writer.create()){return h.withdrawAddress!==""&&_.uint32(10).string(h.withdrawAddress),_},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=L();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.withdrawAddress=b.string();break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{withdrawAddress:(0,w.isSet)(h.withdrawAddress)?String(h.withdrawAddress):""}},toJSON(h){let _={};return h.withdrawAddress!==void 0&&(_.withdrawAddress=h.withdrawAddress),_},fromPartial(h){var b;let _=L();return _.withdrawAddress=(b=h.withdrawAddress)!=null?b:"",_}};function V(){return{}}e.QueryCommunityPoolRequest={encode(h,_=N.Writer.create()){return _},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=V();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){default:b.skipType(ie&7);break}}return J},fromJSON(h){return{}},toJSON(h){return{}},fromPartial(h){return V()}};function K(){return{pool:[]}}e.QueryCommunityPoolResponse={encode(h,_=N.Writer.create()){for(let b of h.pool)g.DecCoin.encode(b,_.uint32(10).fork()).ldelim();return _},decode(h,_){let b=h instanceof N.Reader?h:new N.Reader(h),O=_===void 0?b.len:b.pos+_,J=K();for(;b.pos<O;){let ie=b.uint32();switch(ie>>>3){case 1:J.pool.push(g.DecCoin.decode(b,b.uint32()));break;default:b.skipType(ie&7);break}}return J},fromJSON(h){return{pool:Array.isArray(h==null?void 0:h.pool)?h.pool.map(_=>g.DecCoin.fromJSON(_)):[]}},toJSON(h){let _={};return h.pool?_.pool=h.pool.map(b=>b?g.DecCoin.toJSON(b):void 0):_.pool=[],_},fromPartial(h){var b;let _=K();return _.pool=((b=h.pool)==null?void 0:b.map(O=>g.DecCoin.fromPartial(O)))||[],_}};class m{constructor(_){this.rpc=_,this.Params=this.Params.bind(this),this.ValidatorDistributionInfo=this.ValidatorDistributionInfo.bind(this),this.ValidatorOutstandingRewards=this.ValidatorOutstandingRewards.bind(this),this.ValidatorCommission=this.ValidatorCommission.bind(this),this.ValidatorSlashes=this.ValidatorSlashes.bind(this),this.DelegationRewards=this.DelegationRewards.bind(this),this.DelegationTotalRewards=this.DelegationTotalRewards.bind(this),this.DelegatorValidators=this.DelegatorValidators.bind(this),this.DelegatorWithdrawAddress=this.DelegatorWithdrawAddress.bind(this),this.CommunityPool=this.CommunityPool.bind(this)}Params(_={}){let b=e.QueryParamsRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","Params",b).then(J=>e.QueryParamsResponse.decode(new N.Reader(J)))}ValidatorDistributionInfo(_){let b=e.QueryValidatorDistributionInfoRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","ValidatorDistributionInfo",b).then(J=>e.QueryValidatorDistributionInfoResponse.decode(new N.Reader(J)))}ValidatorOutstandingRewards(_){let b=e.QueryValidatorOutstandingRewardsRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","ValidatorOutstandingRewards",b).then(J=>e.QueryValidatorOutstandingRewardsResponse.decode(new N.Reader(J)))}ValidatorCommission(_){let b=e.QueryValidatorCommissionRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","ValidatorCommission",b).then(J=>e.QueryValidatorCommissionResponse.decode(new N.Reader(J)))}ValidatorSlashes(_){let b=e.QueryValidatorSlashesRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","ValidatorSlashes",b).then(J=>e.QueryValidatorSlashesResponse.decode(new N.Reader(J)))}DelegationRewards(_){let b=e.QueryDelegationRewardsRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","DelegationRewards",b).then(J=>e.QueryDelegationRewardsResponse.decode(new N.Reader(J)))}DelegationTotalRewards(_){let b=e.QueryDelegationTotalRewardsRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","DelegationTotalRewards",b).then(J=>e.QueryDelegationTotalRewardsResponse.decode(new N.Reader(J)))}DelegatorValidators(_){let b=e.QueryDelegatorValidatorsRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","DelegatorValidators",b).then(J=>e.QueryDelegatorValidatorsResponse.decode(new N.Reader(J)))}DelegatorWithdrawAddress(_){let b=e.QueryDelegatorWithdrawAddressRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","DelegatorWithdrawAddress",b).then(J=>e.QueryDelegatorWithdrawAddressResponse.decode(new N.Reader(J)))}CommunityPool(_={}){let b=e.QueryCommunityPoolRequest.encode(_).finish();return this.rpc.request("cosmos.distribution.v1beta1.Query","CommunityPool",b).then(J=>e.QueryCommunityPoolResponse.decode(new N.Reader(J)))}}e.QueryClientImpl=m})(_$r);var K6s=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(rvt,"__esModule",{value:!0});rvt.setupDistributionExtension=void 0;var Y6s=_$r,fLr=K6s(qM),lLr=Rw;function V6s(e){let i=(0,lLr.createProtobufRpcClient)(e),A=new Y6s.QueryClientImpl(i);return{distribution:{communityPool:()=>Jt(this,null,function*(){return yield A.CommunityPool({})}),delegationRewards:(c,f)=>Jt(this,null,function*(){return yield A.DelegationRewards({delegatorAddress:c,validatorAddress:f})}),delegationTotalRewards:c=>Jt(this,null,function*(){return yield A.DelegationTotalRewards({delegatorAddress:c})}),delegatorValidators:c=>Jt(this,null,function*(){return yield A.DelegatorValidators({delegatorAddress:c})}),delegatorWithdrawAddress:c=>Jt(this,null,function*(){return yield A.DelegatorWithdrawAddress({delegatorAddress:c})}),params:()=>Jt(this,null,function*(){return yield A.Params({})}),validatorCommission:c=>Jt(this,null,function*(){return yield A.ValidatorCommission({validatorAddress:c})}),validatorOutstandingRewards:c=>Jt(this,null,function*(){return yield A.ValidatorOutstandingRewards({validatorAddress:c})}),validatorSlashes:(c,f,l,g)=>Jt(this,null,function*(){return yield A.ValidatorSlashes({validatorAddress:c,startingHeight:fLr.default.fromNumber(f,!0),endingHeight:fLr.default.fromNumber(l,!0),pagination:(0,lLr.createPagination)(g)})})}}}rvt.setupDistributionExtension=V6s;var uSe={};Object.defineProperty(uSe,"__esModule",{value:!0});uSe.createEvidenceAminoConverters=uSe.isAminoMsgSubmitEvidence=void 0;function z6s(e){return e.type==="cosmos-sdk/MsgSubmitEvidence"}uSe.isAminoMsgSubmitEvidence=z6s;function W6s(){throw new Error("Not implemented")}uSe.createEvidenceAminoConverters=W6s;var ivt={};Object.defineProperty(ivt,"__esModule",{value:!0});ivt.createFeegrantAminoConverters=void 0;function Z6s(){return{}}ivt.createFeegrantAminoConverters=Z6s;var ovt={},E$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(v,ne,Z,R){R===void 0&&(R=Z);var M=Object.getOwnPropertyDescriptor(ne,Z);(!M||("get"in M?!ne.__esModule:M.writable||M.configurable))&&(M={enumerable:!0,get:function(){return ne[Z]}}),Object.defineProperty(v,R,M)}:function(v,ne,Z,R){R===void 0&&(R=Z),v[R]=ne[Z]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(v,ne){Object.defineProperty(v,"default",{enumerable:!0,value:ne})}:function(v,ne){v.default=ne}),c=Fr&&Fr.__importStar||function(v){if(v&&v.__esModule)return v;var ne={};if(v!=null)for(var Z in v)Z!=="default"&&Object.prototype.hasOwnProperty.call(v,Z)&&i(ne,v,Z);return A(ne,v),ne};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgRevokeAllowanceResponse=e.MsgRevokeAllowance=e.MsgGrantAllowanceResponse=e.MsgGrantAllowance=e.protobufPackage=void 0;let f=fh,l=c(BA),g=Ns;e.protobufPackage="cosmos.feegrant.v1beta1";function w(){return{granter:"",grantee:"",allowance:void 0}}e.MsgGrantAllowance={encode(v,ne=l.Writer.create()){return v.granter!==""&&ne.uint32(10).string(v.granter),v.grantee!==""&&ne.uint32(18).string(v.grantee),v.allowance!==void 0&&f.Any.encode(v.allowance,ne.uint32(26).fork()).ldelim(),ne},decode(v,ne){let Z=v instanceof l.Reader?v:new l.Reader(v),R=ne===void 0?Z.len:Z.pos+ne,M=w();for(;Z.pos<R;){let U=Z.uint32();switch(U>>>3){case 1:M.granter=Z.string();break;case 2:M.grantee=Z.string();break;case 3:M.allowance=f.Any.decode(Z,Z.uint32());break;default:Z.skipType(U&7);break}}return M},fromJSON(v){return{granter:(0,g.isSet)(v.granter)?String(v.granter):"",grantee:(0,g.isSet)(v.grantee)?String(v.grantee):"",allowance:(0,g.isSet)(v.allowance)?f.Any.fromJSON(v.allowance):void 0}},toJSON(v){let ne={};return v.granter!==void 0&&(ne.granter=v.granter),v.grantee!==void 0&&(ne.grantee=v.grantee),v.allowance!==void 0&&(ne.allowance=v.allowance?f.Any.toJSON(v.allowance):void 0),ne},fromPartial(v){var Z,R;let ne=w();return ne.granter=(Z=v.granter)!=null?Z:"",ne.grantee=(R=v.grantee)!=null?R:"",ne.allowance=v.allowance!==void 0&&v.allowance!==null?f.Any.fromPartial(v.allowance):void 0,ne}};function N(){return{}}e.MsgGrantAllowanceResponse={encode(v,ne=l.Writer.create()){return ne},decode(v,ne){let Z=v instanceof l.Reader?v:new l.Reader(v),R=ne===void 0?Z.len:Z.pos+ne,M=N();for(;Z.pos<R;){let U=Z.uint32();switch(U>>>3){default:Z.skipType(U&7);break}}return M},fromJSON(v){return{}},toJSON(v){return{}},fromPartial(v){return N()}};function F(){return{granter:"",grantee:""}}e.MsgRevokeAllowance={encode(v,ne=l.Writer.create()){return v.granter!==""&&ne.uint32(10).string(v.granter),v.grantee!==""&&ne.uint32(18).string(v.grantee),ne},decode(v,ne){let Z=v instanceof l.Reader?v:new l.Reader(v),R=ne===void 0?Z.len:Z.pos+ne,M=F();for(;Z.pos<R;){let U=Z.uint32();switch(U>>>3){case 1:M.granter=Z.string();break;case 2:M.grantee=Z.string();break;default:Z.skipType(U&7);break}}return M},fromJSON(v){return{granter:(0,g.isSet)(v.granter)?String(v.granter):"",grantee:(0,g.isSet)(v.grantee)?String(v.grantee):""}},toJSON(v){let ne={};return v.granter!==void 0&&(ne.granter=v.granter),v.grantee!==void 0&&(ne.grantee=v.grantee),ne},fromPartial(v){var Z,R;let ne=F();return ne.granter=(Z=v.granter)!=null?Z:"",ne.grantee=(R=v.grantee)!=null?R:"",ne}};function j(){return{}}e.MsgRevokeAllowanceResponse={encode(v,ne=l.Writer.create()){return ne},decode(v,ne){let Z=v instanceof l.Reader?v:new l.Reader(v),R=ne===void 0?Z.len:Z.pos+ne,M=j();for(;Z.pos<R;){let U=Z.uint32();switch(U>>>3){default:Z.skipType(U&7);break}}return M},fromJSON(v){return{}},toJSON(v){return{}},fromPartial(v){return j()}};class te{constructor(ne){this.rpc=ne,this.GrantAllowance=this.GrantAllowance.bind(this),this.RevokeAllowance=this.RevokeAllowance.bind(this)}GrantAllowance(ne){let Z=e.MsgGrantAllowance.encode(ne).finish();return this.rpc.request("cosmos.feegrant.v1beta1.Msg","GrantAllowance",Z).then(M=>e.MsgGrantAllowanceResponse.decode(new l.Reader(M)))}RevokeAllowance(ne){let Z=e.MsgRevokeAllowance.encode(ne).finish();return this.rpc.request("cosmos.feegrant.v1beta1.Msg","RevokeAllowance",Z).then(M=>e.MsgRevokeAllowanceResponse.decode(new l.Reader(M)))}}e.MsgClientImpl=te})(E$r);Object.defineProperty(ovt,"__esModule",{value:!0});ovt.feegrantTypes=void 0;var hLr=E$r;ovt.feegrantTypes=[["/cosmos.feegrant.v1beta1.MsgGrantAllowance",hLr.MsgGrantAllowance],["/cosmos.feegrant.v1beta1.MsgRevokeAllowance",hLr.MsgRevokeAllowance]];var avt={},B$r={},v$r={},MR={},X6s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),$6s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),j6s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&X6s(i,e,A);return $6s(i,e),i};Object.defineProperty(MR,"__esModule",{value:!0});MR.Duration=MR.protobufPackage=void 0;var gie=Ns,D2n=j6s(BA);MR.protobufPackage="google.protobuf";function gLr(){return{seconds:gie.Long.ZERO,nanos:0}}MR.Duration={encode(e,i=D2n.Writer.create()){return e.seconds.isZero()||i.uint32(8).int64(e.seconds),e.nanos!==0&&i.uint32(16).int32(e.nanos),i},decode(e,i){let A=e instanceof D2n.Reader?e:new D2n.Reader(e),c=i===void 0?A.len:A.pos+i,f=gLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.seconds=A.int64();break;case 2:f.nanos=A.int32();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{seconds:(0,gie.isSet)(e.seconds)?gie.Long.fromValue(e.seconds):gie.Long.ZERO,nanos:(0,gie.isSet)(e.nanos)?Number(e.nanos):0}},toJSON(e){let i={};return e.seconds!==void 0&&(i.seconds=(e.seconds||gie.Long.ZERO).toString()),e.nanos!==void 0&&(i.nanos=Math.round(e.nanos)),i},fromPartial(e){var A;let i=gLr();return i.seconds=e.seconds!==void 0&&e.seconds!==null?gie.Long.fromValue(e.seconds):gie.Long.ZERO,i.nanos=(A=e.nanos)!=null?A:0,i}};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(Z,R,M,U){U===void 0&&(U=M);var E=Object.getOwnPropertyDescriptor(R,M);(!E||("get"in E?!R.__esModule:E.writable||E.configurable))&&(E={enumerable:!0,get:function(){return R[M]}}),Object.defineProperty(Z,U,E)}:function(Z,R,M,U){U===void 0&&(U=M),Z[U]=R[M]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(Z,R){Object.defineProperty(Z,"default",{enumerable:!0,value:R})}:function(Z,R){Z.default=R}),c=Fr&&Fr.__importStar||function(Z){if(Z&&Z.__esModule)return Z;var R={};if(Z!=null)for(var M in Z)M!=="default"&&Object.prototype.hasOwnProperty.call(Z,M)&&i(R,Z,M);return A(R,Z),R};Object.defineProperty(e,"__esModule",{value:!0}),e.Grant=e.AllowedMsgAllowance=e.PeriodicAllowance=e.BasicAllowance=e.protobufPackage=void 0;let f=gg,l=k3,g=MR,w=fh,N=c(BA),F=Ns;e.protobufPackage="cosmos.feegrant.v1beta1";function j(){return{spendLimit:[],expiration:void 0}}e.BasicAllowance={encode(Z,R=N.Writer.create()){for(let M of Z.spendLimit)f.Coin.encode(M,R.uint32(10).fork()).ldelim();return Z.expiration!==void 0&&l.Timestamp.encode(Z.expiration,R.uint32(18).fork()).ldelim(),R},decode(Z,R){let M=Z instanceof N.Reader?Z:new N.Reader(Z),U=R===void 0?M.len:M.pos+R,E=j();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){case 1:E.spendLimit.push(f.Coin.decode(M,M.uint32()));break;case 2:E.expiration=l.Timestamp.decode(M,M.uint32());break;default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{spendLimit:Array.isArray(Z==null?void 0:Z.spendLimit)?Z.spendLimit.map(R=>f.Coin.fromJSON(R)):[],expiration:(0,F.isSet)(Z.expiration)?(0,F.fromJsonTimestamp)(Z.expiration):void 0}},toJSON(Z){let R={};return Z.spendLimit?R.spendLimit=Z.spendLimit.map(M=>M?f.Coin.toJSON(M):void 0):R.spendLimit=[],Z.expiration!==void 0&&(R.expiration=(0,F.fromTimestamp)(Z.expiration).toISOString()),R},fromPartial(Z){var M;let R=j();return R.spendLimit=((M=Z.spendLimit)==null?void 0:M.map(U=>f.Coin.fromPartial(U)))||[],R.expiration=Z.expiration!==void 0&&Z.expiration!==null?l.Timestamp.fromPartial(Z.expiration):void 0,R}};function te(){return{basic:void 0,period:void 0,periodSpendLimit:[],periodCanSpend:[],periodReset:void 0}}e.PeriodicAllowance={encode(Z,R=N.Writer.create()){Z.basic!==void 0&&e.BasicAllowance.encode(Z.basic,R.uint32(10).fork()).ldelim(),Z.period!==void 0&&g.Duration.encode(Z.period,R.uint32(18).fork()).ldelim();for(let M of Z.periodSpendLimit)f.Coin.encode(M,R.uint32(26).fork()).ldelim();for(let M of Z.periodCanSpend)f.Coin.encode(M,R.uint32(34).fork()).ldelim();return Z.periodReset!==void 0&&l.Timestamp.encode(Z.periodReset,R.uint32(42).fork()).ldelim(),R},decode(Z,R){let M=Z instanceof N.Reader?Z:new N.Reader(Z),U=R===void 0?M.len:M.pos+R,E=te();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){case 1:E.basic=e.BasicAllowance.decode(M,M.uint32());break;case 2:E.period=g.Duration.decode(M,M.uint32());break;case 3:E.periodSpendLimit.push(f.Coin.decode(M,M.uint32()));break;case 4:E.periodCanSpend.push(f.Coin.decode(M,M.uint32()));break;case 5:E.periodReset=l.Timestamp.decode(M,M.uint32());break;default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{basic:(0,F.isSet)(Z.basic)?e.BasicAllowance.fromJSON(Z.basic):void 0,period:(0,F.isSet)(Z.period)?g.Duration.fromJSON(Z.period):void 0,periodSpendLimit:Array.isArray(Z==null?void 0:Z.periodSpendLimit)?Z.periodSpendLimit.map(R=>f.Coin.fromJSON(R)):[],periodCanSpend:Array.isArray(Z==null?void 0:Z.periodCanSpend)?Z.periodCanSpend.map(R=>f.Coin.fromJSON(R)):[],periodReset:(0,F.isSet)(Z.periodReset)?(0,F.fromJsonTimestamp)(Z.periodReset):void 0}},toJSON(Z){let R={};return Z.basic!==void 0&&(R.basic=Z.basic?e.BasicAllowance.toJSON(Z.basic):void 0),Z.period!==void 0&&(R.period=Z.period?g.Duration.toJSON(Z.period):void 0),Z.periodSpendLimit?R.periodSpendLimit=Z.periodSpendLimit.map(M=>M?f.Coin.toJSON(M):void 0):R.periodSpendLimit=[],Z.periodCanSpend?R.periodCanSpend=Z.periodCanSpend.map(M=>M?f.Coin.toJSON(M):void 0):R.periodCanSpend=[],Z.periodReset!==void 0&&(R.periodReset=(0,F.fromTimestamp)(Z.periodReset).toISOString()),R},fromPartial(Z){var M,U;let R=te();return R.basic=Z.basic!==void 0&&Z.basic!==null?e.BasicAllowance.fromPartial(Z.basic):void 0,R.period=Z.period!==void 0&&Z.period!==null?g.Duration.fromPartial(Z.period):void 0,R.periodSpendLimit=((M=Z.periodSpendLimit)==null?void 0:M.map(E=>f.Coin.fromPartial(E)))||[],R.periodCanSpend=((U=Z.periodCanSpend)==null?void 0:U.map(E=>f.Coin.fromPartial(E)))||[],R.periodReset=Z.periodReset!==void 0&&Z.periodReset!==null?l.Timestamp.fromPartial(Z.periodReset):void 0,R}};function v(){return{allowance:void 0,allowedMessages:[]}}e.AllowedMsgAllowance={encode(Z,R=N.Writer.create()){Z.allowance!==void 0&&w.Any.encode(Z.allowance,R.uint32(10).fork()).ldelim();for(let M of Z.allowedMessages)R.uint32(18).string(M);return R},decode(Z,R){let M=Z instanceof N.Reader?Z:new N.Reader(Z),U=R===void 0?M.len:M.pos+R,E=v();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){case 1:E.allowance=w.Any.decode(M,M.uint32());break;case 2:E.allowedMessages.push(M.string());break;default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{allowance:(0,F.isSet)(Z.allowance)?w.Any.fromJSON(Z.allowance):void 0,allowedMessages:Array.isArray(Z==null?void 0:Z.allowedMessages)?Z.allowedMessages.map(R=>String(R)):[]}},toJSON(Z){let R={};return Z.allowance!==void 0&&(R.allowance=Z.allowance?w.Any.toJSON(Z.allowance):void 0),Z.allowedMessages?R.allowedMessages=Z.allowedMessages.map(M=>M):R.allowedMessages=[],R},fromPartial(Z){var M;let R=v();return R.allowance=Z.allowance!==void 0&&Z.allowance!==null?w.Any.fromPartial(Z.allowance):void 0,R.allowedMessages=((M=Z.allowedMessages)==null?void 0:M.map(U=>U))||[],R}};function ne(){return{granter:"",grantee:"",allowance:void 0}}e.Grant={encode(Z,R=N.Writer.create()){return Z.granter!==""&&R.uint32(10).string(Z.granter),Z.grantee!==""&&R.uint32(18).string(Z.grantee),Z.allowance!==void 0&&w.Any.encode(Z.allowance,R.uint32(26).fork()).ldelim(),R},decode(Z,R){let M=Z instanceof N.Reader?Z:new N.Reader(Z),U=R===void 0?M.len:M.pos+R,E=ne();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){case 1:E.granter=M.string();break;case 2:E.grantee=M.string();break;case 3:E.allowance=w.Any.decode(M,M.uint32());break;default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{granter:(0,F.isSet)(Z.granter)?String(Z.granter):"",grantee:(0,F.isSet)(Z.grantee)?String(Z.grantee):"",allowance:(0,F.isSet)(Z.allowance)?w.Any.fromJSON(Z.allowance):void 0}},toJSON(Z){let R={};return Z.granter!==void 0&&(R.granter=Z.granter),Z.grantee!==void 0&&(R.grantee=Z.grantee),Z.allowance!==void 0&&(R.allowance=Z.allowance?w.Any.toJSON(Z.allowance):void 0),R},fromPartial(Z){var M,U;let R=ne();return R.granter=(M=Z.granter)!=null?M:"",R.grantee=(U=Z.grantee)!=null?U:"",R.allowance=Z.allowance!==void 0&&Z.allowance!==null?w.Any.fromPartial(Z.allowance):void 0,R}}})(v$r);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(R,M,U,E){E===void 0&&(E=U);var Q=Object.getOwnPropertyDescriptor(M,U);(!Q||("get"in Q?!M.__esModule:Q.writable||Q.configurable))&&(Q={enumerable:!0,get:function(){return M[U]}}),Object.defineProperty(R,E,Q)}:function(R,M,U,E){E===void 0&&(E=U),R[E]=M[U]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(R,M){Object.defineProperty(R,"default",{enumerable:!0,value:M})}:function(R,M){R.default=M}),c=Fr&&Fr.__importStar||function(R){if(R&&R.__esModule)return R;var M={};if(R!=null)for(var U in R)U!=="default"&&Object.prototype.hasOwnProperty.call(R,U)&&i(M,R,U);return A(M,R),M};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryAllowancesByGranterResponse=e.QueryAllowancesByGranterRequest=e.QueryAllowancesResponse=e.QueryAllowancesRequest=e.QueryAllowanceResponse=e.QueryAllowanceRequest=e.protobufPackage=void 0;let f=Hm,l=v$r,g=c(BA),w=Ns;e.protobufPackage="cosmos.feegrant.v1beta1";function N(){return{granter:"",grantee:""}}e.QueryAllowanceRequest={encode(R,M=g.Writer.create()){return R.granter!==""&&M.uint32(10).string(R.granter),R.grantee!==""&&M.uint32(18).string(R.grantee),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=N();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.granter=U.string();break;case 2:Q.grantee=U.string();break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{granter:(0,w.isSet)(R.granter)?String(R.granter):"",grantee:(0,w.isSet)(R.grantee)?String(R.grantee):""}},toJSON(R){let M={};return R.granter!==void 0&&(M.granter=R.granter),R.grantee!==void 0&&(M.grantee=R.grantee),M},fromPartial(R){var U,E;let M=N();return M.granter=(U=R.granter)!=null?U:"",M.grantee=(E=R.grantee)!=null?E:"",M}};function F(){return{allowance:void 0}}e.QueryAllowanceResponse={encode(R,M=g.Writer.create()){return R.allowance!==void 0&&l.Grant.encode(R.allowance,M.uint32(10).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=F();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.allowance=l.Grant.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{allowance:(0,w.isSet)(R.allowance)?l.Grant.fromJSON(R.allowance):void 0}},toJSON(R){let M={};return R.allowance!==void 0&&(M.allowance=R.allowance?l.Grant.toJSON(R.allowance):void 0),M},fromPartial(R){let M=F();return M.allowance=R.allowance!==void 0&&R.allowance!==null?l.Grant.fromPartial(R.allowance):void 0,M}};function j(){return{grantee:"",pagination:void 0}}e.QueryAllowancesRequest={encode(R,M=g.Writer.create()){return R.grantee!==""&&M.uint32(10).string(R.grantee),R.pagination!==void 0&&f.PageRequest.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=j();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.grantee=U.string();break;case 2:Q.pagination=f.PageRequest.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{grantee:(0,w.isSet)(R.grantee)?String(R.grantee):"",pagination:(0,w.isSet)(R.pagination)?f.PageRequest.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.grantee!==void 0&&(M.grantee=R.grantee),R.pagination!==void 0&&(M.pagination=R.pagination?f.PageRequest.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=j();return M.grantee=(U=R.grantee)!=null?U:"",M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageRequest.fromPartial(R.pagination):void 0,M}};function te(){return{allowances:[],pagination:void 0}}e.QueryAllowancesResponse={encode(R,M=g.Writer.create()){for(let U of R.allowances)l.Grant.encode(U,M.uint32(10).fork()).ldelim();return R.pagination!==void 0&&f.PageResponse.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=te();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.allowances.push(l.Grant.decode(U,U.uint32()));break;case 2:Q.pagination=f.PageResponse.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{allowances:Array.isArray(R==null?void 0:R.allowances)?R.allowances.map(M=>l.Grant.fromJSON(M)):[],pagination:(0,w.isSet)(R.pagination)?f.PageResponse.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.allowances?M.allowances=R.allowances.map(U=>U?l.Grant.toJSON(U):void 0):M.allowances=[],R.pagination!==void 0&&(M.pagination=R.pagination?f.PageResponse.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=te();return M.allowances=((U=R.allowances)==null?void 0:U.map(E=>l.Grant.fromPartial(E)))||[],M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageResponse.fromPartial(R.pagination):void 0,M}};function v(){return{granter:"",pagination:void 0}}e.QueryAllowancesByGranterRequest={encode(R,M=g.Writer.create()){return R.granter!==""&&M.uint32(10).string(R.granter),R.pagination!==void 0&&f.PageRequest.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=v();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.granter=U.string();break;case 2:Q.pagination=f.PageRequest.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{granter:(0,w.isSet)(R.granter)?String(R.granter):"",pagination:(0,w.isSet)(R.pagination)?f.PageRequest.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.granter!==void 0&&(M.granter=R.granter),R.pagination!==void 0&&(M.pagination=R.pagination?f.PageRequest.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=v();return M.granter=(U=R.granter)!=null?U:"",M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageRequest.fromPartial(R.pagination):void 0,M}};function ne(){return{allowances:[],pagination:void 0}}e.QueryAllowancesByGranterResponse={encode(R,M=g.Writer.create()){for(let U of R.allowances)l.Grant.encode(U,M.uint32(10).fork()).ldelim();return R.pagination!==void 0&&f.PageResponse.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=ne();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.allowances.push(l.Grant.decode(U,U.uint32()));break;case 2:Q.pagination=f.PageResponse.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{allowances:Array.isArray(R==null?void 0:R.allowances)?R.allowances.map(M=>l.Grant.fromJSON(M)):[],pagination:(0,w.isSet)(R.pagination)?f.PageResponse.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.allowances?M.allowances=R.allowances.map(U=>U?l.Grant.toJSON(U):void 0):M.allowances=[],R.pagination!==void 0&&(M.pagination=R.pagination?f.PageResponse.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=ne();return M.allowances=((U=R.allowances)==null?void 0:U.map(E=>l.Grant.fromPartial(E)))||[],M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageResponse.fromPartial(R.pagination):void 0,M}};class Z{constructor(M){this.rpc=M,this.Allowance=this.Allowance.bind(this),this.Allowances=this.Allowances.bind(this),this.AllowancesByGranter=this.AllowancesByGranter.bind(this)}Allowance(M){let U=e.QueryAllowanceRequest.encode(M).finish();return this.rpc.request("cosmos.feegrant.v1beta1.Query","Allowance",U).then(Q=>e.QueryAllowanceResponse.decode(new g.Reader(Q)))}Allowances(M){let U=e.QueryAllowancesRequest.encode(M).finish();return this.rpc.request("cosmos.feegrant.v1beta1.Query","Allowances",U).then(Q=>e.QueryAllowancesResponse.decode(new g.Reader(Q)))}AllowancesByGranter(M){let U=e.QueryAllowancesByGranterRequest.encode(M).finish();return this.rpc.request("cosmos.feegrant.v1beta1.Query","AllowancesByGranter",U).then(Q=>e.QueryAllowancesByGranterResponse.decode(new g.Reader(Q)))}}e.QueryClientImpl=Z})(B$r);Object.defineProperty(avt,"__esModule",{value:!0});avt.setupFeegrantExtension=void 0;var e8s=B$r,pLr=Rw;function t8s(e){let i=(0,pLr.createProtobufRpcClient)(e),A=new e8s.QueryClientImpl(i);return{feegrant:{allowance:(c,f)=>Jt(this,null,function*(){return yield A.Allowance({granter:c,grantee:f})}),allowances:(c,f)=>Jt(this,null,function*(){return yield A.Allowances({grantee:c,pagination:(0,pLr.createPagination)(f)})})}}}avt.setupFeegrantExtension=t8s;var gM={},svt={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(p,L,V,K){K===void 0&&(K=V);var m=Object.getOwnPropertyDescriptor(L,V);(!m||("get"in m?!L.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return L[V]}}),Object.defineProperty(p,K,m)}:function(p,L,V,K){K===void 0&&(K=V),p[K]=L[V]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(p,L){Object.defineProperty(p,"default",{enumerable:!0,value:L})}:function(p,L){p.default=L}),c=Fr&&Fr.__importStar||function(p){if(p&&p.__esModule)return p;var L={};if(p!=null)for(var V in p)V!=="default"&&Object.prototype.hasOwnProperty.call(p,V)&&i(L,p,V);return A(L,p),L};Object.defineProperty(e,"__esModule",{value:!0}),e.TallyParams=e.VotingParams=e.DepositParams=e.Vote=e.TallyResult=e.Proposal=e.Deposit=e.TextProposal=e.WeightedVoteOption=e.proposalStatusToJSON=e.proposalStatusFromJSON=e.ProposalStatus=e.voteOptionToJSON=e.voteOptionFromJSON=e.VoteOption=e.protobufPackage=void 0;let f=gg,l=fh,g=k3,w=MR,N=Ns,F=c(BA);e.protobufPackage="cosmos.gov.v1beta1";var j;(function(p){p[p.VOTE_OPTION_UNSPECIFIED=0]="VOTE_OPTION_UNSPECIFIED",p[p.VOTE_OPTION_YES=1]="VOTE_OPTION_YES",p[p.VOTE_OPTION_ABSTAIN=2]="VOTE_OPTION_ABSTAIN",p[p.VOTE_OPTION_NO=3]="VOTE_OPTION_NO",p[p.VOTE_OPTION_NO_WITH_VETO=4]="VOTE_OPTION_NO_WITH_VETO",p[p.UNRECOGNIZED=-1]="UNRECOGNIZED"})(j=e.VoteOption||(e.VoteOption={}));function te(p){switch(p){case 0:case"VOTE_OPTION_UNSPECIFIED":return j.VOTE_OPTION_UNSPECIFIED;case 1:case"VOTE_OPTION_YES":return j.VOTE_OPTION_YES;case 2:case"VOTE_OPTION_ABSTAIN":return j.VOTE_OPTION_ABSTAIN;case 3:case"VOTE_OPTION_NO":return j.VOTE_OPTION_NO;case 4:case"VOTE_OPTION_NO_WITH_VETO":return j.VOTE_OPTION_NO_WITH_VETO;case-1:case"UNRECOGNIZED":default:return j.UNRECOGNIZED}}e.voteOptionFromJSON=te;function v(p){switch(p){case j.VOTE_OPTION_UNSPECIFIED:return"VOTE_OPTION_UNSPECIFIED";case j.VOTE_OPTION_YES:return"VOTE_OPTION_YES";case j.VOTE_OPTION_ABSTAIN:return"VOTE_OPTION_ABSTAIN";case j.VOTE_OPTION_NO:return"VOTE_OPTION_NO";case j.VOTE_OPTION_NO_WITH_VETO:return"VOTE_OPTION_NO_WITH_VETO";case j.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.voteOptionToJSON=v;var ne;(function(p){p[p.PROPOSAL_STATUS_UNSPECIFIED=0]="PROPOSAL_STATUS_UNSPECIFIED",p[p.PROPOSAL_STATUS_DEPOSIT_PERIOD=1]="PROPOSAL_STATUS_DEPOSIT_PERIOD",p[p.PROPOSAL_STATUS_VOTING_PERIOD=2]="PROPOSAL_STATUS_VOTING_PERIOD",p[p.PROPOSAL_STATUS_PASSED=3]="PROPOSAL_STATUS_PASSED",p[p.PROPOSAL_STATUS_REJECTED=4]="PROPOSAL_STATUS_REJECTED",p[p.PROPOSAL_STATUS_FAILED=5]="PROPOSAL_STATUS_FAILED",p[p.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ne=e.ProposalStatus||(e.ProposalStatus={}));function Z(p){switch(p){case 0:case"PROPOSAL_STATUS_UNSPECIFIED":return ne.PROPOSAL_STATUS_UNSPECIFIED;case 1:case"PROPOSAL_STATUS_DEPOSIT_PERIOD":return ne.PROPOSAL_STATUS_DEPOSIT_PERIOD;case 2:case"PROPOSAL_STATUS_VOTING_PERIOD":return ne.PROPOSAL_STATUS_VOTING_PERIOD;case 3:case"PROPOSAL_STATUS_PASSED":return ne.PROPOSAL_STATUS_PASSED;case 4:case"PROPOSAL_STATUS_REJECTED":return ne.PROPOSAL_STATUS_REJECTED;case 5:case"PROPOSAL_STATUS_FAILED":return ne.PROPOSAL_STATUS_FAILED;case-1:case"UNRECOGNIZED":default:return ne.UNRECOGNIZED}}e.proposalStatusFromJSON=Z;function R(p){switch(p){case ne.PROPOSAL_STATUS_UNSPECIFIED:return"PROPOSAL_STATUS_UNSPECIFIED";case ne.PROPOSAL_STATUS_DEPOSIT_PERIOD:return"PROPOSAL_STATUS_DEPOSIT_PERIOD";case ne.PROPOSAL_STATUS_VOTING_PERIOD:return"PROPOSAL_STATUS_VOTING_PERIOD";case ne.PROPOSAL_STATUS_PASSED:return"PROPOSAL_STATUS_PASSED";case ne.PROPOSAL_STATUS_REJECTED:return"PROPOSAL_STATUS_REJECTED";case ne.PROPOSAL_STATUS_FAILED:return"PROPOSAL_STATUS_FAILED";case ne.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.proposalStatusToJSON=R;function M(){return{option:0,weight:""}}e.WeightedVoteOption={encode(p,L=F.Writer.create()){return p.option!==0&&L.uint32(8).int32(p.option),p.weight!==""&&L.uint32(18).string(p.weight),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=M();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.option=V.int32();break;case 2:m.weight=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{option:(0,N.isSet)(p.option)?te(p.option):0,weight:(0,N.isSet)(p.weight)?String(p.weight):""}},toJSON(p){let L={};return p.option!==void 0&&(L.option=v(p.option)),p.weight!==void 0&&(L.weight=p.weight),L},fromPartial(p){var V,K;let L=M();return L.option=(V=p.option)!=null?V:0,L.weight=(K=p.weight)!=null?K:"",L}};function U(){return{title:"",description:""}}e.TextProposal={encode(p,L=F.Writer.create()){return p.title!==""&&L.uint32(10).string(p.title),p.description!==""&&L.uint32(18).string(p.description),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=U();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.title=V.string();break;case 2:m.description=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{title:(0,N.isSet)(p.title)?String(p.title):"",description:(0,N.isSet)(p.description)?String(p.description):""}},toJSON(p){let L={};return p.title!==void 0&&(L.title=p.title),p.description!==void 0&&(L.description=p.description),L},fromPartial(p){var V,K;let L=U();return L.title=(V=p.title)!=null?V:"",L.description=(K=p.description)!=null?K:"",L}};function E(){return{proposalId:N.Long.UZERO,depositor:"",amount:[]}}e.Deposit={encode(p,L=F.Writer.create()){p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),p.depositor!==""&&L.uint32(18).string(p.depositor);for(let V of p.amount)f.Coin.encode(V,L.uint32(26).fork()).ldelim();return L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=E();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;case 2:m.depositor=V.string();break;case 3:m.amount.push(f.Coin.decode(V,V.uint32()));break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,N.isSet)(p.proposalId)?N.Long.fromValue(p.proposalId):N.Long.UZERO,depositor:(0,N.isSet)(p.depositor)?String(p.depositor):"",amount:Array.isArray(p==null?void 0:p.amount)?p.amount.map(L=>f.Coin.fromJSON(L)):[]}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||N.Long.UZERO).toString()),p.depositor!==void 0&&(L.depositor=p.depositor),p.amount?L.amount=p.amount.map(V=>V?f.Coin.toJSON(V):void 0):L.amount=[],L},fromPartial(p){var V,K;let L=E();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?N.Long.fromValue(p.proposalId):N.Long.UZERO,L.depositor=(V=p.depositor)!=null?V:"",L.amount=((K=p.amount)==null?void 0:K.map(m=>f.Coin.fromPartial(m)))||[],L}};function Q(){return{proposalId:N.Long.UZERO,content:void 0,status:0,finalTallyResult:void 0,submitTime:void 0,depositEndTime:void 0,totalDeposit:[],votingStartTime:void 0,votingEndTime:void 0}}e.Proposal={encode(p,L=F.Writer.create()){p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),p.content!==void 0&&l.Any.encode(p.content,L.uint32(18).fork()).ldelim(),p.status!==0&&L.uint32(24).int32(p.status),p.finalTallyResult!==void 0&&e.TallyResult.encode(p.finalTallyResult,L.uint32(34).fork()).ldelim(),p.submitTime!==void 0&&g.Timestamp.encode(p.submitTime,L.uint32(42).fork()).ldelim(),p.depositEndTime!==void 0&&g.Timestamp.encode(p.depositEndTime,L.uint32(50).fork()).ldelim();for(let V of p.totalDeposit)f.Coin.encode(V,L.uint32(58).fork()).ldelim();return p.votingStartTime!==void 0&&g.Timestamp.encode(p.votingStartTime,L.uint32(66).fork()).ldelim(),p.votingEndTime!==void 0&&g.Timestamp.encode(p.votingEndTime,L.uint32(74).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=Q();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;case 2:m.content=l.Any.decode(V,V.uint32());break;case 3:m.status=V.int32();break;case 4:m.finalTallyResult=e.TallyResult.decode(V,V.uint32());break;case 5:m.submitTime=g.Timestamp.decode(V,V.uint32());break;case 6:m.depositEndTime=g.Timestamp.decode(V,V.uint32());break;case 7:m.totalDeposit.push(f.Coin.decode(V,V.uint32()));break;case 8:m.votingStartTime=g.Timestamp.decode(V,V.uint32());break;case 9:m.votingEndTime=g.Timestamp.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,N.isSet)(p.proposalId)?N.Long.fromValue(p.proposalId):N.Long.UZERO,content:(0,N.isSet)(p.content)?l.Any.fromJSON(p.content):void 0,status:(0,N.isSet)(p.status)?Z(p.status):0,finalTallyResult:(0,N.isSet)(p.finalTallyResult)?e.TallyResult.fromJSON(p.finalTallyResult):void 0,submitTime:(0,N.isSet)(p.submitTime)?(0,N.fromJsonTimestamp)(p.submitTime):void 0,depositEndTime:(0,N.isSet)(p.depositEndTime)?(0,N.fromJsonTimestamp)(p.depositEndTime):void 0,totalDeposit:Array.isArray(p==null?void 0:p.totalDeposit)?p.totalDeposit.map(L=>f.Coin.fromJSON(L)):[],votingStartTime:(0,N.isSet)(p.votingStartTime)?(0,N.fromJsonTimestamp)(p.votingStartTime):void 0,votingEndTime:(0,N.isSet)(p.votingEndTime)?(0,N.fromJsonTimestamp)(p.votingEndTime):void 0}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||N.Long.UZERO).toString()),p.content!==void 0&&(L.content=p.content?l.Any.toJSON(p.content):void 0),p.status!==void 0&&(L.status=R(p.status)),p.finalTallyResult!==void 0&&(L.finalTallyResult=p.finalTallyResult?e.TallyResult.toJSON(p.finalTallyResult):void 0),p.submitTime!==void 0&&(L.submitTime=(0,N.fromTimestamp)(p.submitTime).toISOString()),p.depositEndTime!==void 0&&(L.depositEndTime=(0,N.fromTimestamp)(p.depositEndTime).toISOString()),p.totalDeposit?L.totalDeposit=p.totalDeposit.map(V=>V?f.Coin.toJSON(V):void 0):L.totalDeposit=[],p.votingStartTime!==void 0&&(L.votingStartTime=(0,N.fromTimestamp)(p.votingStartTime).toISOString()),p.votingEndTime!==void 0&&(L.votingEndTime=(0,N.fromTimestamp)(p.votingEndTime).toISOString()),L},fromPartial(p){var V,K;let L=Q();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?N.Long.fromValue(p.proposalId):N.Long.UZERO,L.content=p.content!==void 0&&p.content!==null?l.Any.fromPartial(p.content):void 0,L.status=(V=p.status)!=null?V:0,L.finalTallyResult=p.finalTallyResult!==void 0&&p.finalTallyResult!==null?e.TallyResult.fromPartial(p.finalTallyResult):void 0,L.submitTime=p.submitTime!==void 0&&p.submitTime!==null?g.Timestamp.fromPartial(p.submitTime):void 0,L.depositEndTime=p.depositEndTime!==void 0&&p.depositEndTime!==null?g.Timestamp.fromPartial(p.depositEndTime):void 0,L.totalDeposit=((K=p.totalDeposit)==null?void 0:K.map(m=>f.Coin.fromPartial(m)))||[],L.votingStartTime=p.votingStartTime!==void 0&&p.votingStartTime!==null?g.Timestamp.fromPartial(p.votingStartTime):void 0,L.votingEndTime=p.votingEndTime!==void 0&&p.votingEndTime!==null?g.Timestamp.fromPartial(p.votingEndTime):void 0,L}};function H(){return{yes:"",abstain:"",no:"",noWithVeto:""}}e.TallyResult={encode(p,L=F.Writer.create()){return p.yes!==""&&L.uint32(10).string(p.yes),p.abstain!==""&&L.uint32(18).string(p.abstain),p.no!==""&&L.uint32(26).string(p.no),p.noWithVeto!==""&&L.uint32(34).string(p.noWithVeto),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=H();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.yes=V.string();break;case 2:m.abstain=V.string();break;case 3:m.no=V.string();break;case 4:m.noWithVeto=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{yes:(0,N.isSet)(p.yes)?String(p.yes):"",abstain:(0,N.isSet)(p.abstain)?String(p.abstain):"",no:(0,N.isSet)(p.no)?String(p.no):"",noWithVeto:(0,N.isSet)(p.noWithVeto)?String(p.noWithVeto):""}},toJSON(p){let L={};return p.yes!==void 0&&(L.yes=p.yes),p.abstain!==void 0&&(L.abstain=p.abstain),p.no!==void 0&&(L.no=p.no),p.noWithVeto!==void 0&&(L.noWithVeto=p.noWithVeto),L},fromPartial(p){var V,K,m,h;let L=H();return L.yes=(V=p.yes)!=null?V:"",L.abstain=(K=p.abstain)!=null?K:"",L.no=(m=p.no)!=null?m:"",L.noWithVeto=(h=p.noWithVeto)!=null?h:"",L}};function re(){return{proposalId:N.Long.UZERO,voter:"",option:0,options:[]}}e.Vote={encode(p,L=F.Writer.create()){p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),p.voter!==""&&L.uint32(18).string(p.voter),p.option!==0&&L.uint32(24).int32(p.option);for(let V of p.options)e.WeightedVoteOption.encode(V,L.uint32(34).fork()).ldelim();return L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=re();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;case 2:m.voter=V.string();break;case 3:m.option=V.int32();break;case 4:m.options.push(e.WeightedVoteOption.decode(V,V.uint32()));break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,N.isSet)(p.proposalId)?N.Long.fromValue(p.proposalId):N.Long.UZERO,voter:(0,N.isSet)(p.voter)?String(p.voter):"",option:(0,N.isSet)(p.option)?te(p.option):0,options:Array.isArray(p==null?void 0:p.options)?p.options.map(L=>e.WeightedVoteOption.fromJSON(L)):[]}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||N.Long.UZERO).toString()),p.voter!==void 0&&(L.voter=p.voter),p.option!==void 0&&(L.option=v(p.option)),p.options?L.options=p.options.map(V=>V?e.WeightedVoteOption.toJSON(V):void 0):L.options=[],L},fromPartial(p){var V,K,m;let L=re();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?N.Long.fromValue(p.proposalId):N.Long.UZERO,L.voter=(V=p.voter)!=null?V:"",L.option=(K=p.option)!=null?K:0,L.options=((m=p.options)==null?void 0:m.map(h=>e.WeightedVoteOption.fromPartial(h)))||[],L}};function ee(){return{minDeposit:[],maxDepositPeriod:void 0}}e.DepositParams={encode(p,L=F.Writer.create()){for(let V of p.minDeposit)f.Coin.encode(V,L.uint32(10).fork()).ldelim();return p.maxDepositPeriod!==void 0&&w.Duration.encode(p.maxDepositPeriod,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=ee();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.minDeposit.push(f.Coin.decode(V,V.uint32()));break;case 2:m.maxDepositPeriod=w.Duration.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{minDeposit:Array.isArray(p==null?void 0:p.minDeposit)?p.minDeposit.map(L=>f.Coin.fromJSON(L)):[],maxDepositPeriod:(0,N.isSet)(p.maxDepositPeriod)?w.Duration.fromJSON(p.maxDepositPeriod):void 0}},toJSON(p){let L={};return p.minDeposit?L.minDeposit=p.minDeposit.map(V=>V?f.Coin.toJSON(V):void 0):L.minDeposit=[],p.maxDepositPeriod!==void 0&&(L.maxDepositPeriod=p.maxDepositPeriod?w.Duration.toJSON(p.maxDepositPeriod):void 0),L},fromPartial(p){var V;let L=ee();return L.minDeposit=((V=p.minDeposit)==null?void 0:V.map(K=>f.Coin.fromPartial(K)))||[],L.maxDepositPeriod=p.maxDepositPeriod!==void 0&&p.maxDepositPeriod!==null?w.Duration.fromPartial(p.maxDepositPeriod):void 0,L}};function T(){return{votingPeriod:void 0}}e.VotingParams={encode(p,L=F.Writer.create()){return p.votingPeriod!==void 0&&w.Duration.encode(p.votingPeriod,L.uint32(10).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=T();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.votingPeriod=w.Duration.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{votingPeriod:(0,N.isSet)(p.votingPeriod)?w.Duration.fromJSON(p.votingPeriod):void 0}},toJSON(p){let L={};return p.votingPeriod!==void 0&&(L.votingPeriod=p.votingPeriod?w.Duration.toJSON(p.votingPeriod):void 0),L},fromPartial(p){let L=T();return L.votingPeriod=p.votingPeriod!==void 0&&p.votingPeriod!==null?w.Duration.fromPartial(p.votingPeriod):void 0,L}};function se(){return{quorum:new Uint8Array,threshold:new Uint8Array,vetoThreshold:new Uint8Array}}e.TallyParams={encode(p,L=F.Writer.create()){return p.quorum.length!==0&&L.uint32(10).bytes(p.quorum),p.threshold.length!==0&&L.uint32(18).bytes(p.threshold),p.vetoThreshold.length!==0&&L.uint32(26).bytes(p.vetoThreshold),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=se();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.quorum=V.bytes();break;case 2:m.threshold=V.bytes();break;case 3:m.vetoThreshold=V.bytes();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{quorum:(0,N.isSet)(p.quorum)?(0,N.bytesFromBase64)(p.quorum):new Uint8Array,threshold:(0,N.isSet)(p.threshold)?(0,N.bytesFromBase64)(p.threshold):new Uint8Array,vetoThreshold:(0,N.isSet)(p.vetoThreshold)?(0,N.bytesFromBase64)(p.vetoThreshold):new Uint8Array}},toJSON(p){let L={};return p.quorum!==void 0&&(L.quorum=(0,N.base64FromBytes)(p.quorum!==void 0?p.quorum:new Uint8Array)),p.threshold!==void 0&&(L.threshold=(0,N.base64FromBytes)(p.threshold!==void 0?p.threshold:new Uint8Array)),p.vetoThreshold!==void 0&&(L.vetoThreshold=(0,N.base64FromBytes)(p.vetoThreshold!==void 0?p.vetoThreshold:new Uint8Array)),L},fromPartial(p){var V,K,m;let L=se();return L.quorum=(V=p.quorum)!=null?V:new Uint8Array,L.threshold=(K=p.threshold)!=null?K:new Uint8Array,L.vetoThreshold=(m=p.vetoThreshold)!=null?m:new Uint8Array,L}}})(svt);var n8s=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gM,"__esModule",{value:!0});gM.createGovAminoConverters=gM.isAminoMsgDeposit=gM.isAminoMsgVoteWeighted=gM.isAminoMsgVote=gM.isAminoMsgSubmitProposal=void 0;var r8s=EE,JHe=O3,HHe=svt,i8s=fh,R2n=n8s(qM),o8s=Rw;function a8s(e){return e.type==="cosmos-sdk/MsgSubmitProposal"}gM.isAminoMsgSubmitProposal=a8s;function s8s(e){return e.type==="cosmos-sdk/MsgVote"}gM.isAminoMsgVote=s8s;function A8s(e){return e.type==="cosmos-sdk/MsgVoteWeighted"}gM.isAminoMsgVoteWeighted=A8s;function d8s(e){return e.type==="cosmos-sdk/MsgDeposit"}gM.isAminoMsgDeposit=d8s;function c8s(){return{"/cosmos.gov.v1beta1.MsgDeposit":{aminoType:"cosmos-sdk/MsgDeposit",toAmino:({amount:e,depositor:i,proposalId:A})=>({amount:e,depositor:i,proposal_id:A.toString()}),fromAmino:({amount:e,depositor:i,proposal_id:A})=>({amount:Array.from(e),depositor:i,proposalId:R2n.default.fromString(A)})},"/cosmos.gov.v1beta1.MsgVote":{aminoType:"cosmos-sdk/MsgVote",toAmino:({option:e,proposalId:i,voter:A})=>({option:e,proposal_id:i.toString(),voter:A}),fromAmino:({option:e,proposal_id:i,voter:A})=>({option:(0,HHe.voteOptionFromJSON)(e),proposalId:R2n.default.fromString(i),voter:A})},"/cosmos.gov.v1beta1.MsgVoteWeighted":{aminoType:"cosmos-sdk/MsgVoteWeighted",toAmino:({options:e,proposalId:i,voter:A})=>({options:e.map(c=>({option:c.option,weight:(0,o8s.decodeCosmosSdkDecFromProto)(c.weight).toString().padEnd(20,"0")})),proposal_id:i.toString(),voter:A}),fromAmino:({options:e,proposal_id:i,voter:A})=>({proposalId:R2n.default.fromString(i),voter:A,options:e.map(c=>({option:(0,HHe.voteOptionFromJSON)(c.option),weight:r8s.Decimal.fromUserInput(c.weight,18).atomics}))})},"/cosmos.gov.v1beta1.MsgSubmitProposal":{aminoType:"cosmos-sdk/MsgSubmitProposal",toAmino:({initialDeposit:e,proposer:i,content:A})=>{(0,JHe.assertDefinedAndNotNull)(A);let c;switch(A.typeUrl){case"/cosmos.gov.v1beta1.TextProposal":{let f=HHe.TextProposal.decode(A.value);c={type:"cosmos-sdk/TextProposal",value:{description:f.description,title:f.title}};break}default:throw new Error(`Unsupported proposal type: '${A.typeUrl}'`)}return{initial_deposit:e,proposer:i,content:c}},fromAmino:({initial_deposit:e,proposer:i,content:A})=>{let c;switch(A.type){case"cosmos-sdk/TextProposal":{let{value:f}=A;(0,JHe.assert)((0,JHe.isNonNullObject)(f));let{title:l,description:g}=f;(0,JHe.assert)(typeof l=="string"),(0,JHe.assert)(typeof g=="string"),c=i8s.Any.fromPartial({typeUrl:"/cosmos.gov.v1beta1.TextProposal",value:HHe.TextProposal.encode(HHe.TextProposal.fromPartial({title:l,description:g})).finish()});break}default:throw new Error(`Unsupported proposal type: '${A.type}'`)}return{initialDeposit:Array.from(e),proposer:i,content:c}}}}}gM.createGovAminoConverters=c8s;var pM={},b$r={},S$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(p,L,V,K){K===void 0&&(K=V);var m=Object.getOwnPropertyDescriptor(L,V);(!m||("get"in m?!L.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return L[V]}}),Object.defineProperty(p,K,m)}:function(p,L,V,K){K===void 0&&(K=V),p[K]=L[V]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(p,L){Object.defineProperty(p,"default",{enumerable:!0,value:L})}:function(p,L){p.default=L}),c=Fr&&Fr.__importStar||function(p){if(p&&p.__esModule)return p;var L={};if(p!=null)for(var V in p)V!=="default"&&Object.prototype.hasOwnProperty.call(p,V)&&i(L,p,V);return A(L,p),L};Object.defineProperty(e,"__esModule",{value:!0}),e.Params=e.TallyParams=e.VotingParams=e.DepositParams=e.Vote=e.TallyResult=e.Proposal=e.Deposit=e.WeightedVoteOption=e.proposalStatusToJSON=e.proposalStatusFromJSON=e.ProposalStatus=e.voteOptionToJSON=e.voteOptionFromJSON=e.VoteOption=e.protobufPackage=void 0;let f=gg,l=fh,g=k3,w=MR,N=Ns,F=c(BA);e.protobufPackage="cosmos.gov.v1";var j;(function(p){p[p.VOTE_OPTION_UNSPECIFIED=0]="VOTE_OPTION_UNSPECIFIED",p[p.VOTE_OPTION_YES=1]="VOTE_OPTION_YES",p[p.VOTE_OPTION_ABSTAIN=2]="VOTE_OPTION_ABSTAIN",p[p.VOTE_OPTION_NO=3]="VOTE_OPTION_NO",p[p.VOTE_OPTION_NO_WITH_VETO=4]="VOTE_OPTION_NO_WITH_VETO",p[p.UNRECOGNIZED=-1]="UNRECOGNIZED"})(j=e.VoteOption||(e.VoteOption={}));function te(p){switch(p){case 0:case"VOTE_OPTION_UNSPECIFIED":return j.VOTE_OPTION_UNSPECIFIED;case 1:case"VOTE_OPTION_YES":return j.VOTE_OPTION_YES;case 2:case"VOTE_OPTION_ABSTAIN":return j.VOTE_OPTION_ABSTAIN;case 3:case"VOTE_OPTION_NO":return j.VOTE_OPTION_NO;case 4:case"VOTE_OPTION_NO_WITH_VETO":return j.VOTE_OPTION_NO_WITH_VETO;case-1:case"UNRECOGNIZED":default:return j.UNRECOGNIZED}}e.voteOptionFromJSON=te;function v(p){switch(p){case j.VOTE_OPTION_UNSPECIFIED:return"VOTE_OPTION_UNSPECIFIED";case j.VOTE_OPTION_YES:return"VOTE_OPTION_YES";case j.VOTE_OPTION_ABSTAIN:return"VOTE_OPTION_ABSTAIN";case j.VOTE_OPTION_NO:return"VOTE_OPTION_NO";case j.VOTE_OPTION_NO_WITH_VETO:return"VOTE_OPTION_NO_WITH_VETO";case j.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.voteOptionToJSON=v;var ne;(function(p){p[p.PROPOSAL_STATUS_UNSPECIFIED=0]="PROPOSAL_STATUS_UNSPECIFIED",p[p.PROPOSAL_STATUS_DEPOSIT_PERIOD=1]="PROPOSAL_STATUS_DEPOSIT_PERIOD",p[p.PROPOSAL_STATUS_VOTING_PERIOD=2]="PROPOSAL_STATUS_VOTING_PERIOD",p[p.PROPOSAL_STATUS_PASSED=3]="PROPOSAL_STATUS_PASSED",p[p.PROPOSAL_STATUS_REJECTED=4]="PROPOSAL_STATUS_REJECTED",p[p.PROPOSAL_STATUS_FAILED=5]="PROPOSAL_STATUS_FAILED",p[p.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ne=e.ProposalStatus||(e.ProposalStatus={}));function Z(p){switch(p){case 0:case"PROPOSAL_STATUS_UNSPECIFIED":return ne.PROPOSAL_STATUS_UNSPECIFIED;case 1:case"PROPOSAL_STATUS_DEPOSIT_PERIOD":return ne.PROPOSAL_STATUS_DEPOSIT_PERIOD;case 2:case"PROPOSAL_STATUS_VOTING_PERIOD":return ne.PROPOSAL_STATUS_VOTING_PERIOD;case 3:case"PROPOSAL_STATUS_PASSED":return ne.PROPOSAL_STATUS_PASSED;case 4:case"PROPOSAL_STATUS_REJECTED":return ne.PROPOSAL_STATUS_REJECTED;case 5:case"PROPOSAL_STATUS_FAILED":return ne.PROPOSAL_STATUS_FAILED;case-1:case"UNRECOGNIZED":default:return ne.UNRECOGNIZED}}e.proposalStatusFromJSON=Z;function R(p){switch(p){case ne.PROPOSAL_STATUS_UNSPECIFIED:return"PROPOSAL_STATUS_UNSPECIFIED";case ne.PROPOSAL_STATUS_DEPOSIT_PERIOD:return"PROPOSAL_STATUS_DEPOSIT_PERIOD";case ne.PROPOSAL_STATUS_VOTING_PERIOD:return"PROPOSAL_STATUS_VOTING_PERIOD";case ne.PROPOSAL_STATUS_PASSED:return"PROPOSAL_STATUS_PASSED";case ne.PROPOSAL_STATUS_REJECTED:return"PROPOSAL_STATUS_REJECTED";case ne.PROPOSAL_STATUS_FAILED:return"PROPOSAL_STATUS_FAILED";case ne.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.proposalStatusToJSON=R;function M(){return{option:0,weight:""}}e.WeightedVoteOption={encode(p,L=F.Writer.create()){return p.option!==0&&L.uint32(8).int32(p.option),p.weight!==""&&L.uint32(18).string(p.weight),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=M();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.option=V.int32();break;case 2:m.weight=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{option:(0,N.isSet)(p.option)?te(p.option):0,weight:(0,N.isSet)(p.weight)?String(p.weight):""}},toJSON(p){let L={};return p.option!==void 0&&(L.option=v(p.option)),p.weight!==void 0&&(L.weight=p.weight),L},fromPartial(p){var V,K;let L=M();return L.option=(V=p.option)!=null?V:0,L.weight=(K=p.weight)!=null?K:"",L}};function U(){return{proposalId:N.Long.UZERO,depositor:"",amount:[]}}e.Deposit={encode(p,L=F.Writer.create()){p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),p.depositor!==""&&L.uint32(18).string(p.depositor);for(let V of p.amount)f.Coin.encode(V,L.uint32(26).fork()).ldelim();return L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=U();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;case 2:m.depositor=V.string();break;case 3:m.amount.push(f.Coin.decode(V,V.uint32()));break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,N.isSet)(p.proposalId)?N.Long.fromValue(p.proposalId):N.Long.UZERO,depositor:(0,N.isSet)(p.depositor)?String(p.depositor):"",amount:Array.isArray(p==null?void 0:p.amount)?p.amount.map(L=>f.Coin.fromJSON(L)):[]}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||N.Long.UZERO).toString()),p.depositor!==void 0&&(L.depositor=p.depositor),p.amount?L.amount=p.amount.map(V=>V?f.Coin.toJSON(V):void 0):L.amount=[],L},fromPartial(p){var V,K;let L=U();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?N.Long.fromValue(p.proposalId):N.Long.UZERO,L.depositor=(V=p.depositor)!=null?V:"",L.amount=((K=p.amount)==null?void 0:K.map(m=>f.Coin.fromPartial(m)))||[],L}};function E(){return{id:N.Long.UZERO,messages:[],status:0,finalTallyResult:void 0,submitTime:void 0,depositEndTime:void 0,totalDeposit:[],votingStartTime:void 0,votingEndTime:void 0,metadata:"",title:"",summary:"",proposer:""}}e.Proposal={encode(p,L=F.Writer.create()){p.id.isZero()||L.uint32(8).uint64(p.id);for(let V of p.messages)l.Any.encode(V,L.uint32(18).fork()).ldelim();p.status!==0&&L.uint32(24).int32(p.status),p.finalTallyResult!==void 0&&e.TallyResult.encode(p.finalTallyResult,L.uint32(34).fork()).ldelim(),p.submitTime!==void 0&&g.Timestamp.encode(p.submitTime,L.uint32(42).fork()).ldelim(),p.depositEndTime!==void 0&&g.Timestamp.encode(p.depositEndTime,L.uint32(50).fork()).ldelim();for(let V of p.totalDeposit)f.Coin.encode(V,L.uint32(58).fork()).ldelim();return p.votingStartTime!==void 0&&g.Timestamp.encode(p.votingStartTime,L.uint32(66).fork()).ldelim(),p.votingEndTime!==void 0&&g.Timestamp.encode(p.votingEndTime,L.uint32(74).fork()).ldelim(),p.metadata!==""&&L.uint32(82).string(p.metadata),p.title!==""&&L.uint32(90).string(p.title),p.summary!==""&&L.uint32(98).string(p.summary),p.proposer!==""&&L.uint32(106).string(p.proposer),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=E();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.id=V.uint64();break;case 2:m.messages.push(l.Any.decode(V,V.uint32()));break;case 3:m.status=V.int32();break;case 4:m.finalTallyResult=e.TallyResult.decode(V,V.uint32());break;case 5:m.submitTime=g.Timestamp.decode(V,V.uint32());break;case 6:m.depositEndTime=g.Timestamp.decode(V,V.uint32());break;case 7:m.totalDeposit.push(f.Coin.decode(V,V.uint32()));break;case 8:m.votingStartTime=g.Timestamp.decode(V,V.uint32());break;case 9:m.votingEndTime=g.Timestamp.decode(V,V.uint32());break;case 10:m.metadata=V.string();break;case 11:m.title=V.string();break;case 12:m.summary=V.string();break;case 13:m.proposer=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{id:(0,N.isSet)(p.id)?N.Long.fromValue(p.id):N.Long.UZERO,messages:Array.isArray(p==null?void 0:p.messages)?p.messages.map(L=>l.Any.fromJSON(L)):[],status:(0,N.isSet)(p.status)?Z(p.status):0,finalTallyResult:(0,N.isSet)(p.finalTallyResult)?e.TallyResult.fromJSON(p.finalTallyResult):void 0,submitTime:(0,N.isSet)(p.submitTime)?(0,N.fromJsonTimestamp)(p.submitTime):void 0,depositEndTime:(0,N.isSet)(p.depositEndTime)?(0,N.fromJsonTimestamp)(p.depositEndTime):void 0,totalDeposit:Array.isArray(p==null?void 0:p.totalDeposit)?p.totalDeposit.map(L=>f.Coin.fromJSON(L)):[],votingStartTime:(0,N.isSet)(p.votingStartTime)?(0,N.fromJsonTimestamp)(p.votingStartTime):void 0,votingEndTime:(0,N.isSet)(p.votingEndTime)?(0,N.fromJsonTimestamp)(p.votingEndTime):void 0,metadata:(0,N.isSet)(p.metadata)?String(p.metadata):"",title:(0,N.isSet)(p.title)?String(p.title):"",summary:(0,N.isSet)(p.summary)?String(p.summary):"",proposer:(0,N.isSet)(p.proposer)?String(p.proposer):""}},toJSON(p){let L={};return p.id!==void 0&&(L.id=(p.id||N.Long.UZERO).toString()),p.messages?L.messages=p.messages.map(V=>V?l.Any.toJSON(V):void 0):L.messages=[],p.status!==void 0&&(L.status=R(p.status)),p.finalTallyResult!==void 0&&(L.finalTallyResult=p.finalTallyResult?e.TallyResult.toJSON(p.finalTallyResult):void 0),p.submitTime!==void 0&&(L.submitTime=(0,N.fromTimestamp)(p.submitTime).toISOString()),p.depositEndTime!==void 0&&(L.depositEndTime=(0,N.fromTimestamp)(p.depositEndTime).toISOString()),p.totalDeposit?L.totalDeposit=p.totalDeposit.map(V=>V?f.Coin.toJSON(V):void 0):L.totalDeposit=[],p.votingStartTime!==void 0&&(L.votingStartTime=(0,N.fromTimestamp)(p.votingStartTime).toISOString()),p.votingEndTime!==void 0&&(L.votingEndTime=(0,N.fromTimestamp)(p.votingEndTime).toISOString()),p.metadata!==void 0&&(L.metadata=p.metadata),p.title!==void 0&&(L.title=p.title),p.summary!==void 0&&(L.summary=p.summary),p.proposer!==void 0&&(L.proposer=p.proposer),L},fromPartial(p){var V,K,m,h,_,b,O;let L=E();return L.id=p.id!==void 0&&p.id!==null?N.Long.fromValue(p.id):N.Long.UZERO,L.messages=((V=p.messages)==null?void 0:V.map(J=>l.Any.fromPartial(J)))||[],L.status=(K=p.status)!=null?K:0,L.finalTallyResult=p.finalTallyResult!==void 0&&p.finalTallyResult!==null?e.TallyResult.fromPartial(p.finalTallyResult):void 0,L.submitTime=p.submitTime!==void 0&&p.submitTime!==null?g.Timestamp.fromPartial(p.submitTime):void 0,L.depositEndTime=p.depositEndTime!==void 0&&p.depositEndTime!==null?g.Timestamp.fromPartial(p.depositEndTime):void 0,L.totalDeposit=((m=p.totalDeposit)==null?void 0:m.map(J=>f.Coin.fromPartial(J)))||[],L.votingStartTime=p.votingStartTime!==void 0&&p.votingStartTime!==null?g.Timestamp.fromPartial(p.votingStartTime):void 0,L.votingEndTime=p.votingEndTime!==void 0&&p.votingEndTime!==null?g.Timestamp.fromPartial(p.votingEndTime):void 0,L.metadata=(h=p.metadata)!=null?h:"",L.title=(_=p.title)!=null?_:"",L.summary=(b=p.summary)!=null?b:"",L.proposer=(O=p.proposer)!=null?O:"",L}};function Q(){return{yesCount:"",abstainCount:"",noCount:"",noWithVetoCount:""}}e.TallyResult={encode(p,L=F.Writer.create()){return p.yesCount!==""&&L.uint32(10).string(p.yesCount),p.abstainCount!==""&&L.uint32(18).string(p.abstainCount),p.noCount!==""&&L.uint32(26).string(p.noCount),p.noWithVetoCount!==""&&L.uint32(34).string(p.noWithVetoCount),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=Q();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.yesCount=V.string();break;case 2:m.abstainCount=V.string();break;case 3:m.noCount=V.string();break;case 4:m.noWithVetoCount=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{yesCount:(0,N.isSet)(p.yesCount)?String(p.yesCount):"",abstainCount:(0,N.isSet)(p.abstainCount)?String(p.abstainCount):"",noCount:(0,N.isSet)(p.noCount)?String(p.noCount):"",noWithVetoCount:(0,N.isSet)(p.noWithVetoCount)?String(p.noWithVetoCount):""}},toJSON(p){let L={};return p.yesCount!==void 0&&(L.yesCount=p.yesCount),p.abstainCount!==void 0&&(L.abstainCount=p.abstainCount),p.noCount!==void 0&&(L.noCount=p.noCount),p.noWithVetoCount!==void 0&&(L.noWithVetoCount=p.noWithVetoCount),L},fromPartial(p){var V,K,m,h;let L=Q();return L.yesCount=(V=p.yesCount)!=null?V:"",L.abstainCount=(K=p.abstainCount)!=null?K:"",L.noCount=(m=p.noCount)!=null?m:"",L.noWithVetoCount=(h=p.noWithVetoCount)!=null?h:"",L}};function H(){return{proposalId:N.Long.UZERO,voter:"",options:[],metadata:""}}e.Vote={encode(p,L=F.Writer.create()){p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),p.voter!==""&&L.uint32(18).string(p.voter);for(let V of p.options)e.WeightedVoteOption.encode(V,L.uint32(34).fork()).ldelim();return p.metadata!==""&&L.uint32(42).string(p.metadata),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=H();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;case 2:m.voter=V.string();break;case 4:m.options.push(e.WeightedVoteOption.decode(V,V.uint32()));break;case 5:m.metadata=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,N.isSet)(p.proposalId)?N.Long.fromValue(p.proposalId):N.Long.UZERO,voter:(0,N.isSet)(p.voter)?String(p.voter):"",options:Array.isArray(p==null?void 0:p.options)?p.options.map(L=>e.WeightedVoteOption.fromJSON(L)):[],metadata:(0,N.isSet)(p.metadata)?String(p.metadata):""}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||N.Long.UZERO).toString()),p.voter!==void 0&&(L.voter=p.voter),p.options?L.options=p.options.map(V=>V?e.WeightedVoteOption.toJSON(V):void 0):L.options=[],p.metadata!==void 0&&(L.metadata=p.metadata),L},fromPartial(p){var V,K,m;let L=H();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?N.Long.fromValue(p.proposalId):N.Long.UZERO,L.voter=(V=p.voter)!=null?V:"",L.options=((K=p.options)==null?void 0:K.map(h=>e.WeightedVoteOption.fromPartial(h)))||[],L.metadata=(m=p.metadata)!=null?m:"",L}};function re(){return{minDeposit:[],maxDepositPeriod:void 0}}e.DepositParams={encode(p,L=F.Writer.create()){for(let V of p.minDeposit)f.Coin.encode(V,L.uint32(10).fork()).ldelim();return p.maxDepositPeriod!==void 0&&w.Duration.encode(p.maxDepositPeriod,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=re();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.minDeposit.push(f.Coin.decode(V,V.uint32()));break;case 2:m.maxDepositPeriod=w.Duration.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{minDeposit:Array.isArray(p==null?void 0:p.minDeposit)?p.minDeposit.map(L=>f.Coin.fromJSON(L)):[],maxDepositPeriod:(0,N.isSet)(p.maxDepositPeriod)?w.Duration.fromJSON(p.maxDepositPeriod):void 0}},toJSON(p){let L={};return p.minDeposit?L.minDeposit=p.minDeposit.map(V=>V?f.Coin.toJSON(V):void 0):L.minDeposit=[],p.maxDepositPeriod!==void 0&&(L.maxDepositPeriod=p.maxDepositPeriod?w.Duration.toJSON(p.maxDepositPeriod):void 0),L},fromPartial(p){var V;let L=re();return L.minDeposit=((V=p.minDeposit)==null?void 0:V.map(K=>f.Coin.fromPartial(K)))||[],L.maxDepositPeriod=p.maxDepositPeriod!==void 0&&p.maxDepositPeriod!==null?w.Duration.fromPartial(p.maxDepositPeriod):void 0,L}};function ee(){return{votingPeriod:void 0}}e.VotingParams={encode(p,L=F.Writer.create()){return p.votingPeriod!==void 0&&w.Duration.encode(p.votingPeriod,L.uint32(10).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=ee();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.votingPeriod=w.Duration.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{votingPeriod:(0,N.isSet)(p.votingPeriod)?w.Duration.fromJSON(p.votingPeriod):void 0}},toJSON(p){let L={};return p.votingPeriod!==void 0&&(L.votingPeriod=p.votingPeriod?w.Duration.toJSON(p.votingPeriod):void 0),L},fromPartial(p){let L=ee();return L.votingPeriod=p.votingPeriod!==void 0&&p.votingPeriod!==null?w.Duration.fromPartial(p.votingPeriod):void 0,L}};function T(){return{quorum:"",threshold:"",vetoThreshold:""}}e.TallyParams={encode(p,L=F.Writer.create()){return p.quorum!==""&&L.uint32(10).string(p.quorum),p.threshold!==""&&L.uint32(18).string(p.threshold),p.vetoThreshold!==""&&L.uint32(26).string(p.vetoThreshold),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=T();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.quorum=V.string();break;case 2:m.threshold=V.string();break;case 3:m.vetoThreshold=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{quorum:(0,N.isSet)(p.quorum)?String(p.quorum):"",threshold:(0,N.isSet)(p.threshold)?String(p.threshold):"",vetoThreshold:(0,N.isSet)(p.vetoThreshold)?String(p.vetoThreshold):""}},toJSON(p){let L={};return p.quorum!==void 0&&(L.quorum=p.quorum),p.threshold!==void 0&&(L.threshold=p.threshold),p.vetoThreshold!==void 0&&(L.vetoThreshold=p.vetoThreshold),L},fromPartial(p){var V,K,m;let L=T();return L.quorum=(V=p.quorum)!=null?V:"",L.threshold=(K=p.threshold)!=null?K:"",L.vetoThreshold=(m=p.vetoThreshold)!=null?m:"",L}};function se(){return{minDeposit:[],maxDepositPeriod:void 0,votingPeriod:void 0,quorum:"",threshold:"",vetoThreshold:"",minInitialDepositRatio:"",burnVoteQuorum:!1,burnProposalDepositPrevote:!1,burnVoteVeto:!1}}e.Params={encode(p,L=F.Writer.create()){for(let V of p.minDeposit)f.Coin.encode(V,L.uint32(10).fork()).ldelim();return p.maxDepositPeriod!==void 0&&w.Duration.encode(p.maxDepositPeriod,L.uint32(18).fork()).ldelim(),p.votingPeriod!==void 0&&w.Duration.encode(p.votingPeriod,L.uint32(26).fork()).ldelim(),p.quorum!==""&&L.uint32(34).string(p.quorum),p.threshold!==""&&L.uint32(42).string(p.threshold),p.vetoThreshold!==""&&L.uint32(50).string(p.vetoThreshold),p.minInitialDepositRatio!==""&&L.uint32(58).string(p.minInitialDepositRatio),p.burnVoteQuorum===!0&&L.uint32(104).bool(p.burnVoteQuorum),p.burnProposalDepositPrevote===!0&&L.uint32(112).bool(p.burnProposalDepositPrevote),p.burnVoteVeto===!0&&L.uint32(120).bool(p.burnVoteVeto),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=se();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.minDeposit.push(f.Coin.decode(V,V.uint32()));break;case 2:m.maxDepositPeriod=w.Duration.decode(V,V.uint32());break;case 3:m.votingPeriod=w.Duration.decode(V,V.uint32());break;case 4:m.quorum=V.string();break;case 5:m.threshold=V.string();break;case 6:m.vetoThreshold=V.string();break;case 7:m.minInitialDepositRatio=V.string();break;case 13:m.burnVoteQuorum=V.bool();break;case 14:m.burnProposalDepositPrevote=V.bool();break;case 15:m.burnVoteVeto=V.bool();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{minDeposit:Array.isArray(p==null?void 0:p.minDeposit)?p.minDeposit.map(L=>f.Coin.fromJSON(L)):[],maxDepositPeriod:(0,N.isSet)(p.maxDepositPeriod)?w.Duration.fromJSON(p.maxDepositPeriod):void 0,votingPeriod:(0,N.isSet)(p.votingPeriod)?w.Duration.fromJSON(p.votingPeriod):void 0,quorum:(0,N.isSet)(p.quorum)?String(p.quorum):"",threshold:(0,N.isSet)(p.threshold)?String(p.threshold):"",vetoThreshold:(0,N.isSet)(p.vetoThreshold)?String(p.vetoThreshold):"",minInitialDepositRatio:(0,N.isSet)(p.minInitialDepositRatio)?String(p.minInitialDepositRatio):"",burnVoteQuorum:(0,N.isSet)(p.burnVoteQuorum)?!!p.burnVoteQuorum:!1,burnProposalDepositPrevote:(0,N.isSet)(p.burnProposalDepositPrevote)?!!p.burnProposalDepositPrevote:!1,burnVoteVeto:(0,N.isSet)(p.burnVoteVeto)?!!p.burnVoteVeto:!1}},toJSON(p){let L={};return p.minDeposit?L.minDeposit=p.minDeposit.map(V=>V?f.Coin.toJSON(V):void 0):L.minDeposit=[],p.maxDepositPeriod!==void 0&&(L.maxDepositPeriod=p.maxDepositPeriod?w.Duration.toJSON(p.maxDepositPeriod):void 0),p.votingPeriod!==void 0&&(L.votingPeriod=p.votingPeriod?w.Duration.toJSON(p.votingPeriod):void 0),p.quorum!==void 0&&(L.quorum=p.quorum),p.threshold!==void 0&&(L.threshold=p.threshold),p.vetoThreshold!==void 0&&(L.vetoThreshold=p.vetoThreshold),p.minInitialDepositRatio!==void 0&&(L.minInitialDepositRatio=p.minInitialDepositRatio),p.burnVoteQuorum!==void 0&&(L.burnVoteQuorum=p.burnVoteQuorum),p.burnProposalDepositPrevote!==void 0&&(L.burnProposalDepositPrevote=p.burnProposalDepositPrevote),p.burnVoteVeto!==void 0&&(L.burnVoteVeto=p.burnVoteVeto),L},fromPartial(p){var V,K,m,h,_,b,O,J;let L=se();return L.minDeposit=((V=p.minDeposit)==null?void 0:V.map(ie=>f.Coin.fromPartial(ie)))||[],L.maxDepositPeriod=p.maxDepositPeriod!==void 0&&p.maxDepositPeriod!==null?w.Duration.fromPartial(p.maxDepositPeriod):void 0,L.votingPeriod=p.votingPeriod!==void 0&&p.votingPeriod!==null?w.Duration.fromPartial(p.votingPeriod):void 0,L.quorum=(K=p.quorum)!=null?K:"",L.threshold=(m=p.threshold)!=null?m:"",L.vetoThreshold=(h=p.vetoThreshold)!=null?h:"",L.minInitialDepositRatio=(_=p.minInitialDepositRatio)!=null?_:"",L.burnVoteQuorum=(b=p.burnVoteQuorum)!=null?b:!1,L.burnProposalDepositPrevote=(O=p.burnProposalDepositPrevote)!=null?O:!1,L.burnVoteVeto=(J=p.burnVoteVeto)!=null?J:!1,L}}})(S$r);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(ee,T,se,p){p===void 0&&(p=se);var L=Object.getOwnPropertyDescriptor(T,se);(!L||("get"in L?!T.__esModule:L.writable||L.configurable))&&(L={enumerable:!0,get:function(){return T[se]}}),Object.defineProperty(ee,p,L)}:function(ee,T,se,p){p===void 0&&(p=se),ee[p]=T[se]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(ee,T){Object.defineProperty(ee,"default",{enumerable:!0,value:T})}:function(ee,T){ee.default=T}),c=Fr&&Fr.__importStar||function(ee){if(ee&&ee.__esModule)return ee;var T={};if(ee!=null)for(var se in ee)se!=="default"&&Object.prototype.hasOwnProperty.call(ee,se)&&i(T,ee,se);return A(T,ee),T};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgUpdateParamsResponse=e.MsgUpdateParams=e.MsgDepositResponse=e.MsgDeposit=e.MsgVoteWeightedResponse=e.MsgVoteWeighted=e.MsgVoteResponse=e.MsgVote=e.MsgExecLegacyContentResponse=e.MsgExecLegacyContent=e.MsgSubmitProposalResponse=e.MsgSubmitProposal=e.protobufPackage=void 0;let f=fh,l=gg,g=S$r,w=Ns,N=c(BA);e.protobufPackage="cosmos.gov.v1";function F(){return{messages:[],initialDeposit:[],proposer:"",metadata:"",title:"",summary:""}}e.MsgSubmitProposal={encode(ee,T=N.Writer.create()){for(let se of ee.messages)f.Any.encode(se,T.uint32(10).fork()).ldelim();for(let se of ee.initialDeposit)l.Coin.encode(se,T.uint32(18).fork()).ldelim();return ee.proposer!==""&&T.uint32(26).string(ee.proposer),ee.metadata!==""&&T.uint32(34).string(ee.metadata),ee.title!==""&&T.uint32(42).string(ee.title),ee.summary!==""&&T.uint32(50).string(ee.summary),T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=F();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){case 1:L.messages.push(f.Any.decode(se,se.uint32()));break;case 2:L.initialDeposit.push(l.Coin.decode(se,se.uint32()));break;case 3:L.proposer=se.string();break;case 4:L.metadata=se.string();break;case 5:L.title=se.string();break;case 6:L.summary=se.string();break;default:se.skipType(V&7);break}}return L},fromJSON(ee){return{messages:Array.isArray(ee==null?void 0:ee.messages)?ee.messages.map(T=>f.Any.fromJSON(T)):[],initialDeposit:Array.isArray(ee==null?void 0:ee.initialDeposit)?ee.initialDeposit.map(T=>l.Coin.fromJSON(T)):[],proposer:(0,w.isSet)(ee.proposer)?String(ee.proposer):"",metadata:(0,w.isSet)(ee.metadata)?String(ee.metadata):"",title:(0,w.isSet)(ee.title)?String(ee.title):"",summary:(0,w.isSet)(ee.summary)?String(ee.summary):""}},toJSON(ee){let T={};return ee.messages?T.messages=ee.messages.map(se=>se?f.Any.toJSON(se):void 0):T.messages=[],ee.initialDeposit?T.initialDeposit=ee.initialDeposit.map(se=>se?l.Coin.toJSON(se):void 0):T.initialDeposit=[],ee.proposer!==void 0&&(T.proposer=ee.proposer),ee.metadata!==void 0&&(T.metadata=ee.metadata),ee.title!==void 0&&(T.title=ee.title),ee.summary!==void 0&&(T.summary=ee.summary),T},fromPartial(ee){var se,p,L,V,K,m;let T=F();return T.messages=((se=ee.messages)==null?void 0:se.map(h=>f.Any.fromPartial(h)))||[],T.initialDeposit=((p=ee.initialDeposit)==null?void 0:p.map(h=>l.Coin.fromPartial(h)))||[],T.proposer=(L=ee.proposer)!=null?L:"",T.metadata=(V=ee.metadata)!=null?V:"",T.title=(K=ee.title)!=null?K:"",T.summary=(m=ee.summary)!=null?m:"",T}};function j(){return{proposalId:w.Long.UZERO}}e.MsgSubmitProposalResponse={encode(ee,T=N.Writer.create()){return ee.proposalId.isZero()||T.uint32(8).uint64(ee.proposalId),T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=j();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){case 1:L.proposalId=se.uint64();break;default:se.skipType(V&7);break}}return L},fromJSON(ee){return{proposalId:(0,w.isSet)(ee.proposalId)?w.Long.fromValue(ee.proposalId):w.Long.UZERO}},toJSON(ee){let T={};return ee.proposalId!==void 0&&(T.proposalId=(ee.proposalId||w.Long.UZERO).toString()),T},fromPartial(ee){let T=j();return T.proposalId=ee.proposalId!==void 0&&ee.proposalId!==null?w.Long.fromValue(ee.proposalId):w.Long.UZERO,T}};function te(){return{content:void 0,authority:""}}e.MsgExecLegacyContent={encode(ee,T=N.Writer.create()){return ee.content!==void 0&&f.Any.encode(ee.content,T.uint32(10).fork()).ldelim(),ee.authority!==""&&T.uint32(18).string(ee.authority),T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=te();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){case 1:L.content=f.Any.decode(se,se.uint32());break;case 2:L.authority=se.string();break;default:se.skipType(V&7);break}}return L},fromJSON(ee){return{content:(0,w.isSet)(ee.content)?f.Any.fromJSON(ee.content):void 0,authority:(0,w.isSet)(ee.authority)?String(ee.authority):""}},toJSON(ee){let T={};return ee.content!==void 0&&(T.content=ee.content?f.Any.toJSON(ee.content):void 0),ee.authority!==void 0&&(T.authority=ee.authority),T},fromPartial(ee){var se;let T=te();return T.content=ee.content!==void 0&&ee.content!==null?f.Any.fromPartial(ee.content):void 0,T.authority=(se=ee.authority)!=null?se:"",T}};function v(){return{}}e.MsgExecLegacyContentResponse={encode(ee,T=N.Writer.create()){return T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=v();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){default:se.skipType(V&7);break}}return L},fromJSON(ee){return{}},toJSON(ee){return{}},fromPartial(ee){return v()}};function ne(){return{proposalId:w.Long.UZERO,voter:"",option:0,metadata:""}}e.MsgVote={encode(ee,T=N.Writer.create()){return ee.proposalId.isZero()||T.uint32(8).uint64(ee.proposalId),ee.voter!==""&&T.uint32(18).string(ee.voter),ee.option!==0&&T.uint32(24).int32(ee.option),ee.metadata!==""&&T.uint32(34).string(ee.metadata),T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=ne();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){case 1:L.proposalId=se.uint64();break;case 2:L.voter=se.string();break;case 3:L.option=se.int32();break;case 4:L.metadata=se.string();break;default:se.skipType(V&7);break}}return L},fromJSON(ee){return{proposalId:(0,w.isSet)(ee.proposalId)?w.Long.fromValue(ee.proposalId):w.Long.UZERO,voter:(0,w.isSet)(ee.voter)?String(ee.voter):"",option:(0,w.isSet)(ee.option)?(0,g.voteOptionFromJSON)(ee.option):0,metadata:(0,w.isSet)(ee.metadata)?String(ee.metadata):""}},toJSON(ee){let T={};return ee.proposalId!==void 0&&(T.proposalId=(ee.proposalId||w.Long.UZERO).toString()),ee.voter!==void 0&&(T.voter=ee.voter),ee.option!==void 0&&(T.option=(0,g.voteOptionToJSON)(ee.option)),ee.metadata!==void 0&&(T.metadata=ee.metadata),T},fromPartial(ee){var se,p,L;let T=ne();return T.proposalId=ee.proposalId!==void 0&&ee.proposalId!==null?w.Long.fromValue(ee.proposalId):w.Long.UZERO,T.voter=(se=ee.voter)!=null?se:"",T.option=(p=ee.option)!=null?p:0,T.metadata=(L=ee.metadata)!=null?L:"",T}};function Z(){return{}}e.MsgVoteResponse={encode(ee,T=N.Writer.create()){return T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=Z();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){default:se.skipType(V&7);break}}return L},fromJSON(ee){return{}},toJSON(ee){return{}},fromPartial(ee){return Z()}};function R(){return{proposalId:w.Long.UZERO,voter:"",options:[],metadata:""}}e.MsgVoteWeighted={encode(ee,T=N.Writer.create()){ee.proposalId.isZero()||T.uint32(8).uint64(ee.proposalId),ee.voter!==""&&T.uint32(18).string(ee.voter);for(let se of ee.options)g.WeightedVoteOption.encode(se,T.uint32(26).fork()).ldelim();return ee.metadata!==""&&T.uint32(34).string(ee.metadata),T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=R();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){case 1:L.proposalId=se.uint64();break;case 2:L.voter=se.string();break;case 3:L.options.push(g.WeightedVoteOption.decode(se,se.uint32()));break;case 4:L.metadata=se.string();break;default:se.skipType(V&7);break}}return L},fromJSON(ee){return{proposalId:(0,w.isSet)(ee.proposalId)?w.Long.fromValue(ee.proposalId):w.Long.UZERO,voter:(0,w.isSet)(ee.voter)?String(ee.voter):"",options:Array.isArray(ee==null?void 0:ee.options)?ee.options.map(T=>g.WeightedVoteOption.fromJSON(T)):[],metadata:(0,w.isSet)(ee.metadata)?String(ee.metadata):""}},toJSON(ee){let T={};return ee.proposalId!==void 0&&(T.proposalId=(ee.proposalId||w.Long.UZERO).toString()),ee.voter!==void 0&&(T.voter=ee.voter),ee.options?T.options=ee.options.map(se=>se?g.WeightedVoteOption.toJSON(se):void 0):T.options=[],ee.metadata!==void 0&&(T.metadata=ee.metadata),T},fromPartial(ee){var se,p,L;let T=R();return T.proposalId=ee.proposalId!==void 0&&ee.proposalId!==null?w.Long.fromValue(ee.proposalId):w.Long.UZERO,T.voter=(se=ee.voter)!=null?se:"",T.options=((p=ee.options)==null?void 0:p.map(V=>g.WeightedVoteOption.fromPartial(V)))||[],T.metadata=(L=ee.metadata)!=null?L:"",T}};function M(){return{}}e.MsgVoteWeightedResponse={encode(ee,T=N.Writer.create()){return T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=M();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){default:se.skipType(V&7);break}}return L},fromJSON(ee){return{}},toJSON(ee){return{}},fromPartial(ee){return M()}};function U(){return{proposalId:w.Long.UZERO,depositor:"",amount:[]}}e.MsgDeposit={encode(ee,T=N.Writer.create()){ee.proposalId.isZero()||T.uint32(8).uint64(ee.proposalId),ee.depositor!==""&&T.uint32(18).string(ee.depositor);for(let se of ee.amount)l.Coin.encode(se,T.uint32(26).fork()).ldelim();return T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=U();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){case 1:L.proposalId=se.uint64();break;case 2:L.depositor=se.string();break;case 3:L.amount.push(l.Coin.decode(se,se.uint32()));break;default:se.skipType(V&7);break}}return L},fromJSON(ee){return{proposalId:(0,w.isSet)(ee.proposalId)?w.Long.fromValue(ee.proposalId):w.Long.UZERO,depositor:(0,w.isSet)(ee.depositor)?String(ee.depositor):"",amount:Array.isArray(ee==null?void 0:ee.amount)?ee.amount.map(T=>l.Coin.fromJSON(T)):[]}},toJSON(ee){let T={};return ee.proposalId!==void 0&&(T.proposalId=(ee.proposalId||w.Long.UZERO).toString()),ee.depositor!==void 0&&(T.depositor=ee.depositor),ee.amount?T.amount=ee.amount.map(se=>se?l.Coin.toJSON(se):void 0):T.amount=[],T},fromPartial(ee){var se,p;let T=U();return T.proposalId=ee.proposalId!==void 0&&ee.proposalId!==null?w.Long.fromValue(ee.proposalId):w.Long.UZERO,T.depositor=(se=ee.depositor)!=null?se:"",T.amount=((p=ee.amount)==null?void 0:p.map(L=>l.Coin.fromPartial(L)))||[],T}};function E(){return{}}e.MsgDepositResponse={encode(ee,T=N.Writer.create()){return T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=E();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){default:se.skipType(V&7);break}}return L},fromJSON(ee){return{}},toJSON(ee){return{}},fromPartial(ee){return E()}};function Q(){return{authority:"",params:void 0}}e.MsgUpdateParams={encode(ee,T=N.Writer.create()){return ee.authority!==""&&T.uint32(10).string(ee.authority),ee.params!==void 0&&g.Params.encode(ee.params,T.uint32(18).fork()).ldelim(),T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=Q();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){case 1:L.authority=se.string();break;case 2:L.params=g.Params.decode(se,se.uint32());break;default:se.skipType(V&7);break}}return L},fromJSON(ee){return{authority:(0,w.isSet)(ee.authority)?String(ee.authority):"",params:(0,w.isSet)(ee.params)?g.Params.fromJSON(ee.params):void 0}},toJSON(ee){let T={};return ee.authority!==void 0&&(T.authority=ee.authority),ee.params!==void 0&&(T.params=ee.params?g.Params.toJSON(ee.params):void 0),T},fromPartial(ee){var se;let T=Q();return T.authority=(se=ee.authority)!=null?se:"",T.params=ee.params!==void 0&&ee.params!==null?g.Params.fromPartial(ee.params):void 0,T}};function H(){return{}}e.MsgUpdateParamsResponse={encode(ee,T=N.Writer.create()){return T},decode(ee,T){let se=ee instanceof N.Reader?ee:new N.Reader(ee),p=T===void 0?se.len:se.pos+T,L=H();for(;se.pos<p;){let V=se.uint32();switch(V>>>3){default:se.skipType(V&7);break}}return L},fromJSON(ee){return{}},toJSON(ee){return{}},fromPartial(ee){return H()}};class re{constructor(T){this.rpc=T,this.SubmitProposal=this.SubmitProposal.bind(this),this.ExecLegacyContent=this.ExecLegacyContent.bind(this),this.Vote=this.Vote.bind(this),this.VoteWeighted=this.VoteWeighted.bind(this),this.Deposit=this.Deposit.bind(this),this.UpdateParams=this.UpdateParams.bind(this)}SubmitProposal(T){let se=e.MsgSubmitProposal.encode(T).finish();return this.rpc.request("cosmos.gov.v1.Msg","SubmitProposal",se).then(L=>e.MsgSubmitProposalResponse.decode(new N.Reader(L)))}ExecLegacyContent(T){let se=e.MsgExecLegacyContent.encode(T).finish();return this.rpc.request("cosmos.gov.v1.Msg","ExecLegacyContent",se).then(L=>e.MsgExecLegacyContentResponse.decode(new N.Reader(L)))}Vote(T){let se=e.MsgVote.encode(T).finish();return this.rpc.request("cosmos.gov.v1.Msg","Vote",se).then(L=>e.MsgVoteResponse.decode(new N.Reader(L)))}VoteWeighted(T){let se=e.MsgVoteWeighted.encode(T).finish();return this.rpc.request("cosmos.gov.v1.Msg","VoteWeighted",se).then(L=>e.MsgVoteWeightedResponse.decode(new N.Reader(L)))}Deposit(T){let se=e.MsgDeposit.encode(T).finish();return this.rpc.request("cosmos.gov.v1.Msg","Deposit",se).then(L=>e.MsgDepositResponse.decode(new N.Reader(L)))}UpdateParams(T){let se=e.MsgUpdateParams.encode(T).finish();return this.rpc.request("cosmos.gov.v1.Msg","UpdateParams",se).then(L=>e.MsgUpdateParamsResponse.decode(new N.Reader(L)))}}e.MsgClientImpl=re})(b$r);var w$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(E,Q,H,re){re===void 0&&(re=H);var ee=Object.getOwnPropertyDescriptor(Q,H);(!ee||("get"in ee?!Q.__esModule:ee.writable||ee.configurable))&&(ee={enumerable:!0,get:function(){return Q[H]}}),Object.defineProperty(E,re,ee)}:function(E,Q,H,re){re===void 0&&(re=H),E[re]=Q[H]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(E,Q){Object.defineProperty(E,"default",{enumerable:!0,value:Q})}:function(E,Q){E.default=Q}),c=Fr&&Fr.__importStar||function(E){if(E&&E.__esModule)return E;var Q={};if(E!=null)for(var H in E)H!=="default"&&Object.prototype.hasOwnProperty.call(E,H)&&i(Q,E,H);return A(Q,E),Q};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgDepositResponse=e.MsgDeposit=e.MsgVoteWeightedResponse=e.MsgVoteWeighted=e.MsgVoteResponse=e.MsgVote=e.MsgSubmitProposalResponse=e.MsgSubmitProposal=e.protobufPackage=void 0;let f=fh,l=gg,g=svt,w=Ns,N=c(BA);e.protobufPackage="cosmos.gov.v1beta1";function F(){return{content:void 0,initialDeposit:[],proposer:""}}e.MsgSubmitProposal={encode(E,Q=N.Writer.create()){E.content!==void 0&&f.Any.encode(E.content,Q.uint32(10).fork()).ldelim();for(let H of E.initialDeposit)l.Coin.encode(H,Q.uint32(18).fork()).ldelim();return E.proposer!==""&&Q.uint32(26).string(E.proposer),Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=F();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.content=f.Any.decode(H,H.uint32());break;case 2:ee.initialDeposit.push(l.Coin.decode(H,H.uint32()));break;case 3:ee.proposer=H.string();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{content:(0,w.isSet)(E.content)?f.Any.fromJSON(E.content):void 0,initialDeposit:Array.isArray(E==null?void 0:E.initialDeposit)?E.initialDeposit.map(Q=>l.Coin.fromJSON(Q)):[],proposer:(0,w.isSet)(E.proposer)?String(E.proposer):""}},toJSON(E){let Q={};return E.content!==void 0&&(Q.content=E.content?f.Any.toJSON(E.content):void 0),E.initialDeposit?Q.initialDeposit=E.initialDeposit.map(H=>H?l.Coin.toJSON(H):void 0):Q.initialDeposit=[],E.proposer!==void 0&&(Q.proposer=E.proposer),Q},fromPartial(E){var H,re;let Q=F();return Q.content=E.content!==void 0&&E.content!==null?f.Any.fromPartial(E.content):void 0,Q.initialDeposit=((H=E.initialDeposit)==null?void 0:H.map(ee=>l.Coin.fromPartial(ee)))||[],Q.proposer=(re=E.proposer)!=null?re:"",Q}};function j(){return{proposalId:w.Long.UZERO}}e.MsgSubmitProposalResponse={encode(E,Q=N.Writer.create()){return E.proposalId.isZero()||Q.uint32(8).uint64(E.proposalId),Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=j();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.proposalId=H.uint64();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{proposalId:(0,w.isSet)(E.proposalId)?w.Long.fromValue(E.proposalId):w.Long.UZERO}},toJSON(E){let Q={};return E.proposalId!==void 0&&(Q.proposalId=(E.proposalId||w.Long.UZERO).toString()),Q},fromPartial(E){let Q=j();return Q.proposalId=E.proposalId!==void 0&&E.proposalId!==null?w.Long.fromValue(E.proposalId):w.Long.UZERO,Q}};function te(){return{proposalId:w.Long.UZERO,voter:"",option:0}}e.MsgVote={encode(E,Q=N.Writer.create()){return E.proposalId.isZero()||Q.uint32(8).uint64(E.proposalId),E.voter!==""&&Q.uint32(18).string(E.voter),E.option!==0&&Q.uint32(24).int32(E.option),Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=te();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.proposalId=H.uint64();break;case 2:ee.voter=H.string();break;case 3:ee.option=H.int32();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{proposalId:(0,w.isSet)(E.proposalId)?w.Long.fromValue(E.proposalId):w.Long.UZERO,voter:(0,w.isSet)(E.voter)?String(E.voter):"",option:(0,w.isSet)(E.option)?(0,g.voteOptionFromJSON)(E.option):0}},toJSON(E){let Q={};return E.proposalId!==void 0&&(Q.proposalId=(E.proposalId||w.Long.UZERO).toString()),E.voter!==void 0&&(Q.voter=E.voter),E.option!==void 0&&(Q.option=(0,g.voteOptionToJSON)(E.option)),Q},fromPartial(E){var H,re;let Q=te();return Q.proposalId=E.proposalId!==void 0&&E.proposalId!==null?w.Long.fromValue(E.proposalId):w.Long.UZERO,Q.voter=(H=E.voter)!=null?H:"",Q.option=(re=E.option)!=null?re:0,Q}};function v(){return{}}e.MsgVoteResponse={encode(E,Q=N.Writer.create()){return Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=v();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){default:H.skipType(T&7);break}}return ee},fromJSON(E){return{}},toJSON(E){return{}},fromPartial(E){return v()}};function ne(){return{proposalId:w.Long.UZERO,voter:"",options:[]}}e.MsgVoteWeighted={encode(E,Q=N.Writer.create()){E.proposalId.isZero()||Q.uint32(8).uint64(E.proposalId),E.voter!==""&&Q.uint32(18).string(E.voter);for(let H of E.options)g.WeightedVoteOption.encode(H,Q.uint32(26).fork()).ldelim();return Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=ne();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.proposalId=H.uint64();break;case 2:ee.voter=H.string();break;case 3:ee.options.push(g.WeightedVoteOption.decode(H,H.uint32()));break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{proposalId:(0,w.isSet)(E.proposalId)?w.Long.fromValue(E.proposalId):w.Long.UZERO,voter:(0,w.isSet)(E.voter)?String(E.voter):"",options:Array.isArray(E==null?void 0:E.options)?E.options.map(Q=>g.WeightedVoteOption.fromJSON(Q)):[]}},toJSON(E){let Q={};return E.proposalId!==void 0&&(Q.proposalId=(E.proposalId||w.Long.UZERO).toString()),E.voter!==void 0&&(Q.voter=E.voter),E.options?Q.options=E.options.map(H=>H?g.WeightedVoteOption.toJSON(H):void 0):Q.options=[],Q},fromPartial(E){var H,re;let Q=ne();return Q.proposalId=E.proposalId!==void 0&&E.proposalId!==null?w.Long.fromValue(E.proposalId):w.Long.UZERO,Q.voter=(H=E.voter)!=null?H:"",Q.options=((re=E.options)==null?void 0:re.map(ee=>g.WeightedVoteOption.fromPartial(ee)))||[],Q}};function Z(){return{}}e.MsgVoteWeightedResponse={encode(E,Q=N.Writer.create()){return Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=Z();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){default:H.skipType(T&7);break}}return ee},fromJSON(E){return{}},toJSON(E){return{}},fromPartial(E){return Z()}};function R(){return{proposalId:w.Long.UZERO,depositor:"",amount:[]}}e.MsgDeposit={encode(E,Q=N.Writer.create()){E.proposalId.isZero()||Q.uint32(8).uint64(E.proposalId),E.depositor!==""&&Q.uint32(18).string(E.depositor);for(let H of E.amount)l.Coin.encode(H,Q.uint32(26).fork()).ldelim();return Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=R();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.proposalId=H.uint64();break;case 2:ee.depositor=H.string();break;case 3:ee.amount.push(l.Coin.decode(H,H.uint32()));break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{proposalId:(0,w.isSet)(E.proposalId)?w.Long.fromValue(E.proposalId):w.Long.UZERO,depositor:(0,w.isSet)(E.depositor)?String(E.depositor):"",amount:Array.isArray(E==null?void 0:E.amount)?E.amount.map(Q=>l.Coin.fromJSON(Q)):[]}},toJSON(E){let Q={};return E.proposalId!==void 0&&(Q.proposalId=(E.proposalId||w.Long.UZERO).toString()),E.depositor!==void 0&&(Q.depositor=E.depositor),E.amount?Q.amount=E.amount.map(H=>H?l.Coin.toJSON(H):void 0):Q.amount=[],Q},fromPartial(E){var H,re;let Q=R();return Q.proposalId=E.proposalId!==void 0&&E.proposalId!==null?w.Long.fromValue(E.proposalId):w.Long.UZERO,Q.depositor=(H=E.depositor)!=null?H:"",Q.amount=((re=E.amount)==null?void 0:re.map(ee=>l.Coin.fromPartial(ee)))||[],Q}};function M(){return{}}e.MsgDepositResponse={encode(E,Q=N.Writer.create()){return Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=M();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){default:H.skipType(T&7);break}}return ee},fromJSON(E){return{}},toJSON(E){return{}},fromPartial(E){return M()}};class U{constructor(Q){this.rpc=Q,this.SubmitProposal=this.SubmitProposal.bind(this),this.Vote=this.Vote.bind(this),this.VoteWeighted=this.VoteWeighted.bind(this),this.Deposit=this.Deposit.bind(this)}SubmitProposal(Q){let H=e.MsgSubmitProposal.encode(Q).finish();return this.rpc.request("cosmos.gov.v1beta1.Msg","SubmitProposal",H).then(ee=>e.MsgSubmitProposalResponse.decode(new N.Reader(ee)))}Vote(Q){let H=e.MsgVote.encode(Q).finish();return this.rpc.request("cosmos.gov.v1beta1.Msg","Vote",H).then(ee=>e.MsgVoteResponse.decode(new N.Reader(ee)))}VoteWeighted(Q){let H=e.MsgVoteWeighted.encode(Q).finish();return this.rpc.request("cosmos.gov.v1beta1.Msg","VoteWeighted",H).then(ee=>e.MsgVoteWeightedResponse.decode(new N.Reader(ee)))}Deposit(Q){let H=e.MsgDeposit.encode(Q).finish();return this.rpc.request("cosmos.gov.v1beta1.Msg","Deposit",H).then(ee=>e.MsgDepositResponse.decode(new N.Reader(ee)))}}e.MsgClientImpl=U})(w$r);Object.defineProperty(pM,"__esModule",{value:!0});pM.isMsgVoteWeightedEncodeObject=pM.isMsgVoteEncodeObject=pM.isMsgSubmitProposalEncodeObject=pM.isMsgDepositEncodeObject=pM.govTypes=void 0;var LHe=b$r,B3t=w$r;pM.govTypes=[["/cosmos.gov.v1.MsgDeposit",LHe.MsgDeposit],["/cosmos.gov.v1.MsgSubmitProposal",LHe.MsgSubmitProposal],["/cosmos.gov.v1.MsgUpdateParams",LHe.MsgUpdateParams],["/cosmos.gov.v1.MsgVote",LHe.MsgVote],["/cosmos.gov.v1.MsgVoteWeighted",LHe.MsgVoteWeighted],["/cosmos.gov.v1beta1.MsgDeposit",B3t.MsgDeposit],["/cosmos.gov.v1beta1.MsgSubmitProposal",B3t.MsgSubmitProposal],["/cosmos.gov.v1beta1.MsgVote",B3t.MsgVote],["/cosmos.gov.v1beta1.MsgVoteWeighted",B3t.MsgVoteWeighted]];function u8s(e){return e.typeUrl==="/cosmos.gov.v1beta1.MsgDeposit"}pM.isMsgDepositEncodeObject=u8s;function f8s(e){return e.typeUrl==="/cosmos.gov.v1beta1.MsgSubmitProposal"}pM.isMsgSubmitProposalEncodeObject=f8s;function l8s(e){return e.typeUrl==="/cosmos.gov.v1beta1.MsgVote"}pM.isMsgVoteEncodeObject=l8s;function h8s(e){return e.typeUrl==="/cosmos.gov.v1beta1.MsgVoteWeighted"}pM.isMsgVoteWeightedEncodeObject=h8s;var Avt={},Q$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(p,L,V,K){K===void 0&&(K=V);var m=Object.getOwnPropertyDescriptor(L,V);(!m||("get"in m?!L.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return L[V]}}),Object.defineProperty(p,K,m)}:function(p,L,V,K){K===void 0&&(K=V),p[K]=L[V]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(p,L){Object.defineProperty(p,"default",{enumerable:!0,value:L})}:function(p,L){p.default=L}),c=Fr&&Fr.__importStar||function(p){if(p&&p.__esModule)return p;var L={};if(p!=null)for(var V in p)V!=="default"&&Object.prototype.hasOwnProperty.call(p,V)&&i(L,p,V);return A(L,p),L};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryTallyResultResponse=e.QueryTallyResultRequest=e.QueryDepositsResponse=e.QueryDepositsRequest=e.QueryDepositResponse=e.QueryDepositRequest=e.QueryParamsResponse=e.QueryParamsRequest=e.QueryVotesResponse=e.QueryVotesRequest=e.QueryVoteResponse=e.QueryVoteRequest=e.QueryProposalsResponse=e.QueryProposalsRequest=e.QueryProposalResponse=e.QueryProposalRequest=e.protobufPackage=void 0;let f=svt,l=Hm,g=Ns,w=c(BA);e.protobufPackage="cosmos.gov.v1beta1";function N(){return{proposalId:g.Long.UZERO}}e.QueryProposalRequest={encode(p,L=w.Writer.create()){return p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=N();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,g.isSet)(p.proposalId)?g.Long.fromValue(p.proposalId):g.Long.UZERO}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||g.Long.UZERO).toString()),L},fromPartial(p){let L=N();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?g.Long.fromValue(p.proposalId):g.Long.UZERO,L}};function F(){return{proposal:void 0}}e.QueryProposalResponse={encode(p,L=w.Writer.create()){return p.proposal!==void 0&&f.Proposal.encode(p.proposal,L.uint32(10).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=F();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposal=f.Proposal.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposal:(0,g.isSet)(p.proposal)?f.Proposal.fromJSON(p.proposal):void 0}},toJSON(p){let L={};return p.proposal!==void 0&&(L.proposal=p.proposal?f.Proposal.toJSON(p.proposal):void 0),L},fromPartial(p){let L=F();return L.proposal=p.proposal!==void 0&&p.proposal!==null?f.Proposal.fromPartial(p.proposal):void 0,L}};function j(){return{proposalStatus:0,voter:"",depositor:"",pagination:void 0}}e.QueryProposalsRequest={encode(p,L=w.Writer.create()){return p.proposalStatus!==0&&L.uint32(8).int32(p.proposalStatus),p.voter!==""&&L.uint32(18).string(p.voter),p.depositor!==""&&L.uint32(26).string(p.depositor),p.pagination!==void 0&&l.PageRequest.encode(p.pagination,L.uint32(34).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=j();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalStatus=V.int32();break;case 2:m.voter=V.string();break;case 3:m.depositor=V.string();break;case 4:m.pagination=l.PageRequest.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalStatus:(0,g.isSet)(p.proposalStatus)?(0,f.proposalStatusFromJSON)(p.proposalStatus):0,voter:(0,g.isSet)(p.voter)?String(p.voter):"",depositor:(0,g.isSet)(p.depositor)?String(p.depositor):"",pagination:(0,g.isSet)(p.pagination)?l.PageRequest.fromJSON(p.pagination):void 0}},toJSON(p){let L={};return p.proposalStatus!==void 0&&(L.proposalStatus=(0,f.proposalStatusToJSON)(p.proposalStatus)),p.voter!==void 0&&(L.voter=p.voter),p.depositor!==void 0&&(L.depositor=p.depositor),p.pagination!==void 0&&(L.pagination=p.pagination?l.PageRequest.toJSON(p.pagination):void 0),L},fromPartial(p){var V,K,m;let L=j();return L.proposalStatus=(V=p.proposalStatus)!=null?V:0,L.voter=(K=p.voter)!=null?K:"",L.depositor=(m=p.depositor)!=null?m:"",L.pagination=p.pagination!==void 0&&p.pagination!==null?l.PageRequest.fromPartial(p.pagination):void 0,L}};function te(){return{proposals:[],pagination:void 0}}e.QueryProposalsResponse={encode(p,L=w.Writer.create()){for(let V of p.proposals)f.Proposal.encode(V,L.uint32(10).fork()).ldelim();return p.pagination!==void 0&&l.PageResponse.encode(p.pagination,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=te();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposals.push(f.Proposal.decode(V,V.uint32()));break;case 2:m.pagination=l.PageResponse.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposals:Array.isArray(p==null?void 0:p.proposals)?p.proposals.map(L=>f.Proposal.fromJSON(L)):[],pagination:(0,g.isSet)(p.pagination)?l.PageResponse.fromJSON(p.pagination):void 0}},toJSON(p){let L={};return p.proposals?L.proposals=p.proposals.map(V=>V?f.Proposal.toJSON(V):void 0):L.proposals=[],p.pagination!==void 0&&(L.pagination=p.pagination?l.PageResponse.toJSON(p.pagination):void 0),L},fromPartial(p){var V;let L=te();return L.proposals=((V=p.proposals)==null?void 0:V.map(K=>f.Proposal.fromPartial(K)))||[],L.pagination=p.pagination!==void 0&&p.pagination!==null?l.PageResponse.fromPartial(p.pagination):void 0,L}};function v(){return{proposalId:g.Long.UZERO,voter:""}}e.QueryVoteRequest={encode(p,L=w.Writer.create()){return p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),p.voter!==""&&L.uint32(18).string(p.voter),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=v();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;case 2:m.voter=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,g.isSet)(p.proposalId)?g.Long.fromValue(p.proposalId):g.Long.UZERO,voter:(0,g.isSet)(p.voter)?String(p.voter):""}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||g.Long.UZERO).toString()),p.voter!==void 0&&(L.voter=p.voter),L},fromPartial(p){var V;let L=v();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?g.Long.fromValue(p.proposalId):g.Long.UZERO,L.voter=(V=p.voter)!=null?V:"",L}};function ne(){return{vote:void 0}}e.QueryVoteResponse={encode(p,L=w.Writer.create()){return p.vote!==void 0&&f.Vote.encode(p.vote,L.uint32(10).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=ne();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.vote=f.Vote.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{vote:(0,g.isSet)(p.vote)?f.Vote.fromJSON(p.vote):void 0}},toJSON(p){let L={};return p.vote!==void 0&&(L.vote=p.vote?f.Vote.toJSON(p.vote):void 0),L},fromPartial(p){let L=ne();return L.vote=p.vote!==void 0&&p.vote!==null?f.Vote.fromPartial(p.vote):void 0,L}};function Z(){return{proposalId:g.Long.UZERO,pagination:void 0}}e.QueryVotesRequest={encode(p,L=w.Writer.create()){return p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),p.pagination!==void 0&&l.PageRequest.encode(p.pagination,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=Z();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;case 2:m.pagination=l.PageRequest.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,g.isSet)(p.proposalId)?g.Long.fromValue(p.proposalId):g.Long.UZERO,pagination:(0,g.isSet)(p.pagination)?l.PageRequest.fromJSON(p.pagination):void 0}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||g.Long.UZERO).toString()),p.pagination!==void 0&&(L.pagination=p.pagination?l.PageRequest.toJSON(p.pagination):void 0),L},fromPartial(p){let L=Z();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?g.Long.fromValue(p.proposalId):g.Long.UZERO,L.pagination=p.pagination!==void 0&&p.pagination!==null?l.PageRequest.fromPartial(p.pagination):void 0,L}};function R(){return{votes:[],pagination:void 0}}e.QueryVotesResponse={encode(p,L=w.Writer.create()){for(let V of p.votes)f.Vote.encode(V,L.uint32(10).fork()).ldelim();return p.pagination!==void 0&&l.PageResponse.encode(p.pagination,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=R();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.votes.push(f.Vote.decode(V,V.uint32()));break;case 2:m.pagination=l.PageResponse.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{votes:Array.isArray(p==null?void 0:p.votes)?p.votes.map(L=>f.Vote.fromJSON(L)):[],pagination:(0,g.isSet)(p.pagination)?l.PageResponse.fromJSON(p.pagination):void 0}},toJSON(p){let L={};return p.votes?L.votes=p.votes.map(V=>V?f.Vote.toJSON(V):void 0):L.votes=[],p.pagination!==void 0&&(L.pagination=p.pagination?l.PageResponse.toJSON(p.pagination):void 0),L},fromPartial(p){var V;let L=R();return L.votes=((V=p.votes)==null?void 0:V.map(K=>f.Vote.fromPartial(K)))||[],L.pagination=p.pagination!==void 0&&p.pagination!==null?l.PageResponse.fromPartial(p.pagination):void 0,L}};function M(){return{paramsType:""}}e.QueryParamsRequest={encode(p,L=w.Writer.create()){return p.paramsType!==""&&L.uint32(10).string(p.paramsType),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=M();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.paramsType=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{paramsType:(0,g.isSet)(p.paramsType)?String(p.paramsType):""}},toJSON(p){let L={};return p.paramsType!==void 0&&(L.paramsType=p.paramsType),L},fromPartial(p){var V;let L=M();return L.paramsType=(V=p.paramsType)!=null?V:"",L}};function U(){return{votingParams:void 0,depositParams:void 0,tallyParams:void 0}}e.QueryParamsResponse={encode(p,L=w.Writer.create()){return p.votingParams!==void 0&&f.VotingParams.encode(p.votingParams,L.uint32(10).fork()).ldelim(),p.depositParams!==void 0&&f.DepositParams.encode(p.depositParams,L.uint32(18).fork()).ldelim(),p.tallyParams!==void 0&&f.TallyParams.encode(p.tallyParams,L.uint32(26).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=U();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.votingParams=f.VotingParams.decode(V,V.uint32());break;case 2:m.depositParams=f.DepositParams.decode(V,V.uint32());break;case 3:m.tallyParams=f.TallyParams.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{votingParams:(0,g.isSet)(p.votingParams)?f.VotingParams.fromJSON(p.votingParams):void 0,depositParams:(0,g.isSet)(p.depositParams)?f.DepositParams.fromJSON(p.depositParams):void 0,tallyParams:(0,g.isSet)(p.tallyParams)?f.TallyParams.fromJSON(p.tallyParams):void 0}},toJSON(p){let L={};return p.votingParams!==void 0&&(L.votingParams=p.votingParams?f.VotingParams.toJSON(p.votingParams):void 0),p.depositParams!==void 0&&(L.depositParams=p.depositParams?f.DepositParams.toJSON(p.depositParams):void 0),p.tallyParams!==void 0&&(L.tallyParams=p.tallyParams?f.TallyParams.toJSON(p.tallyParams):void 0),L},fromPartial(p){let L=U();return L.votingParams=p.votingParams!==void 0&&p.votingParams!==null?f.VotingParams.fromPartial(p.votingParams):void 0,L.depositParams=p.depositParams!==void 0&&p.depositParams!==null?f.DepositParams.fromPartial(p.depositParams):void 0,L.tallyParams=p.tallyParams!==void 0&&p.tallyParams!==null?f.TallyParams.fromPartial(p.tallyParams):void 0,L}};function E(){return{proposalId:g.Long.UZERO,depositor:""}}e.QueryDepositRequest={encode(p,L=w.Writer.create()){return p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),p.depositor!==""&&L.uint32(18).string(p.depositor),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=E();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;case 2:m.depositor=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,g.isSet)(p.proposalId)?g.Long.fromValue(p.proposalId):g.Long.UZERO,depositor:(0,g.isSet)(p.depositor)?String(p.depositor):""}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||g.Long.UZERO).toString()),p.depositor!==void 0&&(L.depositor=p.depositor),L},fromPartial(p){var V;let L=E();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?g.Long.fromValue(p.proposalId):g.Long.UZERO,L.depositor=(V=p.depositor)!=null?V:"",L}};function Q(){return{deposit:void 0}}e.QueryDepositResponse={encode(p,L=w.Writer.create()){return p.deposit!==void 0&&f.Deposit.encode(p.deposit,L.uint32(10).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=Q();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.deposit=f.Deposit.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{deposit:(0,g.isSet)(p.deposit)?f.Deposit.fromJSON(p.deposit):void 0}},toJSON(p){let L={};return p.deposit!==void 0&&(L.deposit=p.deposit?f.Deposit.toJSON(p.deposit):void 0),L},fromPartial(p){let L=Q();return L.deposit=p.deposit!==void 0&&p.deposit!==null?f.Deposit.fromPartial(p.deposit):void 0,L}};function H(){return{proposalId:g.Long.UZERO,pagination:void 0}}e.QueryDepositsRequest={encode(p,L=w.Writer.create()){return p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),p.pagination!==void 0&&l.PageRequest.encode(p.pagination,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=H();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;case 2:m.pagination=l.PageRequest.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,g.isSet)(p.proposalId)?g.Long.fromValue(p.proposalId):g.Long.UZERO,pagination:(0,g.isSet)(p.pagination)?l.PageRequest.fromJSON(p.pagination):void 0}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||g.Long.UZERO).toString()),p.pagination!==void 0&&(L.pagination=p.pagination?l.PageRequest.toJSON(p.pagination):void 0),L},fromPartial(p){let L=H();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?g.Long.fromValue(p.proposalId):g.Long.UZERO,L.pagination=p.pagination!==void 0&&p.pagination!==null?l.PageRequest.fromPartial(p.pagination):void 0,L}};function re(){return{deposits:[],pagination:void 0}}e.QueryDepositsResponse={encode(p,L=w.Writer.create()){for(let V of p.deposits)f.Deposit.encode(V,L.uint32(10).fork()).ldelim();return p.pagination!==void 0&&l.PageResponse.encode(p.pagination,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=re();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.deposits.push(f.Deposit.decode(V,V.uint32()));break;case 2:m.pagination=l.PageResponse.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{deposits:Array.isArray(p==null?void 0:p.deposits)?p.deposits.map(L=>f.Deposit.fromJSON(L)):[],pagination:(0,g.isSet)(p.pagination)?l.PageResponse.fromJSON(p.pagination):void 0}},toJSON(p){let L={};return p.deposits?L.deposits=p.deposits.map(V=>V?f.Deposit.toJSON(V):void 0):L.deposits=[],p.pagination!==void 0&&(L.pagination=p.pagination?l.PageResponse.toJSON(p.pagination):void 0),L},fromPartial(p){var V;let L=re();return L.deposits=((V=p.deposits)==null?void 0:V.map(K=>f.Deposit.fromPartial(K)))||[],L.pagination=p.pagination!==void 0&&p.pagination!==null?l.PageResponse.fromPartial(p.pagination):void 0,L}};function ee(){return{proposalId:g.Long.UZERO}}e.QueryTallyResultRequest={encode(p,L=w.Writer.create()){return p.proposalId.isZero()||L.uint32(8).uint64(p.proposalId),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=ee();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.proposalId=V.uint64();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{proposalId:(0,g.isSet)(p.proposalId)?g.Long.fromValue(p.proposalId):g.Long.UZERO}},toJSON(p){let L={};return p.proposalId!==void 0&&(L.proposalId=(p.proposalId||g.Long.UZERO).toString()),L},fromPartial(p){let L=ee();return L.proposalId=p.proposalId!==void 0&&p.proposalId!==null?g.Long.fromValue(p.proposalId):g.Long.UZERO,L}};function T(){return{tally:void 0}}e.QueryTallyResultResponse={encode(p,L=w.Writer.create()){return p.tally!==void 0&&f.TallyResult.encode(p.tally,L.uint32(10).fork()).ldelim(),L},decode(p,L){let V=p instanceof w.Reader?p:new w.Reader(p),K=L===void 0?V.len:V.pos+L,m=T();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.tally=f.TallyResult.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{tally:(0,g.isSet)(p.tally)?f.TallyResult.fromJSON(p.tally):void 0}},toJSON(p){let L={};return p.tally!==void 0&&(L.tally=p.tally?f.TallyResult.toJSON(p.tally):void 0),L},fromPartial(p){let L=T();return L.tally=p.tally!==void 0&&p.tally!==null?f.TallyResult.fromPartial(p.tally):void 0,L}};class se{constructor(L){this.rpc=L,this.Proposal=this.Proposal.bind(this),this.Proposals=this.Proposals.bind(this),this.Vote=this.Vote.bind(this),this.Votes=this.Votes.bind(this),this.Params=this.Params.bind(this),this.Deposit=this.Deposit.bind(this),this.Deposits=this.Deposits.bind(this),this.TallyResult=this.TallyResult.bind(this)}Proposal(L){let V=e.QueryProposalRequest.encode(L).finish();return this.rpc.request("cosmos.gov.v1beta1.Query","Proposal",V).then(m=>e.QueryProposalResponse.decode(new w.Reader(m)))}Proposals(L){let V=e.QueryProposalsRequest.encode(L).finish();return this.rpc.request("cosmos.gov.v1beta1.Query","Proposals",V).then(m=>e.QueryProposalsResponse.decode(new w.Reader(m)))}Vote(L){let V=e.QueryVoteRequest.encode(L).finish();return this.rpc.request("cosmos.gov.v1beta1.Query","Vote",V).then(m=>e.QueryVoteResponse.decode(new w.Reader(m)))}Votes(L){let V=e.QueryVotesRequest.encode(L).finish();return this.rpc.request("cosmos.gov.v1beta1.Query","Votes",V).then(m=>e.QueryVotesResponse.decode(new w.Reader(m)))}Params(L){let V=e.QueryParamsRequest.encode(L).finish();return this.rpc.request("cosmos.gov.v1beta1.Query","Params",V).then(m=>e.QueryParamsResponse.decode(new w.Reader(m)))}Deposit(L){let V=e.QueryDepositRequest.encode(L).finish();return this.rpc.request("cosmos.gov.v1beta1.Query","Deposit",V).then(m=>e.QueryDepositResponse.decode(new w.Reader(m)))}Deposits(L){let V=e.QueryDepositsRequest.encode(L).finish();return this.rpc.request("cosmos.gov.v1beta1.Query","Deposits",V).then(m=>e.QueryDepositsResponse.decode(new w.Reader(m)))}TallyResult(L){let V=e.QueryTallyResultRequest.encode(L).finish();return this.rpc.request("cosmos.gov.v1beta1.Query","TallyResult",V).then(m=>e.QueryTallyResultResponse.decode(new w.Reader(m)))}}e.QueryClientImpl=se})(Q$r);Object.defineProperty(Avt,"__esModule",{value:!0});Avt.setupGovExtension=void 0;var g8s=Q$r,Wq=Rw;function p8s(e){let i=(0,Wq.createProtobufRpcClient)(e),A=new g8s.QueryClientImpl(i);return{gov:{params:c=>Jt(this,null,function*(){return yield A.Params({paramsType:c})}),proposals:(c,f,l,g)=>Jt(this,null,function*(){return yield A.Proposals({proposalStatus:c,depositor:f,voter:l,pagination:(0,Wq.createPagination)(g)})}),proposal:c=>Jt(this,null,function*(){return yield A.Proposal({proposalId:(0,Wq.longify)(c)})}),deposits:(c,f)=>Jt(this,null,function*(){return yield A.Deposits({proposalId:(0,Wq.longify)(c),pagination:(0,Wq.createPagination)(f)})}),deposit:(c,f)=>Jt(this,null,function*(){return yield A.Deposit({proposalId:(0,Wq.longify)(c),depositor:f})}),tally:c=>Jt(this,null,function*(){return yield A.TallyResult({proposalId:(0,Wq.longify)(c)})}),votes:(c,f)=>Jt(this,null,function*(){return yield A.Votes({proposalId:(0,Wq.longify)(c),pagination:(0,Wq.createPagination)(f)})}),vote:(c,f)=>Jt(this,null,function*(){return yield A.Vote({proposalId:(0,Wq.longify)(c),voter:f})})}}}Avt.setupGovExtension=p8s;var dvt={};Object.defineProperty(dvt,"__esModule",{value:!0});dvt.createGroupAminoConverters=void 0;function y8s(){return{}}dvt.createGroupAminoConverters=y8s;var cvt={},k$r={},D$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(m,h,_,b){b===void 0&&(b=_);var O=Object.getOwnPropertyDescriptor(h,_);(!O||("get"in O?!h.__esModule:O.writable||O.configurable))&&(O={enumerable:!0,get:function(){return h[_]}}),Object.defineProperty(m,b,O)}:function(m,h,_,b){b===void 0&&(b=_),m[b]=h[_]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(m,h){Object.defineProperty(m,"default",{enumerable:!0,value:h})}:function(m,h){m.default=h}),c=Fr&&Fr.__importStar||function(m){if(m&&m.__esModule)return m;var h={};if(m!=null)for(var _ in m)_!=="default"&&Object.prototype.hasOwnProperty.call(m,_)&&i(h,m,_);return A(h,m),h};Object.defineProperty(e,"__esModule",{value:!0}),e.Vote=e.TallyResult=e.Proposal=e.GroupPolicyInfo=e.GroupMember=e.GroupInfo=e.DecisionPolicyWindows=e.PercentageDecisionPolicy=e.ThresholdDecisionPolicy=e.MemberRequest=e.Member=e.proposalExecutorResultToJSON=e.proposalExecutorResultFromJSON=e.ProposalExecutorResult=e.proposalStatusToJSON=e.proposalStatusFromJSON=e.ProposalStatus=e.voteOptionToJSON=e.voteOptionFromJSON=e.VoteOption=e.protobufPackage=void 0;let f=k3,l=MR,g=fh,w=Ns,N=c(BA);e.protobufPackage="cosmos.group.v1";var F;(function(m){m[m.VOTE_OPTION_UNSPECIFIED=0]="VOTE_OPTION_UNSPECIFIED",m[m.VOTE_OPTION_YES=1]="VOTE_OPTION_YES",m[m.VOTE_OPTION_ABSTAIN=2]="VOTE_OPTION_ABSTAIN",m[m.VOTE_OPTION_NO=3]="VOTE_OPTION_NO",m[m.VOTE_OPTION_NO_WITH_VETO=4]="VOTE_OPTION_NO_WITH_VETO",m[m.UNRECOGNIZED=-1]="UNRECOGNIZED"})(F=e.VoteOption||(e.VoteOption={}));function j(m){switch(m){case 0:case"VOTE_OPTION_UNSPECIFIED":return F.VOTE_OPTION_UNSPECIFIED;case 1:case"VOTE_OPTION_YES":return F.VOTE_OPTION_YES;case 2:case"VOTE_OPTION_ABSTAIN":return F.VOTE_OPTION_ABSTAIN;case 3:case"VOTE_OPTION_NO":return F.VOTE_OPTION_NO;case 4:case"VOTE_OPTION_NO_WITH_VETO":return F.VOTE_OPTION_NO_WITH_VETO;case-1:case"UNRECOGNIZED":default:return F.UNRECOGNIZED}}e.voteOptionFromJSON=j;function te(m){switch(m){case F.VOTE_OPTION_UNSPECIFIED:return"VOTE_OPTION_UNSPECIFIED";case F.VOTE_OPTION_YES:return"VOTE_OPTION_YES";case F.VOTE_OPTION_ABSTAIN:return"VOTE_OPTION_ABSTAIN";case F.VOTE_OPTION_NO:return"VOTE_OPTION_NO";case F.VOTE_OPTION_NO_WITH_VETO:return"VOTE_OPTION_NO_WITH_VETO";case F.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.voteOptionToJSON=te;var v;(function(m){m[m.PROPOSAL_STATUS_UNSPECIFIED=0]="PROPOSAL_STATUS_UNSPECIFIED",m[m.PROPOSAL_STATUS_SUBMITTED=1]="PROPOSAL_STATUS_SUBMITTED",m[m.PROPOSAL_STATUS_ACCEPTED=2]="PROPOSAL_STATUS_ACCEPTED",m[m.PROPOSAL_STATUS_REJECTED=3]="PROPOSAL_STATUS_REJECTED",m[m.PROPOSAL_STATUS_ABORTED=4]="PROPOSAL_STATUS_ABORTED",m[m.PROPOSAL_STATUS_WITHDRAWN=5]="PROPOSAL_STATUS_WITHDRAWN",m[m.UNRECOGNIZED=-1]="UNRECOGNIZED"})(v=e.ProposalStatus||(e.ProposalStatus={}));function ne(m){switch(m){case 0:case"PROPOSAL_STATUS_UNSPECIFIED":return v.PROPOSAL_STATUS_UNSPECIFIED;case 1:case"PROPOSAL_STATUS_SUBMITTED":return v.PROPOSAL_STATUS_SUBMITTED;case 2:case"PROPOSAL_STATUS_ACCEPTED":return v.PROPOSAL_STATUS_ACCEPTED;case 3:case"PROPOSAL_STATUS_REJECTED":return v.PROPOSAL_STATUS_REJECTED;case 4:case"PROPOSAL_STATUS_ABORTED":return v.PROPOSAL_STATUS_ABORTED;case 5:case"PROPOSAL_STATUS_WITHDRAWN":return v.PROPOSAL_STATUS_WITHDRAWN;case-1:case"UNRECOGNIZED":default:return v.UNRECOGNIZED}}e.proposalStatusFromJSON=ne;function Z(m){switch(m){case v.PROPOSAL_STATUS_UNSPECIFIED:return"PROPOSAL_STATUS_UNSPECIFIED";case v.PROPOSAL_STATUS_SUBMITTED:return"PROPOSAL_STATUS_SUBMITTED";case v.PROPOSAL_STATUS_ACCEPTED:return"PROPOSAL_STATUS_ACCEPTED";case v.PROPOSAL_STATUS_REJECTED:return"PROPOSAL_STATUS_REJECTED";case v.PROPOSAL_STATUS_ABORTED:return"PROPOSAL_STATUS_ABORTED";case v.PROPOSAL_STATUS_WITHDRAWN:return"PROPOSAL_STATUS_WITHDRAWN";case v.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.proposalStatusToJSON=Z;var R;(function(m){m[m.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED=0]="PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED",m[m.PROPOSAL_EXECUTOR_RESULT_NOT_RUN=1]="PROPOSAL_EXECUTOR_RESULT_NOT_RUN",m[m.PROPOSAL_EXECUTOR_RESULT_SUCCESS=2]="PROPOSAL_EXECUTOR_RESULT_SUCCESS",m[m.PROPOSAL_EXECUTOR_RESULT_FAILURE=3]="PROPOSAL_EXECUTOR_RESULT_FAILURE",m[m.UNRECOGNIZED=-1]="UNRECOGNIZED"})(R=e.ProposalExecutorResult||(e.ProposalExecutorResult={}));function M(m){switch(m){case 0:case"PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED":return R.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED;case 1:case"PROPOSAL_EXECUTOR_RESULT_NOT_RUN":return R.PROPOSAL_EXECUTOR_RESULT_NOT_RUN;case 2:case"PROPOSAL_EXECUTOR_RESULT_SUCCESS":return R.PROPOSAL_EXECUTOR_RESULT_SUCCESS;case 3:case"PROPOSAL_EXECUTOR_RESULT_FAILURE":return R.PROPOSAL_EXECUTOR_RESULT_FAILURE;case-1:case"UNRECOGNIZED":default:return R.UNRECOGNIZED}}e.proposalExecutorResultFromJSON=M;function U(m){switch(m){case R.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED:return"PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED";case R.PROPOSAL_EXECUTOR_RESULT_NOT_RUN:return"PROPOSAL_EXECUTOR_RESULT_NOT_RUN";case R.PROPOSAL_EXECUTOR_RESULT_SUCCESS:return"PROPOSAL_EXECUTOR_RESULT_SUCCESS";case R.PROPOSAL_EXECUTOR_RESULT_FAILURE:return"PROPOSAL_EXECUTOR_RESULT_FAILURE";case R.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.proposalExecutorResultToJSON=U;function E(){return{address:"",weight:"",metadata:"",addedAt:void 0}}e.Member={encode(m,h=N.Writer.create()){return m.address!==""&&h.uint32(10).string(m.address),m.weight!==""&&h.uint32(18).string(m.weight),m.metadata!==""&&h.uint32(26).string(m.metadata),m.addedAt!==void 0&&f.Timestamp.encode(m.addedAt,h.uint32(34).fork()).ldelim(),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=E();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.address=_.string();break;case 2:O.weight=_.string();break;case 3:O.metadata=_.string();break;case 4:O.addedAt=f.Timestamp.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{address:(0,w.isSet)(m.address)?String(m.address):"",weight:(0,w.isSet)(m.weight)?String(m.weight):"",metadata:(0,w.isSet)(m.metadata)?String(m.metadata):"",addedAt:(0,w.isSet)(m.addedAt)?(0,w.fromJsonTimestamp)(m.addedAt):void 0}},toJSON(m){let h={};return m.address!==void 0&&(h.address=m.address),m.weight!==void 0&&(h.weight=m.weight),m.metadata!==void 0&&(h.metadata=m.metadata),m.addedAt!==void 0&&(h.addedAt=(0,w.fromTimestamp)(m.addedAt).toISOString()),h},fromPartial(m){var _,b,O;let h=E();return h.address=(_=m.address)!=null?_:"",h.weight=(b=m.weight)!=null?b:"",h.metadata=(O=m.metadata)!=null?O:"",h.addedAt=m.addedAt!==void 0&&m.addedAt!==null?f.Timestamp.fromPartial(m.addedAt):void 0,h}};function Q(){return{address:"",weight:"",metadata:""}}e.MemberRequest={encode(m,h=N.Writer.create()){return m.address!==""&&h.uint32(10).string(m.address),m.weight!==""&&h.uint32(18).string(m.weight),m.metadata!==""&&h.uint32(26).string(m.metadata),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=Q();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.address=_.string();break;case 2:O.weight=_.string();break;case 3:O.metadata=_.string();break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{address:(0,w.isSet)(m.address)?String(m.address):"",weight:(0,w.isSet)(m.weight)?String(m.weight):"",metadata:(0,w.isSet)(m.metadata)?String(m.metadata):""}},toJSON(m){let h={};return m.address!==void 0&&(h.address=m.address),m.weight!==void 0&&(h.weight=m.weight),m.metadata!==void 0&&(h.metadata=m.metadata),h},fromPartial(m){var _,b,O;let h=Q();return h.address=(_=m.address)!=null?_:"",h.weight=(b=m.weight)!=null?b:"",h.metadata=(O=m.metadata)!=null?O:"",h}};function H(){return{threshold:"",windows:void 0}}e.ThresholdDecisionPolicy={encode(m,h=N.Writer.create()){return m.threshold!==""&&h.uint32(10).string(m.threshold),m.windows!==void 0&&e.DecisionPolicyWindows.encode(m.windows,h.uint32(18).fork()).ldelim(),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=H();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.threshold=_.string();break;case 2:O.windows=e.DecisionPolicyWindows.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{threshold:(0,w.isSet)(m.threshold)?String(m.threshold):"",windows:(0,w.isSet)(m.windows)?e.DecisionPolicyWindows.fromJSON(m.windows):void 0}},toJSON(m){let h={};return m.threshold!==void 0&&(h.threshold=m.threshold),m.windows!==void 0&&(h.windows=m.windows?e.DecisionPolicyWindows.toJSON(m.windows):void 0),h},fromPartial(m){var _;let h=H();return h.threshold=(_=m.threshold)!=null?_:"",h.windows=m.windows!==void 0&&m.windows!==null?e.DecisionPolicyWindows.fromPartial(m.windows):void 0,h}};function re(){return{percentage:"",windows:void 0}}e.PercentageDecisionPolicy={encode(m,h=N.Writer.create()){return m.percentage!==""&&h.uint32(10).string(m.percentage),m.windows!==void 0&&e.DecisionPolicyWindows.encode(m.windows,h.uint32(18).fork()).ldelim(),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=re();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.percentage=_.string();break;case 2:O.windows=e.DecisionPolicyWindows.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{percentage:(0,w.isSet)(m.percentage)?String(m.percentage):"",windows:(0,w.isSet)(m.windows)?e.DecisionPolicyWindows.fromJSON(m.windows):void 0}},toJSON(m){let h={};return m.percentage!==void 0&&(h.percentage=m.percentage),m.windows!==void 0&&(h.windows=m.windows?e.DecisionPolicyWindows.toJSON(m.windows):void 0),h},fromPartial(m){var _;let h=re();return h.percentage=(_=m.percentage)!=null?_:"",h.windows=m.windows!==void 0&&m.windows!==null?e.DecisionPolicyWindows.fromPartial(m.windows):void 0,h}};function ee(){return{votingPeriod:void 0,minExecutionPeriod:void 0}}e.DecisionPolicyWindows={encode(m,h=N.Writer.create()){return m.votingPeriod!==void 0&&l.Duration.encode(m.votingPeriod,h.uint32(10).fork()).ldelim(),m.minExecutionPeriod!==void 0&&l.Duration.encode(m.minExecutionPeriod,h.uint32(18).fork()).ldelim(),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=ee();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.votingPeriod=l.Duration.decode(_,_.uint32());break;case 2:O.minExecutionPeriod=l.Duration.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{votingPeriod:(0,w.isSet)(m.votingPeriod)?l.Duration.fromJSON(m.votingPeriod):void 0,minExecutionPeriod:(0,w.isSet)(m.minExecutionPeriod)?l.Duration.fromJSON(m.minExecutionPeriod):void 0}},toJSON(m){let h={};return m.votingPeriod!==void 0&&(h.votingPeriod=m.votingPeriod?l.Duration.toJSON(m.votingPeriod):void 0),m.minExecutionPeriod!==void 0&&(h.minExecutionPeriod=m.minExecutionPeriod?l.Duration.toJSON(m.minExecutionPeriod):void 0),h},fromPartial(m){let h=ee();return h.votingPeriod=m.votingPeriod!==void 0&&m.votingPeriod!==null?l.Duration.fromPartial(m.votingPeriod):void 0,h.minExecutionPeriod=m.minExecutionPeriod!==void 0&&m.minExecutionPeriod!==null?l.Duration.fromPartial(m.minExecutionPeriod):void 0,h}};function T(){return{id:w.Long.UZERO,admin:"",metadata:"",version:w.Long.UZERO,totalWeight:"",createdAt:void 0}}e.GroupInfo={encode(m,h=N.Writer.create()){return m.id.isZero()||h.uint32(8).uint64(m.id),m.admin!==""&&h.uint32(18).string(m.admin),m.metadata!==""&&h.uint32(26).string(m.metadata),m.version.isZero()||h.uint32(32).uint64(m.version),m.totalWeight!==""&&h.uint32(42).string(m.totalWeight),m.createdAt!==void 0&&f.Timestamp.encode(m.createdAt,h.uint32(50).fork()).ldelim(),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=T();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.id=_.uint64();break;case 2:O.admin=_.string();break;case 3:O.metadata=_.string();break;case 4:O.version=_.uint64();break;case 5:O.totalWeight=_.string();break;case 6:O.createdAt=f.Timestamp.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{id:(0,w.isSet)(m.id)?w.Long.fromValue(m.id):w.Long.UZERO,admin:(0,w.isSet)(m.admin)?String(m.admin):"",metadata:(0,w.isSet)(m.metadata)?String(m.metadata):"",version:(0,w.isSet)(m.version)?w.Long.fromValue(m.version):w.Long.UZERO,totalWeight:(0,w.isSet)(m.totalWeight)?String(m.totalWeight):"",createdAt:(0,w.isSet)(m.createdAt)?(0,w.fromJsonTimestamp)(m.createdAt):void 0}},toJSON(m){let h={};return m.id!==void 0&&(h.id=(m.id||w.Long.UZERO).toString()),m.admin!==void 0&&(h.admin=m.admin),m.metadata!==void 0&&(h.metadata=m.metadata),m.version!==void 0&&(h.version=(m.version||w.Long.UZERO).toString()),m.totalWeight!==void 0&&(h.totalWeight=m.totalWeight),m.createdAt!==void 0&&(h.createdAt=(0,w.fromTimestamp)(m.createdAt).toISOString()),h},fromPartial(m){var _,b,O;let h=T();return h.id=m.id!==void 0&&m.id!==null?w.Long.fromValue(m.id):w.Long.UZERO,h.admin=(_=m.admin)!=null?_:"",h.metadata=(b=m.metadata)!=null?b:"",h.version=m.version!==void 0&&m.version!==null?w.Long.fromValue(m.version):w.Long.UZERO,h.totalWeight=(O=m.totalWeight)!=null?O:"",h.createdAt=m.createdAt!==void 0&&m.createdAt!==null?f.Timestamp.fromPartial(m.createdAt):void 0,h}};function se(){return{groupId:w.Long.UZERO,member:void 0}}e.GroupMember={encode(m,h=N.Writer.create()){return m.groupId.isZero()||h.uint32(8).uint64(m.groupId),m.member!==void 0&&e.Member.encode(m.member,h.uint32(18).fork()).ldelim(),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=se();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.groupId=_.uint64();break;case 2:O.member=e.Member.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{groupId:(0,w.isSet)(m.groupId)?w.Long.fromValue(m.groupId):w.Long.UZERO,member:(0,w.isSet)(m.member)?e.Member.fromJSON(m.member):void 0}},toJSON(m){let h={};return m.groupId!==void 0&&(h.groupId=(m.groupId||w.Long.UZERO).toString()),m.member!==void 0&&(h.member=m.member?e.Member.toJSON(m.member):void 0),h},fromPartial(m){let h=se();return h.groupId=m.groupId!==void 0&&m.groupId!==null?w.Long.fromValue(m.groupId):w.Long.UZERO,h.member=m.member!==void 0&&m.member!==null?e.Member.fromPartial(m.member):void 0,h}};function p(){return{address:"",groupId:w.Long.UZERO,admin:"",metadata:"",version:w.Long.UZERO,decisionPolicy:void 0,createdAt:void 0}}e.GroupPolicyInfo={encode(m,h=N.Writer.create()){return m.address!==""&&h.uint32(10).string(m.address),m.groupId.isZero()||h.uint32(16).uint64(m.groupId),m.admin!==""&&h.uint32(26).string(m.admin),m.metadata!==""&&h.uint32(34).string(m.metadata),m.version.isZero()||h.uint32(40).uint64(m.version),m.decisionPolicy!==void 0&&g.Any.encode(m.decisionPolicy,h.uint32(50).fork()).ldelim(),m.createdAt!==void 0&&f.Timestamp.encode(m.createdAt,h.uint32(58).fork()).ldelim(),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=p();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.address=_.string();break;case 2:O.groupId=_.uint64();break;case 3:O.admin=_.string();break;case 4:O.metadata=_.string();break;case 5:O.version=_.uint64();break;case 6:O.decisionPolicy=g.Any.decode(_,_.uint32());break;case 7:O.createdAt=f.Timestamp.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{address:(0,w.isSet)(m.address)?String(m.address):"",groupId:(0,w.isSet)(m.groupId)?w.Long.fromValue(m.groupId):w.Long.UZERO,admin:(0,w.isSet)(m.admin)?String(m.admin):"",metadata:(0,w.isSet)(m.metadata)?String(m.metadata):"",version:(0,w.isSet)(m.version)?w.Long.fromValue(m.version):w.Long.UZERO,decisionPolicy:(0,w.isSet)(m.decisionPolicy)?g.Any.fromJSON(m.decisionPolicy):void 0,createdAt:(0,w.isSet)(m.createdAt)?(0,w.fromJsonTimestamp)(m.createdAt):void 0}},toJSON(m){let h={};return m.address!==void 0&&(h.address=m.address),m.groupId!==void 0&&(h.groupId=(m.groupId||w.Long.UZERO).toString()),m.admin!==void 0&&(h.admin=m.admin),m.metadata!==void 0&&(h.metadata=m.metadata),m.version!==void 0&&(h.version=(m.version||w.Long.UZERO).toString()),m.decisionPolicy!==void 0&&(h.decisionPolicy=m.decisionPolicy?g.Any.toJSON(m.decisionPolicy):void 0),m.createdAt!==void 0&&(h.createdAt=(0,w.fromTimestamp)(m.createdAt).toISOString()),h},fromPartial(m){var _,b,O;let h=p();return h.address=(_=m.address)!=null?_:"",h.groupId=m.groupId!==void 0&&m.groupId!==null?w.Long.fromValue(m.groupId):w.Long.UZERO,h.admin=(b=m.admin)!=null?b:"",h.metadata=(O=m.metadata)!=null?O:"",h.version=m.version!==void 0&&m.version!==null?w.Long.fromValue(m.version):w.Long.UZERO,h.decisionPolicy=m.decisionPolicy!==void 0&&m.decisionPolicy!==null?g.Any.fromPartial(m.decisionPolicy):void 0,h.createdAt=m.createdAt!==void 0&&m.createdAt!==null?f.Timestamp.fromPartial(m.createdAt):void 0,h}};function L(){return{id:w.Long.UZERO,groupPolicyAddress:"",metadata:"",proposers:[],submitTime:void 0,groupVersion:w.Long.UZERO,groupPolicyVersion:w.Long.UZERO,status:0,finalTallyResult:void 0,votingPeriodEnd:void 0,executorResult:0,messages:[],title:"",summary:""}}e.Proposal={encode(m,h=N.Writer.create()){m.id.isZero()||h.uint32(8).uint64(m.id),m.groupPolicyAddress!==""&&h.uint32(18).string(m.groupPolicyAddress),m.metadata!==""&&h.uint32(26).string(m.metadata);for(let _ of m.proposers)h.uint32(34).string(_);m.submitTime!==void 0&&f.Timestamp.encode(m.submitTime,h.uint32(42).fork()).ldelim(),m.groupVersion.isZero()||h.uint32(48).uint64(m.groupVersion),m.groupPolicyVersion.isZero()||h.uint32(56).uint64(m.groupPolicyVersion),m.status!==0&&h.uint32(64).int32(m.status),m.finalTallyResult!==void 0&&e.TallyResult.encode(m.finalTallyResult,h.uint32(74).fork()).ldelim(),m.votingPeriodEnd!==void 0&&f.Timestamp.encode(m.votingPeriodEnd,h.uint32(82).fork()).ldelim(),m.executorResult!==0&&h.uint32(88).int32(m.executorResult);for(let _ of m.messages)g.Any.encode(_,h.uint32(98).fork()).ldelim();return m.title!==""&&h.uint32(106).string(m.title),m.summary!==""&&h.uint32(114).string(m.summary),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=L();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.id=_.uint64();break;case 2:O.groupPolicyAddress=_.string();break;case 3:O.metadata=_.string();break;case 4:O.proposers.push(_.string());break;case 5:O.submitTime=f.Timestamp.decode(_,_.uint32());break;case 6:O.groupVersion=_.uint64();break;case 7:O.groupPolicyVersion=_.uint64();break;case 8:O.status=_.int32();break;case 9:O.finalTallyResult=e.TallyResult.decode(_,_.uint32());break;case 10:O.votingPeriodEnd=f.Timestamp.decode(_,_.uint32());break;case 11:O.executorResult=_.int32();break;case 12:O.messages.push(g.Any.decode(_,_.uint32()));break;case 13:O.title=_.string();break;case 14:O.summary=_.string();break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{id:(0,w.isSet)(m.id)?w.Long.fromValue(m.id):w.Long.UZERO,groupPolicyAddress:(0,w.isSet)(m.groupPolicyAddress)?String(m.groupPolicyAddress):"",metadata:(0,w.isSet)(m.metadata)?String(m.metadata):"",proposers:Array.isArray(m==null?void 0:m.proposers)?m.proposers.map(h=>String(h)):[],submitTime:(0,w.isSet)(m.submitTime)?(0,w.fromJsonTimestamp)(m.submitTime):void 0,groupVersion:(0,w.isSet)(m.groupVersion)?w.Long.fromValue(m.groupVersion):w.Long.UZERO,groupPolicyVersion:(0,w.isSet)(m.groupPolicyVersion)?w.Long.fromValue(m.groupPolicyVersion):w.Long.UZERO,status:(0,w.isSet)(m.status)?ne(m.status):0,finalTallyResult:(0,w.isSet)(m.finalTallyResult)?e.TallyResult.fromJSON(m.finalTallyResult):void 0,votingPeriodEnd:(0,w.isSet)(m.votingPeriodEnd)?(0,w.fromJsonTimestamp)(m.votingPeriodEnd):void 0,executorResult:(0,w.isSet)(m.executorResult)?M(m.executorResult):0,messages:Array.isArray(m==null?void 0:m.messages)?m.messages.map(h=>g.Any.fromJSON(h)):[],title:(0,w.isSet)(m.title)?String(m.title):"",summary:(0,w.isSet)(m.summary)?String(m.summary):""}},toJSON(m){let h={};return m.id!==void 0&&(h.id=(m.id||w.Long.UZERO).toString()),m.groupPolicyAddress!==void 0&&(h.groupPolicyAddress=m.groupPolicyAddress),m.metadata!==void 0&&(h.metadata=m.metadata),m.proposers?h.proposers=m.proposers.map(_=>_):h.proposers=[],m.submitTime!==void 0&&(h.submitTime=(0,w.fromTimestamp)(m.submitTime).toISOString()),m.groupVersion!==void 0&&(h.groupVersion=(m.groupVersion||w.Long.UZERO).toString()),m.groupPolicyVersion!==void 0&&(h.groupPolicyVersion=(m.groupPolicyVersion||w.Long.UZERO).toString()),m.status!==void 0&&(h.status=Z(m.status)),m.finalTallyResult!==void 0&&(h.finalTallyResult=m.finalTallyResult?e.TallyResult.toJSON(m.finalTallyResult):void 0),m.votingPeriodEnd!==void 0&&(h.votingPeriodEnd=(0,w.fromTimestamp)(m.votingPeriodEnd).toISOString()),m.executorResult!==void 0&&(h.executorResult=U(m.executorResult)),m.messages?h.messages=m.messages.map(_=>_?g.Any.toJSON(_):void 0):h.messages=[],m.title!==void 0&&(h.title=m.title),m.summary!==void 0&&(h.summary=m.summary),h},fromPartial(m){var _,b,O,J,ie,G,I,C;let h=L();return h.id=m.id!==void 0&&m.id!==null?w.Long.fromValue(m.id):w.Long.UZERO,h.groupPolicyAddress=(_=m.groupPolicyAddress)!=null?_:"",h.metadata=(b=m.metadata)!=null?b:"",h.proposers=((O=m.proposers)==null?void 0:O.map(D=>D))||[],h.submitTime=m.submitTime!==void 0&&m.submitTime!==null?f.Timestamp.fromPartial(m.submitTime):void 0,h.groupVersion=m.groupVersion!==void 0&&m.groupVersion!==null?w.Long.fromValue(m.groupVersion):w.Long.UZERO,h.groupPolicyVersion=m.groupPolicyVersion!==void 0&&m.groupPolicyVersion!==null?w.Long.fromValue(m.groupPolicyVersion):w.Long.UZERO,h.status=(J=m.status)!=null?J:0,h.finalTallyResult=m.finalTallyResult!==void 0&&m.finalTallyResult!==null?e.TallyResult.fromPartial(m.finalTallyResult):void 0,h.votingPeriodEnd=m.votingPeriodEnd!==void 0&&m.votingPeriodEnd!==null?f.Timestamp.fromPartial(m.votingPeriodEnd):void 0,h.executorResult=(ie=m.executorResult)!=null?ie:0,h.messages=((G=m.messages)==null?void 0:G.map(D=>g.Any.fromPartial(D)))||[],h.title=(I=m.title)!=null?I:"",h.summary=(C=m.summary)!=null?C:"",h}};function V(){return{yesCount:"",abstainCount:"",noCount:"",noWithVetoCount:""}}e.TallyResult={encode(m,h=N.Writer.create()){return m.yesCount!==""&&h.uint32(10).string(m.yesCount),m.abstainCount!==""&&h.uint32(18).string(m.abstainCount),m.noCount!==""&&h.uint32(26).string(m.noCount),m.noWithVetoCount!==""&&h.uint32(34).string(m.noWithVetoCount),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=V();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.yesCount=_.string();break;case 2:O.abstainCount=_.string();break;case 3:O.noCount=_.string();break;case 4:O.noWithVetoCount=_.string();break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{yesCount:(0,w.isSet)(m.yesCount)?String(m.yesCount):"",abstainCount:(0,w.isSet)(m.abstainCount)?String(m.abstainCount):"",noCount:(0,w.isSet)(m.noCount)?String(m.noCount):"",noWithVetoCount:(0,w.isSet)(m.noWithVetoCount)?String(m.noWithVetoCount):""}},toJSON(m){let h={};return m.yesCount!==void 0&&(h.yesCount=m.yesCount),m.abstainCount!==void 0&&(h.abstainCount=m.abstainCount),m.noCount!==void 0&&(h.noCount=m.noCount),m.noWithVetoCount!==void 0&&(h.noWithVetoCount=m.noWithVetoCount),h},fromPartial(m){var _,b,O,J;let h=V();return h.yesCount=(_=m.yesCount)!=null?_:"",h.abstainCount=(b=m.abstainCount)!=null?b:"",h.noCount=(O=m.noCount)!=null?O:"",h.noWithVetoCount=(J=m.noWithVetoCount)!=null?J:"",h}};function K(){return{proposalId:w.Long.UZERO,voter:"",option:0,metadata:"",submitTime:void 0}}e.Vote={encode(m,h=N.Writer.create()){return m.proposalId.isZero()||h.uint32(8).uint64(m.proposalId),m.voter!==""&&h.uint32(18).string(m.voter),m.option!==0&&h.uint32(24).int32(m.option),m.metadata!==""&&h.uint32(34).string(m.metadata),m.submitTime!==void 0&&f.Timestamp.encode(m.submitTime,h.uint32(42).fork()).ldelim(),h},decode(m,h){let _=m instanceof N.Reader?m:new N.Reader(m),b=h===void 0?_.len:_.pos+h,O=K();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.proposalId=_.uint64();break;case 2:O.voter=_.string();break;case 3:O.option=_.int32();break;case 4:O.metadata=_.string();break;case 5:O.submitTime=f.Timestamp.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{proposalId:(0,w.isSet)(m.proposalId)?w.Long.fromValue(m.proposalId):w.Long.UZERO,voter:(0,w.isSet)(m.voter)?String(m.voter):"",option:(0,w.isSet)(m.option)?j(m.option):0,metadata:(0,w.isSet)(m.metadata)?String(m.metadata):"",submitTime:(0,w.isSet)(m.submitTime)?(0,w.fromJsonTimestamp)(m.submitTime):void 0}},toJSON(m){let h={};return m.proposalId!==void 0&&(h.proposalId=(m.proposalId||w.Long.UZERO).toString()),m.voter!==void 0&&(h.voter=m.voter),m.option!==void 0&&(h.option=te(m.option)),m.metadata!==void 0&&(h.metadata=m.metadata),m.submitTime!==void 0&&(h.submitTime=(0,w.fromTimestamp)(m.submitTime).toISOString()),h},fromPartial(m){var _,b,O;let h=K();return h.proposalId=m.proposalId!==void 0&&m.proposalId!==null?w.Long.fromValue(m.proposalId):w.Long.UZERO,h.voter=(_=m.voter)!=null?_:"",h.option=(b=m.option)!=null?b:0,h.metadata=(O=m.metadata)!=null?O:"",h.submitTime=m.submitTime!==void 0&&m.submitTime!==null?f.Timestamp.fromPartial(m.submitTime):void 0,h}}})(D$r);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(W,ae,ye,Xe){Xe===void 0&&(Xe=ye);var nt=Object.getOwnPropertyDescriptor(ae,ye);(!nt||("get"in nt?!ae.__esModule:nt.writable||nt.configurable))&&(nt={enumerable:!0,get:function(){return ae[ye]}}),Object.defineProperty(W,Xe,nt)}:function(W,ae,ye,Xe){Xe===void 0&&(Xe=ye),W[Xe]=ae[ye]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(W,ae){Object.defineProperty(W,"default",{enumerable:!0,value:ae})}:function(W,ae){W.default=ae}),c=Fr&&Fr.__importStar||function(W){if(W&&W.__esModule)return W;var ae={};if(W!=null)for(var ye in W)ye!=="default"&&Object.prototype.hasOwnProperty.call(W,ye)&&i(ae,W,ye);return A(ae,W),ae};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgLeaveGroupResponse=e.MsgLeaveGroup=e.MsgExecResponse=e.MsgExec=e.MsgVoteResponse=e.MsgVote=e.MsgWithdrawProposalResponse=e.MsgWithdrawProposal=e.MsgSubmitProposalResponse=e.MsgSubmitProposal=e.MsgUpdateGroupPolicyMetadataResponse=e.MsgUpdateGroupPolicyMetadata=e.MsgUpdateGroupPolicyDecisionPolicyResponse=e.MsgUpdateGroupPolicyDecisionPolicy=e.MsgCreateGroupWithPolicyResponse=e.MsgCreateGroupWithPolicy=e.MsgUpdateGroupPolicyAdminResponse=e.MsgUpdateGroupPolicyAdmin=e.MsgCreateGroupPolicyResponse=e.MsgCreateGroupPolicy=e.MsgUpdateGroupMetadataResponse=e.MsgUpdateGroupMetadata=e.MsgUpdateGroupAdminResponse=e.MsgUpdateGroupAdmin=e.MsgUpdateGroupMembersResponse=e.MsgUpdateGroupMembers=e.MsgCreateGroupResponse=e.MsgCreateGroup=e.execToJSON=e.execFromJSON=e.Exec=e.protobufPackage=void 0;let f=D$r,l=fh,g=Ns,w=c(BA);e.protobufPackage="cosmos.group.v1";var N;(function(W){W[W.EXEC_UNSPECIFIED=0]="EXEC_UNSPECIFIED",W[W.EXEC_TRY=1]="EXEC_TRY",W[W.UNRECOGNIZED=-1]="UNRECOGNIZED"})(N=e.Exec||(e.Exec={}));function F(W){switch(W){case 0:case"EXEC_UNSPECIFIED":return N.EXEC_UNSPECIFIED;case 1:case"EXEC_TRY":return N.EXEC_TRY;case-1:case"UNRECOGNIZED":default:return N.UNRECOGNIZED}}e.execFromJSON=F;function j(W){switch(W){case N.EXEC_UNSPECIFIED:return"EXEC_UNSPECIFIED";case N.EXEC_TRY:return"EXEC_TRY";case N.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.execToJSON=j;function te(){return{admin:"",members:[],metadata:""}}e.MsgCreateGroup={encode(W,ae=w.Writer.create()){W.admin!==""&&ae.uint32(10).string(W.admin);for(let ye of W.members)f.MemberRequest.encode(ye,ae.uint32(18).fork()).ldelim();return W.metadata!==""&&ae.uint32(26).string(W.metadata),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=te();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.admin=ye.string();break;case 2:nt.members.push(f.MemberRequest.decode(ye,ye.uint32()));break;case 3:nt.metadata=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{admin:(0,g.isSet)(W.admin)?String(W.admin):"",members:Array.isArray(W==null?void 0:W.members)?W.members.map(ae=>f.MemberRequest.fromJSON(ae)):[],metadata:(0,g.isSet)(W.metadata)?String(W.metadata):""}},toJSON(W){let ae={};return W.admin!==void 0&&(ae.admin=W.admin),W.members?ae.members=W.members.map(ye=>ye?f.MemberRequest.toJSON(ye):void 0):ae.members=[],W.metadata!==void 0&&(ae.metadata=W.metadata),ae},fromPartial(W){var ye,Xe,nt;let ae=te();return ae.admin=(ye=W.admin)!=null?ye:"",ae.members=((Xe=W.members)==null?void 0:Xe.map(Ke=>f.MemberRequest.fromPartial(Ke)))||[],ae.metadata=(nt=W.metadata)!=null?nt:"",ae}};function v(){return{groupId:g.Long.UZERO}}e.MsgCreateGroupResponse={encode(W,ae=w.Writer.create()){return W.groupId.isZero()||ae.uint32(8).uint64(W.groupId),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=v();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.groupId=ye.uint64();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{groupId:(0,g.isSet)(W.groupId)?g.Long.fromValue(W.groupId):g.Long.UZERO}},toJSON(W){let ae={};return W.groupId!==void 0&&(ae.groupId=(W.groupId||g.Long.UZERO).toString()),ae},fromPartial(W){let ae=v();return ae.groupId=W.groupId!==void 0&&W.groupId!==null?g.Long.fromValue(W.groupId):g.Long.UZERO,ae}};function ne(){return{admin:"",groupId:g.Long.UZERO,memberUpdates:[]}}e.MsgUpdateGroupMembers={encode(W,ae=w.Writer.create()){W.admin!==""&&ae.uint32(10).string(W.admin),W.groupId.isZero()||ae.uint32(16).uint64(W.groupId);for(let ye of W.memberUpdates)f.MemberRequest.encode(ye,ae.uint32(26).fork()).ldelim();return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=ne();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.admin=ye.string();break;case 2:nt.groupId=ye.uint64();break;case 3:nt.memberUpdates.push(f.MemberRequest.decode(ye,ye.uint32()));break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{admin:(0,g.isSet)(W.admin)?String(W.admin):"",groupId:(0,g.isSet)(W.groupId)?g.Long.fromValue(W.groupId):g.Long.UZERO,memberUpdates:Array.isArray(W==null?void 0:W.memberUpdates)?W.memberUpdates.map(ae=>f.MemberRequest.fromJSON(ae)):[]}},toJSON(W){let ae={};return W.admin!==void 0&&(ae.admin=W.admin),W.groupId!==void 0&&(ae.groupId=(W.groupId||g.Long.UZERO).toString()),W.memberUpdates?ae.memberUpdates=W.memberUpdates.map(ye=>ye?f.MemberRequest.toJSON(ye):void 0):ae.memberUpdates=[],ae},fromPartial(W){var ye,Xe;let ae=ne();return ae.admin=(ye=W.admin)!=null?ye:"",ae.groupId=W.groupId!==void 0&&W.groupId!==null?g.Long.fromValue(W.groupId):g.Long.UZERO,ae.memberUpdates=((Xe=W.memberUpdates)==null?void 0:Xe.map(nt=>f.MemberRequest.fromPartial(nt)))||[],ae}};function Z(){return{}}e.MsgUpdateGroupMembersResponse={encode(W,ae=w.Writer.create()){return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=Z();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{}},toJSON(W){return{}},fromPartial(W){return Z()}};function R(){return{admin:"",groupId:g.Long.UZERO,newAdmin:""}}e.MsgUpdateGroupAdmin={encode(W,ae=w.Writer.create()){return W.admin!==""&&ae.uint32(10).string(W.admin),W.groupId.isZero()||ae.uint32(16).uint64(W.groupId),W.newAdmin!==""&&ae.uint32(26).string(W.newAdmin),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=R();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.admin=ye.string();break;case 2:nt.groupId=ye.uint64();break;case 3:nt.newAdmin=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{admin:(0,g.isSet)(W.admin)?String(W.admin):"",groupId:(0,g.isSet)(W.groupId)?g.Long.fromValue(W.groupId):g.Long.UZERO,newAdmin:(0,g.isSet)(W.newAdmin)?String(W.newAdmin):""}},toJSON(W){let ae={};return W.admin!==void 0&&(ae.admin=W.admin),W.groupId!==void 0&&(ae.groupId=(W.groupId||g.Long.UZERO).toString()),W.newAdmin!==void 0&&(ae.newAdmin=W.newAdmin),ae},fromPartial(W){var ye,Xe;let ae=R();return ae.admin=(ye=W.admin)!=null?ye:"",ae.groupId=W.groupId!==void 0&&W.groupId!==null?g.Long.fromValue(W.groupId):g.Long.UZERO,ae.newAdmin=(Xe=W.newAdmin)!=null?Xe:"",ae}};function M(){return{}}e.MsgUpdateGroupAdminResponse={encode(W,ae=w.Writer.create()){return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=M();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{}},toJSON(W){return{}},fromPartial(W){return M()}};function U(){return{admin:"",groupId:g.Long.UZERO,metadata:""}}e.MsgUpdateGroupMetadata={encode(W,ae=w.Writer.create()){return W.admin!==""&&ae.uint32(10).string(W.admin),W.groupId.isZero()||ae.uint32(16).uint64(W.groupId),W.metadata!==""&&ae.uint32(26).string(W.metadata),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=U();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.admin=ye.string();break;case 2:nt.groupId=ye.uint64();break;case 3:nt.metadata=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{admin:(0,g.isSet)(W.admin)?String(W.admin):"",groupId:(0,g.isSet)(W.groupId)?g.Long.fromValue(W.groupId):g.Long.UZERO,metadata:(0,g.isSet)(W.metadata)?String(W.metadata):""}},toJSON(W){let ae={};return W.admin!==void 0&&(ae.admin=W.admin),W.groupId!==void 0&&(ae.groupId=(W.groupId||g.Long.UZERO).toString()),W.metadata!==void 0&&(ae.metadata=W.metadata),ae},fromPartial(W){var ye,Xe;let ae=U();return ae.admin=(ye=W.admin)!=null?ye:"",ae.groupId=W.groupId!==void 0&&W.groupId!==null?g.Long.fromValue(W.groupId):g.Long.UZERO,ae.metadata=(Xe=W.metadata)!=null?Xe:"",ae}};function E(){return{}}e.MsgUpdateGroupMetadataResponse={encode(W,ae=w.Writer.create()){return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=E();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{}},toJSON(W){return{}},fromPartial(W){return E()}};function Q(){return{admin:"",groupId:g.Long.UZERO,metadata:"",decisionPolicy:void 0}}e.MsgCreateGroupPolicy={encode(W,ae=w.Writer.create()){return W.admin!==""&&ae.uint32(10).string(W.admin),W.groupId.isZero()||ae.uint32(16).uint64(W.groupId),W.metadata!==""&&ae.uint32(26).string(W.metadata),W.decisionPolicy!==void 0&&l.Any.encode(W.decisionPolicy,ae.uint32(34).fork()).ldelim(),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=Q();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.admin=ye.string();break;case 2:nt.groupId=ye.uint64();break;case 3:nt.metadata=ye.string();break;case 4:nt.decisionPolicy=l.Any.decode(ye,ye.uint32());break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{admin:(0,g.isSet)(W.admin)?String(W.admin):"",groupId:(0,g.isSet)(W.groupId)?g.Long.fromValue(W.groupId):g.Long.UZERO,metadata:(0,g.isSet)(W.metadata)?String(W.metadata):"",decisionPolicy:(0,g.isSet)(W.decisionPolicy)?l.Any.fromJSON(W.decisionPolicy):void 0}},toJSON(W){let ae={};return W.admin!==void 0&&(ae.admin=W.admin),W.groupId!==void 0&&(ae.groupId=(W.groupId||g.Long.UZERO).toString()),W.metadata!==void 0&&(ae.metadata=W.metadata),W.decisionPolicy!==void 0&&(ae.decisionPolicy=W.decisionPolicy?l.Any.toJSON(W.decisionPolicy):void 0),ae},fromPartial(W){var ye,Xe;let ae=Q();return ae.admin=(ye=W.admin)!=null?ye:"",ae.groupId=W.groupId!==void 0&&W.groupId!==null?g.Long.fromValue(W.groupId):g.Long.UZERO,ae.metadata=(Xe=W.metadata)!=null?Xe:"",ae.decisionPolicy=W.decisionPolicy!==void 0&&W.decisionPolicy!==null?l.Any.fromPartial(W.decisionPolicy):void 0,ae}};function H(){return{address:""}}e.MsgCreateGroupPolicyResponse={encode(W,ae=w.Writer.create()){return W.address!==""&&ae.uint32(10).string(W.address),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=H();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.address=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{address:(0,g.isSet)(W.address)?String(W.address):""}},toJSON(W){let ae={};return W.address!==void 0&&(ae.address=W.address),ae},fromPartial(W){var ye;let ae=H();return ae.address=(ye=W.address)!=null?ye:"",ae}};function re(){return{admin:"",groupPolicyAddress:"",newAdmin:""}}e.MsgUpdateGroupPolicyAdmin={encode(W,ae=w.Writer.create()){return W.admin!==""&&ae.uint32(10).string(W.admin),W.groupPolicyAddress!==""&&ae.uint32(18).string(W.groupPolicyAddress),W.newAdmin!==""&&ae.uint32(26).string(W.newAdmin),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=re();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.admin=ye.string();break;case 2:nt.groupPolicyAddress=ye.string();break;case 3:nt.newAdmin=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{admin:(0,g.isSet)(W.admin)?String(W.admin):"",groupPolicyAddress:(0,g.isSet)(W.groupPolicyAddress)?String(W.groupPolicyAddress):"",newAdmin:(0,g.isSet)(W.newAdmin)?String(W.newAdmin):""}},toJSON(W){let ae={};return W.admin!==void 0&&(ae.admin=W.admin),W.groupPolicyAddress!==void 0&&(ae.groupPolicyAddress=W.groupPolicyAddress),W.newAdmin!==void 0&&(ae.newAdmin=W.newAdmin),ae},fromPartial(W){var ye,Xe,nt;let ae=re();return ae.admin=(ye=W.admin)!=null?ye:"",ae.groupPolicyAddress=(Xe=W.groupPolicyAddress)!=null?Xe:"",ae.newAdmin=(nt=W.newAdmin)!=null?nt:"",ae}};function ee(){return{}}e.MsgUpdateGroupPolicyAdminResponse={encode(W,ae=w.Writer.create()){return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=ee();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{}},toJSON(W){return{}},fromPartial(W){return ee()}};function T(){return{admin:"",members:[],groupMetadata:"",groupPolicyMetadata:"",groupPolicyAsAdmin:!1,decisionPolicy:void 0}}e.MsgCreateGroupWithPolicy={encode(W,ae=w.Writer.create()){W.admin!==""&&ae.uint32(10).string(W.admin);for(let ye of W.members)f.MemberRequest.encode(ye,ae.uint32(18).fork()).ldelim();return W.groupMetadata!==""&&ae.uint32(26).string(W.groupMetadata),W.groupPolicyMetadata!==""&&ae.uint32(34).string(W.groupPolicyMetadata),W.groupPolicyAsAdmin===!0&&ae.uint32(40).bool(W.groupPolicyAsAdmin),W.decisionPolicy!==void 0&&l.Any.encode(W.decisionPolicy,ae.uint32(50).fork()).ldelim(),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=T();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.admin=ye.string();break;case 2:nt.members.push(f.MemberRequest.decode(ye,ye.uint32()));break;case 3:nt.groupMetadata=ye.string();break;case 4:nt.groupPolicyMetadata=ye.string();break;case 5:nt.groupPolicyAsAdmin=ye.bool();break;case 6:nt.decisionPolicy=l.Any.decode(ye,ye.uint32());break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{admin:(0,g.isSet)(W.admin)?String(W.admin):"",members:Array.isArray(W==null?void 0:W.members)?W.members.map(ae=>f.MemberRequest.fromJSON(ae)):[],groupMetadata:(0,g.isSet)(W.groupMetadata)?String(W.groupMetadata):"",groupPolicyMetadata:(0,g.isSet)(W.groupPolicyMetadata)?String(W.groupPolicyMetadata):"",groupPolicyAsAdmin:(0,g.isSet)(W.groupPolicyAsAdmin)?!!W.groupPolicyAsAdmin:!1,decisionPolicy:(0,g.isSet)(W.decisionPolicy)?l.Any.fromJSON(W.decisionPolicy):void 0}},toJSON(W){let ae={};return W.admin!==void 0&&(ae.admin=W.admin),W.members?ae.members=W.members.map(ye=>ye?f.MemberRequest.toJSON(ye):void 0):ae.members=[],W.groupMetadata!==void 0&&(ae.groupMetadata=W.groupMetadata),W.groupPolicyMetadata!==void 0&&(ae.groupPolicyMetadata=W.groupPolicyMetadata),W.groupPolicyAsAdmin!==void 0&&(ae.groupPolicyAsAdmin=W.groupPolicyAsAdmin),W.decisionPolicy!==void 0&&(ae.decisionPolicy=W.decisionPolicy?l.Any.toJSON(W.decisionPolicy):void 0),ae},fromPartial(W){var ye,Xe,nt,Ke,It;let ae=T();return ae.admin=(ye=W.admin)!=null?ye:"",ae.members=((Xe=W.members)==null?void 0:Xe.map(rt=>f.MemberRequest.fromPartial(rt)))||[],ae.groupMetadata=(nt=W.groupMetadata)!=null?nt:"",ae.groupPolicyMetadata=(Ke=W.groupPolicyMetadata)!=null?Ke:"",ae.groupPolicyAsAdmin=(It=W.groupPolicyAsAdmin)!=null?It:!1,ae.decisionPolicy=W.decisionPolicy!==void 0&&W.decisionPolicy!==null?l.Any.fromPartial(W.decisionPolicy):void 0,ae}};function se(){return{groupId:g.Long.UZERO,groupPolicyAddress:""}}e.MsgCreateGroupWithPolicyResponse={encode(W,ae=w.Writer.create()){return W.groupId.isZero()||ae.uint32(8).uint64(W.groupId),W.groupPolicyAddress!==""&&ae.uint32(18).string(W.groupPolicyAddress),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=se();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.groupId=ye.uint64();break;case 2:nt.groupPolicyAddress=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{groupId:(0,g.isSet)(W.groupId)?g.Long.fromValue(W.groupId):g.Long.UZERO,groupPolicyAddress:(0,g.isSet)(W.groupPolicyAddress)?String(W.groupPolicyAddress):""}},toJSON(W){let ae={};return W.groupId!==void 0&&(ae.groupId=(W.groupId||g.Long.UZERO).toString()),W.groupPolicyAddress!==void 0&&(ae.groupPolicyAddress=W.groupPolicyAddress),ae},fromPartial(W){var ye;let ae=se();return ae.groupId=W.groupId!==void 0&&W.groupId!==null?g.Long.fromValue(W.groupId):g.Long.UZERO,ae.groupPolicyAddress=(ye=W.groupPolicyAddress)!=null?ye:"",ae}};function p(){return{admin:"",groupPolicyAddress:"",decisionPolicy:void 0}}e.MsgUpdateGroupPolicyDecisionPolicy={encode(W,ae=w.Writer.create()){return W.admin!==""&&ae.uint32(10).string(W.admin),W.groupPolicyAddress!==""&&ae.uint32(18).string(W.groupPolicyAddress),W.decisionPolicy!==void 0&&l.Any.encode(W.decisionPolicy,ae.uint32(26).fork()).ldelim(),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=p();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.admin=ye.string();break;case 2:nt.groupPolicyAddress=ye.string();break;case 3:nt.decisionPolicy=l.Any.decode(ye,ye.uint32());break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{admin:(0,g.isSet)(W.admin)?String(W.admin):"",groupPolicyAddress:(0,g.isSet)(W.groupPolicyAddress)?String(W.groupPolicyAddress):"",decisionPolicy:(0,g.isSet)(W.decisionPolicy)?l.Any.fromJSON(W.decisionPolicy):void 0}},toJSON(W){let ae={};return W.admin!==void 0&&(ae.admin=W.admin),W.groupPolicyAddress!==void 0&&(ae.groupPolicyAddress=W.groupPolicyAddress),W.decisionPolicy!==void 0&&(ae.decisionPolicy=W.decisionPolicy?l.Any.toJSON(W.decisionPolicy):void 0),ae},fromPartial(W){var ye,Xe;let ae=p();return ae.admin=(ye=W.admin)!=null?ye:"",ae.groupPolicyAddress=(Xe=W.groupPolicyAddress)!=null?Xe:"",ae.decisionPolicy=W.decisionPolicy!==void 0&&W.decisionPolicy!==null?l.Any.fromPartial(W.decisionPolicy):void 0,ae}};function L(){return{}}e.MsgUpdateGroupPolicyDecisionPolicyResponse={encode(W,ae=w.Writer.create()){return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=L();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{}},toJSON(W){return{}},fromPartial(W){return L()}};function V(){return{admin:"",groupPolicyAddress:"",metadata:""}}e.MsgUpdateGroupPolicyMetadata={encode(W,ae=w.Writer.create()){return W.admin!==""&&ae.uint32(10).string(W.admin),W.groupPolicyAddress!==""&&ae.uint32(18).string(W.groupPolicyAddress),W.metadata!==""&&ae.uint32(26).string(W.metadata),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=V();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.admin=ye.string();break;case 2:nt.groupPolicyAddress=ye.string();break;case 3:nt.metadata=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{admin:(0,g.isSet)(W.admin)?String(W.admin):"",groupPolicyAddress:(0,g.isSet)(W.groupPolicyAddress)?String(W.groupPolicyAddress):"",metadata:(0,g.isSet)(W.metadata)?String(W.metadata):""}},toJSON(W){let ae={};return W.admin!==void 0&&(ae.admin=W.admin),W.groupPolicyAddress!==void 0&&(ae.groupPolicyAddress=W.groupPolicyAddress),W.metadata!==void 0&&(ae.metadata=W.metadata),ae},fromPartial(W){var ye,Xe,nt;let ae=V();return ae.admin=(ye=W.admin)!=null?ye:"",ae.groupPolicyAddress=(Xe=W.groupPolicyAddress)!=null?Xe:"",ae.metadata=(nt=W.metadata)!=null?nt:"",ae}};function K(){return{}}e.MsgUpdateGroupPolicyMetadataResponse={encode(W,ae=w.Writer.create()){return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=K();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{}},toJSON(W){return{}},fromPartial(W){return K()}};function m(){return{groupPolicyAddress:"",proposers:[],metadata:"",messages:[],exec:0,title:"",summary:""}}e.MsgSubmitProposal={encode(W,ae=w.Writer.create()){W.groupPolicyAddress!==""&&ae.uint32(10).string(W.groupPolicyAddress);for(let ye of W.proposers)ae.uint32(18).string(ye);W.metadata!==""&&ae.uint32(26).string(W.metadata);for(let ye of W.messages)l.Any.encode(ye,ae.uint32(34).fork()).ldelim();return W.exec!==0&&ae.uint32(40).int32(W.exec),W.title!==""&&ae.uint32(50).string(W.title),W.summary!==""&&ae.uint32(58).string(W.summary),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=m();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.groupPolicyAddress=ye.string();break;case 2:nt.proposers.push(ye.string());break;case 3:nt.metadata=ye.string();break;case 4:nt.messages.push(l.Any.decode(ye,ye.uint32()));break;case 5:nt.exec=ye.int32();break;case 6:nt.title=ye.string();break;case 7:nt.summary=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{groupPolicyAddress:(0,g.isSet)(W.groupPolicyAddress)?String(W.groupPolicyAddress):"",proposers:Array.isArray(W==null?void 0:W.proposers)?W.proposers.map(ae=>String(ae)):[],metadata:(0,g.isSet)(W.metadata)?String(W.metadata):"",messages:Array.isArray(W==null?void 0:W.messages)?W.messages.map(ae=>l.Any.fromJSON(ae)):[],exec:(0,g.isSet)(W.exec)?F(W.exec):0,title:(0,g.isSet)(W.title)?String(W.title):"",summary:(0,g.isSet)(W.summary)?String(W.summary):""}},toJSON(W){let ae={};return W.groupPolicyAddress!==void 0&&(ae.groupPolicyAddress=W.groupPolicyAddress),W.proposers?ae.proposers=W.proposers.map(ye=>ye):ae.proposers=[],W.metadata!==void 0&&(ae.metadata=W.metadata),W.messages?ae.messages=W.messages.map(ye=>ye?l.Any.toJSON(ye):void 0):ae.messages=[],W.exec!==void 0&&(ae.exec=j(W.exec)),W.title!==void 0&&(ae.title=W.title),W.summary!==void 0&&(ae.summary=W.summary),ae},fromPartial(W){var ye,Xe,nt,Ke,It,rt,ut;let ae=m();return ae.groupPolicyAddress=(ye=W.groupPolicyAddress)!=null?ye:"",ae.proposers=((Xe=W.proposers)==null?void 0:Xe.map(Rt=>Rt))||[],ae.metadata=(nt=W.metadata)!=null?nt:"",ae.messages=((Ke=W.messages)==null?void 0:Ke.map(Rt=>l.Any.fromPartial(Rt)))||[],ae.exec=(It=W.exec)!=null?It:0,ae.title=(rt=W.title)!=null?rt:"",ae.summary=(ut=W.summary)!=null?ut:"",ae}};function h(){return{proposalId:g.Long.UZERO}}e.MsgSubmitProposalResponse={encode(W,ae=w.Writer.create()){return W.proposalId.isZero()||ae.uint32(8).uint64(W.proposalId),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=h();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.proposalId=ye.uint64();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{proposalId:(0,g.isSet)(W.proposalId)?g.Long.fromValue(W.proposalId):g.Long.UZERO}},toJSON(W){let ae={};return W.proposalId!==void 0&&(ae.proposalId=(W.proposalId||g.Long.UZERO).toString()),ae},fromPartial(W){let ae=h();return ae.proposalId=W.proposalId!==void 0&&W.proposalId!==null?g.Long.fromValue(W.proposalId):g.Long.UZERO,ae}};function _(){return{proposalId:g.Long.UZERO,address:""}}e.MsgWithdrawProposal={encode(W,ae=w.Writer.create()){return W.proposalId.isZero()||ae.uint32(8).uint64(W.proposalId),W.address!==""&&ae.uint32(18).string(W.address),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=_();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.proposalId=ye.uint64();break;case 2:nt.address=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{proposalId:(0,g.isSet)(W.proposalId)?g.Long.fromValue(W.proposalId):g.Long.UZERO,address:(0,g.isSet)(W.address)?String(W.address):""}},toJSON(W){let ae={};return W.proposalId!==void 0&&(ae.proposalId=(W.proposalId||g.Long.UZERO).toString()),W.address!==void 0&&(ae.address=W.address),ae},fromPartial(W){var ye;let ae=_();return ae.proposalId=W.proposalId!==void 0&&W.proposalId!==null?g.Long.fromValue(W.proposalId):g.Long.UZERO,ae.address=(ye=W.address)!=null?ye:"",ae}};function b(){return{}}e.MsgWithdrawProposalResponse={encode(W,ae=w.Writer.create()){return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=b();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{}},toJSON(W){return{}},fromPartial(W){return b()}};function O(){return{proposalId:g.Long.UZERO,voter:"",option:0,metadata:"",exec:0}}e.MsgVote={encode(W,ae=w.Writer.create()){return W.proposalId.isZero()||ae.uint32(8).uint64(W.proposalId),W.voter!==""&&ae.uint32(18).string(W.voter),W.option!==0&&ae.uint32(24).int32(W.option),W.metadata!==""&&ae.uint32(34).string(W.metadata),W.exec!==0&&ae.uint32(40).int32(W.exec),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=O();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.proposalId=ye.uint64();break;case 2:nt.voter=ye.string();break;case 3:nt.option=ye.int32();break;case 4:nt.metadata=ye.string();break;case 5:nt.exec=ye.int32();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{proposalId:(0,g.isSet)(W.proposalId)?g.Long.fromValue(W.proposalId):g.Long.UZERO,voter:(0,g.isSet)(W.voter)?String(W.voter):"",option:(0,g.isSet)(W.option)?(0,f.voteOptionFromJSON)(W.option):0,metadata:(0,g.isSet)(W.metadata)?String(W.metadata):"",exec:(0,g.isSet)(W.exec)?F(W.exec):0}},toJSON(W){let ae={};return W.proposalId!==void 0&&(ae.proposalId=(W.proposalId||g.Long.UZERO).toString()),W.voter!==void 0&&(ae.voter=W.voter),W.option!==void 0&&(ae.option=(0,f.voteOptionToJSON)(W.option)),W.metadata!==void 0&&(ae.metadata=W.metadata),W.exec!==void 0&&(ae.exec=j(W.exec)),ae},fromPartial(W){var ye,Xe,nt,Ke;let ae=O();return ae.proposalId=W.proposalId!==void 0&&W.proposalId!==null?g.Long.fromValue(W.proposalId):g.Long.UZERO,ae.voter=(ye=W.voter)!=null?ye:"",ae.option=(Xe=W.option)!=null?Xe:0,ae.metadata=(nt=W.metadata)!=null?nt:"",ae.exec=(Ke=W.exec)!=null?Ke:0,ae}};function J(){return{}}e.MsgVoteResponse={encode(W,ae=w.Writer.create()){return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=J();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{}},toJSON(W){return{}},fromPartial(W){return J()}};function ie(){return{proposalId:g.Long.UZERO,executor:""}}e.MsgExec={encode(W,ae=w.Writer.create()){return W.proposalId.isZero()||ae.uint32(8).uint64(W.proposalId),W.executor!==""&&ae.uint32(18).string(W.executor),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=ie();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.proposalId=ye.uint64();break;case 2:nt.executor=ye.string();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{proposalId:(0,g.isSet)(W.proposalId)?g.Long.fromValue(W.proposalId):g.Long.UZERO,executor:(0,g.isSet)(W.executor)?String(W.executor):""}},toJSON(W){let ae={};return W.proposalId!==void 0&&(ae.proposalId=(W.proposalId||g.Long.UZERO).toString()),W.executor!==void 0&&(ae.executor=W.executor),ae},fromPartial(W){var ye;let ae=ie();return ae.proposalId=W.proposalId!==void 0&&W.proposalId!==null?g.Long.fromValue(W.proposalId):g.Long.UZERO,ae.executor=(ye=W.executor)!=null?ye:"",ae}};function G(){return{result:0}}e.MsgExecResponse={encode(W,ae=w.Writer.create()){return W.result!==0&&ae.uint32(16).int32(W.result),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=G();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 2:nt.result=ye.int32();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{result:(0,g.isSet)(W.result)?(0,f.proposalExecutorResultFromJSON)(W.result):0}},toJSON(W){let ae={};return W.result!==void 0&&(ae.result=(0,f.proposalExecutorResultToJSON)(W.result)),ae},fromPartial(W){var ye;let ae=G();return ae.result=(ye=W.result)!=null?ye:0,ae}};function I(){return{address:"",groupId:g.Long.UZERO}}e.MsgLeaveGroup={encode(W,ae=w.Writer.create()){return W.address!==""&&ae.uint32(10).string(W.address),W.groupId.isZero()||ae.uint32(16).uint64(W.groupId),ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=I();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){case 1:nt.address=ye.string();break;case 2:nt.groupId=ye.uint64();break;default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{address:(0,g.isSet)(W.address)?String(W.address):"",groupId:(0,g.isSet)(W.groupId)?g.Long.fromValue(W.groupId):g.Long.UZERO}},toJSON(W){let ae={};return W.address!==void 0&&(ae.address=W.address),W.groupId!==void 0&&(ae.groupId=(W.groupId||g.Long.UZERO).toString()),ae},fromPartial(W){var ye;let ae=I();return ae.address=(ye=W.address)!=null?ye:"",ae.groupId=W.groupId!==void 0&&W.groupId!==null?g.Long.fromValue(W.groupId):g.Long.UZERO,ae}};function C(){return{}}e.MsgLeaveGroupResponse={encode(W,ae=w.Writer.create()){return ae},decode(W,ae){let ye=W instanceof w.Reader?W:new w.Reader(W),Xe=ae===void 0?ye.len:ye.pos+ae,nt=C();for(;ye.pos<Xe;){let Ke=ye.uint32();switch(Ke>>>3){default:ye.skipType(Ke&7);break}}return nt},fromJSON(W){return{}},toJSON(W){return{}},fromPartial(W){return C()}};class D{constructor(ae){this.rpc=ae,this.CreateGroup=this.CreateGroup.bind(this),this.UpdateGroupMembers=this.UpdateGroupMembers.bind(this),this.UpdateGroupAdmin=this.UpdateGroupAdmin.bind(this),this.UpdateGroupMetadata=this.UpdateGroupMetadata.bind(this),this.CreateGroupPolicy=this.CreateGroupPolicy.bind(this),this.CreateGroupWithPolicy=this.CreateGroupWithPolicy.bind(this),this.UpdateGroupPolicyAdmin=this.UpdateGroupPolicyAdmin.bind(this),this.UpdateGroupPolicyDecisionPolicy=this.UpdateGroupPolicyDecisionPolicy.bind(this),this.UpdateGroupPolicyMetadata=this.UpdateGroupPolicyMetadata.bind(this),this.SubmitProposal=this.SubmitProposal.bind(this),this.WithdrawProposal=this.WithdrawProposal.bind(this),this.Vote=this.Vote.bind(this),this.Exec=this.Exec.bind(this),this.LeaveGroup=this.LeaveGroup.bind(this)}CreateGroup(ae){let ye=e.MsgCreateGroup.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","CreateGroup",ye).then(nt=>e.MsgCreateGroupResponse.decode(new w.Reader(nt)))}UpdateGroupMembers(ae){let ye=e.MsgUpdateGroupMembers.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","UpdateGroupMembers",ye).then(nt=>e.MsgUpdateGroupMembersResponse.decode(new w.Reader(nt)))}UpdateGroupAdmin(ae){let ye=e.MsgUpdateGroupAdmin.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","UpdateGroupAdmin",ye).then(nt=>e.MsgUpdateGroupAdminResponse.decode(new w.Reader(nt)))}UpdateGroupMetadata(ae){let ye=e.MsgUpdateGroupMetadata.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","UpdateGroupMetadata",ye).then(nt=>e.MsgUpdateGroupMetadataResponse.decode(new w.Reader(nt)))}CreateGroupPolicy(ae){let ye=e.MsgCreateGroupPolicy.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","CreateGroupPolicy",ye).then(nt=>e.MsgCreateGroupPolicyResponse.decode(new w.Reader(nt)))}CreateGroupWithPolicy(ae){let ye=e.MsgCreateGroupWithPolicy.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","CreateGroupWithPolicy",ye).then(nt=>e.MsgCreateGroupWithPolicyResponse.decode(new w.Reader(nt)))}UpdateGroupPolicyAdmin(ae){let ye=e.MsgUpdateGroupPolicyAdmin.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","UpdateGroupPolicyAdmin",ye).then(nt=>e.MsgUpdateGroupPolicyAdminResponse.decode(new w.Reader(nt)))}UpdateGroupPolicyDecisionPolicy(ae){let ye=e.MsgUpdateGroupPolicyDecisionPolicy.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","UpdateGroupPolicyDecisionPolicy",ye).then(nt=>e.MsgUpdateGroupPolicyDecisionPolicyResponse.decode(new w.Reader(nt)))}UpdateGroupPolicyMetadata(ae){let ye=e.MsgUpdateGroupPolicyMetadata.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","UpdateGroupPolicyMetadata",ye).then(nt=>e.MsgUpdateGroupPolicyMetadataResponse.decode(new w.Reader(nt)))}SubmitProposal(ae){let ye=e.MsgSubmitProposal.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","SubmitProposal",ye).then(nt=>e.MsgSubmitProposalResponse.decode(new w.Reader(nt)))}WithdrawProposal(ae){let ye=e.MsgWithdrawProposal.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","WithdrawProposal",ye).then(nt=>e.MsgWithdrawProposalResponse.decode(new w.Reader(nt)))}Vote(ae){let ye=e.MsgVote.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","Vote",ye).then(nt=>e.MsgVoteResponse.decode(new w.Reader(nt)))}Exec(ae){let ye=e.MsgExec.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","Exec",ye).then(nt=>e.MsgExecResponse.decode(new w.Reader(nt)))}LeaveGroup(ae){let ye=e.MsgLeaveGroup.encode(ae).finish();return this.rpc.request("cosmos.group.v1.Msg","LeaveGroup",ye).then(nt=>e.MsgLeaveGroupResponse.decode(new w.Reader(nt)))}}e.MsgClientImpl=D})(k$r);Object.defineProperty(cvt,"__esModule",{value:!0});cvt.groupTypes=void 0;var Yk=k$r;cvt.groupTypes=[["/cosmos.group.v1.MsgCreateGroup",Yk.MsgCreateGroup],["/cosmos.group.v1.MsgCreateGroupPolicy",Yk.MsgCreateGroupPolicy],["/cosmos.group.v1.MsgCreateGroupWithPolicy",Yk.MsgCreateGroupWithPolicy],["/cosmos.group.v1.MsgExec",Yk.MsgExec],["/cosmos.group.v1.MsgLeaveGroup",Yk.MsgLeaveGroup],["/cosmos.group.v1.MsgSubmitProposal",Yk.MsgSubmitProposal],["/cosmos.group.v1.MsgUpdateGroupAdmin",Yk.MsgUpdateGroupAdmin],["/cosmos.group.v1.MsgUpdateGroupMembers",Yk.MsgUpdateGroupMembers],["/cosmos.group.v1.MsgUpdateGroupMetadata",Yk.MsgUpdateGroupMetadata],["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin",Yk.MsgUpdateGroupPolicyAdmin],["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy",Yk.MsgUpdateGroupPolicyDecisionPolicy],["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata",Yk.MsgUpdateGroupPolicyMetadata],["/cosmos.group.v1.MsgVote",Yk.MsgVote],["/cosmos.group.v1.MsgWithdrawProposal",Yk.MsgWithdrawProposal]];var fSe={},uvt={},lW={},R$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(v,ne,Z,R){R===void 0&&(R=Z);var M=Object.getOwnPropertyDescriptor(ne,Z);(!M||("get"in M?!ne.__esModule:M.writable||M.configurable))&&(M={enumerable:!0,get:function(){return ne[Z]}}),Object.defineProperty(v,R,M)}:function(v,ne,Z,R){R===void 0&&(R=Z),v[R]=ne[Z]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(v,ne){Object.defineProperty(v,"default",{enumerable:!0,value:ne})}:function(v,ne){v.default=ne}),c=Fr&&Fr.__importStar||function(v){if(v&&v.__esModule)return v;var ne={};if(v!=null)for(var Z in v)Z!=="default"&&Object.prototype.hasOwnProperty.call(v,Z)&&i(ne,v,Z);return A(ne,v),ne};Object.defineProperty(e,"__esModule",{value:!0}),e.ModuleVersion=e.CancelSoftwareUpgradeProposal=e.SoftwareUpgradeProposal=e.Plan=e.protobufPackage=void 0;let f=k3,l=fh,g=Ns,w=c(BA);e.protobufPackage="cosmos.upgrade.v1beta1";function N(){return{name:"",time:void 0,height:g.Long.ZERO,info:"",upgradedClientState:void 0}}e.Plan={encode(v,ne=w.Writer.create()){return v.name!==""&&ne.uint32(10).string(v.name),v.time!==void 0&&f.Timestamp.encode(v.time,ne.uint32(18).fork()).ldelim(),v.height.isZero()||ne.uint32(24).int64(v.height),v.info!==""&&ne.uint32(34).string(v.info),v.upgradedClientState!==void 0&&l.Any.encode(v.upgradedClientState,ne.uint32(42).fork()).ldelim(),ne},decode(v,ne){let Z=v instanceof w.Reader?v:new w.Reader(v),R=ne===void 0?Z.len:Z.pos+ne,M=N();for(;Z.pos<R;){let U=Z.uint32();switch(U>>>3){case 1:M.name=Z.string();break;case 2:M.time=f.Timestamp.decode(Z,Z.uint32());break;case 3:M.height=Z.int64();break;case 4:M.info=Z.string();break;case 5:M.upgradedClientState=l.Any.decode(Z,Z.uint32());break;default:Z.skipType(U&7);break}}return M},fromJSON(v){return{name:(0,g.isSet)(v.name)?String(v.name):"",time:(0,g.isSet)(v.time)?(0,g.fromJsonTimestamp)(v.time):void 0,height:(0,g.isSet)(v.height)?g.Long.fromValue(v.height):g.Long.ZERO,info:(0,g.isSet)(v.info)?String(v.info):"",upgradedClientState:(0,g.isSet)(v.upgradedClientState)?l.Any.fromJSON(v.upgradedClientState):void 0}},toJSON(v){let ne={};return v.name!==void 0&&(ne.name=v.name),v.time!==void 0&&(ne.time=(0,g.fromTimestamp)(v.time).toISOString()),v.height!==void 0&&(ne.height=(v.height||g.Long.ZERO).toString()),v.info!==void 0&&(ne.info=v.info),v.upgradedClientState!==void 0&&(ne.upgradedClientState=v.upgradedClientState?l.Any.toJSON(v.upgradedClientState):void 0),ne},fromPartial(v){var Z,R;let ne=N();return ne.name=(Z=v.name)!=null?Z:"",ne.time=v.time!==void 0&&v.time!==null?f.Timestamp.fromPartial(v.time):void 0,ne.height=v.height!==void 0&&v.height!==null?g.Long.fromValue(v.height):g.Long.ZERO,ne.info=(R=v.info)!=null?R:"",ne.upgradedClientState=v.upgradedClientState!==void 0&&v.upgradedClientState!==null?l.Any.fromPartial(v.upgradedClientState):void 0,ne}};function F(){return{title:"",description:"",plan:void 0}}e.SoftwareUpgradeProposal={encode(v,ne=w.Writer.create()){return v.title!==""&&ne.uint32(10).string(v.title),v.description!==""&&ne.uint32(18).string(v.description),v.plan!==void 0&&e.Plan.encode(v.plan,ne.uint32(26).fork()).ldelim(),ne},decode(v,ne){let Z=v instanceof w.Reader?v:new w.Reader(v),R=ne===void 0?Z.len:Z.pos+ne,M=F();for(;Z.pos<R;){let U=Z.uint32();switch(U>>>3){case 1:M.title=Z.string();break;case 2:M.description=Z.string();break;case 3:M.plan=e.Plan.decode(Z,Z.uint32());break;default:Z.skipType(U&7);break}}return M},fromJSON(v){return{title:(0,g.isSet)(v.title)?String(v.title):"",description:(0,g.isSet)(v.description)?String(v.description):"",plan:(0,g.isSet)(v.plan)?e.Plan.fromJSON(v.plan):void 0}},toJSON(v){let ne={};return v.title!==void 0&&(ne.title=v.title),v.description!==void 0&&(ne.description=v.description),v.plan!==void 0&&(ne.plan=v.plan?e.Plan.toJSON(v.plan):void 0),ne},fromPartial(v){var Z,R;let ne=F();return ne.title=(Z=v.title)!=null?Z:"",ne.description=(R=v.description)!=null?R:"",ne.plan=v.plan!==void 0&&v.plan!==null?e.Plan.fromPartial(v.plan):void 0,ne}};function j(){return{title:"",description:""}}e.CancelSoftwareUpgradeProposal={encode(v,ne=w.Writer.create()){return v.title!==""&&ne.uint32(10).string(v.title),v.description!==""&&ne.uint32(18).string(v.description),ne},decode(v,ne){let Z=v instanceof w.Reader?v:new w.Reader(v),R=ne===void 0?Z.len:Z.pos+ne,M=j();for(;Z.pos<R;){let U=Z.uint32();switch(U>>>3){case 1:M.title=Z.string();break;case 2:M.description=Z.string();break;default:Z.skipType(U&7);break}}return M},fromJSON(v){return{title:(0,g.isSet)(v.title)?String(v.title):"",description:(0,g.isSet)(v.description)?String(v.description):""}},toJSON(v){let ne={};return v.title!==void 0&&(ne.title=v.title),v.description!==void 0&&(ne.description=v.description),ne},fromPartial(v){var Z,R;let ne=j();return ne.title=(Z=v.title)!=null?Z:"",ne.description=(R=v.description)!=null?R:"",ne}};function te(){return{name:"",version:g.Long.UZERO}}e.ModuleVersion={encode(v,ne=w.Writer.create()){return v.name!==""&&ne.uint32(10).string(v.name),v.version.isZero()||ne.uint32(16).uint64(v.version),ne},decode(v,ne){let Z=v instanceof w.Reader?v:new w.Reader(v),R=ne===void 0?Z.len:Z.pos+ne,M=te();for(;Z.pos<R;){let U=Z.uint32();switch(U>>>3){case 1:M.name=Z.string();break;case 2:M.version=Z.uint64();break;default:Z.skipType(U&7);break}}return M},fromJSON(v){return{name:(0,g.isSet)(v.name)?String(v.name):"",version:(0,g.isSet)(v.version)?g.Long.fromValue(v.version):g.Long.UZERO}},toJSON(v){let ne={};return v.name!==void 0&&(ne.name=v.name),v.version!==void 0&&(ne.version=(v.version||g.Long.UZERO).toString()),ne},fromPartial(v){var Z;let ne=te();return ne.name=(Z=v.name)!=null?Z:"",ne.version=v.version!==void 0&&v.version!==null?g.Long.fromValue(v.version):g.Long.UZERO,ne}}})(R$r);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(R,M,U,E){E===void 0&&(E=U);var Q=Object.getOwnPropertyDescriptor(M,U);(!Q||("get"in Q?!M.__esModule:Q.writable||Q.configurable))&&(Q={enumerable:!0,get:function(){return M[U]}}),Object.defineProperty(R,E,Q)}:function(R,M,U,E){E===void 0&&(E=U),R[E]=M[U]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(R,M){Object.defineProperty(R,"default",{enumerable:!0,value:M})}:function(R,M){R.default=M}),c=Fr&&Fr.__importStar||function(R){if(R&&R.__esModule)return R;var M={};if(R!=null)for(var U in R)U!=="default"&&Object.prototype.hasOwnProperty.call(R,U)&&i(M,R,U);return A(M,R),M};Object.defineProperty(e,"__esModule",{value:!0}),e.Params=e.Height=e.UpgradeProposal=e.ClientUpdateProposal=e.ClientConsensusStates=e.ConsensusStateWithHeight=e.IdentifiedClientState=e.protobufPackage=void 0;let f=fh,l=R$r,g=Ns,w=c(BA);e.protobufPackage="ibc.core.client.v1";function N(){return{clientId:"",clientState:void 0}}e.IdentifiedClientState={encode(R,M=w.Writer.create()){return R.clientId!==""&&M.uint32(10).string(R.clientId),R.clientState!==void 0&&f.Any.encode(R.clientState,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=N();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.clientId=U.string();break;case 2:Q.clientState=f.Any.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{clientId:(0,g.isSet)(R.clientId)?String(R.clientId):"",clientState:(0,g.isSet)(R.clientState)?f.Any.fromJSON(R.clientState):void 0}},toJSON(R){let M={};return R.clientId!==void 0&&(M.clientId=R.clientId),R.clientState!==void 0&&(M.clientState=R.clientState?f.Any.toJSON(R.clientState):void 0),M},fromPartial(R){var U;let M=N();return M.clientId=(U=R.clientId)!=null?U:"",M.clientState=R.clientState!==void 0&&R.clientState!==null?f.Any.fromPartial(R.clientState):void 0,M}};function F(){return{height:void 0,consensusState:void 0}}e.ConsensusStateWithHeight={encode(R,M=w.Writer.create()){return R.height!==void 0&&e.Height.encode(R.height,M.uint32(10).fork()).ldelim(),R.consensusState!==void 0&&f.Any.encode(R.consensusState,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=F();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.height=e.Height.decode(U,U.uint32());break;case 2:Q.consensusState=f.Any.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{height:(0,g.isSet)(R.height)?e.Height.fromJSON(R.height):void 0,consensusState:(0,g.isSet)(R.consensusState)?f.Any.fromJSON(R.consensusState):void 0}},toJSON(R){let M={};return R.height!==void 0&&(M.height=R.height?e.Height.toJSON(R.height):void 0),R.consensusState!==void 0&&(M.consensusState=R.consensusState?f.Any.toJSON(R.consensusState):void 0),M},fromPartial(R){let M=F();return M.height=R.height!==void 0&&R.height!==null?e.Height.fromPartial(R.height):void 0,M.consensusState=R.consensusState!==void 0&&R.consensusState!==null?f.Any.fromPartial(R.consensusState):void 0,M}};function j(){return{clientId:"",consensusStates:[]}}e.ClientConsensusStates={encode(R,M=w.Writer.create()){R.clientId!==""&&M.uint32(10).string(R.clientId);for(let U of R.consensusStates)e.ConsensusStateWithHeight.encode(U,M.uint32(18).fork()).ldelim();return M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=j();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.clientId=U.string();break;case 2:Q.consensusStates.push(e.ConsensusStateWithHeight.decode(U,U.uint32()));break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{clientId:(0,g.isSet)(R.clientId)?String(R.clientId):"",consensusStates:Array.isArray(R==null?void 0:R.consensusStates)?R.consensusStates.map(M=>e.ConsensusStateWithHeight.fromJSON(M)):[]}},toJSON(R){let M={};return R.clientId!==void 0&&(M.clientId=R.clientId),R.consensusStates?M.consensusStates=R.consensusStates.map(U=>U?e.ConsensusStateWithHeight.toJSON(U):void 0):M.consensusStates=[],M},fromPartial(R){var U,E;let M=j();return M.clientId=(U=R.clientId)!=null?U:"",M.consensusStates=((E=R.consensusStates)==null?void 0:E.map(Q=>e.ConsensusStateWithHeight.fromPartial(Q)))||[],M}};function te(){return{title:"",description:"",subjectClientId:"",substituteClientId:""}}e.ClientUpdateProposal={encode(R,M=w.Writer.create()){return R.title!==""&&M.uint32(10).string(R.title),R.description!==""&&M.uint32(18).string(R.description),R.subjectClientId!==""&&M.uint32(26).string(R.subjectClientId),R.substituteClientId!==""&&M.uint32(34).string(R.substituteClientId),M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=te();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.title=U.string();break;case 2:Q.description=U.string();break;case 3:Q.subjectClientId=U.string();break;case 4:Q.substituteClientId=U.string();break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{title:(0,g.isSet)(R.title)?String(R.title):"",description:(0,g.isSet)(R.description)?String(R.description):"",subjectClientId:(0,g.isSet)(R.subjectClientId)?String(R.subjectClientId):"",substituteClientId:(0,g.isSet)(R.substituteClientId)?String(R.substituteClientId):""}},toJSON(R){let M={};return R.title!==void 0&&(M.title=R.title),R.description!==void 0&&(M.description=R.description),R.subjectClientId!==void 0&&(M.subjectClientId=R.subjectClientId),R.substituteClientId!==void 0&&(M.substituteClientId=R.substituteClientId),M},fromPartial(R){var U,E,Q,H;let M=te();return M.title=(U=R.title)!=null?U:"",M.description=(E=R.description)!=null?E:"",M.subjectClientId=(Q=R.subjectClientId)!=null?Q:"",M.substituteClientId=(H=R.substituteClientId)!=null?H:"",M}};function v(){return{title:"",description:"",plan:void 0,upgradedClientState:void 0}}e.UpgradeProposal={encode(R,M=w.Writer.create()){return R.title!==""&&M.uint32(10).string(R.title),R.description!==""&&M.uint32(18).string(R.description),R.plan!==void 0&&l.Plan.encode(R.plan,M.uint32(26).fork()).ldelim(),R.upgradedClientState!==void 0&&f.Any.encode(R.upgradedClientState,M.uint32(34).fork()).ldelim(),M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=v();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.title=U.string();break;case 2:Q.description=U.string();break;case 3:Q.plan=l.Plan.decode(U,U.uint32());break;case 4:Q.upgradedClientState=f.Any.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{title:(0,g.isSet)(R.title)?String(R.title):"",description:(0,g.isSet)(R.description)?String(R.description):"",plan:(0,g.isSet)(R.plan)?l.Plan.fromJSON(R.plan):void 0,upgradedClientState:(0,g.isSet)(R.upgradedClientState)?f.Any.fromJSON(R.upgradedClientState):void 0}},toJSON(R){let M={};return R.title!==void 0&&(M.title=R.title),R.description!==void 0&&(M.description=R.description),R.plan!==void 0&&(M.plan=R.plan?l.Plan.toJSON(R.plan):void 0),R.upgradedClientState!==void 0&&(M.upgradedClientState=R.upgradedClientState?f.Any.toJSON(R.upgradedClientState):void 0),M},fromPartial(R){var U,E;let M=v();return M.title=(U=R.title)!=null?U:"",M.description=(E=R.description)!=null?E:"",M.plan=R.plan!==void 0&&R.plan!==null?l.Plan.fromPartial(R.plan):void 0,M.upgradedClientState=R.upgradedClientState!==void 0&&R.upgradedClientState!==null?f.Any.fromPartial(R.upgradedClientState):void 0,M}};function ne(){return{revisionNumber:g.Long.UZERO,revisionHeight:g.Long.UZERO}}e.Height={encode(R,M=w.Writer.create()){return R.revisionNumber.isZero()||M.uint32(8).uint64(R.revisionNumber),R.revisionHeight.isZero()||M.uint32(16).uint64(R.revisionHeight),M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=ne();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.revisionNumber=U.uint64();break;case 2:Q.revisionHeight=U.uint64();break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{revisionNumber:(0,g.isSet)(R.revisionNumber)?g.Long.fromValue(R.revisionNumber):g.Long.UZERO,revisionHeight:(0,g.isSet)(R.revisionHeight)?g.Long.fromValue(R.revisionHeight):g.Long.UZERO}},toJSON(R){let M={};return R.revisionNumber!==void 0&&(M.revisionNumber=(R.revisionNumber||g.Long.UZERO).toString()),R.revisionHeight!==void 0&&(M.revisionHeight=(R.revisionHeight||g.Long.UZERO).toString()),M},fromPartial(R){let M=ne();return M.revisionNumber=R.revisionNumber!==void 0&&R.revisionNumber!==null?g.Long.fromValue(R.revisionNumber):g.Long.UZERO,M.revisionHeight=R.revisionHeight!==void 0&&R.revisionHeight!==null?g.Long.fromValue(R.revisionHeight):g.Long.UZERO,M}};function Z(){return{allowedClients:[]}}e.Params={encode(R,M=w.Writer.create()){for(let U of R.allowedClients)M.uint32(10).string(U);return M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=Z();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.allowedClients.push(U.string());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{allowedClients:Array.isArray(R==null?void 0:R.allowedClients)?R.allowedClients.map(M=>String(M)):[]}},toJSON(R){let M={};return R.allowedClients?M.allowedClients=R.allowedClients.map(U=>U):M.allowedClients=[],M},fromPartial(R){var U;let M=Z();return M.allowedClients=((U=R.allowedClients)==null?void 0:U.map(E=>E))||[],M}}})(lW);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(te,v,ne,Z){Z===void 0&&(Z=ne);var R=Object.getOwnPropertyDescriptor(v,ne);(!R||("get"in R?!v.__esModule:R.writable||R.configurable))&&(R={enumerable:!0,get:function(){return v[ne]}}),Object.defineProperty(te,Z,R)}:function(te,v,ne,Z){Z===void 0&&(Z=ne),te[Z]=v[ne]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(te,v){Object.defineProperty(te,"default",{enumerable:!0,value:v})}:function(te,v){te.default=v}),c=Fr&&Fr.__importStar||function(te){if(te&&te.__esModule)return te;var v={};if(te!=null)for(var ne in te)ne!=="default"&&Object.prototype.hasOwnProperty.call(te,ne)&&i(v,te,ne);return A(v,te),v};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgTransferResponse=e.MsgTransfer=e.protobufPackage=void 0;let f=gg,l=lW,g=Ns,w=c(BA);e.protobufPackage="ibc.applications.transfer.v1";function N(){return{sourcePort:"",sourceChannel:"",token:void 0,sender:"",receiver:"",timeoutHeight:void 0,timeoutTimestamp:g.Long.UZERO,memo:""}}e.MsgTransfer={encode(te,v=w.Writer.create()){return te.sourcePort!==""&&v.uint32(10).string(te.sourcePort),te.sourceChannel!==""&&v.uint32(18).string(te.sourceChannel),te.token!==void 0&&f.Coin.encode(te.token,v.uint32(26).fork()).ldelim(),te.sender!==""&&v.uint32(34).string(te.sender),te.receiver!==""&&v.uint32(42).string(te.receiver),te.timeoutHeight!==void 0&&l.Height.encode(te.timeoutHeight,v.uint32(50).fork()).ldelim(),te.timeoutTimestamp.isZero()||v.uint32(56).uint64(te.timeoutTimestamp),te.memo!==""&&v.uint32(66).string(te.memo),v},decode(te,v){let ne=te instanceof w.Reader?te:new w.Reader(te),Z=v===void 0?ne.len:ne.pos+v,R=N();for(;ne.pos<Z;){let M=ne.uint32();switch(M>>>3){case 1:R.sourcePort=ne.string();break;case 2:R.sourceChannel=ne.string();break;case 3:R.token=f.Coin.decode(ne,ne.uint32());break;case 4:R.sender=ne.string();break;case 5:R.receiver=ne.string();break;case 6:R.timeoutHeight=l.Height.decode(ne,ne.uint32());break;case 7:R.timeoutTimestamp=ne.uint64();break;case 8:R.memo=ne.string();break;default:ne.skipType(M&7);break}}return R},fromJSON(te){return{sourcePort:(0,g.isSet)(te.sourcePort)?String(te.sourcePort):"",sourceChannel:(0,g.isSet)(te.sourceChannel)?String(te.sourceChannel):"",token:(0,g.isSet)(te.token)?f.Coin.fromJSON(te.token):void 0,sender:(0,g.isSet)(te.sender)?String(te.sender):"",receiver:(0,g.isSet)(te.receiver)?String(te.receiver):"",timeoutHeight:(0,g.isSet)(te.timeoutHeight)?l.Height.fromJSON(te.timeoutHeight):void 0,timeoutTimestamp:(0,g.isSet)(te.timeoutTimestamp)?g.Long.fromValue(te.timeoutTimestamp):g.Long.UZERO,memo:(0,g.isSet)(te.memo)?String(te.memo):""}},toJSON(te){let v={};return te.sourcePort!==void 0&&(v.sourcePort=te.sourcePort),te.sourceChannel!==void 0&&(v.sourceChannel=te.sourceChannel),te.token!==void 0&&(v.token=te.token?f.Coin.toJSON(te.token):void 0),te.sender!==void 0&&(v.sender=te.sender),te.receiver!==void 0&&(v.receiver=te.receiver),te.timeoutHeight!==void 0&&(v.timeoutHeight=te.timeoutHeight?l.Height.toJSON(te.timeoutHeight):void 0),te.timeoutTimestamp!==void 0&&(v.timeoutTimestamp=(te.timeoutTimestamp||g.Long.UZERO).toString()),te.memo!==void 0&&(v.memo=te.memo),v},fromPartial(te){var ne,Z,R,M,U;let v=N();return v.sourcePort=(ne=te.sourcePort)!=null?ne:"",v.sourceChannel=(Z=te.sourceChannel)!=null?Z:"",v.token=te.token!==void 0&&te.token!==null?f.Coin.fromPartial(te.token):void 0,v.sender=(R=te.sender)!=null?R:"",v.receiver=(M=te.receiver)!=null?M:"",v.timeoutHeight=te.timeoutHeight!==void 0&&te.timeoutHeight!==null?l.Height.fromPartial(te.timeoutHeight):void 0,v.timeoutTimestamp=te.timeoutTimestamp!==void 0&&te.timeoutTimestamp!==null?g.Long.fromValue(te.timeoutTimestamp):g.Long.UZERO,v.memo=(U=te.memo)!=null?U:"",v}};function F(){return{sequence:g.Long.UZERO}}e.MsgTransferResponse={encode(te,v=w.Writer.create()){return te.sequence.isZero()||v.uint32(8).uint64(te.sequence),v},decode(te,v){let ne=te instanceof w.Reader?te:new w.Reader(te),Z=v===void 0?ne.len:ne.pos+v,R=F();for(;ne.pos<Z;){let M=ne.uint32();switch(M>>>3){case 1:R.sequence=ne.uint64();break;default:ne.skipType(M&7);break}}return R},fromJSON(te){return{sequence:(0,g.isSet)(te.sequence)?g.Long.fromValue(te.sequence):g.Long.UZERO}},toJSON(te){let v={};return te.sequence!==void 0&&(v.sequence=(te.sequence||g.Long.UZERO).toString()),v},fromPartial(te){let v=F();return v.sequence=te.sequence!==void 0&&te.sequence!==null?g.Long.fromValue(te.sequence):g.Long.UZERO,v}};class j{constructor(v){this.rpc=v,this.Transfer=this.Transfer.bind(this)}Transfer(v){let ne=e.MsgTransfer.encode(v).finish();return this.rpc.request("ibc.applications.transfer.v1.Msg","Transfer",ne).then(R=>e.MsgTransferResponse.decode(new w.Reader(R)))}}e.MsgClientImpl=j})(uvt);var m8s=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fSe,"__esModule",{value:!0});fSe.createIbcAminoConverters=fSe.isAminoMsgTransfer=void 0;var I8s=uvt,r_t=m8s(qM);function C8s(e){return e.type==="cosmos-sdk/MsgTransfer"}fSe.isAminoMsgTransfer=C8s;function P2n(e){if(typeof e=="string")return e===""?void 0:e;if(typeof e=="number")return e===0?void 0:e;if(r_t.default.isLong(e))return e.isZero()?void 0:e;throw new Error(`Got unsupported type '${typeof e}'`)}function _8s(){return{"/ibc.applications.transfer.v1.MsgTransfer":{aminoType:"cosmos-sdk/MsgTransfer",toAmino:({sourcePort:e,sourceChannel:i,token:A,sender:c,receiver:f,timeoutHeight:l,timeoutTimestamp:g})=>{var w,N,F;return{source_port:e,source_channel:i,token:A,sender:c,receiver:f,timeout_height:l?{revision_height:(w=P2n(l.revisionHeight))==null?void 0:w.toString(),revision_number:(N=P2n(l.revisionNumber))==null?void 0:N.toString()}:{},timeout_timestamp:(F=P2n(g))==null?void 0:F.toString()}},fromAmino:({source_port:e,source_channel:i,token:A,sender:c,receiver:f,timeout_height:l,timeout_timestamp:g})=>I8s.MsgTransfer.fromPartial({sourcePort:e,sourceChannel:i,token:A,sender:c,receiver:f,timeoutHeight:l?{revisionHeight:r_t.default.fromString(l.revision_height||"0",!0),revisionNumber:r_t.default.fromString(l.revision_number||"0",!0)}:void 0,timeoutTimestamp:r_t.default.fromString(g||"0",!0)})}}}fSe.createIbcAminoConverters=_8s;var lSe={},P$r={},fvt={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(H,re,ee,T){T===void 0&&(T=ee);var se=Object.getOwnPropertyDescriptor(re,ee);(!se||("get"in se?!re.__esModule:se.writable||se.configurable))&&(se={enumerable:!0,get:function(){return re[ee]}}),Object.defineProperty(H,T,se)}:function(H,re,ee,T){T===void 0&&(T=ee),H[T]=re[ee]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(H,re){Object.defineProperty(H,"default",{enumerable:!0,value:re})}:function(H,re){H.default=re}),c=Fr&&Fr.__importStar||function(H){if(H&&H.__esModule)return H;var re={};if(H!=null)for(var ee in H)ee!=="default"&&Object.prototype.hasOwnProperty.call(H,ee)&&i(re,H,ee);return A(re,H),re};Object.defineProperty(e,"__esModule",{value:!0}),e.Acknowledgement=e.PacketId=e.PacketState=e.Packet=e.Counterparty=e.IdentifiedChannel=e.Channel=e.orderToJSON=e.orderFromJSON=e.Order=e.stateToJSON=e.stateFromJSON=e.State=e.protobufPackage=void 0;let f=lW,l=Ns,g=c(BA);e.protobufPackage="ibc.core.channel.v1";var w;(function(H){H[H.STATE_UNINITIALIZED_UNSPECIFIED=0]="STATE_UNINITIALIZED_UNSPECIFIED",H[H.STATE_INIT=1]="STATE_INIT",H[H.STATE_TRYOPEN=2]="STATE_TRYOPEN",H[H.STATE_OPEN=3]="STATE_OPEN",H[H.STATE_CLOSED=4]="STATE_CLOSED",H[H.UNRECOGNIZED=-1]="UNRECOGNIZED"})(w=e.State||(e.State={}));function N(H){switch(H){case 0:case"STATE_UNINITIALIZED_UNSPECIFIED":return w.STATE_UNINITIALIZED_UNSPECIFIED;case 1:case"STATE_INIT":return w.STATE_INIT;case 2:case"STATE_TRYOPEN":return w.STATE_TRYOPEN;case 3:case"STATE_OPEN":return w.STATE_OPEN;case 4:case"STATE_CLOSED":return w.STATE_CLOSED;case-1:case"UNRECOGNIZED":default:return w.UNRECOGNIZED}}e.stateFromJSON=N;function F(H){switch(H){case w.STATE_UNINITIALIZED_UNSPECIFIED:return"STATE_UNINITIALIZED_UNSPECIFIED";case w.STATE_INIT:return"STATE_INIT";case w.STATE_TRYOPEN:return"STATE_TRYOPEN";case w.STATE_OPEN:return"STATE_OPEN";case w.STATE_CLOSED:return"STATE_CLOSED";case w.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.stateToJSON=F;var j;(function(H){H[H.ORDER_NONE_UNSPECIFIED=0]="ORDER_NONE_UNSPECIFIED",H[H.ORDER_UNORDERED=1]="ORDER_UNORDERED",H[H.ORDER_ORDERED=2]="ORDER_ORDERED",H[H.UNRECOGNIZED=-1]="UNRECOGNIZED"})(j=e.Order||(e.Order={}));function te(H){switch(H){case 0:case"ORDER_NONE_UNSPECIFIED":return j.ORDER_NONE_UNSPECIFIED;case 1:case"ORDER_UNORDERED":return j.ORDER_UNORDERED;case 2:case"ORDER_ORDERED":return j.ORDER_ORDERED;case-1:case"UNRECOGNIZED":default:return j.UNRECOGNIZED}}e.orderFromJSON=te;function v(H){switch(H){case j.ORDER_NONE_UNSPECIFIED:return"ORDER_NONE_UNSPECIFIED";case j.ORDER_UNORDERED:return"ORDER_UNORDERED";case j.ORDER_ORDERED:return"ORDER_ORDERED";case j.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.orderToJSON=v;function ne(){return{state:0,ordering:0,counterparty:void 0,connectionHops:[],version:""}}e.Channel={encode(H,re=g.Writer.create()){H.state!==0&&re.uint32(8).int32(H.state),H.ordering!==0&&re.uint32(16).int32(H.ordering),H.counterparty!==void 0&&e.Counterparty.encode(H.counterparty,re.uint32(26).fork()).ldelim();for(let ee of H.connectionHops)re.uint32(34).string(ee);return H.version!==""&&re.uint32(42).string(H.version),re},decode(H,re){let ee=H instanceof g.Reader?H:new g.Reader(H),T=re===void 0?ee.len:ee.pos+re,se=ne();for(;ee.pos<T;){let p=ee.uint32();switch(p>>>3){case 1:se.state=ee.int32();break;case 2:se.ordering=ee.int32();break;case 3:se.counterparty=e.Counterparty.decode(ee,ee.uint32());break;case 4:se.connectionHops.push(ee.string());break;case 5:se.version=ee.string();break;default:ee.skipType(p&7);break}}return se},fromJSON(H){return{state:(0,l.isSet)(H.state)?N(H.state):0,ordering:(0,l.isSet)(H.ordering)?te(H.ordering):0,counterparty:(0,l.isSet)(H.counterparty)?e.Counterparty.fromJSON(H.counterparty):void 0,connectionHops:Array.isArray(H==null?void 0:H.connectionHops)?H.connectionHops.map(re=>String(re)):[],version:(0,l.isSet)(H.version)?String(H.version):""}},toJSON(H){let re={};return H.state!==void 0&&(re.state=F(H.state)),H.ordering!==void 0&&(re.ordering=v(H.ordering)),H.counterparty!==void 0&&(re.counterparty=H.counterparty?e.Counterparty.toJSON(H.counterparty):void 0),H.connectionHops?re.connectionHops=H.connectionHops.map(ee=>ee):re.connectionHops=[],H.version!==void 0&&(re.version=H.version),re},fromPartial(H){var ee,T,se,p;let re=ne();return re.state=(ee=H.state)!=null?ee:0,re.ordering=(T=H.ordering)!=null?T:0,re.counterparty=H.counterparty!==void 0&&H.counterparty!==null?e.Counterparty.fromPartial(H.counterparty):void 0,re.connectionHops=((se=H.connectionHops)==null?void 0:se.map(L=>L))||[],re.version=(p=H.version)!=null?p:"",re}};function Z(){return{state:0,ordering:0,counterparty:void 0,connectionHops:[],version:"",portId:"",channelId:""}}e.IdentifiedChannel={encode(H,re=g.Writer.create()){H.state!==0&&re.uint32(8).int32(H.state),H.ordering!==0&&re.uint32(16).int32(H.ordering),H.counterparty!==void 0&&e.Counterparty.encode(H.counterparty,re.uint32(26).fork()).ldelim();for(let ee of H.connectionHops)re.uint32(34).string(ee);return H.version!==""&&re.uint32(42).string(H.version),H.portId!==""&&re.uint32(50).string(H.portId),H.channelId!==""&&re.uint32(58).string(H.channelId),re},decode(H,re){let ee=H instanceof g.Reader?H:new g.Reader(H),T=re===void 0?ee.len:ee.pos+re,se=Z();for(;ee.pos<T;){let p=ee.uint32();switch(p>>>3){case 1:se.state=ee.int32();break;case 2:se.ordering=ee.int32();break;case 3:se.counterparty=e.Counterparty.decode(ee,ee.uint32());break;case 4:se.connectionHops.push(ee.string());break;case 5:se.version=ee.string();break;case 6:se.portId=ee.string();break;case 7:se.channelId=ee.string();break;default:ee.skipType(p&7);break}}return se},fromJSON(H){return{state:(0,l.isSet)(H.state)?N(H.state):0,ordering:(0,l.isSet)(H.ordering)?te(H.ordering):0,counterparty:(0,l.isSet)(H.counterparty)?e.Counterparty.fromJSON(H.counterparty):void 0,connectionHops:Array.isArray(H==null?void 0:H.connectionHops)?H.connectionHops.map(re=>String(re)):[],version:(0,l.isSet)(H.version)?String(H.version):"",portId:(0,l.isSet)(H.portId)?String(H.portId):"",channelId:(0,l.isSet)(H.channelId)?String(H.channelId):""}},toJSON(H){let re={};return H.state!==void 0&&(re.state=F(H.state)),H.ordering!==void 0&&(re.ordering=v(H.ordering)),H.counterparty!==void 0&&(re.counterparty=H.counterparty?e.Counterparty.toJSON(H.counterparty):void 0),H.connectionHops?re.connectionHops=H.connectionHops.map(ee=>ee):re.connectionHops=[],H.version!==void 0&&(re.version=H.version),H.portId!==void 0&&(re.portId=H.portId),H.channelId!==void 0&&(re.channelId=H.channelId),re},fromPartial(H){var ee,T,se,p,L,V;let re=Z();return re.state=(ee=H.state)!=null?ee:0,re.ordering=(T=H.ordering)!=null?T:0,re.counterparty=H.counterparty!==void 0&&H.counterparty!==null?e.Counterparty.fromPartial(H.counterparty):void 0,re.connectionHops=((se=H.connectionHops)==null?void 0:se.map(K=>K))||[],re.version=(p=H.version)!=null?p:"",re.portId=(L=H.portId)!=null?L:"",re.channelId=(V=H.channelId)!=null?V:"",re}};function R(){return{portId:"",channelId:""}}e.Counterparty={encode(H,re=g.Writer.create()){return H.portId!==""&&re.uint32(10).string(H.portId),H.channelId!==""&&re.uint32(18).string(H.channelId),re},decode(H,re){let ee=H instanceof g.Reader?H:new g.Reader(H),T=re===void 0?ee.len:ee.pos+re,se=R();for(;ee.pos<T;){let p=ee.uint32();switch(p>>>3){case 1:se.portId=ee.string();break;case 2:se.channelId=ee.string();break;default:ee.skipType(p&7);break}}return se},fromJSON(H){return{portId:(0,l.isSet)(H.portId)?String(H.portId):"",channelId:(0,l.isSet)(H.channelId)?String(H.channelId):""}},toJSON(H){let re={};return H.portId!==void 0&&(re.portId=H.portId),H.channelId!==void 0&&(re.channelId=H.channelId),re},fromPartial(H){var ee,T;let re=R();return re.portId=(ee=H.portId)!=null?ee:"",re.channelId=(T=H.channelId)!=null?T:"",re}};function M(){return{sequence:l.Long.UZERO,sourcePort:"",sourceChannel:"",destinationPort:"",destinationChannel:"",data:new Uint8Array,timeoutHeight:void 0,timeoutTimestamp:l.Long.UZERO}}e.Packet={encode(H,re=g.Writer.create()){return H.sequence.isZero()||re.uint32(8).uint64(H.sequence),H.sourcePort!==""&&re.uint32(18).string(H.sourcePort),H.sourceChannel!==""&&re.uint32(26).string(H.sourceChannel),H.destinationPort!==""&&re.uint32(34).string(H.destinationPort),H.destinationChannel!==""&&re.uint32(42).string(H.destinationChannel),H.data.length!==0&&re.uint32(50).bytes(H.data),H.timeoutHeight!==void 0&&f.Height.encode(H.timeoutHeight,re.uint32(58).fork()).ldelim(),H.timeoutTimestamp.isZero()||re.uint32(64).uint64(H.timeoutTimestamp),re},decode(H,re){let ee=H instanceof g.Reader?H:new g.Reader(H),T=re===void 0?ee.len:ee.pos+re,se=M();for(;ee.pos<T;){let p=ee.uint32();switch(p>>>3){case 1:se.sequence=ee.uint64();break;case 2:se.sourcePort=ee.string();break;case 3:se.sourceChannel=ee.string();break;case 4:se.destinationPort=ee.string();break;case 5:se.destinationChannel=ee.string();break;case 6:se.data=ee.bytes();break;case 7:se.timeoutHeight=f.Height.decode(ee,ee.uint32());break;case 8:se.timeoutTimestamp=ee.uint64();break;default:ee.skipType(p&7);break}}return se},fromJSON(H){return{sequence:(0,l.isSet)(H.sequence)?l.Long.fromValue(H.sequence):l.Long.UZERO,sourcePort:(0,l.isSet)(H.sourcePort)?String(H.sourcePort):"",sourceChannel:(0,l.isSet)(H.sourceChannel)?String(H.sourceChannel):"",destinationPort:(0,l.isSet)(H.destinationPort)?String(H.destinationPort):"",destinationChannel:(0,l.isSet)(H.destinationChannel)?String(H.destinationChannel):"",data:(0,l.isSet)(H.data)?(0,l.bytesFromBase64)(H.data):new Uint8Array,timeoutHeight:(0,l.isSet)(H.timeoutHeight)?f.Height.fromJSON(H.timeoutHeight):void 0,timeoutTimestamp:(0,l.isSet)(H.timeoutTimestamp)?l.Long.fromValue(H.timeoutTimestamp):l.Long.UZERO}},toJSON(H){let re={};return H.sequence!==void 0&&(re.sequence=(H.sequence||l.Long.UZERO).toString()),H.sourcePort!==void 0&&(re.sourcePort=H.sourcePort),H.sourceChannel!==void 0&&(re.sourceChannel=H.sourceChannel),H.destinationPort!==void 0&&(re.destinationPort=H.destinationPort),H.destinationChannel!==void 0&&(re.destinationChannel=H.destinationChannel),H.data!==void 0&&(re.data=(0,l.base64FromBytes)(H.data!==void 0?H.data:new Uint8Array)),H.timeoutHeight!==void 0&&(re.timeoutHeight=H.timeoutHeight?f.Height.toJSON(H.timeoutHeight):void 0),H.timeoutTimestamp!==void 0&&(re.timeoutTimestamp=(H.timeoutTimestamp||l.Long.UZERO).toString()),re},fromPartial(H){var ee,T,se,p,L;let re=M();return re.sequence=H.sequence!==void 0&&H.sequence!==null?l.Long.fromValue(H.sequence):l.Long.UZERO,re.sourcePort=(ee=H.sourcePort)!=null?ee:"",re.sourceChannel=(T=H.sourceChannel)!=null?T:"",re.destinationPort=(se=H.destinationPort)!=null?se:"",re.destinationChannel=(p=H.destinationChannel)!=null?p:"",re.data=(L=H.data)!=null?L:new Uint8Array,re.timeoutHeight=H.timeoutHeight!==void 0&&H.timeoutHeight!==null?f.Height.fromPartial(H.timeoutHeight):void 0,re.timeoutTimestamp=H.timeoutTimestamp!==void 0&&H.timeoutTimestamp!==null?l.Long.fromValue(H.timeoutTimestamp):l.Long.UZERO,re}};function U(){return{portId:"",channelId:"",sequence:l.Long.UZERO,data:new Uint8Array}}e.PacketState={encode(H,re=g.Writer.create()){return H.portId!==""&&re.uint32(10).string(H.portId),H.channelId!==""&&re.uint32(18).string(H.channelId),H.sequence.isZero()||re.uint32(24).uint64(H.sequence),H.data.length!==0&&re.uint32(34).bytes(H.data),re},decode(H,re){let ee=H instanceof g.Reader?H:new g.Reader(H),T=re===void 0?ee.len:ee.pos+re,se=U();for(;ee.pos<T;){let p=ee.uint32();switch(p>>>3){case 1:se.portId=ee.string();break;case 2:se.channelId=ee.string();break;case 3:se.sequence=ee.uint64();break;case 4:se.data=ee.bytes();break;default:ee.skipType(p&7);break}}return se},fromJSON(H){return{portId:(0,l.isSet)(H.portId)?String(H.portId):"",channelId:(0,l.isSet)(H.channelId)?String(H.channelId):"",sequence:(0,l.isSet)(H.sequence)?l.Long.fromValue(H.sequence):l.Long.UZERO,data:(0,l.isSet)(H.data)?(0,l.bytesFromBase64)(H.data):new Uint8Array}},toJSON(H){let re={};return H.portId!==void 0&&(re.portId=H.portId),H.channelId!==void 0&&(re.channelId=H.channelId),H.sequence!==void 0&&(re.sequence=(H.sequence||l.Long.UZERO).toString()),H.data!==void 0&&(re.data=(0,l.base64FromBytes)(H.data!==void 0?H.data:new Uint8Array)),re},fromPartial(H){var ee,T,se;let re=U();return re.portId=(ee=H.portId)!=null?ee:"",re.channelId=(T=H.channelId)!=null?T:"",re.sequence=H.sequence!==void 0&&H.sequence!==null?l.Long.fromValue(H.sequence):l.Long.UZERO,re.data=(se=H.data)!=null?se:new Uint8Array,re}};function E(){return{portId:"",channelId:"",sequence:l.Long.UZERO}}e.PacketId={encode(H,re=g.Writer.create()){return H.portId!==""&&re.uint32(10).string(H.portId),H.channelId!==""&&re.uint32(18).string(H.channelId),H.sequence.isZero()||re.uint32(24).uint64(H.sequence),re},decode(H,re){let ee=H instanceof g.Reader?H:new g.Reader(H),T=re===void 0?ee.len:ee.pos+re,se=E();for(;ee.pos<T;){let p=ee.uint32();switch(p>>>3){case 1:se.portId=ee.string();break;case 2:se.channelId=ee.string();break;case 3:se.sequence=ee.uint64();break;default:ee.skipType(p&7);break}}return se},fromJSON(H){return{portId:(0,l.isSet)(H.portId)?String(H.portId):"",channelId:(0,l.isSet)(H.channelId)?String(H.channelId):"",sequence:(0,l.isSet)(H.sequence)?l.Long.fromValue(H.sequence):l.Long.UZERO}},toJSON(H){let re={};return H.portId!==void 0&&(re.portId=H.portId),H.channelId!==void 0&&(re.channelId=H.channelId),H.sequence!==void 0&&(re.sequence=(H.sequence||l.Long.UZERO).toString()),re},fromPartial(H){var ee,T;let re=E();return re.portId=(ee=H.portId)!=null?ee:"",re.channelId=(T=H.channelId)!=null?T:"",re.sequence=H.sequence!==void 0&&H.sequence!==null?l.Long.fromValue(H.sequence):l.Long.UZERO,re}};function Q(){return{result:void 0,error:void 0}}e.Acknowledgement={encode(H,re=g.Writer.create()){return H.result!==void 0&&re.uint32(170).bytes(H.result),H.error!==void 0&&re.uint32(178).string(H.error),re},decode(H,re){let ee=H instanceof g.Reader?H:new g.Reader(H),T=re===void 0?ee.len:ee.pos+re,se=Q();for(;ee.pos<T;){let p=ee.uint32();switch(p>>>3){case 21:se.result=ee.bytes();break;case 22:se.error=ee.string();break;default:ee.skipType(p&7);break}}return se},fromJSON(H){return{result:(0,l.isSet)(H.result)?(0,l.bytesFromBase64)(H.result):void 0,error:(0,l.isSet)(H.error)?String(H.error):void 0}},toJSON(H){let re={};return H.result!==void 0&&(re.result=H.result!==void 0?(0,l.base64FromBytes)(H.result):void 0),H.error!==void 0&&(re.error=H.error),re},fromPartial(H){var ee,T;let re=Q();return re.result=(ee=H.result)!=null?ee:void 0,re.error=(T=H.error)!=null?T:void 0,re}}})(fvt);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(b,O,J,ie){ie===void 0&&(ie=J);var G=Object.getOwnPropertyDescriptor(O,J);(!G||("get"in G?!O.__esModule:G.writable||G.configurable))&&(G={enumerable:!0,get:function(){return O[J]}}),Object.defineProperty(b,ie,G)}:function(b,O,J,ie){ie===void 0&&(ie=J),b[ie]=O[J]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(b,O){Object.defineProperty(b,"default",{enumerable:!0,value:O})}:function(b,O){b.default=O}),c=Fr&&Fr.__importStar||function(b){if(b&&b.__esModule)return b;var O={};if(b!=null)for(var J in b)J!=="default"&&Object.prototype.hasOwnProperty.call(b,J)&&i(O,b,J);return A(O,b),O};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgAcknowledgementResponse=e.MsgAcknowledgement=e.MsgTimeoutOnCloseResponse=e.MsgTimeoutOnClose=e.MsgTimeoutResponse=e.MsgTimeout=e.MsgRecvPacketResponse=e.MsgRecvPacket=e.MsgChannelCloseConfirmResponse=e.MsgChannelCloseConfirm=e.MsgChannelCloseInitResponse=e.MsgChannelCloseInit=e.MsgChannelOpenConfirmResponse=e.MsgChannelOpenConfirm=e.MsgChannelOpenAckResponse=e.MsgChannelOpenAck=e.MsgChannelOpenTryResponse=e.MsgChannelOpenTry=e.MsgChannelOpenInitResponse=e.MsgChannelOpenInit=e.responseResultTypeToJSON=e.responseResultTypeFromJSON=e.ResponseResultType=e.protobufPackage=void 0;let f=fvt,l=lW,g=Ns,w=c(BA);e.protobufPackage="ibc.core.channel.v1";var N;(function(b){b[b.RESPONSE_RESULT_TYPE_UNSPECIFIED=0]="RESPONSE_RESULT_TYPE_UNSPECIFIED",b[b.RESPONSE_RESULT_TYPE_NOOP=1]="RESPONSE_RESULT_TYPE_NOOP",b[b.RESPONSE_RESULT_TYPE_SUCCESS=2]="RESPONSE_RESULT_TYPE_SUCCESS",b[b.UNRECOGNIZED=-1]="UNRECOGNIZED"})(N=e.ResponseResultType||(e.ResponseResultType={}));function F(b){switch(b){case 0:case"RESPONSE_RESULT_TYPE_UNSPECIFIED":return N.RESPONSE_RESULT_TYPE_UNSPECIFIED;case 1:case"RESPONSE_RESULT_TYPE_NOOP":return N.RESPONSE_RESULT_TYPE_NOOP;case 2:case"RESPONSE_RESULT_TYPE_SUCCESS":return N.RESPONSE_RESULT_TYPE_SUCCESS;case-1:case"UNRECOGNIZED":default:return N.UNRECOGNIZED}}e.responseResultTypeFromJSON=F;function j(b){switch(b){case N.RESPONSE_RESULT_TYPE_UNSPECIFIED:return"RESPONSE_RESULT_TYPE_UNSPECIFIED";case N.RESPONSE_RESULT_TYPE_NOOP:return"RESPONSE_RESULT_TYPE_NOOP";case N.RESPONSE_RESULT_TYPE_SUCCESS:return"RESPONSE_RESULT_TYPE_SUCCESS";case N.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.responseResultTypeToJSON=j;function te(){return{portId:"",channel:void 0,signer:""}}e.MsgChannelOpenInit={encode(b,O=w.Writer.create()){return b.portId!==""&&O.uint32(10).string(b.portId),b.channel!==void 0&&f.Channel.encode(b.channel,O.uint32(18).fork()).ldelim(),b.signer!==""&&O.uint32(26).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=te();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.portId=J.string();break;case 2:G.channel=f.Channel.decode(J,J.uint32());break;case 3:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{portId:(0,g.isSet)(b.portId)?String(b.portId):"",channel:(0,g.isSet)(b.channel)?f.Channel.fromJSON(b.channel):void 0,signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.portId!==void 0&&(O.portId=b.portId),b.channel!==void 0&&(O.channel=b.channel?f.Channel.toJSON(b.channel):void 0),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie;let O=te();return O.portId=(J=b.portId)!=null?J:"",O.channel=b.channel!==void 0&&b.channel!==null?f.Channel.fromPartial(b.channel):void 0,O.signer=(ie=b.signer)!=null?ie:"",O}};function v(){return{channelId:"",version:""}}e.MsgChannelOpenInitResponse={encode(b,O=w.Writer.create()){return b.channelId!==""&&O.uint32(10).string(b.channelId),b.version!==""&&O.uint32(18).string(b.version),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=v();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.channelId=J.string();break;case 2:G.version=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{channelId:(0,g.isSet)(b.channelId)?String(b.channelId):"",version:(0,g.isSet)(b.version)?String(b.version):""}},toJSON(b){let O={};return b.channelId!==void 0&&(O.channelId=b.channelId),b.version!==void 0&&(O.version=b.version),O},fromPartial(b){var J,ie;let O=v();return O.channelId=(J=b.channelId)!=null?J:"",O.version=(ie=b.version)!=null?ie:"",O}};function ne(){return{portId:"",previousChannelId:"",channel:void 0,counterpartyVersion:"",proofInit:new Uint8Array,proofHeight:void 0,signer:""}}e.MsgChannelOpenTry={encode(b,O=w.Writer.create()){return b.portId!==""&&O.uint32(10).string(b.portId),b.previousChannelId!==""&&O.uint32(18).string(b.previousChannelId),b.channel!==void 0&&f.Channel.encode(b.channel,O.uint32(26).fork()).ldelim(),b.counterpartyVersion!==""&&O.uint32(34).string(b.counterpartyVersion),b.proofInit.length!==0&&O.uint32(42).bytes(b.proofInit),b.proofHeight!==void 0&&l.Height.encode(b.proofHeight,O.uint32(50).fork()).ldelim(),b.signer!==""&&O.uint32(58).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=ne();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.portId=J.string();break;case 2:G.previousChannelId=J.string();break;case 3:G.channel=f.Channel.decode(J,J.uint32());break;case 4:G.counterpartyVersion=J.string();break;case 5:G.proofInit=J.bytes();break;case 6:G.proofHeight=l.Height.decode(J,J.uint32());break;case 7:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{portId:(0,g.isSet)(b.portId)?String(b.portId):"",previousChannelId:(0,g.isSet)(b.previousChannelId)?String(b.previousChannelId):"",channel:(0,g.isSet)(b.channel)?f.Channel.fromJSON(b.channel):void 0,counterpartyVersion:(0,g.isSet)(b.counterpartyVersion)?String(b.counterpartyVersion):"",proofInit:(0,g.isSet)(b.proofInit)?(0,g.bytesFromBase64)(b.proofInit):new Uint8Array,proofHeight:(0,g.isSet)(b.proofHeight)?l.Height.fromJSON(b.proofHeight):void 0,signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.portId!==void 0&&(O.portId=b.portId),b.previousChannelId!==void 0&&(O.previousChannelId=b.previousChannelId),b.channel!==void 0&&(O.channel=b.channel?f.Channel.toJSON(b.channel):void 0),b.counterpartyVersion!==void 0&&(O.counterpartyVersion=b.counterpartyVersion),b.proofInit!==void 0&&(O.proofInit=(0,g.base64FromBytes)(b.proofInit!==void 0?b.proofInit:new Uint8Array)),b.proofHeight!==void 0&&(O.proofHeight=b.proofHeight?l.Height.toJSON(b.proofHeight):void 0),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie,G,I,C;let O=ne();return O.portId=(J=b.portId)!=null?J:"",O.previousChannelId=(ie=b.previousChannelId)!=null?ie:"",O.channel=b.channel!==void 0&&b.channel!==null?f.Channel.fromPartial(b.channel):void 0,O.counterpartyVersion=(G=b.counterpartyVersion)!=null?G:"",O.proofInit=(I=b.proofInit)!=null?I:new Uint8Array,O.proofHeight=b.proofHeight!==void 0&&b.proofHeight!==null?l.Height.fromPartial(b.proofHeight):void 0,O.signer=(C=b.signer)!=null?C:"",O}};function Z(){return{version:""}}e.MsgChannelOpenTryResponse={encode(b,O=w.Writer.create()){return b.version!==""&&O.uint32(10).string(b.version),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=Z();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.version=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{version:(0,g.isSet)(b.version)?String(b.version):""}},toJSON(b){let O={};return b.version!==void 0&&(O.version=b.version),O},fromPartial(b){var J;let O=Z();return O.version=(J=b.version)!=null?J:"",O}};function R(){return{portId:"",channelId:"",counterpartyChannelId:"",counterpartyVersion:"",proofTry:new Uint8Array,proofHeight:void 0,signer:""}}e.MsgChannelOpenAck={encode(b,O=w.Writer.create()){return b.portId!==""&&O.uint32(10).string(b.portId),b.channelId!==""&&O.uint32(18).string(b.channelId),b.counterpartyChannelId!==""&&O.uint32(26).string(b.counterpartyChannelId),b.counterpartyVersion!==""&&O.uint32(34).string(b.counterpartyVersion),b.proofTry.length!==0&&O.uint32(42).bytes(b.proofTry),b.proofHeight!==void 0&&l.Height.encode(b.proofHeight,O.uint32(50).fork()).ldelim(),b.signer!==""&&O.uint32(58).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=R();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.portId=J.string();break;case 2:G.channelId=J.string();break;case 3:G.counterpartyChannelId=J.string();break;case 4:G.counterpartyVersion=J.string();break;case 5:G.proofTry=J.bytes();break;case 6:G.proofHeight=l.Height.decode(J,J.uint32());break;case 7:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{portId:(0,g.isSet)(b.portId)?String(b.portId):"",channelId:(0,g.isSet)(b.channelId)?String(b.channelId):"",counterpartyChannelId:(0,g.isSet)(b.counterpartyChannelId)?String(b.counterpartyChannelId):"",counterpartyVersion:(0,g.isSet)(b.counterpartyVersion)?String(b.counterpartyVersion):"",proofTry:(0,g.isSet)(b.proofTry)?(0,g.bytesFromBase64)(b.proofTry):new Uint8Array,proofHeight:(0,g.isSet)(b.proofHeight)?l.Height.fromJSON(b.proofHeight):void 0,signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.portId!==void 0&&(O.portId=b.portId),b.channelId!==void 0&&(O.channelId=b.channelId),b.counterpartyChannelId!==void 0&&(O.counterpartyChannelId=b.counterpartyChannelId),b.counterpartyVersion!==void 0&&(O.counterpartyVersion=b.counterpartyVersion),b.proofTry!==void 0&&(O.proofTry=(0,g.base64FromBytes)(b.proofTry!==void 0?b.proofTry:new Uint8Array)),b.proofHeight!==void 0&&(O.proofHeight=b.proofHeight?l.Height.toJSON(b.proofHeight):void 0),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie,G,I,C,D;let O=R();return O.portId=(J=b.portId)!=null?J:"",O.channelId=(ie=b.channelId)!=null?ie:"",O.counterpartyChannelId=(G=b.counterpartyChannelId)!=null?G:"",O.counterpartyVersion=(I=b.counterpartyVersion)!=null?I:"",O.proofTry=(C=b.proofTry)!=null?C:new Uint8Array,O.proofHeight=b.proofHeight!==void 0&&b.proofHeight!==null?l.Height.fromPartial(b.proofHeight):void 0,O.signer=(D=b.signer)!=null?D:"",O}};function M(){return{}}e.MsgChannelOpenAckResponse={encode(b,O=w.Writer.create()){return O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=M();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){default:J.skipType(I&7);break}}return G},fromJSON(b){return{}},toJSON(b){return{}},fromPartial(b){return M()}};function U(){return{portId:"",channelId:"",proofAck:new Uint8Array,proofHeight:void 0,signer:""}}e.MsgChannelOpenConfirm={encode(b,O=w.Writer.create()){return b.portId!==""&&O.uint32(10).string(b.portId),b.channelId!==""&&O.uint32(18).string(b.channelId),b.proofAck.length!==0&&O.uint32(26).bytes(b.proofAck),b.proofHeight!==void 0&&l.Height.encode(b.proofHeight,O.uint32(34).fork()).ldelim(),b.signer!==""&&O.uint32(42).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=U();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.portId=J.string();break;case 2:G.channelId=J.string();break;case 3:G.proofAck=J.bytes();break;case 4:G.proofHeight=l.Height.decode(J,J.uint32());break;case 5:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{portId:(0,g.isSet)(b.portId)?String(b.portId):"",channelId:(0,g.isSet)(b.channelId)?String(b.channelId):"",proofAck:(0,g.isSet)(b.proofAck)?(0,g.bytesFromBase64)(b.proofAck):new Uint8Array,proofHeight:(0,g.isSet)(b.proofHeight)?l.Height.fromJSON(b.proofHeight):void 0,signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.portId!==void 0&&(O.portId=b.portId),b.channelId!==void 0&&(O.channelId=b.channelId),b.proofAck!==void 0&&(O.proofAck=(0,g.base64FromBytes)(b.proofAck!==void 0?b.proofAck:new Uint8Array)),b.proofHeight!==void 0&&(O.proofHeight=b.proofHeight?l.Height.toJSON(b.proofHeight):void 0),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie,G,I;let O=U();return O.portId=(J=b.portId)!=null?J:"",O.channelId=(ie=b.channelId)!=null?ie:"",O.proofAck=(G=b.proofAck)!=null?G:new Uint8Array,O.proofHeight=b.proofHeight!==void 0&&b.proofHeight!==null?l.Height.fromPartial(b.proofHeight):void 0,O.signer=(I=b.signer)!=null?I:"",O}};function E(){return{}}e.MsgChannelOpenConfirmResponse={encode(b,O=w.Writer.create()){return O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=E();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){default:J.skipType(I&7);break}}return G},fromJSON(b){return{}},toJSON(b){return{}},fromPartial(b){return E()}};function Q(){return{portId:"",channelId:"",signer:""}}e.MsgChannelCloseInit={encode(b,O=w.Writer.create()){return b.portId!==""&&O.uint32(10).string(b.portId),b.channelId!==""&&O.uint32(18).string(b.channelId),b.signer!==""&&O.uint32(26).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=Q();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.portId=J.string();break;case 2:G.channelId=J.string();break;case 3:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{portId:(0,g.isSet)(b.portId)?String(b.portId):"",channelId:(0,g.isSet)(b.channelId)?String(b.channelId):"",signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.portId!==void 0&&(O.portId=b.portId),b.channelId!==void 0&&(O.channelId=b.channelId),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie,G;let O=Q();return O.portId=(J=b.portId)!=null?J:"",O.channelId=(ie=b.channelId)!=null?ie:"",O.signer=(G=b.signer)!=null?G:"",O}};function H(){return{}}e.MsgChannelCloseInitResponse={encode(b,O=w.Writer.create()){return O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=H();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){default:J.skipType(I&7);break}}return G},fromJSON(b){return{}},toJSON(b){return{}},fromPartial(b){return H()}};function re(){return{portId:"",channelId:"",proofInit:new Uint8Array,proofHeight:void 0,signer:""}}e.MsgChannelCloseConfirm={encode(b,O=w.Writer.create()){return b.portId!==""&&O.uint32(10).string(b.portId),b.channelId!==""&&O.uint32(18).string(b.channelId),b.proofInit.length!==0&&O.uint32(26).bytes(b.proofInit),b.proofHeight!==void 0&&l.Height.encode(b.proofHeight,O.uint32(34).fork()).ldelim(),b.signer!==""&&O.uint32(42).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=re();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.portId=J.string();break;case 2:G.channelId=J.string();break;case 3:G.proofInit=J.bytes();break;case 4:G.proofHeight=l.Height.decode(J,J.uint32());break;case 5:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{portId:(0,g.isSet)(b.portId)?String(b.portId):"",channelId:(0,g.isSet)(b.channelId)?String(b.channelId):"",proofInit:(0,g.isSet)(b.proofInit)?(0,g.bytesFromBase64)(b.proofInit):new Uint8Array,proofHeight:(0,g.isSet)(b.proofHeight)?l.Height.fromJSON(b.proofHeight):void 0,signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.portId!==void 0&&(O.portId=b.portId),b.channelId!==void 0&&(O.channelId=b.channelId),b.proofInit!==void 0&&(O.proofInit=(0,g.base64FromBytes)(b.proofInit!==void 0?b.proofInit:new Uint8Array)),b.proofHeight!==void 0&&(O.proofHeight=b.proofHeight?l.Height.toJSON(b.proofHeight):void 0),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie,G,I;let O=re();return O.portId=(J=b.portId)!=null?J:"",O.channelId=(ie=b.channelId)!=null?ie:"",O.proofInit=(G=b.proofInit)!=null?G:new Uint8Array,O.proofHeight=b.proofHeight!==void 0&&b.proofHeight!==null?l.Height.fromPartial(b.proofHeight):void 0,O.signer=(I=b.signer)!=null?I:"",O}};function ee(){return{}}e.MsgChannelCloseConfirmResponse={encode(b,O=w.Writer.create()){return O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=ee();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){default:J.skipType(I&7);break}}return G},fromJSON(b){return{}},toJSON(b){return{}},fromPartial(b){return ee()}};function T(){return{packet:void 0,proofCommitment:new Uint8Array,proofHeight:void 0,signer:""}}e.MsgRecvPacket={encode(b,O=w.Writer.create()){return b.packet!==void 0&&f.Packet.encode(b.packet,O.uint32(10).fork()).ldelim(),b.proofCommitment.length!==0&&O.uint32(18).bytes(b.proofCommitment),b.proofHeight!==void 0&&l.Height.encode(b.proofHeight,O.uint32(26).fork()).ldelim(),b.signer!==""&&O.uint32(34).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=T();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.packet=f.Packet.decode(J,J.uint32());break;case 2:G.proofCommitment=J.bytes();break;case 3:G.proofHeight=l.Height.decode(J,J.uint32());break;case 4:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{packet:(0,g.isSet)(b.packet)?f.Packet.fromJSON(b.packet):void 0,proofCommitment:(0,g.isSet)(b.proofCommitment)?(0,g.bytesFromBase64)(b.proofCommitment):new Uint8Array,proofHeight:(0,g.isSet)(b.proofHeight)?l.Height.fromJSON(b.proofHeight):void 0,signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.packet!==void 0&&(O.packet=b.packet?f.Packet.toJSON(b.packet):void 0),b.proofCommitment!==void 0&&(O.proofCommitment=(0,g.base64FromBytes)(b.proofCommitment!==void 0?b.proofCommitment:new Uint8Array)),b.proofHeight!==void 0&&(O.proofHeight=b.proofHeight?l.Height.toJSON(b.proofHeight):void 0),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie;let O=T();return O.packet=b.packet!==void 0&&b.packet!==null?f.Packet.fromPartial(b.packet):void 0,O.proofCommitment=(J=b.proofCommitment)!=null?J:new Uint8Array,O.proofHeight=b.proofHeight!==void 0&&b.proofHeight!==null?l.Height.fromPartial(b.proofHeight):void 0,O.signer=(ie=b.signer)!=null?ie:"",O}};function se(){return{result:0}}e.MsgRecvPacketResponse={encode(b,O=w.Writer.create()){return b.result!==0&&O.uint32(8).int32(b.result),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=se();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.result=J.int32();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{result:(0,g.isSet)(b.result)?F(b.result):0}},toJSON(b){let O={};return b.result!==void 0&&(O.result=j(b.result)),O},fromPartial(b){var J;let O=se();return O.result=(J=b.result)!=null?J:0,O}};function p(){return{packet:void 0,proofUnreceived:new Uint8Array,proofHeight:void 0,nextSequenceRecv:g.Long.UZERO,signer:""}}e.MsgTimeout={encode(b,O=w.Writer.create()){return b.packet!==void 0&&f.Packet.encode(b.packet,O.uint32(10).fork()).ldelim(),b.proofUnreceived.length!==0&&O.uint32(18).bytes(b.proofUnreceived),b.proofHeight!==void 0&&l.Height.encode(b.proofHeight,O.uint32(26).fork()).ldelim(),b.nextSequenceRecv.isZero()||O.uint32(32).uint64(b.nextSequenceRecv),b.signer!==""&&O.uint32(42).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=p();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.packet=f.Packet.decode(J,J.uint32());break;case 2:G.proofUnreceived=J.bytes();break;case 3:G.proofHeight=l.Height.decode(J,J.uint32());break;case 4:G.nextSequenceRecv=J.uint64();break;case 5:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{packet:(0,g.isSet)(b.packet)?f.Packet.fromJSON(b.packet):void 0,proofUnreceived:(0,g.isSet)(b.proofUnreceived)?(0,g.bytesFromBase64)(b.proofUnreceived):new Uint8Array,proofHeight:(0,g.isSet)(b.proofHeight)?l.Height.fromJSON(b.proofHeight):void 0,nextSequenceRecv:(0,g.isSet)(b.nextSequenceRecv)?g.Long.fromValue(b.nextSequenceRecv):g.Long.UZERO,signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.packet!==void 0&&(O.packet=b.packet?f.Packet.toJSON(b.packet):void 0),b.proofUnreceived!==void 0&&(O.proofUnreceived=(0,g.base64FromBytes)(b.proofUnreceived!==void 0?b.proofUnreceived:new Uint8Array)),b.proofHeight!==void 0&&(O.proofHeight=b.proofHeight?l.Height.toJSON(b.proofHeight):void 0),b.nextSequenceRecv!==void 0&&(O.nextSequenceRecv=(b.nextSequenceRecv||g.Long.UZERO).toString()),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie;let O=p();return O.packet=b.packet!==void 0&&b.packet!==null?f.Packet.fromPartial(b.packet):void 0,O.proofUnreceived=(J=b.proofUnreceived)!=null?J:new Uint8Array,O.proofHeight=b.proofHeight!==void 0&&b.proofHeight!==null?l.Height.fromPartial(b.proofHeight):void 0,O.nextSequenceRecv=b.nextSequenceRecv!==void 0&&b.nextSequenceRecv!==null?g.Long.fromValue(b.nextSequenceRecv):g.Long.UZERO,O.signer=(ie=b.signer)!=null?ie:"",O}};function L(){return{result:0}}e.MsgTimeoutResponse={encode(b,O=w.Writer.create()){return b.result!==0&&O.uint32(8).int32(b.result),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=L();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.result=J.int32();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{result:(0,g.isSet)(b.result)?F(b.result):0}},toJSON(b){let O={};return b.result!==void 0&&(O.result=j(b.result)),O},fromPartial(b){var J;let O=L();return O.result=(J=b.result)!=null?J:0,O}};function V(){return{packet:void 0,proofUnreceived:new Uint8Array,proofClose:new Uint8Array,proofHeight:void 0,nextSequenceRecv:g.Long.UZERO,signer:""}}e.MsgTimeoutOnClose={encode(b,O=w.Writer.create()){return b.packet!==void 0&&f.Packet.encode(b.packet,O.uint32(10).fork()).ldelim(),b.proofUnreceived.length!==0&&O.uint32(18).bytes(b.proofUnreceived),b.proofClose.length!==0&&O.uint32(26).bytes(b.proofClose),b.proofHeight!==void 0&&l.Height.encode(b.proofHeight,O.uint32(34).fork()).ldelim(),b.nextSequenceRecv.isZero()||O.uint32(40).uint64(b.nextSequenceRecv),b.signer!==""&&O.uint32(50).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=V();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.packet=f.Packet.decode(J,J.uint32());break;case 2:G.proofUnreceived=J.bytes();break;case 3:G.proofClose=J.bytes();break;case 4:G.proofHeight=l.Height.decode(J,J.uint32());break;case 5:G.nextSequenceRecv=J.uint64();break;case 6:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{packet:(0,g.isSet)(b.packet)?f.Packet.fromJSON(b.packet):void 0,proofUnreceived:(0,g.isSet)(b.proofUnreceived)?(0,g.bytesFromBase64)(b.proofUnreceived):new Uint8Array,proofClose:(0,g.isSet)(b.proofClose)?(0,g.bytesFromBase64)(b.proofClose):new Uint8Array,proofHeight:(0,g.isSet)(b.proofHeight)?l.Height.fromJSON(b.proofHeight):void 0,nextSequenceRecv:(0,g.isSet)(b.nextSequenceRecv)?g.Long.fromValue(b.nextSequenceRecv):g.Long.UZERO,signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.packet!==void 0&&(O.packet=b.packet?f.Packet.toJSON(b.packet):void 0),b.proofUnreceived!==void 0&&(O.proofUnreceived=(0,g.base64FromBytes)(b.proofUnreceived!==void 0?b.proofUnreceived:new Uint8Array)),b.proofClose!==void 0&&(O.proofClose=(0,g.base64FromBytes)(b.proofClose!==void 0?b.proofClose:new Uint8Array)),b.proofHeight!==void 0&&(O.proofHeight=b.proofHeight?l.Height.toJSON(b.proofHeight):void 0),b.nextSequenceRecv!==void 0&&(O.nextSequenceRecv=(b.nextSequenceRecv||g.Long.UZERO).toString()),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie,G;let O=V();return O.packet=b.packet!==void 0&&b.packet!==null?f.Packet.fromPartial(b.packet):void 0,O.proofUnreceived=(J=b.proofUnreceived)!=null?J:new Uint8Array,O.proofClose=(ie=b.proofClose)!=null?ie:new Uint8Array,O.proofHeight=b.proofHeight!==void 0&&b.proofHeight!==null?l.Height.fromPartial(b.proofHeight):void 0,O.nextSequenceRecv=b.nextSequenceRecv!==void 0&&b.nextSequenceRecv!==null?g.Long.fromValue(b.nextSequenceRecv):g.Long.UZERO,O.signer=(G=b.signer)!=null?G:"",O}};function K(){return{result:0}}e.MsgTimeoutOnCloseResponse={encode(b,O=w.Writer.create()){return b.result!==0&&O.uint32(8).int32(b.result),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=K();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.result=J.int32();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{result:(0,g.isSet)(b.result)?F(b.result):0}},toJSON(b){let O={};return b.result!==void 0&&(O.result=j(b.result)),O},fromPartial(b){var J;let O=K();return O.result=(J=b.result)!=null?J:0,O}};function m(){return{packet:void 0,acknowledgement:new Uint8Array,proofAcked:new Uint8Array,proofHeight:void 0,signer:""}}e.MsgAcknowledgement={encode(b,O=w.Writer.create()){return b.packet!==void 0&&f.Packet.encode(b.packet,O.uint32(10).fork()).ldelim(),b.acknowledgement.length!==0&&O.uint32(18).bytes(b.acknowledgement),b.proofAcked.length!==0&&O.uint32(26).bytes(b.proofAcked),b.proofHeight!==void 0&&l.Height.encode(b.proofHeight,O.uint32(34).fork()).ldelim(),b.signer!==""&&O.uint32(42).string(b.signer),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=m();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.packet=f.Packet.decode(J,J.uint32());break;case 2:G.acknowledgement=J.bytes();break;case 3:G.proofAcked=J.bytes();break;case 4:G.proofHeight=l.Height.decode(J,J.uint32());break;case 5:G.signer=J.string();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{packet:(0,g.isSet)(b.packet)?f.Packet.fromJSON(b.packet):void 0,acknowledgement:(0,g.isSet)(b.acknowledgement)?(0,g.bytesFromBase64)(b.acknowledgement):new Uint8Array,proofAcked:(0,g.isSet)(b.proofAcked)?(0,g.bytesFromBase64)(b.proofAcked):new Uint8Array,proofHeight:(0,g.isSet)(b.proofHeight)?l.Height.fromJSON(b.proofHeight):void 0,signer:(0,g.isSet)(b.signer)?String(b.signer):""}},toJSON(b){let O={};return b.packet!==void 0&&(O.packet=b.packet?f.Packet.toJSON(b.packet):void 0),b.acknowledgement!==void 0&&(O.acknowledgement=(0,g.base64FromBytes)(b.acknowledgement!==void 0?b.acknowledgement:new Uint8Array)),b.proofAcked!==void 0&&(O.proofAcked=(0,g.base64FromBytes)(b.proofAcked!==void 0?b.proofAcked:new Uint8Array)),b.proofHeight!==void 0&&(O.proofHeight=b.proofHeight?l.Height.toJSON(b.proofHeight):void 0),b.signer!==void 0&&(O.signer=b.signer),O},fromPartial(b){var J,ie,G;let O=m();return O.packet=b.packet!==void 0&&b.packet!==null?f.Packet.fromPartial(b.packet):void 0,O.acknowledgement=(J=b.acknowledgement)!=null?J:new Uint8Array,O.proofAcked=(ie=b.proofAcked)!=null?ie:new Uint8Array,O.proofHeight=b.proofHeight!==void 0&&b.proofHeight!==null?l.Height.fromPartial(b.proofHeight):void 0,O.signer=(G=b.signer)!=null?G:"",O}};function h(){return{result:0}}e.MsgAcknowledgementResponse={encode(b,O=w.Writer.create()){return b.result!==0&&O.uint32(8).int32(b.result),O},decode(b,O){let J=b instanceof w.Reader?b:new w.Reader(b),ie=O===void 0?J.len:J.pos+O,G=h();for(;J.pos<ie;){let I=J.uint32();switch(I>>>3){case 1:G.result=J.int32();break;default:J.skipType(I&7);break}}return G},fromJSON(b){return{result:(0,g.isSet)(b.result)?F(b.result):0}},toJSON(b){let O={};return b.result!==void 0&&(O.result=j(b.result)),O},fromPartial(b){var J;let O=h();return O.result=(J=b.result)!=null?J:0,O}};class _{constructor(O){this.rpc=O,this.ChannelOpenInit=this.ChannelOpenInit.bind(this),this.ChannelOpenTry=this.ChannelOpenTry.bind(this),this.ChannelOpenAck=this.ChannelOpenAck.bind(this),this.ChannelOpenConfirm=this.ChannelOpenConfirm.bind(this),this.ChannelCloseInit=this.ChannelCloseInit.bind(this),this.ChannelCloseConfirm=this.ChannelCloseConfirm.bind(this),this.RecvPacket=this.RecvPacket.bind(this),this.Timeout=this.Timeout.bind(this),this.TimeoutOnClose=this.TimeoutOnClose.bind(this),this.Acknowledgement=this.Acknowledgement.bind(this)}ChannelOpenInit(O){let J=e.MsgChannelOpenInit.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","ChannelOpenInit",J).then(G=>e.MsgChannelOpenInitResponse.decode(new w.Reader(G)))}ChannelOpenTry(O){let J=e.MsgChannelOpenTry.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","ChannelOpenTry",J).then(G=>e.MsgChannelOpenTryResponse.decode(new w.Reader(G)))}ChannelOpenAck(O){let J=e.MsgChannelOpenAck.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","ChannelOpenAck",J).then(G=>e.MsgChannelOpenAckResponse.decode(new w.Reader(G)))}ChannelOpenConfirm(O){let J=e.MsgChannelOpenConfirm.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","ChannelOpenConfirm",J).then(G=>e.MsgChannelOpenConfirmResponse.decode(new w.Reader(G)))}ChannelCloseInit(O){let J=e.MsgChannelCloseInit.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","ChannelCloseInit",J).then(G=>e.MsgChannelCloseInitResponse.decode(new w.Reader(G)))}ChannelCloseConfirm(O){let J=e.MsgChannelCloseConfirm.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","ChannelCloseConfirm",J).then(G=>e.MsgChannelCloseConfirmResponse.decode(new w.Reader(G)))}RecvPacket(O){let J=e.MsgRecvPacket.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","RecvPacket",J).then(G=>e.MsgRecvPacketResponse.decode(new w.Reader(G)))}Timeout(O){let J=e.MsgTimeout.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","Timeout",J).then(G=>e.MsgTimeoutResponse.decode(new w.Reader(G)))}TimeoutOnClose(O){let J=e.MsgTimeoutOnClose.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","TimeoutOnClose",J).then(G=>e.MsgTimeoutOnCloseResponse.decode(new w.Reader(G)))}Acknowledgement(O){let J=e.MsgAcknowledgement.encode(O).finish();return this.rpc.request("ibc.core.channel.v1.Msg","Acknowledgement",J).then(G=>e.MsgAcknowledgementResponse.decode(new w.Reader(G)))}}e.MsgClientImpl=_})(P$r);var O$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(M,U,E,Q){Q===void 0&&(Q=E);var H=Object.getOwnPropertyDescriptor(U,E);(!H||("get"in H?!U.__esModule:H.writable||H.configurable))&&(H={enumerable:!0,get:function(){return U[E]}}),Object.defineProperty(M,Q,H)}:function(M,U,E,Q){Q===void 0&&(Q=E),M[Q]=U[E]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(M,U){Object.defineProperty(M,"default",{enumerable:!0,value:U})}:function(M,U){M.default=U}),c=Fr&&Fr.__importStar||function(M){if(M&&M.__esModule)return M;var U={};if(M!=null)for(var E in M)E!=="default"&&Object.prototype.hasOwnProperty.call(M,E)&&i(U,M,E);return A(U,M),U};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgSubmitMisbehaviourResponse=e.MsgSubmitMisbehaviour=e.MsgUpgradeClientResponse=e.MsgUpgradeClient=e.MsgUpdateClientResponse=e.MsgUpdateClient=e.MsgCreateClientResponse=e.MsgCreateClient=e.protobufPackage=void 0;let f=fh,l=c(BA),g=Ns;e.protobufPackage="ibc.core.client.v1";function w(){return{clientState:void 0,consensusState:void 0,signer:""}}e.MsgCreateClient={encode(M,U=l.Writer.create()){return M.clientState!==void 0&&f.Any.encode(M.clientState,U.uint32(10).fork()).ldelim(),M.consensusState!==void 0&&f.Any.encode(M.consensusState,U.uint32(18).fork()).ldelim(),M.signer!==""&&U.uint32(26).string(M.signer),U},decode(M,U){let E=M instanceof l.Reader?M:new l.Reader(M),Q=U===void 0?E.len:E.pos+U,H=w();for(;E.pos<Q;){let re=E.uint32();switch(re>>>3){case 1:H.clientState=f.Any.decode(E,E.uint32());break;case 2:H.consensusState=f.Any.decode(E,E.uint32());break;case 3:H.signer=E.string();break;default:E.skipType(re&7);break}}return H},fromJSON(M){return{clientState:(0,g.isSet)(M.clientState)?f.Any.fromJSON(M.clientState):void 0,consensusState:(0,g.isSet)(M.consensusState)?f.Any.fromJSON(M.consensusState):void 0,signer:(0,g.isSet)(M.signer)?String(M.signer):""}},toJSON(M){let U={};return M.clientState!==void 0&&(U.clientState=M.clientState?f.Any.toJSON(M.clientState):void 0),M.consensusState!==void 0&&(U.consensusState=M.consensusState?f.Any.toJSON(M.consensusState):void 0),M.signer!==void 0&&(U.signer=M.signer),U},fromPartial(M){var E;let U=w();return U.clientState=M.clientState!==void 0&&M.clientState!==null?f.Any.fromPartial(M.clientState):void 0,U.consensusState=M.consensusState!==void 0&&M.consensusState!==null?f.Any.fromPartial(M.consensusState):void 0,U.signer=(E=M.signer)!=null?E:"",U}};function N(){return{}}e.MsgCreateClientResponse={encode(M,U=l.Writer.create()){return U},decode(M,U){let E=M instanceof l.Reader?M:new l.Reader(M),Q=U===void 0?E.len:E.pos+U,H=N();for(;E.pos<Q;){let re=E.uint32();switch(re>>>3){default:E.skipType(re&7);break}}return H},fromJSON(M){return{}},toJSON(M){return{}},fromPartial(M){return N()}};function F(){return{clientId:"",clientMessage:void 0,signer:""}}e.MsgUpdateClient={encode(M,U=l.Writer.create()){return M.clientId!==""&&U.uint32(10).string(M.clientId),M.clientMessage!==void 0&&f.Any.encode(M.clientMessage,U.uint32(18).fork()).ldelim(),M.signer!==""&&U.uint32(26).string(M.signer),U},decode(M,U){let E=M instanceof l.Reader?M:new l.Reader(M),Q=U===void 0?E.len:E.pos+U,H=F();for(;E.pos<Q;){let re=E.uint32();switch(re>>>3){case 1:H.clientId=E.string();break;case 2:H.clientMessage=f.Any.decode(E,E.uint32());break;case 3:H.signer=E.string();break;default:E.skipType(re&7);break}}return H},fromJSON(M){return{clientId:(0,g.isSet)(M.clientId)?String(M.clientId):"",clientMessage:(0,g.isSet)(M.clientMessage)?f.Any.fromJSON(M.clientMessage):void 0,signer:(0,g.isSet)(M.signer)?String(M.signer):""}},toJSON(M){let U={};return M.clientId!==void 0&&(U.clientId=M.clientId),M.clientMessage!==void 0&&(U.clientMessage=M.clientMessage?f.Any.toJSON(M.clientMessage):void 0),M.signer!==void 0&&(U.signer=M.signer),U},fromPartial(M){var E,Q;let U=F();return U.clientId=(E=M.clientId)!=null?E:"",U.clientMessage=M.clientMessage!==void 0&&M.clientMessage!==null?f.Any.fromPartial(M.clientMessage):void 0,U.signer=(Q=M.signer)!=null?Q:"",U}};function j(){return{}}e.MsgUpdateClientResponse={encode(M,U=l.Writer.create()){return U},decode(M,U){let E=M instanceof l.Reader?M:new l.Reader(M),Q=U===void 0?E.len:E.pos+U,H=j();for(;E.pos<Q;){let re=E.uint32();switch(re>>>3){default:E.skipType(re&7);break}}return H},fromJSON(M){return{}},toJSON(M){return{}},fromPartial(M){return j()}};function te(){return{clientId:"",clientState:void 0,consensusState:void 0,proofUpgradeClient:new Uint8Array,proofUpgradeConsensusState:new Uint8Array,signer:""}}e.MsgUpgradeClient={encode(M,U=l.Writer.create()){return M.clientId!==""&&U.uint32(10).string(M.clientId),M.clientState!==void 0&&f.Any.encode(M.clientState,U.uint32(18).fork()).ldelim(),M.consensusState!==void 0&&f.Any.encode(M.consensusState,U.uint32(26).fork()).ldelim(),M.proofUpgradeClient.length!==0&&U.uint32(34).bytes(M.proofUpgradeClient),M.proofUpgradeConsensusState.length!==0&&U.uint32(42).bytes(M.proofUpgradeConsensusState),M.signer!==""&&U.uint32(50).string(M.signer),U},decode(M,U){let E=M instanceof l.Reader?M:new l.Reader(M),Q=U===void 0?E.len:E.pos+U,H=te();for(;E.pos<Q;){let re=E.uint32();switch(re>>>3){case 1:H.clientId=E.string();break;case 2:H.clientState=f.Any.decode(E,E.uint32());break;case 3:H.consensusState=f.Any.decode(E,E.uint32());break;case 4:H.proofUpgradeClient=E.bytes();break;case 5:H.proofUpgradeConsensusState=E.bytes();break;case 6:H.signer=E.string();break;default:E.skipType(re&7);break}}return H},fromJSON(M){return{clientId:(0,g.isSet)(M.clientId)?String(M.clientId):"",clientState:(0,g.isSet)(M.clientState)?f.Any.fromJSON(M.clientState):void 0,consensusState:(0,g.isSet)(M.consensusState)?f.Any.fromJSON(M.consensusState):void 0,proofUpgradeClient:(0,g.isSet)(M.proofUpgradeClient)?(0,g.bytesFromBase64)(M.proofUpgradeClient):new Uint8Array,proofUpgradeConsensusState:(0,g.isSet)(M.proofUpgradeConsensusState)?(0,g.bytesFromBase64)(M.proofUpgradeConsensusState):new Uint8Array,signer:(0,g.isSet)(M.signer)?String(M.signer):""}},toJSON(M){let U={};return M.clientId!==void 0&&(U.clientId=M.clientId),M.clientState!==void 0&&(U.clientState=M.clientState?f.Any.toJSON(M.clientState):void 0),M.consensusState!==void 0&&(U.consensusState=M.consensusState?f.Any.toJSON(M.consensusState):void 0),M.proofUpgradeClient!==void 0&&(U.proofUpgradeClient=(0,g.base64FromBytes)(M.proofUpgradeClient!==void 0?M.proofUpgradeClient:new Uint8Array)),M.proofUpgradeConsensusState!==void 0&&(U.proofUpgradeConsensusState=(0,g.base64FromBytes)(M.proofUpgradeConsensusState!==void 0?M.proofUpgradeConsensusState:new Uint8Array)),M.signer!==void 0&&(U.signer=M.signer),U},fromPartial(M){var E,Q,H,re;let U=te();return U.clientId=(E=M.clientId)!=null?E:"",U.clientState=M.clientState!==void 0&&M.clientState!==null?f.Any.fromPartial(M.clientState):void 0,U.consensusState=M.consensusState!==void 0&&M.consensusState!==null?f.Any.fromPartial(M.consensusState):void 0,U.proofUpgradeClient=(Q=M.proofUpgradeClient)!=null?Q:new Uint8Array,U.proofUpgradeConsensusState=(H=M.proofUpgradeConsensusState)!=null?H:new Uint8Array,U.signer=(re=M.signer)!=null?re:"",U}};function v(){return{}}e.MsgUpgradeClientResponse={encode(M,U=l.Writer.create()){return U},decode(M,U){let E=M instanceof l.Reader?M:new l.Reader(M),Q=U===void 0?E.len:E.pos+U,H=v();for(;E.pos<Q;){let re=E.uint32();switch(re>>>3){default:E.skipType(re&7);break}}return H},fromJSON(M){return{}},toJSON(M){return{}},fromPartial(M){return v()}};function ne(){return{clientId:"",misbehaviour:void 0,signer:""}}e.MsgSubmitMisbehaviour={encode(M,U=l.Writer.create()){return M.clientId!==""&&U.uint32(10).string(M.clientId),M.misbehaviour!==void 0&&f.Any.encode(M.misbehaviour,U.uint32(18).fork()).ldelim(),M.signer!==""&&U.uint32(26).string(M.signer),U},decode(M,U){let E=M instanceof l.Reader?M:new l.Reader(M),Q=U===void 0?E.len:E.pos+U,H=ne();for(;E.pos<Q;){let re=E.uint32();switch(re>>>3){case 1:H.clientId=E.string();break;case 2:H.misbehaviour=f.Any.decode(E,E.uint32());break;case 3:H.signer=E.string();break;default:E.skipType(re&7);break}}return H},fromJSON(M){return{clientId:(0,g.isSet)(M.clientId)?String(M.clientId):"",misbehaviour:(0,g.isSet)(M.misbehaviour)?f.Any.fromJSON(M.misbehaviour):void 0,signer:(0,g.isSet)(M.signer)?String(M.signer):""}},toJSON(M){let U={};return M.clientId!==void 0&&(U.clientId=M.clientId),M.misbehaviour!==void 0&&(U.misbehaviour=M.misbehaviour?f.Any.toJSON(M.misbehaviour):void 0),M.signer!==void 0&&(U.signer=M.signer),U},fromPartial(M){var E,Q;let U=ne();return U.clientId=(E=M.clientId)!=null?E:"",U.misbehaviour=M.misbehaviour!==void 0&&M.misbehaviour!==null?f.Any.fromPartial(M.misbehaviour):void 0,U.signer=(Q=M.signer)!=null?Q:"",U}};function Z(){return{}}e.MsgSubmitMisbehaviourResponse={encode(M,U=l.Writer.create()){return U},decode(M,U){let E=M instanceof l.Reader?M:new l.Reader(M),Q=U===void 0?E.len:E.pos+U,H=Z();for(;E.pos<Q;){let re=E.uint32();switch(re>>>3){default:E.skipType(re&7);break}}return H},fromJSON(M){return{}},toJSON(M){return{}},fromPartial(M){return Z()}};class R{constructor(U){this.rpc=U,this.CreateClient=this.CreateClient.bind(this),this.UpdateClient=this.UpdateClient.bind(this),this.UpgradeClient=this.UpgradeClient.bind(this),this.SubmitMisbehaviour=this.SubmitMisbehaviour.bind(this)}CreateClient(U){let E=e.MsgCreateClient.encode(U).finish();return this.rpc.request("ibc.core.client.v1.Msg","CreateClient",E).then(H=>e.MsgCreateClientResponse.decode(new l.Reader(H)))}UpdateClient(U){let E=e.MsgUpdateClient.encode(U).finish();return this.rpc.request("ibc.core.client.v1.Msg","UpdateClient",E).then(H=>e.MsgUpdateClientResponse.decode(new l.Reader(H)))}UpgradeClient(U){let E=e.MsgUpgradeClient.encode(U).finish();return this.rpc.request("ibc.core.client.v1.Msg","UpgradeClient",E).then(H=>e.MsgUpgradeClientResponse.decode(new l.Reader(H)))}SubmitMisbehaviour(U){let E=e.MsgSubmitMisbehaviour.encode(U).finish();return this.rpc.request("ibc.core.client.v1.Msg","SubmitMisbehaviour",E).then(H=>e.MsgSubmitMisbehaviourResponse.decode(new l.Reader(H)))}}e.MsgClientImpl=R})(O$r);var N$r={},IIn={},DR={},CIn={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(p,L,V,K){K===void 0&&(K=V);var m=Object.getOwnPropertyDescriptor(L,V);(!m||("get"in m?!L.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return L[V]}}),Object.defineProperty(p,K,m)}:function(p,L,V,K){K===void 0&&(K=V),p[K]=L[V]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(p,L){Object.defineProperty(p,"default",{enumerable:!0,value:L})}:function(p,L){p.default=L}),c=Fr&&Fr.__importStar||function(p){if(p&&p.__esModule)return p;var L={};if(p!=null)for(var V in p)V!=="default"&&Object.prototype.hasOwnProperty.call(p,V)&&i(L,p,V);return A(L,p),L};Object.defineProperty(e,"__esModule",{value:!0}),e.CompressedNonExistenceProof=e.CompressedExistenceProof=e.CompressedBatchEntry=e.CompressedBatchProof=e.BatchEntry=e.BatchProof=e.InnerSpec=e.ProofSpec=e.InnerOp=e.LeafOp=e.CommitmentProof=e.NonExistenceProof=e.ExistenceProof=e.lengthOpToJSON=e.lengthOpFromJSON=e.LengthOp=e.hashOpToJSON=e.hashOpFromJSON=e.HashOp=e.protobufPackage=void 0;let f=c(BA),l=Ns;e.protobufPackage="cosmos.ics23.v1";var g;(function(p){p[p.NO_HASH=0]="NO_HASH",p[p.SHA256=1]="SHA256",p[p.SHA512=2]="SHA512",p[p.KECCAK=3]="KECCAK",p[p.RIPEMD160=4]="RIPEMD160",p[p.BITCOIN=5]="BITCOIN",p[p.SHA512_256=6]="SHA512_256",p[p.UNRECOGNIZED=-1]="UNRECOGNIZED"})(g=e.HashOp||(e.HashOp={}));function w(p){switch(p){case 0:case"NO_HASH":return g.NO_HASH;case 1:case"SHA256":return g.SHA256;case 2:case"SHA512":return g.SHA512;case 3:case"KECCAK":return g.KECCAK;case 4:case"RIPEMD160":return g.RIPEMD160;case 5:case"BITCOIN":return g.BITCOIN;case 6:case"SHA512_256":return g.SHA512_256;case-1:case"UNRECOGNIZED":default:return g.UNRECOGNIZED}}e.hashOpFromJSON=w;function N(p){switch(p){case g.NO_HASH:return"NO_HASH";case g.SHA256:return"SHA256";case g.SHA512:return"SHA512";case g.KECCAK:return"KECCAK";case g.RIPEMD160:return"RIPEMD160";case g.BITCOIN:return"BITCOIN";case g.SHA512_256:return"SHA512_256";case g.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.hashOpToJSON=N;var F;(function(p){p[p.NO_PREFIX=0]="NO_PREFIX",p[p.VAR_PROTO=1]="VAR_PROTO",p[p.VAR_RLP=2]="VAR_RLP",p[p.FIXED32_BIG=3]="FIXED32_BIG",p[p.FIXED32_LITTLE=4]="FIXED32_LITTLE",p[p.FIXED64_BIG=5]="FIXED64_BIG",p[p.FIXED64_LITTLE=6]="FIXED64_LITTLE",p[p.REQUIRE_32_BYTES=7]="REQUIRE_32_BYTES",p[p.REQUIRE_64_BYTES=8]="REQUIRE_64_BYTES",p[p.UNRECOGNIZED=-1]="UNRECOGNIZED"})(F=e.LengthOp||(e.LengthOp={}));function j(p){switch(p){case 0:case"NO_PREFIX":return F.NO_PREFIX;case 1:case"VAR_PROTO":return F.VAR_PROTO;case 2:case"VAR_RLP":return F.VAR_RLP;case 3:case"FIXED32_BIG":return F.FIXED32_BIG;case 4:case"FIXED32_LITTLE":return F.FIXED32_LITTLE;case 5:case"FIXED64_BIG":return F.FIXED64_BIG;case 6:case"FIXED64_LITTLE":return F.FIXED64_LITTLE;case 7:case"REQUIRE_32_BYTES":return F.REQUIRE_32_BYTES;case 8:case"REQUIRE_64_BYTES":return F.REQUIRE_64_BYTES;case-1:case"UNRECOGNIZED":default:return F.UNRECOGNIZED}}e.lengthOpFromJSON=j;function te(p){switch(p){case F.NO_PREFIX:return"NO_PREFIX";case F.VAR_PROTO:return"VAR_PROTO";case F.VAR_RLP:return"VAR_RLP";case F.FIXED32_BIG:return"FIXED32_BIG";case F.FIXED32_LITTLE:return"FIXED32_LITTLE";case F.FIXED64_BIG:return"FIXED64_BIG";case F.FIXED64_LITTLE:return"FIXED64_LITTLE";case F.REQUIRE_32_BYTES:return"REQUIRE_32_BYTES";case F.REQUIRE_64_BYTES:return"REQUIRE_64_BYTES";case F.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.lengthOpToJSON=te;function v(){return{key:new Uint8Array,value:new Uint8Array,leaf:void 0,path:[]}}e.ExistenceProof={encode(p,L=f.Writer.create()){p.key.length!==0&&L.uint32(10).bytes(p.key),p.value.length!==0&&L.uint32(18).bytes(p.value),p.leaf!==void 0&&e.LeafOp.encode(p.leaf,L.uint32(26).fork()).ldelim();for(let V of p.path)e.InnerOp.encode(V,L.uint32(34).fork()).ldelim();return L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=v();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.key=V.bytes();break;case 2:m.value=V.bytes();break;case 3:m.leaf=e.LeafOp.decode(V,V.uint32());break;case 4:m.path.push(e.InnerOp.decode(V,V.uint32()));break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{key:(0,l.isSet)(p.key)?(0,l.bytesFromBase64)(p.key):new Uint8Array,value:(0,l.isSet)(p.value)?(0,l.bytesFromBase64)(p.value):new Uint8Array,leaf:(0,l.isSet)(p.leaf)?e.LeafOp.fromJSON(p.leaf):void 0,path:Array.isArray(p==null?void 0:p.path)?p.path.map(L=>e.InnerOp.fromJSON(L)):[]}},toJSON(p){let L={};return p.key!==void 0&&(L.key=(0,l.base64FromBytes)(p.key!==void 0?p.key:new Uint8Array)),p.value!==void 0&&(L.value=(0,l.base64FromBytes)(p.value!==void 0?p.value:new Uint8Array)),p.leaf!==void 0&&(L.leaf=p.leaf?e.LeafOp.toJSON(p.leaf):void 0),p.path?L.path=p.path.map(V=>V?e.InnerOp.toJSON(V):void 0):L.path=[],L},fromPartial(p){var V,K,m;let L=v();return L.key=(V=p.key)!=null?V:new Uint8Array,L.value=(K=p.value)!=null?K:new Uint8Array,L.leaf=p.leaf!==void 0&&p.leaf!==null?e.LeafOp.fromPartial(p.leaf):void 0,L.path=((m=p.path)==null?void 0:m.map(h=>e.InnerOp.fromPartial(h)))||[],L}};function ne(){return{key:new Uint8Array,left:void 0,right:void 0}}e.NonExistenceProof={encode(p,L=f.Writer.create()){return p.key.length!==0&&L.uint32(10).bytes(p.key),p.left!==void 0&&e.ExistenceProof.encode(p.left,L.uint32(18).fork()).ldelim(),p.right!==void 0&&e.ExistenceProof.encode(p.right,L.uint32(26).fork()).ldelim(),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=ne();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.key=V.bytes();break;case 2:m.left=e.ExistenceProof.decode(V,V.uint32());break;case 3:m.right=e.ExistenceProof.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{key:(0,l.isSet)(p.key)?(0,l.bytesFromBase64)(p.key):new Uint8Array,left:(0,l.isSet)(p.left)?e.ExistenceProof.fromJSON(p.left):void 0,right:(0,l.isSet)(p.right)?e.ExistenceProof.fromJSON(p.right):void 0}},toJSON(p){let L={};return p.key!==void 0&&(L.key=(0,l.base64FromBytes)(p.key!==void 0?p.key:new Uint8Array)),p.left!==void 0&&(L.left=p.left?e.ExistenceProof.toJSON(p.left):void 0),p.right!==void 0&&(L.right=p.right?e.ExistenceProof.toJSON(p.right):void 0),L},fromPartial(p){var V;let L=ne();return L.key=(V=p.key)!=null?V:new Uint8Array,L.left=p.left!==void 0&&p.left!==null?e.ExistenceProof.fromPartial(p.left):void 0,L.right=p.right!==void 0&&p.right!==null?e.ExistenceProof.fromPartial(p.right):void 0,L}};function Z(){return{exist:void 0,nonexist:void 0,batch:void 0,compressed:void 0}}e.CommitmentProof={encode(p,L=f.Writer.create()){return p.exist!==void 0&&e.ExistenceProof.encode(p.exist,L.uint32(10).fork()).ldelim(),p.nonexist!==void 0&&e.NonExistenceProof.encode(p.nonexist,L.uint32(18).fork()).ldelim(),p.batch!==void 0&&e.BatchProof.encode(p.batch,L.uint32(26).fork()).ldelim(),p.compressed!==void 0&&e.CompressedBatchProof.encode(p.compressed,L.uint32(34).fork()).ldelim(),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=Z();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.exist=e.ExistenceProof.decode(V,V.uint32());break;case 2:m.nonexist=e.NonExistenceProof.decode(V,V.uint32());break;case 3:m.batch=e.BatchProof.decode(V,V.uint32());break;case 4:m.compressed=e.CompressedBatchProof.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{exist:(0,l.isSet)(p.exist)?e.ExistenceProof.fromJSON(p.exist):void 0,nonexist:(0,l.isSet)(p.nonexist)?e.NonExistenceProof.fromJSON(p.nonexist):void 0,batch:(0,l.isSet)(p.batch)?e.BatchProof.fromJSON(p.batch):void 0,compressed:(0,l.isSet)(p.compressed)?e.CompressedBatchProof.fromJSON(p.compressed):void 0}},toJSON(p){let L={};return p.exist!==void 0&&(L.exist=p.exist?e.ExistenceProof.toJSON(p.exist):void 0),p.nonexist!==void 0&&(L.nonexist=p.nonexist?e.NonExistenceProof.toJSON(p.nonexist):void 0),p.batch!==void 0&&(L.batch=p.batch?e.BatchProof.toJSON(p.batch):void 0),p.compressed!==void 0&&(L.compressed=p.compressed?e.CompressedBatchProof.toJSON(p.compressed):void 0),L},fromPartial(p){let L=Z();return L.exist=p.exist!==void 0&&p.exist!==null?e.ExistenceProof.fromPartial(p.exist):void 0,L.nonexist=p.nonexist!==void 0&&p.nonexist!==null?e.NonExistenceProof.fromPartial(p.nonexist):void 0,L.batch=p.batch!==void 0&&p.batch!==null?e.BatchProof.fromPartial(p.batch):void 0,L.compressed=p.compressed!==void 0&&p.compressed!==null?e.CompressedBatchProof.fromPartial(p.compressed):void 0,L}};function R(){return{hash:0,prehashKey:0,prehashValue:0,length:0,prefix:new Uint8Array}}e.LeafOp={encode(p,L=f.Writer.create()){return p.hash!==0&&L.uint32(8).int32(p.hash),p.prehashKey!==0&&L.uint32(16).int32(p.prehashKey),p.prehashValue!==0&&L.uint32(24).int32(p.prehashValue),p.length!==0&&L.uint32(32).int32(p.length),p.prefix.length!==0&&L.uint32(42).bytes(p.prefix),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=R();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.hash=V.int32();break;case 2:m.prehashKey=V.int32();break;case 3:m.prehashValue=V.int32();break;case 4:m.length=V.int32();break;case 5:m.prefix=V.bytes();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{hash:(0,l.isSet)(p.hash)?w(p.hash):0,prehashKey:(0,l.isSet)(p.prehashKey)?w(p.prehashKey):0,prehashValue:(0,l.isSet)(p.prehashValue)?w(p.prehashValue):0,length:(0,l.isSet)(p.length)?j(p.length):0,prefix:(0,l.isSet)(p.prefix)?(0,l.bytesFromBase64)(p.prefix):new Uint8Array}},toJSON(p){let L={};return p.hash!==void 0&&(L.hash=N(p.hash)),p.prehashKey!==void 0&&(L.prehashKey=N(p.prehashKey)),p.prehashValue!==void 0&&(L.prehashValue=N(p.prehashValue)),p.length!==void 0&&(L.length=te(p.length)),p.prefix!==void 0&&(L.prefix=(0,l.base64FromBytes)(p.prefix!==void 0?p.prefix:new Uint8Array)),L},fromPartial(p){var V,K,m,h,_;let L=R();return L.hash=(V=p.hash)!=null?V:0,L.prehashKey=(K=p.prehashKey)!=null?K:0,L.prehashValue=(m=p.prehashValue)!=null?m:0,L.length=(h=p.length)!=null?h:0,L.prefix=(_=p.prefix)!=null?_:new Uint8Array,L}};function M(){return{hash:0,prefix:new Uint8Array,suffix:new Uint8Array}}e.InnerOp={encode(p,L=f.Writer.create()){return p.hash!==0&&L.uint32(8).int32(p.hash),p.prefix.length!==0&&L.uint32(18).bytes(p.prefix),p.suffix.length!==0&&L.uint32(26).bytes(p.suffix),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=M();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.hash=V.int32();break;case 2:m.prefix=V.bytes();break;case 3:m.suffix=V.bytes();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{hash:(0,l.isSet)(p.hash)?w(p.hash):0,prefix:(0,l.isSet)(p.prefix)?(0,l.bytesFromBase64)(p.prefix):new Uint8Array,suffix:(0,l.isSet)(p.suffix)?(0,l.bytesFromBase64)(p.suffix):new Uint8Array}},toJSON(p){let L={};return p.hash!==void 0&&(L.hash=N(p.hash)),p.prefix!==void 0&&(L.prefix=(0,l.base64FromBytes)(p.prefix!==void 0?p.prefix:new Uint8Array)),p.suffix!==void 0&&(L.suffix=(0,l.base64FromBytes)(p.suffix!==void 0?p.suffix:new Uint8Array)),L},fromPartial(p){var V,K,m;let L=M();return L.hash=(V=p.hash)!=null?V:0,L.prefix=(K=p.prefix)!=null?K:new Uint8Array,L.suffix=(m=p.suffix)!=null?m:new Uint8Array,L}};function U(){return{leafSpec:void 0,innerSpec:void 0,maxDepth:0,minDepth:0}}e.ProofSpec={encode(p,L=f.Writer.create()){return p.leafSpec!==void 0&&e.LeafOp.encode(p.leafSpec,L.uint32(10).fork()).ldelim(),p.innerSpec!==void 0&&e.InnerSpec.encode(p.innerSpec,L.uint32(18).fork()).ldelim(),p.maxDepth!==0&&L.uint32(24).int32(p.maxDepth),p.minDepth!==0&&L.uint32(32).int32(p.minDepth),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=U();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.leafSpec=e.LeafOp.decode(V,V.uint32());break;case 2:m.innerSpec=e.InnerSpec.decode(V,V.uint32());break;case 3:m.maxDepth=V.int32();break;case 4:m.minDepth=V.int32();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{leafSpec:(0,l.isSet)(p.leafSpec)?e.LeafOp.fromJSON(p.leafSpec):void 0,innerSpec:(0,l.isSet)(p.innerSpec)?e.InnerSpec.fromJSON(p.innerSpec):void 0,maxDepth:(0,l.isSet)(p.maxDepth)?Number(p.maxDepth):0,minDepth:(0,l.isSet)(p.minDepth)?Number(p.minDepth):0}},toJSON(p){let L={};return p.leafSpec!==void 0&&(L.leafSpec=p.leafSpec?e.LeafOp.toJSON(p.leafSpec):void 0),p.innerSpec!==void 0&&(L.innerSpec=p.innerSpec?e.InnerSpec.toJSON(p.innerSpec):void 0),p.maxDepth!==void 0&&(L.maxDepth=Math.round(p.maxDepth)),p.minDepth!==void 0&&(L.minDepth=Math.round(p.minDepth)),L},fromPartial(p){var V,K;let L=U();return L.leafSpec=p.leafSpec!==void 0&&p.leafSpec!==null?e.LeafOp.fromPartial(p.leafSpec):void 0,L.innerSpec=p.innerSpec!==void 0&&p.innerSpec!==null?e.InnerSpec.fromPartial(p.innerSpec):void 0,L.maxDepth=(V=p.maxDepth)!=null?V:0,L.minDepth=(K=p.minDepth)!=null?K:0,L}};function E(){return{childOrder:[],childSize:0,minPrefixLength:0,maxPrefixLength:0,emptyChild:new Uint8Array,hash:0}}e.InnerSpec={encode(p,L=f.Writer.create()){L.uint32(10).fork();for(let V of p.childOrder)L.int32(V);return L.ldelim(),p.childSize!==0&&L.uint32(16).int32(p.childSize),p.minPrefixLength!==0&&L.uint32(24).int32(p.minPrefixLength),p.maxPrefixLength!==0&&L.uint32(32).int32(p.maxPrefixLength),p.emptyChild.length!==0&&L.uint32(42).bytes(p.emptyChild),p.hash!==0&&L.uint32(48).int32(p.hash),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=E();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:if((h&7)===2){let _=V.uint32()+V.pos;for(;V.pos<_;)m.childOrder.push(V.int32())}else m.childOrder.push(V.int32());break;case 2:m.childSize=V.int32();break;case 3:m.minPrefixLength=V.int32();break;case 4:m.maxPrefixLength=V.int32();break;case 5:m.emptyChild=V.bytes();break;case 6:m.hash=V.int32();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{childOrder:Array.isArray(p==null?void 0:p.childOrder)?p.childOrder.map(L=>Number(L)):[],childSize:(0,l.isSet)(p.childSize)?Number(p.childSize):0,minPrefixLength:(0,l.isSet)(p.minPrefixLength)?Number(p.minPrefixLength):0,maxPrefixLength:(0,l.isSet)(p.maxPrefixLength)?Number(p.maxPrefixLength):0,emptyChild:(0,l.isSet)(p.emptyChild)?(0,l.bytesFromBase64)(p.emptyChild):new Uint8Array,hash:(0,l.isSet)(p.hash)?w(p.hash):0}},toJSON(p){let L={};return p.childOrder?L.childOrder=p.childOrder.map(V=>Math.round(V)):L.childOrder=[],p.childSize!==void 0&&(L.childSize=Math.round(p.childSize)),p.minPrefixLength!==void 0&&(L.minPrefixLength=Math.round(p.minPrefixLength)),p.maxPrefixLength!==void 0&&(L.maxPrefixLength=Math.round(p.maxPrefixLength)),p.emptyChild!==void 0&&(L.emptyChild=(0,l.base64FromBytes)(p.emptyChild!==void 0?p.emptyChild:new Uint8Array)),p.hash!==void 0&&(L.hash=N(p.hash)),L},fromPartial(p){var V,K,m,h,_,b;let L=E();return L.childOrder=((V=p.childOrder)==null?void 0:V.map(O=>O))||[],L.childSize=(K=p.childSize)!=null?K:0,L.minPrefixLength=(m=p.minPrefixLength)!=null?m:0,L.maxPrefixLength=(h=p.maxPrefixLength)!=null?h:0,L.emptyChild=(_=p.emptyChild)!=null?_:new Uint8Array,L.hash=(b=p.hash)!=null?b:0,L}};function Q(){return{entries:[]}}e.BatchProof={encode(p,L=f.Writer.create()){for(let V of p.entries)e.BatchEntry.encode(V,L.uint32(10).fork()).ldelim();return L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=Q();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.entries.push(e.BatchEntry.decode(V,V.uint32()));break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{entries:Array.isArray(p==null?void 0:p.entries)?p.entries.map(L=>e.BatchEntry.fromJSON(L)):[]}},toJSON(p){let L={};return p.entries?L.entries=p.entries.map(V=>V?e.BatchEntry.toJSON(V):void 0):L.entries=[],L},fromPartial(p){var V;let L=Q();return L.entries=((V=p.entries)==null?void 0:V.map(K=>e.BatchEntry.fromPartial(K)))||[],L}};function H(){return{exist:void 0,nonexist:void 0}}e.BatchEntry={encode(p,L=f.Writer.create()){return p.exist!==void 0&&e.ExistenceProof.encode(p.exist,L.uint32(10).fork()).ldelim(),p.nonexist!==void 0&&e.NonExistenceProof.encode(p.nonexist,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=H();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.exist=e.ExistenceProof.decode(V,V.uint32());break;case 2:m.nonexist=e.NonExistenceProof.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{exist:(0,l.isSet)(p.exist)?e.ExistenceProof.fromJSON(p.exist):void 0,nonexist:(0,l.isSet)(p.nonexist)?e.NonExistenceProof.fromJSON(p.nonexist):void 0}},toJSON(p){let L={};return p.exist!==void 0&&(L.exist=p.exist?e.ExistenceProof.toJSON(p.exist):void 0),p.nonexist!==void 0&&(L.nonexist=p.nonexist?e.NonExistenceProof.toJSON(p.nonexist):void 0),L},fromPartial(p){let L=H();return L.exist=p.exist!==void 0&&p.exist!==null?e.ExistenceProof.fromPartial(p.exist):void 0,L.nonexist=p.nonexist!==void 0&&p.nonexist!==null?e.NonExistenceProof.fromPartial(p.nonexist):void 0,L}};function re(){return{entries:[],lookupInners:[]}}e.CompressedBatchProof={encode(p,L=f.Writer.create()){for(let V of p.entries)e.CompressedBatchEntry.encode(V,L.uint32(10).fork()).ldelim();for(let V of p.lookupInners)e.InnerOp.encode(V,L.uint32(18).fork()).ldelim();return L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=re();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.entries.push(e.CompressedBatchEntry.decode(V,V.uint32()));break;case 2:m.lookupInners.push(e.InnerOp.decode(V,V.uint32()));break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{entries:Array.isArray(p==null?void 0:p.entries)?p.entries.map(L=>e.CompressedBatchEntry.fromJSON(L)):[],lookupInners:Array.isArray(p==null?void 0:p.lookupInners)?p.lookupInners.map(L=>e.InnerOp.fromJSON(L)):[]}},toJSON(p){let L={};return p.entries?L.entries=p.entries.map(V=>V?e.CompressedBatchEntry.toJSON(V):void 0):L.entries=[],p.lookupInners?L.lookupInners=p.lookupInners.map(V=>V?e.InnerOp.toJSON(V):void 0):L.lookupInners=[],L},fromPartial(p){var V,K;let L=re();return L.entries=((V=p.entries)==null?void 0:V.map(m=>e.CompressedBatchEntry.fromPartial(m)))||[],L.lookupInners=((K=p.lookupInners)==null?void 0:K.map(m=>e.InnerOp.fromPartial(m)))||[],L}};function ee(){return{exist:void 0,nonexist:void 0}}e.CompressedBatchEntry={encode(p,L=f.Writer.create()){return p.exist!==void 0&&e.CompressedExistenceProof.encode(p.exist,L.uint32(10).fork()).ldelim(),p.nonexist!==void 0&&e.CompressedNonExistenceProof.encode(p.nonexist,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=ee();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.exist=e.CompressedExistenceProof.decode(V,V.uint32());break;case 2:m.nonexist=e.CompressedNonExistenceProof.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{exist:(0,l.isSet)(p.exist)?e.CompressedExistenceProof.fromJSON(p.exist):void 0,nonexist:(0,l.isSet)(p.nonexist)?e.CompressedNonExistenceProof.fromJSON(p.nonexist):void 0}},toJSON(p){let L={};return p.exist!==void 0&&(L.exist=p.exist?e.CompressedExistenceProof.toJSON(p.exist):void 0),p.nonexist!==void 0&&(L.nonexist=p.nonexist?e.CompressedNonExistenceProof.toJSON(p.nonexist):void 0),L},fromPartial(p){let L=ee();return L.exist=p.exist!==void 0&&p.exist!==null?e.CompressedExistenceProof.fromPartial(p.exist):void 0,L.nonexist=p.nonexist!==void 0&&p.nonexist!==null?e.CompressedNonExistenceProof.fromPartial(p.nonexist):void 0,L}};function T(){return{key:new Uint8Array,value:new Uint8Array,leaf:void 0,path:[]}}e.CompressedExistenceProof={encode(p,L=f.Writer.create()){p.key.length!==0&&L.uint32(10).bytes(p.key),p.value.length!==0&&L.uint32(18).bytes(p.value),p.leaf!==void 0&&e.LeafOp.encode(p.leaf,L.uint32(26).fork()).ldelim(),L.uint32(34).fork();for(let V of p.path)L.int32(V);return L.ldelim(),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=T();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.key=V.bytes();break;case 2:m.value=V.bytes();break;case 3:m.leaf=e.LeafOp.decode(V,V.uint32());break;case 4:if((h&7)===2){let _=V.uint32()+V.pos;for(;V.pos<_;)m.path.push(V.int32())}else m.path.push(V.int32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{key:(0,l.isSet)(p.key)?(0,l.bytesFromBase64)(p.key):new Uint8Array,value:(0,l.isSet)(p.value)?(0,l.bytesFromBase64)(p.value):new Uint8Array,leaf:(0,l.isSet)(p.leaf)?e.LeafOp.fromJSON(p.leaf):void 0,path:Array.isArray(p==null?void 0:p.path)?p.path.map(L=>Number(L)):[]}},toJSON(p){let L={};return p.key!==void 0&&(L.key=(0,l.base64FromBytes)(p.key!==void 0?p.key:new Uint8Array)),p.value!==void 0&&(L.value=(0,l.base64FromBytes)(p.value!==void 0?p.value:new Uint8Array)),p.leaf!==void 0&&(L.leaf=p.leaf?e.LeafOp.toJSON(p.leaf):void 0),p.path?L.path=p.path.map(V=>Math.round(V)):L.path=[],L},fromPartial(p){var V,K,m;let L=T();return L.key=(V=p.key)!=null?V:new Uint8Array,L.value=(K=p.value)!=null?K:new Uint8Array,L.leaf=p.leaf!==void 0&&p.leaf!==null?e.LeafOp.fromPartial(p.leaf):void 0,L.path=((m=p.path)==null?void 0:m.map(h=>h))||[],L}};function se(){return{key:new Uint8Array,left:void 0,right:void 0}}e.CompressedNonExistenceProof={encode(p,L=f.Writer.create()){return p.key.length!==0&&L.uint32(10).bytes(p.key),p.left!==void 0&&e.CompressedExistenceProof.encode(p.left,L.uint32(18).fork()).ldelim(),p.right!==void 0&&e.CompressedExistenceProof.encode(p.right,L.uint32(26).fork()).ldelim(),L},decode(p,L){let V=p instanceof f.Reader?p:new f.Reader(p),K=L===void 0?V.len:V.pos+L,m=se();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.key=V.bytes();break;case 2:m.left=e.CompressedExistenceProof.decode(V,V.uint32());break;case 3:m.right=e.CompressedExistenceProof.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{key:(0,l.isSet)(p.key)?(0,l.bytesFromBase64)(p.key):new Uint8Array,left:(0,l.isSet)(p.left)?e.CompressedExistenceProof.fromJSON(p.left):void 0,right:(0,l.isSet)(p.right)?e.CompressedExistenceProof.fromJSON(p.right):void 0}},toJSON(p){let L={};return p.key!==void 0&&(L.key=(0,l.base64FromBytes)(p.key!==void 0?p.key:new Uint8Array)),p.left!==void 0&&(L.left=p.left?e.CompressedExistenceProof.toJSON(p.left):void 0),p.right!==void 0&&(L.right=p.right?e.CompressedExistenceProof.toJSON(p.right):void 0),L},fromPartial(p){var V;let L=se();return L.key=(V=p.key)!=null?V:new Uint8Array,L.left=p.left!==void 0&&p.left!==null?e.CompressedExistenceProof.fromPartial(p.left):void 0,L.right=p.right!==void 0&&p.right!==null?e.CompressedExistenceProof.fromPartial(p.right):void 0,L}}})(CIn);var E8s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),B8s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),v8s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&E8s(i,e,A);return B8s(i,e),i};Object.defineProperty(DR,"__esModule",{value:!0});DR.MerkleProof=DR.MerklePath=DR.MerklePrefix=DR.MerkleRoot=DR.protobufPackage=void 0;var GHe=CIn,UM=v8s(BA),O8e=Ns;DR.protobufPackage="ibc.core.commitment.v1";function yLr(){return{hash:new Uint8Array}}DR.MerkleRoot={encode(e,i=UM.Writer.create()){return e.hash.length!==0&&i.uint32(10).bytes(e.hash),i},decode(e,i){let A=e instanceof UM.Reader?e:new UM.Reader(e),c=i===void 0?A.len:A.pos+i,f=yLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.hash=A.bytes();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{hash:(0,O8e.isSet)(e.hash)?(0,O8e.bytesFromBase64)(e.hash):new Uint8Array}},toJSON(e){let i={};return e.hash!==void 0&&(i.hash=(0,O8e.base64FromBytes)(e.hash!==void 0?e.hash:new Uint8Array)),i},fromPartial(e){var A;let i=yLr();return i.hash=(A=e.hash)!=null?A:new Uint8Array,i}};function mLr(){return{keyPrefix:new Uint8Array}}DR.MerklePrefix={encode(e,i=UM.Writer.create()){return e.keyPrefix.length!==0&&i.uint32(10).bytes(e.keyPrefix),i},decode(e,i){let A=e instanceof UM.Reader?e:new UM.Reader(e),c=i===void 0?A.len:A.pos+i,f=mLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.keyPrefix=A.bytes();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{keyPrefix:(0,O8e.isSet)(e.keyPrefix)?(0,O8e.bytesFromBase64)(e.keyPrefix):new Uint8Array}},toJSON(e){let i={};return e.keyPrefix!==void 0&&(i.keyPrefix=(0,O8e.base64FromBytes)(e.keyPrefix!==void 0?e.keyPrefix:new Uint8Array)),i},fromPartial(e){var A;let i=mLr();return i.keyPrefix=(A=e.keyPrefix)!=null?A:new Uint8Array,i}};function ILr(){return{keyPath:[]}}DR.MerklePath={encode(e,i=UM.Writer.create()){for(let A of e.keyPath)i.uint32(10).string(A);return i},decode(e,i){let A=e instanceof UM.Reader?e:new UM.Reader(e),c=i===void 0?A.len:A.pos+i,f=ILr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.keyPath.push(A.string());break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{keyPath:Array.isArray(e==null?void 0:e.keyPath)?e.keyPath.map(i=>String(i)):[]}},toJSON(e){let i={};return e.keyPath?i.keyPath=e.keyPath.map(A=>A):i.keyPath=[],i},fromPartial(e){var A;let i=ILr();return i.keyPath=((A=e.keyPath)==null?void 0:A.map(c=>c))||[],i}};function CLr(){return{proofs:[]}}DR.MerkleProof={encode(e,i=UM.Writer.create()){for(let A of e.proofs)GHe.CommitmentProof.encode(A,i.uint32(10).fork()).ldelim();return i},decode(e,i){let A=e instanceof UM.Reader?e:new UM.Reader(e),c=i===void 0?A.len:A.pos+i,f=CLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.proofs.push(GHe.CommitmentProof.decode(A,A.uint32()));break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{proofs:Array.isArray(e==null?void 0:e.proofs)?e.proofs.map(i=>GHe.CommitmentProof.fromJSON(i)):[]}},toJSON(e){let i={};return e.proofs?i.proofs=e.proofs.map(A=>A?GHe.CommitmentProof.toJSON(A):void 0):i.proofs=[],i},fromPartial(e){var A;let i=CLr();return i.proofs=((A=e.proofs)==null?void 0:A.map(c=>GHe.CommitmentProof.fromPartial(c)))||[],i}};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(U,E,Q,H){H===void 0&&(H=Q);var re=Object.getOwnPropertyDescriptor(E,Q);(!re||("get"in re?!E.__esModule:re.writable||re.configurable))&&(re={enumerable:!0,get:function(){return E[Q]}}),Object.defineProperty(U,H,re)}:function(U,E,Q,H){H===void 0&&(H=Q),U[H]=E[Q]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(U,E){Object.defineProperty(U,"default",{enumerable:!0,value:E})}:function(U,E){U.default=E}),c=Fr&&Fr.__importStar||function(U){if(U&&U.__esModule)return U;var E={};if(U!=null)for(var Q in U)Q!=="default"&&Object.prototype.hasOwnProperty.call(U,Q)&&i(E,U,Q);return A(E,U),E};Object.defineProperty(e,"__esModule",{value:!0}),e.Params=e.Version=e.ConnectionPaths=e.ClientPaths=e.Counterparty=e.IdentifiedConnection=e.ConnectionEnd=e.stateToJSON=e.stateFromJSON=e.State=e.protobufPackage=void 0;let f=DR,l=Ns,g=c(BA);e.protobufPackage="ibc.core.connection.v1";var w;(function(U){U[U.STATE_UNINITIALIZED_UNSPECIFIED=0]="STATE_UNINITIALIZED_UNSPECIFIED",U[U.STATE_INIT=1]="STATE_INIT",U[U.STATE_TRYOPEN=2]="STATE_TRYOPEN",U[U.STATE_OPEN=3]="STATE_OPEN",U[U.UNRECOGNIZED=-1]="UNRECOGNIZED"})(w=e.State||(e.State={}));function N(U){switch(U){case 0:case"STATE_UNINITIALIZED_UNSPECIFIED":return w.STATE_UNINITIALIZED_UNSPECIFIED;case 1:case"STATE_INIT":return w.STATE_INIT;case 2:case"STATE_TRYOPEN":return w.STATE_TRYOPEN;case 3:case"STATE_OPEN":return w.STATE_OPEN;case-1:case"UNRECOGNIZED":default:return w.UNRECOGNIZED}}e.stateFromJSON=N;function F(U){switch(U){case w.STATE_UNINITIALIZED_UNSPECIFIED:return"STATE_UNINITIALIZED_UNSPECIFIED";case w.STATE_INIT:return"STATE_INIT";case w.STATE_TRYOPEN:return"STATE_TRYOPEN";case w.STATE_OPEN:return"STATE_OPEN";case w.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.stateToJSON=F;function j(){return{clientId:"",versions:[],state:0,counterparty:void 0,delayPeriod:l.Long.UZERO}}e.ConnectionEnd={encode(U,E=g.Writer.create()){U.clientId!==""&&E.uint32(10).string(U.clientId);for(let Q of U.versions)e.Version.encode(Q,E.uint32(18).fork()).ldelim();return U.state!==0&&E.uint32(24).int32(U.state),U.counterparty!==void 0&&e.Counterparty.encode(U.counterparty,E.uint32(34).fork()).ldelim(),U.delayPeriod.isZero()||E.uint32(40).uint64(U.delayPeriod),E},decode(U,E){let Q=U instanceof g.Reader?U:new g.Reader(U),H=E===void 0?Q.len:Q.pos+E,re=j();for(;Q.pos<H;){let ee=Q.uint32();switch(ee>>>3){case 1:re.clientId=Q.string();break;case 2:re.versions.push(e.Version.decode(Q,Q.uint32()));break;case 3:re.state=Q.int32();break;case 4:re.counterparty=e.Counterparty.decode(Q,Q.uint32());break;case 5:re.delayPeriod=Q.uint64();break;default:Q.skipType(ee&7);break}}return re},fromJSON(U){return{clientId:(0,l.isSet)(U.clientId)?String(U.clientId):"",versions:Array.isArray(U==null?void 0:U.versions)?U.versions.map(E=>e.Version.fromJSON(E)):[],state:(0,l.isSet)(U.state)?N(U.state):0,counterparty:(0,l.isSet)(U.counterparty)?e.Counterparty.fromJSON(U.counterparty):void 0,delayPeriod:(0,l.isSet)(U.delayPeriod)?l.Long.fromValue(U.delayPeriod):l.Long.UZERO}},toJSON(U){let E={};return U.clientId!==void 0&&(E.clientId=U.clientId),U.versions?E.versions=U.versions.map(Q=>Q?e.Version.toJSON(Q):void 0):E.versions=[],U.state!==void 0&&(E.state=F(U.state)),U.counterparty!==void 0&&(E.counterparty=U.counterparty?e.Counterparty.toJSON(U.counterparty):void 0),U.delayPeriod!==void 0&&(E.delayPeriod=(U.delayPeriod||l.Long.UZERO).toString()),E},fromPartial(U){var Q,H,re;let E=j();return E.clientId=(Q=U.clientId)!=null?Q:"",E.versions=((H=U.versions)==null?void 0:H.map(ee=>e.Version.fromPartial(ee)))||[],E.state=(re=U.state)!=null?re:0,E.counterparty=U.counterparty!==void 0&&U.counterparty!==null?e.Counterparty.fromPartial(U.counterparty):void 0,E.delayPeriod=U.delayPeriod!==void 0&&U.delayPeriod!==null?l.Long.fromValue(U.delayPeriod):l.Long.UZERO,E}};function te(){return{id:"",clientId:"",versions:[],state:0,counterparty:void 0,delayPeriod:l.Long.UZERO}}e.IdentifiedConnection={encode(U,E=g.Writer.create()){U.id!==""&&E.uint32(10).string(U.id),U.clientId!==""&&E.uint32(18).string(U.clientId);for(let Q of U.versions)e.Version.encode(Q,E.uint32(26).fork()).ldelim();return U.state!==0&&E.uint32(32).int32(U.state),U.counterparty!==void 0&&e.Counterparty.encode(U.counterparty,E.uint32(42).fork()).ldelim(),U.delayPeriod.isZero()||E.uint32(48).uint64(U.delayPeriod),E},decode(U,E){let Q=U instanceof g.Reader?U:new g.Reader(U),H=E===void 0?Q.len:Q.pos+E,re=te();for(;Q.pos<H;){let ee=Q.uint32();switch(ee>>>3){case 1:re.id=Q.string();break;case 2:re.clientId=Q.string();break;case 3:re.versions.push(e.Version.decode(Q,Q.uint32()));break;case 4:re.state=Q.int32();break;case 5:re.counterparty=e.Counterparty.decode(Q,Q.uint32());break;case 6:re.delayPeriod=Q.uint64();break;default:Q.skipType(ee&7);break}}return re},fromJSON(U){return{id:(0,l.isSet)(U.id)?String(U.id):"",clientId:(0,l.isSet)(U.clientId)?String(U.clientId):"",versions:Array.isArray(U==null?void 0:U.versions)?U.versions.map(E=>e.Version.fromJSON(E)):[],state:(0,l.isSet)(U.state)?N(U.state):0,counterparty:(0,l.isSet)(U.counterparty)?e.Counterparty.fromJSON(U.counterparty):void 0,delayPeriod:(0,l.isSet)(U.delayPeriod)?l.Long.fromValue(U.delayPeriod):l.Long.UZERO}},toJSON(U){let E={};return U.id!==void 0&&(E.id=U.id),U.clientId!==void 0&&(E.clientId=U.clientId),U.versions?E.versions=U.versions.map(Q=>Q?e.Version.toJSON(Q):void 0):E.versions=[],U.state!==void 0&&(E.state=F(U.state)),U.counterparty!==void 0&&(E.counterparty=U.counterparty?e.Counterparty.toJSON(U.counterparty):void 0),U.delayPeriod!==void 0&&(E.delayPeriod=(U.delayPeriod||l.Long.UZERO).toString()),E},fromPartial(U){var Q,H,re,ee;let E=te();return E.id=(Q=U.id)!=null?Q:"",E.clientId=(H=U.clientId)!=null?H:"",E.versions=((re=U.versions)==null?void 0:re.map(T=>e.Version.fromPartial(T)))||[],E.state=(ee=U.state)!=null?ee:0,E.counterparty=U.counterparty!==void 0&&U.counterparty!==null?e.Counterparty.fromPartial(U.counterparty):void 0,E.delayPeriod=U.delayPeriod!==void 0&&U.delayPeriod!==null?l.Long.fromValue(U.delayPeriod):l.Long.UZERO,E}};function v(){return{clientId:"",connectionId:"",prefix:void 0}}e.Counterparty={encode(U,E=g.Writer.create()){return U.clientId!==""&&E.uint32(10).string(U.clientId),U.connectionId!==""&&E.uint32(18).string(U.connectionId),U.prefix!==void 0&&f.MerklePrefix.encode(U.prefix,E.uint32(26).fork()).ldelim(),E},decode(U,E){let Q=U instanceof g.Reader?U:new g.Reader(U),H=E===void 0?Q.len:Q.pos+E,re=v();for(;Q.pos<H;){let ee=Q.uint32();switch(ee>>>3){case 1:re.clientId=Q.string();break;case 2:re.connectionId=Q.string();break;case 3:re.prefix=f.MerklePrefix.decode(Q,Q.uint32());break;default:Q.skipType(ee&7);break}}return re},fromJSON(U){return{clientId:(0,l.isSet)(U.clientId)?String(U.clientId):"",connectionId:(0,l.isSet)(U.connectionId)?String(U.connectionId):"",prefix:(0,l.isSet)(U.prefix)?f.MerklePrefix.fromJSON(U.prefix):void 0}},toJSON(U){let E={};return U.clientId!==void 0&&(E.clientId=U.clientId),U.connectionId!==void 0&&(E.connectionId=U.connectionId),U.prefix!==void 0&&(E.prefix=U.prefix?f.MerklePrefix.toJSON(U.prefix):void 0),E},fromPartial(U){var Q,H;let E=v();return E.clientId=(Q=U.clientId)!=null?Q:"",E.connectionId=(H=U.connectionId)!=null?H:"",E.prefix=U.prefix!==void 0&&U.prefix!==null?f.MerklePrefix.fromPartial(U.prefix):void 0,E}};function ne(){return{paths:[]}}e.ClientPaths={encode(U,E=g.Writer.create()){for(let Q of U.paths)E.uint32(10).string(Q);return E},decode(U,E){let Q=U instanceof g.Reader?U:new g.Reader(U),H=E===void 0?Q.len:Q.pos+E,re=ne();for(;Q.pos<H;){let ee=Q.uint32();switch(ee>>>3){case 1:re.paths.push(Q.string());break;default:Q.skipType(ee&7);break}}return re},fromJSON(U){return{paths:Array.isArray(U==null?void 0:U.paths)?U.paths.map(E=>String(E)):[]}},toJSON(U){let E={};return U.paths?E.paths=U.paths.map(Q=>Q):E.paths=[],E},fromPartial(U){var Q;let E=ne();return E.paths=((Q=U.paths)==null?void 0:Q.map(H=>H))||[],E}};function Z(){return{clientId:"",paths:[]}}e.ConnectionPaths={encode(U,E=g.Writer.create()){U.clientId!==""&&E.uint32(10).string(U.clientId);for(let Q of U.paths)E.uint32(18).string(Q);return E},decode(U,E){let Q=U instanceof g.Reader?U:new g.Reader(U),H=E===void 0?Q.len:Q.pos+E,re=Z();for(;Q.pos<H;){let ee=Q.uint32();switch(ee>>>3){case 1:re.clientId=Q.string();break;case 2:re.paths.push(Q.string());break;default:Q.skipType(ee&7);break}}return re},fromJSON(U){return{clientId:(0,l.isSet)(U.clientId)?String(U.clientId):"",paths:Array.isArray(U==null?void 0:U.paths)?U.paths.map(E=>String(E)):[]}},toJSON(U){let E={};return U.clientId!==void 0&&(E.clientId=U.clientId),U.paths?E.paths=U.paths.map(Q=>Q):E.paths=[],E},fromPartial(U){var Q,H;let E=Z();return E.clientId=(Q=U.clientId)!=null?Q:"",E.paths=((H=U.paths)==null?void 0:H.map(re=>re))||[],E}};function R(){return{identifier:"",features:[]}}e.Version={encode(U,E=g.Writer.create()){U.identifier!==""&&E.uint32(10).string(U.identifier);for(let Q of U.features)E.uint32(18).string(Q);return E},decode(U,E){let Q=U instanceof g.Reader?U:new g.Reader(U),H=E===void 0?Q.len:Q.pos+E,re=R();for(;Q.pos<H;){let ee=Q.uint32();switch(ee>>>3){case 1:re.identifier=Q.string();break;case 2:re.features.push(Q.string());break;default:Q.skipType(ee&7);break}}return re},fromJSON(U){return{identifier:(0,l.isSet)(U.identifier)?String(U.identifier):"",features:Array.isArray(U==null?void 0:U.features)?U.features.map(E=>String(E)):[]}},toJSON(U){let E={};return U.identifier!==void 0&&(E.identifier=U.identifier),U.features?E.features=U.features.map(Q=>Q):E.features=[],E},fromPartial(U){var Q,H;let E=R();return E.identifier=(Q=U.identifier)!=null?Q:"",E.features=((H=U.features)==null?void 0:H.map(re=>re))||[],E}};function M(){return{maxExpectedTimePerBlock:l.Long.UZERO}}e.Params={encode(U,E=g.Writer.create()){return U.maxExpectedTimePerBlock.isZero()||E.uint32(8).uint64(U.maxExpectedTimePerBlock),E},decode(U,E){let Q=U instanceof g.Reader?U:new g.Reader(U),H=E===void 0?Q.len:Q.pos+E,re=M();for(;Q.pos<H;){let ee=Q.uint32();switch(ee>>>3){case 1:re.maxExpectedTimePerBlock=Q.uint64();break;default:Q.skipType(ee&7);break}}return re},fromJSON(U){return{maxExpectedTimePerBlock:(0,l.isSet)(U.maxExpectedTimePerBlock)?l.Long.fromValue(U.maxExpectedTimePerBlock):l.Long.UZERO}},toJSON(U){let E={};return U.maxExpectedTimePerBlock!==void 0&&(E.maxExpectedTimePerBlock=(U.maxExpectedTimePerBlock||l.Long.UZERO).toString()),E},fromPartial(U){let E=M();return E.maxExpectedTimePerBlock=U.maxExpectedTimePerBlock!==void 0&&U.maxExpectedTimePerBlock!==null?l.Long.fromValue(U.maxExpectedTimePerBlock):l.Long.UZERO,E}}})(IIn);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(E,Q,H,re){re===void 0&&(re=H);var ee=Object.getOwnPropertyDescriptor(Q,H);(!ee||("get"in ee?!Q.__esModule:ee.writable||ee.configurable))&&(ee={enumerable:!0,get:function(){return Q[H]}}),Object.defineProperty(E,re,ee)}:function(E,Q,H,re){re===void 0&&(re=H),E[re]=Q[H]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(E,Q){Object.defineProperty(E,"default",{enumerable:!0,value:Q})}:function(E,Q){E.default=Q}),c=Fr&&Fr.__importStar||function(E){if(E&&E.__esModule)return E;var Q={};if(E!=null)for(var H in E)H!=="default"&&Object.prototype.hasOwnProperty.call(E,H)&&i(Q,E,H);return A(Q,E),Q};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgConnectionOpenConfirmResponse=e.MsgConnectionOpenConfirm=e.MsgConnectionOpenAckResponse=e.MsgConnectionOpenAck=e.MsgConnectionOpenTryResponse=e.MsgConnectionOpenTry=e.MsgConnectionOpenInitResponse=e.MsgConnectionOpenInit=e.protobufPackage=void 0;let f=IIn,l=fh,g=lW,w=Ns,N=c(BA);e.protobufPackage="ibc.core.connection.v1";function F(){return{clientId:"",counterparty:void 0,version:void 0,delayPeriod:w.Long.UZERO,signer:""}}e.MsgConnectionOpenInit={encode(E,Q=N.Writer.create()){return E.clientId!==""&&Q.uint32(10).string(E.clientId),E.counterparty!==void 0&&f.Counterparty.encode(E.counterparty,Q.uint32(18).fork()).ldelim(),E.version!==void 0&&f.Version.encode(E.version,Q.uint32(26).fork()).ldelim(),E.delayPeriod.isZero()||Q.uint32(32).uint64(E.delayPeriod),E.signer!==""&&Q.uint32(42).string(E.signer),Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=F();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.clientId=H.string();break;case 2:ee.counterparty=f.Counterparty.decode(H,H.uint32());break;case 3:ee.version=f.Version.decode(H,H.uint32());break;case 4:ee.delayPeriod=H.uint64();break;case 5:ee.signer=H.string();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{clientId:(0,w.isSet)(E.clientId)?String(E.clientId):"",counterparty:(0,w.isSet)(E.counterparty)?f.Counterparty.fromJSON(E.counterparty):void 0,version:(0,w.isSet)(E.version)?f.Version.fromJSON(E.version):void 0,delayPeriod:(0,w.isSet)(E.delayPeriod)?w.Long.fromValue(E.delayPeriod):w.Long.UZERO,signer:(0,w.isSet)(E.signer)?String(E.signer):""}},toJSON(E){let Q={};return E.clientId!==void 0&&(Q.clientId=E.clientId),E.counterparty!==void 0&&(Q.counterparty=E.counterparty?f.Counterparty.toJSON(E.counterparty):void 0),E.version!==void 0&&(Q.version=E.version?f.Version.toJSON(E.version):void 0),E.delayPeriod!==void 0&&(Q.delayPeriod=(E.delayPeriod||w.Long.UZERO).toString()),E.signer!==void 0&&(Q.signer=E.signer),Q},fromPartial(E){var H,re;let Q=F();return Q.clientId=(H=E.clientId)!=null?H:"",Q.counterparty=E.counterparty!==void 0&&E.counterparty!==null?f.Counterparty.fromPartial(E.counterparty):void 0,Q.version=E.version!==void 0&&E.version!==null?f.Version.fromPartial(E.version):void 0,Q.delayPeriod=E.delayPeriod!==void 0&&E.delayPeriod!==null?w.Long.fromValue(E.delayPeriod):w.Long.UZERO,Q.signer=(re=E.signer)!=null?re:"",Q}};function j(){return{}}e.MsgConnectionOpenInitResponse={encode(E,Q=N.Writer.create()){return Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=j();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){default:H.skipType(T&7);break}}return ee},fromJSON(E){return{}},toJSON(E){return{}},fromPartial(E){return j()}};function te(){return{clientId:"",previousConnectionId:"",clientState:void 0,counterparty:void 0,delayPeriod:w.Long.UZERO,counterpartyVersions:[],proofHeight:void 0,proofInit:new Uint8Array,proofClient:new Uint8Array,proofConsensus:new Uint8Array,consensusHeight:void 0,signer:"",hostConsensusStateProof:new Uint8Array}}e.MsgConnectionOpenTry={encode(E,Q=N.Writer.create()){E.clientId!==""&&Q.uint32(10).string(E.clientId),E.previousConnectionId!==""&&Q.uint32(18).string(E.previousConnectionId),E.clientState!==void 0&&l.Any.encode(E.clientState,Q.uint32(26).fork()).ldelim(),E.counterparty!==void 0&&f.Counterparty.encode(E.counterparty,Q.uint32(34).fork()).ldelim(),E.delayPeriod.isZero()||Q.uint32(40).uint64(E.delayPeriod);for(let H of E.counterpartyVersions)f.Version.encode(H,Q.uint32(50).fork()).ldelim();return E.proofHeight!==void 0&&g.Height.encode(E.proofHeight,Q.uint32(58).fork()).ldelim(),E.proofInit.length!==0&&Q.uint32(66).bytes(E.proofInit),E.proofClient.length!==0&&Q.uint32(74).bytes(E.proofClient),E.proofConsensus.length!==0&&Q.uint32(82).bytes(E.proofConsensus),E.consensusHeight!==void 0&&g.Height.encode(E.consensusHeight,Q.uint32(90).fork()).ldelim(),E.signer!==""&&Q.uint32(98).string(E.signer),E.hostConsensusStateProof.length!==0&&Q.uint32(106).bytes(E.hostConsensusStateProof),Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=te();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.clientId=H.string();break;case 2:ee.previousConnectionId=H.string();break;case 3:ee.clientState=l.Any.decode(H,H.uint32());break;case 4:ee.counterparty=f.Counterparty.decode(H,H.uint32());break;case 5:ee.delayPeriod=H.uint64();break;case 6:ee.counterpartyVersions.push(f.Version.decode(H,H.uint32()));break;case 7:ee.proofHeight=g.Height.decode(H,H.uint32());break;case 8:ee.proofInit=H.bytes();break;case 9:ee.proofClient=H.bytes();break;case 10:ee.proofConsensus=H.bytes();break;case 11:ee.consensusHeight=g.Height.decode(H,H.uint32());break;case 12:ee.signer=H.string();break;case 13:ee.hostConsensusStateProof=H.bytes();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{clientId:(0,w.isSet)(E.clientId)?String(E.clientId):"",previousConnectionId:(0,w.isSet)(E.previousConnectionId)?String(E.previousConnectionId):"",clientState:(0,w.isSet)(E.clientState)?l.Any.fromJSON(E.clientState):void 0,counterparty:(0,w.isSet)(E.counterparty)?f.Counterparty.fromJSON(E.counterparty):void 0,delayPeriod:(0,w.isSet)(E.delayPeriod)?w.Long.fromValue(E.delayPeriod):w.Long.UZERO,counterpartyVersions:Array.isArray(E==null?void 0:E.counterpartyVersions)?E.counterpartyVersions.map(Q=>f.Version.fromJSON(Q)):[],proofHeight:(0,w.isSet)(E.proofHeight)?g.Height.fromJSON(E.proofHeight):void 0,proofInit:(0,w.isSet)(E.proofInit)?(0,w.bytesFromBase64)(E.proofInit):new Uint8Array,proofClient:(0,w.isSet)(E.proofClient)?(0,w.bytesFromBase64)(E.proofClient):new Uint8Array,proofConsensus:(0,w.isSet)(E.proofConsensus)?(0,w.bytesFromBase64)(E.proofConsensus):new Uint8Array,consensusHeight:(0,w.isSet)(E.consensusHeight)?g.Height.fromJSON(E.consensusHeight):void 0,signer:(0,w.isSet)(E.signer)?String(E.signer):"",hostConsensusStateProof:(0,w.isSet)(E.hostConsensusStateProof)?(0,w.bytesFromBase64)(E.hostConsensusStateProof):new Uint8Array}},toJSON(E){let Q={};return E.clientId!==void 0&&(Q.clientId=E.clientId),E.previousConnectionId!==void 0&&(Q.previousConnectionId=E.previousConnectionId),E.clientState!==void 0&&(Q.clientState=E.clientState?l.Any.toJSON(E.clientState):void 0),E.counterparty!==void 0&&(Q.counterparty=E.counterparty?f.Counterparty.toJSON(E.counterparty):void 0),E.delayPeriod!==void 0&&(Q.delayPeriod=(E.delayPeriod||w.Long.UZERO).toString()),E.counterpartyVersions?Q.counterpartyVersions=E.counterpartyVersions.map(H=>H?f.Version.toJSON(H):void 0):Q.counterpartyVersions=[],E.proofHeight!==void 0&&(Q.proofHeight=E.proofHeight?g.Height.toJSON(E.proofHeight):void 0),E.proofInit!==void 0&&(Q.proofInit=(0,w.base64FromBytes)(E.proofInit!==void 0?E.proofInit:new Uint8Array)),E.proofClient!==void 0&&(Q.proofClient=(0,w.base64FromBytes)(E.proofClient!==void 0?E.proofClient:new Uint8Array)),E.proofConsensus!==void 0&&(Q.proofConsensus=(0,w.base64FromBytes)(E.proofConsensus!==void 0?E.proofConsensus:new Uint8Array)),E.consensusHeight!==void 0&&(Q.consensusHeight=E.consensusHeight?g.Height.toJSON(E.consensusHeight):void 0),E.signer!==void 0&&(Q.signer=E.signer),E.hostConsensusStateProof!==void 0&&(Q.hostConsensusStateProof=(0,w.base64FromBytes)(E.hostConsensusStateProof!==void 0?E.hostConsensusStateProof:new Uint8Array)),Q},fromPartial(E){var H,re,ee,T,se,p,L,V;let Q=te();return Q.clientId=(H=E.clientId)!=null?H:"",Q.previousConnectionId=(re=E.previousConnectionId)!=null?re:"",Q.clientState=E.clientState!==void 0&&E.clientState!==null?l.Any.fromPartial(E.clientState):void 0,Q.counterparty=E.counterparty!==void 0&&E.counterparty!==null?f.Counterparty.fromPartial(E.counterparty):void 0,Q.delayPeriod=E.delayPeriod!==void 0&&E.delayPeriod!==null?w.Long.fromValue(E.delayPeriod):w.Long.UZERO,Q.counterpartyVersions=((ee=E.counterpartyVersions)==null?void 0:ee.map(K=>f.Version.fromPartial(K)))||[],Q.proofHeight=E.proofHeight!==void 0&&E.proofHeight!==null?g.Height.fromPartial(E.proofHeight):void 0,Q.proofInit=(T=E.proofInit)!=null?T:new Uint8Array,Q.proofClient=(se=E.proofClient)!=null?se:new Uint8Array,Q.proofConsensus=(p=E.proofConsensus)!=null?p:new Uint8Array,Q.consensusHeight=E.consensusHeight!==void 0&&E.consensusHeight!==null?g.Height.fromPartial(E.consensusHeight):void 0,Q.signer=(L=E.signer)!=null?L:"",Q.hostConsensusStateProof=(V=E.hostConsensusStateProof)!=null?V:new Uint8Array,Q}};function v(){return{}}e.MsgConnectionOpenTryResponse={encode(E,Q=N.Writer.create()){return Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=v();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){default:H.skipType(T&7);break}}return ee},fromJSON(E){return{}},toJSON(E){return{}},fromPartial(E){return v()}};function ne(){return{connectionId:"",counterpartyConnectionId:"",version:void 0,clientState:void 0,proofHeight:void 0,proofTry:new Uint8Array,proofClient:new Uint8Array,proofConsensus:new Uint8Array,consensusHeight:void 0,signer:"",hostConsensusStateProof:new Uint8Array}}e.MsgConnectionOpenAck={encode(E,Q=N.Writer.create()){return E.connectionId!==""&&Q.uint32(10).string(E.connectionId),E.counterpartyConnectionId!==""&&Q.uint32(18).string(E.counterpartyConnectionId),E.version!==void 0&&f.Version.encode(E.version,Q.uint32(26).fork()).ldelim(),E.clientState!==void 0&&l.Any.encode(E.clientState,Q.uint32(34).fork()).ldelim(),E.proofHeight!==void 0&&g.Height.encode(E.proofHeight,Q.uint32(42).fork()).ldelim(),E.proofTry.length!==0&&Q.uint32(50).bytes(E.proofTry),E.proofClient.length!==0&&Q.uint32(58).bytes(E.proofClient),E.proofConsensus.length!==0&&Q.uint32(66).bytes(E.proofConsensus),E.consensusHeight!==void 0&&g.Height.encode(E.consensusHeight,Q.uint32(74).fork()).ldelim(),E.signer!==""&&Q.uint32(82).string(E.signer),E.hostConsensusStateProof.length!==0&&Q.uint32(90).bytes(E.hostConsensusStateProof),Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=ne();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.connectionId=H.string();break;case 2:ee.counterpartyConnectionId=H.string();break;case 3:ee.version=f.Version.decode(H,H.uint32());break;case 4:ee.clientState=l.Any.decode(H,H.uint32());break;case 5:ee.proofHeight=g.Height.decode(H,H.uint32());break;case 6:ee.proofTry=H.bytes();break;case 7:ee.proofClient=H.bytes();break;case 8:ee.proofConsensus=H.bytes();break;case 9:ee.consensusHeight=g.Height.decode(H,H.uint32());break;case 10:ee.signer=H.string();break;case 11:ee.hostConsensusStateProof=H.bytes();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{connectionId:(0,w.isSet)(E.connectionId)?String(E.connectionId):"",counterpartyConnectionId:(0,w.isSet)(E.counterpartyConnectionId)?String(E.counterpartyConnectionId):"",version:(0,w.isSet)(E.version)?f.Version.fromJSON(E.version):void 0,clientState:(0,w.isSet)(E.clientState)?l.Any.fromJSON(E.clientState):void 0,proofHeight:(0,w.isSet)(E.proofHeight)?g.Height.fromJSON(E.proofHeight):void 0,proofTry:(0,w.isSet)(E.proofTry)?(0,w.bytesFromBase64)(E.proofTry):new Uint8Array,proofClient:(0,w.isSet)(E.proofClient)?(0,w.bytesFromBase64)(E.proofClient):new Uint8Array,proofConsensus:(0,w.isSet)(E.proofConsensus)?(0,w.bytesFromBase64)(E.proofConsensus):new Uint8Array,consensusHeight:(0,w.isSet)(E.consensusHeight)?g.Height.fromJSON(E.consensusHeight):void 0,signer:(0,w.isSet)(E.signer)?String(E.signer):"",hostConsensusStateProof:(0,w.isSet)(E.hostConsensusStateProof)?(0,w.bytesFromBase64)(E.hostConsensusStateProof):new Uint8Array}},toJSON(E){let Q={};return E.connectionId!==void 0&&(Q.connectionId=E.connectionId),E.counterpartyConnectionId!==void 0&&(Q.counterpartyConnectionId=E.counterpartyConnectionId),E.version!==void 0&&(Q.version=E.version?f.Version.toJSON(E.version):void 0),E.clientState!==void 0&&(Q.clientState=E.clientState?l.Any.toJSON(E.clientState):void 0),E.proofHeight!==void 0&&(Q.proofHeight=E.proofHeight?g.Height.toJSON(E.proofHeight):void 0),E.proofTry!==void 0&&(Q.proofTry=(0,w.base64FromBytes)(E.proofTry!==void 0?E.proofTry:new Uint8Array)),E.proofClient!==void 0&&(Q.proofClient=(0,w.base64FromBytes)(E.proofClient!==void 0?E.proofClient:new Uint8Array)),E.proofConsensus!==void 0&&(Q.proofConsensus=(0,w.base64FromBytes)(E.proofConsensus!==void 0?E.proofConsensus:new Uint8Array)),E.consensusHeight!==void 0&&(Q.consensusHeight=E.consensusHeight?g.Height.toJSON(E.consensusHeight):void 0),E.signer!==void 0&&(Q.signer=E.signer),E.hostConsensusStateProof!==void 0&&(Q.hostConsensusStateProof=(0,w.base64FromBytes)(E.hostConsensusStateProof!==void 0?E.hostConsensusStateProof:new Uint8Array)),Q},fromPartial(E){var H,re,ee,T,se,p,L;let Q=ne();return Q.connectionId=(H=E.connectionId)!=null?H:"",Q.counterpartyConnectionId=(re=E.counterpartyConnectionId)!=null?re:"",Q.version=E.version!==void 0&&E.version!==null?f.Version.fromPartial(E.version):void 0,Q.clientState=E.clientState!==void 0&&E.clientState!==null?l.Any.fromPartial(E.clientState):void 0,Q.proofHeight=E.proofHeight!==void 0&&E.proofHeight!==null?g.Height.fromPartial(E.proofHeight):void 0,Q.proofTry=(ee=E.proofTry)!=null?ee:new Uint8Array,Q.proofClient=(T=E.proofClient)!=null?T:new Uint8Array,Q.proofConsensus=(se=E.proofConsensus)!=null?se:new Uint8Array,Q.consensusHeight=E.consensusHeight!==void 0&&E.consensusHeight!==null?g.Height.fromPartial(E.consensusHeight):void 0,Q.signer=(p=E.signer)!=null?p:"",Q.hostConsensusStateProof=(L=E.hostConsensusStateProof)!=null?L:new Uint8Array,Q}};function Z(){return{}}e.MsgConnectionOpenAckResponse={encode(E,Q=N.Writer.create()){return Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=Z();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){default:H.skipType(T&7);break}}return ee},fromJSON(E){return{}},toJSON(E){return{}},fromPartial(E){return Z()}};function R(){return{connectionId:"",proofAck:new Uint8Array,proofHeight:void 0,signer:""}}e.MsgConnectionOpenConfirm={encode(E,Q=N.Writer.create()){return E.connectionId!==""&&Q.uint32(10).string(E.connectionId),E.proofAck.length!==0&&Q.uint32(18).bytes(E.proofAck),E.proofHeight!==void 0&&g.Height.encode(E.proofHeight,Q.uint32(26).fork()).ldelim(),E.signer!==""&&Q.uint32(34).string(E.signer),Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=R();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.connectionId=H.string();break;case 2:ee.proofAck=H.bytes();break;case 3:ee.proofHeight=g.Height.decode(H,H.uint32());break;case 4:ee.signer=H.string();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{connectionId:(0,w.isSet)(E.connectionId)?String(E.connectionId):"",proofAck:(0,w.isSet)(E.proofAck)?(0,w.bytesFromBase64)(E.proofAck):new Uint8Array,proofHeight:(0,w.isSet)(E.proofHeight)?g.Height.fromJSON(E.proofHeight):void 0,signer:(0,w.isSet)(E.signer)?String(E.signer):""}},toJSON(E){let Q={};return E.connectionId!==void 0&&(Q.connectionId=E.connectionId),E.proofAck!==void 0&&(Q.proofAck=(0,w.base64FromBytes)(E.proofAck!==void 0?E.proofAck:new Uint8Array)),E.proofHeight!==void 0&&(Q.proofHeight=E.proofHeight?g.Height.toJSON(E.proofHeight):void 0),E.signer!==void 0&&(Q.signer=E.signer),Q},fromPartial(E){var H,re,ee;let Q=R();return Q.connectionId=(H=E.connectionId)!=null?H:"",Q.proofAck=(re=E.proofAck)!=null?re:new Uint8Array,Q.proofHeight=E.proofHeight!==void 0&&E.proofHeight!==null?g.Height.fromPartial(E.proofHeight):void 0,Q.signer=(ee=E.signer)!=null?ee:"",Q}};function M(){return{}}e.MsgConnectionOpenConfirmResponse={encode(E,Q=N.Writer.create()){return Q},decode(E,Q){let H=E instanceof N.Reader?E:new N.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=M();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){default:H.skipType(T&7);break}}return ee},fromJSON(E){return{}},toJSON(E){return{}},fromPartial(E){return M()}};class U{constructor(Q){this.rpc=Q,this.ConnectionOpenInit=this.ConnectionOpenInit.bind(this),this.ConnectionOpenTry=this.ConnectionOpenTry.bind(this),this.ConnectionOpenAck=this.ConnectionOpenAck.bind(this),this.ConnectionOpenConfirm=this.ConnectionOpenConfirm.bind(this)}ConnectionOpenInit(Q){let H=e.MsgConnectionOpenInit.encode(Q).finish();return this.rpc.request("ibc.core.connection.v1.Msg","ConnectionOpenInit",H).then(ee=>e.MsgConnectionOpenInitResponse.decode(new N.Reader(ee)))}ConnectionOpenTry(Q){let H=e.MsgConnectionOpenTry.encode(Q).finish();return this.rpc.request("ibc.core.connection.v1.Msg","ConnectionOpenTry",H).then(ee=>e.MsgConnectionOpenTryResponse.decode(new N.Reader(ee)))}ConnectionOpenAck(Q){let H=e.MsgConnectionOpenAck.encode(Q).finish();return this.rpc.request("ibc.core.connection.v1.Msg","ConnectionOpenAck",H).then(ee=>e.MsgConnectionOpenAckResponse.decode(new N.Reader(ee)))}ConnectionOpenConfirm(Q){let H=e.MsgConnectionOpenConfirm.encode(Q).finish();return this.rpc.request("ibc.core.connection.v1.Msg","ConnectionOpenConfirm",H).then(ee=>e.MsgConnectionOpenConfirmResponse.decode(new N.Reader(ee)))}}e.MsgClientImpl=U})(N$r);Object.defineProperty(lSe,"__esModule",{value:!0});lSe.isMsgTransferEncodeObject=lSe.ibcTypes=void 0;var b8s=uvt,Zq=P$r,v3t=O$r,b3t=N$r;lSe.ibcTypes=[["/ibc.applications.transfer.v1.MsgTransfer",b8s.MsgTransfer],["/ibc.core.channel.v1.MsgAcknowledgement",Zq.MsgAcknowledgement],["/ibc.core.channel.v1.MsgChannelCloseConfirm",Zq.MsgChannelCloseConfirm],["/ibc.core.channel.v1.MsgChannelCloseInit",Zq.MsgChannelCloseInit],["/ibc.core.channel.v1.MsgChannelOpenAck",Zq.MsgChannelOpenAck],["/ibc.core.channel.v1.MsgChannelOpenConfirm",Zq.MsgChannelOpenConfirm],["/ibc.core.channel.v1.MsgChannelOpenInit",Zq.MsgChannelOpenInit],["/ibc.core.channel.v1.MsgChannelOpenTry",Zq.MsgChannelOpenTry],["/ibc.core.channel.v1.MsgRecvPacket",Zq.MsgRecvPacket],["/ibc.core.channel.v1.MsgTimeout",Zq.MsgTimeout],["/ibc.core.channel.v1.MsgTimeoutOnClose",Zq.MsgTimeoutOnClose],["/ibc.core.client.v1.MsgCreateClient",v3t.MsgCreateClient],["/ibc.core.client.v1.MsgSubmitMisbehaviour",v3t.MsgSubmitMisbehaviour],["/ibc.core.client.v1.MsgUpdateClient",v3t.MsgUpdateClient],["/ibc.core.client.v1.MsgUpgradeClient",v3t.MsgUpgradeClient],["/ibc.core.connection.v1.MsgConnectionOpenAck",b3t.MsgConnectionOpenAck],["/ibc.core.connection.v1.MsgConnectionOpenConfirm",b3t.MsgConnectionOpenConfirm],["/ibc.core.connection.v1.MsgConnectionOpenInit",b3t.MsgConnectionOpenInit],["/ibc.core.connection.v1.MsgConnectionOpenTry",b3t.MsgConnectionOpenTry]];function S8s(e){return e.typeUrl==="/ibc.applications.transfer.v1.MsgTransfer"}lSe.isMsgTransferEncodeObject=S8s;var lvt={},x$r={},Kie={},w8s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),Q8s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),k8s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&w8s(i,e,A);return Q8s(i,e),i};Object.defineProperty(Kie,"__esModule",{value:!0});Kie.Params=Kie.DenomTrace=Kie.protobufPackage=void 0;var N8e=k8s(BA),IEt=Ns;Kie.protobufPackage="ibc.applications.transfer.v1";function _Lr(){return{path:"",baseDenom:""}}Kie.DenomTrace={encode(e,i=N8e.Writer.create()){return e.path!==""&&i.uint32(10).string(e.path),e.baseDenom!==""&&i.uint32(18).string(e.baseDenom),i},decode(e,i){let A=e instanceof N8e.Reader?e:new N8e.Reader(e),c=i===void 0?A.len:A.pos+i,f=_Lr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.path=A.string();break;case 2:f.baseDenom=A.string();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{path:(0,IEt.isSet)(e.path)?String(e.path):"",baseDenom:(0,IEt.isSet)(e.baseDenom)?String(e.baseDenom):""}},toJSON(e){let i={};return e.path!==void 0&&(i.path=e.path),e.baseDenom!==void 0&&(i.baseDenom=e.baseDenom),i},fromPartial(e){var A,c;let i=_Lr();return i.path=(A=e.path)!=null?A:"",i.baseDenom=(c=e.baseDenom)!=null?c:"",i}};function ELr(){return{sendEnabled:!1,receiveEnabled:!1}}Kie.Params={encode(e,i=N8e.Writer.create()){return e.sendEnabled===!0&&i.uint32(8).bool(e.sendEnabled),e.receiveEnabled===!0&&i.uint32(16).bool(e.receiveEnabled),i},decode(e,i){let A=e instanceof N8e.Reader?e:new N8e.Reader(e),c=i===void 0?A.len:A.pos+i,f=ELr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.sendEnabled=A.bool();break;case 2:f.receiveEnabled=A.bool();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{sendEnabled:(0,IEt.isSet)(e.sendEnabled)?!!e.sendEnabled:!1,receiveEnabled:(0,IEt.isSet)(e.receiveEnabled)?!!e.receiveEnabled:!1}},toJSON(e){let i={};return e.sendEnabled!==void 0&&(i.sendEnabled=e.sendEnabled),e.receiveEnabled!==void 0&&(i.receiveEnabled=e.receiveEnabled),i},fromPartial(e){var A,c;let i=ELr();return i.sendEnabled=(A=e.sendEnabled)!=null?A:!1,i.receiveEnabled=(c=e.receiveEnabled)!=null?c:!1,i}};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(Q,H,re,ee){ee===void 0&&(ee=re);var T=Object.getOwnPropertyDescriptor(H,re);(!T||("get"in T?!H.__esModule:T.writable||T.configurable))&&(T={enumerable:!0,get:function(){return H[re]}}),Object.defineProperty(Q,ee,T)}:function(Q,H,re,ee){ee===void 0&&(ee=re),Q[ee]=H[re]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(Q,H){Object.defineProperty(Q,"default",{enumerable:!0,value:H})}:function(Q,H){Q.default=H}),c=Fr&&Fr.__importStar||function(Q){if(Q&&Q.__esModule)return Q;var H={};if(Q!=null)for(var re in Q)re!=="default"&&Object.prototype.hasOwnProperty.call(Q,re)&&i(H,Q,re);return A(H,Q),H};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryEscrowAddressResponse=e.QueryEscrowAddressRequest=e.QueryDenomHashResponse=e.QueryDenomHashRequest=e.QueryParamsResponse=e.QueryParamsRequest=e.QueryDenomTracesResponse=e.QueryDenomTracesRequest=e.QueryDenomTraceResponse=e.QueryDenomTraceRequest=e.protobufPackage=void 0;let f=Hm,l=Kie,g=c(BA),w=Ns;e.protobufPackage="ibc.applications.transfer.v1";function N(){return{hash:""}}e.QueryDenomTraceRequest={encode(Q,H=g.Writer.create()){return Q.hash!==""&&H.uint32(10).string(Q.hash),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=N();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.hash=re.string();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{hash:(0,w.isSet)(Q.hash)?String(Q.hash):""}},toJSON(Q){let H={};return Q.hash!==void 0&&(H.hash=Q.hash),H},fromPartial(Q){var re;let H=N();return H.hash=(re=Q.hash)!=null?re:"",H}};function F(){return{denomTrace:void 0}}e.QueryDenomTraceResponse={encode(Q,H=g.Writer.create()){return Q.denomTrace!==void 0&&l.DenomTrace.encode(Q.denomTrace,H.uint32(10).fork()).ldelim(),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=F();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.denomTrace=l.DenomTrace.decode(re,re.uint32());break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{denomTrace:(0,w.isSet)(Q.denomTrace)?l.DenomTrace.fromJSON(Q.denomTrace):void 0}},toJSON(Q){let H={};return Q.denomTrace!==void 0&&(H.denomTrace=Q.denomTrace?l.DenomTrace.toJSON(Q.denomTrace):void 0),H},fromPartial(Q){let H=F();return H.denomTrace=Q.denomTrace!==void 0&&Q.denomTrace!==null?l.DenomTrace.fromPartial(Q.denomTrace):void 0,H}};function j(){return{pagination:void 0}}e.QueryDenomTracesRequest={encode(Q,H=g.Writer.create()){return Q.pagination!==void 0&&f.PageRequest.encode(Q.pagination,H.uint32(10).fork()).ldelim(),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=j();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.pagination=f.PageRequest.decode(re,re.uint32());break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{pagination:(0,w.isSet)(Q.pagination)?f.PageRequest.fromJSON(Q.pagination):void 0}},toJSON(Q){let H={};return Q.pagination!==void 0&&(H.pagination=Q.pagination?f.PageRequest.toJSON(Q.pagination):void 0),H},fromPartial(Q){let H=j();return H.pagination=Q.pagination!==void 0&&Q.pagination!==null?f.PageRequest.fromPartial(Q.pagination):void 0,H}};function te(){return{denomTraces:[],pagination:void 0}}e.QueryDenomTracesResponse={encode(Q,H=g.Writer.create()){for(let re of Q.denomTraces)l.DenomTrace.encode(re,H.uint32(10).fork()).ldelim();return Q.pagination!==void 0&&f.PageResponse.encode(Q.pagination,H.uint32(18).fork()).ldelim(),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=te();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.denomTraces.push(l.DenomTrace.decode(re,re.uint32()));break;case 2:T.pagination=f.PageResponse.decode(re,re.uint32());break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{denomTraces:Array.isArray(Q==null?void 0:Q.denomTraces)?Q.denomTraces.map(H=>l.DenomTrace.fromJSON(H)):[],pagination:(0,w.isSet)(Q.pagination)?f.PageResponse.fromJSON(Q.pagination):void 0}},toJSON(Q){let H={};return Q.denomTraces?H.denomTraces=Q.denomTraces.map(re=>re?l.DenomTrace.toJSON(re):void 0):H.denomTraces=[],Q.pagination!==void 0&&(H.pagination=Q.pagination?f.PageResponse.toJSON(Q.pagination):void 0),H},fromPartial(Q){var re;let H=te();return H.denomTraces=((re=Q.denomTraces)==null?void 0:re.map(ee=>l.DenomTrace.fromPartial(ee)))||[],H.pagination=Q.pagination!==void 0&&Q.pagination!==null?f.PageResponse.fromPartial(Q.pagination):void 0,H}};function v(){return{}}e.QueryParamsRequest={encode(Q,H=g.Writer.create()){return H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=v();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){default:re.skipType(se&7);break}}return T},fromJSON(Q){return{}},toJSON(Q){return{}},fromPartial(Q){return v()}};function ne(){return{params:void 0}}e.QueryParamsResponse={encode(Q,H=g.Writer.create()){return Q.params!==void 0&&l.Params.encode(Q.params,H.uint32(10).fork()).ldelim(),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=ne();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.params=l.Params.decode(re,re.uint32());break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{params:(0,w.isSet)(Q.params)?l.Params.fromJSON(Q.params):void 0}},toJSON(Q){let H={};return Q.params!==void 0&&(H.params=Q.params?l.Params.toJSON(Q.params):void 0),H},fromPartial(Q){let H=ne();return H.params=Q.params!==void 0&&Q.params!==null?l.Params.fromPartial(Q.params):void 0,H}};function Z(){return{trace:""}}e.QueryDenomHashRequest={encode(Q,H=g.Writer.create()){return Q.trace!==""&&H.uint32(10).string(Q.trace),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=Z();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.trace=re.string();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{trace:(0,w.isSet)(Q.trace)?String(Q.trace):""}},toJSON(Q){let H={};return Q.trace!==void 0&&(H.trace=Q.trace),H},fromPartial(Q){var re;let H=Z();return H.trace=(re=Q.trace)!=null?re:"",H}};function R(){return{hash:""}}e.QueryDenomHashResponse={encode(Q,H=g.Writer.create()){return Q.hash!==""&&H.uint32(10).string(Q.hash),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=R();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.hash=re.string();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{hash:(0,w.isSet)(Q.hash)?String(Q.hash):""}},toJSON(Q){let H={};return Q.hash!==void 0&&(H.hash=Q.hash),H},fromPartial(Q){var re;let H=R();return H.hash=(re=Q.hash)!=null?re:"",H}};function M(){return{portId:"",channelId:""}}e.QueryEscrowAddressRequest={encode(Q,H=g.Writer.create()){return Q.portId!==""&&H.uint32(10).string(Q.portId),Q.channelId!==""&&H.uint32(18).string(Q.channelId),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=M();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.portId=re.string();break;case 2:T.channelId=re.string();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{portId:(0,w.isSet)(Q.portId)?String(Q.portId):"",channelId:(0,w.isSet)(Q.channelId)?String(Q.channelId):""}},toJSON(Q){let H={};return Q.portId!==void 0&&(H.portId=Q.portId),Q.channelId!==void 0&&(H.channelId=Q.channelId),H},fromPartial(Q){var re,ee;let H=M();return H.portId=(re=Q.portId)!=null?re:"",H.channelId=(ee=Q.channelId)!=null?ee:"",H}};function U(){return{escrowAddress:""}}e.QueryEscrowAddressResponse={encode(Q,H=g.Writer.create()){return Q.escrowAddress!==""&&H.uint32(10).string(Q.escrowAddress),H},decode(Q,H){let re=Q instanceof g.Reader?Q:new g.Reader(Q),ee=H===void 0?re.len:re.pos+H,T=U();for(;re.pos<ee;){let se=re.uint32();switch(se>>>3){case 1:T.escrowAddress=re.string();break;default:re.skipType(se&7);break}}return T},fromJSON(Q){return{escrowAddress:(0,w.isSet)(Q.escrowAddress)?String(Q.escrowAddress):""}},toJSON(Q){let H={};return Q.escrowAddress!==void 0&&(H.escrowAddress=Q.escrowAddress),H},fromPartial(Q){var re;let H=U();return H.escrowAddress=(re=Q.escrowAddress)!=null?re:"",H}};class E{constructor(H){this.rpc=H,this.DenomTrace=this.DenomTrace.bind(this),this.DenomTraces=this.DenomTraces.bind(this),this.Params=this.Params.bind(this),this.DenomHash=this.DenomHash.bind(this),this.EscrowAddress=this.EscrowAddress.bind(this)}DenomTrace(H){let re=e.QueryDenomTraceRequest.encode(H).finish();return this.rpc.request("ibc.applications.transfer.v1.Query","DenomTrace",re).then(T=>e.QueryDenomTraceResponse.decode(new g.Reader(T)))}DenomTraces(H={pagination:void 0}){let re=e.QueryDenomTracesRequest.encode(H).finish();return this.rpc.request("ibc.applications.transfer.v1.Query","DenomTraces",re).then(T=>e.QueryDenomTracesResponse.decode(new g.Reader(T)))}Params(H={}){let re=e.QueryParamsRequest.encode(H).finish();return this.rpc.request("ibc.applications.transfer.v1.Query","Params",re).then(T=>e.QueryParamsResponse.decode(new g.Reader(T)))}DenomHash(H){let re=e.QueryDenomHashRequest.encode(H).finish();return this.rpc.request("ibc.applications.transfer.v1.Query","DenomHash",re).then(T=>e.QueryDenomHashResponse.decode(new g.Reader(T)))}EscrowAddress(H){let re=e.QueryEscrowAddressRequest.encode(H).finish();return this.rpc.request("ibc.applications.transfer.v1.Query","EscrowAddress",re).then(T=>e.QueryEscrowAddressResponse.decode(new g.Reader(T)))}}e.QueryClientImpl=E})(x$r);var M$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(I,C,D,W){W===void 0&&(W=D);var ae=Object.getOwnPropertyDescriptor(C,D);(!ae||("get"in ae?!C.__esModule:ae.writable||ae.configurable))&&(ae={enumerable:!0,get:function(){return C[D]}}),Object.defineProperty(I,W,ae)}:function(I,C,D,W){W===void 0&&(W=D),I[W]=C[D]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(I,C){Object.defineProperty(I,"default",{enumerable:!0,value:C})}:function(I,C){I.default=C}),c=Fr&&Fr.__importStar||function(I){if(I&&I.__esModule)return I;var C={};if(I!=null)for(var D in I)D!=="default"&&Object.prototype.hasOwnProperty.call(I,D)&&i(C,I,D);return A(C,I),C};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryNextSequenceReceiveResponse=e.QueryNextSequenceReceiveRequest=e.QueryUnreceivedAcksResponse=e.QueryUnreceivedAcksRequest=e.QueryUnreceivedPacketsResponse=e.QueryUnreceivedPacketsRequest=e.QueryPacketAcknowledgementsResponse=e.QueryPacketAcknowledgementsRequest=e.QueryPacketAcknowledgementResponse=e.QueryPacketAcknowledgementRequest=e.QueryPacketReceiptResponse=e.QueryPacketReceiptRequest=e.QueryPacketCommitmentsResponse=e.QueryPacketCommitmentsRequest=e.QueryPacketCommitmentResponse=e.QueryPacketCommitmentRequest=e.QueryChannelConsensusStateResponse=e.QueryChannelConsensusStateRequest=e.QueryChannelClientStateResponse=e.QueryChannelClientStateRequest=e.QueryConnectionChannelsResponse=e.QueryConnectionChannelsRequest=e.QueryChannelsResponse=e.QueryChannelsRequest=e.QueryChannelResponse=e.QueryChannelRequest=e.protobufPackage=void 0;let f=Hm,l=fvt,g=lW,w=fh,N=Ns,F=c(BA);e.protobufPackage="ibc.core.channel.v1";function j(){return{portId:"",channelId:""}}e.QueryChannelRequest={encode(I,C=F.Writer.create()){return I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=j();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):""}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),C},fromPartial(I){var D,W;let C=j();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C}};function te(){return{channel:void 0,proof:new Uint8Array,proofHeight:void 0}}e.QueryChannelResponse={encode(I,C=F.Writer.create()){return I.channel!==void 0&&l.Channel.encode(I.channel,C.uint32(10).fork()).ldelim(),I.proof.length!==0&&C.uint32(18).bytes(I.proof),I.proofHeight!==void 0&&g.Height.encode(I.proofHeight,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=te();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.channel=l.Channel.decode(D,D.uint32());break;case 2:ae.proof=D.bytes();break;case 3:ae.proofHeight=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{channel:(0,N.isSet)(I.channel)?l.Channel.fromJSON(I.channel):void 0,proof:(0,N.isSet)(I.proof)?(0,N.bytesFromBase64)(I.proof):new Uint8Array,proofHeight:(0,N.isSet)(I.proofHeight)?g.Height.fromJSON(I.proofHeight):void 0}},toJSON(I){let C={};return I.channel!==void 0&&(C.channel=I.channel?l.Channel.toJSON(I.channel):void 0),I.proof!==void 0&&(C.proof=(0,N.base64FromBytes)(I.proof!==void 0?I.proof:new Uint8Array)),I.proofHeight!==void 0&&(C.proofHeight=I.proofHeight?g.Height.toJSON(I.proofHeight):void 0),C},fromPartial(I){var D;let C=te();return C.channel=I.channel!==void 0&&I.channel!==null?l.Channel.fromPartial(I.channel):void 0,C.proof=(D=I.proof)!=null?D:new Uint8Array,C.proofHeight=I.proofHeight!==void 0&&I.proofHeight!==null?g.Height.fromPartial(I.proofHeight):void 0,C}};function v(){return{pagination:void 0}}e.QueryChannelsRequest={encode(I,C=F.Writer.create()){return I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(10).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=v();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{pagination:(0,N.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){let C=v();return C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function ne(){return{channels:[],pagination:void 0,height:void 0}}e.QueryChannelsResponse={encode(I,C=F.Writer.create()){for(let D of I.channels)l.IdentifiedChannel.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),I.height!==void 0&&g.Height.encode(I.height,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=ne();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.channels.push(l.IdentifiedChannel.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;case 3:ae.height=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{channels:Array.isArray(I==null?void 0:I.channels)?I.channels.map(C=>l.IdentifiedChannel.fromJSON(C)):[],pagination:(0,N.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0,height:(0,N.isSet)(I.height)?g.Height.fromJSON(I.height):void 0}},toJSON(I){let C={};return I.channels?C.channels=I.channels.map(D=>D?l.IdentifiedChannel.toJSON(D):void 0):C.channels=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),I.height!==void 0&&(C.height=I.height?g.Height.toJSON(I.height):void 0),C},fromPartial(I){var D;let C=ne();return C.channels=((D=I.channels)==null?void 0:D.map(W=>l.IdentifiedChannel.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C.height=I.height!==void 0&&I.height!==null?g.Height.fromPartial(I.height):void 0,C}};function Z(){return{connection:"",pagination:void 0}}e.QueryConnectionChannelsRequest={encode(I,C=F.Writer.create()){return I.connection!==""&&C.uint32(10).string(I.connection),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=Z();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.connection=D.string();break;case 2:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{connection:(0,N.isSet)(I.connection)?String(I.connection):"",pagination:(0,N.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.connection!==void 0&&(C.connection=I.connection),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=Z();return C.connection=(D=I.connection)!=null?D:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function R(){return{channels:[],pagination:void 0,height:void 0}}e.QueryConnectionChannelsResponse={encode(I,C=F.Writer.create()){for(let D of I.channels)l.IdentifiedChannel.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),I.height!==void 0&&g.Height.encode(I.height,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=R();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.channels.push(l.IdentifiedChannel.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;case 3:ae.height=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{channels:Array.isArray(I==null?void 0:I.channels)?I.channels.map(C=>l.IdentifiedChannel.fromJSON(C)):[],pagination:(0,N.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0,height:(0,N.isSet)(I.height)?g.Height.fromJSON(I.height):void 0}},toJSON(I){let C={};return I.channels?C.channels=I.channels.map(D=>D?l.IdentifiedChannel.toJSON(D):void 0):C.channels=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),I.height!==void 0&&(C.height=I.height?g.Height.toJSON(I.height):void 0),C},fromPartial(I){var D;let C=R();return C.channels=((D=I.channels)==null?void 0:D.map(W=>l.IdentifiedChannel.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C.height=I.height!==void 0&&I.height!==null?g.Height.fromPartial(I.height):void 0,C}};function M(){return{portId:"",channelId:""}}e.QueryChannelClientStateRequest={encode(I,C=F.Writer.create()){return I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=M();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):""}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),C},fromPartial(I){var D,W;let C=M();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C}};function U(){return{identifiedClientState:void 0,proof:new Uint8Array,proofHeight:void 0}}e.QueryChannelClientStateResponse={encode(I,C=F.Writer.create()){return I.identifiedClientState!==void 0&&g.IdentifiedClientState.encode(I.identifiedClientState,C.uint32(10).fork()).ldelim(),I.proof.length!==0&&C.uint32(18).bytes(I.proof),I.proofHeight!==void 0&&g.Height.encode(I.proofHeight,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=U();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.identifiedClientState=g.IdentifiedClientState.decode(D,D.uint32());break;case 2:ae.proof=D.bytes();break;case 3:ae.proofHeight=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{identifiedClientState:(0,N.isSet)(I.identifiedClientState)?g.IdentifiedClientState.fromJSON(I.identifiedClientState):void 0,proof:(0,N.isSet)(I.proof)?(0,N.bytesFromBase64)(I.proof):new Uint8Array,proofHeight:(0,N.isSet)(I.proofHeight)?g.Height.fromJSON(I.proofHeight):void 0}},toJSON(I){let C={};return I.identifiedClientState!==void 0&&(C.identifiedClientState=I.identifiedClientState?g.IdentifiedClientState.toJSON(I.identifiedClientState):void 0),I.proof!==void 0&&(C.proof=(0,N.base64FromBytes)(I.proof!==void 0?I.proof:new Uint8Array)),I.proofHeight!==void 0&&(C.proofHeight=I.proofHeight?g.Height.toJSON(I.proofHeight):void 0),C},fromPartial(I){var D;let C=U();return C.identifiedClientState=I.identifiedClientState!==void 0&&I.identifiedClientState!==null?g.IdentifiedClientState.fromPartial(I.identifiedClientState):void 0,C.proof=(D=I.proof)!=null?D:new Uint8Array,C.proofHeight=I.proofHeight!==void 0&&I.proofHeight!==null?g.Height.fromPartial(I.proofHeight):void 0,C}};function E(){return{portId:"",channelId:"",revisionNumber:N.Long.UZERO,revisionHeight:N.Long.UZERO}}e.QueryChannelConsensusStateRequest={encode(I,C=F.Writer.create()){return I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),I.revisionNumber.isZero()||C.uint32(24).uint64(I.revisionNumber),I.revisionHeight.isZero()||C.uint32(32).uint64(I.revisionHeight),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=E();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;case 3:ae.revisionNumber=D.uint64();break;case 4:ae.revisionHeight=D.uint64();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):"",revisionNumber:(0,N.isSet)(I.revisionNumber)?N.Long.fromValue(I.revisionNumber):N.Long.UZERO,revisionHeight:(0,N.isSet)(I.revisionHeight)?N.Long.fromValue(I.revisionHeight):N.Long.UZERO}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),I.revisionNumber!==void 0&&(C.revisionNumber=(I.revisionNumber||N.Long.UZERO).toString()),I.revisionHeight!==void 0&&(C.revisionHeight=(I.revisionHeight||N.Long.UZERO).toString()),C},fromPartial(I){var D,W;let C=E();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C.revisionNumber=I.revisionNumber!==void 0&&I.revisionNumber!==null?N.Long.fromValue(I.revisionNumber):N.Long.UZERO,C.revisionHeight=I.revisionHeight!==void 0&&I.revisionHeight!==null?N.Long.fromValue(I.revisionHeight):N.Long.UZERO,C}};function Q(){return{consensusState:void 0,clientId:"",proof:new Uint8Array,proofHeight:void 0}}e.QueryChannelConsensusStateResponse={encode(I,C=F.Writer.create()){return I.consensusState!==void 0&&w.Any.encode(I.consensusState,C.uint32(10).fork()).ldelim(),I.clientId!==""&&C.uint32(18).string(I.clientId),I.proof.length!==0&&C.uint32(26).bytes(I.proof),I.proofHeight!==void 0&&g.Height.encode(I.proofHeight,C.uint32(34).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=Q();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.consensusState=w.Any.decode(D,D.uint32());break;case 2:ae.clientId=D.string();break;case 3:ae.proof=D.bytes();break;case 4:ae.proofHeight=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{consensusState:(0,N.isSet)(I.consensusState)?w.Any.fromJSON(I.consensusState):void 0,clientId:(0,N.isSet)(I.clientId)?String(I.clientId):"",proof:(0,N.isSet)(I.proof)?(0,N.bytesFromBase64)(I.proof):new Uint8Array,proofHeight:(0,N.isSet)(I.proofHeight)?g.Height.fromJSON(I.proofHeight):void 0}},toJSON(I){let C={};return I.consensusState!==void 0&&(C.consensusState=I.consensusState?w.Any.toJSON(I.consensusState):void 0),I.clientId!==void 0&&(C.clientId=I.clientId),I.proof!==void 0&&(C.proof=(0,N.base64FromBytes)(I.proof!==void 0?I.proof:new Uint8Array)),I.proofHeight!==void 0&&(C.proofHeight=I.proofHeight?g.Height.toJSON(I.proofHeight):void 0),C},fromPartial(I){var D,W;let C=Q();return C.consensusState=I.consensusState!==void 0&&I.consensusState!==null?w.Any.fromPartial(I.consensusState):void 0,C.clientId=(D=I.clientId)!=null?D:"",C.proof=(W=I.proof)!=null?W:new Uint8Array,C.proofHeight=I.proofHeight!==void 0&&I.proofHeight!==null?g.Height.fromPartial(I.proofHeight):void 0,C}};function H(){return{portId:"",channelId:"",sequence:N.Long.UZERO}}e.QueryPacketCommitmentRequest={encode(I,C=F.Writer.create()){return I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),I.sequence.isZero()||C.uint32(24).uint64(I.sequence),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=H();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;case 3:ae.sequence=D.uint64();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):"",sequence:(0,N.isSet)(I.sequence)?N.Long.fromValue(I.sequence):N.Long.UZERO}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),I.sequence!==void 0&&(C.sequence=(I.sequence||N.Long.UZERO).toString()),C},fromPartial(I){var D,W;let C=H();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C.sequence=I.sequence!==void 0&&I.sequence!==null?N.Long.fromValue(I.sequence):N.Long.UZERO,C}};function re(){return{commitment:new Uint8Array,proof:new Uint8Array,proofHeight:void 0}}e.QueryPacketCommitmentResponse={encode(I,C=F.Writer.create()){return I.commitment.length!==0&&C.uint32(10).bytes(I.commitment),I.proof.length!==0&&C.uint32(18).bytes(I.proof),I.proofHeight!==void 0&&g.Height.encode(I.proofHeight,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=re();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.commitment=D.bytes();break;case 2:ae.proof=D.bytes();break;case 3:ae.proofHeight=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{commitment:(0,N.isSet)(I.commitment)?(0,N.bytesFromBase64)(I.commitment):new Uint8Array,proof:(0,N.isSet)(I.proof)?(0,N.bytesFromBase64)(I.proof):new Uint8Array,proofHeight:(0,N.isSet)(I.proofHeight)?g.Height.fromJSON(I.proofHeight):void 0}},toJSON(I){let C={};return I.commitment!==void 0&&(C.commitment=(0,N.base64FromBytes)(I.commitment!==void 0?I.commitment:new Uint8Array)),I.proof!==void 0&&(C.proof=(0,N.base64FromBytes)(I.proof!==void 0?I.proof:new Uint8Array)),I.proofHeight!==void 0&&(C.proofHeight=I.proofHeight?g.Height.toJSON(I.proofHeight):void 0),C},fromPartial(I){var D,W;let C=re();return C.commitment=(D=I.commitment)!=null?D:new Uint8Array,C.proof=(W=I.proof)!=null?W:new Uint8Array,C.proofHeight=I.proofHeight!==void 0&&I.proofHeight!==null?g.Height.fromPartial(I.proofHeight):void 0,C}};function ee(){return{portId:"",channelId:"",pagination:void 0}}e.QueryPacketCommitmentsRequest={encode(I,C=F.Writer.create()){return I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=ee();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;case 3:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):"",pagination:(0,N.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){var D,W;let C=ee();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function T(){return{commitments:[],pagination:void 0,height:void 0}}e.QueryPacketCommitmentsResponse={encode(I,C=F.Writer.create()){for(let D of I.commitments)l.PacketState.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),I.height!==void 0&&g.Height.encode(I.height,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=T();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.commitments.push(l.PacketState.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;case 3:ae.height=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{commitments:Array.isArray(I==null?void 0:I.commitments)?I.commitments.map(C=>l.PacketState.fromJSON(C)):[],pagination:(0,N.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0,height:(0,N.isSet)(I.height)?g.Height.fromJSON(I.height):void 0}},toJSON(I){let C={};return I.commitments?C.commitments=I.commitments.map(D=>D?l.PacketState.toJSON(D):void 0):C.commitments=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),I.height!==void 0&&(C.height=I.height?g.Height.toJSON(I.height):void 0),C},fromPartial(I){var D;let C=T();return C.commitments=((D=I.commitments)==null?void 0:D.map(W=>l.PacketState.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C.height=I.height!==void 0&&I.height!==null?g.Height.fromPartial(I.height):void 0,C}};function se(){return{portId:"",channelId:"",sequence:N.Long.UZERO}}e.QueryPacketReceiptRequest={encode(I,C=F.Writer.create()){return I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),I.sequence.isZero()||C.uint32(24).uint64(I.sequence),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=se();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;case 3:ae.sequence=D.uint64();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):"",sequence:(0,N.isSet)(I.sequence)?N.Long.fromValue(I.sequence):N.Long.UZERO}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),I.sequence!==void 0&&(C.sequence=(I.sequence||N.Long.UZERO).toString()),C},fromPartial(I){var D,W;let C=se();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C.sequence=I.sequence!==void 0&&I.sequence!==null?N.Long.fromValue(I.sequence):N.Long.UZERO,C}};function p(){return{received:!1,proof:new Uint8Array,proofHeight:void 0}}e.QueryPacketReceiptResponse={encode(I,C=F.Writer.create()){return I.received===!0&&C.uint32(16).bool(I.received),I.proof.length!==0&&C.uint32(26).bytes(I.proof),I.proofHeight!==void 0&&g.Height.encode(I.proofHeight,C.uint32(34).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=p();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 2:ae.received=D.bool();break;case 3:ae.proof=D.bytes();break;case 4:ae.proofHeight=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{received:(0,N.isSet)(I.received)?!!I.received:!1,proof:(0,N.isSet)(I.proof)?(0,N.bytesFromBase64)(I.proof):new Uint8Array,proofHeight:(0,N.isSet)(I.proofHeight)?g.Height.fromJSON(I.proofHeight):void 0}},toJSON(I){let C={};return I.received!==void 0&&(C.received=I.received),I.proof!==void 0&&(C.proof=(0,N.base64FromBytes)(I.proof!==void 0?I.proof:new Uint8Array)),I.proofHeight!==void 0&&(C.proofHeight=I.proofHeight?g.Height.toJSON(I.proofHeight):void 0),C},fromPartial(I){var D,W;let C=p();return C.received=(D=I.received)!=null?D:!1,C.proof=(W=I.proof)!=null?W:new Uint8Array,C.proofHeight=I.proofHeight!==void 0&&I.proofHeight!==null?g.Height.fromPartial(I.proofHeight):void 0,C}};function L(){return{portId:"",channelId:"",sequence:N.Long.UZERO}}e.QueryPacketAcknowledgementRequest={encode(I,C=F.Writer.create()){return I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),I.sequence.isZero()||C.uint32(24).uint64(I.sequence),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=L();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;case 3:ae.sequence=D.uint64();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):"",sequence:(0,N.isSet)(I.sequence)?N.Long.fromValue(I.sequence):N.Long.UZERO}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),I.sequence!==void 0&&(C.sequence=(I.sequence||N.Long.UZERO).toString()),C},fromPartial(I){var D,W;let C=L();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C.sequence=I.sequence!==void 0&&I.sequence!==null?N.Long.fromValue(I.sequence):N.Long.UZERO,C}};function V(){return{acknowledgement:new Uint8Array,proof:new Uint8Array,proofHeight:void 0}}e.QueryPacketAcknowledgementResponse={encode(I,C=F.Writer.create()){return I.acknowledgement.length!==0&&C.uint32(10).bytes(I.acknowledgement),I.proof.length!==0&&C.uint32(18).bytes(I.proof),I.proofHeight!==void 0&&g.Height.encode(I.proofHeight,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=V();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.acknowledgement=D.bytes();break;case 2:ae.proof=D.bytes();break;case 3:ae.proofHeight=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{acknowledgement:(0,N.isSet)(I.acknowledgement)?(0,N.bytesFromBase64)(I.acknowledgement):new Uint8Array,proof:(0,N.isSet)(I.proof)?(0,N.bytesFromBase64)(I.proof):new Uint8Array,proofHeight:(0,N.isSet)(I.proofHeight)?g.Height.fromJSON(I.proofHeight):void 0}},toJSON(I){let C={};return I.acknowledgement!==void 0&&(C.acknowledgement=(0,N.base64FromBytes)(I.acknowledgement!==void 0?I.acknowledgement:new Uint8Array)),I.proof!==void 0&&(C.proof=(0,N.base64FromBytes)(I.proof!==void 0?I.proof:new Uint8Array)),I.proofHeight!==void 0&&(C.proofHeight=I.proofHeight?g.Height.toJSON(I.proofHeight):void 0),C},fromPartial(I){var D,W;let C=V();return C.acknowledgement=(D=I.acknowledgement)!=null?D:new Uint8Array,C.proof=(W=I.proof)!=null?W:new Uint8Array,C.proofHeight=I.proofHeight!==void 0&&I.proofHeight!==null?g.Height.fromPartial(I.proofHeight):void 0,C}};function K(){return{portId:"",channelId:"",pagination:void 0,packetCommitmentSequences:[]}}e.QueryPacketAcknowledgementsRequest={encode(I,C=F.Writer.create()){I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(26).fork()).ldelim(),C.uint32(34).fork();for(let D of I.packetCommitmentSequences)C.uint64(D);return C.ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=K();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;case 3:ae.pagination=f.PageRequest.decode(D,D.uint32());break;case 4:if((ye&7)===2){let Xe=D.uint32()+D.pos;for(;D.pos<Xe;)ae.packetCommitmentSequences.push(D.uint64())}else ae.packetCommitmentSequences.push(D.uint64());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):"",pagination:(0,N.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0,packetCommitmentSequences:Array.isArray(I==null?void 0:I.packetCommitmentSequences)?I.packetCommitmentSequences.map(C=>N.Long.fromValue(C)):[]}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),I.packetCommitmentSequences?C.packetCommitmentSequences=I.packetCommitmentSequences.map(D=>(D||N.Long.UZERO).toString()):C.packetCommitmentSequences=[],C},fromPartial(I){var D,W,ae;let C=K();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C.packetCommitmentSequences=((ae=I.packetCommitmentSequences)==null?void 0:ae.map(ye=>N.Long.fromValue(ye)))||[],C}};function m(){return{acknowledgements:[],pagination:void 0,height:void 0}}e.QueryPacketAcknowledgementsResponse={encode(I,C=F.Writer.create()){for(let D of I.acknowledgements)l.PacketState.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),I.height!==void 0&&g.Height.encode(I.height,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=m();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.acknowledgements.push(l.PacketState.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;case 3:ae.height=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{acknowledgements:Array.isArray(I==null?void 0:I.acknowledgements)?I.acknowledgements.map(C=>l.PacketState.fromJSON(C)):[],pagination:(0,N.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0,height:(0,N.isSet)(I.height)?g.Height.fromJSON(I.height):void 0}},toJSON(I){let C={};return I.acknowledgements?C.acknowledgements=I.acknowledgements.map(D=>D?l.PacketState.toJSON(D):void 0):C.acknowledgements=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),I.height!==void 0&&(C.height=I.height?g.Height.toJSON(I.height):void 0),C},fromPartial(I){var D;let C=m();return C.acknowledgements=((D=I.acknowledgements)==null?void 0:D.map(W=>l.PacketState.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C.height=I.height!==void 0&&I.height!==null?g.Height.fromPartial(I.height):void 0,C}};function h(){return{portId:"",channelId:"",packetCommitmentSequences:[]}}e.QueryUnreceivedPacketsRequest={encode(I,C=F.Writer.create()){I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),C.uint32(26).fork();for(let D of I.packetCommitmentSequences)C.uint64(D);return C.ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=h();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;case 3:if((ye&7)===2){let Xe=D.uint32()+D.pos;for(;D.pos<Xe;)ae.packetCommitmentSequences.push(D.uint64())}else ae.packetCommitmentSequences.push(D.uint64());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):"",packetCommitmentSequences:Array.isArray(I==null?void 0:I.packetCommitmentSequences)?I.packetCommitmentSequences.map(C=>N.Long.fromValue(C)):[]}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),I.packetCommitmentSequences?C.packetCommitmentSequences=I.packetCommitmentSequences.map(D=>(D||N.Long.UZERO).toString()):C.packetCommitmentSequences=[],C},fromPartial(I){var D,W,ae;let C=h();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C.packetCommitmentSequences=((ae=I.packetCommitmentSequences)==null?void 0:ae.map(ye=>N.Long.fromValue(ye)))||[],C}};function _(){return{sequences:[],height:void 0}}e.QueryUnreceivedPacketsResponse={encode(I,C=F.Writer.create()){C.uint32(10).fork();for(let D of I.sequences)C.uint64(D);return C.ldelim(),I.height!==void 0&&g.Height.encode(I.height,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=_();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:if((ye&7)===2){let Xe=D.uint32()+D.pos;for(;D.pos<Xe;)ae.sequences.push(D.uint64())}else ae.sequences.push(D.uint64());break;case 2:ae.height=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{sequences:Array.isArray(I==null?void 0:I.sequences)?I.sequences.map(C=>N.Long.fromValue(C)):[],height:(0,N.isSet)(I.height)?g.Height.fromJSON(I.height):void 0}},toJSON(I){let C={};return I.sequences?C.sequences=I.sequences.map(D=>(D||N.Long.UZERO).toString()):C.sequences=[],I.height!==void 0&&(C.height=I.height?g.Height.toJSON(I.height):void 0),C},fromPartial(I){var D;let C=_();return C.sequences=((D=I.sequences)==null?void 0:D.map(W=>N.Long.fromValue(W)))||[],C.height=I.height!==void 0&&I.height!==null?g.Height.fromPartial(I.height):void 0,C}};function b(){return{portId:"",channelId:"",packetAckSequences:[]}}e.QueryUnreceivedAcksRequest={encode(I,C=F.Writer.create()){I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),C.uint32(26).fork();for(let D of I.packetAckSequences)C.uint64(D);return C.ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=b();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;case 3:if((ye&7)===2){let Xe=D.uint32()+D.pos;for(;D.pos<Xe;)ae.packetAckSequences.push(D.uint64())}else ae.packetAckSequences.push(D.uint64());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):"",packetAckSequences:Array.isArray(I==null?void 0:I.packetAckSequences)?I.packetAckSequences.map(C=>N.Long.fromValue(C)):[]}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),I.packetAckSequences?C.packetAckSequences=I.packetAckSequences.map(D=>(D||N.Long.UZERO).toString()):C.packetAckSequences=[],C},fromPartial(I){var D,W,ae;let C=b();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C.packetAckSequences=((ae=I.packetAckSequences)==null?void 0:ae.map(ye=>N.Long.fromValue(ye)))||[],C}};function O(){return{sequences:[],height:void 0}}e.QueryUnreceivedAcksResponse={encode(I,C=F.Writer.create()){C.uint32(10).fork();for(let D of I.sequences)C.uint64(D);return C.ldelim(),I.height!==void 0&&g.Height.encode(I.height,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=O();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:if((ye&7)===2){let Xe=D.uint32()+D.pos;for(;D.pos<Xe;)ae.sequences.push(D.uint64())}else ae.sequences.push(D.uint64());break;case 2:ae.height=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{sequences:Array.isArray(I==null?void 0:I.sequences)?I.sequences.map(C=>N.Long.fromValue(C)):[],height:(0,N.isSet)(I.height)?g.Height.fromJSON(I.height):void 0}},toJSON(I){let C={};return I.sequences?C.sequences=I.sequences.map(D=>(D||N.Long.UZERO).toString()):C.sequences=[],I.height!==void 0&&(C.height=I.height?g.Height.toJSON(I.height):void 0),C},fromPartial(I){var D;let C=O();return C.sequences=((D=I.sequences)==null?void 0:D.map(W=>N.Long.fromValue(W)))||[],C.height=I.height!==void 0&&I.height!==null?g.Height.fromPartial(I.height):void 0,C}};function J(){return{portId:"",channelId:""}}e.QueryNextSequenceReceiveRequest={encode(I,C=F.Writer.create()){return I.portId!==""&&C.uint32(10).string(I.portId),I.channelId!==""&&C.uint32(18).string(I.channelId),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=J();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.portId=D.string();break;case 2:ae.channelId=D.string();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{portId:(0,N.isSet)(I.portId)?String(I.portId):"",channelId:(0,N.isSet)(I.channelId)?String(I.channelId):""}},toJSON(I){let C={};return I.portId!==void 0&&(C.portId=I.portId),I.channelId!==void 0&&(C.channelId=I.channelId),C},fromPartial(I){var D,W;let C=J();return C.portId=(D=I.portId)!=null?D:"",C.channelId=(W=I.channelId)!=null?W:"",C}};function ie(){return{nextSequenceReceive:N.Long.UZERO,proof:new Uint8Array,proofHeight:void 0}}e.QueryNextSequenceReceiveResponse={encode(I,C=F.Writer.create()){return I.nextSequenceReceive.isZero()||C.uint32(8).uint64(I.nextSequenceReceive),I.proof.length!==0&&C.uint32(18).bytes(I.proof),I.proofHeight!==void 0&&g.Height.encode(I.proofHeight,C.uint32(26).fork()).ldelim(),C},decode(I,C){let D=I instanceof F.Reader?I:new F.Reader(I),W=C===void 0?D.len:D.pos+C,ae=ie();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.nextSequenceReceive=D.uint64();break;case 2:ae.proof=D.bytes();break;case 3:ae.proofHeight=g.Height.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{nextSequenceReceive:(0,N.isSet)(I.nextSequenceReceive)?N.Long.fromValue(I.nextSequenceReceive):N.Long.UZERO,proof:(0,N.isSet)(I.proof)?(0,N.bytesFromBase64)(I.proof):new Uint8Array,proofHeight:(0,N.isSet)(I.proofHeight)?g.Height.fromJSON(I.proofHeight):void 0}},toJSON(I){let C={};return I.nextSequenceReceive!==void 0&&(C.nextSequenceReceive=(I.nextSequenceReceive||N.Long.UZERO).toString()),I.proof!==void 0&&(C.proof=(0,N.base64FromBytes)(I.proof!==void 0?I.proof:new Uint8Array)),I.proofHeight!==void 0&&(C.proofHeight=I.proofHeight?g.Height.toJSON(I.proofHeight):void 0),C},fromPartial(I){var D;let C=ie();return C.nextSequenceReceive=I.nextSequenceReceive!==void 0&&I.nextSequenceReceive!==null?N.Long.fromValue(I.nextSequenceReceive):N.Long.UZERO,C.proof=(D=I.proof)!=null?D:new Uint8Array,C.proofHeight=I.proofHeight!==void 0&&I.proofHeight!==null?g.Height.fromPartial(I.proofHeight):void 0,C}};class G{constructor(C){this.rpc=C,this.Channel=this.Channel.bind(this),this.Channels=this.Channels.bind(this),this.ConnectionChannels=this.ConnectionChannels.bind(this),this.ChannelClientState=this.ChannelClientState.bind(this),this.ChannelConsensusState=this.ChannelConsensusState.bind(this),this.PacketCommitment=this.PacketCommitment.bind(this),this.PacketCommitments=this.PacketCommitments.bind(this),this.PacketReceipt=this.PacketReceipt.bind(this),this.PacketAcknowledgement=this.PacketAcknowledgement.bind(this),this.PacketAcknowledgements=this.PacketAcknowledgements.bind(this),this.UnreceivedPackets=this.UnreceivedPackets.bind(this),this.UnreceivedAcks=this.UnreceivedAcks.bind(this),this.NextSequenceReceive=this.NextSequenceReceive.bind(this)}Channel(C){let D=e.QueryChannelRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","Channel",D).then(ae=>e.QueryChannelResponse.decode(new F.Reader(ae)))}Channels(C={pagination:void 0}){let D=e.QueryChannelsRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","Channels",D).then(ae=>e.QueryChannelsResponse.decode(new F.Reader(ae)))}ConnectionChannels(C){let D=e.QueryConnectionChannelsRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","ConnectionChannels",D).then(ae=>e.QueryConnectionChannelsResponse.decode(new F.Reader(ae)))}ChannelClientState(C){let D=e.QueryChannelClientStateRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","ChannelClientState",D).then(ae=>e.QueryChannelClientStateResponse.decode(new F.Reader(ae)))}ChannelConsensusState(C){let D=e.QueryChannelConsensusStateRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","ChannelConsensusState",D).then(ae=>e.QueryChannelConsensusStateResponse.decode(new F.Reader(ae)))}PacketCommitment(C){let D=e.QueryPacketCommitmentRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","PacketCommitment",D).then(ae=>e.QueryPacketCommitmentResponse.decode(new F.Reader(ae)))}PacketCommitments(C){let D=e.QueryPacketCommitmentsRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","PacketCommitments",D).then(ae=>e.QueryPacketCommitmentsResponse.decode(new F.Reader(ae)))}PacketReceipt(C){let D=e.QueryPacketReceiptRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","PacketReceipt",D).then(ae=>e.QueryPacketReceiptResponse.decode(new F.Reader(ae)))}PacketAcknowledgement(C){let D=e.QueryPacketAcknowledgementRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","PacketAcknowledgement",D).then(ae=>e.QueryPacketAcknowledgementResponse.decode(new F.Reader(ae)))}PacketAcknowledgements(C){let D=e.QueryPacketAcknowledgementsRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","PacketAcknowledgements",D).then(ae=>e.QueryPacketAcknowledgementsResponse.decode(new F.Reader(ae)))}UnreceivedPackets(C){let D=e.QueryUnreceivedPacketsRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","UnreceivedPackets",D).then(ae=>e.QueryUnreceivedPacketsResponse.decode(new F.Reader(ae)))}UnreceivedAcks(C){let D=e.QueryUnreceivedAcksRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","UnreceivedAcks",D).then(ae=>e.QueryUnreceivedAcksResponse.decode(new F.Reader(ae)))}NextSequenceReceive(C){let D=e.QueryNextSequenceReceiveRequest.encode(C).finish();return this.rpc.request("ibc.core.channel.v1.Query","NextSequenceReceive",D).then(ae=>e.QueryNextSequenceReceiveResponse.decode(new F.Reader(ae)))}}e.QueryClientImpl=G})(M$r);var T$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(K,m,h,_){_===void 0&&(_=h);var b=Object.getOwnPropertyDescriptor(m,h);(!b||("get"in b?!m.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return m[h]}}),Object.defineProperty(K,_,b)}:function(K,m,h,_){_===void 0&&(_=h),K[_]=m[h]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(K,m){Object.defineProperty(K,"default",{enumerable:!0,value:m})}:function(K,m){K.default=m}),c=Fr&&Fr.__importStar||function(K){if(K&&K.__esModule)return K;var m={};if(K!=null)for(var h in K)h!=="default"&&Object.prototype.hasOwnProperty.call(K,h)&&i(m,K,h);return A(m,K),m};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryUpgradedConsensusStateResponse=e.QueryUpgradedConsensusStateRequest=e.QueryUpgradedClientStateResponse=e.QueryUpgradedClientStateRequest=e.QueryClientParamsResponse=e.QueryClientParamsRequest=e.QueryClientStatusResponse=e.QueryClientStatusRequest=e.QueryConsensusStateHeightsResponse=e.QueryConsensusStateHeightsRequest=e.QueryConsensusStatesResponse=e.QueryConsensusStatesRequest=e.QueryConsensusStateResponse=e.QueryConsensusStateRequest=e.QueryClientStatesResponse=e.QueryClientStatesRequest=e.QueryClientStateResponse=e.QueryClientStateRequest=e.protobufPackage=void 0;let f=Hm,l=fh,g=lW,w=Ns,N=c(BA);e.protobufPackage="ibc.core.client.v1";function F(){return{clientId:""}}e.QueryClientStateRequest={encode(K,m=N.Writer.create()){return K.clientId!==""&&m.uint32(10).string(K.clientId),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=F();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.clientId=h.string();break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{clientId:(0,w.isSet)(K.clientId)?String(K.clientId):""}},toJSON(K){let m={};return K.clientId!==void 0&&(m.clientId=K.clientId),m},fromPartial(K){var h;let m=F();return m.clientId=(h=K.clientId)!=null?h:"",m}};function j(){return{clientState:void 0,proof:new Uint8Array,proofHeight:void 0}}e.QueryClientStateResponse={encode(K,m=N.Writer.create()){return K.clientState!==void 0&&l.Any.encode(K.clientState,m.uint32(10).fork()).ldelim(),K.proof.length!==0&&m.uint32(18).bytes(K.proof),K.proofHeight!==void 0&&g.Height.encode(K.proofHeight,m.uint32(26).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=j();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.clientState=l.Any.decode(h,h.uint32());break;case 2:b.proof=h.bytes();break;case 3:b.proofHeight=g.Height.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{clientState:(0,w.isSet)(K.clientState)?l.Any.fromJSON(K.clientState):void 0,proof:(0,w.isSet)(K.proof)?(0,w.bytesFromBase64)(K.proof):new Uint8Array,proofHeight:(0,w.isSet)(K.proofHeight)?g.Height.fromJSON(K.proofHeight):void 0}},toJSON(K){let m={};return K.clientState!==void 0&&(m.clientState=K.clientState?l.Any.toJSON(K.clientState):void 0),K.proof!==void 0&&(m.proof=(0,w.base64FromBytes)(K.proof!==void 0?K.proof:new Uint8Array)),K.proofHeight!==void 0&&(m.proofHeight=K.proofHeight?g.Height.toJSON(K.proofHeight):void 0),m},fromPartial(K){var h;let m=j();return m.clientState=K.clientState!==void 0&&K.clientState!==null?l.Any.fromPartial(K.clientState):void 0,m.proof=(h=K.proof)!=null?h:new Uint8Array,m.proofHeight=K.proofHeight!==void 0&&K.proofHeight!==null?g.Height.fromPartial(K.proofHeight):void 0,m}};function te(){return{pagination:void 0}}e.QueryClientStatesRequest={encode(K,m=N.Writer.create()){return K.pagination!==void 0&&f.PageRequest.encode(K.pagination,m.uint32(10).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=te();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.pagination=f.PageRequest.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{pagination:(0,w.isSet)(K.pagination)?f.PageRequest.fromJSON(K.pagination):void 0}},toJSON(K){let m={};return K.pagination!==void 0&&(m.pagination=K.pagination?f.PageRequest.toJSON(K.pagination):void 0),m},fromPartial(K){let m=te();return m.pagination=K.pagination!==void 0&&K.pagination!==null?f.PageRequest.fromPartial(K.pagination):void 0,m}};function v(){return{clientStates:[],pagination:void 0}}e.QueryClientStatesResponse={encode(K,m=N.Writer.create()){for(let h of K.clientStates)g.IdentifiedClientState.encode(h,m.uint32(10).fork()).ldelim();return K.pagination!==void 0&&f.PageResponse.encode(K.pagination,m.uint32(18).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=v();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.clientStates.push(g.IdentifiedClientState.decode(h,h.uint32()));break;case 2:b.pagination=f.PageResponse.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{clientStates:Array.isArray(K==null?void 0:K.clientStates)?K.clientStates.map(m=>g.IdentifiedClientState.fromJSON(m)):[],pagination:(0,w.isSet)(K.pagination)?f.PageResponse.fromJSON(K.pagination):void 0}},toJSON(K){let m={};return K.clientStates?m.clientStates=K.clientStates.map(h=>h?g.IdentifiedClientState.toJSON(h):void 0):m.clientStates=[],K.pagination!==void 0&&(m.pagination=K.pagination?f.PageResponse.toJSON(K.pagination):void 0),m},fromPartial(K){var h;let m=v();return m.clientStates=((h=K.clientStates)==null?void 0:h.map(_=>g.IdentifiedClientState.fromPartial(_)))||[],m.pagination=K.pagination!==void 0&&K.pagination!==null?f.PageResponse.fromPartial(K.pagination):void 0,m}};function ne(){return{clientId:"",revisionNumber:w.Long.UZERO,revisionHeight:w.Long.UZERO,latestHeight:!1}}e.QueryConsensusStateRequest={encode(K,m=N.Writer.create()){return K.clientId!==""&&m.uint32(10).string(K.clientId),K.revisionNumber.isZero()||m.uint32(16).uint64(K.revisionNumber),K.revisionHeight.isZero()||m.uint32(24).uint64(K.revisionHeight),K.latestHeight===!0&&m.uint32(32).bool(K.latestHeight),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=ne();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.clientId=h.string();break;case 2:b.revisionNumber=h.uint64();break;case 3:b.revisionHeight=h.uint64();break;case 4:b.latestHeight=h.bool();break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{clientId:(0,w.isSet)(K.clientId)?String(K.clientId):"",revisionNumber:(0,w.isSet)(K.revisionNumber)?w.Long.fromValue(K.revisionNumber):w.Long.UZERO,revisionHeight:(0,w.isSet)(K.revisionHeight)?w.Long.fromValue(K.revisionHeight):w.Long.UZERO,latestHeight:(0,w.isSet)(K.latestHeight)?!!K.latestHeight:!1}},toJSON(K){let m={};return K.clientId!==void 0&&(m.clientId=K.clientId),K.revisionNumber!==void 0&&(m.revisionNumber=(K.revisionNumber||w.Long.UZERO).toString()),K.revisionHeight!==void 0&&(m.revisionHeight=(K.revisionHeight||w.Long.UZERO).toString()),K.latestHeight!==void 0&&(m.latestHeight=K.latestHeight),m},fromPartial(K){var h,_;let m=ne();return m.clientId=(h=K.clientId)!=null?h:"",m.revisionNumber=K.revisionNumber!==void 0&&K.revisionNumber!==null?w.Long.fromValue(K.revisionNumber):w.Long.UZERO,m.revisionHeight=K.revisionHeight!==void 0&&K.revisionHeight!==null?w.Long.fromValue(K.revisionHeight):w.Long.UZERO,m.latestHeight=(_=K.latestHeight)!=null?_:!1,m}};function Z(){return{consensusState:void 0,proof:new Uint8Array,proofHeight:void 0}}e.QueryConsensusStateResponse={encode(K,m=N.Writer.create()){return K.consensusState!==void 0&&l.Any.encode(K.consensusState,m.uint32(10).fork()).ldelim(),K.proof.length!==0&&m.uint32(18).bytes(K.proof),K.proofHeight!==void 0&&g.Height.encode(K.proofHeight,m.uint32(26).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=Z();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.consensusState=l.Any.decode(h,h.uint32());break;case 2:b.proof=h.bytes();break;case 3:b.proofHeight=g.Height.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{consensusState:(0,w.isSet)(K.consensusState)?l.Any.fromJSON(K.consensusState):void 0,proof:(0,w.isSet)(K.proof)?(0,w.bytesFromBase64)(K.proof):new Uint8Array,proofHeight:(0,w.isSet)(K.proofHeight)?g.Height.fromJSON(K.proofHeight):void 0}},toJSON(K){let m={};return K.consensusState!==void 0&&(m.consensusState=K.consensusState?l.Any.toJSON(K.consensusState):void 0),K.proof!==void 0&&(m.proof=(0,w.base64FromBytes)(K.proof!==void 0?K.proof:new Uint8Array)),K.proofHeight!==void 0&&(m.proofHeight=K.proofHeight?g.Height.toJSON(K.proofHeight):void 0),m},fromPartial(K){var h;let m=Z();return m.consensusState=K.consensusState!==void 0&&K.consensusState!==null?l.Any.fromPartial(K.consensusState):void 0,m.proof=(h=K.proof)!=null?h:new Uint8Array,m.proofHeight=K.proofHeight!==void 0&&K.proofHeight!==null?g.Height.fromPartial(K.proofHeight):void 0,m}};function R(){return{clientId:"",pagination:void 0}}e.QueryConsensusStatesRequest={encode(K,m=N.Writer.create()){return K.clientId!==""&&m.uint32(10).string(K.clientId),K.pagination!==void 0&&f.PageRequest.encode(K.pagination,m.uint32(18).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=R();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.clientId=h.string();break;case 2:b.pagination=f.PageRequest.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{clientId:(0,w.isSet)(K.clientId)?String(K.clientId):"",pagination:(0,w.isSet)(K.pagination)?f.PageRequest.fromJSON(K.pagination):void 0}},toJSON(K){let m={};return K.clientId!==void 0&&(m.clientId=K.clientId),K.pagination!==void 0&&(m.pagination=K.pagination?f.PageRequest.toJSON(K.pagination):void 0),m},fromPartial(K){var h;let m=R();return m.clientId=(h=K.clientId)!=null?h:"",m.pagination=K.pagination!==void 0&&K.pagination!==null?f.PageRequest.fromPartial(K.pagination):void 0,m}};function M(){return{consensusStates:[],pagination:void 0}}e.QueryConsensusStatesResponse={encode(K,m=N.Writer.create()){for(let h of K.consensusStates)g.ConsensusStateWithHeight.encode(h,m.uint32(10).fork()).ldelim();return K.pagination!==void 0&&f.PageResponse.encode(K.pagination,m.uint32(18).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=M();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.consensusStates.push(g.ConsensusStateWithHeight.decode(h,h.uint32()));break;case 2:b.pagination=f.PageResponse.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{consensusStates:Array.isArray(K==null?void 0:K.consensusStates)?K.consensusStates.map(m=>g.ConsensusStateWithHeight.fromJSON(m)):[],pagination:(0,w.isSet)(K.pagination)?f.PageResponse.fromJSON(K.pagination):void 0}},toJSON(K){let m={};return K.consensusStates?m.consensusStates=K.consensusStates.map(h=>h?g.ConsensusStateWithHeight.toJSON(h):void 0):m.consensusStates=[],K.pagination!==void 0&&(m.pagination=K.pagination?f.PageResponse.toJSON(K.pagination):void 0),m},fromPartial(K){var h;let m=M();return m.consensusStates=((h=K.consensusStates)==null?void 0:h.map(_=>g.ConsensusStateWithHeight.fromPartial(_)))||[],m.pagination=K.pagination!==void 0&&K.pagination!==null?f.PageResponse.fromPartial(K.pagination):void 0,m}};function U(){return{clientId:"",pagination:void 0}}e.QueryConsensusStateHeightsRequest={encode(K,m=N.Writer.create()){return K.clientId!==""&&m.uint32(10).string(K.clientId),K.pagination!==void 0&&f.PageRequest.encode(K.pagination,m.uint32(18).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=U();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.clientId=h.string();break;case 2:b.pagination=f.PageRequest.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{clientId:(0,w.isSet)(K.clientId)?String(K.clientId):"",pagination:(0,w.isSet)(K.pagination)?f.PageRequest.fromJSON(K.pagination):void 0}},toJSON(K){let m={};return K.clientId!==void 0&&(m.clientId=K.clientId),K.pagination!==void 0&&(m.pagination=K.pagination?f.PageRequest.toJSON(K.pagination):void 0),m},fromPartial(K){var h;let m=U();return m.clientId=(h=K.clientId)!=null?h:"",m.pagination=K.pagination!==void 0&&K.pagination!==null?f.PageRequest.fromPartial(K.pagination):void 0,m}};function E(){return{consensusStateHeights:[],pagination:void 0}}e.QueryConsensusStateHeightsResponse={encode(K,m=N.Writer.create()){for(let h of K.consensusStateHeights)g.Height.encode(h,m.uint32(10).fork()).ldelim();return K.pagination!==void 0&&f.PageResponse.encode(K.pagination,m.uint32(18).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=E();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.consensusStateHeights.push(g.Height.decode(h,h.uint32()));break;case 2:b.pagination=f.PageResponse.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{consensusStateHeights:Array.isArray(K==null?void 0:K.consensusStateHeights)?K.consensusStateHeights.map(m=>g.Height.fromJSON(m)):[],pagination:(0,w.isSet)(K.pagination)?f.PageResponse.fromJSON(K.pagination):void 0}},toJSON(K){let m={};return K.consensusStateHeights?m.consensusStateHeights=K.consensusStateHeights.map(h=>h?g.Height.toJSON(h):void 0):m.consensusStateHeights=[],K.pagination!==void 0&&(m.pagination=K.pagination?f.PageResponse.toJSON(K.pagination):void 0),m},fromPartial(K){var h;let m=E();return m.consensusStateHeights=((h=K.consensusStateHeights)==null?void 0:h.map(_=>g.Height.fromPartial(_)))||[],m.pagination=K.pagination!==void 0&&K.pagination!==null?f.PageResponse.fromPartial(K.pagination):void 0,m}};function Q(){return{clientId:""}}e.QueryClientStatusRequest={encode(K,m=N.Writer.create()){return K.clientId!==""&&m.uint32(10).string(K.clientId),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=Q();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.clientId=h.string();break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{clientId:(0,w.isSet)(K.clientId)?String(K.clientId):""}},toJSON(K){let m={};return K.clientId!==void 0&&(m.clientId=K.clientId),m},fromPartial(K){var h;let m=Q();return m.clientId=(h=K.clientId)!=null?h:"",m}};function H(){return{status:""}}e.QueryClientStatusResponse={encode(K,m=N.Writer.create()){return K.status!==""&&m.uint32(10).string(K.status),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=H();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.status=h.string();break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{status:(0,w.isSet)(K.status)?String(K.status):""}},toJSON(K){let m={};return K.status!==void 0&&(m.status=K.status),m},fromPartial(K){var h;let m=H();return m.status=(h=K.status)!=null?h:"",m}};function re(){return{}}e.QueryClientParamsRequest={encode(K,m=N.Writer.create()){return m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=re();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){default:h.skipType(O&7);break}}return b},fromJSON(K){return{}},toJSON(K){return{}},fromPartial(K){return re()}};function ee(){return{params:void 0}}e.QueryClientParamsResponse={encode(K,m=N.Writer.create()){return K.params!==void 0&&g.Params.encode(K.params,m.uint32(10).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=ee();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.params=g.Params.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{params:(0,w.isSet)(K.params)?g.Params.fromJSON(K.params):void 0}},toJSON(K){let m={};return K.params!==void 0&&(m.params=K.params?g.Params.toJSON(K.params):void 0),m},fromPartial(K){let m=ee();return m.params=K.params!==void 0&&K.params!==null?g.Params.fromPartial(K.params):void 0,m}};function T(){return{}}e.QueryUpgradedClientStateRequest={encode(K,m=N.Writer.create()){return m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=T();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){default:h.skipType(O&7);break}}return b},fromJSON(K){return{}},toJSON(K){return{}},fromPartial(K){return T()}};function se(){return{upgradedClientState:void 0}}e.QueryUpgradedClientStateResponse={encode(K,m=N.Writer.create()){return K.upgradedClientState!==void 0&&l.Any.encode(K.upgradedClientState,m.uint32(10).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=se();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.upgradedClientState=l.Any.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{upgradedClientState:(0,w.isSet)(K.upgradedClientState)?l.Any.fromJSON(K.upgradedClientState):void 0}},toJSON(K){let m={};return K.upgradedClientState!==void 0&&(m.upgradedClientState=K.upgradedClientState?l.Any.toJSON(K.upgradedClientState):void 0),m},fromPartial(K){let m=se();return m.upgradedClientState=K.upgradedClientState!==void 0&&K.upgradedClientState!==null?l.Any.fromPartial(K.upgradedClientState):void 0,m}};function p(){return{}}e.QueryUpgradedConsensusStateRequest={encode(K,m=N.Writer.create()){return m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=p();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){default:h.skipType(O&7);break}}return b},fromJSON(K){return{}},toJSON(K){return{}},fromPartial(K){return p()}};function L(){return{upgradedConsensusState:void 0}}e.QueryUpgradedConsensusStateResponse={encode(K,m=N.Writer.create()){return K.upgradedConsensusState!==void 0&&l.Any.encode(K.upgradedConsensusState,m.uint32(10).fork()).ldelim(),m},decode(K,m){let h=K instanceof N.Reader?K:new N.Reader(K),_=m===void 0?h.len:h.pos+m,b=L();for(;h.pos<_;){let O=h.uint32();switch(O>>>3){case 1:b.upgradedConsensusState=l.Any.decode(h,h.uint32());break;default:h.skipType(O&7);break}}return b},fromJSON(K){return{upgradedConsensusState:(0,w.isSet)(K.upgradedConsensusState)?l.Any.fromJSON(K.upgradedConsensusState):void 0}},toJSON(K){let m={};return K.upgradedConsensusState!==void 0&&(m.upgradedConsensusState=K.upgradedConsensusState?l.Any.toJSON(K.upgradedConsensusState):void 0),m},fromPartial(K){let m=L();return m.upgradedConsensusState=K.upgradedConsensusState!==void 0&&K.upgradedConsensusState!==null?l.Any.fromPartial(K.upgradedConsensusState):void 0,m}};class V{constructor(m){this.rpc=m,this.ClientState=this.ClientState.bind(this),this.ClientStates=this.ClientStates.bind(this),this.ConsensusState=this.ConsensusState.bind(this),this.ConsensusStates=this.ConsensusStates.bind(this),this.ConsensusStateHeights=this.ConsensusStateHeights.bind(this),this.ClientStatus=this.ClientStatus.bind(this),this.ClientParams=this.ClientParams.bind(this),this.UpgradedClientState=this.UpgradedClientState.bind(this),this.UpgradedConsensusState=this.UpgradedConsensusState.bind(this)}ClientState(m){let h=e.QueryClientStateRequest.encode(m).finish();return this.rpc.request("ibc.core.client.v1.Query","ClientState",h).then(b=>e.QueryClientStateResponse.decode(new N.Reader(b)))}ClientStates(m={pagination:void 0}){let h=e.QueryClientStatesRequest.encode(m).finish();return this.rpc.request("ibc.core.client.v1.Query","ClientStates",h).then(b=>e.QueryClientStatesResponse.decode(new N.Reader(b)))}ConsensusState(m){let h=e.QueryConsensusStateRequest.encode(m).finish();return this.rpc.request("ibc.core.client.v1.Query","ConsensusState",h).then(b=>e.QueryConsensusStateResponse.decode(new N.Reader(b)))}ConsensusStates(m){let h=e.QueryConsensusStatesRequest.encode(m).finish();return this.rpc.request("ibc.core.client.v1.Query","ConsensusStates",h).then(b=>e.QueryConsensusStatesResponse.decode(new N.Reader(b)))}ConsensusStateHeights(m){let h=e.QueryConsensusStateHeightsRequest.encode(m).finish();return this.rpc.request("ibc.core.client.v1.Query","ConsensusStateHeights",h).then(b=>e.QueryConsensusStateHeightsResponse.decode(new N.Reader(b)))}ClientStatus(m){let h=e.QueryClientStatusRequest.encode(m).finish();return this.rpc.request("ibc.core.client.v1.Query","ClientStatus",h).then(b=>e.QueryClientStatusResponse.decode(new N.Reader(b)))}ClientParams(m={}){let h=e.QueryClientParamsRequest.encode(m).finish();return this.rpc.request("ibc.core.client.v1.Query","ClientParams",h).then(b=>e.QueryClientParamsResponse.decode(new N.Reader(b)))}UpgradedClientState(m={}){let h=e.QueryUpgradedClientStateRequest.encode(m).finish();return this.rpc.request("ibc.core.client.v1.Query","UpgradedClientState",h).then(b=>e.QueryUpgradedClientStateResponse.decode(new N.Reader(b)))}UpgradedConsensusState(m={}){let h=e.QueryUpgradedConsensusStateRequest.encode(m).finish();return this.rpc.request("ibc.core.client.v1.Query","UpgradedConsensusState",h).then(b=>e.QueryUpgradedConsensusStateResponse.decode(new N.Reader(b)))}}e.QueryClientImpl=V})(T$r);var U$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(T,se,p,L){L===void 0&&(L=p);var V=Object.getOwnPropertyDescriptor(se,p);(!V||("get"in V?!se.__esModule:V.writable||V.configurable))&&(V={enumerable:!0,get:function(){return se[p]}}),Object.defineProperty(T,L,V)}:function(T,se,p,L){L===void 0&&(L=p),T[L]=se[p]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(T,se){Object.defineProperty(T,"default",{enumerable:!0,value:se})}:function(T,se){T.default=se}),c=Fr&&Fr.__importStar||function(T){if(T&&T.__esModule)return T;var se={};if(T!=null)for(var p in T)p!=="default"&&Object.prototype.hasOwnProperty.call(T,p)&&i(se,T,p);return A(se,T),se};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryConnectionParamsResponse=e.QueryConnectionParamsRequest=e.QueryConnectionConsensusStateResponse=e.QueryConnectionConsensusStateRequest=e.QueryConnectionClientStateResponse=e.QueryConnectionClientStateRequest=e.QueryClientConnectionsResponse=e.QueryClientConnectionsRequest=e.QueryConnectionsResponse=e.QueryConnectionsRequest=e.QueryConnectionResponse=e.QueryConnectionRequest=e.protobufPackage=void 0;let f=Hm,l=IIn,g=lW,w=fh,N=Ns,F=c(BA);e.protobufPackage="ibc.core.connection.v1";function j(){return{connectionId:""}}e.QueryConnectionRequest={encode(T,se=F.Writer.create()){return T.connectionId!==""&&se.uint32(10).string(T.connectionId),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=j();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.connectionId=p.string();break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{connectionId:(0,N.isSet)(T.connectionId)?String(T.connectionId):""}},toJSON(T){let se={};return T.connectionId!==void 0&&(se.connectionId=T.connectionId),se},fromPartial(T){var p;let se=j();return se.connectionId=(p=T.connectionId)!=null?p:"",se}};function te(){return{connection:void 0,proof:new Uint8Array,proofHeight:void 0}}e.QueryConnectionResponse={encode(T,se=F.Writer.create()){return T.connection!==void 0&&l.ConnectionEnd.encode(T.connection,se.uint32(10).fork()).ldelim(),T.proof.length!==0&&se.uint32(18).bytes(T.proof),T.proofHeight!==void 0&&g.Height.encode(T.proofHeight,se.uint32(26).fork()).ldelim(),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=te();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.connection=l.ConnectionEnd.decode(p,p.uint32());break;case 2:V.proof=p.bytes();break;case 3:V.proofHeight=g.Height.decode(p,p.uint32());break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{connection:(0,N.isSet)(T.connection)?l.ConnectionEnd.fromJSON(T.connection):void 0,proof:(0,N.isSet)(T.proof)?(0,N.bytesFromBase64)(T.proof):new Uint8Array,proofHeight:(0,N.isSet)(T.proofHeight)?g.Height.fromJSON(T.proofHeight):void 0}},toJSON(T){let se={};return T.connection!==void 0&&(se.connection=T.connection?l.ConnectionEnd.toJSON(T.connection):void 0),T.proof!==void 0&&(se.proof=(0,N.base64FromBytes)(T.proof!==void 0?T.proof:new Uint8Array)),T.proofHeight!==void 0&&(se.proofHeight=T.proofHeight?g.Height.toJSON(T.proofHeight):void 0),se},fromPartial(T){var p;let se=te();return se.connection=T.connection!==void 0&&T.connection!==null?l.ConnectionEnd.fromPartial(T.connection):void 0,se.proof=(p=T.proof)!=null?p:new Uint8Array,se.proofHeight=T.proofHeight!==void 0&&T.proofHeight!==null?g.Height.fromPartial(T.proofHeight):void 0,se}};function v(){return{pagination:void 0}}e.QueryConnectionsRequest={encode(T,se=F.Writer.create()){return T.pagination!==void 0&&f.PageRequest.encode(T.pagination,se.uint32(10).fork()).ldelim(),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=v();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.pagination=f.PageRequest.decode(p,p.uint32());break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{pagination:(0,N.isSet)(T.pagination)?f.PageRequest.fromJSON(T.pagination):void 0}},toJSON(T){let se={};return T.pagination!==void 0&&(se.pagination=T.pagination?f.PageRequest.toJSON(T.pagination):void 0),se},fromPartial(T){let se=v();return se.pagination=T.pagination!==void 0&&T.pagination!==null?f.PageRequest.fromPartial(T.pagination):void 0,se}};function ne(){return{connections:[],pagination:void 0,height:void 0}}e.QueryConnectionsResponse={encode(T,se=F.Writer.create()){for(let p of T.connections)l.IdentifiedConnection.encode(p,se.uint32(10).fork()).ldelim();return T.pagination!==void 0&&f.PageResponse.encode(T.pagination,se.uint32(18).fork()).ldelim(),T.height!==void 0&&g.Height.encode(T.height,se.uint32(26).fork()).ldelim(),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=ne();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.connections.push(l.IdentifiedConnection.decode(p,p.uint32()));break;case 2:V.pagination=f.PageResponse.decode(p,p.uint32());break;case 3:V.height=g.Height.decode(p,p.uint32());break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{connections:Array.isArray(T==null?void 0:T.connections)?T.connections.map(se=>l.IdentifiedConnection.fromJSON(se)):[],pagination:(0,N.isSet)(T.pagination)?f.PageResponse.fromJSON(T.pagination):void 0,height:(0,N.isSet)(T.height)?g.Height.fromJSON(T.height):void 0}},toJSON(T){let se={};return T.connections?se.connections=T.connections.map(p=>p?l.IdentifiedConnection.toJSON(p):void 0):se.connections=[],T.pagination!==void 0&&(se.pagination=T.pagination?f.PageResponse.toJSON(T.pagination):void 0),T.height!==void 0&&(se.height=T.height?g.Height.toJSON(T.height):void 0),se},fromPartial(T){var p;let se=ne();return se.connections=((p=T.connections)==null?void 0:p.map(L=>l.IdentifiedConnection.fromPartial(L)))||[],se.pagination=T.pagination!==void 0&&T.pagination!==null?f.PageResponse.fromPartial(T.pagination):void 0,se.height=T.height!==void 0&&T.height!==null?g.Height.fromPartial(T.height):void 0,se}};function Z(){return{clientId:""}}e.QueryClientConnectionsRequest={encode(T,se=F.Writer.create()){return T.clientId!==""&&se.uint32(10).string(T.clientId),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=Z();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.clientId=p.string();break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{clientId:(0,N.isSet)(T.clientId)?String(T.clientId):""}},toJSON(T){let se={};return T.clientId!==void 0&&(se.clientId=T.clientId),se},fromPartial(T){var p;let se=Z();return se.clientId=(p=T.clientId)!=null?p:"",se}};function R(){return{connectionPaths:[],proof:new Uint8Array,proofHeight:void 0}}e.QueryClientConnectionsResponse={encode(T,se=F.Writer.create()){for(let p of T.connectionPaths)se.uint32(10).string(p);return T.proof.length!==0&&se.uint32(18).bytes(T.proof),T.proofHeight!==void 0&&g.Height.encode(T.proofHeight,se.uint32(26).fork()).ldelim(),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=R();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.connectionPaths.push(p.string());break;case 2:V.proof=p.bytes();break;case 3:V.proofHeight=g.Height.decode(p,p.uint32());break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{connectionPaths:Array.isArray(T==null?void 0:T.connectionPaths)?T.connectionPaths.map(se=>String(se)):[],proof:(0,N.isSet)(T.proof)?(0,N.bytesFromBase64)(T.proof):new Uint8Array,proofHeight:(0,N.isSet)(T.proofHeight)?g.Height.fromJSON(T.proofHeight):void 0}},toJSON(T){let se={};return T.connectionPaths?se.connectionPaths=T.connectionPaths.map(p=>p):se.connectionPaths=[],T.proof!==void 0&&(se.proof=(0,N.base64FromBytes)(T.proof!==void 0?T.proof:new Uint8Array)),T.proofHeight!==void 0&&(se.proofHeight=T.proofHeight?g.Height.toJSON(T.proofHeight):void 0),se},fromPartial(T){var p,L;let se=R();return se.connectionPaths=((p=T.connectionPaths)==null?void 0:p.map(V=>V))||[],se.proof=(L=T.proof)!=null?L:new Uint8Array,se.proofHeight=T.proofHeight!==void 0&&T.proofHeight!==null?g.Height.fromPartial(T.proofHeight):void 0,se}};function M(){return{connectionId:""}}e.QueryConnectionClientStateRequest={encode(T,se=F.Writer.create()){return T.connectionId!==""&&se.uint32(10).string(T.connectionId),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=M();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.connectionId=p.string();break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{connectionId:(0,N.isSet)(T.connectionId)?String(T.connectionId):""}},toJSON(T){let se={};return T.connectionId!==void 0&&(se.connectionId=T.connectionId),se},fromPartial(T){var p;let se=M();return se.connectionId=(p=T.connectionId)!=null?p:"",se}};function U(){return{identifiedClientState:void 0,proof:new Uint8Array,proofHeight:void 0}}e.QueryConnectionClientStateResponse={encode(T,se=F.Writer.create()){return T.identifiedClientState!==void 0&&g.IdentifiedClientState.encode(T.identifiedClientState,se.uint32(10).fork()).ldelim(),T.proof.length!==0&&se.uint32(18).bytes(T.proof),T.proofHeight!==void 0&&g.Height.encode(T.proofHeight,se.uint32(26).fork()).ldelim(),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=U();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.identifiedClientState=g.IdentifiedClientState.decode(p,p.uint32());break;case 2:V.proof=p.bytes();break;case 3:V.proofHeight=g.Height.decode(p,p.uint32());break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{identifiedClientState:(0,N.isSet)(T.identifiedClientState)?g.IdentifiedClientState.fromJSON(T.identifiedClientState):void 0,proof:(0,N.isSet)(T.proof)?(0,N.bytesFromBase64)(T.proof):new Uint8Array,proofHeight:(0,N.isSet)(T.proofHeight)?g.Height.fromJSON(T.proofHeight):void 0}},toJSON(T){let se={};return T.identifiedClientState!==void 0&&(se.identifiedClientState=T.identifiedClientState?g.IdentifiedClientState.toJSON(T.identifiedClientState):void 0),T.proof!==void 0&&(se.proof=(0,N.base64FromBytes)(T.proof!==void 0?T.proof:new Uint8Array)),T.proofHeight!==void 0&&(se.proofHeight=T.proofHeight?g.Height.toJSON(T.proofHeight):void 0),se},fromPartial(T){var p;let se=U();return se.identifiedClientState=T.identifiedClientState!==void 0&&T.identifiedClientState!==null?g.IdentifiedClientState.fromPartial(T.identifiedClientState):void 0,se.proof=(p=T.proof)!=null?p:new Uint8Array,se.proofHeight=T.proofHeight!==void 0&&T.proofHeight!==null?g.Height.fromPartial(T.proofHeight):void 0,se}};function E(){return{connectionId:"",revisionNumber:N.Long.UZERO,revisionHeight:N.Long.UZERO}}e.QueryConnectionConsensusStateRequest={encode(T,se=F.Writer.create()){return T.connectionId!==""&&se.uint32(10).string(T.connectionId),T.revisionNumber.isZero()||se.uint32(16).uint64(T.revisionNumber),T.revisionHeight.isZero()||se.uint32(24).uint64(T.revisionHeight),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=E();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.connectionId=p.string();break;case 2:V.revisionNumber=p.uint64();break;case 3:V.revisionHeight=p.uint64();break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{connectionId:(0,N.isSet)(T.connectionId)?String(T.connectionId):"",revisionNumber:(0,N.isSet)(T.revisionNumber)?N.Long.fromValue(T.revisionNumber):N.Long.UZERO,revisionHeight:(0,N.isSet)(T.revisionHeight)?N.Long.fromValue(T.revisionHeight):N.Long.UZERO}},toJSON(T){let se={};return T.connectionId!==void 0&&(se.connectionId=T.connectionId),T.revisionNumber!==void 0&&(se.revisionNumber=(T.revisionNumber||N.Long.UZERO).toString()),T.revisionHeight!==void 0&&(se.revisionHeight=(T.revisionHeight||N.Long.UZERO).toString()),se},fromPartial(T){var p;let se=E();return se.connectionId=(p=T.connectionId)!=null?p:"",se.revisionNumber=T.revisionNumber!==void 0&&T.revisionNumber!==null?N.Long.fromValue(T.revisionNumber):N.Long.UZERO,se.revisionHeight=T.revisionHeight!==void 0&&T.revisionHeight!==null?N.Long.fromValue(T.revisionHeight):N.Long.UZERO,se}};function Q(){return{consensusState:void 0,clientId:"",proof:new Uint8Array,proofHeight:void 0}}e.QueryConnectionConsensusStateResponse={encode(T,se=F.Writer.create()){return T.consensusState!==void 0&&w.Any.encode(T.consensusState,se.uint32(10).fork()).ldelim(),T.clientId!==""&&se.uint32(18).string(T.clientId),T.proof.length!==0&&se.uint32(26).bytes(T.proof),T.proofHeight!==void 0&&g.Height.encode(T.proofHeight,se.uint32(34).fork()).ldelim(),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=Q();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.consensusState=w.Any.decode(p,p.uint32());break;case 2:V.clientId=p.string();break;case 3:V.proof=p.bytes();break;case 4:V.proofHeight=g.Height.decode(p,p.uint32());break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{consensusState:(0,N.isSet)(T.consensusState)?w.Any.fromJSON(T.consensusState):void 0,clientId:(0,N.isSet)(T.clientId)?String(T.clientId):"",proof:(0,N.isSet)(T.proof)?(0,N.bytesFromBase64)(T.proof):new Uint8Array,proofHeight:(0,N.isSet)(T.proofHeight)?g.Height.fromJSON(T.proofHeight):void 0}},toJSON(T){let se={};return T.consensusState!==void 0&&(se.consensusState=T.consensusState?w.Any.toJSON(T.consensusState):void 0),T.clientId!==void 0&&(se.clientId=T.clientId),T.proof!==void 0&&(se.proof=(0,N.base64FromBytes)(T.proof!==void 0?T.proof:new Uint8Array)),T.proofHeight!==void 0&&(se.proofHeight=T.proofHeight?g.Height.toJSON(T.proofHeight):void 0),se},fromPartial(T){var p,L;let se=Q();return se.consensusState=T.consensusState!==void 0&&T.consensusState!==null?w.Any.fromPartial(T.consensusState):void 0,se.clientId=(p=T.clientId)!=null?p:"",se.proof=(L=T.proof)!=null?L:new Uint8Array,se.proofHeight=T.proofHeight!==void 0&&T.proofHeight!==null?g.Height.fromPartial(T.proofHeight):void 0,se}};function H(){return{}}e.QueryConnectionParamsRequest={encode(T,se=F.Writer.create()){return se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=H();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){default:p.skipType(K&7);break}}return V},fromJSON(T){return{}},toJSON(T){return{}},fromPartial(T){return H()}};function re(){return{params:void 0}}e.QueryConnectionParamsResponse={encode(T,se=F.Writer.create()){return T.params!==void 0&&g.Params.encode(T.params,se.uint32(10).fork()).ldelim(),se},decode(T,se){let p=T instanceof F.Reader?T:new F.Reader(T),L=se===void 0?p.len:p.pos+se,V=re();for(;p.pos<L;){let K=p.uint32();switch(K>>>3){case 1:V.params=g.Params.decode(p,p.uint32());break;default:p.skipType(K&7);break}}return V},fromJSON(T){return{params:(0,N.isSet)(T.params)?g.Params.fromJSON(T.params):void 0}},toJSON(T){let se={};return T.params!==void 0&&(se.params=T.params?g.Params.toJSON(T.params):void 0),se},fromPartial(T){let se=re();return se.params=T.params!==void 0&&T.params!==null?g.Params.fromPartial(T.params):void 0,se}};class ee{constructor(se){this.rpc=se,this.Connection=this.Connection.bind(this),this.Connections=this.Connections.bind(this),this.ClientConnections=this.ClientConnections.bind(this),this.ConnectionClientState=this.ConnectionClientState.bind(this),this.ConnectionConsensusState=this.ConnectionConsensusState.bind(this),this.ConnectionParams=this.ConnectionParams.bind(this)}Connection(se){let p=e.QueryConnectionRequest.encode(se).finish();return this.rpc.request("ibc.core.connection.v1.Query","Connection",p).then(V=>e.QueryConnectionResponse.decode(new F.Reader(V)))}Connections(se={pagination:void 0}){let p=e.QueryConnectionsRequest.encode(se).finish();return this.rpc.request("ibc.core.connection.v1.Query","Connections",p).then(V=>e.QueryConnectionsResponse.decode(new F.Reader(V)))}ClientConnections(se){let p=e.QueryClientConnectionsRequest.encode(se).finish();return this.rpc.request("ibc.core.connection.v1.Query","ClientConnections",p).then(V=>e.QueryClientConnectionsResponse.decode(new F.Reader(V)))}ConnectionClientState(se){let p=e.QueryConnectionClientStateRequest.encode(se).finish();return this.rpc.request("ibc.core.connection.v1.Query","ConnectionClientState",p).then(V=>e.QueryConnectionClientStateResponse.decode(new F.Reader(V)))}ConnectionConsensusState(se){let p=e.QueryConnectionConsensusStateRequest.encode(se).finish();return this.rpc.request("ibc.core.connection.v1.Query","ConnectionConsensusState",p).then(V=>e.QueryConnectionConsensusStateResponse.decode(new F.Reader(V)))}ConnectionParams(se={}){let p=e.QueryConnectionParamsRequest.encode(se).finish();return this.rpc.request("ibc.core.connection.v1.Query","ConnectionParams",p).then(V=>e.QueryConnectionParamsResponse.decode(new F.Reader(V)))}}e.QueryClientImpl=ee})(U$r);var F$r={},Yfe={},_In={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(te,v,ne,Z){Z===void 0&&(Z=ne);var R=Object.getOwnPropertyDescriptor(v,ne);(!R||("get"in R?!v.__esModule:R.writable||R.configurable))&&(R={enumerable:!0,get:function(){return v[ne]}}),Object.defineProperty(te,Z,R)}:function(te,v,ne,Z){Z===void 0&&(Z=ne),te[Z]=v[ne]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(te,v){Object.defineProperty(te,"default",{enumerable:!0,value:v})}:function(te,v){te.default=v}),c=Fr&&Fr.__importStar||function(te){if(te&&te.__esModule)return te;var v={};if(te!=null)for(var ne in te)ne!=="default"&&Object.prototype.hasOwnProperty.call(te,ne)&&i(v,te,ne);return A(v,te),v};Object.defineProperty(e,"__esModule",{value:!0}),e.ProofOps=e.ProofOp=e.DominoOp=e.ValueOp=e.Proof=e.protobufPackage=void 0;let f=Ns,l=c(BA);e.protobufPackage="tendermint.crypto";function g(){return{total:f.Long.ZERO,index:f.Long.ZERO,leafHash:new Uint8Array,aunts:[]}}e.Proof={encode(te,v=l.Writer.create()){te.total.isZero()||v.uint32(8).int64(te.total),te.index.isZero()||v.uint32(16).int64(te.index),te.leafHash.length!==0&&v.uint32(26).bytes(te.leafHash);for(let ne of te.aunts)v.uint32(34).bytes(ne);return v},decode(te,v){let ne=te instanceof l.Reader?te:new l.Reader(te),Z=v===void 0?ne.len:ne.pos+v,R=g();for(;ne.pos<Z;){let M=ne.uint32();switch(M>>>3){case 1:R.total=ne.int64();break;case 2:R.index=ne.int64();break;case 3:R.leafHash=ne.bytes();break;case 4:R.aunts.push(ne.bytes());break;default:ne.skipType(M&7);break}}return R},fromJSON(te){return{total:(0,f.isSet)(te.total)?f.Long.fromValue(te.total):f.Long.ZERO,index:(0,f.isSet)(te.index)?f.Long.fromValue(te.index):f.Long.ZERO,leafHash:(0,f.isSet)(te.leafHash)?(0,f.bytesFromBase64)(te.leafHash):new Uint8Array,aunts:Array.isArray(te==null?void 0:te.aunts)?te.aunts.map(v=>(0,f.bytesFromBase64)(v)):[]}},toJSON(te){let v={};return te.total!==void 0&&(v.total=(te.total||f.Long.ZERO).toString()),te.index!==void 0&&(v.index=(te.index||f.Long.ZERO).toString()),te.leafHash!==void 0&&(v.leafHash=(0,f.base64FromBytes)(te.leafHash!==void 0?te.leafHash:new Uint8Array)),te.aunts?v.aunts=te.aunts.map(ne=>(0,f.base64FromBytes)(ne!==void 0?ne:new Uint8Array)):v.aunts=[],v},fromPartial(te){var ne,Z;let v=g();return v.total=te.total!==void 0&&te.total!==null?f.Long.fromValue(te.total):f.Long.ZERO,v.index=te.index!==void 0&&te.index!==null?f.Long.fromValue(te.index):f.Long.ZERO,v.leafHash=(ne=te.leafHash)!=null?ne:new Uint8Array,v.aunts=((Z=te.aunts)==null?void 0:Z.map(R=>R))||[],v}};function w(){return{key:new Uint8Array,proof:void 0}}e.ValueOp={encode(te,v=l.Writer.create()){return te.key.length!==0&&v.uint32(10).bytes(te.key),te.proof!==void 0&&e.Proof.encode(te.proof,v.uint32(18).fork()).ldelim(),v},decode(te,v){let ne=te instanceof l.Reader?te:new l.Reader(te),Z=v===void 0?ne.len:ne.pos+v,R=w();for(;ne.pos<Z;){let M=ne.uint32();switch(M>>>3){case 1:R.key=ne.bytes();break;case 2:R.proof=e.Proof.decode(ne,ne.uint32());break;default:ne.skipType(M&7);break}}return R},fromJSON(te){return{key:(0,f.isSet)(te.key)?(0,f.bytesFromBase64)(te.key):new Uint8Array,proof:(0,f.isSet)(te.proof)?e.Proof.fromJSON(te.proof):void 0}},toJSON(te){let v={};return te.key!==void 0&&(v.key=(0,f.base64FromBytes)(te.key!==void 0?te.key:new Uint8Array)),te.proof!==void 0&&(v.proof=te.proof?e.Proof.toJSON(te.proof):void 0),v},fromPartial(te){var ne;let v=w();return v.key=(ne=te.key)!=null?ne:new Uint8Array,v.proof=te.proof!==void 0&&te.proof!==null?e.Proof.fromPartial(te.proof):void 0,v}};function N(){return{key:"",input:"",output:""}}e.DominoOp={encode(te,v=l.Writer.create()){return te.key!==""&&v.uint32(10).string(te.key),te.input!==""&&v.uint32(18).string(te.input),te.output!==""&&v.uint32(26).string(te.output),v},decode(te,v){let ne=te instanceof l.Reader?te:new l.Reader(te),Z=v===void 0?ne.len:ne.pos+v,R=N();for(;ne.pos<Z;){let M=ne.uint32();switch(M>>>3){case 1:R.key=ne.string();break;case 2:R.input=ne.string();break;case 3:R.output=ne.string();break;default:ne.skipType(M&7);break}}return R},fromJSON(te){return{key:(0,f.isSet)(te.key)?String(te.key):"",input:(0,f.isSet)(te.input)?String(te.input):"",output:(0,f.isSet)(te.output)?String(te.output):""}},toJSON(te){let v={};return te.key!==void 0&&(v.key=te.key),te.input!==void 0&&(v.input=te.input),te.output!==void 0&&(v.output=te.output),v},fromPartial(te){var ne,Z,R;let v=N();return v.key=(ne=te.key)!=null?ne:"",v.input=(Z=te.input)!=null?Z:"",v.output=(R=te.output)!=null?R:"",v}};function F(){return{type:"",key:new Uint8Array,data:new Uint8Array}}e.ProofOp={encode(te,v=l.Writer.create()){return te.type!==""&&v.uint32(10).string(te.type),te.key.length!==0&&v.uint32(18).bytes(te.key),te.data.length!==0&&v.uint32(26).bytes(te.data),v},decode(te,v){let ne=te instanceof l.Reader?te:new l.Reader(te),Z=v===void 0?ne.len:ne.pos+v,R=F();for(;ne.pos<Z;){let M=ne.uint32();switch(M>>>3){case 1:R.type=ne.string();break;case 2:R.key=ne.bytes();break;case 3:R.data=ne.bytes();break;default:ne.skipType(M&7);break}}return R},fromJSON(te){return{type:(0,f.isSet)(te.type)?String(te.type):"",key:(0,f.isSet)(te.key)?(0,f.bytesFromBase64)(te.key):new Uint8Array,data:(0,f.isSet)(te.data)?(0,f.bytesFromBase64)(te.data):new Uint8Array}},toJSON(te){let v={};return te.type!==void 0&&(v.type=te.type),te.key!==void 0&&(v.key=(0,f.base64FromBytes)(te.key!==void 0?te.key:new Uint8Array)),te.data!==void 0&&(v.data=(0,f.base64FromBytes)(te.data!==void 0?te.data:new Uint8Array)),v},fromPartial(te){var ne,Z,R;let v=F();return v.type=(ne=te.type)!=null?ne:"",v.key=(Z=te.key)!=null?Z:new Uint8Array,v.data=(R=te.data)!=null?R:new Uint8Array,v}};function j(){return{ops:[]}}e.ProofOps={encode(te,v=l.Writer.create()){for(let ne of te.ops)e.ProofOp.encode(ne,v.uint32(10).fork()).ldelim();return v},decode(te,v){let ne=te instanceof l.Reader?te:new l.Reader(te),Z=v===void 0?ne.len:ne.pos+v,R=j();for(;ne.pos<Z;){let M=ne.uint32();switch(M>>>3){case 1:R.ops.push(e.ProofOp.decode(ne,ne.uint32()));break;default:ne.skipType(M&7);break}}return R},fromJSON(te){return{ops:Array.isArray(te==null?void 0:te.ops)?te.ops.map(v=>e.ProofOp.fromJSON(v)):[]}},toJSON(te){let v={};return te.ops?v.ops=te.ops.map(ne=>ne?e.ProofOp.toJSON(ne):void 0):v.ops=[],v},fromPartial(te){var ne;let v=j();return v.ops=((ne=te.ops)==null?void 0:ne.map(Z=>e.ProofOp.fromPartial(Z)))||[],v}}})(_In);var Yie={},D8s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),R8s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),P8s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&D8s(i,e,A);return R8s(i,e),i};Object.defineProperty(Yie,"__esModule",{value:!0});Yie.Consensus=Yie.App=Yie.protobufPackage=void 0;var fm=Ns,x8e=P8s(BA);Yie.protobufPackage="tendermint.version";function BLr(){return{protocol:fm.Long.UZERO,software:""}}Yie.App={encode(e,i=x8e.Writer.create()){return e.protocol.isZero()||i.uint32(8).uint64(e.protocol),e.software!==""&&i.uint32(18).string(e.software),i},decode(e,i){let A=e instanceof x8e.Reader?e:new x8e.Reader(e),c=i===void 0?A.len:A.pos+i,f=BLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.protocol=A.uint64();break;case 2:f.software=A.string();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{protocol:(0,fm.isSet)(e.protocol)?fm.Long.fromValue(e.protocol):fm.Long.UZERO,software:(0,fm.isSet)(e.software)?String(e.software):""}},toJSON(e){let i={};return e.protocol!==void 0&&(i.protocol=(e.protocol||fm.Long.UZERO).toString()),e.software!==void 0&&(i.software=e.software),i},fromPartial(e){var A;let i=BLr();return i.protocol=e.protocol!==void 0&&e.protocol!==null?fm.Long.fromValue(e.protocol):fm.Long.UZERO,i.software=(A=e.software)!=null?A:"",i}};function vLr(){return{block:fm.Long.UZERO,app:fm.Long.UZERO}}Yie.Consensus={encode(e,i=x8e.Writer.create()){return e.block.isZero()||i.uint32(8).uint64(e.block),e.app.isZero()||i.uint32(16).uint64(e.app),i},decode(e,i){let A=e instanceof x8e.Reader?e:new x8e.Reader(e),c=i===void 0?A.len:A.pos+i,f=vLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.block=A.uint64();break;case 2:f.app=A.uint64();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{block:(0,fm.isSet)(e.block)?fm.Long.fromValue(e.block):fm.Long.UZERO,app:(0,fm.isSet)(e.app)?fm.Long.fromValue(e.app):fm.Long.UZERO}},toJSON(e){let i={};return e.block!==void 0&&(i.block=(e.block||fm.Long.UZERO).toString()),e.app!==void 0&&(i.app=(e.app||fm.Long.UZERO).toString()),i},fromPartial(e){let i=vLr();return i.block=e.block!==void 0&&e.block!==null?fm.Long.fromValue(e.block):fm.Long.UZERO,i.app=e.app!==void 0&&e.app!==null?fm.Long.fromValue(e.app):fm.Long.UZERO,i}};var hvt={},bfe={},O8s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),N8s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),x8s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&O8s(i,e,A);return N8s(i,e),i};Object.defineProperty(bfe,"__esModule",{value:!0});bfe.PublicKey=bfe.protobufPackage=void 0;var O2n=x8s(BA),M6e=Ns;bfe.protobufPackage="tendermint.crypto";function bLr(){return{ed25519:void 0,secp256k1:void 0}}bfe.PublicKey={encode(e,i=O2n.Writer.create()){return e.ed25519!==void 0&&i.uint32(10).bytes(e.ed25519),e.secp256k1!==void 0&&i.uint32(18).bytes(e.secp256k1),i},decode(e,i){let A=e instanceof O2n.Reader?e:new O2n.Reader(e),c=i===void 0?A.len:A.pos+i,f=bLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.ed25519=A.bytes();break;case 2:f.secp256k1=A.bytes();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{ed25519:(0,M6e.isSet)(e.ed25519)?(0,M6e.bytesFromBase64)(e.ed25519):void 0,secp256k1:(0,M6e.isSet)(e.secp256k1)?(0,M6e.bytesFromBase64)(e.secp256k1):void 0}},toJSON(e){let i={};return e.ed25519!==void 0&&(i.ed25519=e.ed25519!==void 0?(0,M6e.base64FromBytes)(e.ed25519):void 0),e.secp256k1!==void 0&&(i.secp256k1=e.secp256k1!==void 0?(0,M6e.base64FromBytes)(e.secp256k1):void 0),i},fromPartial(e){var A,c;let i=bLr();return i.ed25519=(A=e.ed25519)!=null?A:void 0,i.secp256k1=(c=e.secp256k1)!=null?c:void 0,i}};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(j,te,v,ne){ne===void 0&&(ne=v);var Z=Object.getOwnPropertyDescriptor(te,v);(!Z||("get"in Z?!te.__esModule:Z.writable||Z.configurable))&&(Z={enumerable:!0,get:function(){return te[v]}}),Object.defineProperty(j,ne,Z)}:function(j,te,v,ne){ne===void 0&&(ne=v),j[ne]=te[v]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(j,te){Object.defineProperty(j,"default",{enumerable:!0,value:te})}:function(j,te){j.default=te}),c=Fr&&Fr.__importStar||function(j){if(j&&j.__esModule)return j;var te={};if(j!=null)for(var v in j)v!=="default"&&Object.prototype.hasOwnProperty.call(j,v)&&i(te,j,v);return A(te,j),te};Object.defineProperty(e,"__esModule",{value:!0}),e.SimpleValidator=e.Validator=e.ValidatorSet=e.protobufPackage=void 0;let f=bfe,l=Ns,g=c(BA);e.protobufPackage="tendermint.types";function w(){return{validators:[],proposer:void 0,totalVotingPower:l.Long.ZERO}}e.ValidatorSet={encode(j,te=g.Writer.create()){for(let v of j.validators)e.Validator.encode(v,te.uint32(10).fork()).ldelim();return j.proposer!==void 0&&e.Validator.encode(j.proposer,te.uint32(18).fork()).ldelim(),j.totalVotingPower.isZero()||te.uint32(24).int64(j.totalVotingPower),te},decode(j,te){let v=j instanceof g.Reader?j:new g.Reader(j),ne=te===void 0?v.len:v.pos+te,Z=w();for(;v.pos<ne;){let R=v.uint32();switch(R>>>3){case 1:Z.validators.push(e.Validator.decode(v,v.uint32()));break;case 2:Z.proposer=e.Validator.decode(v,v.uint32());break;case 3:Z.totalVotingPower=v.int64();break;default:v.skipType(R&7);break}}return Z},fromJSON(j){return{validators:Array.isArray(j==null?void 0:j.validators)?j.validators.map(te=>e.Validator.fromJSON(te)):[],proposer:(0,l.isSet)(j.proposer)?e.Validator.fromJSON(j.proposer):void 0,totalVotingPower:(0,l.isSet)(j.totalVotingPower)?l.Long.fromValue(j.totalVotingPower):l.Long.ZERO}},toJSON(j){let te={};return j.validators?te.validators=j.validators.map(v=>v?e.Validator.toJSON(v):void 0):te.validators=[],j.proposer!==void 0&&(te.proposer=j.proposer?e.Validator.toJSON(j.proposer):void 0),j.totalVotingPower!==void 0&&(te.totalVotingPower=(j.totalVotingPower||l.Long.ZERO).toString()),te},fromPartial(j){var v;let te=w();return te.validators=((v=j.validators)==null?void 0:v.map(ne=>e.Validator.fromPartial(ne)))||[],te.proposer=j.proposer!==void 0&&j.proposer!==null?e.Validator.fromPartial(j.proposer):void 0,te.totalVotingPower=j.totalVotingPower!==void 0&&j.totalVotingPower!==null?l.Long.fromValue(j.totalVotingPower):l.Long.ZERO,te}};function N(){return{address:new Uint8Array,pubKey:void 0,votingPower:l.Long.ZERO,proposerPriority:l.Long.ZERO}}e.Validator={encode(j,te=g.Writer.create()){return j.address.length!==0&&te.uint32(10).bytes(j.address),j.pubKey!==void 0&&f.PublicKey.encode(j.pubKey,te.uint32(18).fork()).ldelim(),j.votingPower.isZero()||te.uint32(24).int64(j.votingPower),j.proposerPriority.isZero()||te.uint32(32).int64(j.proposerPriority),te},decode(j,te){let v=j instanceof g.Reader?j:new g.Reader(j),ne=te===void 0?v.len:v.pos+te,Z=N();for(;v.pos<ne;){let R=v.uint32();switch(R>>>3){case 1:Z.address=v.bytes();break;case 2:Z.pubKey=f.PublicKey.decode(v,v.uint32());break;case 3:Z.votingPower=v.int64();break;case 4:Z.proposerPriority=v.int64();break;default:v.skipType(R&7);break}}return Z},fromJSON(j){return{address:(0,l.isSet)(j.address)?(0,l.bytesFromBase64)(j.address):new Uint8Array,pubKey:(0,l.isSet)(j.pubKey)?f.PublicKey.fromJSON(j.pubKey):void 0,votingPower:(0,l.isSet)(j.votingPower)?l.Long.fromValue(j.votingPower):l.Long.ZERO,proposerPriority:(0,l.isSet)(j.proposerPriority)?l.Long.fromValue(j.proposerPriority):l.Long.ZERO}},toJSON(j){let te={};return j.address!==void 0&&(te.address=(0,l.base64FromBytes)(j.address!==void 0?j.address:new Uint8Array)),j.pubKey!==void 0&&(te.pubKey=j.pubKey?f.PublicKey.toJSON(j.pubKey):void 0),j.votingPower!==void 0&&(te.votingPower=(j.votingPower||l.Long.ZERO).toString()),j.proposerPriority!==void 0&&(te.proposerPriority=(j.proposerPriority||l.Long.ZERO).toString()),te},fromPartial(j){var v;let te=N();return te.address=(v=j.address)!=null?v:new Uint8Array,te.pubKey=j.pubKey!==void 0&&j.pubKey!==null?f.PublicKey.fromPartial(j.pubKey):void 0,te.votingPower=j.votingPower!==void 0&&j.votingPower!==null?l.Long.fromValue(j.votingPower):l.Long.ZERO,te.proposerPriority=j.proposerPriority!==void 0&&j.proposerPriority!==null?l.Long.fromValue(j.proposerPriority):l.Long.ZERO,te}};function F(){return{pubKey:void 0,votingPower:l.Long.ZERO}}e.SimpleValidator={encode(j,te=g.Writer.create()){return j.pubKey!==void 0&&f.PublicKey.encode(j.pubKey,te.uint32(10).fork()).ldelim(),j.votingPower.isZero()||te.uint32(16).int64(j.votingPower),te},decode(j,te){let v=j instanceof g.Reader?j:new g.Reader(j),ne=te===void 0?v.len:v.pos+te,Z=F();for(;v.pos<ne;){let R=v.uint32();switch(R>>>3){case 1:Z.pubKey=f.PublicKey.decode(v,v.uint32());break;case 2:Z.votingPower=v.int64();break;default:v.skipType(R&7);break}}return Z},fromJSON(j){return{pubKey:(0,l.isSet)(j.pubKey)?f.PublicKey.fromJSON(j.pubKey):void 0,votingPower:(0,l.isSet)(j.votingPower)?l.Long.fromValue(j.votingPower):l.Long.ZERO}},toJSON(j){let te={};return j.pubKey!==void 0&&(te.pubKey=j.pubKey?f.PublicKey.toJSON(j.pubKey):void 0),j.votingPower!==void 0&&(te.votingPower=(j.votingPower||l.Long.ZERO).toString()),te},fromPartial(j){let te=F();return te.pubKey=j.pubKey!==void 0&&j.pubKey!==null?f.PublicKey.fromPartial(j.pubKey):void 0,te.votingPower=j.votingPower!==void 0&&j.votingPower!==null?l.Long.fromValue(j.votingPower):l.Long.ZERO,te}}})(hvt);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(m,h,_,b){b===void 0&&(b=_);var O=Object.getOwnPropertyDescriptor(h,_);(!O||("get"in O?!h.__esModule:O.writable||O.configurable))&&(O={enumerable:!0,get:function(){return h[_]}}),Object.defineProperty(m,b,O)}:function(m,h,_,b){b===void 0&&(b=_),m[b]=h[_]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(m,h){Object.defineProperty(m,"default",{enumerable:!0,value:h})}:function(m,h){m.default=h}),c=Fr&&Fr.__importStar||function(m){if(m&&m.__esModule)return m;var h={};if(m!=null)for(var _ in m)_!=="default"&&Object.prototype.hasOwnProperty.call(m,_)&&i(h,m,_);return A(h,m),h};Object.defineProperty(e,"__esModule",{value:!0}),e.TxProof=e.BlockMeta=e.LightBlock=e.SignedHeader=e.Proposal=e.CommitSig=e.Commit=e.Vote=e.Data=e.Header=e.BlockID=e.Part=e.PartSetHeader=e.signedMsgTypeToJSON=e.signedMsgTypeFromJSON=e.SignedMsgType=e.blockIDFlagToJSON=e.blockIDFlagFromJSON=e.BlockIDFlag=e.protobufPackage=void 0;let f=_In,l=Yie,g=k3,w=hvt,N=Ns,F=c(BA);e.protobufPackage="tendermint.types";var j;(function(m){m[m.BLOCK_ID_FLAG_UNKNOWN=0]="BLOCK_ID_FLAG_UNKNOWN",m[m.BLOCK_ID_FLAG_ABSENT=1]="BLOCK_ID_FLAG_ABSENT",m[m.BLOCK_ID_FLAG_COMMIT=2]="BLOCK_ID_FLAG_COMMIT",m[m.BLOCK_ID_FLAG_NIL=3]="BLOCK_ID_FLAG_NIL",m[m.UNRECOGNIZED=-1]="UNRECOGNIZED"})(j=e.BlockIDFlag||(e.BlockIDFlag={}));function te(m){switch(m){case 0:case"BLOCK_ID_FLAG_UNKNOWN":return j.BLOCK_ID_FLAG_UNKNOWN;case 1:case"BLOCK_ID_FLAG_ABSENT":return j.BLOCK_ID_FLAG_ABSENT;case 2:case"BLOCK_ID_FLAG_COMMIT":return j.BLOCK_ID_FLAG_COMMIT;case 3:case"BLOCK_ID_FLAG_NIL":return j.BLOCK_ID_FLAG_NIL;case-1:case"UNRECOGNIZED":default:return j.UNRECOGNIZED}}e.blockIDFlagFromJSON=te;function v(m){switch(m){case j.BLOCK_ID_FLAG_UNKNOWN:return"BLOCK_ID_FLAG_UNKNOWN";case j.BLOCK_ID_FLAG_ABSENT:return"BLOCK_ID_FLAG_ABSENT";case j.BLOCK_ID_FLAG_COMMIT:return"BLOCK_ID_FLAG_COMMIT";case j.BLOCK_ID_FLAG_NIL:return"BLOCK_ID_FLAG_NIL";case j.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.blockIDFlagToJSON=v;var ne;(function(m){m[m.SIGNED_MSG_TYPE_UNKNOWN=0]="SIGNED_MSG_TYPE_UNKNOWN",m[m.SIGNED_MSG_TYPE_PREVOTE=1]="SIGNED_MSG_TYPE_PREVOTE",m[m.SIGNED_MSG_TYPE_PRECOMMIT=2]="SIGNED_MSG_TYPE_PRECOMMIT",m[m.SIGNED_MSG_TYPE_PROPOSAL=32]="SIGNED_MSG_TYPE_PROPOSAL",m[m.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ne=e.SignedMsgType||(e.SignedMsgType={}));function Z(m){switch(m){case 0:case"SIGNED_MSG_TYPE_UNKNOWN":return ne.SIGNED_MSG_TYPE_UNKNOWN;case 1:case"SIGNED_MSG_TYPE_PREVOTE":return ne.SIGNED_MSG_TYPE_PREVOTE;case 2:case"SIGNED_MSG_TYPE_PRECOMMIT":return ne.SIGNED_MSG_TYPE_PRECOMMIT;case 32:case"SIGNED_MSG_TYPE_PROPOSAL":return ne.SIGNED_MSG_TYPE_PROPOSAL;case-1:case"UNRECOGNIZED":default:return ne.UNRECOGNIZED}}e.signedMsgTypeFromJSON=Z;function R(m){switch(m){case ne.SIGNED_MSG_TYPE_UNKNOWN:return"SIGNED_MSG_TYPE_UNKNOWN";case ne.SIGNED_MSG_TYPE_PREVOTE:return"SIGNED_MSG_TYPE_PREVOTE";case ne.SIGNED_MSG_TYPE_PRECOMMIT:return"SIGNED_MSG_TYPE_PRECOMMIT";case ne.SIGNED_MSG_TYPE_PROPOSAL:return"SIGNED_MSG_TYPE_PROPOSAL";case ne.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.signedMsgTypeToJSON=R;function M(){return{total:0,hash:new Uint8Array}}e.PartSetHeader={encode(m,h=F.Writer.create()){return m.total!==0&&h.uint32(8).uint32(m.total),m.hash.length!==0&&h.uint32(18).bytes(m.hash),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=M();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.total=_.uint32();break;case 2:O.hash=_.bytes();break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{total:(0,N.isSet)(m.total)?Number(m.total):0,hash:(0,N.isSet)(m.hash)?(0,N.bytesFromBase64)(m.hash):new Uint8Array}},toJSON(m){let h={};return m.total!==void 0&&(h.total=Math.round(m.total)),m.hash!==void 0&&(h.hash=(0,N.base64FromBytes)(m.hash!==void 0?m.hash:new Uint8Array)),h},fromPartial(m){var _,b;let h=M();return h.total=(_=m.total)!=null?_:0,h.hash=(b=m.hash)!=null?b:new Uint8Array,h}};function U(){return{index:0,bytes:new Uint8Array,proof:void 0}}e.Part={encode(m,h=F.Writer.create()){return m.index!==0&&h.uint32(8).uint32(m.index),m.bytes.length!==0&&h.uint32(18).bytes(m.bytes),m.proof!==void 0&&f.Proof.encode(m.proof,h.uint32(26).fork()).ldelim(),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=U();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.index=_.uint32();break;case 2:O.bytes=_.bytes();break;case 3:O.proof=f.Proof.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{index:(0,N.isSet)(m.index)?Number(m.index):0,bytes:(0,N.isSet)(m.bytes)?(0,N.bytesFromBase64)(m.bytes):new Uint8Array,proof:(0,N.isSet)(m.proof)?f.Proof.fromJSON(m.proof):void 0}},toJSON(m){let h={};return m.index!==void 0&&(h.index=Math.round(m.index)),m.bytes!==void 0&&(h.bytes=(0,N.base64FromBytes)(m.bytes!==void 0?m.bytes:new Uint8Array)),m.proof!==void 0&&(h.proof=m.proof?f.Proof.toJSON(m.proof):void 0),h},fromPartial(m){var _,b;let h=U();return h.index=(_=m.index)!=null?_:0,h.bytes=(b=m.bytes)!=null?b:new Uint8Array,h.proof=m.proof!==void 0&&m.proof!==null?f.Proof.fromPartial(m.proof):void 0,h}};function E(){return{hash:new Uint8Array,partSetHeader:void 0}}e.BlockID={encode(m,h=F.Writer.create()){return m.hash.length!==0&&h.uint32(10).bytes(m.hash),m.partSetHeader!==void 0&&e.PartSetHeader.encode(m.partSetHeader,h.uint32(18).fork()).ldelim(),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=E();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.hash=_.bytes();break;case 2:O.partSetHeader=e.PartSetHeader.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{hash:(0,N.isSet)(m.hash)?(0,N.bytesFromBase64)(m.hash):new Uint8Array,partSetHeader:(0,N.isSet)(m.partSetHeader)?e.PartSetHeader.fromJSON(m.partSetHeader):void 0}},toJSON(m){let h={};return m.hash!==void 0&&(h.hash=(0,N.base64FromBytes)(m.hash!==void 0?m.hash:new Uint8Array)),m.partSetHeader!==void 0&&(h.partSetHeader=m.partSetHeader?e.PartSetHeader.toJSON(m.partSetHeader):void 0),h},fromPartial(m){var _;let h=E();return h.hash=(_=m.hash)!=null?_:new Uint8Array,h.partSetHeader=m.partSetHeader!==void 0&&m.partSetHeader!==null?e.PartSetHeader.fromPartial(m.partSetHeader):void 0,h}};function Q(){return{version:void 0,chainId:"",height:N.Long.ZERO,time:void 0,lastBlockId:void 0,lastCommitHash:new Uint8Array,dataHash:new Uint8Array,validatorsHash:new Uint8Array,nextValidatorsHash:new Uint8Array,consensusHash:new Uint8Array,appHash:new Uint8Array,lastResultsHash:new Uint8Array,evidenceHash:new Uint8Array,proposerAddress:new Uint8Array}}e.Header={encode(m,h=F.Writer.create()){return m.version!==void 0&&l.Consensus.encode(m.version,h.uint32(10).fork()).ldelim(),m.chainId!==""&&h.uint32(18).string(m.chainId),m.height.isZero()||h.uint32(24).int64(m.height),m.time!==void 0&&g.Timestamp.encode(m.time,h.uint32(34).fork()).ldelim(),m.lastBlockId!==void 0&&e.BlockID.encode(m.lastBlockId,h.uint32(42).fork()).ldelim(),m.lastCommitHash.length!==0&&h.uint32(50).bytes(m.lastCommitHash),m.dataHash.length!==0&&h.uint32(58).bytes(m.dataHash),m.validatorsHash.length!==0&&h.uint32(66).bytes(m.validatorsHash),m.nextValidatorsHash.length!==0&&h.uint32(74).bytes(m.nextValidatorsHash),m.consensusHash.length!==0&&h.uint32(82).bytes(m.consensusHash),m.appHash.length!==0&&h.uint32(90).bytes(m.appHash),m.lastResultsHash.length!==0&&h.uint32(98).bytes(m.lastResultsHash),m.evidenceHash.length!==0&&h.uint32(106).bytes(m.evidenceHash),m.proposerAddress.length!==0&&h.uint32(114).bytes(m.proposerAddress),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=Q();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.version=l.Consensus.decode(_,_.uint32());break;case 2:O.chainId=_.string();break;case 3:O.height=_.int64();break;case 4:O.time=g.Timestamp.decode(_,_.uint32());break;case 5:O.lastBlockId=e.BlockID.decode(_,_.uint32());break;case 6:O.lastCommitHash=_.bytes();break;case 7:O.dataHash=_.bytes();break;case 8:O.validatorsHash=_.bytes();break;case 9:O.nextValidatorsHash=_.bytes();break;case 10:O.consensusHash=_.bytes();break;case 11:O.appHash=_.bytes();break;case 12:O.lastResultsHash=_.bytes();break;case 13:O.evidenceHash=_.bytes();break;case 14:O.proposerAddress=_.bytes();break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{version:(0,N.isSet)(m.version)?l.Consensus.fromJSON(m.version):void 0,chainId:(0,N.isSet)(m.chainId)?String(m.chainId):"",height:(0,N.isSet)(m.height)?N.Long.fromValue(m.height):N.Long.ZERO,time:(0,N.isSet)(m.time)?(0,N.fromJsonTimestamp)(m.time):void 0,lastBlockId:(0,N.isSet)(m.lastBlockId)?e.BlockID.fromJSON(m.lastBlockId):void 0,lastCommitHash:(0,N.isSet)(m.lastCommitHash)?(0,N.bytesFromBase64)(m.lastCommitHash):new Uint8Array,dataHash:(0,N.isSet)(m.dataHash)?(0,N.bytesFromBase64)(m.dataHash):new Uint8Array,validatorsHash:(0,N.isSet)(m.validatorsHash)?(0,N.bytesFromBase64)(m.validatorsHash):new Uint8Array,nextValidatorsHash:(0,N.isSet)(m.nextValidatorsHash)?(0,N.bytesFromBase64)(m.nextValidatorsHash):new Uint8Array,consensusHash:(0,N.isSet)(m.consensusHash)?(0,N.bytesFromBase64)(m.consensusHash):new Uint8Array,appHash:(0,N.isSet)(m.appHash)?(0,N.bytesFromBase64)(m.appHash):new Uint8Array,lastResultsHash:(0,N.isSet)(m.lastResultsHash)?(0,N.bytesFromBase64)(m.lastResultsHash):new Uint8Array,evidenceHash:(0,N.isSet)(m.evidenceHash)?(0,N.bytesFromBase64)(m.evidenceHash):new Uint8Array,proposerAddress:(0,N.isSet)(m.proposerAddress)?(0,N.bytesFromBase64)(m.proposerAddress):new Uint8Array}},toJSON(m){let h={};return m.version!==void 0&&(h.version=m.version?l.Consensus.toJSON(m.version):void 0),m.chainId!==void 0&&(h.chainId=m.chainId),m.height!==void 0&&(h.height=(m.height||N.Long.ZERO).toString()),m.time!==void 0&&(h.time=(0,N.fromTimestamp)(m.time).toISOString()),m.lastBlockId!==void 0&&(h.lastBlockId=m.lastBlockId?e.BlockID.toJSON(m.lastBlockId):void 0),m.lastCommitHash!==void 0&&(h.lastCommitHash=(0,N.base64FromBytes)(m.lastCommitHash!==void 0?m.lastCommitHash:new Uint8Array)),m.dataHash!==void 0&&(h.dataHash=(0,N.base64FromBytes)(m.dataHash!==void 0?m.dataHash:new Uint8Array)),m.validatorsHash!==void 0&&(h.validatorsHash=(0,N.base64FromBytes)(m.validatorsHash!==void 0?m.validatorsHash:new Uint8Array)),m.nextValidatorsHash!==void 0&&(h.nextValidatorsHash=(0,N.base64FromBytes)(m.nextValidatorsHash!==void 0?m.nextValidatorsHash:new Uint8Array)),m.consensusHash!==void 0&&(h.consensusHash=(0,N.base64FromBytes)(m.consensusHash!==void 0?m.consensusHash:new Uint8Array)),m.appHash!==void 0&&(h.appHash=(0,N.base64FromBytes)(m.appHash!==void 0?m.appHash:new Uint8Array)),m.lastResultsHash!==void 0&&(h.lastResultsHash=(0,N.base64FromBytes)(m.lastResultsHash!==void 0?m.lastResultsHash:new Uint8Array)),m.evidenceHash!==void 0&&(h.evidenceHash=(0,N.base64FromBytes)(m.evidenceHash!==void 0?m.evidenceHash:new Uint8Array)),m.proposerAddress!==void 0&&(h.proposerAddress=(0,N.base64FromBytes)(m.proposerAddress!==void 0?m.proposerAddress:new Uint8Array)),h},fromPartial(m){var _,b,O,J,ie,G,I,C,D,W;let h=Q();return h.version=m.version!==void 0&&m.version!==null?l.Consensus.fromPartial(m.version):void 0,h.chainId=(_=m.chainId)!=null?_:"",h.height=m.height!==void 0&&m.height!==null?N.Long.fromValue(m.height):N.Long.ZERO,h.time=m.time!==void 0&&m.time!==null?g.Timestamp.fromPartial(m.time):void 0,h.lastBlockId=m.lastBlockId!==void 0&&m.lastBlockId!==null?e.BlockID.fromPartial(m.lastBlockId):void 0,h.lastCommitHash=(b=m.lastCommitHash)!=null?b:new Uint8Array,h.dataHash=(O=m.dataHash)!=null?O:new Uint8Array,h.validatorsHash=(J=m.validatorsHash)!=null?J:new Uint8Array,h.nextValidatorsHash=(ie=m.nextValidatorsHash)!=null?ie:new Uint8Array,h.consensusHash=(G=m.consensusHash)!=null?G:new Uint8Array,h.appHash=(I=m.appHash)!=null?I:new Uint8Array,h.lastResultsHash=(C=m.lastResultsHash)!=null?C:new Uint8Array,h.evidenceHash=(D=m.evidenceHash)!=null?D:new Uint8Array,h.proposerAddress=(W=m.proposerAddress)!=null?W:new Uint8Array,h}};function H(){return{txs:[]}}e.Data={encode(m,h=F.Writer.create()){for(let _ of m.txs)h.uint32(10).bytes(_);return h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=H();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.txs.push(_.bytes());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{txs:Array.isArray(m==null?void 0:m.txs)?m.txs.map(h=>(0,N.bytesFromBase64)(h)):[]}},toJSON(m){let h={};return m.txs?h.txs=m.txs.map(_=>(0,N.base64FromBytes)(_!==void 0?_:new Uint8Array)):h.txs=[],h},fromPartial(m){var _;let h=H();return h.txs=((_=m.txs)==null?void 0:_.map(b=>b))||[],h}};function re(){return{type:0,height:N.Long.ZERO,round:0,blockId:void 0,timestamp:void 0,validatorAddress:new Uint8Array,validatorIndex:0,signature:new Uint8Array}}e.Vote={encode(m,h=F.Writer.create()){return m.type!==0&&h.uint32(8).int32(m.type),m.height.isZero()||h.uint32(16).int64(m.height),m.round!==0&&h.uint32(24).int32(m.round),m.blockId!==void 0&&e.BlockID.encode(m.blockId,h.uint32(34).fork()).ldelim(),m.timestamp!==void 0&&g.Timestamp.encode(m.timestamp,h.uint32(42).fork()).ldelim(),m.validatorAddress.length!==0&&h.uint32(50).bytes(m.validatorAddress),m.validatorIndex!==0&&h.uint32(56).int32(m.validatorIndex),m.signature.length!==0&&h.uint32(66).bytes(m.signature),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=re();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.type=_.int32();break;case 2:O.height=_.int64();break;case 3:O.round=_.int32();break;case 4:O.blockId=e.BlockID.decode(_,_.uint32());break;case 5:O.timestamp=g.Timestamp.decode(_,_.uint32());break;case 6:O.validatorAddress=_.bytes();break;case 7:O.validatorIndex=_.int32();break;case 8:O.signature=_.bytes();break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{type:(0,N.isSet)(m.type)?Z(m.type):0,height:(0,N.isSet)(m.height)?N.Long.fromValue(m.height):N.Long.ZERO,round:(0,N.isSet)(m.round)?Number(m.round):0,blockId:(0,N.isSet)(m.blockId)?e.BlockID.fromJSON(m.blockId):void 0,timestamp:(0,N.isSet)(m.timestamp)?(0,N.fromJsonTimestamp)(m.timestamp):void 0,validatorAddress:(0,N.isSet)(m.validatorAddress)?(0,N.bytesFromBase64)(m.validatorAddress):new Uint8Array,validatorIndex:(0,N.isSet)(m.validatorIndex)?Number(m.validatorIndex):0,signature:(0,N.isSet)(m.signature)?(0,N.bytesFromBase64)(m.signature):new Uint8Array}},toJSON(m){let h={};return m.type!==void 0&&(h.type=R(m.type)),m.height!==void 0&&(h.height=(m.height||N.Long.ZERO).toString()),m.round!==void 0&&(h.round=Math.round(m.round)),m.blockId!==void 0&&(h.blockId=m.blockId?e.BlockID.toJSON(m.blockId):void 0),m.timestamp!==void 0&&(h.timestamp=(0,N.fromTimestamp)(m.timestamp).toISOString()),m.validatorAddress!==void 0&&(h.validatorAddress=(0,N.base64FromBytes)(m.validatorAddress!==void 0?m.validatorAddress:new Uint8Array)),m.validatorIndex!==void 0&&(h.validatorIndex=Math.round(m.validatorIndex)),m.signature!==void 0&&(h.signature=(0,N.base64FromBytes)(m.signature!==void 0?m.signature:new Uint8Array)),h},fromPartial(m){var _,b,O,J,ie;let h=re();return h.type=(_=m.type)!=null?_:0,h.height=m.height!==void 0&&m.height!==null?N.Long.fromValue(m.height):N.Long.ZERO,h.round=(b=m.round)!=null?b:0,h.blockId=m.blockId!==void 0&&m.blockId!==null?e.BlockID.fromPartial(m.blockId):void 0,h.timestamp=m.timestamp!==void 0&&m.timestamp!==null?g.Timestamp.fromPartial(m.timestamp):void 0,h.validatorAddress=(O=m.validatorAddress)!=null?O:new Uint8Array,h.validatorIndex=(J=m.validatorIndex)!=null?J:0,h.signature=(ie=m.signature)!=null?ie:new Uint8Array,h}};function ee(){return{height:N.Long.ZERO,round:0,blockId:void 0,signatures:[]}}e.Commit={encode(m,h=F.Writer.create()){m.height.isZero()||h.uint32(8).int64(m.height),m.round!==0&&h.uint32(16).int32(m.round),m.blockId!==void 0&&e.BlockID.encode(m.blockId,h.uint32(26).fork()).ldelim();for(let _ of m.signatures)e.CommitSig.encode(_,h.uint32(34).fork()).ldelim();return h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=ee();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.height=_.int64();break;case 2:O.round=_.int32();break;case 3:O.blockId=e.BlockID.decode(_,_.uint32());break;case 4:O.signatures.push(e.CommitSig.decode(_,_.uint32()));break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{height:(0,N.isSet)(m.height)?N.Long.fromValue(m.height):N.Long.ZERO,round:(0,N.isSet)(m.round)?Number(m.round):0,blockId:(0,N.isSet)(m.blockId)?e.BlockID.fromJSON(m.blockId):void 0,signatures:Array.isArray(m==null?void 0:m.signatures)?m.signatures.map(h=>e.CommitSig.fromJSON(h)):[]}},toJSON(m){let h={};return m.height!==void 0&&(h.height=(m.height||N.Long.ZERO).toString()),m.round!==void 0&&(h.round=Math.round(m.round)),m.blockId!==void 0&&(h.blockId=m.blockId?e.BlockID.toJSON(m.blockId):void 0),m.signatures?h.signatures=m.signatures.map(_=>_?e.CommitSig.toJSON(_):void 0):h.signatures=[],h},fromPartial(m){var _,b;let h=ee();return h.height=m.height!==void 0&&m.height!==null?N.Long.fromValue(m.height):N.Long.ZERO,h.round=(_=m.round)!=null?_:0,h.blockId=m.blockId!==void 0&&m.blockId!==null?e.BlockID.fromPartial(m.blockId):void 0,h.signatures=((b=m.signatures)==null?void 0:b.map(O=>e.CommitSig.fromPartial(O)))||[],h}};function T(){return{blockIdFlag:0,validatorAddress:new Uint8Array,timestamp:void 0,signature:new Uint8Array}}e.CommitSig={encode(m,h=F.Writer.create()){return m.blockIdFlag!==0&&h.uint32(8).int32(m.blockIdFlag),m.validatorAddress.length!==0&&h.uint32(18).bytes(m.validatorAddress),m.timestamp!==void 0&&g.Timestamp.encode(m.timestamp,h.uint32(26).fork()).ldelim(),m.signature.length!==0&&h.uint32(34).bytes(m.signature),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=T();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.blockIdFlag=_.int32();break;case 2:O.validatorAddress=_.bytes();break;case 3:O.timestamp=g.Timestamp.decode(_,_.uint32());break;case 4:O.signature=_.bytes();break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{blockIdFlag:(0,N.isSet)(m.blockIdFlag)?te(m.blockIdFlag):0,validatorAddress:(0,N.isSet)(m.validatorAddress)?(0,N.bytesFromBase64)(m.validatorAddress):new Uint8Array,timestamp:(0,N.isSet)(m.timestamp)?(0,N.fromJsonTimestamp)(m.timestamp):void 0,signature:(0,N.isSet)(m.signature)?(0,N.bytesFromBase64)(m.signature):new Uint8Array}},toJSON(m){let h={};return m.blockIdFlag!==void 0&&(h.blockIdFlag=v(m.blockIdFlag)),m.validatorAddress!==void 0&&(h.validatorAddress=(0,N.base64FromBytes)(m.validatorAddress!==void 0?m.validatorAddress:new Uint8Array)),m.timestamp!==void 0&&(h.timestamp=(0,N.fromTimestamp)(m.timestamp).toISOString()),m.signature!==void 0&&(h.signature=(0,N.base64FromBytes)(m.signature!==void 0?m.signature:new Uint8Array)),h},fromPartial(m){var _,b,O;let h=T();return h.blockIdFlag=(_=m.blockIdFlag)!=null?_:0,h.validatorAddress=(b=m.validatorAddress)!=null?b:new Uint8Array,h.timestamp=m.timestamp!==void 0&&m.timestamp!==null?g.Timestamp.fromPartial(m.timestamp):void 0,h.signature=(O=m.signature)!=null?O:new Uint8Array,h}};function se(){return{type:0,height:N.Long.ZERO,round:0,polRound:0,blockId:void 0,timestamp:void 0,signature:new Uint8Array}}e.Proposal={encode(m,h=F.Writer.create()){return m.type!==0&&h.uint32(8).int32(m.type),m.height.isZero()||h.uint32(16).int64(m.height),m.round!==0&&h.uint32(24).int32(m.round),m.polRound!==0&&h.uint32(32).int32(m.polRound),m.blockId!==void 0&&e.BlockID.encode(m.blockId,h.uint32(42).fork()).ldelim(),m.timestamp!==void 0&&g.Timestamp.encode(m.timestamp,h.uint32(50).fork()).ldelim(),m.signature.length!==0&&h.uint32(58).bytes(m.signature),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=se();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.type=_.int32();break;case 2:O.height=_.int64();break;case 3:O.round=_.int32();break;case 4:O.polRound=_.int32();break;case 5:O.blockId=e.BlockID.decode(_,_.uint32());break;case 6:O.timestamp=g.Timestamp.decode(_,_.uint32());break;case 7:O.signature=_.bytes();break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{type:(0,N.isSet)(m.type)?Z(m.type):0,height:(0,N.isSet)(m.height)?N.Long.fromValue(m.height):N.Long.ZERO,round:(0,N.isSet)(m.round)?Number(m.round):0,polRound:(0,N.isSet)(m.polRound)?Number(m.polRound):0,blockId:(0,N.isSet)(m.blockId)?e.BlockID.fromJSON(m.blockId):void 0,timestamp:(0,N.isSet)(m.timestamp)?(0,N.fromJsonTimestamp)(m.timestamp):void 0,signature:(0,N.isSet)(m.signature)?(0,N.bytesFromBase64)(m.signature):new Uint8Array}},toJSON(m){let h={};return m.type!==void 0&&(h.type=R(m.type)),m.height!==void 0&&(h.height=(m.height||N.Long.ZERO).toString()),m.round!==void 0&&(h.round=Math.round(m.round)),m.polRound!==void 0&&(h.polRound=Math.round(m.polRound)),m.blockId!==void 0&&(h.blockId=m.blockId?e.BlockID.toJSON(m.blockId):void 0),m.timestamp!==void 0&&(h.timestamp=(0,N.fromTimestamp)(m.timestamp).toISOString()),m.signature!==void 0&&(h.signature=(0,N.base64FromBytes)(m.signature!==void 0?m.signature:new Uint8Array)),h},fromPartial(m){var _,b,O,J;let h=se();return h.type=(_=m.type)!=null?_:0,h.height=m.height!==void 0&&m.height!==null?N.Long.fromValue(m.height):N.Long.ZERO,h.round=(b=m.round)!=null?b:0,h.polRound=(O=m.polRound)!=null?O:0,h.blockId=m.blockId!==void 0&&m.blockId!==null?e.BlockID.fromPartial(m.blockId):void 0,h.timestamp=m.timestamp!==void 0&&m.timestamp!==null?g.Timestamp.fromPartial(m.timestamp):void 0,h.signature=(J=m.signature)!=null?J:new Uint8Array,h}};function p(){return{header:void 0,commit:void 0}}e.SignedHeader={encode(m,h=F.Writer.create()){return m.header!==void 0&&e.Header.encode(m.header,h.uint32(10).fork()).ldelim(),m.commit!==void 0&&e.Commit.encode(m.commit,h.uint32(18).fork()).ldelim(),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=p();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.header=e.Header.decode(_,_.uint32());break;case 2:O.commit=e.Commit.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{header:(0,N.isSet)(m.header)?e.Header.fromJSON(m.header):void 0,commit:(0,N.isSet)(m.commit)?e.Commit.fromJSON(m.commit):void 0}},toJSON(m){let h={};return m.header!==void 0&&(h.header=m.header?e.Header.toJSON(m.header):void 0),m.commit!==void 0&&(h.commit=m.commit?e.Commit.toJSON(m.commit):void 0),h},fromPartial(m){let h=p();return h.header=m.header!==void 0&&m.header!==null?e.Header.fromPartial(m.header):void 0,h.commit=m.commit!==void 0&&m.commit!==null?e.Commit.fromPartial(m.commit):void 0,h}};function L(){return{signedHeader:void 0,validatorSet:void 0}}e.LightBlock={encode(m,h=F.Writer.create()){return m.signedHeader!==void 0&&e.SignedHeader.encode(m.signedHeader,h.uint32(10).fork()).ldelim(),m.validatorSet!==void 0&&w.ValidatorSet.encode(m.validatorSet,h.uint32(18).fork()).ldelim(),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=L();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.signedHeader=e.SignedHeader.decode(_,_.uint32());break;case 2:O.validatorSet=w.ValidatorSet.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{signedHeader:(0,N.isSet)(m.signedHeader)?e.SignedHeader.fromJSON(m.signedHeader):void 0,validatorSet:(0,N.isSet)(m.validatorSet)?w.ValidatorSet.fromJSON(m.validatorSet):void 0}},toJSON(m){let h={};return m.signedHeader!==void 0&&(h.signedHeader=m.signedHeader?e.SignedHeader.toJSON(m.signedHeader):void 0),m.validatorSet!==void 0&&(h.validatorSet=m.validatorSet?w.ValidatorSet.toJSON(m.validatorSet):void 0),h},fromPartial(m){let h=L();return h.signedHeader=m.signedHeader!==void 0&&m.signedHeader!==null?e.SignedHeader.fromPartial(m.signedHeader):void 0,h.validatorSet=m.validatorSet!==void 0&&m.validatorSet!==null?w.ValidatorSet.fromPartial(m.validatorSet):void 0,h}};function V(){return{blockId:void 0,blockSize:N.Long.ZERO,header:void 0,numTxs:N.Long.ZERO}}e.BlockMeta={encode(m,h=F.Writer.create()){return m.blockId!==void 0&&e.BlockID.encode(m.blockId,h.uint32(10).fork()).ldelim(),m.blockSize.isZero()||h.uint32(16).int64(m.blockSize),m.header!==void 0&&e.Header.encode(m.header,h.uint32(26).fork()).ldelim(),m.numTxs.isZero()||h.uint32(32).int64(m.numTxs),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=V();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.blockId=e.BlockID.decode(_,_.uint32());break;case 2:O.blockSize=_.int64();break;case 3:O.header=e.Header.decode(_,_.uint32());break;case 4:O.numTxs=_.int64();break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{blockId:(0,N.isSet)(m.blockId)?e.BlockID.fromJSON(m.blockId):void 0,blockSize:(0,N.isSet)(m.blockSize)?N.Long.fromValue(m.blockSize):N.Long.ZERO,header:(0,N.isSet)(m.header)?e.Header.fromJSON(m.header):void 0,numTxs:(0,N.isSet)(m.numTxs)?N.Long.fromValue(m.numTxs):N.Long.ZERO}},toJSON(m){let h={};return m.blockId!==void 0&&(h.blockId=m.blockId?e.BlockID.toJSON(m.blockId):void 0),m.blockSize!==void 0&&(h.blockSize=(m.blockSize||N.Long.ZERO).toString()),m.header!==void 0&&(h.header=m.header?e.Header.toJSON(m.header):void 0),m.numTxs!==void 0&&(h.numTxs=(m.numTxs||N.Long.ZERO).toString()),h},fromPartial(m){let h=V();return h.blockId=m.blockId!==void 0&&m.blockId!==null?e.BlockID.fromPartial(m.blockId):void 0,h.blockSize=m.blockSize!==void 0&&m.blockSize!==null?N.Long.fromValue(m.blockSize):N.Long.ZERO,h.header=m.header!==void 0&&m.header!==null?e.Header.fromPartial(m.header):void 0,h.numTxs=m.numTxs!==void 0&&m.numTxs!==null?N.Long.fromValue(m.numTxs):N.Long.ZERO,h}};function K(){return{rootHash:new Uint8Array,data:new Uint8Array,proof:void 0}}e.TxProof={encode(m,h=F.Writer.create()){return m.rootHash.length!==0&&h.uint32(10).bytes(m.rootHash),m.data.length!==0&&h.uint32(18).bytes(m.data),m.proof!==void 0&&f.Proof.encode(m.proof,h.uint32(26).fork()).ldelim(),h},decode(m,h){let _=m instanceof F.Reader?m:new F.Reader(m),b=h===void 0?_.len:_.pos+h,O=K();for(;_.pos<b;){let J=_.uint32();switch(J>>>3){case 1:O.rootHash=_.bytes();break;case 2:O.data=_.bytes();break;case 3:O.proof=f.Proof.decode(_,_.uint32());break;default:_.skipType(J&7);break}}return O},fromJSON(m){return{rootHash:(0,N.isSet)(m.rootHash)?(0,N.bytesFromBase64)(m.rootHash):new Uint8Array,data:(0,N.isSet)(m.data)?(0,N.bytesFromBase64)(m.data):new Uint8Array,proof:(0,N.isSet)(m.proof)?f.Proof.fromJSON(m.proof):void 0}},toJSON(m){let h={};return m.rootHash!==void 0&&(h.rootHash=(0,N.base64FromBytes)(m.rootHash!==void 0?m.rootHash:new Uint8Array)),m.data!==void 0&&(h.data=(0,N.base64FromBytes)(m.data!==void 0?m.data:new Uint8Array)),m.proof!==void 0&&(h.proof=m.proof?f.Proof.toJSON(m.proof):void 0),h},fromPartial(m){var _,b;let h=K();return h.rootHash=(_=m.rootHash)!=null?_:new Uint8Array,h.data=(b=m.data)!=null?b:new Uint8Array,h.proof=m.proof!==void 0&&m.proof!==null?f.Proof.fromPartial(m.proof):void 0,h}}})(Yfe);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(E,Q,H,re){re===void 0&&(re=H);var ee=Object.getOwnPropertyDescriptor(Q,H);(!ee||("get"in ee?!Q.__esModule:ee.writable||ee.configurable))&&(ee={enumerable:!0,get:function(){return Q[H]}}),Object.defineProperty(E,re,ee)}:function(E,Q,H,re){re===void 0&&(re=H),E[re]=Q[H]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(E,Q){Object.defineProperty(E,"default",{enumerable:!0,value:Q})}:function(E,Q){E.default=Q}),c=Fr&&Fr.__importStar||function(E){if(E&&E.__esModule)return E;var Q={};if(E!=null)for(var H in E)H!=="default"&&Object.prototype.hasOwnProperty.call(E,H)&&i(Q,E,H);return A(Q,E),Q};Object.defineProperty(e,"__esModule",{value:!0}),e.Fraction=e.Header=e.Misbehaviour=e.ConsensusState=e.ClientState=e.protobufPackage=void 0;let f=MR,l=lW,g=CIn,w=k3,N=DR,F=Yfe,j=hvt,te=Ns,v=c(BA);e.protobufPackage="ibc.lightclients.tendermint.v1";function ne(){return{chainId:"",trustLevel:void 0,trustingPeriod:void 0,unbondingPeriod:void 0,maxClockDrift:void 0,frozenHeight:void 0,latestHeight:void 0,proofSpecs:[],upgradePath:[],allowUpdateAfterExpiry:!1,allowUpdateAfterMisbehaviour:!1}}e.ClientState={encode(E,Q=v.Writer.create()){E.chainId!==""&&Q.uint32(10).string(E.chainId),E.trustLevel!==void 0&&e.Fraction.encode(E.trustLevel,Q.uint32(18).fork()).ldelim(),E.trustingPeriod!==void 0&&f.Duration.encode(E.trustingPeriod,Q.uint32(26).fork()).ldelim(),E.unbondingPeriod!==void 0&&f.Duration.encode(E.unbondingPeriod,Q.uint32(34).fork()).ldelim(),E.maxClockDrift!==void 0&&f.Duration.encode(E.maxClockDrift,Q.uint32(42).fork()).ldelim(),E.frozenHeight!==void 0&&l.Height.encode(E.frozenHeight,Q.uint32(50).fork()).ldelim(),E.latestHeight!==void 0&&l.Height.encode(E.latestHeight,Q.uint32(58).fork()).ldelim();for(let H of E.proofSpecs)g.ProofSpec.encode(H,Q.uint32(66).fork()).ldelim();for(let H of E.upgradePath)Q.uint32(74).string(H);return E.allowUpdateAfterExpiry===!0&&Q.uint32(80).bool(E.allowUpdateAfterExpiry),E.allowUpdateAfterMisbehaviour===!0&&Q.uint32(88).bool(E.allowUpdateAfterMisbehaviour),Q},decode(E,Q){let H=E instanceof v.Reader?E:new v.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=ne();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.chainId=H.string();break;case 2:ee.trustLevel=e.Fraction.decode(H,H.uint32());break;case 3:ee.trustingPeriod=f.Duration.decode(H,H.uint32());break;case 4:ee.unbondingPeriod=f.Duration.decode(H,H.uint32());break;case 5:ee.maxClockDrift=f.Duration.decode(H,H.uint32());break;case 6:ee.frozenHeight=l.Height.decode(H,H.uint32());break;case 7:ee.latestHeight=l.Height.decode(H,H.uint32());break;case 8:ee.proofSpecs.push(g.ProofSpec.decode(H,H.uint32()));break;case 9:ee.upgradePath.push(H.string());break;case 10:ee.allowUpdateAfterExpiry=H.bool();break;case 11:ee.allowUpdateAfterMisbehaviour=H.bool();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{chainId:(0,te.isSet)(E.chainId)?String(E.chainId):"",trustLevel:(0,te.isSet)(E.trustLevel)?e.Fraction.fromJSON(E.trustLevel):void 0,trustingPeriod:(0,te.isSet)(E.trustingPeriod)?f.Duration.fromJSON(E.trustingPeriod):void 0,unbondingPeriod:(0,te.isSet)(E.unbondingPeriod)?f.Duration.fromJSON(E.unbondingPeriod):void 0,maxClockDrift:(0,te.isSet)(E.maxClockDrift)?f.Duration.fromJSON(E.maxClockDrift):void 0,frozenHeight:(0,te.isSet)(E.frozenHeight)?l.Height.fromJSON(E.frozenHeight):void 0,latestHeight:(0,te.isSet)(E.latestHeight)?l.Height.fromJSON(E.latestHeight):void 0,proofSpecs:Array.isArray(E==null?void 0:E.proofSpecs)?E.proofSpecs.map(Q=>g.ProofSpec.fromJSON(Q)):[],upgradePath:Array.isArray(E==null?void 0:E.upgradePath)?E.upgradePath.map(Q=>String(Q)):[],allowUpdateAfterExpiry:(0,te.isSet)(E.allowUpdateAfterExpiry)?!!E.allowUpdateAfterExpiry:!1,allowUpdateAfterMisbehaviour:(0,te.isSet)(E.allowUpdateAfterMisbehaviour)?!!E.allowUpdateAfterMisbehaviour:!1}},toJSON(E){let Q={};return E.chainId!==void 0&&(Q.chainId=E.chainId),E.trustLevel!==void 0&&(Q.trustLevel=E.trustLevel?e.Fraction.toJSON(E.trustLevel):void 0),E.trustingPeriod!==void 0&&(Q.trustingPeriod=E.trustingPeriod?f.Duration.toJSON(E.trustingPeriod):void 0),E.unbondingPeriod!==void 0&&(Q.unbondingPeriod=E.unbondingPeriod?f.Duration.toJSON(E.unbondingPeriod):void 0),E.maxClockDrift!==void 0&&(Q.maxClockDrift=E.maxClockDrift?f.Duration.toJSON(E.maxClockDrift):void 0),E.frozenHeight!==void 0&&(Q.frozenHeight=E.frozenHeight?l.Height.toJSON(E.frozenHeight):void 0),E.latestHeight!==void 0&&(Q.latestHeight=E.latestHeight?l.Height.toJSON(E.latestHeight):void 0),E.proofSpecs?Q.proofSpecs=E.proofSpecs.map(H=>H?g.ProofSpec.toJSON(H):void 0):Q.proofSpecs=[],E.upgradePath?Q.upgradePath=E.upgradePath.map(H=>H):Q.upgradePath=[],E.allowUpdateAfterExpiry!==void 0&&(Q.allowUpdateAfterExpiry=E.allowUpdateAfterExpiry),E.allowUpdateAfterMisbehaviour!==void 0&&(Q.allowUpdateAfterMisbehaviour=E.allowUpdateAfterMisbehaviour),Q},fromPartial(E){var H,re,ee,T,se;let Q=ne();return Q.chainId=(H=E.chainId)!=null?H:"",Q.trustLevel=E.trustLevel!==void 0&&E.trustLevel!==null?e.Fraction.fromPartial(E.trustLevel):void 0,Q.trustingPeriod=E.trustingPeriod!==void 0&&E.trustingPeriod!==null?f.Duration.fromPartial(E.trustingPeriod):void 0,Q.unbondingPeriod=E.unbondingPeriod!==void 0&&E.unbondingPeriod!==null?f.Duration.fromPartial(E.unbondingPeriod):void 0,Q.maxClockDrift=E.maxClockDrift!==void 0&&E.maxClockDrift!==null?f.Duration.fromPartial(E.maxClockDrift):void 0,Q.frozenHeight=E.frozenHeight!==void 0&&E.frozenHeight!==null?l.Height.fromPartial(E.frozenHeight):void 0,Q.latestHeight=E.latestHeight!==void 0&&E.latestHeight!==null?l.Height.fromPartial(E.latestHeight):void 0,Q.proofSpecs=((re=E.proofSpecs)==null?void 0:re.map(p=>g.ProofSpec.fromPartial(p)))||[],Q.upgradePath=((ee=E.upgradePath)==null?void 0:ee.map(p=>p))||[],Q.allowUpdateAfterExpiry=(T=E.allowUpdateAfterExpiry)!=null?T:!1,Q.allowUpdateAfterMisbehaviour=(se=E.allowUpdateAfterMisbehaviour)!=null?se:!1,Q}};function Z(){return{timestamp:void 0,root:void 0,nextValidatorsHash:new Uint8Array}}e.ConsensusState={encode(E,Q=v.Writer.create()){return E.timestamp!==void 0&&w.Timestamp.encode(E.timestamp,Q.uint32(10).fork()).ldelim(),E.root!==void 0&&N.MerkleRoot.encode(E.root,Q.uint32(18).fork()).ldelim(),E.nextValidatorsHash.length!==0&&Q.uint32(26).bytes(E.nextValidatorsHash),Q},decode(E,Q){let H=E instanceof v.Reader?E:new v.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=Z();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.timestamp=w.Timestamp.decode(H,H.uint32());break;case 2:ee.root=N.MerkleRoot.decode(H,H.uint32());break;case 3:ee.nextValidatorsHash=H.bytes();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{timestamp:(0,te.isSet)(E.timestamp)?(0,te.fromJsonTimestamp)(E.timestamp):void 0,root:(0,te.isSet)(E.root)?N.MerkleRoot.fromJSON(E.root):void 0,nextValidatorsHash:(0,te.isSet)(E.nextValidatorsHash)?(0,te.bytesFromBase64)(E.nextValidatorsHash):new Uint8Array}},toJSON(E){let Q={};return E.timestamp!==void 0&&(Q.timestamp=(0,te.fromTimestamp)(E.timestamp).toISOString()),E.root!==void 0&&(Q.root=E.root?N.MerkleRoot.toJSON(E.root):void 0),E.nextValidatorsHash!==void 0&&(Q.nextValidatorsHash=(0,te.base64FromBytes)(E.nextValidatorsHash!==void 0?E.nextValidatorsHash:new Uint8Array)),Q},fromPartial(E){var H;let Q=Z();return Q.timestamp=E.timestamp!==void 0&&E.timestamp!==null?w.Timestamp.fromPartial(E.timestamp):void 0,Q.root=E.root!==void 0&&E.root!==null?N.MerkleRoot.fromPartial(E.root):void 0,Q.nextValidatorsHash=(H=E.nextValidatorsHash)!=null?H:new Uint8Array,Q}};function R(){return{clientId:"",header1:void 0,header2:void 0}}e.Misbehaviour={encode(E,Q=v.Writer.create()){return E.clientId!==""&&Q.uint32(10).string(E.clientId),E.header1!==void 0&&e.Header.encode(E.header1,Q.uint32(18).fork()).ldelim(),E.header2!==void 0&&e.Header.encode(E.header2,Q.uint32(26).fork()).ldelim(),Q},decode(E,Q){let H=E instanceof v.Reader?E:new v.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=R();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.clientId=H.string();break;case 2:ee.header1=e.Header.decode(H,H.uint32());break;case 3:ee.header2=e.Header.decode(H,H.uint32());break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{clientId:(0,te.isSet)(E.clientId)?String(E.clientId):"",header1:(0,te.isSet)(E.header1)?e.Header.fromJSON(E.header1):void 0,header2:(0,te.isSet)(E.header2)?e.Header.fromJSON(E.header2):void 0}},toJSON(E){let Q={};return E.clientId!==void 0&&(Q.clientId=E.clientId),E.header1!==void 0&&(Q.header1=E.header1?e.Header.toJSON(E.header1):void 0),E.header2!==void 0&&(Q.header2=E.header2?e.Header.toJSON(E.header2):void 0),Q},fromPartial(E){var H;let Q=R();return Q.clientId=(H=E.clientId)!=null?H:"",Q.header1=E.header1!==void 0&&E.header1!==null?e.Header.fromPartial(E.header1):void 0,Q.header2=E.header2!==void 0&&E.header2!==null?e.Header.fromPartial(E.header2):void 0,Q}};function M(){return{signedHeader:void 0,validatorSet:void 0,trustedHeight:void 0,trustedValidators:void 0}}e.Header={encode(E,Q=v.Writer.create()){return E.signedHeader!==void 0&&F.SignedHeader.encode(E.signedHeader,Q.uint32(10).fork()).ldelim(),E.validatorSet!==void 0&&j.ValidatorSet.encode(E.validatorSet,Q.uint32(18).fork()).ldelim(),E.trustedHeight!==void 0&&l.Height.encode(E.trustedHeight,Q.uint32(26).fork()).ldelim(),E.trustedValidators!==void 0&&j.ValidatorSet.encode(E.trustedValidators,Q.uint32(34).fork()).ldelim(),Q},decode(E,Q){let H=E instanceof v.Reader?E:new v.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=M();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.signedHeader=F.SignedHeader.decode(H,H.uint32());break;case 2:ee.validatorSet=j.ValidatorSet.decode(H,H.uint32());break;case 3:ee.trustedHeight=l.Height.decode(H,H.uint32());break;case 4:ee.trustedValidators=j.ValidatorSet.decode(H,H.uint32());break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{signedHeader:(0,te.isSet)(E.signedHeader)?F.SignedHeader.fromJSON(E.signedHeader):void 0,validatorSet:(0,te.isSet)(E.validatorSet)?j.ValidatorSet.fromJSON(E.validatorSet):void 0,trustedHeight:(0,te.isSet)(E.trustedHeight)?l.Height.fromJSON(E.trustedHeight):void 0,trustedValidators:(0,te.isSet)(E.trustedValidators)?j.ValidatorSet.fromJSON(E.trustedValidators):void 0}},toJSON(E){let Q={};return E.signedHeader!==void 0&&(Q.signedHeader=E.signedHeader?F.SignedHeader.toJSON(E.signedHeader):void 0),E.validatorSet!==void 0&&(Q.validatorSet=E.validatorSet?j.ValidatorSet.toJSON(E.validatorSet):void 0),E.trustedHeight!==void 0&&(Q.trustedHeight=E.trustedHeight?l.Height.toJSON(E.trustedHeight):void 0),E.trustedValidators!==void 0&&(Q.trustedValidators=E.trustedValidators?j.ValidatorSet.toJSON(E.trustedValidators):void 0),Q},fromPartial(E){let Q=M();return Q.signedHeader=E.signedHeader!==void 0&&E.signedHeader!==null?F.SignedHeader.fromPartial(E.signedHeader):void 0,Q.validatorSet=E.validatorSet!==void 0&&E.validatorSet!==null?j.ValidatorSet.fromPartial(E.validatorSet):void 0,Q.trustedHeight=E.trustedHeight!==void 0&&E.trustedHeight!==null?l.Height.fromPartial(E.trustedHeight):void 0,Q.trustedValidators=E.trustedValidators!==void 0&&E.trustedValidators!==null?j.ValidatorSet.fromPartial(E.trustedValidators):void 0,Q}};function U(){return{numerator:te.Long.UZERO,denominator:te.Long.UZERO}}e.Fraction={encode(E,Q=v.Writer.create()){return E.numerator.isZero()||Q.uint32(8).uint64(E.numerator),E.denominator.isZero()||Q.uint32(16).uint64(E.denominator),Q},decode(E,Q){let H=E instanceof v.Reader?E:new v.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=U();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.numerator=H.uint64();break;case 2:ee.denominator=H.uint64();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{numerator:(0,te.isSet)(E.numerator)?te.Long.fromValue(E.numerator):te.Long.UZERO,denominator:(0,te.isSet)(E.denominator)?te.Long.fromValue(E.denominator):te.Long.UZERO}},toJSON(E){let Q={};return E.numerator!==void 0&&(Q.numerator=(E.numerator||te.Long.UZERO).toString()),E.denominator!==void 0&&(Q.denominator=(E.denominator||te.Long.UZERO).toString()),Q},fromPartial(E){let Q=U();return Q.numerator=E.numerator!==void 0&&E.numerator!==null?te.Long.fromValue(E.numerator):te.Long.UZERO,Q.denominator=E.denominator!==void 0&&E.denominator!==null?te.Long.fromValue(E.denominator):te.Long.UZERO,Q}}})(F$r);var M8s=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lvt,"__esModule",{value:!0});lvt.setupIbcExtension=void 0;var S3t=K2,T8s=EE,U8s=x$r,F8s=fvt,N2n=M$r,x2n=T$r,SLr=U$r,J$r=F$r,Lz=M8s(qM),CI=Rw;function M2n(e){if((e==null?void 0:e.typeUrl)!=="/ibc.lightclients.tendermint.v1.ClientState")throw new Error(`Unexpected client state type: ${e==null?void 0:e.typeUrl}`);return J$r.ClientState.decode(e.value)}function J8s(e){if((e==null?void 0:e.typeUrl)!=="/ibc.lightclients.tendermint.v1.ConsensusState")throw new Error(`Unexpected client state type: ${e==null?void 0:e.typeUrl}`);return J$r.ConsensusState.decode(e.value)}function H8s(e){let i=(0,CI.createProtobufRpcClient)(e),A=new N2n.QueryClientImpl(i),c=new x2n.QueryClientImpl(i),f=new SLr.QueryClientImpl(i),l=new U8s.QueryClientImpl(i);return{ibc:{channel:{channel:(g,w)=>Jt(this,null,function*(){return A.Channel({portId:g,channelId:w})}),channels:g=>Jt(this,null,function*(){return A.Channels({pagination:(0,CI.createPagination)(g)})}),allChannels:()=>Jt(this,null,function*(){var F;let g=[],w,N;do w=yield A.Channels({pagination:(0,CI.createPagination)(N)}),g.push(...w.channels),N=(F=w.pagination)==null?void 0:F.nextKey;while(N&&N.length);return{channels:g,height:w.height}}),connectionChannels:(g,w)=>Jt(this,null,function*(){return A.ConnectionChannels({connection:g,pagination:(0,CI.createPagination)(w)})}),allConnectionChannels:g=>Jt(this,null,function*(){var j;let w=[],N,F;do N=yield A.ConnectionChannels({connection:g,pagination:(0,CI.createPagination)(F)}),w.push(...N.channels),F=(j=N.pagination)==null?void 0:j.nextKey;while(F&&F.length);return{channels:w,height:N.height}}),clientState:(g,w)=>Jt(this,null,function*(){return A.ChannelClientState({portId:g,channelId:w})}),consensusState:(g,w,N,F)=>Jt(this,null,function*(){return A.ChannelConsensusState({portId:g,channelId:w,revisionNumber:Lz.default.fromNumber(N,!0),revisionHeight:Lz.default.fromNumber(F,!0)})}),packetCommitment:(g,w,N)=>Jt(this,null,function*(){return A.PacketCommitment({portId:g,channelId:w,sequence:Lz.default.fromNumber(N,!0)})}),packetCommitments:(g,w,N)=>Jt(this,null,function*(){return A.PacketCommitments({channelId:w,portId:g,pagination:(0,CI.createPagination)(N)})}),allPacketCommitments:(g,w)=>Jt(this,null,function*(){var te;let N=[],F,j;do F=yield A.PacketCommitments({channelId:w,portId:g,pagination:(0,CI.createPagination)(j)}),N.push(...F.commitments),j=(te=F.pagination)==null?void 0:te.nextKey;while(j&&j.length);return{commitments:N,height:F.height}}),packetReceipt:(g,w,N)=>Jt(this,null,function*(){return A.PacketReceipt({portId:g,channelId:w,sequence:Lz.default.fromNumber(N,!0)})}),packetAcknowledgement:(g,w,N)=>Jt(this,null,function*(){return A.PacketAcknowledgement({portId:g,channelId:w,sequence:Lz.default.fromNumber(N,!0)})}),packetAcknowledgements:(g,w,N)=>Jt(this,null,function*(){let F=N2n.QueryPacketAcknowledgementsRequest.fromPartial({portId:g,channelId:w,pagination:(0,CI.createPagination)(N)});return A.PacketAcknowledgements(F)}),allPacketAcknowledgements:(g,w)=>Jt(this,null,function*(){var te;let N=[],F,j;do{let v=N2n.QueryPacketAcknowledgementsRequest.fromPartial({channelId:w,portId:g,pagination:(0,CI.createPagination)(j)});F=yield A.PacketAcknowledgements(v),N.push(...F.acknowledgements),j=(te=F.pagination)==null?void 0:te.nextKey}while(j&&j.length);return{acknowledgements:N,height:F.height}}),unreceivedPackets:(g,w,N)=>Jt(this,null,function*(){return A.UnreceivedPackets({portId:g,channelId:w,packetCommitmentSequences:N.map(F=>Lz.default.fromNumber(F,!0))})}),unreceivedAcks:(g,w,N)=>Jt(this,null,function*(){return A.UnreceivedAcks({portId:g,channelId:w,packetAckSequences:N.map(F=>Lz.default.fromNumber(F,!0))})}),nextSequenceReceive:(g,w)=>Jt(this,null,function*(){return A.NextSequenceReceive({portId:g,channelId:w})})},client:{state:g=>Jt(this,null,function*(){return c.ClientState({clientId:g})}),states:g=>Jt(this,null,function*(){return c.ClientStates({pagination:(0,CI.createPagination)(g)})}),allStates:()=>Jt(this,null,function*(){var F;let g=[],w,N;do w=yield c.ClientStates({pagination:(0,CI.createPagination)(N)}),g.push(...w.clientStates),N=(F=w.pagination)==null?void 0:F.nextKey;while(N&&N.length);return{clientStates:g}}),consensusState:(g,w)=>Jt(this,null,function*(){return c.ConsensusState(x2n.QueryConsensusStateRequest.fromPartial({clientId:g,revisionHeight:w!==void 0?Lz.default.fromNumber(w,!0):void 0,latestHeight:w===void 0}))}),consensusStates:(g,w)=>Jt(this,null,function*(){return c.ConsensusStates({clientId:g,pagination:(0,CI.createPagination)(w)})}),allConsensusStates:g=>Jt(this,null,function*(){var j;let w=[],N,F;do N=yield c.ConsensusStates({clientId:g,pagination:(0,CI.createPagination)(F)}),w.push(...N.consensusStates),F=(j=N.pagination)==null?void 0:j.nextKey;while(F&&F.length);return{consensusStates:w}}),params:()=>Jt(this,null,function*(){return c.ClientParams({})}),stateTm:g=>Jt(this,null,function*(){let w=yield c.ClientState({clientId:g});return M2n(w.clientState)}),statesTm:g=>Jt(this,null,function*(){let{clientStates:w}=yield c.ClientStates({pagination:(0,CI.createPagination)(g)});return w.map(({clientState:N})=>M2n(N))}),allStatesTm:()=>Jt(this,null,function*(){var F;let g=[],w,N;do w=yield c.ClientStates({pagination:(0,CI.createPagination)(N)}),g.push(...w.clientStates),N=(F=w.pagination)==null?void 0:F.nextKey;while(N&&N.length);return g.map(({clientState:j})=>M2n(j))}),consensusStateTm:(g,w)=>Jt(this,null,function*(){let N=yield c.ConsensusState(x2n.QueryConsensusStateRequest.fromPartial({clientId:g,revisionHeight:w==null?void 0:w.revisionHeight,revisionNumber:w==null?void 0:w.revisionNumber,latestHeight:w===void 0}));return J8s(N.consensusState)})},connection:{connection:g=>Jt(this,null,function*(){return f.Connection({connectionId:g})}),connections:g=>Jt(this,null,function*(){return f.Connections({pagination:(0,CI.createPagination)(g)})}),allConnections:()=>Jt(this,null,function*(){var F;let g=[],w,N;do w=yield f.Connections({pagination:(0,CI.createPagination)(N)}),g.push(...w.connections),N=(F=w.pagination)==null?void 0:F.nextKey;while(N&&N.length);return{connections:g,height:w.height}}),clientConnections:g=>Jt(this,null,function*(){return f.ClientConnections({clientId:g})}),clientState:g=>Jt(this,null,function*(){return f.ConnectionClientState({connectionId:g})}),consensusState:(g,w)=>Jt(this,null,function*(){return f.ConnectionConsensusState(SLr.QueryConnectionConsensusStateRequest.fromPartial({connectionId:g,revisionHeight:Lz.default.fromNumber(w,!0)}))})},transfer:{denomTrace:g=>Jt(this,null,function*(){return l.DenomTrace({hash:g})}),denomTraces:g=>Jt(this,null,function*(){return l.DenomTraces({pagination:(0,CI.createPagination)(g)})}),allDenomTraces:()=>Jt(this,null,function*(){var F;let g=[],w,N;do w=yield l.DenomTraces({pagination:(0,CI.createPagination)(N)}),g.push(...w.denomTraces),N=(F=w.pagination)==null?void 0:F.nextKey;while(N&&N.length);return{denomTraces:g}}),params:()=>Jt(this,null,function*(){return l.Params({})})},verified:{channel:{channel:(g,w)=>Jt(this,null,function*(){let N=(0,S3t.toAscii)(`channelEnds/ports/${g}/channels/${w}`),{value:F}=yield e.queryStoreVerified("ibc",N);return F.length?F8s.Channel.decode(F):null}),packetCommitment:(g,w,N)=>Jt(this,null,function*(){let F=(0,S3t.toAscii)(`commitments/ports/${g}/channels/${w}/packets/${N}`),{value:j}=yield e.queryStoreVerified("ibc",F);return j}),packetAcknowledgement:(g,w,N)=>Jt(this,null,function*(){let F=(0,S3t.toAscii)(`acks/ports/${g}/channels/${w}/acknowledgements/${N}`),{value:j}=yield e.queryStoreVerified("ibc",F);return j}),nextSequenceReceive:(g,w)=>Jt(this,null,function*(){let N=(0,S3t.toAscii)(`seqAcks/ports/${g}/channels/${w}/nextSequenceAck`),{value:F}=yield e.queryStoreVerified("ibc",N);return F.length?T8s.Uint64.fromBytes(F).toNumber():null})}}}}}lvt.setupIbcExtension=H8s;var gvt={},H$r={},Vie={},L8s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),G8s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),q8s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&L8s(i,e,A);return G8s(i,e),i};Object.defineProperty(Vie,"__esModule",{value:!0});Vie.Params=Vie.Minter=Vie.protobufPackage=void 0;var jk=Ns,M8e=q8s(BA);Vie.protobufPackage="cosmos.mint.v1beta1";function wLr(){return{inflation:"",annualProvisions:""}}Vie.Minter={encode(e,i=M8e.Writer.create()){return e.inflation!==""&&i.uint32(10).string(e.inflation),e.annualProvisions!==""&&i.uint32(18).string(e.annualProvisions),i},decode(e,i){let A=e instanceof M8e.Reader?e:new M8e.Reader(e),c=i===void 0?A.len:A.pos+i,f=wLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.inflation=A.string();break;case 2:f.annualProvisions=A.string();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{inflation:(0,jk.isSet)(e.inflation)?String(e.inflation):"",annualProvisions:(0,jk.isSet)(e.annualProvisions)?String(e.annualProvisions):""}},toJSON(e){let i={};return e.inflation!==void 0&&(i.inflation=e.inflation),e.annualProvisions!==void 0&&(i.annualProvisions=e.annualProvisions),i},fromPartial(e){var A,c;let i=wLr();return i.inflation=(A=e.inflation)!=null?A:"",i.annualProvisions=(c=e.annualProvisions)!=null?c:"",i}};function QLr(){return{mintDenom:"",inflationRateChange:"",inflationMax:"",inflationMin:"",goalBonded:"",blocksPerYear:jk.Long.UZERO}}Vie.Params={encode(e,i=M8e.Writer.create()){return e.mintDenom!==""&&i.uint32(10).string(e.mintDenom),e.inflationRateChange!==""&&i.uint32(18).string(e.inflationRateChange),e.inflationMax!==""&&i.uint32(26).string(e.inflationMax),e.inflationMin!==""&&i.uint32(34).string(e.inflationMin),e.goalBonded!==""&&i.uint32(42).string(e.goalBonded),e.blocksPerYear.isZero()||i.uint32(48).uint64(e.blocksPerYear),i},decode(e,i){let A=e instanceof M8e.Reader?e:new M8e.Reader(e),c=i===void 0?A.len:A.pos+i,f=QLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.mintDenom=A.string();break;case 2:f.inflationRateChange=A.string();break;case 3:f.inflationMax=A.string();break;case 4:f.inflationMin=A.string();break;case 5:f.goalBonded=A.string();break;case 6:f.blocksPerYear=A.uint64();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{mintDenom:(0,jk.isSet)(e.mintDenom)?String(e.mintDenom):"",inflationRateChange:(0,jk.isSet)(e.inflationRateChange)?String(e.inflationRateChange):"",inflationMax:(0,jk.isSet)(e.inflationMax)?String(e.inflationMax):"",inflationMin:(0,jk.isSet)(e.inflationMin)?String(e.inflationMin):"",goalBonded:(0,jk.isSet)(e.goalBonded)?String(e.goalBonded):"",blocksPerYear:(0,jk.isSet)(e.blocksPerYear)?jk.Long.fromValue(e.blocksPerYear):jk.Long.UZERO}},toJSON(e){let i={};return e.mintDenom!==void 0&&(i.mintDenom=e.mintDenom),e.inflationRateChange!==void 0&&(i.inflationRateChange=e.inflationRateChange),e.inflationMax!==void 0&&(i.inflationMax=e.inflationMax),e.inflationMin!==void 0&&(i.inflationMin=e.inflationMin),e.goalBonded!==void 0&&(i.goalBonded=e.goalBonded),e.blocksPerYear!==void 0&&(i.blocksPerYear=(e.blocksPerYear||jk.Long.UZERO).toString()),i},fromPartial(e){var A,c,f,l,g;let i=QLr();return i.mintDenom=(A=e.mintDenom)!=null?A:"",i.inflationRateChange=(c=e.inflationRateChange)!=null?c:"",i.inflationMax=(f=e.inflationMax)!=null?f:"",i.inflationMin=(l=e.inflationMin)!=null?l:"",i.goalBonded=(g=e.goalBonded)!=null?g:"",i.blocksPerYear=e.blocksPerYear!==void 0&&e.blocksPerYear!==null?jk.Long.fromValue(e.blocksPerYear):jk.Long.UZERO,i}};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(Z,R,M,U){U===void 0&&(U=M);var E=Object.getOwnPropertyDescriptor(R,M);(!E||("get"in E?!R.__esModule:E.writable||E.configurable))&&(E={enumerable:!0,get:function(){return R[M]}}),Object.defineProperty(Z,U,E)}:function(Z,R,M,U){U===void 0&&(U=M),Z[U]=R[M]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(Z,R){Object.defineProperty(Z,"default",{enumerable:!0,value:R})}:function(Z,R){Z.default=R}),c=Fr&&Fr.__importStar||function(Z){if(Z&&Z.__esModule)return Z;var R={};if(Z!=null)for(var M in Z)M!=="default"&&Object.prototype.hasOwnProperty.call(Z,M)&&i(R,Z,M);return A(R,Z),R};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryAnnualProvisionsResponse=e.QueryAnnualProvisionsRequest=e.QueryInflationResponse=e.QueryInflationRequest=e.QueryParamsResponse=e.QueryParamsRequest=e.protobufPackage=void 0;let f=Vie,l=c(BA),g=Ns;e.protobufPackage="cosmos.mint.v1beta1";function w(){return{}}e.QueryParamsRequest={encode(Z,R=l.Writer.create()){return R},decode(Z,R){let M=Z instanceof l.Reader?Z:new l.Reader(Z),U=R===void 0?M.len:M.pos+R,E=w();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{}},toJSON(Z){return{}},fromPartial(Z){return w()}};function N(){return{params:void 0}}e.QueryParamsResponse={encode(Z,R=l.Writer.create()){return Z.params!==void 0&&f.Params.encode(Z.params,R.uint32(10).fork()).ldelim(),R},decode(Z,R){let M=Z instanceof l.Reader?Z:new l.Reader(Z),U=R===void 0?M.len:M.pos+R,E=N();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){case 1:E.params=f.Params.decode(M,M.uint32());break;default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{params:(0,g.isSet)(Z.params)?f.Params.fromJSON(Z.params):void 0}},toJSON(Z){let R={};return Z.params!==void 0&&(R.params=Z.params?f.Params.toJSON(Z.params):void 0),R},fromPartial(Z){let R=N();return R.params=Z.params!==void 0&&Z.params!==null?f.Params.fromPartial(Z.params):void 0,R}};function F(){return{}}e.QueryInflationRequest={encode(Z,R=l.Writer.create()){return R},decode(Z,R){let M=Z instanceof l.Reader?Z:new l.Reader(Z),U=R===void 0?M.len:M.pos+R,E=F();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{}},toJSON(Z){return{}},fromPartial(Z){return F()}};function j(){return{inflation:new Uint8Array}}e.QueryInflationResponse={encode(Z,R=l.Writer.create()){return Z.inflation.length!==0&&R.uint32(10).bytes(Z.inflation),R},decode(Z,R){let M=Z instanceof l.Reader?Z:new l.Reader(Z),U=R===void 0?M.len:M.pos+R,E=j();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){case 1:E.inflation=M.bytes();break;default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{inflation:(0,g.isSet)(Z.inflation)?(0,g.bytesFromBase64)(Z.inflation):new Uint8Array}},toJSON(Z){let R={};return Z.inflation!==void 0&&(R.inflation=(0,g.base64FromBytes)(Z.inflation!==void 0?Z.inflation:new Uint8Array)),R},fromPartial(Z){var M;let R=j();return R.inflation=(M=Z.inflation)!=null?M:new Uint8Array,R}};function te(){return{}}e.QueryAnnualProvisionsRequest={encode(Z,R=l.Writer.create()){return R},decode(Z,R){let M=Z instanceof l.Reader?Z:new l.Reader(Z),U=R===void 0?M.len:M.pos+R,E=te();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{}},toJSON(Z){return{}},fromPartial(Z){return te()}};function v(){return{annualProvisions:new Uint8Array}}e.QueryAnnualProvisionsResponse={encode(Z,R=l.Writer.create()){return Z.annualProvisions.length!==0&&R.uint32(10).bytes(Z.annualProvisions),R},decode(Z,R){let M=Z instanceof l.Reader?Z:new l.Reader(Z),U=R===void 0?M.len:M.pos+R,E=v();for(;M.pos<U;){let Q=M.uint32();switch(Q>>>3){case 1:E.annualProvisions=M.bytes();break;default:M.skipType(Q&7);break}}return E},fromJSON(Z){return{annualProvisions:(0,g.isSet)(Z.annualProvisions)?(0,g.bytesFromBase64)(Z.annualProvisions):new Uint8Array}},toJSON(Z){let R={};return Z.annualProvisions!==void 0&&(R.annualProvisions=(0,g.base64FromBytes)(Z.annualProvisions!==void 0?Z.annualProvisions:new Uint8Array)),R},fromPartial(Z){var M;let R=v();return R.annualProvisions=(M=Z.annualProvisions)!=null?M:new Uint8Array,R}};class ne{constructor(R){this.rpc=R,this.Params=this.Params.bind(this),this.Inflation=this.Inflation.bind(this),this.AnnualProvisions=this.AnnualProvisions.bind(this)}Params(R={}){let M=e.QueryParamsRequest.encode(R).finish();return this.rpc.request("cosmos.mint.v1beta1.Query","Params",M).then(E=>e.QueryParamsResponse.decode(new l.Reader(E)))}Inflation(R={}){let M=e.QueryInflationRequest.encode(R).finish();return this.rpc.request("cosmos.mint.v1beta1.Query","Inflation",M).then(E=>e.QueryInflationResponse.decode(new l.Reader(E)))}AnnualProvisions(R={}){let M=e.QueryAnnualProvisionsRequest.encode(R).finish();return this.rpc.request("cosmos.mint.v1beta1.Query","AnnualProvisions",M).then(E=>e.QueryAnnualProvisionsResponse.decode(new l.Reader(E)))}}e.QueryClientImpl=ne})(H$r);Object.defineProperty(gvt,"__esModule",{value:!0});gvt.setupMintExtension=void 0;var K8s=O3,Y8s=H$r,Mue=Rw;function V8s(e){let i=(0,Mue.createProtobufRpcClient)(e),A=new Y8s.QueryClientImpl(i);return{mint:{params:()=>Jt(this,null,function*(){let{params:c}=yield A.Params({});return(0,K8s.assert)(c),{blocksPerYear:c.blocksPerYear,goalBonded:(0,Mue.decodeCosmosSdkDecFromProto)(c.goalBonded),inflationMin:(0,Mue.decodeCosmosSdkDecFromProto)(c.inflationMin),inflationMax:(0,Mue.decodeCosmosSdkDecFromProto)(c.inflationMax),inflationRateChange:(0,Mue.decodeCosmosSdkDecFromProto)(c.inflationRateChange),mintDenom:c.mintDenom}}),inflation:()=>Jt(this,null,function*(){let{inflation:c}=yield A.Inflation({});return(0,Mue.decodeCosmosSdkDecFromProto)(c)}),annualProvisions:()=>Jt(this,null,function*(){let{annualProvisions:c}=yield A.AnnualProvisions({});return(0,Mue.decodeCosmosSdkDecFromProto)(c)})}}}gvt.setupMintExtension=V8s;var hSe={};Object.defineProperty(hSe,"__esModule",{value:!0});hSe.createSlashingAminoConverters=hSe.isAminoMsgUnjail=void 0;function z8s(e){return e.type==="cosmos-sdk/MsgUnjail"}hSe.isAminoMsgUnjail=z8s;function W8s(){throw new Error("Not implemented")}hSe.createSlashingAminoConverters=W8s;var pvt={},L$r={},zie={},Z8s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),X8s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),$8s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&Z8s(i,e,A);return X8s(i,e),i};Object.defineProperty(zie,"__esModule",{value:!0});zie.Params=zie.ValidatorSigningInfo=zie.protobufPackage=void 0;var T2n=k3,qHe=MR,Qu=Ns,T8e=$8s(BA);zie.protobufPackage="cosmos.slashing.v1beta1";function kLr(){return{address:"",startHeight:Qu.Long.ZERO,indexOffset:Qu.Long.ZERO,jailedUntil:void 0,tombstoned:!1,missedBlocksCounter:Qu.Long.ZERO}}zie.ValidatorSigningInfo={encode(e,i=T8e.Writer.create()){return e.address!==""&&i.uint32(10).string(e.address),e.startHeight.isZero()||i.uint32(16).int64(e.startHeight),e.indexOffset.isZero()||i.uint32(24).int64(e.indexOffset),e.jailedUntil!==void 0&&T2n.Timestamp.encode(e.jailedUntil,i.uint32(34).fork()).ldelim(),e.tombstoned===!0&&i.uint32(40).bool(e.tombstoned),e.missedBlocksCounter.isZero()||i.uint32(48).int64(e.missedBlocksCounter),i},decode(e,i){let A=e instanceof T8e.Reader?e:new T8e.Reader(e),c=i===void 0?A.len:A.pos+i,f=kLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.address=A.string();break;case 2:f.startHeight=A.int64();break;case 3:f.indexOffset=A.int64();break;case 4:f.jailedUntil=T2n.Timestamp.decode(A,A.uint32());break;case 5:f.tombstoned=A.bool();break;case 6:f.missedBlocksCounter=A.int64();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{address:(0,Qu.isSet)(e.address)?String(e.address):"",startHeight:(0,Qu.isSet)(e.startHeight)?Qu.Long.fromValue(e.startHeight):Qu.Long.ZERO,indexOffset:(0,Qu.isSet)(e.indexOffset)?Qu.Long.fromValue(e.indexOffset):Qu.Long.ZERO,jailedUntil:(0,Qu.isSet)(e.jailedUntil)?(0,Qu.fromJsonTimestamp)(e.jailedUntil):void 0,tombstoned:(0,Qu.isSet)(e.tombstoned)?!!e.tombstoned:!1,missedBlocksCounter:(0,Qu.isSet)(e.missedBlocksCounter)?Qu.Long.fromValue(e.missedBlocksCounter):Qu.Long.ZERO}},toJSON(e){let i={};return e.address!==void 0&&(i.address=e.address),e.startHeight!==void 0&&(i.startHeight=(e.startHeight||Qu.Long.ZERO).toString()),e.indexOffset!==void 0&&(i.indexOffset=(e.indexOffset||Qu.Long.ZERO).toString()),e.jailedUntil!==void 0&&(i.jailedUntil=(0,Qu.fromTimestamp)(e.jailedUntil).toISOString()),e.tombstoned!==void 0&&(i.tombstoned=e.tombstoned),e.missedBlocksCounter!==void 0&&(i.missedBlocksCounter=(e.missedBlocksCounter||Qu.Long.ZERO).toString()),i},fromPartial(e){var A,c;let i=kLr();return i.address=(A=e.address)!=null?A:"",i.startHeight=e.startHeight!==void 0&&e.startHeight!==null?Qu.Long.fromValue(e.startHeight):Qu.Long.ZERO,i.indexOffset=e.indexOffset!==void 0&&e.indexOffset!==null?Qu.Long.fromValue(e.indexOffset):Qu.Long.ZERO,i.jailedUntil=e.jailedUntil!==void 0&&e.jailedUntil!==null?T2n.Timestamp.fromPartial(e.jailedUntil):void 0,i.tombstoned=(c=e.tombstoned)!=null?c:!1,i.missedBlocksCounter=e.missedBlocksCounter!==void 0&&e.missedBlocksCounter!==null?Qu.Long.fromValue(e.missedBlocksCounter):Qu.Long.ZERO,i}};function DLr(){return{signedBlocksWindow:Qu.Long.ZERO,minSignedPerWindow:new Uint8Array,downtimeJailDuration:void 0,slashFractionDoubleSign:new Uint8Array,slashFractionDowntime:new Uint8Array}}zie.Params={encode(e,i=T8e.Writer.create()){return e.signedBlocksWindow.isZero()||i.uint32(8).int64(e.signedBlocksWindow),e.minSignedPerWindow.length!==0&&i.uint32(18).bytes(e.minSignedPerWindow),e.downtimeJailDuration!==void 0&&qHe.Duration.encode(e.downtimeJailDuration,i.uint32(26).fork()).ldelim(),e.slashFractionDoubleSign.length!==0&&i.uint32(34).bytes(e.slashFractionDoubleSign),e.slashFractionDowntime.length!==0&&i.uint32(42).bytes(e.slashFractionDowntime),i},decode(e,i){let A=e instanceof T8e.Reader?e:new T8e.Reader(e),c=i===void 0?A.len:A.pos+i,f=DLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.signedBlocksWindow=A.int64();break;case 2:f.minSignedPerWindow=A.bytes();break;case 3:f.downtimeJailDuration=qHe.Duration.decode(A,A.uint32());break;case 4:f.slashFractionDoubleSign=A.bytes();break;case 5:f.slashFractionDowntime=A.bytes();break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{signedBlocksWindow:(0,Qu.isSet)(e.signedBlocksWindow)?Qu.Long.fromValue(e.signedBlocksWindow):Qu.Long.ZERO,minSignedPerWindow:(0,Qu.isSet)(e.minSignedPerWindow)?(0,Qu.bytesFromBase64)(e.minSignedPerWindow):new Uint8Array,downtimeJailDuration:(0,Qu.isSet)(e.downtimeJailDuration)?qHe.Duration.fromJSON(e.downtimeJailDuration):void 0,slashFractionDoubleSign:(0,Qu.isSet)(e.slashFractionDoubleSign)?(0,Qu.bytesFromBase64)(e.slashFractionDoubleSign):new Uint8Array,slashFractionDowntime:(0,Qu.isSet)(e.slashFractionDowntime)?(0,Qu.bytesFromBase64)(e.slashFractionDowntime):new Uint8Array}},toJSON(e){let i={};return e.signedBlocksWindow!==void 0&&(i.signedBlocksWindow=(e.signedBlocksWindow||Qu.Long.ZERO).toString()),e.minSignedPerWindow!==void 0&&(i.minSignedPerWindow=(0,Qu.base64FromBytes)(e.minSignedPerWindow!==void 0?e.minSignedPerWindow:new Uint8Array)),e.downtimeJailDuration!==void 0&&(i.downtimeJailDuration=e.downtimeJailDuration?qHe.Duration.toJSON(e.downtimeJailDuration):void 0),e.slashFractionDoubleSign!==void 0&&(i.slashFractionDoubleSign=(0,Qu.base64FromBytes)(e.slashFractionDoubleSign!==void 0?e.slashFractionDoubleSign:new Uint8Array)),e.slashFractionDowntime!==void 0&&(i.slashFractionDowntime=(0,Qu.base64FromBytes)(e.slashFractionDowntime!==void 0?e.slashFractionDowntime:new Uint8Array)),i},fromPartial(e){var A,c,f;let i=DLr();return i.signedBlocksWindow=e.signedBlocksWindow!==void 0&&e.signedBlocksWindow!==null?Qu.Long.fromValue(e.signedBlocksWindow):Qu.Long.ZERO,i.minSignedPerWindow=(A=e.minSignedPerWindow)!=null?A:new Uint8Array,i.downtimeJailDuration=e.downtimeJailDuration!==void 0&&e.downtimeJailDuration!==null?qHe.Duration.fromPartial(e.downtimeJailDuration):void 0,i.slashFractionDoubleSign=(c=e.slashFractionDoubleSign)!=null?c:new Uint8Array,i.slashFractionDowntime=(f=e.slashFractionDowntime)!=null?f:new Uint8Array,i}};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(R,M,U,E){E===void 0&&(E=U);var Q=Object.getOwnPropertyDescriptor(M,U);(!Q||("get"in Q?!M.__esModule:Q.writable||Q.configurable))&&(Q={enumerable:!0,get:function(){return M[U]}}),Object.defineProperty(R,E,Q)}:function(R,M,U,E){E===void 0&&(E=U),R[E]=M[U]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(R,M){Object.defineProperty(R,"default",{enumerable:!0,value:M})}:function(R,M){R.default=M}),c=Fr&&Fr.__importStar||function(R){if(R&&R.__esModule)return R;var M={};if(R!=null)for(var U in R)U!=="default"&&Object.prototype.hasOwnProperty.call(R,U)&&i(M,R,U);return A(M,R),M};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QuerySigningInfosResponse=e.QuerySigningInfosRequest=e.QuerySigningInfoResponse=e.QuerySigningInfoRequest=e.QueryParamsResponse=e.QueryParamsRequest=e.protobufPackage=void 0;let f=Hm,l=zie,g=c(BA),w=Ns;e.protobufPackage="cosmos.slashing.v1beta1";function N(){return{}}e.QueryParamsRequest={encode(R,M=g.Writer.create()){return M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=N();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){default:U.skipType(H&7);break}}return Q},fromJSON(R){return{}},toJSON(R){return{}},fromPartial(R){return N()}};function F(){return{params:void 0}}e.QueryParamsResponse={encode(R,M=g.Writer.create()){return R.params!==void 0&&l.Params.encode(R.params,M.uint32(10).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=F();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.params=l.Params.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{params:(0,w.isSet)(R.params)?l.Params.fromJSON(R.params):void 0}},toJSON(R){let M={};return R.params!==void 0&&(M.params=R.params?l.Params.toJSON(R.params):void 0),M},fromPartial(R){let M=F();return M.params=R.params!==void 0&&R.params!==null?l.Params.fromPartial(R.params):void 0,M}};function j(){return{consAddress:""}}e.QuerySigningInfoRequest={encode(R,M=g.Writer.create()){return R.consAddress!==""&&M.uint32(10).string(R.consAddress),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=j();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.consAddress=U.string();break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{consAddress:(0,w.isSet)(R.consAddress)?String(R.consAddress):""}},toJSON(R){let M={};return R.consAddress!==void 0&&(M.consAddress=R.consAddress),M},fromPartial(R){var U;let M=j();return M.consAddress=(U=R.consAddress)!=null?U:"",M}};function te(){return{valSigningInfo:void 0}}e.QuerySigningInfoResponse={encode(R,M=g.Writer.create()){return R.valSigningInfo!==void 0&&l.ValidatorSigningInfo.encode(R.valSigningInfo,M.uint32(10).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=te();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.valSigningInfo=l.ValidatorSigningInfo.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{valSigningInfo:(0,w.isSet)(R.valSigningInfo)?l.ValidatorSigningInfo.fromJSON(R.valSigningInfo):void 0}},toJSON(R){let M={};return R.valSigningInfo!==void 0&&(M.valSigningInfo=R.valSigningInfo?l.ValidatorSigningInfo.toJSON(R.valSigningInfo):void 0),M},fromPartial(R){let M=te();return M.valSigningInfo=R.valSigningInfo!==void 0&&R.valSigningInfo!==null?l.ValidatorSigningInfo.fromPartial(R.valSigningInfo):void 0,M}};function v(){return{pagination:void 0}}e.QuerySigningInfosRequest={encode(R,M=g.Writer.create()){return R.pagination!==void 0&&f.PageRequest.encode(R.pagination,M.uint32(10).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=v();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.pagination=f.PageRequest.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{pagination:(0,w.isSet)(R.pagination)?f.PageRequest.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.pagination!==void 0&&(M.pagination=R.pagination?f.PageRequest.toJSON(R.pagination):void 0),M},fromPartial(R){let M=v();return M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageRequest.fromPartial(R.pagination):void 0,M}};function ne(){return{info:[],pagination:void 0}}e.QuerySigningInfosResponse={encode(R,M=g.Writer.create()){for(let U of R.info)l.ValidatorSigningInfo.encode(U,M.uint32(10).fork()).ldelim();return R.pagination!==void 0&&f.PageResponse.encode(R.pagination,M.uint32(18).fork()).ldelim(),M},decode(R,M){let U=R instanceof g.Reader?R:new g.Reader(R),E=M===void 0?U.len:U.pos+M,Q=ne();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.info.push(l.ValidatorSigningInfo.decode(U,U.uint32()));break;case 2:Q.pagination=f.PageResponse.decode(U,U.uint32());break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{info:Array.isArray(R==null?void 0:R.info)?R.info.map(M=>l.ValidatorSigningInfo.fromJSON(M)):[],pagination:(0,w.isSet)(R.pagination)?f.PageResponse.fromJSON(R.pagination):void 0}},toJSON(R){let M={};return R.info?M.info=R.info.map(U=>U?l.ValidatorSigningInfo.toJSON(U):void 0):M.info=[],R.pagination!==void 0&&(M.pagination=R.pagination?f.PageResponse.toJSON(R.pagination):void 0),M},fromPartial(R){var U;let M=ne();return M.info=((U=R.info)==null?void 0:U.map(E=>l.ValidatorSigningInfo.fromPartial(E)))||[],M.pagination=R.pagination!==void 0&&R.pagination!==null?f.PageResponse.fromPartial(R.pagination):void 0,M}};class Z{constructor(M){this.rpc=M,this.Params=this.Params.bind(this),this.SigningInfo=this.SigningInfo.bind(this),this.SigningInfos=this.SigningInfos.bind(this)}Params(M={}){let U=e.QueryParamsRequest.encode(M).finish();return this.rpc.request("cosmos.slashing.v1beta1.Query","Params",U).then(Q=>e.QueryParamsResponse.decode(new g.Reader(Q)))}SigningInfo(M){let U=e.QuerySigningInfoRequest.encode(M).finish();return this.rpc.request("cosmos.slashing.v1beta1.Query","SigningInfo",U).then(Q=>e.QuerySigningInfoResponse.decode(new g.Reader(Q)))}SigningInfos(M={pagination:void 0}){let U=e.QuerySigningInfosRequest.encode(M).finish();return this.rpc.request("cosmos.slashing.v1beta1.Query","SigningInfos",U).then(Q=>e.QuerySigningInfosResponse.decode(new g.Reader(Q)))}}e.QueryClientImpl=Z})(L$r);Object.defineProperty(pvt,"__esModule",{value:!0});pvt.setupSlashingExtension=void 0;var j8s=L$r,RLr=Rw;function ebs(e){let i=(0,RLr.createProtobufRpcClient)(e),A=new j8s.QueryClientImpl(i);return{slashing:{signingInfo:c=>Jt(this,null,function*(){return yield A.SigningInfo({consAddress:c})}),signingInfos:c=>Jt(this,null,function*(){return yield A.SigningInfos({pagination:(0,RLr.createPagination)(c)})}),params:()=>Jt(this,null,function*(){return yield A.Params({})})}}}pvt.setupSlashingExtension=ebs;var NB={};Object.defineProperty(NB,"__esModule",{value:!0});NB.createStakingAminoConverters=NB.isAminoMsgUndelegate=NB.isAminoMsgBeginRedelegate=NB.isAminoMsgDelegate=NB.isAminoMsgEditValidator=NB.isAminoMsgCreateValidator=NB.protoDecimalToJson=void 0;var G$r=EE,PLr=MF,aie=O3;function JLe(e){let i=G$r.Decimal.fromAtomics(e,18),[A,c]=i.toString().split(".");return`${A}.${(c!=null?c:"").padEnd(18,"0")}`}NB.protoDecimalToJson=JLe;function w3t(e){return G$r.Decimal.fromUserInput(e,18).atomics}function tbs(e){return e.type==="cosmos-sdk/MsgCreateValidator"}NB.isAminoMsgCreateValidator=tbs;function nbs(e){return e.type==="cosmos-sdk/MsgEditValidator"}NB.isAminoMsgEditValidator=nbs;function rbs(e){return e.type==="cosmos-sdk/MsgDelegate"}NB.isAminoMsgDelegate=rbs;function ibs(e){return e.type==="cosmos-sdk/MsgBeginRedelegate"}NB.isAminoMsgBeginRedelegate=ibs;function obs(e){return e.type==="cosmos-sdk/MsgUndelegate"}NB.isAminoMsgUndelegate=obs;function abs(){return{"/cosmos.staking.v1beta1.MsgBeginRedelegate":{aminoType:"cosmos-sdk/MsgBeginRedelegate",toAmino:({delegatorAddress:e,validatorSrcAddress:i,validatorDstAddress:A,amount:c})=>((0,aie.assertDefinedAndNotNull)(c,"missing amount"),{delegator_address:e,validator_src_address:i,validator_dst_address:A,amount:c}),fromAmino:({delegator_address:e,validator_src_address:i,validator_dst_address:A,amount:c})=>({delegatorAddress:e,validatorSrcAddress:i,validatorDstAddress:A,amount:c})},"/cosmos.staking.v1beta1.MsgCreateValidator":{aminoType:"cosmos-sdk/MsgCreateValidator",toAmino:({description:e,commission:i,minSelfDelegation:A,delegatorAddress:c,validatorAddress:f,pubkey:l,value:g})=>((0,aie.assertDefinedAndNotNull)(e,"missing description"),(0,aie.assertDefinedAndNotNull)(i,"missing commission"),(0,aie.assertDefinedAndNotNull)(l,"missing pubkey"),(0,aie.assertDefinedAndNotNull)(g,"missing value"),{description:{moniker:e.moniker,identity:e.identity,website:e.website,security_contact:e.securityContact,details:e.details},commission:{rate:JLe(i.rate),max_rate:JLe(i.maxRate),max_change_rate:JLe(i.maxChangeRate)},min_self_delegation:A,delegator_address:c,validator_address:f,pubkey:(0,PLr.decodePubkey)(l),value:g}),fromAmino:({description:e,commission:i,min_self_delegation:A,delegator_address:c,validator_address:f,pubkey:l,value:g})=>({description:{moniker:e.moniker,identity:e.identity,website:e.website,securityContact:e.security_contact,details:e.details},commission:{rate:w3t(i.rate),maxRate:w3t(i.max_rate),maxChangeRate:w3t(i.max_change_rate)},minSelfDelegation:A,delegatorAddress:c,validatorAddress:f,pubkey:(0,PLr.encodePubkey)(l),value:g})},"/cosmos.staking.v1beta1.MsgDelegate":{aminoType:"cosmos-sdk/MsgDelegate",toAmino:({delegatorAddress:e,validatorAddress:i,amount:A})=>((0,aie.assertDefinedAndNotNull)(A,"missing amount"),{delegator_address:e,validator_address:i,amount:A}),fromAmino:({delegator_address:e,validator_address:i,amount:A})=>({delegatorAddress:e,validatorAddress:i,amount:A})},"/cosmos.staking.v1beta1.MsgEditValidator":{aminoType:"cosmos-sdk/MsgEditValidator",toAmino:({description:e,commissionRate:i,minSelfDelegation:A,validatorAddress:c})=>((0,aie.assertDefinedAndNotNull)(e,"missing description"),{description:{moniker:e.moniker,identity:e.identity,website:e.website,security_contact:e.securityContact,details:e.details},commission_rate:i?JLe(i):void 0,min_self_delegation:A||void 0,validator_address:c}),fromAmino:({description:e,commission_rate:i,min_self_delegation:A,validator_address:c})=>({description:{moniker:e.moniker,identity:e.identity,website:e.website,securityContact:e.security_contact,details:e.details},commissionRate:i?w3t(i):"",minSelfDelegation:A!=null?A:"",validatorAddress:c})},"/cosmos.staking.v1beta1.MsgUndelegate":{aminoType:"cosmos-sdk/MsgUndelegate",toAmino:({delegatorAddress:e,validatorAddress:i,amount:A})=>((0,aie.assertDefinedAndNotNull)(A,"missing amount"),{delegator_address:e,validator_address:i,amount:A}),fromAmino:({delegator_address:e,validator_address:i,amount:A})=>({delegatorAddress:e,validatorAddress:i,amount:A})}}}NB.createStakingAminoConverters=abs;var sD={},EIn={},BIn={},vIn={},q$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(ne,Z,R,M){M===void 0&&(M=R);var U=Object.getOwnPropertyDescriptor(Z,R);(!U||("get"in U?!Z.__esModule:U.writable||U.configurable))&&(U={enumerable:!0,get:function(){return Z[R]}}),Object.defineProperty(ne,M,U)}:function(ne,Z,R,M){M===void 0&&(M=R),ne[M]=Z[R]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(ne,Z){Object.defineProperty(ne,"default",{enumerable:!0,value:Z})}:function(ne,Z){ne.default=Z}),c=Fr&&Fr.__importStar||function(ne){if(ne&&ne.__esModule)return ne;var Z={};if(ne!=null)for(var R in ne)R!=="default"&&Object.prototype.hasOwnProperty.call(ne,R)&&i(Z,ne,R);return A(Z,ne),Z};Object.defineProperty(e,"__esModule",{value:!0}),e.HashedParams=e.VersionParams=e.ValidatorParams=e.EvidenceParams=e.BlockParams=e.ConsensusParams=e.protobufPackage=void 0;let f=MR,l=Ns,g=c(BA);e.protobufPackage="tendermint.types";function w(){return{block:void 0,evidence:void 0,validator:void 0,version:void 0}}e.ConsensusParams={encode(ne,Z=g.Writer.create()){return ne.block!==void 0&&e.BlockParams.encode(ne.block,Z.uint32(10).fork()).ldelim(),ne.evidence!==void 0&&e.EvidenceParams.encode(ne.evidence,Z.uint32(18).fork()).ldelim(),ne.validator!==void 0&&e.ValidatorParams.encode(ne.validator,Z.uint32(26).fork()).ldelim(),ne.version!==void 0&&e.VersionParams.encode(ne.version,Z.uint32(34).fork()).ldelim(),Z},decode(ne,Z){let R=ne instanceof g.Reader?ne:new g.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=w();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.block=e.BlockParams.decode(R,R.uint32());break;case 2:U.evidence=e.EvidenceParams.decode(R,R.uint32());break;case 3:U.validator=e.ValidatorParams.decode(R,R.uint32());break;case 4:U.version=e.VersionParams.decode(R,R.uint32());break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{block:(0,l.isSet)(ne.block)?e.BlockParams.fromJSON(ne.block):void 0,evidence:(0,l.isSet)(ne.evidence)?e.EvidenceParams.fromJSON(ne.evidence):void 0,validator:(0,l.isSet)(ne.validator)?e.ValidatorParams.fromJSON(ne.validator):void 0,version:(0,l.isSet)(ne.version)?e.VersionParams.fromJSON(ne.version):void 0}},toJSON(ne){let Z={};return ne.block!==void 0&&(Z.block=ne.block?e.BlockParams.toJSON(ne.block):void 0),ne.evidence!==void 0&&(Z.evidence=ne.evidence?e.EvidenceParams.toJSON(ne.evidence):void 0),ne.validator!==void 0&&(Z.validator=ne.validator?e.ValidatorParams.toJSON(ne.validator):void 0),ne.version!==void 0&&(Z.version=ne.version?e.VersionParams.toJSON(ne.version):void 0),Z},fromPartial(ne){let Z=w();return Z.block=ne.block!==void 0&&ne.block!==null?e.BlockParams.fromPartial(ne.block):void 0,Z.evidence=ne.evidence!==void 0&&ne.evidence!==null?e.EvidenceParams.fromPartial(ne.evidence):void 0,Z.validator=ne.validator!==void 0&&ne.validator!==null?e.ValidatorParams.fromPartial(ne.validator):void 0,Z.version=ne.version!==void 0&&ne.version!==null?e.VersionParams.fromPartial(ne.version):void 0,Z}};function N(){return{maxBytes:l.Long.ZERO,maxGas:l.Long.ZERO}}e.BlockParams={encode(ne,Z=g.Writer.create()){return ne.maxBytes.isZero()||Z.uint32(8).int64(ne.maxBytes),ne.maxGas.isZero()||Z.uint32(16).int64(ne.maxGas),Z},decode(ne,Z){let R=ne instanceof g.Reader?ne:new g.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=N();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.maxBytes=R.int64();break;case 2:U.maxGas=R.int64();break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{maxBytes:(0,l.isSet)(ne.maxBytes)?l.Long.fromValue(ne.maxBytes):l.Long.ZERO,maxGas:(0,l.isSet)(ne.maxGas)?l.Long.fromValue(ne.maxGas):l.Long.ZERO}},toJSON(ne){let Z={};return ne.maxBytes!==void 0&&(Z.maxBytes=(ne.maxBytes||l.Long.ZERO).toString()),ne.maxGas!==void 0&&(Z.maxGas=(ne.maxGas||l.Long.ZERO).toString()),Z},fromPartial(ne){let Z=N();return Z.maxBytes=ne.maxBytes!==void 0&&ne.maxBytes!==null?l.Long.fromValue(ne.maxBytes):l.Long.ZERO,Z.maxGas=ne.maxGas!==void 0&&ne.maxGas!==null?l.Long.fromValue(ne.maxGas):l.Long.ZERO,Z}};function F(){return{maxAgeNumBlocks:l.Long.ZERO,maxAgeDuration:void 0,maxBytes:l.Long.ZERO}}e.EvidenceParams={encode(ne,Z=g.Writer.create()){return ne.maxAgeNumBlocks.isZero()||Z.uint32(8).int64(ne.maxAgeNumBlocks),ne.maxAgeDuration!==void 0&&f.Duration.encode(ne.maxAgeDuration,Z.uint32(18).fork()).ldelim(),ne.maxBytes.isZero()||Z.uint32(24).int64(ne.maxBytes),Z},decode(ne,Z){let R=ne instanceof g.Reader?ne:new g.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=F();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.maxAgeNumBlocks=R.int64();break;case 2:U.maxAgeDuration=f.Duration.decode(R,R.uint32());break;case 3:U.maxBytes=R.int64();break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{maxAgeNumBlocks:(0,l.isSet)(ne.maxAgeNumBlocks)?l.Long.fromValue(ne.maxAgeNumBlocks):l.Long.ZERO,maxAgeDuration:(0,l.isSet)(ne.maxAgeDuration)?f.Duration.fromJSON(ne.maxAgeDuration):void 0,maxBytes:(0,l.isSet)(ne.maxBytes)?l.Long.fromValue(ne.maxBytes):l.Long.ZERO}},toJSON(ne){let Z={};return ne.maxAgeNumBlocks!==void 0&&(Z.maxAgeNumBlocks=(ne.maxAgeNumBlocks||l.Long.ZERO).toString()),ne.maxAgeDuration!==void 0&&(Z.maxAgeDuration=ne.maxAgeDuration?f.Duration.toJSON(ne.maxAgeDuration):void 0),ne.maxBytes!==void 0&&(Z.maxBytes=(ne.maxBytes||l.Long.ZERO).toString()),Z},fromPartial(ne){let Z=F();return Z.maxAgeNumBlocks=ne.maxAgeNumBlocks!==void 0&&ne.maxAgeNumBlocks!==null?l.Long.fromValue(ne.maxAgeNumBlocks):l.Long.ZERO,Z.maxAgeDuration=ne.maxAgeDuration!==void 0&&ne.maxAgeDuration!==null?f.Duration.fromPartial(ne.maxAgeDuration):void 0,Z.maxBytes=ne.maxBytes!==void 0&&ne.maxBytes!==null?l.Long.fromValue(ne.maxBytes):l.Long.ZERO,Z}};function j(){return{pubKeyTypes:[]}}e.ValidatorParams={encode(ne,Z=g.Writer.create()){for(let R of ne.pubKeyTypes)Z.uint32(10).string(R);return Z},decode(ne,Z){let R=ne instanceof g.Reader?ne:new g.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=j();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.pubKeyTypes.push(R.string());break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{pubKeyTypes:Array.isArray(ne==null?void 0:ne.pubKeyTypes)?ne.pubKeyTypes.map(Z=>String(Z)):[]}},toJSON(ne){let Z={};return ne.pubKeyTypes?Z.pubKeyTypes=ne.pubKeyTypes.map(R=>R):Z.pubKeyTypes=[],Z},fromPartial(ne){var R;let Z=j();return Z.pubKeyTypes=((R=ne.pubKeyTypes)==null?void 0:R.map(M=>M))||[],Z}};function te(){return{app:l.Long.UZERO}}e.VersionParams={encode(ne,Z=g.Writer.create()){return ne.app.isZero()||Z.uint32(8).uint64(ne.app),Z},decode(ne,Z){let R=ne instanceof g.Reader?ne:new g.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=te();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.app=R.uint64();break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{app:(0,l.isSet)(ne.app)?l.Long.fromValue(ne.app):l.Long.UZERO}},toJSON(ne){let Z={};return ne.app!==void 0&&(Z.app=(ne.app||l.Long.UZERO).toString()),Z},fromPartial(ne){let Z=te();return Z.app=ne.app!==void 0&&ne.app!==null?l.Long.fromValue(ne.app):l.Long.UZERO,Z}};function v(){return{blockMaxBytes:l.Long.ZERO,blockMaxGas:l.Long.ZERO}}e.HashedParams={encode(ne,Z=g.Writer.create()){return ne.blockMaxBytes.isZero()||Z.uint32(8).int64(ne.blockMaxBytes),ne.blockMaxGas.isZero()||Z.uint32(16).int64(ne.blockMaxGas),Z},decode(ne,Z){let R=ne instanceof g.Reader?ne:new g.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=v();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.blockMaxBytes=R.int64();break;case 2:U.blockMaxGas=R.int64();break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{blockMaxBytes:(0,l.isSet)(ne.blockMaxBytes)?l.Long.fromValue(ne.blockMaxBytes):l.Long.ZERO,blockMaxGas:(0,l.isSet)(ne.blockMaxGas)?l.Long.fromValue(ne.blockMaxGas):l.Long.ZERO}},toJSON(ne){let Z={};return ne.blockMaxBytes!==void 0&&(Z.blockMaxBytes=(ne.blockMaxBytes||l.Long.ZERO).toString()),ne.blockMaxGas!==void 0&&(Z.blockMaxGas=(ne.blockMaxGas||l.Long.ZERO).toString()),Z},fromPartial(ne){let Z=v();return Z.blockMaxBytes=ne.blockMaxBytes!==void 0&&ne.blockMaxBytes!==null?l.Long.fromValue(ne.blockMaxBytes):l.Long.ZERO,Z.blockMaxGas=ne.blockMaxGas!==void 0&&ne.blockMaxGas!==null?l.Long.fromValue(ne.blockMaxGas):l.Long.ZERO,Z}}})(q$r);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(Y,fe,be,qt){qt===void 0&&(qt=be);var ct=Object.getOwnPropertyDescriptor(fe,be);(!ct||("get"in ct?!fe.__esModule:ct.writable||ct.configurable))&&(ct={enumerable:!0,get:function(){return fe[be]}}),Object.defineProperty(Y,qt,ct)}:function(Y,fe,be,qt){qt===void 0&&(qt=be),Y[qt]=fe[be]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(Y,fe){Object.defineProperty(Y,"default",{enumerable:!0,value:fe})}:function(Y,fe){Y.default=fe}),c=Fr&&Fr.__importStar||function(Y){if(Y&&Y.__esModule)return Y;var fe={};if(Y!=null)for(var be in Y)be!=="default"&&Object.prototype.hasOwnProperty.call(Y,be)&&i(fe,Y,be);return A(fe,Y),fe};Object.defineProperty(e,"__esModule",{value:!0}),e.ResponsePrepareProposal=e.ResponseApplySnapshotChunk=e.ResponseLoadSnapshotChunk=e.ResponseOfferSnapshot=e.ResponseListSnapshots=e.ResponseCommit=e.ResponseEndBlock=e.ResponseDeliverTx=e.ResponseCheckTx=e.ResponseBeginBlock=e.ResponseQuery=e.ResponseInitChain=e.ResponseInfo=e.ResponseFlush=e.ResponseEcho=e.ResponseException=e.Response=e.RequestProcessProposal=e.RequestPrepareProposal=e.RequestApplySnapshotChunk=e.RequestLoadSnapshotChunk=e.RequestOfferSnapshot=e.RequestListSnapshots=e.RequestCommit=e.RequestEndBlock=e.RequestDeliverTx=e.RequestCheckTx=e.RequestBeginBlock=e.RequestQuery=e.RequestInitChain=e.RequestInfo=e.RequestFlush=e.RequestEcho=e.Request=e.misbehaviorTypeToJSON=e.misbehaviorTypeFromJSON=e.MisbehaviorType=e.responseProcessProposal_ProposalStatusToJSON=e.responseProcessProposal_ProposalStatusFromJSON=e.ResponseProcessProposal_ProposalStatus=e.responseApplySnapshotChunk_ResultToJSON=e.responseApplySnapshotChunk_ResultFromJSON=e.ResponseApplySnapshotChunk_Result=e.responseOfferSnapshot_ResultToJSON=e.responseOfferSnapshot_ResultFromJSON=e.ResponseOfferSnapshot_Result=e.checkTxTypeToJSON=e.checkTxTypeFromJSON=e.CheckTxType=e.protobufPackage=void 0,e.ABCIApplicationClientImpl=e.Snapshot=e.Misbehavior=e.ExtendedVoteInfo=e.VoteInfo=e.ValidatorUpdate=e.Validator=e.TxResult=e.EventAttribute=e.Event=e.ExtendedCommitInfo=e.CommitInfo=e.ResponseProcessProposal=void 0;let f=k3,l=q$r,g=Yfe,w=_In,N=bfe,F=Ns,j=c(BA);e.protobufPackage="tendermint.abci";var te;(function(Y){Y[Y.NEW=0]="NEW",Y[Y.RECHECK=1]="RECHECK",Y[Y.UNRECOGNIZED=-1]="UNRECOGNIZED"})(te=e.CheckTxType||(e.CheckTxType={}));function v(Y){switch(Y){case 0:case"NEW":return te.NEW;case 1:case"RECHECK":return te.RECHECK;case-1:case"UNRECOGNIZED":default:return te.UNRECOGNIZED}}e.checkTxTypeFromJSON=v;function ne(Y){switch(Y){case te.NEW:return"NEW";case te.RECHECK:return"RECHECK";case te.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.checkTxTypeToJSON=ne;var Z;(function(Y){Y[Y.UNKNOWN=0]="UNKNOWN",Y[Y.ACCEPT=1]="ACCEPT",Y[Y.ABORT=2]="ABORT",Y[Y.REJECT=3]="REJECT",Y[Y.REJECT_FORMAT=4]="REJECT_FORMAT",Y[Y.REJECT_SENDER=5]="REJECT_SENDER",Y[Y.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Z=e.ResponseOfferSnapshot_Result||(e.ResponseOfferSnapshot_Result={}));function R(Y){switch(Y){case 0:case"UNKNOWN":return Z.UNKNOWN;case 1:case"ACCEPT":return Z.ACCEPT;case 2:case"ABORT":return Z.ABORT;case 3:case"REJECT":return Z.REJECT;case 4:case"REJECT_FORMAT":return Z.REJECT_FORMAT;case 5:case"REJECT_SENDER":return Z.REJECT_SENDER;case-1:case"UNRECOGNIZED":default:return Z.UNRECOGNIZED}}e.responseOfferSnapshot_ResultFromJSON=R;function M(Y){switch(Y){case Z.UNKNOWN:return"UNKNOWN";case Z.ACCEPT:return"ACCEPT";case Z.ABORT:return"ABORT";case Z.REJECT:return"REJECT";case Z.REJECT_FORMAT:return"REJECT_FORMAT";case Z.REJECT_SENDER:return"REJECT_SENDER";case Z.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.responseOfferSnapshot_ResultToJSON=M;var U;(function(Y){Y[Y.UNKNOWN=0]="UNKNOWN",Y[Y.ACCEPT=1]="ACCEPT",Y[Y.ABORT=2]="ABORT",Y[Y.RETRY=3]="RETRY",Y[Y.RETRY_SNAPSHOT=4]="RETRY_SNAPSHOT",Y[Y.REJECT_SNAPSHOT=5]="REJECT_SNAPSHOT",Y[Y.UNRECOGNIZED=-1]="UNRECOGNIZED"})(U=e.ResponseApplySnapshotChunk_Result||(e.ResponseApplySnapshotChunk_Result={}));function E(Y){switch(Y){case 0:case"UNKNOWN":return U.UNKNOWN;case 1:case"ACCEPT":return U.ACCEPT;case 2:case"ABORT":return U.ABORT;case 3:case"RETRY":return U.RETRY;case 4:case"RETRY_SNAPSHOT":return U.RETRY_SNAPSHOT;case 5:case"REJECT_SNAPSHOT":return U.REJECT_SNAPSHOT;case-1:case"UNRECOGNIZED":default:return U.UNRECOGNIZED}}e.responseApplySnapshotChunk_ResultFromJSON=E;function Q(Y){switch(Y){case U.UNKNOWN:return"UNKNOWN";case U.ACCEPT:return"ACCEPT";case U.ABORT:return"ABORT";case U.RETRY:return"RETRY";case U.RETRY_SNAPSHOT:return"RETRY_SNAPSHOT";case U.REJECT_SNAPSHOT:return"REJECT_SNAPSHOT";case U.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.responseApplySnapshotChunk_ResultToJSON=Q;var H;(function(Y){Y[Y.UNKNOWN=0]="UNKNOWN",Y[Y.ACCEPT=1]="ACCEPT",Y[Y.REJECT=2]="REJECT",Y[Y.UNRECOGNIZED=-1]="UNRECOGNIZED"})(H=e.ResponseProcessProposal_ProposalStatus||(e.ResponseProcessProposal_ProposalStatus={}));function re(Y){switch(Y){case 0:case"UNKNOWN":return H.UNKNOWN;case 1:case"ACCEPT":return H.ACCEPT;case 2:case"REJECT":return H.REJECT;case-1:case"UNRECOGNIZED":default:return H.UNRECOGNIZED}}e.responseProcessProposal_ProposalStatusFromJSON=re;function ee(Y){switch(Y){case H.UNKNOWN:return"UNKNOWN";case H.ACCEPT:return"ACCEPT";case H.REJECT:return"REJECT";case H.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.responseProcessProposal_ProposalStatusToJSON=ee;var T;(function(Y){Y[Y.UNKNOWN=0]="UNKNOWN",Y[Y.DUPLICATE_VOTE=1]="DUPLICATE_VOTE",Y[Y.LIGHT_CLIENT_ATTACK=2]="LIGHT_CLIENT_ATTACK",Y[Y.UNRECOGNIZED=-1]="UNRECOGNIZED"})(T=e.MisbehaviorType||(e.MisbehaviorType={}));function se(Y){switch(Y){case 0:case"UNKNOWN":return T.UNKNOWN;case 1:case"DUPLICATE_VOTE":return T.DUPLICATE_VOTE;case 2:case"LIGHT_CLIENT_ATTACK":return T.LIGHT_CLIENT_ATTACK;case-1:case"UNRECOGNIZED":default:return T.UNRECOGNIZED}}e.misbehaviorTypeFromJSON=se;function p(Y){switch(Y){case T.UNKNOWN:return"UNKNOWN";case T.DUPLICATE_VOTE:return"DUPLICATE_VOTE";case T.LIGHT_CLIENT_ATTACK:return"LIGHT_CLIENT_ATTACK";case T.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.misbehaviorTypeToJSON=p;function L(){return{echo:void 0,flush:void 0,info:void 0,initChain:void 0,query:void 0,beginBlock:void 0,checkTx:void 0,deliverTx:void 0,endBlock:void 0,commit:void 0,listSnapshots:void 0,offerSnapshot:void 0,loadSnapshotChunk:void 0,applySnapshotChunk:void 0,prepareProposal:void 0,processProposal:void 0}}e.Request={encode(Y,fe=j.Writer.create()){return Y.echo!==void 0&&e.RequestEcho.encode(Y.echo,fe.uint32(10).fork()).ldelim(),Y.flush!==void 0&&e.RequestFlush.encode(Y.flush,fe.uint32(18).fork()).ldelim(),Y.info!==void 0&&e.RequestInfo.encode(Y.info,fe.uint32(26).fork()).ldelim(),Y.initChain!==void 0&&e.RequestInitChain.encode(Y.initChain,fe.uint32(42).fork()).ldelim(),Y.query!==void 0&&e.RequestQuery.encode(Y.query,fe.uint32(50).fork()).ldelim(),Y.beginBlock!==void 0&&e.RequestBeginBlock.encode(Y.beginBlock,fe.uint32(58).fork()).ldelim(),Y.checkTx!==void 0&&e.RequestCheckTx.encode(Y.checkTx,fe.uint32(66).fork()).ldelim(),Y.deliverTx!==void 0&&e.RequestDeliverTx.encode(Y.deliverTx,fe.uint32(74).fork()).ldelim(),Y.endBlock!==void 0&&e.RequestEndBlock.encode(Y.endBlock,fe.uint32(82).fork()).ldelim(),Y.commit!==void 0&&e.RequestCommit.encode(Y.commit,fe.uint32(90).fork()).ldelim(),Y.listSnapshots!==void 0&&e.RequestListSnapshots.encode(Y.listSnapshots,fe.uint32(98).fork()).ldelim(),Y.offerSnapshot!==void 0&&e.RequestOfferSnapshot.encode(Y.offerSnapshot,fe.uint32(106).fork()).ldelim(),Y.loadSnapshotChunk!==void 0&&e.RequestLoadSnapshotChunk.encode(Y.loadSnapshotChunk,fe.uint32(114).fork()).ldelim(),Y.applySnapshotChunk!==void 0&&e.RequestApplySnapshotChunk.encode(Y.applySnapshotChunk,fe.uint32(122).fork()).ldelim(),Y.prepareProposal!==void 0&&e.RequestPrepareProposal.encode(Y.prepareProposal,fe.uint32(130).fork()).ldelim(),Y.processProposal!==void 0&&e.RequestProcessProposal.encode(Y.processProposal,fe.uint32(138).fork()).ldelim(),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=L();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.echo=e.RequestEcho.decode(be,be.uint32());break;case 2:ct.flush=e.RequestFlush.decode(be,be.uint32());break;case 3:ct.info=e.RequestInfo.decode(be,be.uint32());break;case 5:ct.initChain=e.RequestInitChain.decode(be,be.uint32());break;case 6:ct.query=e.RequestQuery.decode(be,be.uint32());break;case 7:ct.beginBlock=e.RequestBeginBlock.decode(be,be.uint32());break;case 8:ct.checkTx=e.RequestCheckTx.decode(be,be.uint32());break;case 9:ct.deliverTx=e.RequestDeliverTx.decode(be,be.uint32());break;case 10:ct.endBlock=e.RequestEndBlock.decode(be,be.uint32());break;case 11:ct.commit=e.RequestCommit.decode(be,be.uint32());break;case 12:ct.listSnapshots=e.RequestListSnapshots.decode(be,be.uint32());break;case 13:ct.offerSnapshot=e.RequestOfferSnapshot.decode(be,be.uint32());break;case 14:ct.loadSnapshotChunk=e.RequestLoadSnapshotChunk.decode(be,be.uint32());break;case 15:ct.applySnapshotChunk=e.RequestApplySnapshotChunk.decode(be,be.uint32());break;case 16:ct.prepareProposal=e.RequestPrepareProposal.decode(be,be.uint32());break;case 17:ct.processProposal=e.RequestProcessProposal.decode(be,be.uint32());break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{echo:(0,F.isSet)(Y.echo)?e.RequestEcho.fromJSON(Y.echo):void 0,flush:(0,F.isSet)(Y.flush)?e.RequestFlush.fromJSON(Y.flush):void 0,info:(0,F.isSet)(Y.info)?e.RequestInfo.fromJSON(Y.info):void 0,initChain:(0,F.isSet)(Y.initChain)?e.RequestInitChain.fromJSON(Y.initChain):void 0,query:(0,F.isSet)(Y.query)?e.RequestQuery.fromJSON(Y.query):void 0,beginBlock:(0,F.isSet)(Y.beginBlock)?e.RequestBeginBlock.fromJSON(Y.beginBlock):void 0,checkTx:(0,F.isSet)(Y.checkTx)?e.RequestCheckTx.fromJSON(Y.checkTx):void 0,deliverTx:(0,F.isSet)(Y.deliverTx)?e.RequestDeliverTx.fromJSON(Y.deliverTx):void 0,endBlock:(0,F.isSet)(Y.endBlock)?e.RequestEndBlock.fromJSON(Y.endBlock):void 0,commit:(0,F.isSet)(Y.commit)?e.RequestCommit.fromJSON(Y.commit):void 0,listSnapshots:(0,F.isSet)(Y.listSnapshots)?e.RequestListSnapshots.fromJSON(Y.listSnapshots):void 0,offerSnapshot:(0,F.isSet)(Y.offerSnapshot)?e.RequestOfferSnapshot.fromJSON(Y.offerSnapshot):void 0,loadSnapshotChunk:(0,F.isSet)(Y.loadSnapshotChunk)?e.RequestLoadSnapshotChunk.fromJSON(Y.loadSnapshotChunk):void 0,applySnapshotChunk:(0,F.isSet)(Y.applySnapshotChunk)?e.RequestApplySnapshotChunk.fromJSON(Y.applySnapshotChunk):void 0,prepareProposal:(0,F.isSet)(Y.prepareProposal)?e.RequestPrepareProposal.fromJSON(Y.prepareProposal):void 0,processProposal:(0,F.isSet)(Y.processProposal)?e.RequestProcessProposal.fromJSON(Y.processProposal):void 0}},toJSON(Y){let fe={};return Y.echo!==void 0&&(fe.echo=Y.echo?e.RequestEcho.toJSON(Y.echo):void 0),Y.flush!==void 0&&(fe.flush=Y.flush?e.RequestFlush.toJSON(Y.flush):void 0),Y.info!==void 0&&(fe.info=Y.info?e.RequestInfo.toJSON(Y.info):void 0),Y.initChain!==void 0&&(fe.initChain=Y.initChain?e.RequestInitChain.toJSON(Y.initChain):void 0),Y.query!==void 0&&(fe.query=Y.query?e.RequestQuery.toJSON(Y.query):void 0),Y.beginBlock!==void 0&&(fe.beginBlock=Y.beginBlock?e.RequestBeginBlock.toJSON(Y.beginBlock):void 0),Y.checkTx!==void 0&&(fe.checkTx=Y.checkTx?e.RequestCheckTx.toJSON(Y.checkTx):void 0),Y.deliverTx!==void 0&&(fe.deliverTx=Y.deliverTx?e.RequestDeliverTx.toJSON(Y.deliverTx):void 0),Y.endBlock!==void 0&&(fe.endBlock=Y.endBlock?e.RequestEndBlock.toJSON(Y.endBlock):void 0),Y.commit!==void 0&&(fe.commit=Y.commit?e.RequestCommit.toJSON(Y.commit):void 0),Y.listSnapshots!==void 0&&(fe.listSnapshots=Y.listSnapshots?e.RequestListSnapshots.toJSON(Y.listSnapshots):void 0),Y.offerSnapshot!==void 0&&(fe.offerSnapshot=Y.offerSnapshot?e.RequestOfferSnapshot.toJSON(Y.offerSnapshot):void 0),Y.loadSnapshotChunk!==void 0&&(fe.loadSnapshotChunk=Y.loadSnapshotChunk?e.RequestLoadSnapshotChunk.toJSON(Y.loadSnapshotChunk):void 0),Y.applySnapshotChunk!==void 0&&(fe.applySnapshotChunk=Y.applySnapshotChunk?e.RequestApplySnapshotChunk.toJSON(Y.applySnapshotChunk):void 0),Y.prepareProposal!==void 0&&(fe.prepareProposal=Y.prepareProposal?e.RequestPrepareProposal.toJSON(Y.prepareProposal):void 0),Y.processProposal!==void 0&&(fe.processProposal=Y.processProposal?e.RequestProcessProposal.toJSON(Y.processProposal):void 0),fe},fromPartial(Y){let fe=L();return fe.echo=Y.echo!==void 0&&Y.echo!==null?e.RequestEcho.fromPartial(Y.echo):void 0,fe.flush=Y.flush!==void 0&&Y.flush!==null?e.RequestFlush.fromPartial(Y.flush):void 0,fe.info=Y.info!==void 0&&Y.info!==null?e.RequestInfo.fromPartial(Y.info):void 0,fe.initChain=Y.initChain!==void 0&&Y.initChain!==null?e.RequestInitChain.fromPartial(Y.initChain):void 0,fe.query=Y.query!==void 0&&Y.query!==null?e.RequestQuery.fromPartial(Y.query):void 0,fe.beginBlock=Y.beginBlock!==void 0&&Y.beginBlock!==null?e.RequestBeginBlock.fromPartial(Y.beginBlock):void 0,fe.checkTx=Y.checkTx!==void 0&&Y.checkTx!==null?e.RequestCheckTx.fromPartial(Y.checkTx):void 0,fe.deliverTx=Y.deliverTx!==void 0&&Y.deliverTx!==null?e.RequestDeliverTx.fromPartial(Y.deliverTx):void 0,fe.endBlock=Y.endBlock!==void 0&&Y.endBlock!==null?e.RequestEndBlock.fromPartial(Y.endBlock):void 0,fe.commit=Y.commit!==void 0&&Y.commit!==null?e.RequestCommit.fromPartial(Y.commit):void 0,fe.listSnapshots=Y.listSnapshots!==void 0&&Y.listSnapshots!==null?e.RequestListSnapshots.fromPartial(Y.listSnapshots):void 0,fe.offerSnapshot=Y.offerSnapshot!==void 0&&Y.offerSnapshot!==null?e.RequestOfferSnapshot.fromPartial(Y.offerSnapshot):void 0,fe.loadSnapshotChunk=Y.loadSnapshotChunk!==void 0&&Y.loadSnapshotChunk!==null?e.RequestLoadSnapshotChunk.fromPartial(Y.loadSnapshotChunk):void 0,fe.applySnapshotChunk=Y.applySnapshotChunk!==void 0&&Y.applySnapshotChunk!==null?e.RequestApplySnapshotChunk.fromPartial(Y.applySnapshotChunk):void 0,fe.prepareProposal=Y.prepareProposal!==void 0&&Y.prepareProposal!==null?e.RequestPrepareProposal.fromPartial(Y.prepareProposal):void 0,fe.processProposal=Y.processProposal!==void 0&&Y.processProposal!==null?e.RequestProcessProposal.fromPartial(Y.processProposal):void 0,fe}};function V(){return{message:""}}e.RequestEcho={encode(Y,fe=j.Writer.create()){return Y.message!==""&&fe.uint32(10).string(Y.message),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=V();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.message=be.string();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{message:(0,F.isSet)(Y.message)?String(Y.message):""}},toJSON(Y){let fe={};return Y.message!==void 0&&(fe.message=Y.message),fe},fromPartial(Y){var be;let fe=V();return fe.message=(be=Y.message)!=null?be:"",fe}};function K(){return{}}e.RequestFlush={encode(Y,fe=j.Writer.create()){return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=K();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{}},toJSON(Y){return{}},fromPartial(Y){return K()}};function m(){return{version:"",blockVersion:F.Long.UZERO,p2pVersion:F.Long.UZERO,abciVersion:""}}e.RequestInfo={encode(Y,fe=j.Writer.create()){return Y.version!==""&&fe.uint32(10).string(Y.version),Y.blockVersion.isZero()||fe.uint32(16).uint64(Y.blockVersion),Y.p2pVersion.isZero()||fe.uint32(24).uint64(Y.p2pVersion),Y.abciVersion!==""&&fe.uint32(34).string(Y.abciVersion),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=m();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.version=be.string();break;case 2:ct.blockVersion=be.uint64();break;case 3:ct.p2pVersion=be.uint64();break;case 4:ct.abciVersion=be.string();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{version:(0,F.isSet)(Y.version)?String(Y.version):"",blockVersion:(0,F.isSet)(Y.blockVersion)?F.Long.fromValue(Y.blockVersion):F.Long.UZERO,p2pVersion:(0,F.isSet)(Y.p2pVersion)?F.Long.fromValue(Y.p2pVersion):F.Long.UZERO,abciVersion:(0,F.isSet)(Y.abciVersion)?String(Y.abciVersion):""}},toJSON(Y){let fe={};return Y.version!==void 0&&(fe.version=Y.version),Y.blockVersion!==void 0&&(fe.blockVersion=(Y.blockVersion||F.Long.UZERO).toString()),Y.p2pVersion!==void 0&&(fe.p2pVersion=(Y.p2pVersion||F.Long.UZERO).toString()),Y.abciVersion!==void 0&&(fe.abciVersion=Y.abciVersion),fe},fromPartial(Y){var be,qt;let fe=m();return fe.version=(be=Y.version)!=null?be:"",fe.blockVersion=Y.blockVersion!==void 0&&Y.blockVersion!==null?F.Long.fromValue(Y.blockVersion):F.Long.UZERO,fe.p2pVersion=Y.p2pVersion!==void 0&&Y.p2pVersion!==null?F.Long.fromValue(Y.p2pVersion):F.Long.UZERO,fe.abciVersion=(qt=Y.abciVersion)!=null?qt:"",fe}};function h(){return{time:void 0,chainId:"",consensusParams:void 0,validators:[],appStateBytes:new Uint8Array,initialHeight:F.Long.ZERO}}e.RequestInitChain={encode(Y,fe=j.Writer.create()){Y.time!==void 0&&f.Timestamp.encode(Y.time,fe.uint32(10).fork()).ldelim(),Y.chainId!==""&&fe.uint32(18).string(Y.chainId),Y.consensusParams!==void 0&&l.ConsensusParams.encode(Y.consensusParams,fe.uint32(26).fork()).ldelim();for(let be of Y.validators)e.ValidatorUpdate.encode(be,fe.uint32(34).fork()).ldelim();return Y.appStateBytes.length!==0&&fe.uint32(42).bytes(Y.appStateBytes),Y.initialHeight.isZero()||fe.uint32(48).int64(Y.initialHeight),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=h();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.time=f.Timestamp.decode(be,be.uint32());break;case 2:ct.chainId=be.string();break;case 3:ct.consensusParams=l.ConsensusParams.decode(be,be.uint32());break;case 4:ct.validators.push(e.ValidatorUpdate.decode(be,be.uint32()));break;case 5:ct.appStateBytes=be.bytes();break;case 6:ct.initialHeight=be.int64();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{time:(0,F.isSet)(Y.time)?(0,F.fromJsonTimestamp)(Y.time):void 0,chainId:(0,F.isSet)(Y.chainId)?String(Y.chainId):"",consensusParams:(0,F.isSet)(Y.consensusParams)?l.ConsensusParams.fromJSON(Y.consensusParams):void 0,validators:Array.isArray(Y==null?void 0:Y.validators)?Y.validators.map(fe=>e.ValidatorUpdate.fromJSON(fe)):[],appStateBytes:(0,F.isSet)(Y.appStateBytes)?(0,F.bytesFromBase64)(Y.appStateBytes):new Uint8Array,initialHeight:(0,F.isSet)(Y.initialHeight)?F.Long.fromValue(Y.initialHeight):F.Long.ZERO}},toJSON(Y){let fe={};return Y.time!==void 0&&(fe.time=(0,F.fromTimestamp)(Y.time).toISOString()),Y.chainId!==void 0&&(fe.chainId=Y.chainId),Y.consensusParams!==void 0&&(fe.consensusParams=Y.consensusParams?l.ConsensusParams.toJSON(Y.consensusParams):void 0),Y.validators?fe.validators=Y.validators.map(be=>be?e.ValidatorUpdate.toJSON(be):void 0):fe.validators=[],Y.appStateBytes!==void 0&&(fe.appStateBytes=(0,F.base64FromBytes)(Y.appStateBytes!==void 0?Y.appStateBytes:new Uint8Array)),Y.initialHeight!==void 0&&(fe.initialHeight=(Y.initialHeight||F.Long.ZERO).toString()),fe},fromPartial(Y){var be,qt,ct;let fe=h();return fe.time=Y.time!==void 0&&Y.time!==null?f.Timestamp.fromPartial(Y.time):void 0,fe.chainId=(be=Y.chainId)!=null?be:"",fe.consensusParams=Y.consensusParams!==void 0&&Y.consensusParams!==null?l.ConsensusParams.fromPartial(Y.consensusParams):void 0,fe.validators=((qt=Y.validators)==null?void 0:qt.map(Ft=>e.ValidatorUpdate.fromPartial(Ft)))||[],fe.appStateBytes=(ct=Y.appStateBytes)!=null?ct:new Uint8Array,fe.initialHeight=Y.initialHeight!==void 0&&Y.initialHeight!==null?F.Long.fromValue(Y.initialHeight):F.Long.ZERO,fe}};function _(){return{data:new Uint8Array,path:"",height:F.Long.ZERO,prove:!1}}e.RequestQuery={encode(Y,fe=j.Writer.create()){return Y.data.length!==0&&fe.uint32(10).bytes(Y.data),Y.path!==""&&fe.uint32(18).string(Y.path),Y.height.isZero()||fe.uint32(24).int64(Y.height),Y.prove===!0&&fe.uint32(32).bool(Y.prove),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=_();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.data=be.bytes();break;case 2:ct.path=be.string();break;case 3:ct.height=be.int64();break;case 4:ct.prove=be.bool();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{data:(0,F.isSet)(Y.data)?(0,F.bytesFromBase64)(Y.data):new Uint8Array,path:(0,F.isSet)(Y.path)?String(Y.path):"",height:(0,F.isSet)(Y.height)?F.Long.fromValue(Y.height):F.Long.ZERO,prove:(0,F.isSet)(Y.prove)?!!Y.prove:!1}},toJSON(Y){let fe={};return Y.data!==void 0&&(fe.data=(0,F.base64FromBytes)(Y.data!==void 0?Y.data:new Uint8Array)),Y.path!==void 0&&(fe.path=Y.path),Y.height!==void 0&&(fe.height=(Y.height||F.Long.ZERO).toString()),Y.prove!==void 0&&(fe.prove=Y.prove),fe},fromPartial(Y){var be,qt,ct;let fe=_();return fe.data=(be=Y.data)!=null?be:new Uint8Array,fe.path=(qt=Y.path)!=null?qt:"",fe.height=Y.height!==void 0&&Y.height!==null?F.Long.fromValue(Y.height):F.Long.ZERO,fe.prove=(ct=Y.prove)!=null?ct:!1,fe}};function b(){return{hash:new Uint8Array,header:void 0,lastCommitInfo:void 0,byzantineValidators:[]}}e.RequestBeginBlock={encode(Y,fe=j.Writer.create()){Y.hash.length!==0&&fe.uint32(10).bytes(Y.hash),Y.header!==void 0&&g.Header.encode(Y.header,fe.uint32(18).fork()).ldelim(),Y.lastCommitInfo!==void 0&&e.CommitInfo.encode(Y.lastCommitInfo,fe.uint32(26).fork()).ldelim();for(let be of Y.byzantineValidators)e.Misbehavior.encode(be,fe.uint32(34).fork()).ldelim();return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=b();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.hash=be.bytes();break;case 2:ct.header=g.Header.decode(be,be.uint32());break;case 3:ct.lastCommitInfo=e.CommitInfo.decode(be,be.uint32());break;case 4:ct.byzantineValidators.push(e.Misbehavior.decode(be,be.uint32()));break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{hash:(0,F.isSet)(Y.hash)?(0,F.bytesFromBase64)(Y.hash):new Uint8Array,header:(0,F.isSet)(Y.header)?g.Header.fromJSON(Y.header):void 0,lastCommitInfo:(0,F.isSet)(Y.lastCommitInfo)?e.CommitInfo.fromJSON(Y.lastCommitInfo):void 0,byzantineValidators:Array.isArray(Y==null?void 0:Y.byzantineValidators)?Y.byzantineValidators.map(fe=>e.Misbehavior.fromJSON(fe)):[]}},toJSON(Y){let fe={};return Y.hash!==void 0&&(fe.hash=(0,F.base64FromBytes)(Y.hash!==void 0?Y.hash:new Uint8Array)),Y.header!==void 0&&(fe.header=Y.header?g.Header.toJSON(Y.header):void 0),Y.lastCommitInfo!==void 0&&(fe.lastCommitInfo=Y.lastCommitInfo?e.CommitInfo.toJSON(Y.lastCommitInfo):void 0),Y.byzantineValidators?fe.byzantineValidators=Y.byzantineValidators.map(be=>be?e.Misbehavior.toJSON(be):void 0):fe.byzantineValidators=[],fe},fromPartial(Y){var be,qt;let fe=b();return fe.hash=(be=Y.hash)!=null?be:new Uint8Array,fe.header=Y.header!==void 0&&Y.header!==null?g.Header.fromPartial(Y.header):void 0,fe.lastCommitInfo=Y.lastCommitInfo!==void 0&&Y.lastCommitInfo!==null?e.CommitInfo.fromPartial(Y.lastCommitInfo):void 0,fe.byzantineValidators=((qt=Y.byzantineValidators)==null?void 0:qt.map(ct=>e.Misbehavior.fromPartial(ct)))||[],fe}};function O(){return{tx:new Uint8Array,type:0}}e.RequestCheckTx={encode(Y,fe=j.Writer.create()){return Y.tx.length!==0&&fe.uint32(10).bytes(Y.tx),Y.type!==0&&fe.uint32(16).int32(Y.type),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=O();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.tx=be.bytes();break;case 2:ct.type=be.int32();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{tx:(0,F.isSet)(Y.tx)?(0,F.bytesFromBase64)(Y.tx):new Uint8Array,type:(0,F.isSet)(Y.type)?v(Y.type):0}},toJSON(Y){let fe={};return Y.tx!==void 0&&(fe.tx=(0,F.base64FromBytes)(Y.tx!==void 0?Y.tx:new Uint8Array)),Y.type!==void 0&&(fe.type=ne(Y.type)),fe},fromPartial(Y){var be,qt;let fe=O();return fe.tx=(be=Y.tx)!=null?be:new Uint8Array,fe.type=(qt=Y.type)!=null?qt:0,fe}};function J(){return{tx:new Uint8Array}}e.RequestDeliverTx={encode(Y,fe=j.Writer.create()){return Y.tx.length!==0&&fe.uint32(10).bytes(Y.tx),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=J();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.tx=be.bytes();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{tx:(0,F.isSet)(Y.tx)?(0,F.bytesFromBase64)(Y.tx):new Uint8Array}},toJSON(Y){let fe={};return Y.tx!==void 0&&(fe.tx=(0,F.base64FromBytes)(Y.tx!==void 0?Y.tx:new Uint8Array)),fe},fromPartial(Y){var be;let fe=J();return fe.tx=(be=Y.tx)!=null?be:new Uint8Array,fe}};function ie(){return{height:F.Long.ZERO}}e.RequestEndBlock={encode(Y,fe=j.Writer.create()){return Y.height.isZero()||fe.uint32(8).int64(Y.height),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=ie();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.height=be.int64();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{height:(0,F.isSet)(Y.height)?F.Long.fromValue(Y.height):F.Long.ZERO}},toJSON(Y){let fe={};return Y.height!==void 0&&(fe.height=(Y.height||F.Long.ZERO).toString()),fe},fromPartial(Y){let fe=ie();return fe.height=Y.height!==void 0&&Y.height!==null?F.Long.fromValue(Y.height):F.Long.ZERO,fe}};function G(){return{}}e.RequestCommit={encode(Y,fe=j.Writer.create()){return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=G();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{}},toJSON(Y){return{}},fromPartial(Y){return G()}};function I(){return{}}e.RequestListSnapshots={encode(Y,fe=j.Writer.create()){return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=I();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{}},toJSON(Y){return{}},fromPartial(Y){return I()}};function C(){return{snapshot:void 0,appHash:new Uint8Array}}e.RequestOfferSnapshot={encode(Y,fe=j.Writer.create()){return Y.snapshot!==void 0&&e.Snapshot.encode(Y.snapshot,fe.uint32(10).fork()).ldelim(),Y.appHash.length!==0&&fe.uint32(18).bytes(Y.appHash),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=C();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.snapshot=e.Snapshot.decode(be,be.uint32());break;case 2:ct.appHash=be.bytes();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{snapshot:(0,F.isSet)(Y.snapshot)?e.Snapshot.fromJSON(Y.snapshot):void 0,appHash:(0,F.isSet)(Y.appHash)?(0,F.bytesFromBase64)(Y.appHash):new Uint8Array}},toJSON(Y){let fe={};return Y.snapshot!==void 0&&(fe.snapshot=Y.snapshot?e.Snapshot.toJSON(Y.snapshot):void 0),Y.appHash!==void 0&&(fe.appHash=(0,F.base64FromBytes)(Y.appHash!==void 0?Y.appHash:new Uint8Array)),fe},fromPartial(Y){var be;let fe=C();return fe.snapshot=Y.snapshot!==void 0&&Y.snapshot!==null?e.Snapshot.fromPartial(Y.snapshot):void 0,fe.appHash=(be=Y.appHash)!=null?be:new Uint8Array,fe}};function D(){return{height:F.Long.UZERO,format:0,chunk:0}}e.RequestLoadSnapshotChunk={encode(Y,fe=j.Writer.create()){return Y.height.isZero()||fe.uint32(8).uint64(Y.height),Y.format!==0&&fe.uint32(16).uint32(Y.format),Y.chunk!==0&&fe.uint32(24).uint32(Y.chunk),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=D();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.height=be.uint64();break;case 2:ct.format=be.uint32();break;case 3:ct.chunk=be.uint32();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{height:(0,F.isSet)(Y.height)?F.Long.fromValue(Y.height):F.Long.UZERO,format:(0,F.isSet)(Y.format)?Number(Y.format):0,chunk:(0,F.isSet)(Y.chunk)?Number(Y.chunk):0}},toJSON(Y){let fe={};return Y.height!==void 0&&(fe.height=(Y.height||F.Long.UZERO).toString()),Y.format!==void 0&&(fe.format=Math.round(Y.format)),Y.chunk!==void 0&&(fe.chunk=Math.round(Y.chunk)),fe},fromPartial(Y){var be,qt;let fe=D();return fe.height=Y.height!==void 0&&Y.height!==null?F.Long.fromValue(Y.height):F.Long.UZERO,fe.format=(be=Y.format)!=null?be:0,fe.chunk=(qt=Y.chunk)!=null?qt:0,fe}};function W(){return{index:0,chunk:new Uint8Array,sender:""}}e.RequestApplySnapshotChunk={encode(Y,fe=j.Writer.create()){return Y.index!==0&&fe.uint32(8).uint32(Y.index),Y.chunk.length!==0&&fe.uint32(18).bytes(Y.chunk),Y.sender!==""&&fe.uint32(26).string(Y.sender),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=W();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.index=be.uint32();break;case 2:ct.chunk=be.bytes();break;case 3:ct.sender=be.string();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{index:(0,F.isSet)(Y.index)?Number(Y.index):0,chunk:(0,F.isSet)(Y.chunk)?(0,F.bytesFromBase64)(Y.chunk):new Uint8Array,sender:(0,F.isSet)(Y.sender)?String(Y.sender):""}},toJSON(Y){let fe={};return Y.index!==void 0&&(fe.index=Math.round(Y.index)),Y.chunk!==void 0&&(fe.chunk=(0,F.base64FromBytes)(Y.chunk!==void 0?Y.chunk:new Uint8Array)),Y.sender!==void 0&&(fe.sender=Y.sender),fe},fromPartial(Y){var be,qt,ct;let fe=W();return fe.index=(be=Y.index)!=null?be:0,fe.chunk=(qt=Y.chunk)!=null?qt:new Uint8Array,fe.sender=(ct=Y.sender)!=null?ct:"",fe}};function ae(){return{maxTxBytes:F.Long.ZERO,txs:[],localLastCommit:void 0,misbehavior:[],height:F.Long.ZERO,time:void 0,nextValidatorsHash:new Uint8Array,proposerAddress:new Uint8Array}}e.RequestPrepareProposal={encode(Y,fe=j.Writer.create()){Y.maxTxBytes.isZero()||fe.uint32(8).int64(Y.maxTxBytes);for(let be of Y.txs)fe.uint32(18).bytes(be);Y.localLastCommit!==void 0&&e.ExtendedCommitInfo.encode(Y.localLastCommit,fe.uint32(26).fork()).ldelim();for(let be of Y.misbehavior)e.Misbehavior.encode(be,fe.uint32(34).fork()).ldelim();return Y.height.isZero()||fe.uint32(40).int64(Y.height),Y.time!==void 0&&f.Timestamp.encode(Y.time,fe.uint32(50).fork()).ldelim(),Y.nextValidatorsHash.length!==0&&fe.uint32(58).bytes(Y.nextValidatorsHash),Y.proposerAddress.length!==0&&fe.uint32(66).bytes(Y.proposerAddress),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=ae();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.maxTxBytes=be.int64();break;case 2:ct.txs.push(be.bytes());break;case 3:ct.localLastCommit=e.ExtendedCommitInfo.decode(be,be.uint32());break;case 4:ct.misbehavior.push(e.Misbehavior.decode(be,be.uint32()));break;case 5:ct.height=be.int64();break;case 6:ct.time=f.Timestamp.decode(be,be.uint32());break;case 7:ct.nextValidatorsHash=be.bytes();break;case 8:ct.proposerAddress=be.bytes();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{maxTxBytes:(0,F.isSet)(Y.maxTxBytes)?F.Long.fromValue(Y.maxTxBytes):F.Long.ZERO,txs:Array.isArray(Y==null?void 0:Y.txs)?Y.txs.map(fe=>(0,F.bytesFromBase64)(fe)):[],localLastCommit:(0,F.isSet)(Y.localLastCommit)?e.ExtendedCommitInfo.fromJSON(Y.localLastCommit):void 0,misbehavior:Array.isArray(Y==null?void 0:Y.misbehavior)?Y.misbehavior.map(fe=>e.Misbehavior.fromJSON(fe)):[],height:(0,F.isSet)(Y.height)?F.Long.fromValue(Y.height):F.Long.ZERO,time:(0,F.isSet)(Y.time)?(0,F.fromJsonTimestamp)(Y.time):void 0,nextValidatorsHash:(0,F.isSet)(Y.nextValidatorsHash)?(0,F.bytesFromBase64)(Y.nextValidatorsHash):new Uint8Array,proposerAddress:(0,F.isSet)(Y.proposerAddress)?(0,F.bytesFromBase64)(Y.proposerAddress):new Uint8Array}},toJSON(Y){let fe={};return Y.maxTxBytes!==void 0&&(fe.maxTxBytes=(Y.maxTxBytes||F.Long.ZERO).toString()),Y.txs?fe.txs=Y.txs.map(be=>(0,F.base64FromBytes)(be!==void 0?be:new Uint8Array)):fe.txs=[],Y.localLastCommit!==void 0&&(fe.localLastCommit=Y.localLastCommit?e.ExtendedCommitInfo.toJSON(Y.localLastCommit):void 0),Y.misbehavior?fe.misbehavior=Y.misbehavior.map(be=>be?e.Misbehavior.toJSON(be):void 0):fe.misbehavior=[],Y.height!==void 0&&(fe.height=(Y.height||F.Long.ZERO).toString()),Y.time!==void 0&&(fe.time=(0,F.fromTimestamp)(Y.time).toISOString()),Y.nextValidatorsHash!==void 0&&(fe.nextValidatorsHash=(0,F.base64FromBytes)(Y.nextValidatorsHash!==void 0?Y.nextValidatorsHash:new Uint8Array)),Y.proposerAddress!==void 0&&(fe.proposerAddress=(0,F.base64FromBytes)(Y.proposerAddress!==void 0?Y.proposerAddress:new Uint8Array)),fe},fromPartial(Y){var be,qt,ct,Ft;let fe=ae();return fe.maxTxBytes=Y.maxTxBytes!==void 0&&Y.maxTxBytes!==null?F.Long.fromValue(Y.maxTxBytes):F.Long.ZERO,fe.txs=((be=Y.txs)==null?void 0:be.map(vr=>vr))||[],fe.localLastCommit=Y.localLastCommit!==void 0&&Y.localLastCommit!==null?e.ExtendedCommitInfo.fromPartial(Y.localLastCommit):void 0,fe.misbehavior=((qt=Y.misbehavior)==null?void 0:qt.map(vr=>e.Misbehavior.fromPartial(vr)))||[],fe.height=Y.height!==void 0&&Y.height!==null?F.Long.fromValue(Y.height):F.Long.ZERO,fe.time=Y.time!==void 0&&Y.time!==null?f.Timestamp.fromPartial(Y.time):void 0,fe.nextValidatorsHash=(ct=Y.nextValidatorsHash)!=null?ct:new Uint8Array,fe.proposerAddress=(Ft=Y.proposerAddress)!=null?Ft:new Uint8Array,fe}};function ye(){return{txs:[],proposedLastCommit:void 0,misbehavior:[],hash:new Uint8Array,height:F.Long.ZERO,time:void 0,nextValidatorsHash:new Uint8Array,proposerAddress:new Uint8Array}}e.RequestProcessProposal={encode(Y,fe=j.Writer.create()){for(let be of Y.txs)fe.uint32(10).bytes(be);Y.proposedLastCommit!==void 0&&e.CommitInfo.encode(Y.proposedLastCommit,fe.uint32(18).fork()).ldelim();for(let be of Y.misbehavior)e.Misbehavior.encode(be,fe.uint32(26).fork()).ldelim();return Y.hash.length!==0&&fe.uint32(34).bytes(Y.hash),Y.height.isZero()||fe.uint32(40).int64(Y.height),Y.time!==void 0&&f.Timestamp.encode(Y.time,fe.uint32(50).fork()).ldelim(),Y.nextValidatorsHash.length!==0&&fe.uint32(58).bytes(Y.nextValidatorsHash),Y.proposerAddress.length!==0&&fe.uint32(66).bytes(Y.proposerAddress),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=ye();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.txs.push(be.bytes());break;case 2:ct.proposedLastCommit=e.CommitInfo.decode(be,be.uint32());break;case 3:ct.misbehavior.push(e.Misbehavior.decode(be,be.uint32()));break;case 4:ct.hash=be.bytes();break;case 5:ct.height=be.int64();break;case 6:ct.time=f.Timestamp.decode(be,be.uint32());break;case 7:ct.nextValidatorsHash=be.bytes();break;case 8:ct.proposerAddress=be.bytes();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{txs:Array.isArray(Y==null?void 0:Y.txs)?Y.txs.map(fe=>(0,F.bytesFromBase64)(fe)):[],proposedLastCommit:(0,F.isSet)(Y.proposedLastCommit)?e.CommitInfo.fromJSON(Y.proposedLastCommit):void 0,misbehavior:Array.isArray(Y==null?void 0:Y.misbehavior)?Y.misbehavior.map(fe=>e.Misbehavior.fromJSON(fe)):[],hash:(0,F.isSet)(Y.hash)?(0,F.bytesFromBase64)(Y.hash):new Uint8Array,height:(0,F.isSet)(Y.height)?F.Long.fromValue(Y.height):F.Long.ZERO,time:(0,F.isSet)(Y.time)?(0,F.fromJsonTimestamp)(Y.time):void 0,nextValidatorsHash:(0,F.isSet)(Y.nextValidatorsHash)?(0,F.bytesFromBase64)(Y.nextValidatorsHash):new Uint8Array,proposerAddress:(0,F.isSet)(Y.proposerAddress)?(0,F.bytesFromBase64)(Y.proposerAddress):new Uint8Array}},toJSON(Y){let fe={};return Y.txs?fe.txs=Y.txs.map(be=>(0,F.base64FromBytes)(be!==void 0?be:new Uint8Array)):fe.txs=[],Y.proposedLastCommit!==void 0&&(fe.proposedLastCommit=Y.proposedLastCommit?e.CommitInfo.toJSON(Y.proposedLastCommit):void 0),Y.misbehavior?fe.misbehavior=Y.misbehavior.map(be=>be?e.Misbehavior.toJSON(be):void 0):fe.misbehavior=[],Y.hash!==void 0&&(fe.hash=(0,F.base64FromBytes)(Y.hash!==void 0?Y.hash:new Uint8Array)),Y.height!==void 0&&(fe.height=(Y.height||F.Long.ZERO).toString()),Y.time!==void 0&&(fe.time=(0,F.fromTimestamp)(Y.time).toISOString()),Y.nextValidatorsHash!==void 0&&(fe.nextValidatorsHash=(0,F.base64FromBytes)(Y.nextValidatorsHash!==void 0?Y.nextValidatorsHash:new Uint8Array)),Y.proposerAddress!==void 0&&(fe.proposerAddress=(0,F.base64FromBytes)(Y.proposerAddress!==void 0?Y.proposerAddress:new Uint8Array)),fe},fromPartial(Y){var be,qt,ct,Ft,vr;let fe=ye();return fe.txs=((be=Y.txs)==null?void 0:be.map($n=>$n))||[],fe.proposedLastCommit=Y.proposedLastCommit!==void 0&&Y.proposedLastCommit!==null?e.CommitInfo.fromPartial(Y.proposedLastCommit):void 0,fe.misbehavior=((qt=Y.misbehavior)==null?void 0:qt.map($n=>e.Misbehavior.fromPartial($n)))||[],fe.hash=(ct=Y.hash)!=null?ct:new Uint8Array,fe.height=Y.height!==void 0&&Y.height!==null?F.Long.fromValue(Y.height):F.Long.ZERO,fe.time=Y.time!==void 0&&Y.time!==null?f.Timestamp.fromPartial(Y.time):void 0,fe.nextValidatorsHash=(Ft=Y.nextValidatorsHash)!=null?Ft:new Uint8Array,fe.proposerAddress=(vr=Y.proposerAddress)!=null?vr:new Uint8Array,fe}};function Xe(){return{exception:void 0,echo:void 0,flush:void 0,info:void 0,initChain:void 0,query:void 0,beginBlock:void 0,checkTx:void 0,deliverTx:void 0,endBlock:void 0,commit:void 0,listSnapshots:void 0,offerSnapshot:void 0,loadSnapshotChunk:void 0,applySnapshotChunk:void 0,prepareProposal:void 0,processProposal:void 0}}e.Response={encode(Y,fe=j.Writer.create()){return Y.exception!==void 0&&e.ResponseException.encode(Y.exception,fe.uint32(10).fork()).ldelim(),Y.echo!==void 0&&e.ResponseEcho.encode(Y.echo,fe.uint32(18).fork()).ldelim(),Y.flush!==void 0&&e.ResponseFlush.encode(Y.flush,fe.uint32(26).fork()).ldelim(),Y.info!==void 0&&e.ResponseInfo.encode(Y.info,fe.uint32(34).fork()).ldelim(),Y.initChain!==void 0&&e.ResponseInitChain.encode(Y.initChain,fe.uint32(50).fork()).ldelim(),Y.query!==void 0&&e.ResponseQuery.encode(Y.query,fe.uint32(58).fork()).ldelim(),Y.beginBlock!==void 0&&e.ResponseBeginBlock.encode(Y.beginBlock,fe.uint32(66).fork()).ldelim(),Y.checkTx!==void 0&&e.ResponseCheckTx.encode(Y.checkTx,fe.uint32(74).fork()).ldelim(),Y.deliverTx!==void 0&&e.ResponseDeliverTx.encode(Y.deliverTx,fe.uint32(82).fork()).ldelim(),Y.endBlock!==void 0&&e.ResponseEndBlock.encode(Y.endBlock,fe.uint32(90).fork()).ldelim(),Y.commit!==void 0&&e.ResponseCommit.encode(Y.commit,fe.uint32(98).fork()).ldelim(),Y.listSnapshots!==void 0&&e.ResponseListSnapshots.encode(Y.listSnapshots,fe.uint32(106).fork()).ldelim(),Y.offerSnapshot!==void 0&&e.ResponseOfferSnapshot.encode(Y.offerSnapshot,fe.uint32(114).fork()).ldelim(),Y.loadSnapshotChunk!==void 0&&e.ResponseLoadSnapshotChunk.encode(Y.loadSnapshotChunk,fe.uint32(122).fork()).ldelim(),Y.applySnapshotChunk!==void 0&&e.ResponseApplySnapshotChunk.encode(Y.applySnapshotChunk,fe.uint32(130).fork()).ldelim(),Y.prepareProposal!==void 0&&e.ResponsePrepareProposal.encode(Y.prepareProposal,fe.uint32(138).fork()).ldelim(),Y.processProposal!==void 0&&e.ResponseProcessProposal.encode(Y.processProposal,fe.uint32(146).fork()).ldelim(),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Xe();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.exception=e.ResponseException.decode(be,be.uint32());break;case 2:ct.echo=e.ResponseEcho.decode(be,be.uint32());break;case 3:ct.flush=e.ResponseFlush.decode(be,be.uint32());break;case 4:ct.info=e.ResponseInfo.decode(be,be.uint32());break;case 6:ct.initChain=e.ResponseInitChain.decode(be,be.uint32());break;case 7:ct.query=e.ResponseQuery.decode(be,be.uint32());break;case 8:ct.beginBlock=e.ResponseBeginBlock.decode(be,be.uint32());break;case 9:ct.checkTx=e.ResponseCheckTx.decode(be,be.uint32());break;case 10:ct.deliverTx=e.ResponseDeliverTx.decode(be,be.uint32());break;case 11:ct.endBlock=e.ResponseEndBlock.decode(be,be.uint32());break;case 12:ct.commit=e.ResponseCommit.decode(be,be.uint32());break;case 13:ct.listSnapshots=e.ResponseListSnapshots.decode(be,be.uint32());break;case 14:ct.offerSnapshot=e.ResponseOfferSnapshot.decode(be,be.uint32());break;case 15:ct.loadSnapshotChunk=e.ResponseLoadSnapshotChunk.decode(be,be.uint32());break;case 16:ct.applySnapshotChunk=e.ResponseApplySnapshotChunk.decode(be,be.uint32());break;case 17:ct.prepareProposal=e.ResponsePrepareProposal.decode(be,be.uint32());break;case 18:ct.processProposal=e.ResponseProcessProposal.decode(be,be.uint32());break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{exception:(0,F.isSet)(Y.exception)?e.ResponseException.fromJSON(Y.exception):void 0,echo:(0,F.isSet)(Y.echo)?e.ResponseEcho.fromJSON(Y.echo):void 0,flush:(0,F.isSet)(Y.flush)?e.ResponseFlush.fromJSON(Y.flush):void 0,info:(0,F.isSet)(Y.info)?e.ResponseInfo.fromJSON(Y.info):void 0,initChain:(0,F.isSet)(Y.initChain)?e.ResponseInitChain.fromJSON(Y.initChain):void 0,query:(0,F.isSet)(Y.query)?e.ResponseQuery.fromJSON(Y.query):void 0,beginBlock:(0,F.isSet)(Y.beginBlock)?e.ResponseBeginBlock.fromJSON(Y.beginBlock):void 0,checkTx:(0,F.isSet)(Y.checkTx)?e.ResponseCheckTx.fromJSON(Y.checkTx):void 0,deliverTx:(0,F.isSet)(Y.deliverTx)?e.ResponseDeliverTx.fromJSON(Y.deliverTx):void 0,endBlock:(0,F.isSet)(Y.endBlock)?e.ResponseEndBlock.fromJSON(Y.endBlock):void 0,commit:(0,F.isSet)(Y.commit)?e.ResponseCommit.fromJSON(Y.commit):void 0,listSnapshots:(0,F.isSet)(Y.listSnapshots)?e.ResponseListSnapshots.fromJSON(Y.listSnapshots):void 0,offerSnapshot:(0,F.isSet)(Y.offerSnapshot)?e.ResponseOfferSnapshot.fromJSON(Y.offerSnapshot):void 0,loadSnapshotChunk:(0,F.isSet)(Y.loadSnapshotChunk)?e.ResponseLoadSnapshotChunk.fromJSON(Y.loadSnapshotChunk):void 0,applySnapshotChunk:(0,F.isSet)(Y.applySnapshotChunk)?e.ResponseApplySnapshotChunk.fromJSON(Y.applySnapshotChunk):void 0,prepareProposal:(0,F.isSet)(Y.prepareProposal)?e.ResponsePrepareProposal.fromJSON(Y.prepareProposal):void 0,processProposal:(0,F.isSet)(Y.processProposal)?e.ResponseProcessProposal.fromJSON(Y.processProposal):void 0}},toJSON(Y){let fe={};return Y.exception!==void 0&&(fe.exception=Y.exception?e.ResponseException.toJSON(Y.exception):void 0),Y.echo!==void 0&&(fe.echo=Y.echo?e.ResponseEcho.toJSON(Y.echo):void 0),Y.flush!==void 0&&(fe.flush=Y.flush?e.ResponseFlush.toJSON(Y.flush):void 0),Y.info!==void 0&&(fe.info=Y.info?e.ResponseInfo.toJSON(Y.info):void 0),Y.initChain!==void 0&&(fe.initChain=Y.initChain?e.ResponseInitChain.toJSON(Y.initChain):void 0),Y.query!==void 0&&(fe.query=Y.query?e.ResponseQuery.toJSON(Y.query):void 0),Y.beginBlock!==void 0&&(fe.beginBlock=Y.beginBlock?e.ResponseBeginBlock.toJSON(Y.beginBlock):void 0),Y.checkTx!==void 0&&(fe.checkTx=Y.checkTx?e.ResponseCheckTx.toJSON(Y.checkTx):void 0),Y.deliverTx!==void 0&&(fe.deliverTx=Y.deliverTx?e.ResponseDeliverTx.toJSON(Y.deliverTx):void 0),Y.endBlock!==void 0&&(fe.endBlock=Y.endBlock?e.ResponseEndBlock.toJSON(Y.endBlock):void 0),Y.commit!==void 0&&(fe.commit=Y.commit?e.ResponseCommit.toJSON(Y.commit):void 0),Y.listSnapshots!==void 0&&(fe.listSnapshots=Y.listSnapshots?e.ResponseListSnapshots.toJSON(Y.listSnapshots):void 0),Y.offerSnapshot!==void 0&&(fe.offerSnapshot=Y.offerSnapshot?e.ResponseOfferSnapshot.toJSON(Y.offerSnapshot):void 0),Y.loadSnapshotChunk!==void 0&&(fe.loadSnapshotChunk=Y.loadSnapshotChunk?e.ResponseLoadSnapshotChunk.toJSON(Y.loadSnapshotChunk):void 0),Y.applySnapshotChunk!==void 0&&(fe.applySnapshotChunk=Y.applySnapshotChunk?e.ResponseApplySnapshotChunk.toJSON(Y.applySnapshotChunk):void 0),Y.prepareProposal!==void 0&&(fe.prepareProposal=Y.prepareProposal?e.ResponsePrepareProposal.toJSON(Y.prepareProposal):void 0),Y.processProposal!==void 0&&(fe.processProposal=Y.processProposal?e.ResponseProcessProposal.toJSON(Y.processProposal):void 0),fe},fromPartial(Y){let fe=Xe();return fe.exception=Y.exception!==void 0&&Y.exception!==null?e.ResponseException.fromPartial(Y.exception):void 0,fe.echo=Y.echo!==void 0&&Y.echo!==null?e.ResponseEcho.fromPartial(Y.echo):void 0,fe.flush=Y.flush!==void 0&&Y.flush!==null?e.ResponseFlush.fromPartial(Y.flush):void 0,fe.info=Y.info!==void 0&&Y.info!==null?e.ResponseInfo.fromPartial(Y.info):void 0,fe.initChain=Y.initChain!==void 0&&Y.initChain!==null?e.ResponseInitChain.fromPartial(Y.initChain):void 0,fe.query=Y.query!==void 0&&Y.query!==null?e.ResponseQuery.fromPartial(Y.query):void 0,fe.beginBlock=Y.beginBlock!==void 0&&Y.beginBlock!==null?e.ResponseBeginBlock.fromPartial(Y.beginBlock):void 0,fe.checkTx=Y.checkTx!==void 0&&Y.checkTx!==null?e.ResponseCheckTx.fromPartial(Y.checkTx):void 0,fe.deliverTx=Y.deliverTx!==void 0&&Y.deliverTx!==null?e.ResponseDeliverTx.fromPartial(Y.deliverTx):void 0,fe.endBlock=Y.endBlock!==void 0&&Y.endBlock!==null?e.ResponseEndBlock.fromPartial(Y.endBlock):void 0,fe.commit=Y.commit!==void 0&&Y.commit!==null?e.ResponseCommit.fromPartial(Y.commit):void 0,fe.listSnapshots=Y.listSnapshots!==void 0&&Y.listSnapshots!==null?e.ResponseListSnapshots.fromPartial(Y.listSnapshots):void 0,fe.offerSnapshot=Y.offerSnapshot!==void 0&&Y.offerSnapshot!==null?e.ResponseOfferSnapshot.fromPartial(Y.offerSnapshot):void 0,fe.loadSnapshotChunk=Y.loadSnapshotChunk!==void 0&&Y.loadSnapshotChunk!==null?e.ResponseLoadSnapshotChunk.fromPartial(Y.loadSnapshotChunk):void 0,fe.applySnapshotChunk=Y.applySnapshotChunk!==void 0&&Y.applySnapshotChunk!==null?e.ResponseApplySnapshotChunk.fromPartial(Y.applySnapshotChunk):void 0,fe.prepareProposal=Y.prepareProposal!==void 0&&Y.prepareProposal!==null?e.ResponsePrepareProposal.fromPartial(Y.prepareProposal):void 0,fe.processProposal=Y.processProposal!==void 0&&Y.processProposal!==null?e.ResponseProcessProposal.fromPartial(Y.processProposal):void 0,fe}};function nt(){return{error:""}}e.ResponseException={encode(Y,fe=j.Writer.create()){return Y.error!==""&&fe.uint32(10).string(Y.error),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=nt();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.error=be.string();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{error:(0,F.isSet)(Y.error)?String(Y.error):""}},toJSON(Y){let fe={};return Y.error!==void 0&&(fe.error=Y.error),fe},fromPartial(Y){var be;let fe=nt();return fe.error=(be=Y.error)!=null?be:"",fe}};function Ke(){return{message:""}}e.ResponseEcho={encode(Y,fe=j.Writer.create()){return Y.message!==""&&fe.uint32(10).string(Y.message),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Ke();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.message=be.string();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{message:(0,F.isSet)(Y.message)?String(Y.message):""}},toJSON(Y){let fe={};return Y.message!==void 0&&(fe.message=Y.message),fe},fromPartial(Y){var be;let fe=Ke();return fe.message=(be=Y.message)!=null?be:"",fe}};function It(){return{}}e.ResponseFlush={encode(Y,fe=j.Writer.create()){return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=It();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{}},toJSON(Y){return{}},fromPartial(Y){return It()}};function rt(){return{data:"",version:"",appVersion:F.Long.UZERO,lastBlockHeight:F.Long.ZERO,lastBlockAppHash:new Uint8Array}}e.ResponseInfo={encode(Y,fe=j.Writer.create()){return Y.data!==""&&fe.uint32(10).string(Y.data),Y.version!==""&&fe.uint32(18).string(Y.version),Y.appVersion.isZero()||fe.uint32(24).uint64(Y.appVersion),Y.lastBlockHeight.isZero()||fe.uint32(32).int64(Y.lastBlockHeight),Y.lastBlockAppHash.length!==0&&fe.uint32(42).bytes(Y.lastBlockAppHash),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=rt();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.data=be.string();break;case 2:ct.version=be.string();break;case 3:ct.appVersion=be.uint64();break;case 4:ct.lastBlockHeight=be.int64();break;case 5:ct.lastBlockAppHash=be.bytes();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{data:(0,F.isSet)(Y.data)?String(Y.data):"",version:(0,F.isSet)(Y.version)?String(Y.version):"",appVersion:(0,F.isSet)(Y.appVersion)?F.Long.fromValue(Y.appVersion):F.Long.UZERO,lastBlockHeight:(0,F.isSet)(Y.lastBlockHeight)?F.Long.fromValue(Y.lastBlockHeight):F.Long.ZERO,lastBlockAppHash:(0,F.isSet)(Y.lastBlockAppHash)?(0,F.bytesFromBase64)(Y.lastBlockAppHash):new Uint8Array}},toJSON(Y){let fe={};return Y.data!==void 0&&(fe.data=Y.data),Y.version!==void 0&&(fe.version=Y.version),Y.appVersion!==void 0&&(fe.appVersion=(Y.appVersion||F.Long.UZERO).toString()),Y.lastBlockHeight!==void 0&&(fe.lastBlockHeight=(Y.lastBlockHeight||F.Long.ZERO).toString()),Y.lastBlockAppHash!==void 0&&(fe.lastBlockAppHash=(0,F.base64FromBytes)(Y.lastBlockAppHash!==void 0?Y.lastBlockAppHash:new Uint8Array)),fe},fromPartial(Y){var be,qt,ct;let fe=rt();return fe.data=(be=Y.data)!=null?be:"",fe.version=(qt=Y.version)!=null?qt:"",fe.appVersion=Y.appVersion!==void 0&&Y.appVersion!==null?F.Long.fromValue(Y.appVersion):F.Long.UZERO,fe.lastBlockHeight=Y.lastBlockHeight!==void 0&&Y.lastBlockHeight!==null?F.Long.fromValue(Y.lastBlockHeight):F.Long.ZERO,fe.lastBlockAppHash=(ct=Y.lastBlockAppHash)!=null?ct:new Uint8Array,fe}};function ut(){return{consensusParams:void 0,validators:[],appHash:new Uint8Array}}e.ResponseInitChain={encode(Y,fe=j.Writer.create()){Y.consensusParams!==void 0&&l.ConsensusParams.encode(Y.consensusParams,fe.uint32(10).fork()).ldelim();for(let be of Y.validators)e.ValidatorUpdate.encode(be,fe.uint32(18).fork()).ldelim();return Y.appHash.length!==0&&fe.uint32(26).bytes(Y.appHash),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=ut();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.consensusParams=l.ConsensusParams.decode(be,be.uint32());break;case 2:ct.validators.push(e.ValidatorUpdate.decode(be,be.uint32()));break;case 3:ct.appHash=be.bytes();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{consensusParams:(0,F.isSet)(Y.consensusParams)?l.ConsensusParams.fromJSON(Y.consensusParams):void 0,validators:Array.isArray(Y==null?void 0:Y.validators)?Y.validators.map(fe=>e.ValidatorUpdate.fromJSON(fe)):[],appHash:(0,F.isSet)(Y.appHash)?(0,F.bytesFromBase64)(Y.appHash):new Uint8Array}},toJSON(Y){let fe={};return Y.consensusParams!==void 0&&(fe.consensusParams=Y.consensusParams?l.ConsensusParams.toJSON(Y.consensusParams):void 0),Y.validators?fe.validators=Y.validators.map(be=>be?e.ValidatorUpdate.toJSON(be):void 0):fe.validators=[],Y.appHash!==void 0&&(fe.appHash=(0,F.base64FromBytes)(Y.appHash!==void 0?Y.appHash:new Uint8Array)),fe},fromPartial(Y){var be,qt;let fe=ut();return fe.consensusParams=Y.consensusParams!==void 0&&Y.consensusParams!==null?l.ConsensusParams.fromPartial(Y.consensusParams):void 0,fe.validators=((be=Y.validators)==null?void 0:be.map(ct=>e.ValidatorUpdate.fromPartial(ct)))||[],fe.appHash=(qt=Y.appHash)!=null?qt:new Uint8Array,fe}};function Rt(){return{code:0,log:"",info:"",index:F.Long.ZERO,key:new Uint8Array,value:new Uint8Array,proofOps:void 0,height:F.Long.ZERO,codespace:""}}e.ResponseQuery={encode(Y,fe=j.Writer.create()){return Y.code!==0&&fe.uint32(8).uint32(Y.code),Y.log!==""&&fe.uint32(26).string(Y.log),Y.info!==""&&fe.uint32(34).string(Y.info),Y.index.isZero()||fe.uint32(40).int64(Y.index),Y.key.length!==0&&fe.uint32(50).bytes(Y.key),Y.value.length!==0&&fe.uint32(58).bytes(Y.value),Y.proofOps!==void 0&&w.ProofOps.encode(Y.proofOps,fe.uint32(66).fork()).ldelim(),Y.height.isZero()||fe.uint32(72).int64(Y.height),Y.codespace!==""&&fe.uint32(82).string(Y.codespace),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Rt();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.code=be.uint32();break;case 3:ct.log=be.string();break;case 4:ct.info=be.string();break;case 5:ct.index=be.int64();break;case 6:ct.key=be.bytes();break;case 7:ct.value=be.bytes();break;case 8:ct.proofOps=w.ProofOps.decode(be,be.uint32());break;case 9:ct.height=be.int64();break;case 10:ct.codespace=be.string();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{code:(0,F.isSet)(Y.code)?Number(Y.code):0,log:(0,F.isSet)(Y.log)?String(Y.log):"",info:(0,F.isSet)(Y.info)?String(Y.info):"",index:(0,F.isSet)(Y.index)?F.Long.fromValue(Y.index):F.Long.ZERO,key:(0,F.isSet)(Y.key)?(0,F.bytesFromBase64)(Y.key):new Uint8Array,value:(0,F.isSet)(Y.value)?(0,F.bytesFromBase64)(Y.value):new Uint8Array,proofOps:(0,F.isSet)(Y.proofOps)?w.ProofOps.fromJSON(Y.proofOps):void 0,height:(0,F.isSet)(Y.height)?F.Long.fromValue(Y.height):F.Long.ZERO,codespace:(0,F.isSet)(Y.codespace)?String(Y.codespace):""}},toJSON(Y){let fe={};return Y.code!==void 0&&(fe.code=Math.round(Y.code)),Y.log!==void 0&&(fe.log=Y.log),Y.info!==void 0&&(fe.info=Y.info),Y.index!==void 0&&(fe.index=(Y.index||F.Long.ZERO).toString()),Y.key!==void 0&&(fe.key=(0,F.base64FromBytes)(Y.key!==void 0?Y.key:new Uint8Array)),Y.value!==void 0&&(fe.value=(0,F.base64FromBytes)(Y.value!==void 0?Y.value:new Uint8Array)),Y.proofOps!==void 0&&(fe.proofOps=Y.proofOps?w.ProofOps.toJSON(Y.proofOps):void 0),Y.height!==void 0&&(fe.height=(Y.height||F.Long.ZERO).toString()),Y.codespace!==void 0&&(fe.codespace=Y.codespace),fe},fromPartial(Y){var be,qt,ct,Ft,vr,$n;let fe=Rt();return fe.code=(be=Y.code)!=null?be:0,fe.log=(qt=Y.log)!=null?qt:"",fe.info=(ct=Y.info)!=null?ct:"",fe.index=Y.index!==void 0&&Y.index!==null?F.Long.fromValue(Y.index):F.Long.ZERO,fe.key=(Ft=Y.key)!=null?Ft:new Uint8Array,fe.value=(vr=Y.value)!=null?vr:new Uint8Array,fe.proofOps=Y.proofOps!==void 0&&Y.proofOps!==null?w.ProofOps.fromPartial(Y.proofOps):void 0,fe.height=Y.height!==void 0&&Y.height!==null?F.Long.fromValue(Y.height):F.Long.ZERO,fe.codespace=($n=Y.codespace)!=null?$n:"",fe}};function Ee(){return{events:[]}}e.ResponseBeginBlock={encode(Y,fe=j.Writer.create()){for(let be of Y.events)e.Event.encode(be,fe.uint32(10).fork()).ldelim();return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Ee();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.events.push(e.Event.decode(be,be.uint32()));break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{events:Array.isArray(Y==null?void 0:Y.events)?Y.events.map(fe=>e.Event.fromJSON(fe)):[]}},toJSON(Y){let fe={};return Y.events?fe.events=Y.events.map(be=>be?e.Event.toJSON(be):void 0):fe.events=[],fe},fromPartial(Y){var be;let fe=Ee();return fe.events=((be=Y.events)==null?void 0:be.map(qt=>e.Event.fromPartial(qt)))||[],fe}};function Pt(){return{code:0,data:new Uint8Array,log:"",info:"",gasWanted:F.Long.ZERO,gasUsed:F.Long.ZERO,events:[],codespace:"",sender:"",priority:F.Long.ZERO,mempoolError:""}}e.ResponseCheckTx={encode(Y,fe=j.Writer.create()){Y.code!==0&&fe.uint32(8).uint32(Y.code),Y.data.length!==0&&fe.uint32(18).bytes(Y.data),Y.log!==""&&fe.uint32(26).string(Y.log),Y.info!==""&&fe.uint32(34).string(Y.info),Y.gasWanted.isZero()||fe.uint32(40).int64(Y.gasWanted),Y.gasUsed.isZero()||fe.uint32(48).int64(Y.gasUsed);for(let be of Y.events)e.Event.encode(be,fe.uint32(58).fork()).ldelim();return Y.codespace!==""&&fe.uint32(66).string(Y.codespace),Y.sender!==""&&fe.uint32(74).string(Y.sender),Y.priority.isZero()||fe.uint32(80).int64(Y.priority),Y.mempoolError!==""&&fe.uint32(90).string(Y.mempoolError),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Pt();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.code=be.uint32();break;case 2:ct.data=be.bytes();break;case 3:ct.log=be.string();break;case 4:ct.info=be.string();break;case 5:ct.gasWanted=be.int64();break;case 6:ct.gasUsed=be.int64();break;case 7:ct.events.push(e.Event.decode(be,be.uint32()));break;case 8:ct.codespace=be.string();break;case 9:ct.sender=be.string();break;case 10:ct.priority=be.int64();break;case 11:ct.mempoolError=be.string();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{code:(0,F.isSet)(Y.code)?Number(Y.code):0,data:(0,F.isSet)(Y.data)?(0,F.bytesFromBase64)(Y.data):new Uint8Array,log:(0,F.isSet)(Y.log)?String(Y.log):"",info:(0,F.isSet)(Y.info)?String(Y.info):"",gasWanted:(0,F.isSet)(Y.gas_wanted)?F.Long.fromValue(Y.gas_wanted):F.Long.ZERO,gasUsed:(0,F.isSet)(Y.gas_used)?F.Long.fromValue(Y.gas_used):F.Long.ZERO,events:Array.isArray(Y==null?void 0:Y.events)?Y.events.map(fe=>e.Event.fromJSON(fe)):[],codespace:(0,F.isSet)(Y.codespace)?String(Y.codespace):"",sender:(0,F.isSet)(Y.sender)?String(Y.sender):"",priority:(0,F.isSet)(Y.priority)?F.Long.fromValue(Y.priority):F.Long.ZERO,mempoolError:(0,F.isSet)(Y.mempoolError)?String(Y.mempoolError):""}},toJSON(Y){let fe={};return Y.code!==void 0&&(fe.code=Math.round(Y.code)),Y.data!==void 0&&(fe.data=(0,F.base64FromBytes)(Y.data!==void 0?Y.data:new Uint8Array)),Y.log!==void 0&&(fe.log=Y.log),Y.info!==void 0&&(fe.info=Y.info),Y.gasWanted!==void 0&&(fe.gas_wanted=(Y.gasWanted||F.Long.ZERO).toString()),Y.gasUsed!==void 0&&(fe.gas_used=(Y.gasUsed||F.Long.ZERO).toString()),Y.events?fe.events=Y.events.map(be=>be?e.Event.toJSON(be):void 0):fe.events=[],Y.codespace!==void 0&&(fe.codespace=Y.codespace),Y.sender!==void 0&&(fe.sender=Y.sender),Y.priority!==void 0&&(fe.priority=(Y.priority||F.Long.ZERO).toString()),Y.mempoolError!==void 0&&(fe.mempoolError=Y.mempoolError),fe},fromPartial(Y){var be,qt,ct,Ft,vr,$n,Hn,kr;let fe=Pt();return fe.code=(be=Y.code)!=null?be:0,fe.data=(qt=Y.data)!=null?qt:new Uint8Array,fe.log=(ct=Y.log)!=null?ct:"",fe.info=(Ft=Y.info)!=null?Ft:"",fe.gasWanted=Y.gasWanted!==void 0&&Y.gasWanted!==null?F.Long.fromValue(Y.gasWanted):F.Long.ZERO,fe.gasUsed=Y.gasUsed!==void 0&&Y.gasUsed!==null?F.Long.fromValue(Y.gasUsed):F.Long.ZERO,fe.events=((vr=Y.events)==null?void 0:vr.map(sr=>e.Event.fromPartial(sr)))||[],fe.codespace=($n=Y.codespace)!=null?$n:"",fe.sender=(Hn=Y.sender)!=null?Hn:"",fe.priority=Y.priority!==void 0&&Y.priority!==null?F.Long.fromValue(Y.priority):F.Long.ZERO,fe.mempoolError=(kr=Y.mempoolError)!=null?kr:"",fe}};function _e(){return{code:0,data:new Uint8Array,log:"",info:"",gasWanted:F.Long.ZERO,gasUsed:F.Long.ZERO,events:[],codespace:""}}e.ResponseDeliverTx={encode(Y,fe=j.Writer.create()){Y.code!==0&&fe.uint32(8).uint32(Y.code),Y.data.length!==0&&fe.uint32(18).bytes(Y.data),Y.log!==""&&fe.uint32(26).string(Y.log),Y.info!==""&&fe.uint32(34).string(Y.info),Y.gasWanted.isZero()||fe.uint32(40).int64(Y.gasWanted),Y.gasUsed.isZero()||fe.uint32(48).int64(Y.gasUsed);for(let be of Y.events)e.Event.encode(be,fe.uint32(58).fork()).ldelim();return Y.codespace!==""&&fe.uint32(66).string(Y.codespace),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=_e();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.code=be.uint32();break;case 2:ct.data=be.bytes();break;case 3:ct.log=be.string();break;case 4:ct.info=be.string();break;case 5:ct.gasWanted=be.int64();break;case 6:ct.gasUsed=be.int64();break;case 7:ct.events.push(e.Event.decode(be,be.uint32()));break;case 8:ct.codespace=be.string();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{code:(0,F.isSet)(Y.code)?Number(Y.code):0,data:(0,F.isSet)(Y.data)?(0,F.bytesFromBase64)(Y.data):new Uint8Array,log:(0,F.isSet)(Y.log)?String(Y.log):"",info:(0,F.isSet)(Y.info)?String(Y.info):"",gasWanted:(0,F.isSet)(Y.gas_wanted)?F.Long.fromValue(Y.gas_wanted):F.Long.ZERO,gasUsed:(0,F.isSet)(Y.gas_used)?F.Long.fromValue(Y.gas_used):F.Long.ZERO,events:Array.isArray(Y==null?void 0:Y.events)?Y.events.map(fe=>e.Event.fromJSON(fe)):[],codespace:(0,F.isSet)(Y.codespace)?String(Y.codespace):""}},toJSON(Y){let fe={};return Y.code!==void 0&&(fe.code=Math.round(Y.code)),Y.data!==void 0&&(fe.data=(0,F.base64FromBytes)(Y.data!==void 0?Y.data:new Uint8Array)),Y.log!==void 0&&(fe.log=Y.log),Y.info!==void 0&&(fe.info=Y.info),Y.gasWanted!==void 0&&(fe.gas_wanted=(Y.gasWanted||F.Long.ZERO).toString()),Y.gasUsed!==void 0&&(fe.gas_used=(Y.gasUsed||F.Long.ZERO).toString()),Y.events?fe.events=Y.events.map(be=>be?e.Event.toJSON(be):void 0):fe.events=[],Y.codespace!==void 0&&(fe.codespace=Y.codespace),fe},fromPartial(Y){var be,qt,ct,Ft,vr,$n;let fe=_e();return fe.code=(be=Y.code)!=null?be:0,fe.data=(qt=Y.data)!=null?qt:new Uint8Array,fe.log=(ct=Y.log)!=null?ct:"",fe.info=(Ft=Y.info)!=null?Ft:"",fe.gasWanted=Y.gasWanted!==void 0&&Y.gasWanted!==null?F.Long.fromValue(Y.gasWanted):F.Long.ZERO,fe.gasUsed=Y.gasUsed!==void 0&&Y.gasUsed!==null?F.Long.fromValue(Y.gasUsed):F.Long.ZERO,fe.events=((vr=Y.events)==null?void 0:vr.map(Hn=>e.Event.fromPartial(Hn)))||[],fe.codespace=($n=Y.codespace)!=null?$n:"",fe}};function we(){return{validatorUpdates:[],consensusParamUpdates:void 0,events:[]}}e.ResponseEndBlock={encode(Y,fe=j.Writer.create()){for(let be of Y.validatorUpdates)e.ValidatorUpdate.encode(be,fe.uint32(10).fork()).ldelim();Y.consensusParamUpdates!==void 0&&l.ConsensusParams.encode(Y.consensusParamUpdates,fe.uint32(18).fork()).ldelim();for(let be of Y.events)e.Event.encode(be,fe.uint32(26).fork()).ldelim();return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=we();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.validatorUpdates.push(e.ValidatorUpdate.decode(be,be.uint32()));break;case 2:ct.consensusParamUpdates=l.ConsensusParams.decode(be,be.uint32());break;case 3:ct.events.push(e.Event.decode(be,be.uint32()));break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{validatorUpdates:Array.isArray(Y==null?void 0:Y.validatorUpdates)?Y.validatorUpdates.map(fe=>e.ValidatorUpdate.fromJSON(fe)):[],consensusParamUpdates:(0,F.isSet)(Y.consensusParamUpdates)?l.ConsensusParams.fromJSON(Y.consensusParamUpdates):void 0,events:Array.isArray(Y==null?void 0:Y.events)?Y.events.map(fe=>e.Event.fromJSON(fe)):[]}},toJSON(Y){let fe={};return Y.validatorUpdates?fe.validatorUpdates=Y.validatorUpdates.map(be=>be?e.ValidatorUpdate.toJSON(be):void 0):fe.validatorUpdates=[],Y.consensusParamUpdates!==void 0&&(fe.consensusParamUpdates=Y.consensusParamUpdates?l.ConsensusParams.toJSON(Y.consensusParamUpdates):void 0),Y.events?fe.events=Y.events.map(be=>be?e.Event.toJSON(be):void 0):fe.events=[],fe},fromPartial(Y){var be,qt;let fe=we();return fe.validatorUpdates=((be=Y.validatorUpdates)==null?void 0:be.map(ct=>e.ValidatorUpdate.fromPartial(ct)))||[],fe.consensusParamUpdates=Y.consensusParamUpdates!==void 0&&Y.consensusParamUpdates!==null?l.ConsensusParams.fromPartial(Y.consensusParamUpdates):void 0,fe.events=((qt=Y.events)==null?void 0:qt.map(ct=>e.Event.fromPartial(ct)))||[],fe}};function xe(){return{data:new Uint8Array,retainHeight:F.Long.ZERO}}e.ResponseCommit={encode(Y,fe=j.Writer.create()){return Y.data.length!==0&&fe.uint32(18).bytes(Y.data),Y.retainHeight.isZero()||fe.uint32(24).int64(Y.retainHeight),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=xe();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 2:ct.data=be.bytes();break;case 3:ct.retainHeight=be.int64();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{data:(0,F.isSet)(Y.data)?(0,F.bytesFromBase64)(Y.data):new Uint8Array,retainHeight:(0,F.isSet)(Y.retainHeight)?F.Long.fromValue(Y.retainHeight):F.Long.ZERO}},toJSON(Y){let fe={};return Y.data!==void 0&&(fe.data=(0,F.base64FromBytes)(Y.data!==void 0?Y.data:new Uint8Array)),Y.retainHeight!==void 0&&(fe.retainHeight=(Y.retainHeight||F.Long.ZERO).toString()),fe},fromPartial(Y){var be;let fe=xe();return fe.data=(be=Y.data)!=null?be:new Uint8Array,fe.retainHeight=Y.retainHeight!==void 0&&Y.retainHeight!==null?F.Long.fromValue(Y.retainHeight):F.Long.ZERO,fe}};function Ye(){return{snapshots:[]}}e.ResponseListSnapshots={encode(Y,fe=j.Writer.create()){for(let be of Y.snapshots)e.Snapshot.encode(be,fe.uint32(10).fork()).ldelim();return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Ye();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.snapshots.push(e.Snapshot.decode(be,be.uint32()));break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{snapshots:Array.isArray(Y==null?void 0:Y.snapshots)?Y.snapshots.map(fe=>e.Snapshot.fromJSON(fe)):[]}},toJSON(Y){let fe={};return Y.snapshots?fe.snapshots=Y.snapshots.map(be=>be?e.Snapshot.toJSON(be):void 0):fe.snapshots=[],fe},fromPartial(Y){var be;let fe=Ye();return fe.snapshots=((be=Y.snapshots)==null?void 0:be.map(qt=>e.Snapshot.fromPartial(qt)))||[],fe}};function X(){return{result:0}}e.ResponseOfferSnapshot={encode(Y,fe=j.Writer.create()){return Y.result!==0&&fe.uint32(8).int32(Y.result),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=X();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.result=be.int32();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{result:(0,F.isSet)(Y.result)?R(Y.result):0}},toJSON(Y){let fe={};return Y.result!==void 0&&(fe.result=M(Y.result)),fe},fromPartial(Y){var be;let fe=X();return fe.result=(be=Y.result)!=null?be:0,fe}};function ht(){return{chunk:new Uint8Array}}e.ResponseLoadSnapshotChunk={encode(Y,fe=j.Writer.create()){return Y.chunk.length!==0&&fe.uint32(10).bytes(Y.chunk),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=ht();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.chunk=be.bytes();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{chunk:(0,F.isSet)(Y.chunk)?(0,F.bytesFromBase64)(Y.chunk):new Uint8Array}},toJSON(Y){let fe={};return Y.chunk!==void 0&&(fe.chunk=(0,F.base64FromBytes)(Y.chunk!==void 0?Y.chunk:new Uint8Array)),fe},fromPartial(Y){var be;let fe=ht();return fe.chunk=(be=Y.chunk)!=null?be:new Uint8Array,fe}};function Ut(){return{result:0,refetchChunks:[],rejectSenders:[]}}e.ResponseApplySnapshotChunk={encode(Y,fe=j.Writer.create()){Y.result!==0&&fe.uint32(8).int32(Y.result),fe.uint32(18).fork();for(let be of Y.refetchChunks)fe.uint32(be);fe.ldelim();for(let be of Y.rejectSenders)fe.uint32(26).string(be);return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Ut();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.result=be.int32();break;case 2:if((Ft&7)===2){let vr=be.uint32()+be.pos;for(;be.pos<vr;)ct.refetchChunks.push(be.uint32())}else ct.refetchChunks.push(be.uint32());break;case 3:ct.rejectSenders.push(be.string());break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{result:(0,F.isSet)(Y.result)?E(Y.result):0,refetchChunks:Array.isArray(Y==null?void 0:Y.refetchChunks)?Y.refetchChunks.map(fe=>Number(fe)):[],rejectSenders:Array.isArray(Y==null?void 0:Y.rejectSenders)?Y.rejectSenders.map(fe=>String(fe)):[]}},toJSON(Y){let fe={};return Y.result!==void 0&&(fe.result=Q(Y.result)),Y.refetchChunks?fe.refetchChunks=Y.refetchChunks.map(be=>Math.round(be)):fe.refetchChunks=[],Y.rejectSenders?fe.rejectSenders=Y.rejectSenders.map(be=>be):fe.rejectSenders=[],fe},fromPartial(Y){var be,qt,ct;let fe=Ut();return fe.result=(be=Y.result)!=null?be:0,fe.refetchChunks=((qt=Y.refetchChunks)==null?void 0:qt.map(Ft=>Ft))||[],fe.rejectSenders=((ct=Y.rejectSenders)==null?void 0:ct.map(Ft=>Ft))||[],fe}};function zt(){return{txs:[]}}e.ResponsePrepareProposal={encode(Y,fe=j.Writer.create()){for(let be of Y.txs)fe.uint32(10).bytes(be);return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=zt();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.txs.push(be.bytes());break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{txs:Array.isArray(Y==null?void 0:Y.txs)?Y.txs.map(fe=>(0,F.bytesFromBase64)(fe)):[]}},toJSON(Y){let fe={};return Y.txs?fe.txs=Y.txs.map(be=>(0,F.base64FromBytes)(be!==void 0?be:new Uint8Array)):fe.txs=[],fe},fromPartial(Y){var be;let fe=zt();return fe.txs=((be=Y.txs)==null?void 0:be.map(qt=>qt))||[],fe}};function Wt(){return{status:0}}e.ResponseProcessProposal={encode(Y,fe=j.Writer.create()){return Y.status!==0&&fe.uint32(8).int32(Y.status),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Wt();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.status=be.int32();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{status:(0,F.isSet)(Y.status)?re(Y.status):0}},toJSON(Y){let fe={};return Y.status!==void 0&&(fe.status=ee(Y.status)),fe},fromPartial(Y){var be;let fe=Wt();return fe.status=(be=Y.status)!=null?be:0,fe}};function yn(){return{round:0,votes:[]}}e.CommitInfo={encode(Y,fe=j.Writer.create()){Y.round!==0&&fe.uint32(8).int32(Y.round);for(let be of Y.votes)e.VoteInfo.encode(be,fe.uint32(18).fork()).ldelim();return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=yn();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.round=be.int32();break;case 2:ct.votes.push(e.VoteInfo.decode(be,be.uint32()));break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{round:(0,F.isSet)(Y.round)?Number(Y.round):0,votes:Array.isArray(Y==null?void 0:Y.votes)?Y.votes.map(fe=>e.VoteInfo.fromJSON(fe)):[]}},toJSON(Y){let fe={};return Y.round!==void 0&&(fe.round=Math.round(Y.round)),Y.votes?fe.votes=Y.votes.map(be=>be?e.VoteInfo.toJSON(be):void 0):fe.votes=[],fe},fromPartial(Y){var be,qt;let fe=yn();return fe.round=(be=Y.round)!=null?be:0,fe.votes=((qt=Y.votes)==null?void 0:qt.map(ct=>e.VoteInfo.fromPartial(ct)))||[],fe}};function rn(){return{round:0,votes:[]}}e.ExtendedCommitInfo={encode(Y,fe=j.Writer.create()){Y.round!==0&&fe.uint32(8).int32(Y.round);for(let be of Y.votes)e.ExtendedVoteInfo.encode(be,fe.uint32(18).fork()).ldelim();return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=rn();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.round=be.int32();break;case 2:ct.votes.push(e.ExtendedVoteInfo.decode(be,be.uint32()));break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{round:(0,F.isSet)(Y.round)?Number(Y.round):0,votes:Array.isArray(Y==null?void 0:Y.votes)?Y.votes.map(fe=>e.ExtendedVoteInfo.fromJSON(fe)):[]}},toJSON(Y){let fe={};return Y.round!==void 0&&(fe.round=Math.round(Y.round)),Y.votes?fe.votes=Y.votes.map(be=>be?e.ExtendedVoteInfo.toJSON(be):void 0):fe.votes=[],fe},fromPartial(Y){var be,qt;let fe=rn();return fe.round=(be=Y.round)!=null?be:0,fe.votes=((qt=Y.votes)==null?void 0:qt.map(ct=>e.ExtendedVoteInfo.fromPartial(ct)))||[],fe}};function un(){return{type:"",attributes:[]}}e.Event={encode(Y,fe=j.Writer.create()){Y.type!==""&&fe.uint32(10).string(Y.type);for(let be of Y.attributes)e.EventAttribute.encode(be,fe.uint32(18).fork()).ldelim();return fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=un();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.type=be.string();break;case 2:ct.attributes.push(e.EventAttribute.decode(be,be.uint32()));break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{type:(0,F.isSet)(Y.type)?String(Y.type):"",attributes:Array.isArray(Y==null?void 0:Y.attributes)?Y.attributes.map(fe=>e.EventAttribute.fromJSON(fe)):[]}},toJSON(Y){let fe={};return Y.type!==void 0&&(fe.type=Y.type),Y.attributes?fe.attributes=Y.attributes.map(be=>be?e.EventAttribute.toJSON(be):void 0):fe.attributes=[],fe},fromPartial(Y){var be,qt;let fe=un();return fe.type=(be=Y.type)!=null?be:"",fe.attributes=((qt=Y.attributes)==null?void 0:qt.map(ct=>e.EventAttribute.fromPartial(ct)))||[],fe}};function fr(){return{key:"",value:"",index:!1}}e.EventAttribute={encode(Y,fe=j.Writer.create()){return Y.key!==""&&fe.uint32(10).string(Y.key),Y.value!==""&&fe.uint32(18).string(Y.value),Y.index===!0&&fe.uint32(24).bool(Y.index),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=fr();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.key=be.string();break;case 2:ct.value=be.string();break;case 3:ct.index=be.bool();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{key:(0,F.isSet)(Y.key)?String(Y.key):"",value:(0,F.isSet)(Y.value)?String(Y.value):"",index:(0,F.isSet)(Y.index)?!!Y.index:!1}},toJSON(Y){let fe={};return Y.key!==void 0&&(fe.key=Y.key),Y.value!==void 0&&(fe.value=Y.value),Y.index!==void 0&&(fe.index=Y.index),fe},fromPartial(Y){var be,qt,ct;let fe=fr();return fe.key=(be=Y.key)!=null?be:"",fe.value=(qt=Y.value)!=null?qt:"",fe.index=(ct=Y.index)!=null?ct:!1,fe}};function ir(){return{height:F.Long.ZERO,index:0,tx:new Uint8Array,result:void 0}}e.TxResult={encode(Y,fe=j.Writer.create()){return Y.height.isZero()||fe.uint32(8).int64(Y.height),Y.index!==0&&fe.uint32(16).uint32(Y.index),Y.tx.length!==0&&fe.uint32(26).bytes(Y.tx),Y.result!==void 0&&e.ResponseDeliverTx.encode(Y.result,fe.uint32(34).fork()).ldelim(),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=ir();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.height=be.int64();break;case 2:ct.index=be.uint32();break;case 3:ct.tx=be.bytes();break;case 4:ct.result=e.ResponseDeliverTx.decode(be,be.uint32());break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{height:(0,F.isSet)(Y.height)?F.Long.fromValue(Y.height):F.Long.ZERO,index:(0,F.isSet)(Y.index)?Number(Y.index):0,tx:(0,F.isSet)(Y.tx)?(0,F.bytesFromBase64)(Y.tx):new Uint8Array,result:(0,F.isSet)(Y.result)?e.ResponseDeliverTx.fromJSON(Y.result):void 0}},toJSON(Y){let fe={};return Y.height!==void 0&&(fe.height=(Y.height||F.Long.ZERO).toString()),Y.index!==void 0&&(fe.index=Math.round(Y.index)),Y.tx!==void 0&&(fe.tx=(0,F.base64FromBytes)(Y.tx!==void 0?Y.tx:new Uint8Array)),Y.result!==void 0&&(fe.result=Y.result?e.ResponseDeliverTx.toJSON(Y.result):void 0),fe},fromPartial(Y){var be,qt;let fe=ir();return fe.height=Y.height!==void 0&&Y.height!==null?F.Long.fromValue(Y.height):F.Long.ZERO,fe.index=(be=Y.index)!=null?be:0,fe.tx=(qt=Y.tx)!=null?qt:new Uint8Array,fe.result=Y.result!==void 0&&Y.result!==null?e.ResponseDeliverTx.fromPartial(Y.result):void 0,fe}};function Ln(){return{address:new Uint8Array,power:F.Long.ZERO}}e.Validator={encode(Y,fe=j.Writer.create()){return Y.address.length!==0&&fe.uint32(10).bytes(Y.address),Y.power.isZero()||fe.uint32(24).int64(Y.power),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Ln();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.address=be.bytes();break;case 3:ct.power=be.int64();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{address:(0,F.isSet)(Y.address)?(0,F.bytesFromBase64)(Y.address):new Uint8Array,power:(0,F.isSet)(Y.power)?F.Long.fromValue(Y.power):F.Long.ZERO}},toJSON(Y){let fe={};return Y.address!==void 0&&(fe.address=(0,F.base64FromBytes)(Y.address!==void 0?Y.address:new Uint8Array)),Y.power!==void 0&&(fe.power=(Y.power||F.Long.ZERO).toString()),fe},fromPartial(Y){var be;let fe=Ln();return fe.address=(be=Y.address)!=null?be:new Uint8Array,fe.power=Y.power!==void 0&&Y.power!==null?F.Long.fromValue(Y.power):F.Long.ZERO,fe}};function Br(){return{pubKey:void 0,power:F.Long.ZERO}}e.ValidatorUpdate={encode(Y,fe=j.Writer.create()){return Y.pubKey!==void 0&&N.PublicKey.encode(Y.pubKey,fe.uint32(10).fork()).ldelim(),Y.power.isZero()||fe.uint32(16).int64(Y.power),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Br();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.pubKey=N.PublicKey.decode(be,be.uint32());break;case 2:ct.power=be.int64();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{pubKey:(0,F.isSet)(Y.pubKey)?N.PublicKey.fromJSON(Y.pubKey):void 0,power:(0,F.isSet)(Y.power)?F.Long.fromValue(Y.power):F.Long.ZERO}},toJSON(Y){let fe={};return Y.pubKey!==void 0&&(fe.pubKey=Y.pubKey?N.PublicKey.toJSON(Y.pubKey):void 0),Y.power!==void 0&&(fe.power=(Y.power||F.Long.ZERO).toString()),fe},fromPartial(Y){let fe=Br();return fe.pubKey=Y.pubKey!==void 0&&Y.pubKey!==null?N.PublicKey.fromPartial(Y.pubKey):void 0,fe.power=Y.power!==void 0&&Y.power!==null?F.Long.fromValue(Y.power):F.Long.ZERO,fe}};function Zn(){return{validator:void 0,signedLastBlock:!1}}e.VoteInfo={encode(Y,fe=j.Writer.create()){return Y.validator!==void 0&&e.Validator.encode(Y.validator,fe.uint32(10).fork()).ldelim(),Y.signedLastBlock===!0&&fe.uint32(16).bool(Y.signedLastBlock),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Zn();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.validator=e.Validator.decode(be,be.uint32());break;case 2:ct.signedLastBlock=be.bool();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{validator:(0,F.isSet)(Y.validator)?e.Validator.fromJSON(Y.validator):void 0,signedLastBlock:(0,F.isSet)(Y.signedLastBlock)?!!Y.signedLastBlock:!1}},toJSON(Y){let fe={};return Y.validator!==void 0&&(fe.validator=Y.validator?e.Validator.toJSON(Y.validator):void 0),Y.signedLastBlock!==void 0&&(fe.signedLastBlock=Y.signedLastBlock),fe},fromPartial(Y){var be;let fe=Zn();return fe.validator=Y.validator!==void 0&&Y.validator!==null?e.Validator.fromPartial(Y.validator):void 0,fe.signedLastBlock=(be=Y.signedLastBlock)!=null?be:!1,fe}};function Jn(){return{validator:void 0,signedLastBlock:!1,voteExtension:new Uint8Array}}e.ExtendedVoteInfo={encode(Y,fe=j.Writer.create()){return Y.validator!==void 0&&e.Validator.encode(Y.validator,fe.uint32(10).fork()).ldelim(),Y.signedLastBlock===!0&&fe.uint32(16).bool(Y.signedLastBlock),Y.voteExtension.length!==0&&fe.uint32(26).bytes(Y.voteExtension),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Jn();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.validator=e.Validator.decode(be,be.uint32());break;case 2:ct.signedLastBlock=be.bool();break;case 3:ct.voteExtension=be.bytes();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{validator:(0,F.isSet)(Y.validator)?e.Validator.fromJSON(Y.validator):void 0,signedLastBlock:(0,F.isSet)(Y.signedLastBlock)?!!Y.signedLastBlock:!1,voteExtension:(0,F.isSet)(Y.voteExtension)?(0,F.bytesFromBase64)(Y.voteExtension):new Uint8Array}},toJSON(Y){let fe={};return Y.validator!==void 0&&(fe.validator=Y.validator?e.Validator.toJSON(Y.validator):void 0),Y.signedLastBlock!==void 0&&(fe.signedLastBlock=Y.signedLastBlock),Y.voteExtension!==void 0&&(fe.voteExtension=(0,F.base64FromBytes)(Y.voteExtension!==void 0?Y.voteExtension:new Uint8Array)),fe},fromPartial(Y){var be,qt;let fe=Jn();return fe.validator=Y.validator!==void 0&&Y.validator!==null?e.Validator.fromPartial(Y.validator):void 0,fe.signedLastBlock=(be=Y.signedLastBlock)!=null?be:!1,fe.voteExtension=(qt=Y.voteExtension)!=null?qt:new Uint8Array,fe}};function _r(){return{type:0,validator:void 0,height:F.Long.ZERO,time:void 0,totalVotingPower:F.Long.ZERO}}e.Misbehavior={encode(Y,fe=j.Writer.create()){return Y.type!==0&&fe.uint32(8).int32(Y.type),Y.validator!==void 0&&e.Validator.encode(Y.validator,fe.uint32(18).fork()).ldelim(),Y.height.isZero()||fe.uint32(24).int64(Y.height),Y.time!==void 0&&f.Timestamp.encode(Y.time,fe.uint32(34).fork()).ldelim(),Y.totalVotingPower.isZero()||fe.uint32(40).int64(Y.totalVotingPower),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=_r();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.type=be.int32();break;case 2:ct.validator=e.Validator.decode(be,be.uint32());break;case 3:ct.height=be.int64();break;case 4:ct.time=f.Timestamp.decode(be,be.uint32());break;case 5:ct.totalVotingPower=be.int64();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{type:(0,F.isSet)(Y.type)?se(Y.type):0,validator:(0,F.isSet)(Y.validator)?e.Validator.fromJSON(Y.validator):void 0,height:(0,F.isSet)(Y.height)?F.Long.fromValue(Y.height):F.Long.ZERO,time:(0,F.isSet)(Y.time)?(0,F.fromJsonTimestamp)(Y.time):void 0,totalVotingPower:(0,F.isSet)(Y.totalVotingPower)?F.Long.fromValue(Y.totalVotingPower):F.Long.ZERO}},toJSON(Y){let fe={};return Y.type!==void 0&&(fe.type=p(Y.type)),Y.validator!==void 0&&(fe.validator=Y.validator?e.Validator.toJSON(Y.validator):void 0),Y.height!==void 0&&(fe.height=(Y.height||F.Long.ZERO).toString()),Y.time!==void 0&&(fe.time=(0,F.fromTimestamp)(Y.time).toISOString()),Y.totalVotingPower!==void 0&&(fe.totalVotingPower=(Y.totalVotingPower||F.Long.ZERO).toString()),fe},fromPartial(Y){var be;let fe=_r();return fe.type=(be=Y.type)!=null?be:0,fe.validator=Y.validator!==void 0&&Y.validator!==null?e.Validator.fromPartial(Y.validator):void 0,fe.height=Y.height!==void 0&&Y.height!==null?F.Long.fromValue(Y.height):F.Long.ZERO,fe.time=Y.time!==void 0&&Y.time!==null?f.Timestamp.fromPartial(Y.time):void 0,fe.totalVotingPower=Y.totalVotingPower!==void 0&&Y.totalVotingPower!==null?F.Long.fromValue(Y.totalVotingPower):F.Long.ZERO,fe}};function Yn(){return{height:F.Long.UZERO,format:0,chunks:0,hash:new Uint8Array,metadata:new Uint8Array}}e.Snapshot={encode(Y,fe=j.Writer.create()){return Y.height.isZero()||fe.uint32(8).uint64(Y.height),Y.format!==0&&fe.uint32(16).uint32(Y.format),Y.chunks!==0&&fe.uint32(24).uint32(Y.chunks),Y.hash.length!==0&&fe.uint32(34).bytes(Y.hash),Y.metadata.length!==0&&fe.uint32(42).bytes(Y.metadata),fe},decode(Y,fe){let be=Y instanceof j.Reader?Y:new j.Reader(Y),qt=fe===void 0?be.len:be.pos+fe,ct=Yn();for(;be.pos<qt;){let Ft=be.uint32();switch(Ft>>>3){case 1:ct.height=be.uint64();break;case 2:ct.format=be.uint32();break;case 3:ct.chunks=be.uint32();break;case 4:ct.hash=be.bytes();break;case 5:ct.metadata=be.bytes();break;default:be.skipType(Ft&7);break}}return ct},fromJSON(Y){return{height:(0,F.isSet)(Y.height)?F.Long.fromValue(Y.height):F.Long.UZERO,format:(0,F.isSet)(Y.format)?Number(Y.format):0,chunks:(0,F.isSet)(Y.chunks)?Number(Y.chunks):0,hash:(0,F.isSet)(Y.hash)?(0,F.bytesFromBase64)(Y.hash):new Uint8Array,metadata:(0,F.isSet)(Y.metadata)?(0,F.bytesFromBase64)(Y.metadata):new Uint8Array}},toJSON(Y){let fe={};return Y.height!==void 0&&(fe.height=(Y.height||F.Long.UZERO).toString()),Y.format!==void 0&&(fe.format=Math.round(Y.format)),Y.chunks!==void 0&&(fe.chunks=Math.round(Y.chunks)),Y.hash!==void 0&&(fe.hash=(0,F.base64FromBytes)(Y.hash!==void 0?Y.hash:new Uint8Array)),Y.metadata!==void 0&&(fe.metadata=(0,F.base64FromBytes)(Y.metadata!==void 0?Y.metadata:new Uint8Array)),fe},fromPartial(Y){var be,qt,ct,Ft;let fe=Yn();return fe.height=Y.height!==void 0&&Y.height!==null?F.Long.fromValue(Y.height):F.Long.UZERO,fe.format=(be=Y.format)!=null?be:0,fe.chunks=(qt=Y.chunks)!=null?qt:0,fe.hash=(ct=Y.hash)!=null?ct:new Uint8Array,fe.metadata=(Ft=Y.metadata)!=null?Ft:new Uint8Array,fe}};class kn{constructor(fe){this.rpc=fe,this.Echo=this.Echo.bind(this),this.Flush=this.Flush.bind(this),this.Info=this.Info.bind(this),this.DeliverTx=this.DeliverTx.bind(this),this.CheckTx=this.CheckTx.bind(this),this.Query=this.Query.bind(this),this.Commit=this.Commit.bind(this),this.InitChain=this.InitChain.bind(this),this.BeginBlock=this.BeginBlock.bind(this),this.EndBlock=this.EndBlock.bind(this),this.ListSnapshots=this.ListSnapshots.bind(this),this.OfferSnapshot=this.OfferSnapshot.bind(this),this.LoadSnapshotChunk=this.LoadSnapshotChunk.bind(this),this.ApplySnapshotChunk=this.ApplySnapshotChunk.bind(this),this.PrepareProposal=this.PrepareProposal.bind(this),this.ProcessProposal=this.ProcessProposal.bind(this)}Echo(fe){let be=e.RequestEcho.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","Echo",be).then(ct=>e.ResponseEcho.decode(new j.Reader(ct)))}Flush(fe={}){let be=e.RequestFlush.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","Flush",be).then(ct=>e.ResponseFlush.decode(new j.Reader(ct)))}Info(fe){let be=e.RequestInfo.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","Info",be).then(ct=>e.ResponseInfo.decode(new j.Reader(ct)))}DeliverTx(fe){let be=e.RequestDeliverTx.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","DeliverTx",be).then(ct=>e.ResponseDeliverTx.decode(new j.Reader(ct)))}CheckTx(fe){let be=e.RequestCheckTx.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","CheckTx",be).then(ct=>e.ResponseCheckTx.decode(new j.Reader(ct)))}Query(fe){let be=e.RequestQuery.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","Query",be).then(ct=>e.ResponseQuery.decode(new j.Reader(ct)))}Commit(fe={}){let be=e.RequestCommit.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","Commit",be).then(ct=>e.ResponseCommit.decode(new j.Reader(ct)))}InitChain(fe){let be=e.RequestInitChain.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","InitChain",be).then(ct=>e.ResponseInitChain.decode(new j.Reader(ct)))}BeginBlock(fe){let be=e.RequestBeginBlock.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","BeginBlock",be).then(ct=>e.ResponseBeginBlock.decode(new j.Reader(ct)))}EndBlock(fe){let be=e.RequestEndBlock.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","EndBlock",be).then(ct=>e.ResponseEndBlock.decode(new j.Reader(ct)))}ListSnapshots(fe={}){let be=e.RequestListSnapshots.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","ListSnapshots",be).then(ct=>e.ResponseListSnapshots.decode(new j.Reader(ct)))}OfferSnapshot(fe){let be=e.RequestOfferSnapshot.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","OfferSnapshot",be).then(ct=>e.ResponseOfferSnapshot.decode(new j.Reader(ct)))}LoadSnapshotChunk(fe){let be=e.RequestLoadSnapshotChunk.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","LoadSnapshotChunk",be).then(ct=>e.ResponseLoadSnapshotChunk.decode(new j.Reader(ct)))}ApplySnapshotChunk(fe){let be=e.RequestApplySnapshotChunk.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","ApplySnapshotChunk",be).then(ct=>e.ResponseApplySnapshotChunk.decode(new j.Reader(ct)))}PrepareProposal(fe){let be=e.RequestPrepareProposal.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","PrepareProposal",be).then(ct=>e.ResponsePrepareProposal.decode(new j.Reader(ct)))}ProcessProposal(fe){let be=e.RequestProcessProposal.encode(fe).finish();return this.rpc.request("tendermint.abci.ABCIApplication","ProcessProposal",be).then(ct=>e.ResponseProcessProposal.decode(new j.Reader(ct)))}}e.ABCIApplicationClientImpl=kn})(vIn);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(D,W,ae,ye){ye===void 0&&(ye=ae);var Xe=Object.getOwnPropertyDescriptor(W,ae);(!Xe||("get"in Xe?!W.__esModule:Xe.writable||Xe.configurable))&&(Xe={enumerable:!0,get:function(){return W[ae]}}),Object.defineProperty(D,ye,Xe)}:function(D,W,ae,ye){ye===void 0&&(ye=ae),D[ye]=W[ae]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(D,W){Object.defineProperty(D,"default",{enumerable:!0,value:W})}:function(D,W){D.default=W}),c=Fr&&Fr.__importStar||function(D){if(D&&D.__esModule)return D;var W={};if(D!=null)for(var ae in D)ae!=="default"&&Object.prototype.hasOwnProperty.call(D,ae)&&i(W,D,ae);return A(W,D),W};Object.defineProperty(e,"__esModule",{value:!0}),e.ValidatorUpdates=e.Pool=e.RedelegationResponse=e.RedelegationEntryResponse=e.DelegationResponse=e.Params=e.Redelegation=e.RedelegationEntry=e.UnbondingDelegationEntry=e.UnbondingDelegation=e.Delegation=e.DVVTriplets=e.DVVTriplet=e.DVPairs=e.DVPair=e.ValAddresses=e.Validator=e.Description=e.Commission=e.CommissionRates=e.HistoricalInfo=e.infractionToJSON=e.infractionFromJSON=e.Infraction=e.bondStatusToJSON=e.bondStatusFromJSON=e.BondStatus=e.protobufPackage=void 0;let f=Yfe,l=k3,g=fh,w=MR,N=gg,F=vIn,j=Ns,te=c(BA);e.protobufPackage="cosmos.staking.v1beta1";var v;(function(D){D[D.BOND_STATUS_UNSPECIFIED=0]="BOND_STATUS_UNSPECIFIED",D[D.BOND_STATUS_UNBONDED=1]="BOND_STATUS_UNBONDED",D[D.BOND_STATUS_UNBONDING=2]="BOND_STATUS_UNBONDING",D[D.BOND_STATUS_BONDED=3]="BOND_STATUS_BONDED",D[D.UNRECOGNIZED=-1]="UNRECOGNIZED"})(v=e.BondStatus||(e.BondStatus={}));function ne(D){switch(D){case 0:case"BOND_STATUS_UNSPECIFIED":return v.BOND_STATUS_UNSPECIFIED;case 1:case"BOND_STATUS_UNBONDED":return v.BOND_STATUS_UNBONDED;case 2:case"BOND_STATUS_UNBONDING":return v.BOND_STATUS_UNBONDING;case 3:case"BOND_STATUS_BONDED":return v.BOND_STATUS_BONDED;case-1:case"UNRECOGNIZED":default:return v.UNRECOGNIZED}}e.bondStatusFromJSON=ne;function Z(D){switch(D){case v.BOND_STATUS_UNSPECIFIED:return"BOND_STATUS_UNSPECIFIED";case v.BOND_STATUS_UNBONDED:return"BOND_STATUS_UNBONDED";case v.BOND_STATUS_UNBONDING:return"BOND_STATUS_UNBONDING";case v.BOND_STATUS_BONDED:return"BOND_STATUS_BONDED";case v.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.bondStatusToJSON=Z;var R;(function(D){D[D.INFRACTION_UNSPECIFIED=0]="INFRACTION_UNSPECIFIED",D[D.INFRACTION_DOUBLE_SIGN=1]="INFRACTION_DOUBLE_SIGN",D[D.INFRACTION_DOWNTIME=2]="INFRACTION_DOWNTIME",D[D.UNRECOGNIZED=-1]="UNRECOGNIZED"})(R=e.Infraction||(e.Infraction={}));function M(D){switch(D){case 0:case"INFRACTION_UNSPECIFIED":return R.INFRACTION_UNSPECIFIED;case 1:case"INFRACTION_DOUBLE_SIGN":return R.INFRACTION_DOUBLE_SIGN;case 2:case"INFRACTION_DOWNTIME":return R.INFRACTION_DOWNTIME;case-1:case"UNRECOGNIZED":default:return R.UNRECOGNIZED}}e.infractionFromJSON=M;function U(D){switch(D){case R.INFRACTION_UNSPECIFIED:return"INFRACTION_UNSPECIFIED";case R.INFRACTION_DOUBLE_SIGN:return"INFRACTION_DOUBLE_SIGN";case R.INFRACTION_DOWNTIME:return"INFRACTION_DOWNTIME";case R.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.infractionToJSON=U;function E(){return{header:void 0,valset:[]}}e.HistoricalInfo={encode(D,W=te.Writer.create()){D.header!==void 0&&f.Header.encode(D.header,W.uint32(10).fork()).ldelim();for(let ae of D.valset)e.Validator.encode(ae,W.uint32(18).fork()).ldelim();return W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=E();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.header=f.Header.decode(ae,ae.uint32());break;case 2:Xe.valset.push(e.Validator.decode(ae,ae.uint32()));break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{header:(0,j.isSet)(D.header)?f.Header.fromJSON(D.header):void 0,valset:Array.isArray(D==null?void 0:D.valset)?D.valset.map(W=>e.Validator.fromJSON(W)):[]}},toJSON(D){let W={};return D.header!==void 0&&(W.header=D.header?f.Header.toJSON(D.header):void 0),D.valset?W.valset=D.valset.map(ae=>ae?e.Validator.toJSON(ae):void 0):W.valset=[],W},fromPartial(D){var ae;let W=E();return W.header=D.header!==void 0&&D.header!==null?f.Header.fromPartial(D.header):void 0,W.valset=((ae=D.valset)==null?void 0:ae.map(ye=>e.Validator.fromPartial(ye)))||[],W}};function Q(){return{rate:"",maxRate:"",maxChangeRate:""}}e.CommissionRates={encode(D,W=te.Writer.create()){return D.rate!==""&&W.uint32(10).string(D.rate),D.maxRate!==""&&W.uint32(18).string(D.maxRate),D.maxChangeRate!==""&&W.uint32(26).string(D.maxChangeRate),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=Q();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.rate=ae.string();break;case 2:Xe.maxRate=ae.string();break;case 3:Xe.maxChangeRate=ae.string();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{rate:(0,j.isSet)(D.rate)?String(D.rate):"",maxRate:(0,j.isSet)(D.maxRate)?String(D.maxRate):"",maxChangeRate:(0,j.isSet)(D.maxChangeRate)?String(D.maxChangeRate):""}},toJSON(D){let W={};return D.rate!==void 0&&(W.rate=D.rate),D.maxRate!==void 0&&(W.maxRate=D.maxRate),D.maxChangeRate!==void 0&&(W.maxChangeRate=D.maxChangeRate),W},fromPartial(D){var ae,ye,Xe;let W=Q();return W.rate=(ae=D.rate)!=null?ae:"",W.maxRate=(ye=D.maxRate)!=null?ye:"",W.maxChangeRate=(Xe=D.maxChangeRate)!=null?Xe:"",W}};function H(){return{commissionRates:void 0,updateTime:void 0}}e.Commission={encode(D,W=te.Writer.create()){return D.commissionRates!==void 0&&e.CommissionRates.encode(D.commissionRates,W.uint32(10).fork()).ldelim(),D.updateTime!==void 0&&l.Timestamp.encode(D.updateTime,W.uint32(18).fork()).ldelim(),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=H();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.commissionRates=e.CommissionRates.decode(ae,ae.uint32());break;case 2:Xe.updateTime=l.Timestamp.decode(ae,ae.uint32());break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{commissionRates:(0,j.isSet)(D.commissionRates)?e.CommissionRates.fromJSON(D.commissionRates):void 0,updateTime:(0,j.isSet)(D.updateTime)?(0,j.fromJsonTimestamp)(D.updateTime):void 0}},toJSON(D){let W={};return D.commissionRates!==void 0&&(W.commissionRates=D.commissionRates?e.CommissionRates.toJSON(D.commissionRates):void 0),D.updateTime!==void 0&&(W.updateTime=(0,j.fromTimestamp)(D.updateTime).toISOString()),W},fromPartial(D){let W=H();return W.commissionRates=D.commissionRates!==void 0&&D.commissionRates!==null?e.CommissionRates.fromPartial(D.commissionRates):void 0,W.updateTime=D.updateTime!==void 0&&D.updateTime!==null?l.Timestamp.fromPartial(D.updateTime):void 0,W}};function re(){return{moniker:"",identity:"",website:"",securityContact:"",details:""}}e.Description={encode(D,W=te.Writer.create()){return D.moniker!==""&&W.uint32(10).string(D.moniker),D.identity!==""&&W.uint32(18).string(D.identity),D.website!==""&&W.uint32(26).string(D.website),D.securityContact!==""&&W.uint32(34).string(D.securityContact),D.details!==""&&W.uint32(42).string(D.details),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=re();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.moniker=ae.string();break;case 2:Xe.identity=ae.string();break;case 3:Xe.website=ae.string();break;case 4:Xe.securityContact=ae.string();break;case 5:Xe.details=ae.string();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{moniker:(0,j.isSet)(D.moniker)?String(D.moniker):"",identity:(0,j.isSet)(D.identity)?String(D.identity):"",website:(0,j.isSet)(D.website)?String(D.website):"",securityContact:(0,j.isSet)(D.securityContact)?String(D.securityContact):"",details:(0,j.isSet)(D.details)?String(D.details):""}},toJSON(D){let W={};return D.moniker!==void 0&&(W.moniker=D.moniker),D.identity!==void 0&&(W.identity=D.identity),D.website!==void 0&&(W.website=D.website),D.securityContact!==void 0&&(W.securityContact=D.securityContact),D.details!==void 0&&(W.details=D.details),W},fromPartial(D){var ae,ye,Xe,nt,Ke;let W=re();return W.moniker=(ae=D.moniker)!=null?ae:"",W.identity=(ye=D.identity)!=null?ye:"",W.website=(Xe=D.website)!=null?Xe:"",W.securityContact=(nt=D.securityContact)!=null?nt:"",W.details=(Ke=D.details)!=null?Ke:"",W}};function ee(){return{operatorAddress:"",consensusPubkey:void 0,jailed:!1,status:0,tokens:"",delegatorShares:"",description:void 0,unbondingHeight:j.Long.ZERO,unbondingTime:void 0,commission:void 0,minSelfDelegation:"",unbondingOnHoldRefCount:j.Long.ZERO,unbondingIds:[]}}e.Validator={encode(D,W=te.Writer.create()){D.operatorAddress!==""&&W.uint32(10).string(D.operatorAddress),D.consensusPubkey!==void 0&&g.Any.encode(D.consensusPubkey,W.uint32(18).fork()).ldelim(),D.jailed===!0&&W.uint32(24).bool(D.jailed),D.status!==0&&W.uint32(32).int32(D.status),D.tokens!==""&&W.uint32(42).string(D.tokens),D.delegatorShares!==""&&W.uint32(50).string(D.delegatorShares),D.description!==void 0&&e.Description.encode(D.description,W.uint32(58).fork()).ldelim(),D.unbondingHeight.isZero()||W.uint32(64).int64(D.unbondingHeight),D.unbondingTime!==void 0&&l.Timestamp.encode(D.unbondingTime,W.uint32(74).fork()).ldelim(),D.commission!==void 0&&e.Commission.encode(D.commission,W.uint32(82).fork()).ldelim(),D.minSelfDelegation!==""&&W.uint32(90).string(D.minSelfDelegation),D.unbondingOnHoldRefCount.isZero()||W.uint32(96).int64(D.unbondingOnHoldRefCount),W.uint32(106).fork();for(let ae of D.unbondingIds)W.uint64(ae);return W.ldelim(),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=ee();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.operatorAddress=ae.string();break;case 2:Xe.consensusPubkey=g.Any.decode(ae,ae.uint32());break;case 3:Xe.jailed=ae.bool();break;case 4:Xe.status=ae.int32();break;case 5:Xe.tokens=ae.string();break;case 6:Xe.delegatorShares=ae.string();break;case 7:Xe.description=e.Description.decode(ae,ae.uint32());break;case 8:Xe.unbondingHeight=ae.int64();break;case 9:Xe.unbondingTime=l.Timestamp.decode(ae,ae.uint32());break;case 10:Xe.commission=e.Commission.decode(ae,ae.uint32());break;case 11:Xe.minSelfDelegation=ae.string();break;case 12:Xe.unbondingOnHoldRefCount=ae.int64();break;case 13:if((nt&7)===2){let Ke=ae.uint32()+ae.pos;for(;ae.pos<Ke;)Xe.unbondingIds.push(ae.uint64())}else Xe.unbondingIds.push(ae.uint64());break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{operatorAddress:(0,j.isSet)(D.operatorAddress)?String(D.operatorAddress):"",consensusPubkey:(0,j.isSet)(D.consensusPubkey)?g.Any.fromJSON(D.consensusPubkey):void 0,jailed:(0,j.isSet)(D.jailed)?!!D.jailed:!1,status:(0,j.isSet)(D.status)?ne(D.status):0,tokens:(0,j.isSet)(D.tokens)?String(D.tokens):"",delegatorShares:(0,j.isSet)(D.delegatorShares)?String(D.delegatorShares):"",description:(0,j.isSet)(D.description)?e.Description.fromJSON(D.description):void 0,unbondingHeight:(0,j.isSet)(D.unbondingHeight)?j.Long.fromValue(D.unbondingHeight):j.Long.ZERO,unbondingTime:(0,j.isSet)(D.unbondingTime)?(0,j.fromJsonTimestamp)(D.unbondingTime):void 0,commission:(0,j.isSet)(D.commission)?e.Commission.fromJSON(D.commission):void 0,minSelfDelegation:(0,j.isSet)(D.minSelfDelegation)?String(D.minSelfDelegation):"",unbondingOnHoldRefCount:(0,j.isSet)(D.unbondingOnHoldRefCount)?j.Long.fromValue(D.unbondingOnHoldRefCount):j.Long.ZERO,unbondingIds:Array.isArray(D==null?void 0:D.unbondingIds)?D.unbondingIds.map(W=>j.Long.fromValue(W)):[]}},toJSON(D){let W={};return D.operatorAddress!==void 0&&(W.operatorAddress=D.operatorAddress),D.consensusPubkey!==void 0&&(W.consensusPubkey=D.consensusPubkey?g.Any.toJSON(D.consensusPubkey):void 0),D.jailed!==void 0&&(W.jailed=D.jailed),D.status!==void 0&&(W.status=Z(D.status)),D.tokens!==void 0&&(W.tokens=D.tokens),D.delegatorShares!==void 0&&(W.delegatorShares=D.delegatorShares),D.description!==void 0&&(W.description=D.description?e.Description.toJSON(D.description):void 0),D.unbondingHeight!==void 0&&(W.unbondingHeight=(D.unbondingHeight||j.Long.ZERO).toString()),D.unbondingTime!==void 0&&(W.unbondingTime=(0,j.fromTimestamp)(D.unbondingTime).toISOString()),D.commission!==void 0&&(W.commission=D.commission?e.Commission.toJSON(D.commission):void 0),D.minSelfDelegation!==void 0&&(W.minSelfDelegation=D.minSelfDelegation),D.unbondingOnHoldRefCount!==void 0&&(W.unbondingOnHoldRefCount=(D.unbondingOnHoldRefCount||j.Long.ZERO).toString()),D.unbondingIds?W.unbondingIds=D.unbondingIds.map(ae=>(ae||j.Long.UZERO).toString()):W.unbondingIds=[],W},fromPartial(D){var ae,ye,Xe,nt,Ke,It,rt;let W=ee();return W.operatorAddress=(ae=D.operatorAddress)!=null?ae:"",W.consensusPubkey=D.consensusPubkey!==void 0&&D.consensusPubkey!==null?g.Any.fromPartial(D.consensusPubkey):void 0,W.jailed=(ye=D.jailed)!=null?ye:!1,W.status=(Xe=D.status)!=null?Xe:0,W.tokens=(nt=D.tokens)!=null?nt:"",W.delegatorShares=(Ke=D.delegatorShares)!=null?Ke:"",W.description=D.description!==void 0&&D.description!==null?e.Description.fromPartial(D.description):void 0,W.unbondingHeight=D.unbondingHeight!==void 0&&D.unbondingHeight!==null?j.Long.fromValue(D.unbondingHeight):j.Long.ZERO,W.unbondingTime=D.unbondingTime!==void 0&&D.unbondingTime!==null?l.Timestamp.fromPartial(D.unbondingTime):void 0,W.commission=D.commission!==void 0&&D.commission!==null?e.Commission.fromPartial(D.commission):void 0,W.minSelfDelegation=(It=D.minSelfDelegation)!=null?It:"",W.unbondingOnHoldRefCount=D.unbondingOnHoldRefCount!==void 0&&D.unbondingOnHoldRefCount!==null?j.Long.fromValue(D.unbondingOnHoldRefCount):j.Long.ZERO,W.unbondingIds=((rt=D.unbondingIds)==null?void 0:rt.map(ut=>j.Long.fromValue(ut)))||[],W}};function T(){return{addresses:[]}}e.ValAddresses={encode(D,W=te.Writer.create()){for(let ae of D.addresses)W.uint32(10).string(ae);return W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=T();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.addresses.push(ae.string());break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{addresses:Array.isArray(D==null?void 0:D.addresses)?D.addresses.map(W=>String(W)):[]}},toJSON(D){let W={};return D.addresses?W.addresses=D.addresses.map(ae=>ae):W.addresses=[],W},fromPartial(D){var ae;let W=T();return W.addresses=((ae=D.addresses)==null?void 0:ae.map(ye=>ye))||[],W}};function se(){return{delegatorAddress:"",validatorAddress:""}}e.DVPair={encode(D,W=te.Writer.create()){return D.delegatorAddress!==""&&W.uint32(10).string(D.delegatorAddress),D.validatorAddress!==""&&W.uint32(18).string(D.validatorAddress),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=se();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.delegatorAddress=ae.string();break;case 2:Xe.validatorAddress=ae.string();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{delegatorAddress:(0,j.isSet)(D.delegatorAddress)?String(D.delegatorAddress):"",validatorAddress:(0,j.isSet)(D.validatorAddress)?String(D.validatorAddress):""}},toJSON(D){let W={};return D.delegatorAddress!==void 0&&(W.delegatorAddress=D.delegatorAddress),D.validatorAddress!==void 0&&(W.validatorAddress=D.validatorAddress),W},fromPartial(D){var ae,ye;let W=se();return W.delegatorAddress=(ae=D.delegatorAddress)!=null?ae:"",W.validatorAddress=(ye=D.validatorAddress)!=null?ye:"",W}};function p(){return{pairs:[]}}e.DVPairs={encode(D,W=te.Writer.create()){for(let ae of D.pairs)e.DVPair.encode(ae,W.uint32(10).fork()).ldelim();return W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=p();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.pairs.push(e.DVPair.decode(ae,ae.uint32()));break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{pairs:Array.isArray(D==null?void 0:D.pairs)?D.pairs.map(W=>e.DVPair.fromJSON(W)):[]}},toJSON(D){let W={};return D.pairs?W.pairs=D.pairs.map(ae=>ae?e.DVPair.toJSON(ae):void 0):W.pairs=[],W},fromPartial(D){var ae;let W=p();return W.pairs=((ae=D.pairs)==null?void 0:ae.map(ye=>e.DVPair.fromPartial(ye)))||[],W}};function L(){return{delegatorAddress:"",validatorSrcAddress:"",validatorDstAddress:""}}e.DVVTriplet={encode(D,W=te.Writer.create()){return D.delegatorAddress!==""&&W.uint32(10).string(D.delegatorAddress),D.validatorSrcAddress!==""&&W.uint32(18).string(D.validatorSrcAddress),D.validatorDstAddress!==""&&W.uint32(26).string(D.validatorDstAddress),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=L();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.delegatorAddress=ae.string();break;case 2:Xe.validatorSrcAddress=ae.string();break;case 3:Xe.validatorDstAddress=ae.string();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{delegatorAddress:(0,j.isSet)(D.delegatorAddress)?String(D.delegatorAddress):"",validatorSrcAddress:(0,j.isSet)(D.validatorSrcAddress)?String(D.validatorSrcAddress):"",validatorDstAddress:(0,j.isSet)(D.validatorDstAddress)?String(D.validatorDstAddress):""}},toJSON(D){let W={};return D.delegatorAddress!==void 0&&(W.delegatorAddress=D.delegatorAddress),D.validatorSrcAddress!==void 0&&(W.validatorSrcAddress=D.validatorSrcAddress),D.validatorDstAddress!==void 0&&(W.validatorDstAddress=D.validatorDstAddress),W},fromPartial(D){var ae,ye,Xe;let W=L();return W.delegatorAddress=(ae=D.delegatorAddress)!=null?ae:"",W.validatorSrcAddress=(ye=D.validatorSrcAddress)!=null?ye:"",W.validatorDstAddress=(Xe=D.validatorDstAddress)!=null?Xe:"",W}};function V(){return{triplets:[]}}e.DVVTriplets={encode(D,W=te.Writer.create()){for(let ae of D.triplets)e.DVVTriplet.encode(ae,W.uint32(10).fork()).ldelim();return W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=V();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.triplets.push(e.DVVTriplet.decode(ae,ae.uint32()));break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{triplets:Array.isArray(D==null?void 0:D.triplets)?D.triplets.map(W=>e.DVVTriplet.fromJSON(W)):[]}},toJSON(D){let W={};return D.triplets?W.triplets=D.triplets.map(ae=>ae?e.DVVTriplet.toJSON(ae):void 0):W.triplets=[],W},fromPartial(D){var ae;let W=V();return W.triplets=((ae=D.triplets)==null?void 0:ae.map(ye=>e.DVVTriplet.fromPartial(ye)))||[],W}};function K(){return{delegatorAddress:"",validatorAddress:"",shares:""}}e.Delegation={encode(D,W=te.Writer.create()){return D.delegatorAddress!==""&&W.uint32(10).string(D.delegatorAddress),D.validatorAddress!==""&&W.uint32(18).string(D.validatorAddress),D.shares!==""&&W.uint32(26).string(D.shares),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=K();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.delegatorAddress=ae.string();break;case 2:Xe.validatorAddress=ae.string();break;case 3:Xe.shares=ae.string();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{delegatorAddress:(0,j.isSet)(D.delegatorAddress)?String(D.delegatorAddress):"",validatorAddress:(0,j.isSet)(D.validatorAddress)?String(D.validatorAddress):"",shares:(0,j.isSet)(D.shares)?String(D.shares):""}},toJSON(D){let W={};return D.delegatorAddress!==void 0&&(W.delegatorAddress=D.delegatorAddress),D.validatorAddress!==void 0&&(W.validatorAddress=D.validatorAddress),D.shares!==void 0&&(W.shares=D.shares),W},fromPartial(D){var ae,ye,Xe;let W=K();return W.delegatorAddress=(ae=D.delegatorAddress)!=null?ae:"",W.validatorAddress=(ye=D.validatorAddress)!=null?ye:"",W.shares=(Xe=D.shares)!=null?Xe:"",W}};function m(){return{delegatorAddress:"",validatorAddress:"",entries:[]}}e.UnbondingDelegation={encode(D,W=te.Writer.create()){D.delegatorAddress!==""&&W.uint32(10).string(D.delegatorAddress),D.validatorAddress!==""&&W.uint32(18).string(D.validatorAddress);for(let ae of D.entries)e.UnbondingDelegationEntry.encode(ae,W.uint32(26).fork()).ldelim();return W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=m();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.delegatorAddress=ae.string();break;case 2:Xe.validatorAddress=ae.string();break;case 3:Xe.entries.push(e.UnbondingDelegationEntry.decode(ae,ae.uint32()));break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{delegatorAddress:(0,j.isSet)(D.delegatorAddress)?String(D.delegatorAddress):"",validatorAddress:(0,j.isSet)(D.validatorAddress)?String(D.validatorAddress):"",entries:Array.isArray(D==null?void 0:D.entries)?D.entries.map(W=>e.UnbondingDelegationEntry.fromJSON(W)):[]}},toJSON(D){let W={};return D.delegatorAddress!==void 0&&(W.delegatorAddress=D.delegatorAddress),D.validatorAddress!==void 0&&(W.validatorAddress=D.validatorAddress),D.entries?W.entries=D.entries.map(ae=>ae?e.UnbondingDelegationEntry.toJSON(ae):void 0):W.entries=[],W},fromPartial(D){var ae,ye,Xe;let W=m();return W.delegatorAddress=(ae=D.delegatorAddress)!=null?ae:"",W.validatorAddress=(ye=D.validatorAddress)!=null?ye:"",W.entries=((Xe=D.entries)==null?void 0:Xe.map(nt=>e.UnbondingDelegationEntry.fromPartial(nt)))||[],W}};function h(){return{creationHeight:j.Long.ZERO,completionTime:void 0,initialBalance:"",balance:"",unbondingId:j.Long.UZERO,unbondingOnHoldRefCount:j.Long.ZERO}}e.UnbondingDelegationEntry={encode(D,W=te.Writer.create()){return D.creationHeight.isZero()||W.uint32(8).int64(D.creationHeight),D.completionTime!==void 0&&l.Timestamp.encode(D.completionTime,W.uint32(18).fork()).ldelim(),D.initialBalance!==""&&W.uint32(26).string(D.initialBalance),D.balance!==""&&W.uint32(34).string(D.balance),D.unbondingId.isZero()||W.uint32(40).uint64(D.unbondingId),D.unbondingOnHoldRefCount.isZero()||W.uint32(48).int64(D.unbondingOnHoldRefCount),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=h();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.creationHeight=ae.int64();break;case 2:Xe.completionTime=l.Timestamp.decode(ae,ae.uint32());break;case 3:Xe.initialBalance=ae.string();break;case 4:Xe.balance=ae.string();break;case 5:Xe.unbondingId=ae.uint64();break;case 6:Xe.unbondingOnHoldRefCount=ae.int64();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{creationHeight:(0,j.isSet)(D.creationHeight)?j.Long.fromValue(D.creationHeight):j.Long.ZERO,completionTime:(0,j.isSet)(D.completionTime)?(0,j.fromJsonTimestamp)(D.completionTime):void 0,initialBalance:(0,j.isSet)(D.initialBalance)?String(D.initialBalance):"",balance:(0,j.isSet)(D.balance)?String(D.balance):"",unbondingId:(0,j.isSet)(D.unbondingId)?j.Long.fromValue(D.unbondingId):j.Long.UZERO,unbondingOnHoldRefCount:(0,j.isSet)(D.unbondingOnHoldRefCount)?j.Long.fromValue(D.unbondingOnHoldRefCount):j.Long.ZERO}},toJSON(D){let W={};return D.creationHeight!==void 0&&(W.creationHeight=(D.creationHeight||j.Long.ZERO).toString()),D.completionTime!==void 0&&(W.completionTime=(0,j.fromTimestamp)(D.completionTime).toISOString()),D.initialBalance!==void 0&&(W.initialBalance=D.initialBalance),D.balance!==void 0&&(W.balance=D.balance),D.unbondingId!==void 0&&(W.unbondingId=(D.unbondingId||j.Long.UZERO).toString()),D.unbondingOnHoldRefCount!==void 0&&(W.unbondingOnHoldRefCount=(D.unbondingOnHoldRefCount||j.Long.ZERO).toString()),W},fromPartial(D){var ae,ye;let W=h();return W.creationHeight=D.creationHeight!==void 0&&D.creationHeight!==null?j.Long.fromValue(D.creationHeight):j.Long.ZERO,W.completionTime=D.completionTime!==void 0&&D.completionTime!==null?l.Timestamp.fromPartial(D.completionTime):void 0,W.initialBalance=(ae=D.initialBalance)!=null?ae:"",W.balance=(ye=D.balance)!=null?ye:"",W.unbondingId=D.unbondingId!==void 0&&D.unbondingId!==null?j.Long.fromValue(D.unbondingId):j.Long.UZERO,W.unbondingOnHoldRefCount=D.unbondingOnHoldRefCount!==void 0&&D.unbondingOnHoldRefCount!==null?j.Long.fromValue(D.unbondingOnHoldRefCount):j.Long.ZERO,W}};function _(){return{creationHeight:j.Long.ZERO,completionTime:void 0,initialBalance:"",sharesDst:"",unbondingId:j.Long.UZERO,unbondingOnHoldRefCount:j.Long.ZERO}}e.RedelegationEntry={encode(D,W=te.Writer.create()){return D.creationHeight.isZero()||W.uint32(8).int64(D.creationHeight),D.completionTime!==void 0&&l.Timestamp.encode(D.completionTime,W.uint32(18).fork()).ldelim(),D.initialBalance!==""&&W.uint32(26).string(D.initialBalance),D.sharesDst!==""&&W.uint32(34).string(D.sharesDst),D.unbondingId.isZero()||W.uint32(40).uint64(D.unbondingId),D.unbondingOnHoldRefCount.isZero()||W.uint32(48).int64(D.unbondingOnHoldRefCount),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=_();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.creationHeight=ae.int64();break;case 2:Xe.completionTime=l.Timestamp.decode(ae,ae.uint32());break;case 3:Xe.initialBalance=ae.string();break;case 4:Xe.sharesDst=ae.string();break;case 5:Xe.unbondingId=ae.uint64();break;case 6:Xe.unbondingOnHoldRefCount=ae.int64();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{creationHeight:(0,j.isSet)(D.creationHeight)?j.Long.fromValue(D.creationHeight):j.Long.ZERO,completionTime:(0,j.isSet)(D.completionTime)?(0,j.fromJsonTimestamp)(D.completionTime):void 0,initialBalance:(0,j.isSet)(D.initialBalance)?String(D.initialBalance):"",sharesDst:(0,j.isSet)(D.sharesDst)?String(D.sharesDst):"",unbondingId:(0,j.isSet)(D.unbondingId)?j.Long.fromValue(D.unbondingId):j.Long.UZERO,unbondingOnHoldRefCount:(0,j.isSet)(D.unbondingOnHoldRefCount)?j.Long.fromValue(D.unbondingOnHoldRefCount):j.Long.ZERO}},toJSON(D){let W={};return D.creationHeight!==void 0&&(W.creationHeight=(D.creationHeight||j.Long.ZERO).toString()),D.completionTime!==void 0&&(W.completionTime=(0,j.fromTimestamp)(D.completionTime).toISOString()),D.initialBalance!==void 0&&(W.initialBalance=D.initialBalance),D.sharesDst!==void 0&&(W.sharesDst=D.sharesDst),D.unbondingId!==void 0&&(W.unbondingId=(D.unbondingId||j.Long.UZERO).toString()),D.unbondingOnHoldRefCount!==void 0&&(W.unbondingOnHoldRefCount=(D.unbondingOnHoldRefCount||j.Long.ZERO).toString()),W},fromPartial(D){var ae,ye;let W=_();return W.creationHeight=D.creationHeight!==void 0&&D.creationHeight!==null?j.Long.fromValue(D.creationHeight):j.Long.ZERO,W.completionTime=D.completionTime!==void 0&&D.completionTime!==null?l.Timestamp.fromPartial(D.completionTime):void 0,W.initialBalance=(ae=D.initialBalance)!=null?ae:"",W.sharesDst=(ye=D.sharesDst)!=null?ye:"",W.unbondingId=D.unbondingId!==void 0&&D.unbondingId!==null?j.Long.fromValue(D.unbondingId):j.Long.UZERO,W.unbondingOnHoldRefCount=D.unbondingOnHoldRefCount!==void 0&&D.unbondingOnHoldRefCount!==null?j.Long.fromValue(D.unbondingOnHoldRefCount):j.Long.ZERO,W}};function b(){return{delegatorAddress:"",validatorSrcAddress:"",validatorDstAddress:"",entries:[]}}e.Redelegation={encode(D,W=te.Writer.create()){D.delegatorAddress!==""&&W.uint32(10).string(D.delegatorAddress),D.validatorSrcAddress!==""&&W.uint32(18).string(D.validatorSrcAddress),D.validatorDstAddress!==""&&W.uint32(26).string(D.validatorDstAddress);for(let ae of D.entries)e.RedelegationEntry.encode(ae,W.uint32(34).fork()).ldelim();return W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=b();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.delegatorAddress=ae.string();break;case 2:Xe.validatorSrcAddress=ae.string();break;case 3:Xe.validatorDstAddress=ae.string();break;case 4:Xe.entries.push(e.RedelegationEntry.decode(ae,ae.uint32()));break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{delegatorAddress:(0,j.isSet)(D.delegatorAddress)?String(D.delegatorAddress):"",validatorSrcAddress:(0,j.isSet)(D.validatorSrcAddress)?String(D.validatorSrcAddress):"",validatorDstAddress:(0,j.isSet)(D.validatorDstAddress)?String(D.validatorDstAddress):"",entries:Array.isArray(D==null?void 0:D.entries)?D.entries.map(W=>e.RedelegationEntry.fromJSON(W)):[]}},toJSON(D){let W={};return D.delegatorAddress!==void 0&&(W.delegatorAddress=D.delegatorAddress),D.validatorSrcAddress!==void 0&&(W.validatorSrcAddress=D.validatorSrcAddress),D.validatorDstAddress!==void 0&&(W.validatorDstAddress=D.validatorDstAddress),D.entries?W.entries=D.entries.map(ae=>ae?e.RedelegationEntry.toJSON(ae):void 0):W.entries=[],W},fromPartial(D){var ae,ye,Xe,nt;let W=b();return W.delegatorAddress=(ae=D.delegatorAddress)!=null?ae:"",W.validatorSrcAddress=(ye=D.validatorSrcAddress)!=null?ye:"",W.validatorDstAddress=(Xe=D.validatorDstAddress)!=null?Xe:"",W.entries=((nt=D.entries)==null?void 0:nt.map(Ke=>e.RedelegationEntry.fromPartial(Ke)))||[],W}};function O(){return{unbondingTime:void 0,maxValidators:0,maxEntries:0,historicalEntries:0,bondDenom:"",minCommissionRate:""}}e.Params={encode(D,W=te.Writer.create()){return D.unbondingTime!==void 0&&w.Duration.encode(D.unbondingTime,W.uint32(10).fork()).ldelim(),D.maxValidators!==0&&W.uint32(16).uint32(D.maxValidators),D.maxEntries!==0&&W.uint32(24).uint32(D.maxEntries),D.historicalEntries!==0&&W.uint32(32).uint32(D.historicalEntries),D.bondDenom!==""&&W.uint32(42).string(D.bondDenom),D.minCommissionRate!==""&&W.uint32(50).string(D.minCommissionRate),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=O();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.unbondingTime=w.Duration.decode(ae,ae.uint32());break;case 2:Xe.maxValidators=ae.uint32();break;case 3:Xe.maxEntries=ae.uint32();break;case 4:Xe.historicalEntries=ae.uint32();break;case 5:Xe.bondDenom=ae.string();break;case 6:Xe.minCommissionRate=ae.string();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{unbondingTime:(0,j.isSet)(D.unbondingTime)?w.Duration.fromJSON(D.unbondingTime):void 0,maxValidators:(0,j.isSet)(D.maxValidators)?Number(D.maxValidators):0,maxEntries:(0,j.isSet)(D.maxEntries)?Number(D.maxEntries):0,historicalEntries:(0,j.isSet)(D.historicalEntries)?Number(D.historicalEntries):0,bondDenom:(0,j.isSet)(D.bondDenom)?String(D.bondDenom):"",minCommissionRate:(0,j.isSet)(D.minCommissionRate)?String(D.minCommissionRate):""}},toJSON(D){let W={};return D.unbondingTime!==void 0&&(W.unbondingTime=D.unbondingTime?w.Duration.toJSON(D.unbondingTime):void 0),D.maxValidators!==void 0&&(W.maxValidators=Math.round(D.maxValidators)),D.maxEntries!==void 0&&(W.maxEntries=Math.round(D.maxEntries)),D.historicalEntries!==void 0&&(W.historicalEntries=Math.round(D.historicalEntries)),D.bondDenom!==void 0&&(W.bondDenom=D.bondDenom),D.minCommissionRate!==void 0&&(W.minCommissionRate=D.minCommissionRate),W},fromPartial(D){var ae,ye,Xe,nt,Ke;let W=O();return W.unbondingTime=D.unbondingTime!==void 0&&D.unbondingTime!==null?w.Duration.fromPartial(D.unbondingTime):void 0,W.maxValidators=(ae=D.maxValidators)!=null?ae:0,W.maxEntries=(ye=D.maxEntries)!=null?ye:0,W.historicalEntries=(Xe=D.historicalEntries)!=null?Xe:0,W.bondDenom=(nt=D.bondDenom)!=null?nt:"",W.minCommissionRate=(Ke=D.minCommissionRate)!=null?Ke:"",W}};function J(){return{delegation:void 0,balance:void 0}}e.DelegationResponse={encode(D,W=te.Writer.create()){return D.delegation!==void 0&&e.Delegation.encode(D.delegation,W.uint32(10).fork()).ldelim(),D.balance!==void 0&&N.Coin.encode(D.balance,W.uint32(18).fork()).ldelim(),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=J();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.delegation=e.Delegation.decode(ae,ae.uint32());break;case 2:Xe.balance=N.Coin.decode(ae,ae.uint32());break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{delegation:(0,j.isSet)(D.delegation)?e.Delegation.fromJSON(D.delegation):void 0,balance:(0,j.isSet)(D.balance)?N.Coin.fromJSON(D.balance):void 0}},toJSON(D){let W={};return D.delegation!==void 0&&(W.delegation=D.delegation?e.Delegation.toJSON(D.delegation):void 0),D.balance!==void 0&&(W.balance=D.balance?N.Coin.toJSON(D.balance):void 0),W},fromPartial(D){let W=J();return W.delegation=D.delegation!==void 0&&D.delegation!==null?e.Delegation.fromPartial(D.delegation):void 0,W.balance=D.balance!==void 0&&D.balance!==null?N.Coin.fromPartial(D.balance):void 0,W}};function ie(){return{redelegationEntry:void 0,balance:""}}e.RedelegationEntryResponse={encode(D,W=te.Writer.create()){return D.redelegationEntry!==void 0&&e.RedelegationEntry.encode(D.redelegationEntry,W.uint32(10).fork()).ldelim(),D.balance!==""&&W.uint32(34).string(D.balance),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=ie();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.redelegationEntry=e.RedelegationEntry.decode(ae,ae.uint32());break;case 4:Xe.balance=ae.string();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{redelegationEntry:(0,j.isSet)(D.redelegationEntry)?e.RedelegationEntry.fromJSON(D.redelegationEntry):void 0,balance:(0,j.isSet)(D.balance)?String(D.balance):""}},toJSON(D){let W={};return D.redelegationEntry!==void 0&&(W.redelegationEntry=D.redelegationEntry?e.RedelegationEntry.toJSON(D.redelegationEntry):void 0),D.balance!==void 0&&(W.balance=D.balance),W},fromPartial(D){var ae;let W=ie();return W.redelegationEntry=D.redelegationEntry!==void 0&&D.redelegationEntry!==null?e.RedelegationEntry.fromPartial(D.redelegationEntry):void 0,W.balance=(ae=D.balance)!=null?ae:"",W}};function G(){return{redelegation:void 0,entries:[]}}e.RedelegationResponse={encode(D,W=te.Writer.create()){D.redelegation!==void 0&&e.Redelegation.encode(D.redelegation,W.uint32(10).fork()).ldelim();for(let ae of D.entries)e.RedelegationEntryResponse.encode(ae,W.uint32(18).fork()).ldelim();return W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=G();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.redelegation=e.Redelegation.decode(ae,ae.uint32());break;case 2:Xe.entries.push(e.RedelegationEntryResponse.decode(ae,ae.uint32()));break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{redelegation:(0,j.isSet)(D.redelegation)?e.Redelegation.fromJSON(D.redelegation):void 0,entries:Array.isArray(D==null?void 0:D.entries)?D.entries.map(W=>e.RedelegationEntryResponse.fromJSON(W)):[]}},toJSON(D){let W={};return D.redelegation!==void 0&&(W.redelegation=D.redelegation?e.Redelegation.toJSON(D.redelegation):void 0),D.entries?W.entries=D.entries.map(ae=>ae?e.RedelegationEntryResponse.toJSON(ae):void 0):W.entries=[],W},fromPartial(D){var ae;let W=G();return W.redelegation=D.redelegation!==void 0&&D.redelegation!==null?e.Redelegation.fromPartial(D.redelegation):void 0,W.entries=((ae=D.entries)==null?void 0:ae.map(ye=>e.RedelegationEntryResponse.fromPartial(ye)))||[],W}};function I(){return{notBondedTokens:"",bondedTokens:""}}e.Pool={encode(D,W=te.Writer.create()){return D.notBondedTokens!==""&&W.uint32(10).string(D.notBondedTokens),D.bondedTokens!==""&&W.uint32(18).string(D.bondedTokens),W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=I();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.notBondedTokens=ae.string();break;case 2:Xe.bondedTokens=ae.string();break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{notBondedTokens:(0,j.isSet)(D.notBondedTokens)?String(D.notBondedTokens):"",bondedTokens:(0,j.isSet)(D.bondedTokens)?String(D.bondedTokens):""}},toJSON(D){let W={};return D.notBondedTokens!==void 0&&(W.notBondedTokens=D.notBondedTokens),D.bondedTokens!==void 0&&(W.bondedTokens=D.bondedTokens),W},fromPartial(D){var ae,ye;let W=I();return W.notBondedTokens=(ae=D.notBondedTokens)!=null?ae:"",W.bondedTokens=(ye=D.bondedTokens)!=null?ye:"",W}};function C(){return{updates:[]}}e.ValidatorUpdates={encode(D,W=te.Writer.create()){for(let ae of D.updates)F.ValidatorUpdate.encode(ae,W.uint32(10).fork()).ldelim();return W},decode(D,W){let ae=D instanceof te.Reader?D:new te.Reader(D),ye=W===void 0?ae.len:ae.pos+W,Xe=C();for(;ae.pos<ye;){let nt=ae.uint32();switch(nt>>>3){case 1:Xe.updates.push(F.ValidatorUpdate.decode(ae,ae.uint32()));break;default:ae.skipType(nt&7);break}}return Xe},fromJSON(D){return{updates:Array.isArray(D==null?void 0:D.updates)?D.updates.map(W=>F.ValidatorUpdate.fromJSON(W)):[]}},toJSON(D){let W={};return D.updates?W.updates=D.updates.map(ae=>ae?F.ValidatorUpdate.toJSON(ae):void 0):W.updates=[],W},fromPartial(D){var ae;let W=C();return W.updates=((ae=D.updates)==null?void 0:ae.map(ye=>F.ValidatorUpdate.fromPartial(ye)))||[],W}}})(BIn);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(p,L,V,K){K===void 0&&(K=V);var m=Object.getOwnPropertyDescriptor(L,V);(!m||("get"in m?!L.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return L[V]}}),Object.defineProperty(p,K,m)}:function(p,L,V,K){K===void 0&&(K=V),p[K]=L[V]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(p,L){Object.defineProperty(p,"default",{enumerable:!0,value:L})}:function(p,L){p.default=L}),c=Fr&&Fr.__importStar||function(p){if(p&&p.__esModule)return p;var L={};if(p!=null)for(var V in p)V!=="default"&&Object.prototype.hasOwnProperty.call(p,V)&&i(L,p,V);return A(L,p),L};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgUpdateParamsResponse=e.MsgUpdateParams=e.MsgCancelUnbondingDelegationResponse=e.MsgCancelUnbondingDelegation=e.MsgUndelegateResponse=e.MsgUndelegate=e.MsgBeginRedelegateResponse=e.MsgBeginRedelegate=e.MsgDelegateResponse=e.MsgDelegate=e.MsgEditValidatorResponse=e.MsgEditValidator=e.MsgCreateValidatorResponse=e.MsgCreateValidator=e.protobufPackage=void 0;let f=BIn,l=fh,g=gg,w=k3,N=Ns,F=c(BA);e.protobufPackage="cosmos.staking.v1beta1";function j(){return{description:void 0,commission:void 0,minSelfDelegation:"",delegatorAddress:"",validatorAddress:"",pubkey:void 0,value:void 0}}e.MsgCreateValidator={encode(p,L=F.Writer.create()){return p.description!==void 0&&f.Description.encode(p.description,L.uint32(10).fork()).ldelim(),p.commission!==void 0&&f.CommissionRates.encode(p.commission,L.uint32(18).fork()).ldelim(),p.minSelfDelegation!==""&&L.uint32(26).string(p.minSelfDelegation),p.delegatorAddress!==""&&L.uint32(34).string(p.delegatorAddress),p.validatorAddress!==""&&L.uint32(42).string(p.validatorAddress),p.pubkey!==void 0&&l.Any.encode(p.pubkey,L.uint32(50).fork()).ldelim(),p.value!==void 0&&g.Coin.encode(p.value,L.uint32(58).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=j();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.description=f.Description.decode(V,V.uint32());break;case 2:m.commission=f.CommissionRates.decode(V,V.uint32());break;case 3:m.minSelfDelegation=V.string();break;case 4:m.delegatorAddress=V.string();break;case 5:m.validatorAddress=V.string();break;case 6:m.pubkey=l.Any.decode(V,V.uint32());break;case 7:m.value=g.Coin.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{description:(0,N.isSet)(p.description)?f.Description.fromJSON(p.description):void 0,commission:(0,N.isSet)(p.commission)?f.CommissionRates.fromJSON(p.commission):void 0,minSelfDelegation:(0,N.isSet)(p.minSelfDelegation)?String(p.minSelfDelegation):"",delegatorAddress:(0,N.isSet)(p.delegatorAddress)?String(p.delegatorAddress):"",validatorAddress:(0,N.isSet)(p.validatorAddress)?String(p.validatorAddress):"",pubkey:(0,N.isSet)(p.pubkey)?l.Any.fromJSON(p.pubkey):void 0,value:(0,N.isSet)(p.value)?g.Coin.fromJSON(p.value):void 0}},toJSON(p){let L={};return p.description!==void 0&&(L.description=p.description?f.Description.toJSON(p.description):void 0),p.commission!==void 0&&(L.commission=p.commission?f.CommissionRates.toJSON(p.commission):void 0),p.minSelfDelegation!==void 0&&(L.minSelfDelegation=p.minSelfDelegation),p.delegatorAddress!==void 0&&(L.delegatorAddress=p.delegatorAddress),p.validatorAddress!==void 0&&(L.validatorAddress=p.validatorAddress),p.pubkey!==void 0&&(L.pubkey=p.pubkey?l.Any.toJSON(p.pubkey):void 0),p.value!==void 0&&(L.value=p.value?g.Coin.toJSON(p.value):void 0),L},fromPartial(p){var V,K,m;let L=j();return L.description=p.description!==void 0&&p.description!==null?f.Description.fromPartial(p.description):void 0,L.commission=p.commission!==void 0&&p.commission!==null?f.CommissionRates.fromPartial(p.commission):void 0,L.minSelfDelegation=(V=p.minSelfDelegation)!=null?V:"",L.delegatorAddress=(K=p.delegatorAddress)!=null?K:"",L.validatorAddress=(m=p.validatorAddress)!=null?m:"",L.pubkey=p.pubkey!==void 0&&p.pubkey!==null?l.Any.fromPartial(p.pubkey):void 0,L.value=p.value!==void 0&&p.value!==null?g.Coin.fromPartial(p.value):void 0,L}};function te(){return{}}e.MsgCreateValidatorResponse={encode(p,L=F.Writer.create()){return L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=te();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){default:V.skipType(h&7);break}}return m},fromJSON(p){return{}},toJSON(p){return{}},fromPartial(p){return te()}};function v(){return{description:void 0,validatorAddress:"",commissionRate:"",minSelfDelegation:""}}e.MsgEditValidator={encode(p,L=F.Writer.create()){return p.description!==void 0&&f.Description.encode(p.description,L.uint32(10).fork()).ldelim(),p.validatorAddress!==""&&L.uint32(18).string(p.validatorAddress),p.commissionRate!==""&&L.uint32(26).string(p.commissionRate),p.minSelfDelegation!==""&&L.uint32(34).string(p.minSelfDelegation),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=v();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.description=f.Description.decode(V,V.uint32());break;case 2:m.validatorAddress=V.string();break;case 3:m.commissionRate=V.string();break;case 4:m.minSelfDelegation=V.string();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{description:(0,N.isSet)(p.description)?f.Description.fromJSON(p.description):void 0,validatorAddress:(0,N.isSet)(p.validatorAddress)?String(p.validatorAddress):"",commissionRate:(0,N.isSet)(p.commissionRate)?String(p.commissionRate):"",minSelfDelegation:(0,N.isSet)(p.minSelfDelegation)?String(p.minSelfDelegation):""}},toJSON(p){let L={};return p.description!==void 0&&(L.description=p.description?f.Description.toJSON(p.description):void 0),p.validatorAddress!==void 0&&(L.validatorAddress=p.validatorAddress),p.commissionRate!==void 0&&(L.commissionRate=p.commissionRate),p.minSelfDelegation!==void 0&&(L.minSelfDelegation=p.minSelfDelegation),L},fromPartial(p){var V,K,m;let L=v();return L.description=p.description!==void 0&&p.description!==null?f.Description.fromPartial(p.description):void 0,L.validatorAddress=(V=p.validatorAddress)!=null?V:"",L.commissionRate=(K=p.commissionRate)!=null?K:"",L.minSelfDelegation=(m=p.minSelfDelegation)!=null?m:"",L}};function ne(){return{}}e.MsgEditValidatorResponse={encode(p,L=F.Writer.create()){return L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=ne();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){default:V.skipType(h&7);break}}return m},fromJSON(p){return{}},toJSON(p){return{}},fromPartial(p){return ne()}};function Z(){return{delegatorAddress:"",validatorAddress:"",amount:void 0}}e.MsgDelegate={encode(p,L=F.Writer.create()){return p.delegatorAddress!==""&&L.uint32(10).string(p.delegatorAddress),p.validatorAddress!==""&&L.uint32(18).string(p.validatorAddress),p.amount!==void 0&&g.Coin.encode(p.amount,L.uint32(26).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=Z();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.delegatorAddress=V.string();break;case 2:m.validatorAddress=V.string();break;case 3:m.amount=g.Coin.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{delegatorAddress:(0,N.isSet)(p.delegatorAddress)?String(p.delegatorAddress):"",validatorAddress:(0,N.isSet)(p.validatorAddress)?String(p.validatorAddress):"",amount:(0,N.isSet)(p.amount)?g.Coin.fromJSON(p.amount):void 0}},toJSON(p){let L={};return p.delegatorAddress!==void 0&&(L.delegatorAddress=p.delegatorAddress),p.validatorAddress!==void 0&&(L.validatorAddress=p.validatorAddress),p.amount!==void 0&&(L.amount=p.amount?g.Coin.toJSON(p.amount):void 0),L},fromPartial(p){var V,K;let L=Z();return L.delegatorAddress=(V=p.delegatorAddress)!=null?V:"",L.validatorAddress=(K=p.validatorAddress)!=null?K:"",L.amount=p.amount!==void 0&&p.amount!==null?g.Coin.fromPartial(p.amount):void 0,L}};function R(){return{}}e.MsgDelegateResponse={encode(p,L=F.Writer.create()){return L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=R();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){default:V.skipType(h&7);break}}return m},fromJSON(p){return{}},toJSON(p){return{}},fromPartial(p){return R()}};function M(){return{delegatorAddress:"",validatorSrcAddress:"",validatorDstAddress:"",amount:void 0}}e.MsgBeginRedelegate={encode(p,L=F.Writer.create()){return p.delegatorAddress!==""&&L.uint32(10).string(p.delegatorAddress),p.validatorSrcAddress!==""&&L.uint32(18).string(p.validatorSrcAddress),p.validatorDstAddress!==""&&L.uint32(26).string(p.validatorDstAddress),p.amount!==void 0&&g.Coin.encode(p.amount,L.uint32(34).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=M();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.delegatorAddress=V.string();break;case 2:m.validatorSrcAddress=V.string();break;case 3:m.validatorDstAddress=V.string();break;case 4:m.amount=g.Coin.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{delegatorAddress:(0,N.isSet)(p.delegatorAddress)?String(p.delegatorAddress):"",validatorSrcAddress:(0,N.isSet)(p.validatorSrcAddress)?String(p.validatorSrcAddress):"",validatorDstAddress:(0,N.isSet)(p.validatorDstAddress)?String(p.validatorDstAddress):"",amount:(0,N.isSet)(p.amount)?g.Coin.fromJSON(p.amount):void 0}},toJSON(p){let L={};return p.delegatorAddress!==void 0&&(L.delegatorAddress=p.delegatorAddress),p.validatorSrcAddress!==void 0&&(L.validatorSrcAddress=p.validatorSrcAddress),p.validatorDstAddress!==void 0&&(L.validatorDstAddress=p.validatorDstAddress),p.amount!==void 0&&(L.amount=p.amount?g.Coin.toJSON(p.amount):void 0),L},fromPartial(p){var V,K,m;let L=M();return L.delegatorAddress=(V=p.delegatorAddress)!=null?V:"",L.validatorSrcAddress=(K=p.validatorSrcAddress)!=null?K:"",L.validatorDstAddress=(m=p.validatorDstAddress)!=null?m:"",L.amount=p.amount!==void 0&&p.amount!==null?g.Coin.fromPartial(p.amount):void 0,L}};function U(){return{completionTime:void 0}}e.MsgBeginRedelegateResponse={encode(p,L=F.Writer.create()){return p.completionTime!==void 0&&w.Timestamp.encode(p.completionTime,L.uint32(10).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=U();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.completionTime=w.Timestamp.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{completionTime:(0,N.isSet)(p.completionTime)?(0,N.fromJsonTimestamp)(p.completionTime):void 0}},toJSON(p){let L={};return p.completionTime!==void 0&&(L.completionTime=(0,N.fromTimestamp)(p.completionTime).toISOString()),L},fromPartial(p){let L=U();return L.completionTime=p.completionTime!==void 0&&p.completionTime!==null?w.Timestamp.fromPartial(p.completionTime):void 0,L}};function E(){return{delegatorAddress:"",validatorAddress:"",amount:void 0}}e.MsgUndelegate={encode(p,L=F.Writer.create()){return p.delegatorAddress!==""&&L.uint32(10).string(p.delegatorAddress),p.validatorAddress!==""&&L.uint32(18).string(p.validatorAddress),p.amount!==void 0&&g.Coin.encode(p.amount,L.uint32(26).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=E();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.delegatorAddress=V.string();break;case 2:m.validatorAddress=V.string();break;case 3:m.amount=g.Coin.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{delegatorAddress:(0,N.isSet)(p.delegatorAddress)?String(p.delegatorAddress):"",validatorAddress:(0,N.isSet)(p.validatorAddress)?String(p.validatorAddress):"",amount:(0,N.isSet)(p.amount)?g.Coin.fromJSON(p.amount):void 0}},toJSON(p){let L={};return p.delegatorAddress!==void 0&&(L.delegatorAddress=p.delegatorAddress),p.validatorAddress!==void 0&&(L.validatorAddress=p.validatorAddress),p.amount!==void 0&&(L.amount=p.amount?g.Coin.toJSON(p.amount):void 0),L},fromPartial(p){var V,K;let L=E();return L.delegatorAddress=(V=p.delegatorAddress)!=null?V:"",L.validatorAddress=(K=p.validatorAddress)!=null?K:"",L.amount=p.amount!==void 0&&p.amount!==null?g.Coin.fromPartial(p.amount):void 0,L}};function Q(){return{completionTime:void 0}}e.MsgUndelegateResponse={encode(p,L=F.Writer.create()){return p.completionTime!==void 0&&w.Timestamp.encode(p.completionTime,L.uint32(10).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=Q();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.completionTime=w.Timestamp.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{completionTime:(0,N.isSet)(p.completionTime)?(0,N.fromJsonTimestamp)(p.completionTime):void 0}},toJSON(p){let L={};return p.completionTime!==void 0&&(L.completionTime=(0,N.fromTimestamp)(p.completionTime).toISOString()),L},fromPartial(p){let L=Q();return L.completionTime=p.completionTime!==void 0&&p.completionTime!==null?w.Timestamp.fromPartial(p.completionTime):void 0,L}};function H(){return{delegatorAddress:"",validatorAddress:"",amount:void 0,creationHeight:N.Long.ZERO}}e.MsgCancelUnbondingDelegation={encode(p,L=F.Writer.create()){return p.delegatorAddress!==""&&L.uint32(10).string(p.delegatorAddress),p.validatorAddress!==""&&L.uint32(18).string(p.validatorAddress),p.amount!==void 0&&g.Coin.encode(p.amount,L.uint32(26).fork()).ldelim(),p.creationHeight.isZero()||L.uint32(32).int64(p.creationHeight),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=H();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.delegatorAddress=V.string();break;case 2:m.validatorAddress=V.string();break;case 3:m.amount=g.Coin.decode(V,V.uint32());break;case 4:m.creationHeight=V.int64();break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{delegatorAddress:(0,N.isSet)(p.delegatorAddress)?String(p.delegatorAddress):"",validatorAddress:(0,N.isSet)(p.validatorAddress)?String(p.validatorAddress):"",amount:(0,N.isSet)(p.amount)?g.Coin.fromJSON(p.amount):void 0,creationHeight:(0,N.isSet)(p.creationHeight)?N.Long.fromValue(p.creationHeight):N.Long.ZERO}},toJSON(p){let L={};return p.delegatorAddress!==void 0&&(L.delegatorAddress=p.delegatorAddress),p.validatorAddress!==void 0&&(L.validatorAddress=p.validatorAddress),p.amount!==void 0&&(L.amount=p.amount?g.Coin.toJSON(p.amount):void 0),p.creationHeight!==void 0&&(L.creationHeight=(p.creationHeight||N.Long.ZERO).toString()),L},fromPartial(p){var V,K;let L=H();return L.delegatorAddress=(V=p.delegatorAddress)!=null?V:"",L.validatorAddress=(K=p.validatorAddress)!=null?K:"",L.amount=p.amount!==void 0&&p.amount!==null?g.Coin.fromPartial(p.amount):void 0,L.creationHeight=p.creationHeight!==void 0&&p.creationHeight!==null?N.Long.fromValue(p.creationHeight):N.Long.ZERO,L}};function re(){return{}}e.MsgCancelUnbondingDelegationResponse={encode(p,L=F.Writer.create()){return L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=re();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){default:V.skipType(h&7);break}}return m},fromJSON(p){return{}},toJSON(p){return{}},fromPartial(p){return re()}};function ee(){return{authority:"",params:void 0}}e.MsgUpdateParams={encode(p,L=F.Writer.create()){return p.authority!==""&&L.uint32(10).string(p.authority),p.params!==void 0&&f.Params.encode(p.params,L.uint32(18).fork()).ldelim(),L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=ee();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){case 1:m.authority=V.string();break;case 2:m.params=f.Params.decode(V,V.uint32());break;default:V.skipType(h&7);break}}return m},fromJSON(p){return{authority:(0,N.isSet)(p.authority)?String(p.authority):"",params:(0,N.isSet)(p.params)?f.Params.fromJSON(p.params):void 0}},toJSON(p){let L={};return p.authority!==void 0&&(L.authority=p.authority),p.params!==void 0&&(L.params=p.params?f.Params.toJSON(p.params):void 0),L},fromPartial(p){var V;let L=ee();return L.authority=(V=p.authority)!=null?V:"",L.params=p.params!==void 0&&p.params!==null?f.Params.fromPartial(p.params):void 0,L}};function T(){return{}}e.MsgUpdateParamsResponse={encode(p,L=F.Writer.create()){return L},decode(p,L){let V=p instanceof F.Reader?p:new F.Reader(p),K=L===void 0?V.len:V.pos+L,m=T();for(;V.pos<K;){let h=V.uint32();switch(h>>>3){default:V.skipType(h&7);break}}return m},fromJSON(p){return{}},toJSON(p){return{}},fromPartial(p){return T()}};class se{constructor(L){this.rpc=L,this.CreateValidator=this.CreateValidator.bind(this),this.EditValidator=this.EditValidator.bind(this),this.Delegate=this.Delegate.bind(this),this.BeginRedelegate=this.BeginRedelegate.bind(this),this.Undelegate=this.Undelegate.bind(this),this.CancelUnbondingDelegation=this.CancelUnbondingDelegation.bind(this),this.UpdateParams=this.UpdateParams.bind(this)}CreateValidator(L){let V=e.MsgCreateValidator.encode(L).finish();return this.rpc.request("cosmos.staking.v1beta1.Msg","CreateValidator",V).then(m=>e.MsgCreateValidatorResponse.decode(new F.Reader(m)))}EditValidator(L){let V=e.MsgEditValidator.encode(L).finish();return this.rpc.request("cosmos.staking.v1beta1.Msg","EditValidator",V).then(m=>e.MsgEditValidatorResponse.decode(new F.Reader(m)))}Delegate(L){let V=e.MsgDelegate.encode(L).finish();return this.rpc.request("cosmos.staking.v1beta1.Msg","Delegate",V).then(m=>e.MsgDelegateResponse.decode(new F.Reader(m)))}BeginRedelegate(L){let V=e.MsgBeginRedelegate.encode(L).finish();return this.rpc.request("cosmos.staking.v1beta1.Msg","BeginRedelegate",V).then(m=>e.MsgBeginRedelegateResponse.decode(new F.Reader(m)))}Undelegate(L){let V=e.MsgUndelegate.encode(L).finish();return this.rpc.request("cosmos.staking.v1beta1.Msg","Undelegate",V).then(m=>e.MsgUndelegateResponse.decode(new F.Reader(m)))}CancelUnbondingDelegation(L){let V=e.MsgCancelUnbondingDelegation.encode(L).finish();return this.rpc.request("cosmos.staking.v1beta1.Msg","CancelUnbondingDelegation",V).then(m=>e.MsgCancelUnbondingDelegationResponse.decode(new F.Reader(m)))}UpdateParams(L){let V=e.MsgUpdateParams.encode(L).finish();return this.rpc.request("cosmos.staking.v1beta1.Msg","UpdateParams",V).then(m=>e.MsgUpdateParamsResponse.decode(new F.Reader(m)))}}e.MsgClientImpl=se})(EIn);Object.defineProperty(sD,"__esModule",{value:!0});sD.isMsgUndelegateEncodeObject=sD.isMsgEditValidatorEncodeObject=sD.isMsgDelegateEncodeObject=sD.isMsgCreateValidatorEncodeObject=sD.isMsgBeginRedelegateEncodeObject=sD.stakingTypes=void 0;var KHe=EIn;sD.stakingTypes=[["/cosmos.staking.v1beta1.MsgBeginRedelegate",KHe.MsgBeginRedelegate],["/cosmos.staking.v1beta1.MsgCreateValidator",KHe.MsgCreateValidator],["/cosmos.staking.v1beta1.MsgDelegate",KHe.MsgDelegate],["/cosmos.staking.v1beta1.MsgEditValidator",KHe.MsgEditValidator],["/cosmos.staking.v1beta1.MsgUndelegate",KHe.MsgUndelegate]];function sbs(e){return e.typeUrl==="/cosmos.staking.v1beta1.MsgBeginRedelegate"}sD.isMsgBeginRedelegateEncodeObject=sbs;function Abs(e){return e.typeUrl==="/cosmos.staking.v1beta1.MsgCreateValidator"}sD.isMsgCreateValidatorEncodeObject=Abs;function dbs(e){return e.typeUrl==="/cosmos.staking.v1beta1.MsgDelegate"}sD.isMsgDelegateEncodeObject=dbs;function cbs(e){return e.typeUrl==="/cosmos.staking.v1beta1.MsgEditValidator"}sD.isMsgEditValidatorEncodeObject=cbs;function ubs(e){return e.typeUrl==="/cosmos.staking.v1beta1.MsgUndelegate"}sD.isMsgUndelegateEncodeObject=ubs;var yvt={},K$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(I,C,D,W){W===void 0&&(W=D);var ae=Object.getOwnPropertyDescriptor(C,D);(!ae||("get"in ae?!C.__esModule:ae.writable||ae.configurable))&&(ae={enumerable:!0,get:function(){return C[D]}}),Object.defineProperty(I,W,ae)}:function(I,C,D,W){W===void 0&&(W=D),I[W]=C[D]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(I,C){Object.defineProperty(I,"default",{enumerable:!0,value:C})}:function(I,C){I.default=C}),c=Fr&&Fr.__importStar||function(I){if(I&&I.__esModule)return I;var C={};if(I!=null)for(var D in I)D!=="default"&&Object.prototype.hasOwnProperty.call(I,D)&&i(C,I,D);return A(C,I),C};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryClientImpl=e.QueryParamsResponse=e.QueryParamsRequest=e.QueryPoolResponse=e.QueryPoolRequest=e.QueryHistoricalInfoResponse=e.QueryHistoricalInfoRequest=e.QueryDelegatorValidatorResponse=e.QueryDelegatorValidatorRequest=e.QueryDelegatorValidatorsResponse=e.QueryDelegatorValidatorsRequest=e.QueryRedelegationsResponse=e.QueryRedelegationsRequest=e.QueryDelegatorUnbondingDelegationsResponse=e.QueryDelegatorUnbondingDelegationsRequest=e.QueryDelegatorDelegationsResponse=e.QueryDelegatorDelegationsRequest=e.QueryUnbondingDelegationResponse=e.QueryUnbondingDelegationRequest=e.QueryDelegationResponse=e.QueryDelegationRequest=e.QueryValidatorUnbondingDelegationsResponse=e.QueryValidatorUnbondingDelegationsRequest=e.QueryValidatorDelegationsResponse=e.QueryValidatorDelegationsRequest=e.QueryValidatorResponse=e.QueryValidatorRequest=e.QueryValidatorsResponse=e.QueryValidatorsRequest=e.protobufPackage=void 0;let f=Hm,l=BIn,g=Ns,w=c(BA);e.protobufPackage="cosmos.staking.v1beta1";function N(){return{status:"",pagination:void 0}}e.QueryValidatorsRequest={encode(I,C=w.Writer.create()){return I.status!==""&&C.uint32(10).string(I.status),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=N();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.status=D.string();break;case 2:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{status:(0,g.isSet)(I.status)?String(I.status):"",pagination:(0,g.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.status!==void 0&&(C.status=I.status),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=N();return C.status=(D=I.status)!=null?D:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function F(){return{validators:[],pagination:void 0}}e.QueryValidatorsResponse={encode(I,C=w.Writer.create()){for(let D of I.validators)l.Validator.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=F();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.validators.push(l.Validator.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{validators:Array.isArray(I==null?void 0:I.validators)?I.validators.map(C=>l.Validator.fromJSON(C)):[],pagination:(0,g.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.validators?C.validators=I.validators.map(D=>D?l.Validator.toJSON(D):void 0):C.validators=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=F();return C.validators=((D=I.validators)==null?void 0:D.map(W=>l.Validator.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C}};function j(){return{validatorAddr:""}}e.QueryValidatorRequest={encode(I,C=w.Writer.create()){return I.validatorAddr!==""&&C.uint32(10).string(I.validatorAddr),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=j();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.validatorAddr=D.string();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{validatorAddr:(0,g.isSet)(I.validatorAddr)?String(I.validatorAddr):""}},toJSON(I){let C={};return I.validatorAddr!==void 0&&(C.validatorAddr=I.validatorAddr),C},fromPartial(I){var D;let C=j();return C.validatorAddr=(D=I.validatorAddr)!=null?D:"",C}};function te(){return{validator:void 0}}e.QueryValidatorResponse={encode(I,C=w.Writer.create()){return I.validator!==void 0&&l.Validator.encode(I.validator,C.uint32(10).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=te();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.validator=l.Validator.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{validator:(0,g.isSet)(I.validator)?l.Validator.fromJSON(I.validator):void 0}},toJSON(I){let C={};return I.validator!==void 0&&(C.validator=I.validator?l.Validator.toJSON(I.validator):void 0),C},fromPartial(I){let C=te();return C.validator=I.validator!==void 0&&I.validator!==null?l.Validator.fromPartial(I.validator):void 0,C}};function v(){return{validatorAddr:"",pagination:void 0}}e.QueryValidatorDelegationsRequest={encode(I,C=w.Writer.create()){return I.validatorAddr!==""&&C.uint32(10).string(I.validatorAddr),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=v();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.validatorAddr=D.string();break;case 2:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{validatorAddr:(0,g.isSet)(I.validatorAddr)?String(I.validatorAddr):"",pagination:(0,g.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.validatorAddr!==void 0&&(C.validatorAddr=I.validatorAddr),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=v();return C.validatorAddr=(D=I.validatorAddr)!=null?D:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function ne(){return{delegationResponses:[],pagination:void 0}}e.QueryValidatorDelegationsResponse={encode(I,C=w.Writer.create()){for(let D of I.delegationResponses)l.DelegationResponse.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=ne();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegationResponses.push(l.DelegationResponse.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegationResponses:Array.isArray(I==null?void 0:I.delegationResponses)?I.delegationResponses.map(C=>l.DelegationResponse.fromJSON(C)):[],pagination:(0,g.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.delegationResponses?C.delegationResponses=I.delegationResponses.map(D=>D?l.DelegationResponse.toJSON(D):void 0):C.delegationResponses=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=ne();return C.delegationResponses=((D=I.delegationResponses)==null?void 0:D.map(W=>l.DelegationResponse.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C}};function Z(){return{validatorAddr:"",pagination:void 0}}e.QueryValidatorUnbondingDelegationsRequest={encode(I,C=w.Writer.create()){return I.validatorAddr!==""&&C.uint32(10).string(I.validatorAddr),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=Z();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.validatorAddr=D.string();break;case 2:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{validatorAddr:(0,g.isSet)(I.validatorAddr)?String(I.validatorAddr):"",pagination:(0,g.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.validatorAddr!==void 0&&(C.validatorAddr=I.validatorAddr),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=Z();return C.validatorAddr=(D=I.validatorAddr)!=null?D:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function R(){return{unbondingResponses:[],pagination:void 0}}e.QueryValidatorUnbondingDelegationsResponse={encode(I,C=w.Writer.create()){for(let D of I.unbondingResponses)l.UnbondingDelegation.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=R();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.unbondingResponses.push(l.UnbondingDelegation.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{unbondingResponses:Array.isArray(I==null?void 0:I.unbondingResponses)?I.unbondingResponses.map(C=>l.UnbondingDelegation.fromJSON(C)):[],pagination:(0,g.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.unbondingResponses?C.unbondingResponses=I.unbondingResponses.map(D=>D?l.UnbondingDelegation.toJSON(D):void 0):C.unbondingResponses=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=R();return C.unbondingResponses=((D=I.unbondingResponses)==null?void 0:D.map(W=>l.UnbondingDelegation.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C}};function M(){return{delegatorAddr:"",validatorAddr:""}}e.QueryDelegationRequest={encode(I,C=w.Writer.create()){return I.delegatorAddr!==""&&C.uint32(10).string(I.delegatorAddr),I.validatorAddr!==""&&C.uint32(18).string(I.validatorAddr),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=M();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegatorAddr=D.string();break;case 2:ae.validatorAddr=D.string();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegatorAddr:(0,g.isSet)(I.delegatorAddr)?String(I.delegatorAddr):"",validatorAddr:(0,g.isSet)(I.validatorAddr)?String(I.validatorAddr):""}},toJSON(I){let C={};return I.delegatorAddr!==void 0&&(C.delegatorAddr=I.delegatorAddr),I.validatorAddr!==void 0&&(C.validatorAddr=I.validatorAddr),C},fromPartial(I){var D,W;let C=M();return C.delegatorAddr=(D=I.delegatorAddr)!=null?D:"",C.validatorAddr=(W=I.validatorAddr)!=null?W:"",C}};function U(){return{delegationResponse:void 0}}e.QueryDelegationResponse={encode(I,C=w.Writer.create()){return I.delegationResponse!==void 0&&l.DelegationResponse.encode(I.delegationResponse,C.uint32(10).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=U();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegationResponse=l.DelegationResponse.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegationResponse:(0,g.isSet)(I.delegationResponse)?l.DelegationResponse.fromJSON(I.delegationResponse):void 0}},toJSON(I){let C={};return I.delegationResponse!==void 0&&(C.delegationResponse=I.delegationResponse?l.DelegationResponse.toJSON(I.delegationResponse):void 0),C},fromPartial(I){let C=U();return C.delegationResponse=I.delegationResponse!==void 0&&I.delegationResponse!==null?l.DelegationResponse.fromPartial(I.delegationResponse):void 0,C}};function E(){return{delegatorAddr:"",validatorAddr:""}}e.QueryUnbondingDelegationRequest={encode(I,C=w.Writer.create()){return I.delegatorAddr!==""&&C.uint32(10).string(I.delegatorAddr),I.validatorAddr!==""&&C.uint32(18).string(I.validatorAddr),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=E();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegatorAddr=D.string();break;case 2:ae.validatorAddr=D.string();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegatorAddr:(0,g.isSet)(I.delegatorAddr)?String(I.delegatorAddr):"",validatorAddr:(0,g.isSet)(I.validatorAddr)?String(I.validatorAddr):""}},toJSON(I){let C={};return I.delegatorAddr!==void 0&&(C.delegatorAddr=I.delegatorAddr),I.validatorAddr!==void 0&&(C.validatorAddr=I.validatorAddr),C},fromPartial(I){var D,W;let C=E();return C.delegatorAddr=(D=I.delegatorAddr)!=null?D:"",C.validatorAddr=(W=I.validatorAddr)!=null?W:"",C}};function Q(){return{unbond:void 0}}e.QueryUnbondingDelegationResponse={encode(I,C=w.Writer.create()){return I.unbond!==void 0&&l.UnbondingDelegation.encode(I.unbond,C.uint32(10).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=Q();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.unbond=l.UnbondingDelegation.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{unbond:(0,g.isSet)(I.unbond)?l.UnbondingDelegation.fromJSON(I.unbond):void 0}},toJSON(I){let C={};return I.unbond!==void 0&&(C.unbond=I.unbond?l.UnbondingDelegation.toJSON(I.unbond):void 0),C},fromPartial(I){let C=Q();return C.unbond=I.unbond!==void 0&&I.unbond!==null?l.UnbondingDelegation.fromPartial(I.unbond):void 0,C}};function H(){return{delegatorAddr:"",pagination:void 0}}e.QueryDelegatorDelegationsRequest={encode(I,C=w.Writer.create()){return I.delegatorAddr!==""&&C.uint32(10).string(I.delegatorAddr),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=H();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegatorAddr=D.string();break;case 2:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegatorAddr:(0,g.isSet)(I.delegatorAddr)?String(I.delegatorAddr):"",pagination:(0,g.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.delegatorAddr!==void 0&&(C.delegatorAddr=I.delegatorAddr),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=H();return C.delegatorAddr=(D=I.delegatorAddr)!=null?D:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function re(){return{delegationResponses:[],pagination:void 0}}e.QueryDelegatorDelegationsResponse={encode(I,C=w.Writer.create()){for(let D of I.delegationResponses)l.DelegationResponse.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=re();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegationResponses.push(l.DelegationResponse.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegationResponses:Array.isArray(I==null?void 0:I.delegationResponses)?I.delegationResponses.map(C=>l.DelegationResponse.fromJSON(C)):[],pagination:(0,g.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.delegationResponses?C.delegationResponses=I.delegationResponses.map(D=>D?l.DelegationResponse.toJSON(D):void 0):C.delegationResponses=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=re();return C.delegationResponses=((D=I.delegationResponses)==null?void 0:D.map(W=>l.DelegationResponse.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C}};function ee(){return{delegatorAddr:"",pagination:void 0}}e.QueryDelegatorUnbondingDelegationsRequest={encode(I,C=w.Writer.create()){return I.delegatorAddr!==""&&C.uint32(10).string(I.delegatorAddr),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=ee();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegatorAddr=D.string();break;case 2:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegatorAddr:(0,g.isSet)(I.delegatorAddr)?String(I.delegatorAddr):"",pagination:(0,g.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.delegatorAddr!==void 0&&(C.delegatorAddr=I.delegatorAddr),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=ee();return C.delegatorAddr=(D=I.delegatorAddr)!=null?D:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function T(){return{unbondingResponses:[],pagination:void 0}}e.QueryDelegatorUnbondingDelegationsResponse={encode(I,C=w.Writer.create()){for(let D of I.unbondingResponses)l.UnbondingDelegation.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=T();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.unbondingResponses.push(l.UnbondingDelegation.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{unbondingResponses:Array.isArray(I==null?void 0:I.unbondingResponses)?I.unbondingResponses.map(C=>l.UnbondingDelegation.fromJSON(C)):[],pagination:(0,g.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.unbondingResponses?C.unbondingResponses=I.unbondingResponses.map(D=>D?l.UnbondingDelegation.toJSON(D):void 0):C.unbondingResponses=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=T();return C.unbondingResponses=((D=I.unbondingResponses)==null?void 0:D.map(W=>l.UnbondingDelegation.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C}};function se(){return{delegatorAddr:"",srcValidatorAddr:"",dstValidatorAddr:"",pagination:void 0}}e.QueryRedelegationsRequest={encode(I,C=w.Writer.create()){return I.delegatorAddr!==""&&C.uint32(10).string(I.delegatorAddr),I.srcValidatorAddr!==""&&C.uint32(18).string(I.srcValidatorAddr),I.dstValidatorAddr!==""&&C.uint32(26).string(I.dstValidatorAddr),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(34).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=se();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegatorAddr=D.string();break;case 2:ae.srcValidatorAddr=D.string();break;case 3:ae.dstValidatorAddr=D.string();break;case 4:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegatorAddr:(0,g.isSet)(I.delegatorAddr)?String(I.delegatorAddr):"",srcValidatorAddr:(0,g.isSet)(I.srcValidatorAddr)?String(I.srcValidatorAddr):"",dstValidatorAddr:(0,g.isSet)(I.dstValidatorAddr)?String(I.dstValidatorAddr):"",pagination:(0,g.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.delegatorAddr!==void 0&&(C.delegatorAddr=I.delegatorAddr),I.srcValidatorAddr!==void 0&&(C.srcValidatorAddr=I.srcValidatorAddr),I.dstValidatorAddr!==void 0&&(C.dstValidatorAddr=I.dstValidatorAddr),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){var D,W,ae;let C=se();return C.delegatorAddr=(D=I.delegatorAddr)!=null?D:"",C.srcValidatorAddr=(W=I.srcValidatorAddr)!=null?W:"",C.dstValidatorAddr=(ae=I.dstValidatorAddr)!=null?ae:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function p(){return{redelegationResponses:[],pagination:void 0}}e.QueryRedelegationsResponse={encode(I,C=w.Writer.create()){for(let D of I.redelegationResponses)l.RedelegationResponse.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=p();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.redelegationResponses.push(l.RedelegationResponse.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{redelegationResponses:Array.isArray(I==null?void 0:I.redelegationResponses)?I.redelegationResponses.map(C=>l.RedelegationResponse.fromJSON(C)):[],pagination:(0,g.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.redelegationResponses?C.redelegationResponses=I.redelegationResponses.map(D=>D?l.RedelegationResponse.toJSON(D):void 0):C.redelegationResponses=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=p();return C.redelegationResponses=((D=I.redelegationResponses)==null?void 0:D.map(W=>l.RedelegationResponse.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C}};function L(){return{delegatorAddr:"",pagination:void 0}}e.QueryDelegatorValidatorsRequest={encode(I,C=w.Writer.create()){return I.delegatorAddr!==""&&C.uint32(10).string(I.delegatorAddr),I.pagination!==void 0&&f.PageRequest.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=L();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegatorAddr=D.string();break;case 2:ae.pagination=f.PageRequest.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegatorAddr:(0,g.isSet)(I.delegatorAddr)?String(I.delegatorAddr):"",pagination:(0,g.isSet)(I.pagination)?f.PageRequest.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.delegatorAddr!==void 0&&(C.delegatorAddr=I.delegatorAddr),I.pagination!==void 0&&(C.pagination=I.pagination?f.PageRequest.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=L();return C.delegatorAddr=(D=I.delegatorAddr)!=null?D:"",C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageRequest.fromPartial(I.pagination):void 0,C}};function V(){return{validators:[],pagination:void 0}}e.QueryDelegatorValidatorsResponse={encode(I,C=w.Writer.create()){for(let D of I.validators)l.Validator.encode(D,C.uint32(10).fork()).ldelim();return I.pagination!==void 0&&f.PageResponse.encode(I.pagination,C.uint32(18).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=V();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.validators.push(l.Validator.decode(D,D.uint32()));break;case 2:ae.pagination=f.PageResponse.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{validators:Array.isArray(I==null?void 0:I.validators)?I.validators.map(C=>l.Validator.fromJSON(C)):[],pagination:(0,g.isSet)(I.pagination)?f.PageResponse.fromJSON(I.pagination):void 0}},toJSON(I){let C={};return I.validators?C.validators=I.validators.map(D=>D?l.Validator.toJSON(D):void 0):C.validators=[],I.pagination!==void 0&&(C.pagination=I.pagination?f.PageResponse.toJSON(I.pagination):void 0),C},fromPartial(I){var D;let C=V();return C.validators=((D=I.validators)==null?void 0:D.map(W=>l.Validator.fromPartial(W)))||[],C.pagination=I.pagination!==void 0&&I.pagination!==null?f.PageResponse.fromPartial(I.pagination):void 0,C}};function K(){return{delegatorAddr:"",validatorAddr:""}}e.QueryDelegatorValidatorRequest={encode(I,C=w.Writer.create()){return I.delegatorAddr!==""&&C.uint32(10).string(I.delegatorAddr),I.validatorAddr!==""&&C.uint32(18).string(I.validatorAddr),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=K();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.delegatorAddr=D.string();break;case 2:ae.validatorAddr=D.string();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{delegatorAddr:(0,g.isSet)(I.delegatorAddr)?String(I.delegatorAddr):"",validatorAddr:(0,g.isSet)(I.validatorAddr)?String(I.validatorAddr):""}},toJSON(I){let C={};return I.delegatorAddr!==void 0&&(C.delegatorAddr=I.delegatorAddr),I.validatorAddr!==void 0&&(C.validatorAddr=I.validatorAddr),C},fromPartial(I){var D,W;let C=K();return C.delegatorAddr=(D=I.delegatorAddr)!=null?D:"",C.validatorAddr=(W=I.validatorAddr)!=null?W:"",C}};function m(){return{validator:void 0}}e.QueryDelegatorValidatorResponse={encode(I,C=w.Writer.create()){return I.validator!==void 0&&l.Validator.encode(I.validator,C.uint32(10).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=m();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.validator=l.Validator.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{validator:(0,g.isSet)(I.validator)?l.Validator.fromJSON(I.validator):void 0}},toJSON(I){let C={};return I.validator!==void 0&&(C.validator=I.validator?l.Validator.toJSON(I.validator):void 0),C},fromPartial(I){let C=m();return C.validator=I.validator!==void 0&&I.validator!==null?l.Validator.fromPartial(I.validator):void 0,C}};function h(){return{height:g.Long.ZERO}}e.QueryHistoricalInfoRequest={encode(I,C=w.Writer.create()){return I.height.isZero()||C.uint32(8).int64(I.height),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=h();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.height=D.int64();break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{height:(0,g.isSet)(I.height)?g.Long.fromValue(I.height):g.Long.ZERO}},toJSON(I){let C={};return I.height!==void 0&&(C.height=(I.height||g.Long.ZERO).toString()),C},fromPartial(I){let C=h();return C.height=I.height!==void 0&&I.height!==null?g.Long.fromValue(I.height):g.Long.ZERO,C}};function _(){return{hist:void 0}}e.QueryHistoricalInfoResponse={encode(I,C=w.Writer.create()){return I.hist!==void 0&&l.HistoricalInfo.encode(I.hist,C.uint32(10).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=_();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.hist=l.HistoricalInfo.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{hist:(0,g.isSet)(I.hist)?l.HistoricalInfo.fromJSON(I.hist):void 0}},toJSON(I){let C={};return I.hist!==void 0&&(C.hist=I.hist?l.HistoricalInfo.toJSON(I.hist):void 0),C},fromPartial(I){let C=_();return C.hist=I.hist!==void 0&&I.hist!==null?l.HistoricalInfo.fromPartial(I.hist):void 0,C}};function b(){return{}}e.QueryPoolRequest={encode(I,C=w.Writer.create()){return C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=b();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{}},toJSON(I){return{}},fromPartial(I){return b()}};function O(){return{pool:void 0}}e.QueryPoolResponse={encode(I,C=w.Writer.create()){return I.pool!==void 0&&l.Pool.encode(I.pool,C.uint32(10).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=O();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.pool=l.Pool.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{pool:(0,g.isSet)(I.pool)?l.Pool.fromJSON(I.pool):void 0}},toJSON(I){let C={};return I.pool!==void 0&&(C.pool=I.pool?l.Pool.toJSON(I.pool):void 0),C},fromPartial(I){let C=O();return C.pool=I.pool!==void 0&&I.pool!==null?l.Pool.fromPartial(I.pool):void 0,C}};function J(){return{}}e.QueryParamsRequest={encode(I,C=w.Writer.create()){return C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=J();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{}},toJSON(I){return{}},fromPartial(I){return J()}};function ie(){return{params:void 0}}e.QueryParamsResponse={encode(I,C=w.Writer.create()){return I.params!==void 0&&l.Params.encode(I.params,C.uint32(10).fork()).ldelim(),C},decode(I,C){let D=I instanceof w.Reader?I:new w.Reader(I),W=C===void 0?D.len:D.pos+C,ae=ie();for(;D.pos<W;){let ye=D.uint32();switch(ye>>>3){case 1:ae.params=l.Params.decode(D,D.uint32());break;default:D.skipType(ye&7);break}}return ae},fromJSON(I){return{params:(0,g.isSet)(I.params)?l.Params.fromJSON(I.params):void 0}},toJSON(I){let C={};return I.params!==void 0&&(C.params=I.params?l.Params.toJSON(I.params):void 0),C},fromPartial(I){let C=ie();return C.params=I.params!==void 0&&I.params!==null?l.Params.fromPartial(I.params):void 0,C}};class G{constructor(C){this.rpc=C,this.Validators=this.Validators.bind(this),this.Validator=this.Validator.bind(this),this.ValidatorDelegations=this.ValidatorDelegations.bind(this),this.ValidatorUnbondingDelegations=this.ValidatorUnbondingDelegations.bind(this),this.Delegation=this.Delegation.bind(this),this.UnbondingDelegation=this.UnbondingDelegation.bind(this),this.DelegatorDelegations=this.DelegatorDelegations.bind(this),this.DelegatorUnbondingDelegations=this.DelegatorUnbondingDelegations.bind(this),this.Redelegations=this.Redelegations.bind(this),this.DelegatorValidators=this.DelegatorValidators.bind(this),this.DelegatorValidator=this.DelegatorValidator.bind(this),this.HistoricalInfo=this.HistoricalInfo.bind(this),this.Pool=this.Pool.bind(this),this.Params=this.Params.bind(this)}Validators(C){let D=e.QueryValidatorsRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","Validators",D).then(ae=>e.QueryValidatorsResponse.decode(new w.Reader(ae)))}Validator(C){let D=e.QueryValidatorRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","Validator",D).then(ae=>e.QueryValidatorResponse.decode(new w.Reader(ae)))}ValidatorDelegations(C){let D=e.QueryValidatorDelegationsRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","ValidatorDelegations",D).then(ae=>e.QueryValidatorDelegationsResponse.decode(new w.Reader(ae)))}ValidatorUnbondingDelegations(C){let D=e.QueryValidatorUnbondingDelegationsRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","ValidatorUnbondingDelegations",D).then(ae=>e.QueryValidatorUnbondingDelegationsResponse.decode(new w.Reader(ae)))}Delegation(C){let D=e.QueryDelegationRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","Delegation",D).then(ae=>e.QueryDelegationResponse.decode(new w.Reader(ae)))}UnbondingDelegation(C){let D=e.QueryUnbondingDelegationRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","UnbondingDelegation",D).then(ae=>e.QueryUnbondingDelegationResponse.decode(new w.Reader(ae)))}DelegatorDelegations(C){let D=e.QueryDelegatorDelegationsRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","DelegatorDelegations",D).then(ae=>e.QueryDelegatorDelegationsResponse.decode(new w.Reader(ae)))}DelegatorUnbondingDelegations(C){let D=e.QueryDelegatorUnbondingDelegationsRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","DelegatorUnbondingDelegations",D).then(ae=>e.QueryDelegatorUnbondingDelegationsResponse.decode(new w.Reader(ae)))}Redelegations(C){let D=e.QueryRedelegationsRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","Redelegations",D).then(ae=>e.QueryRedelegationsResponse.decode(new w.Reader(ae)))}DelegatorValidators(C){let D=e.QueryDelegatorValidatorsRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","DelegatorValidators",D).then(ae=>e.QueryDelegatorValidatorsResponse.decode(new w.Reader(ae)))}DelegatorValidator(C){let D=e.QueryDelegatorValidatorRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","DelegatorValidator",D).then(ae=>e.QueryDelegatorValidatorResponse.decode(new w.Reader(ae)))}HistoricalInfo(C){let D=e.QueryHistoricalInfoRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","HistoricalInfo",D).then(ae=>e.QueryHistoricalInfoResponse.decode(new w.Reader(ae)))}Pool(C={}){let D=e.QueryPoolRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","Pool",D).then(ae=>e.QueryPoolResponse.decode(new w.Reader(ae)))}Params(C={}){let D=e.QueryParamsRequest.encode(C).finish();return this.rpc.request("cosmos.staking.v1beta1.Query","Params",D).then(ae=>e.QueryParamsResponse.decode(new w.Reader(ae)))}}e.QueryClientImpl=G})(K$r);var fbs=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yvt,"__esModule",{value:!0});yvt.setupStakingExtension=void 0;var lbs=K$r,hbs=fbs(qM),sie=Rw;function gbs(e){let i=(0,sie.createProtobufRpcClient)(e),A=new lbs.QueryClientImpl(i);return{staking:{delegation:(c,f)=>Jt(this,null,function*(){return yield A.Delegation({delegatorAddr:c,validatorAddr:f})}),delegatorDelegations:(c,f)=>Jt(this,null,function*(){return yield A.DelegatorDelegations({delegatorAddr:c,pagination:(0,sie.createPagination)(f)})}),delegatorUnbondingDelegations:(c,f)=>Jt(this,null,function*(){return yield A.DelegatorUnbondingDelegations({delegatorAddr:c,pagination:(0,sie.createPagination)(f)})}),delegatorValidator:(c,f)=>Jt(this,null,function*(){return yield A.DelegatorValidator({delegatorAddr:c,validatorAddr:f})}),delegatorValidators:(c,f)=>Jt(this,null,function*(){return yield A.DelegatorValidators({delegatorAddr:c,pagination:(0,sie.createPagination)(f)})}),historicalInfo:c=>Jt(this,null,function*(){return yield A.HistoricalInfo({height:hbs.default.fromNumber(c,!0)})}),params:()=>Jt(this,null,function*(){return yield A.Params({})}),pool:()=>Jt(this,null,function*(){return yield A.Pool({})}),redelegations:(c,f,l,g)=>Jt(this,null,function*(){return yield A.Redelegations({delegatorAddr:c,srcValidatorAddr:f,dstValidatorAddr:l,pagination:(0,sie.createPagination)(g)})}),unbondingDelegation:(c,f)=>Jt(this,null,function*(){return yield A.UnbondingDelegation({delegatorAddr:c,validatorAddr:f})}),validator:c=>Jt(this,null,function*(){return yield A.Validator({validatorAddr:c})}),validatorDelegations:(c,f)=>Jt(this,null,function*(){return yield A.ValidatorDelegations({validatorAddr:c,pagination:(0,sie.createPagination)(f)})}),validators:(c,f)=>Jt(this,null,function*(){return yield A.Validators({status:c,pagination:(0,sie.createPagination)(f)})}),validatorUnbondingDelegations:(c,f)=>Jt(this,null,function*(){return yield A.ValidatorUnbondingDelegations({validatorAddr:c,pagination:(0,sie.createPagination)(f)})})}}}yvt.setupStakingExtension=gbs;var mvt={},Y$r={},bIn={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(E,Q,H,re){re===void 0&&(re=H);var ee=Object.getOwnPropertyDescriptor(Q,H);(!ee||("get"in ee?!Q.__esModule:ee.writable||ee.configurable))&&(ee={enumerable:!0,get:function(){return Q[H]}}),Object.defineProperty(E,re,ee)}:function(E,Q,H,re){re===void 0&&(re=H),E[re]=Q[H]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(E,Q){Object.defineProperty(E,"default",{enumerable:!0,value:Q})}:function(E,Q){E.default=Q}),c=Fr&&Fr.__importStar||function(E){if(E&&E.__esModule)return E;var Q={};if(E!=null)for(var H in E)H!=="default"&&Object.prototype.hasOwnProperty.call(E,H)&&i(Q,E,H);return A(Q,E),Q};Object.defineProperty(e,"__esModule",{value:!0}),e.SearchTxsResult=e.TxMsgData=e.MsgData=e.SimulationResponse=e.Result=e.GasInfo=e.Attribute=e.StringEvent=e.ABCIMessageLog=e.TxResponse=e.protobufPackage=void 0;let f=fh,l=vIn,g=Ns,w=c(BA);e.protobufPackage="cosmos.base.abci.v1beta1";function N(){return{height:g.Long.ZERO,txhash:"",codespace:"",code:0,data:"",rawLog:"",logs:[],info:"",gasWanted:g.Long.ZERO,gasUsed:g.Long.ZERO,tx:void 0,timestamp:"",events:[]}}e.TxResponse={encode(E,Q=w.Writer.create()){E.height.isZero()||Q.uint32(8).int64(E.height),E.txhash!==""&&Q.uint32(18).string(E.txhash),E.codespace!==""&&Q.uint32(26).string(E.codespace),E.code!==0&&Q.uint32(32).uint32(E.code),E.data!==""&&Q.uint32(42).string(E.data),E.rawLog!==""&&Q.uint32(50).string(E.rawLog);for(let H of E.logs)e.ABCIMessageLog.encode(H,Q.uint32(58).fork()).ldelim();E.info!==""&&Q.uint32(66).string(E.info),E.gasWanted.isZero()||Q.uint32(72).int64(E.gasWanted),E.gasUsed.isZero()||Q.uint32(80).int64(E.gasUsed),E.tx!==void 0&&f.Any.encode(E.tx,Q.uint32(90).fork()).ldelim(),E.timestamp!==""&&Q.uint32(98).string(E.timestamp);for(let H of E.events)l.Event.encode(H,Q.uint32(106).fork()).ldelim();return Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=N();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.height=H.int64();break;case 2:ee.txhash=H.string();break;case 3:ee.codespace=H.string();break;case 4:ee.code=H.uint32();break;case 5:ee.data=H.string();break;case 6:ee.rawLog=H.string();break;case 7:ee.logs.push(e.ABCIMessageLog.decode(H,H.uint32()));break;case 8:ee.info=H.string();break;case 9:ee.gasWanted=H.int64();break;case 10:ee.gasUsed=H.int64();break;case 11:ee.tx=f.Any.decode(H,H.uint32());break;case 12:ee.timestamp=H.string();break;case 13:ee.events.push(l.Event.decode(H,H.uint32()));break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{height:(0,g.isSet)(E.height)?g.Long.fromValue(E.height):g.Long.ZERO,txhash:(0,g.isSet)(E.txhash)?String(E.txhash):"",codespace:(0,g.isSet)(E.codespace)?String(E.codespace):"",code:(0,g.isSet)(E.code)?Number(E.code):0,data:(0,g.isSet)(E.data)?String(E.data):"",rawLog:(0,g.isSet)(E.rawLog)?String(E.rawLog):"",logs:Array.isArray(E==null?void 0:E.logs)?E.logs.map(Q=>e.ABCIMessageLog.fromJSON(Q)):[],info:(0,g.isSet)(E.info)?String(E.info):"",gasWanted:(0,g.isSet)(E.gasWanted)?g.Long.fromValue(E.gasWanted):g.Long.ZERO,gasUsed:(0,g.isSet)(E.gasUsed)?g.Long.fromValue(E.gasUsed):g.Long.ZERO,tx:(0,g.isSet)(E.tx)?f.Any.fromJSON(E.tx):void 0,timestamp:(0,g.isSet)(E.timestamp)?String(E.timestamp):"",events:Array.isArray(E==null?void 0:E.events)?E.events.map(Q=>l.Event.fromJSON(Q)):[]}},toJSON(E){let Q={};return E.height!==void 0&&(Q.height=(E.height||g.Long.ZERO).toString()),E.txhash!==void 0&&(Q.txhash=E.txhash),E.codespace!==void 0&&(Q.codespace=E.codespace),E.code!==void 0&&(Q.code=Math.round(E.code)),E.data!==void 0&&(Q.data=E.data),E.rawLog!==void 0&&(Q.rawLog=E.rawLog),E.logs?Q.logs=E.logs.map(H=>H?e.ABCIMessageLog.toJSON(H):void 0):Q.logs=[],E.info!==void 0&&(Q.info=E.info),E.gasWanted!==void 0&&(Q.gasWanted=(E.gasWanted||g.Long.ZERO).toString()),E.gasUsed!==void 0&&(Q.gasUsed=(E.gasUsed||g.Long.ZERO).toString()),E.tx!==void 0&&(Q.tx=E.tx?f.Any.toJSON(E.tx):void 0),E.timestamp!==void 0&&(Q.timestamp=E.timestamp),E.events?Q.events=E.events.map(H=>H?l.Event.toJSON(H):void 0):Q.events=[],Q},fromPartial(E){var H,re,ee,T,se,p,L,V,K;let Q=N();return Q.height=E.height!==void 0&&E.height!==null?g.Long.fromValue(E.height):g.Long.ZERO,Q.txhash=(H=E.txhash)!=null?H:"",Q.codespace=(re=E.codespace)!=null?re:"",Q.code=(ee=E.code)!=null?ee:0,Q.data=(T=E.data)!=null?T:"",Q.rawLog=(se=E.rawLog)!=null?se:"",Q.logs=((p=E.logs)==null?void 0:p.map(m=>e.ABCIMessageLog.fromPartial(m)))||[],Q.info=(L=E.info)!=null?L:"",Q.gasWanted=E.gasWanted!==void 0&&E.gasWanted!==null?g.Long.fromValue(E.gasWanted):g.Long.ZERO,Q.gasUsed=E.gasUsed!==void 0&&E.gasUsed!==null?g.Long.fromValue(E.gasUsed):g.Long.ZERO,Q.tx=E.tx!==void 0&&E.tx!==null?f.Any.fromPartial(E.tx):void 0,Q.timestamp=(V=E.timestamp)!=null?V:"",Q.events=((K=E.events)==null?void 0:K.map(m=>l.Event.fromPartial(m)))||[],Q}};function F(){return{msgIndex:0,log:"",events:[]}}e.ABCIMessageLog={encode(E,Q=w.Writer.create()){E.msgIndex!==0&&Q.uint32(8).uint32(E.msgIndex),E.log!==""&&Q.uint32(18).string(E.log);for(let H of E.events)e.StringEvent.encode(H,Q.uint32(26).fork()).ldelim();return Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=F();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.msgIndex=H.uint32();break;case 2:ee.log=H.string();break;case 3:ee.events.push(e.StringEvent.decode(H,H.uint32()));break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{msgIndex:(0,g.isSet)(E.msgIndex)?Number(E.msgIndex):0,log:(0,g.isSet)(E.log)?String(E.log):"",events:Array.isArray(E==null?void 0:E.events)?E.events.map(Q=>e.StringEvent.fromJSON(Q)):[]}},toJSON(E){let Q={};return E.msgIndex!==void 0&&(Q.msgIndex=Math.round(E.msgIndex)),E.log!==void 0&&(Q.log=E.log),E.events?Q.events=E.events.map(H=>H?e.StringEvent.toJSON(H):void 0):Q.events=[],Q},fromPartial(E){var H,re,ee;let Q=F();return Q.msgIndex=(H=E.msgIndex)!=null?H:0,Q.log=(re=E.log)!=null?re:"",Q.events=((ee=E.events)==null?void 0:ee.map(T=>e.StringEvent.fromPartial(T)))||[],Q}};function j(){return{type:"",attributes:[]}}e.StringEvent={encode(E,Q=w.Writer.create()){E.type!==""&&Q.uint32(10).string(E.type);for(let H of E.attributes)e.Attribute.encode(H,Q.uint32(18).fork()).ldelim();return Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=j();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.type=H.string();break;case 2:ee.attributes.push(e.Attribute.decode(H,H.uint32()));break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{type:(0,g.isSet)(E.type)?String(E.type):"",attributes:Array.isArray(E==null?void 0:E.attributes)?E.attributes.map(Q=>e.Attribute.fromJSON(Q)):[]}},toJSON(E){let Q={};return E.type!==void 0&&(Q.type=E.type),E.attributes?Q.attributes=E.attributes.map(H=>H?e.Attribute.toJSON(H):void 0):Q.attributes=[],Q},fromPartial(E){var H,re;let Q=j();return Q.type=(H=E.type)!=null?H:"",Q.attributes=((re=E.attributes)==null?void 0:re.map(ee=>e.Attribute.fromPartial(ee)))||[],Q}};function te(){return{key:"",value:""}}e.Attribute={encode(E,Q=w.Writer.create()){return E.key!==""&&Q.uint32(10).string(E.key),E.value!==""&&Q.uint32(18).string(E.value),Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=te();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.key=H.string();break;case 2:ee.value=H.string();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{key:(0,g.isSet)(E.key)?String(E.key):"",value:(0,g.isSet)(E.value)?String(E.value):""}},toJSON(E){let Q={};return E.key!==void 0&&(Q.key=E.key),E.value!==void 0&&(Q.value=E.value),Q},fromPartial(E){var H,re;let Q=te();return Q.key=(H=E.key)!=null?H:"",Q.value=(re=E.value)!=null?re:"",Q}};function v(){return{gasWanted:g.Long.UZERO,gasUsed:g.Long.UZERO}}e.GasInfo={encode(E,Q=w.Writer.create()){return E.gasWanted.isZero()||Q.uint32(8).uint64(E.gasWanted),E.gasUsed.isZero()||Q.uint32(16).uint64(E.gasUsed),Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=v();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.gasWanted=H.uint64();break;case 2:ee.gasUsed=H.uint64();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{gasWanted:(0,g.isSet)(E.gasWanted)?g.Long.fromValue(E.gasWanted):g.Long.UZERO,gasUsed:(0,g.isSet)(E.gasUsed)?g.Long.fromValue(E.gasUsed):g.Long.UZERO}},toJSON(E){let Q={};return E.gasWanted!==void 0&&(Q.gasWanted=(E.gasWanted||g.Long.UZERO).toString()),E.gasUsed!==void 0&&(Q.gasUsed=(E.gasUsed||g.Long.UZERO).toString()),Q},fromPartial(E){let Q=v();return Q.gasWanted=E.gasWanted!==void 0&&E.gasWanted!==null?g.Long.fromValue(E.gasWanted):g.Long.UZERO,Q.gasUsed=E.gasUsed!==void 0&&E.gasUsed!==null?g.Long.fromValue(E.gasUsed):g.Long.UZERO,Q}};function ne(){return{data:new Uint8Array,log:"",events:[],msgResponses:[]}}e.Result={encode(E,Q=w.Writer.create()){E.data.length!==0&&Q.uint32(10).bytes(E.data),E.log!==""&&Q.uint32(18).string(E.log);for(let H of E.events)l.Event.encode(H,Q.uint32(26).fork()).ldelim();for(let H of E.msgResponses)f.Any.encode(H,Q.uint32(34).fork()).ldelim();return Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=ne();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.data=H.bytes();break;case 2:ee.log=H.string();break;case 3:ee.events.push(l.Event.decode(H,H.uint32()));break;case 4:ee.msgResponses.push(f.Any.decode(H,H.uint32()));break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{data:(0,g.isSet)(E.data)?(0,g.bytesFromBase64)(E.data):new Uint8Array,log:(0,g.isSet)(E.log)?String(E.log):"",events:Array.isArray(E==null?void 0:E.events)?E.events.map(Q=>l.Event.fromJSON(Q)):[],msgResponses:Array.isArray(E==null?void 0:E.msgResponses)?E.msgResponses.map(Q=>f.Any.fromJSON(Q)):[]}},toJSON(E){let Q={};return E.data!==void 0&&(Q.data=(0,g.base64FromBytes)(E.data!==void 0?E.data:new Uint8Array)),E.log!==void 0&&(Q.log=E.log),E.events?Q.events=E.events.map(H=>H?l.Event.toJSON(H):void 0):Q.events=[],E.msgResponses?Q.msgResponses=E.msgResponses.map(H=>H?f.Any.toJSON(H):void 0):Q.msgResponses=[],Q},fromPartial(E){var H,re,ee,T;let Q=ne();return Q.data=(H=E.data)!=null?H:new Uint8Array,Q.log=(re=E.log)!=null?re:"",Q.events=((ee=E.events)==null?void 0:ee.map(se=>l.Event.fromPartial(se)))||[],Q.msgResponses=((T=E.msgResponses)==null?void 0:T.map(se=>f.Any.fromPartial(se)))||[],Q}};function Z(){return{gasInfo:void 0,result:void 0}}e.SimulationResponse={encode(E,Q=w.Writer.create()){return E.gasInfo!==void 0&&e.GasInfo.encode(E.gasInfo,Q.uint32(10).fork()).ldelim(),E.result!==void 0&&e.Result.encode(E.result,Q.uint32(18).fork()).ldelim(),Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=Z();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.gasInfo=e.GasInfo.decode(H,H.uint32());break;case 2:ee.result=e.Result.decode(H,H.uint32());break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{gasInfo:(0,g.isSet)(E.gasInfo)?e.GasInfo.fromJSON(E.gasInfo):void 0,result:(0,g.isSet)(E.result)?e.Result.fromJSON(E.result):void 0}},toJSON(E){let Q={};return E.gasInfo!==void 0&&(Q.gasInfo=E.gasInfo?e.GasInfo.toJSON(E.gasInfo):void 0),E.result!==void 0&&(Q.result=E.result?e.Result.toJSON(E.result):void 0),Q},fromPartial(E){let Q=Z();return Q.gasInfo=E.gasInfo!==void 0&&E.gasInfo!==null?e.GasInfo.fromPartial(E.gasInfo):void 0,Q.result=E.result!==void 0&&E.result!==null?e.Result.fromPartial(E.result):void 0,Q}};function R(){return{msgType:"",data:new Uint8Array}}e.MsgData={encode(E,Q=w.Writer.create()){return E.msgType!==""&&Q.uint32(10).string(E.msgType),E.data.length!==0&&Q.uint32(18).bytes(E.data),Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=R();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.msgType=H.string();break;case 2:ee.data=H.bytes();break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{msgType:(0,g.isSet)(E.msgType)?String(E.msgType):"",data:(0,g.isSet)(E.data)?(0,g.bytesFromBase64)(E.data):new Uint8Array}},toJSON(E){let Q={};return E.msgType!==void 0&&(Q.msgType=E.msgType),E.data!==void 0&&(Q.data=(0,g.base64FromBytes)(E.data!==void 0?E.data:new Uint8Array)),Q},fromPartial(E){var H,re;let Q=R();return Q.msgType=(H=E.msgType)!=null?H:"",Q.data=(re=E.data)!=null?re:new Uint8Array,Q}};function M(){return{data:[],msgResponses:[]}}e.TxMsgData={encode(E,Q=w.Writer.create()){for(let H of E.data)e.MsgData.encode(H,Q.uint32(10).fork()).ldelim();for(let H of E.msgResponses)f.Any.encode(H,Q.uint32(18).fork()).ldelim();return Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=M();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.data.push(e.MsgData.decode(H,H.uint32()));break;case 2:ee.msgResponses.push(f.Any.decode(H,H.uint32()));break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{data:Array.isArray(E==null?void 0:E.data)?E.data.map(Q=>e.MsgData.fromJSON(Q)):[],msgResponses:Array.isArray(E==null?void 0:E.msgResponses)?E.msgResponses.map(Q=>f.Any.fromJSON(Q)):[]}},toJSON(E){let Q={};return E.data?Q.data=E.data.map(H=>H?e.MsgData.toJSON(H):void 0):Q.data=[],E.msgResponses?Q.msgResponses=E.msgResponses.map(H=>H?f.Any.toJSON(H):void 0):Q.msgResponses=[],Q},fromPartial(E){var H,re;let Q=M();return Q.data=((H=E.data)==null?void 0:H.map(ee=>e.MsgData.fromPartial(ee)))||[],Q.msgResponses=((re=E.msgResponses)==null?void 0:re.map(ee=>f.Any.fromPartial(ee)))||[],Q}};function U(){return{totalCount:g.Long.UZERO,count:g.Long.UZERO,pageNumber:g.Long.UZERO,pageTotal:g.Long.UZERO,limit:g.Long.UZERO,txs:[]}}e.SearchTxsResult={encode(E,Q=w.Writer.create()){E.totalCount.isZero()||Q.uint32(8).uint64(E.totalCount),E.count.isZero()||Q.uint32(16).uint64(E.count),E.pageNumber.isZero()||Q.uint32(24).uint64(E.pageNumber),E.pageTotal.isZero()||Q.uint32(32).uint64(E.pageTotal),E.limit.isZero()||Q.uint32(40).uint64(E.limit);for(let H of E.txs)e.TxResponse.encode(H,Q.uint32(50).fork()).ldelim();return Q},decode(E,Q){let H=E instanceof w.Reader?E:new w.Reader(E),re=Q===void 0?H.len:H.pos+Q,ee=U();for(;H.pos<re;){let T=H.uint32();switch(T>>>3){case 1:ee.totalCount=H.uint64();break;case 2:ee.count=H.uint64();break;case 3:ee.pageNumber=H.uint64();break;case 4:ee.pageTotal=H.uint64();break;case 5:ee.limit=H.uint64();break;case 6:ee.txs.push(e.TxResponse.decode(H,H.uint32()));break;default:H.skipType(T&7);break}}return ee},fromJSON(E){return{totalCount:(0,g.isSet)(E.totalCount)?g.Long.fromValue(E.totalCount):g.Long.UZERO,count:(0,g.isSet)(E.count)?g.Long.fromValue(E.count):g.Long.UZERO,pageNumber:(0,g.isSet)(E.pageNumber)?g.Long.fromValue(E.pageNumber):g.Long.UZERO,pageTotal:(0,g.isSet)(E.pageTotal)?g.Long.fromValue(E.pageTotal):g.Long.UZERO,limit:(0,g.isSet)(E.limit)?g.Long.fromValue(E.limit):g.Long.UZERO,txs:Array.isArray(E==null?void 0:E.txs)?E.txs.map(Q=>e.TxResponse.fromJSON(Q)):[]}},toJSON(E){let Q={};return E.totalCount!==void 0&&(Q.totalCount=(E.totalCount||g.Long.UZERO).toString()),E.count!==void 0&&(Q.count=(E.count||g.Long.UZERO).toString()),E.pageNumber!==void 0&&(Q.pageNumber=(E.pageNumber||g.Long.UZERO).toString()),E.pageTotal!==void 0&&(Q.pageTotal=(E.pageTotal||g.Long.UZERO).toString()),E.limit!==void 0&&(Q.limit=(E.limit||g.Long.UZERO).toString()),E.txs?Q.txs=E.txs.map(H=>H?e.TxResponse.toJSON(H):void 0):Q.txs=[],Q},fromPartial(E){var H;let Q=U();return Q.totalCount=E.totalCount!==void 0&&E.totalCount!==null?g.Long.fromValue(E.totalCount):g.Long.UZERO,Q.count=E.count!==void 0&&E.count!==null?g.Long.fromValue(E.count):g.Long.UZERO,Q.pageNumber=E.pageNumber!==void 0&&E.pageNumber!==null?g.Long.fromValue(E.pageNumber):g.Long.UZERO,Q.pageTotal=E.pageTotal!==void 0&&E.pageTotal!==null?g.Long.fromValue(E.pageTotal):g.Long.UZERO,Q.limit=E.limit!==void 0&&E.limit!==null?g.Long.fromValue(E.limit):g.Long.UZERO,Q.txs=((H=E.txs)==null?void 0:H.map(re=>e.TxResponse.fromPartial(re)))||[],Q}}})(bIn);var gSe={},V$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(ne,Z,R,M){M===void 0&&(M=R);var U=Object.getOwnPropertyDescriptor(Z,R);(!U||("get"in U?!Z.__esModule:U.writable||U.configurable))&&(U={enumerable:!0,get:function(){return Z[R]}}),Object.defineProperty(ne,M,U)}:function(ne,Z,R,M){M===void 0&&(M=R),ne[M]=Z[R]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(ne,Z){Object.defineProperty(ne,"default",{enumerable:!0,value:Z})}:function(ne,Z){ne.default=Z}),c=Fr&&Fr.__importStar||function(ne){if(ne&&ne.__esModule)return ne;var Z={};if(ne!=null)for(var R in ne)R!=="default"&&Object.prototype.hasOwnProperty.call(ne,R)&&i(Z,ne,R);return A(Z,ne),Z};Object.defineProperty(e,"__esModule",{value:!0}),e.EvidenceList=e.LightClientAttackEvidence=e.DuplicateVoteEvidence=e.Evidence=e.protobufPackage=void 0;let f=Yfe,l=k3,g=hvt,w=Ns,N=c(BA);e.protobufPackage="tendermint.types";function F(){return{duplicateVoteEvidence:void 0,lightClientAttackEvidence:void 0}}e.Evidence={encode(ne,Z=N.Writer.create()){return ne.duplicateVoteEvidence!==void 0&&e.DuplicateVoteEvidence.encode(ne.duplicateVoteEvidence,Z.uint32(10).fork()).ldelim(),ne.lightClientAttackEvidence!==void 0&&e.LightClientAttackEvidence.encode(ne.lightClientAttackEvidence,Z.uint32(18).fork()).ldelim(),Z},decode(ne,Z){let R=ne instanceof N.Reader?ne:new N.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=F();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.duplicateVoteEvidence=e.DuplicateVoteEvidence.decode(R,R.uint32());break;case 2:U.lightClientAttackEvidence=e.LightClientAttackEvidence.decode(R,R.uint32());break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{duplicateVoteEvidence:(0,w.isSet)(ne.duplicateVoteEvidence)?e.DuplicateVoteEvidence.fromJSON(ne.duplicateVoteEvidence):void 0,lightClientAttackEvidence:(0,w.isSet)(ne.lightClientAttackEvidence)?e.LightClientAttackEvidence.fromJSON(ne.lightClientAttackEvidence):void 0}},toJSON(ne){let Z={};return ne.duplicateVoteEvidence!==void 0&&(Z.duplicateVoteEvidence=ne.duplicateVoteEvidence?e.DuplicateVoteEvidence.toJSON(ne.duplicateVoteEvidence):void 0),ne.lightClientAttackEvidence!==void 0&&(Z.lightClientAttackEvidence=ne.lightClientAttackEvidence?e.LightClientAttackEvidence.toJSON(ne.lightClientAttackEvidence):void 0),Z},fromPartial(ne){let Z=F();return Z.duplicateVoteEvidence=ne.duplicateVoteEvidence!==void 0&&ne.duplicateVoteEvidence!==null?e.DuplicateVoteEvidence.fromPartial(ne.duplicateVoteEvidence):void 0,Z.lightClientAttackEvidence=ne.lightClientAttackEvidence!==void 0&&ne.lightClientAttackEvidence!==null?e.LightClientAttackEvidence.fromPartial(ne.lightClientAttackEvidence):void 0,Z}};function j(){return{voteA:void 0,voteB:void 0,totalVotingPower:w.Long.ZERO,validatorPower:w.Long.ZERO,timestamp:void 0}}e.DuplicateVoteEvidence={encode(ne,Z=N.Writer.create()){return ne.voteA!==void 0&&f.Vote.encode(ne.voteA,Z.uint32(10).fork()).ldelim(),ne.voteB!==void 0&&f.Vote.encode(ne.voteB,Z.uint32(18).fork()).ldelim(),ne.totalVotingPower.isZero()||Z.uint32(24).int64(ne.totalVotingPower),ne.validatorPower.isZero()||Z.uint32(32).int64(ne.validatorPower),ne.timestamp!==void 0&&l.Timestamp.encode(ne.timestamp,Z.uint32(42).fork()).ldelim(),Z},decode(ne,Z){let R=ne instanceof N.Reader?ne:new N.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=j();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.voteA=f.Vote.decode(R,R.uint32());break;case 2:U.voteB=f.Vote.decode(R,R.uint32());break;case 3:U.totalVotingPower=R.int64();break;case 4:U.validatorPower=R.int64();break;case 5:U.timestamp=l.Timestamp.decode(R,R.uint32());break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{voteA:(0,w.isSet)(ne.voteA)?f.Vote.fromJSON(ne.voteA):void 0,voteB:(0,w.isSet)(ne.voteB)?f.Vote.fromJSON(ne.voteB):void 0,totalVotingPower:(0,w.isSet)(ne.totalVotingPower)?w.Long.fromValue(ne.totalVotingPower):w.Long.ZERO,validatorPower:(0,w.isSet)(ne.validatorPower)?w.Long.fromValue(ne.validatorPower):w.Long.ZERO,timestamp:(0,w.isSet)(ne.timestamp)?(0,w.fromJsonTimestamp)(ne.timestamp):void 0}},toJSON(ne){let Z={};return ne.voteA!==void 0&&(Z.voteA=ne.voteA?f.Vote.toJSON(ne.voteA):void 0),ne.voteB!==void 0&&(Z.voteB=ne.voteB?f.Vote.toJSON(ne.voteB):void 0),ne.totalVotingPower!==void 0&&(Z.totalVotingPower=(ne.totalVotingPower||w.Long.ZERO).toString()),ne.validatorPower!==void 0&&(Z.validatorPower=(ne.validatorPower||w.Long.ZERO).toString()),ne.timestamp!==void 0&&(Z.timestamp=(0,w.fromTimestamp)(ne.timestamp).toISOString()),Z},fromPartial(ne){let Z=j();return Z.voteA=ne.voteA!==void 0&&ne.voteA!==null?f.Vote.fromPartial(ne.voteA):void 0,Z.voteB=ne.voteB!==void 0&&ne.voteB!==null?f.Vote.fromPartial(ne.voteB):void 0,Z.totalVotingPower=ne.totalVotingPower!==void 0&&ne.totalVotingPower!==null?w.Long.fromValue(ne.totalVotingPower):w.Long.ZERO,Z.validatorPower=ne.validatorPower!==void 0&&ne.validatorPower!==null?w.Long.fromValue(ne.validatorPower):w.Long.ZERO,Z.timestamp=ne.timestamp!==void 0&&ne.timestamp!==null?l.Timestamp.fromPartial(ne.timestamp):void 0,Z}};function te(){return{conflictingBlock:void 0,commonHeight:w.Long.ZERO,byzantineValidators:[],totalVotingPower:w.Long.ZERO,timestamp:void 0}}e.LightClientAttackEvidence={encode(ne,Z=N.Writer.create()){ne.conflictingBlock!==void 0&&f.LightBlock.encode(ne.conflictingBlock,Z.uint32(10).fork()).ldelim(),ne.commonHeight.isZero()||Z.uint32(16).int64(ne.commonHeight);for(let R of ne.byzantineValidators)g.Validator.encode(R,Z.uint32(26).fork()).ldelim();return ne.totalVotingPower.isZero()||Z.uint32(32).int64(ne.totalVotingPower),ne.timestamp!==void 0&&l.Timestamp.encode(ne.timestamp,Z.uint32(42).fork()).ldelim(),Z},decode(ne,Z){let R=ne instanceof N.Reader?ne:new N.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=te();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.conflictingBlock=f.LightBlock.decode(R,R.uint32());break;case 2:U.commonHeight=R.int64();break;case 3:U.byzantineValidators.push(g.Validator.decode(R,R.uint32()));break;case 4:U.totalVotingPower=R.int64();break;case 5:U.timestamp=l.Timestamp.decode(R,R.uint32());break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{conflictingBlock:(0,w.isSet)(ne.conflictingBlock)?f.LightBlock.fromJSON(ne.conflictingBlock):void 0,commonHeight:(0,w.isSet)(ne.commonHeight)?w.Long.fromValue(ne.commonHeight):w.Long.ZERO,byzantineValidators:Array.isArray(ne==null?void 0:ne.byzantineValidators)?ne.byzantineValidators.map(Z=>g.Validator.fromJSON(Z)):[],totalVotingPower:(0,w.isSet)(ne.totalVotingPower)?w.Long.fromValue(ne.totalVotingPower):w.Long.ZERO,timestamp:(0,w.isSet)(ne.timestamp)?(0,w.fromJsonTimestamp)(ne.timestamp):void 0}},toJSON(ne){let Z={};return ne.conflictingBlock!==void 0&&(Z.conflictingBlock=ne.conflictingBlock?f.LightBlock.toJSON(ne.conflictingBlock):void 0),ne.commonHeight!==void 0&&(Z.commonHeight=(ne.commonHeight||w.Long.ZERO).toString()),ne.byzantineValidators?Z.byzantineValidators=ne.byzantineValidators.map(R=>R?g.Validator.toJSON(R):void 0):Z.byzantineValidators=[],ne.totalVotingPower!==void 0&&(Z.totalVotingPower=(ne.totalVotingPower||w.Long.ZERO).toString()),ne.timestamp!==void 0&&(Z.timestamp=(0,w.fromTimestamp)(ne.timestamp).toISOString()),Z},fromPartial(ne){var R;let Z=te();return Z.conflictingBlock=ne.conflictingBlock!==void 0&&ne.conflictingBlock!==null?f.LightBlock.fromPartial(ne.conflictingBlock):void 0,Z.commonHeight=ne.commonHeight!==void 0&&ne.commonHeight!==null?w.Long.fromValue(ne.commonHeight):w.Long.ZERO,Z.byzantineValidators=((R=ne.byzantineValidators)==null?void 0:R.map(M=>g.Validator.fromPartial(M)))||[],Z.totalVotingPower=ne.totalVotingPower!==void 0&&ne.totalVotingPower!==null?w.Long.fromValue(ne.totalVotingPower):w.Long.ZERO,Z.timestamp=ne.timestamp!==void 0&&ne.timestamp!==null?l.Timestamp.fromPartial(ne.timestamp):void 0,Z}};function v(){return{evidence:[]}}e.EvidenceList={encode(ne,Z=N.Writer.create()){for(let R of ne.evidence)e.Evidence.encode(R,Z.uint32(10).fork()).ldelim();return Z},decode(ne,Z){let R=ne instanceof N.Reader?ne:new N.Reader(ne),M=Z===void 0?R.len:R.pos+Z,U=v();for(;R.pos<M;){let E=R.uint32();switch(E>>>3){case 1:U.evidence.push(e.Evidence.decode(R,R.uint32()));break;default:R.skipType(E&7);break}}return U},fromJSON(ne){return{evidence:Array.isArray(ne==null?void 0:ne.evidence)?ne.evidence.map(Z=>e.Evidence.fromJSON(Z)):[]}},toJSON(ne){let Z={};return ne.evidence?Z.evidence=ne.evidence.map(R=>R?e.Evidence.toJSON(R):void 0):Z.evidence=[],Z},fromPartial(ne){var R;let Z=v();return Z.evidence=((R=ne.evidence)==null?void 0:R.map(M=>e.Evidence.fromPartial(M)))||[],Z}}})(V$r);var pbs=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),ybs=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),mbs=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&pbs(i,e,A);return ybs(i,e),i};Object.defineProperty(gSe,"__esModule",{value:!0});gSe.Block=gSe.protobufPackage=void 0;var _w=Yfe,YHe=V$r,U2n=mbs(BA),Q3t=Ns;gSe.protobufPackage="tendermint.types";function OLr(){return{header:void 0,data:void 0,evidence:void 0,lastCommit:void 0}}gSe.Block={encode(e,i=U2n.Writer.create()){return e.header!==void 0&&_w.Header.encode(e.header,i.uint32(10).fork()).ldelim(),e.data!==void 0&&_w.Data.encode(e.data,i.uint32(18).fork()).ldelim(),e.evidence!==void 0&&YHe.EvidenceList.encode(e.evidence,i.uint32(26).fork()).ldelim(),e.lastCommit!==void 0&&_w.Commit.encode(e.lastCommit,i.uint32(34).fork()).ldelim(),i},decode(e,i){let A=e instanceof U2n.Reader?e:new U2n.Reader(e),c=i===void 0?A.len:A.pos+i,f=OLr();for(;A.pos<c;){let l=A.uint32();switch(l>>>3){case 1:f.header=_w.Header.decode(A,A.uint32());break;case 2:f.data=_w.Data.decode(A,A.uint32());break;case 3:f.evidence=YHe.EvidenceList.decode(A,A.uint32());break;case 4:f.lastCommit=_w.Commit.decode(A,A.uint32());break;default:A.skipType(l&7);break}}return f},fromJSON(e){return{header:(0,Q3t.isSet)(e.header)?_w.Header.fromJSON(e.header):void 0,data:(0,Q3t.isSet)(e.data)?_w.Data.fromJSON(e.data):void 0,evidence:(0,Q3t.isSet)(e.evidence)?YHe.EvidenceList.fromJSON(e.evidence):void 0,lastCommit:(0,Q3t.isSet)(e.lastCommit)?_w.Commit.fromJSON(e.lastCommit):void 0}},toJSON(e){let i={};return e.header!==void 0&&(i.header=e.header?_w.Header.toJSON(e.header):void 0),e.data!==void 0&&(i.data=e.data?_w.Data.toJSON(e.data):void 0),e.evidence!==void 0&&(i.evidence=e.evidence?YHe.EvidenceList.toJSON(e.evidence):void 0),e.lastCommit!==void 0&&(i.lastCommit=e.lastCommit?_w.Commit.toJSON(e.lastCommit):void 0),i},fromPartial(e){let i=OLr();return i.header=e.header!==void 0&&e.header!==null?_w.Header.fromPartial(e.header):void 0,i.data=e.data!==void 0&&e.data!==null?_w.Data.fromPartial(e.data):void 0,i.evidence=e.evidence!==void 0&&e.evidence!==null?YHe.EvidenceList.fromPartial(e.evidence):void 0,i.lastCommit=e.lastCommit!==void 0&&e.lastCommit!==null?_w.Commit.fromPartial(e.lastCommit):void 0,i}};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(G,I,C,D){D===void 0&&(D=C);var W=Object.getOwnPropertyDescriptor(I,C);(!W||("get"in W?!I.__esModule:W.writable||W.configurable))&&(W={enumerable:!0,get:function(){return I[C]}}),Object.defineProperty(G,D,W)}:function(G,I,C,D){D===void 0&&(D=C),G[D]=I[C]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(G,I){Object.defineProperty(G,"default",{enumerable:!0,value:I})}:function(G,I){G.default=I}),c=Fr&&Fr.__importStar||function(G){if(G&&G.__esModule)return G;var I={};if(G!=null)for(var C in G)C!=="default"&&Object.prototype.hasOwnProperty.call(G,C)&&i(I,G,C);return A(I,G),I};Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceClientImpl=e.TxDecodeAminoResponse=e.TxDecodeAminoRequest=e.TxEncodeAminoResponse=e.TxEncodeAminoRequest=e.TxEncodeResponse=e.TxEncodeRequest=e.TxDecodeResponse=e.TxDecodeRequest=e.GetBlockWithTxsResponse=e.GetBlockWithTxsRequest=e.GetTxResponse=e.GetTxRequest=e.SimulateResponse=e.SimulateRequest=e.BroadcastTxResponse=e.BroadcastTxRequest=e.GetTxsEventResponse=e.GetTxsEventRequest=e.broadcastModeToJSON=e.broadcastModeFromJSON=e.BroadcastMode=e.orderByToJSON=e.orderByFromJSON=e.OrderBy=e.protobufPackage=void 0;let f=fW,l=Hm,g=bIn,w=Yfe,N=gSe,F=Ns,j=c(BA);e.protobufPackage="cosmos.tx.v1beta1";var te;(function(G){G[G.ORDER_BY_UNSPECIFIED=0]="ORDER_BY_UNSPECIFIED",G[G.ORDER_BY_ASC=1]="ORDER_BY_ASC",G[G.ORDER_BY_DESC=2]="ORDER_BY_DESC",G[G.UNRECOGNIZED=-1]="UNRECOGNIZED"})(te=e.OrderBy||(e.OrderBy={}));function v(G){switch(G){case 0:case"ORDER_BY_UNSPECIFIED":return te.ORDER_BY_UNSPECIFIED;case 1:case"ORDER_BY_ASC":return te.ORDER_BY_ASC;case 2:case"ORDER_BY_DESC":return te.ORDER_BY_DESC;case-1:case"UNRECOGNIZED":default:return te.UNRECOGNIZED}}e.orderByFromJSON=v;function ne(G){switch(G){case te.ORDER_BY_UNSPECIFIED:return"ORDER_BY_UNSPECIFIED";case te.ORDER_BY_ASC:return"ORDER_BY_ASC";case te.ORDER_BY_DESC:return"ORDER_BY_DESC";case te.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.orderByToJSON=ne;var Z;(function(G){G[G.BROADCAST_MODE_UNSPECIFIED=0]="BROADCAST_MODE_UNSPECIFIED",G[G.BROADCAST_MODE_BLOCK=1]="BROADCAST_MODE_BLOCK",G[G.BROADCAST_MODE_SYNC=2]="BROADCAST_MODE_SYNC",G[G.BROADCAST_MODE_ASYNC=3]="BROADCAST_MODE_ASYNC",G[G.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Z=e.BroadcastMode||(e.BroadcastMode={}));function R(G){switch(G){case 0:case"BROADCAST_MODE_UNSPECIFIED":return Z.BROADCAST_MODE_UNSPECIFIED;case 1:case"BROADCAST_MODE_BLOCK":return Z.BROADCAST_MODE_BLOCK;case 2:case"BROADCAST_MODE_SYNC":return Z.BROADCAST_MODE_SYNC;case 3:case"BROADCAST_MODE_ASYNC":return Z.BROADCAST_MODE_ASYNC;case-1:case"UNRECOGNIZED":default:return Z.UNRECOGNIZED}}e.broadcastModeFromJSON=R;function M(G){switch(G){case Z.BROADCAST_MODE_UNSPECIFIED:return"BROADCAST_MODE_UNSPECIFIED";case Z.BROADCAST_MODE_BLOCK:return"BROADCAST_MODE_BLOCK";case Z.BROADCAST_MODE_SYNC:return"BROADCAST_MODE_SYNC";case Z.BROADCAST_MODE_ASYNC:return"BROADCAST_MODE_ASYNC";case Z.UNRECOGNIZED:default:return"UNRECOGNIZED"}}e.broadcastModeToJSON=M;function U(){return{events:[],pagination:void 0,orderBy:0,page:F.Long.UZERO,limit:F.Long.UZERO}}e.GetTxsEventRequest={encode(G,I=j.Writer.create()){for(let C of G.events)I.uint32(10).string(C);return G.pagination!==void 0&&l.PageRequest.encode(G.pagination,I.uint32(18).fork()).ldelim(),G.orderBy!==0&&I.uint32(24).int32(G.orderBy),G.page.isZero()||I.uint32(32).uint64(G.page),G.limit.isZero()||I.uint32(40).uint64(G.limit),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=U();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.events.push(C.string());break;case 2:W.pagination=l.PageRequest.decode(C,C.uint32());break;case 3:W.orderBy=C.int32();break;case 4:W.page=C.uint64();break;case 5:W.limit=C.uint64();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{events:Array.isArray(G==null?void 0:G.events)?G.events.map(I=>String(I)):[],pagination:(0,F.isSet)(G.pagination)?l.PageRequest.fromJSON(G.pagination):void 0,orderBy:(0,F.isSet)(G.orderBy)?v(G.orderBy):0,page:(0,F.isSet)(G.page)?F.Long.fromValue(G.page):F.Long.UZERO,limit:(0,F.isSet)(G.limit)?F.Long.fromValue(G.limit):F.Long.UZERO}},toJSON(G){let I={};return G.events?I.events=G.events.map(C=>C):I.events=[],G.pagination!==void 0&&(I.pagination=G.pagination?l.PageRequest.toJSON(G.pagination):void 0),G.orderBy!==void 0&&(I.orderBy=ne(G.orderBy)),G.page!==void 0&&(I.page=(G.page||F.Long.UZERO).toString()),G.limit!==void 0&&(I.limit=(G.limit||F.Long.UZERO).toString()),I},fromPartial(G){var C,D;let I=U();return I.events=((C=G.events)==null?void 0:C.map(W=>W))||[],I.pagination=G.pagination!==void 0&&G.pagination!==null?l.PageRequest.fromPartial(G.pagination):void 0,I.orderBy=(D=G.orderBy)!=null?D:0,I.page=G.page!==void 0&&G.page!==null?F.Long.fromValue(G.page):F.Long.UZERO,I.limit=G.limit!==void 0&&G.limit!==null?F.Long.fromValue(G.limit):F.Long.UZERO,I}};function E(){return{txs:[],txResponses:[],pagination:void 0,total:F.Long.UZERO}}e.GetTxsEventResponse={encode(G,I=j.Writer.create()){for(let C of G.txs)f.Tx.encode(C,I.uint32(10).fork()).ldelim();for(let C of G.txResponses)g.TxResponse.encode(C,I.uint32(18).fork()).ldelim();return G.pagination!==void 0&&l.PageResponse.encode(G.pagination,I.uint32(26).fork()).ldelim(),G.total.isZero()||I.uint32(32).uint64(G.total),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=E();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.txs.push(f.Tx.decode(C,C.uint32()));break;case 2:W.txResponses.push(g.TxResponse.decode(C,C.uint32()));break;case 3:W.pagination=l.PageResponse.decode(C,C.uint32());break;case 4:W.total=C.uint64();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{txs:Array.isArray(G==null?void 0:G.txs)?G.txs.map(I=>f.Tx.fromJSON(I)):[],txResponses:Array.isArray(G==null?void 0:G.txResponses)?G.txResponses.map(I=>g.TxResponse.fromJSON(I)):[],pagination:(0,F.isSet)(G.pagination)?l.PageResponse.fromJSON(G.pagination):void 0,total:(0,F.isSet)(G.total)?F.Long.fromValue(G.total):F.Long.UZERO}},toJSON(G){let I={};return G.txs?I.txs=G.txs.map(C=>C?f.Tx.toJSON(C):void 0):I.txs=[],G.txResponses?I.txResponses=G.txResponses.map(C=>C?g.TxResponse.toJSON(C):void 0):I.txResponses=[],G.pagination!==void 0&&(I.pagination=G.pagination?l.PageResponse.toJSON(G.pagination):void 0),G.total!==void 0&&(I.total=(G.total||F.Long.UZERO).toString()),I},fromPartial(G){var C,D;let I=E();return I.txs=((C=G.txs)==null?void 0:C.map(W=>f.Tx.fromPartial(W)))||[],I.txResponses=((D=G.txResponses)==null?void 0:D.map(W=>g.TxResponse.fromPartial(W)))||[],I.pagination=G.pagination!==void 0&&G.pagination!==null?l.PageResponse.fromPartial(G.pagination):void 0,I.total=G.total!==void 0&&G.total!==null?F.Long.fromValue(G.total):F.Long.UZERO,I}};function Q(){return{txBytes:new Uint8Array,mode:0}}e.BroadcastTxRequest={encode(G,I=j.Writer.create()){return G.txBytes.length!==0&&I.uint32(10).bytes(G.txBytes),G.mode!==0&&I.uint32(16).int32(G.mode),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=Q();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.txBytes=C.bytes();break;case 2:W.mode=C.int32();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{txBytes:(0,F.isSet)(G.txBytes)?(0,F.bytesFromBase64)(G.txBytes):new Uint8Array,mode:(0,F.isSet)(G.mode)?R(G.mode):0}},toJSON(G){let I={};return G.txBytes!==void 0&&(I.txBytes=(0,F.base64FromBytes)(G.txBytes!==void 0?G.txBytes:new Uint8Array)),G.mode!==void 0&&(I.mode=M(G.mode)),I},fromPartial(G){var C,D;let I=Q();return I.txBytes=(C=G.txBytes)!=null?C:new Uint8Array,I.mode=(D=G.mode)!=null?D:0,I}};function H(){return{txResponse:void 0}}e.BroadcastTxResponse={encode(G,I=j.Writer.create()){return G.txResponse!==void 0&&g.TxResponse.encode(G.txResponse,I.uint32(10).fork()).ldelim(),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=H();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.txResponse=g.TxResponse.decode(C,C.uint32());break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{txResponse:(0,F.isSet)(G.txResponse)?g.TxResponse.fromJSON(G.txResponse):void 0}},toJSON(G){let I={};return G.txResponse!==void 0&&(I.txResponse=G.txResponse?g.TxResponse.toJSON(G.txResponse):void 0),I},fromPartial(G){let I=H();return I.txResponse=G.txResponse!==void 0&&G.txResponse!==null?g.TxResponse.fromPartial(G.txResponse):void 0,I}};function re(){return{tx:void 0,txBytes:new Uint8Array}}e.SimulateRequest={encode(G,I=j.Writer.create()){return G.tx!==void 0&&f.Tx.encode(G.tx,I.uint32(10).fork()).ldelim(),G.txBytes.length!==0&&I.uint32(18).bytes(G.txBytes),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=re();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.tx=f.Tx.decode(C,C.uint32());break;case 2:W.txBytes=C.bytes();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{tx:(0,F.isSet)(G.tx)?f.Tx.fromJSON(G.tx):void 0,txBytes:(0,F.isSet)(G.txBytes)?(0,F.bytesFromBase64)(G.txBytes):new Uint8Array}},toJSON(G){let I={};return G.tx!==void 0&&(I.tx=G.tx?f.Tx.toJSON(G.tx):void 0),G.txBytes!==void 0&&(I.txBytes=(0,F.base64FromBytes)(G.txBytes!==void 0?G.txBytes:new Uint8Array)),I},fromPartial(G){var C;let I=re();return I.tx=G.tx!==void 0&&G.tx!==null?f.Tx.fromPartial(G.tx):void 0,I.txBytes=(C=G.txBytes)!=null?C:new Uint8Array,I}};function ee(){return{gasInfo:void 0,result:void 0}}e.SimulateResponse={encode(G,I=j.Writer.create()){return G.gasInfo!==void 0&&g.GasInfo.encode(G.gasInfo,I.uint32(10).fork()).ldelim(),G.result!==void 0&&g.Result.encode(G.result,I.uint32(18).fork()).ldelim(),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=ee();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.gasInfo=g.GasInfo.decode(C,C.uint32());break;case 2:W.result=g.Result.decode(C,C.uint32());break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{gasInfo:(0,F.isSet)(G.gasInfo)?g.GasInfo.fromJSON(G.gasInfo):void 0,result:(0,F.isSet)(G.result)?g.Result.fromJSON(G.result):void 0}},toJSON(G){let I={};return G.gasInfo!==void 0&&(I.gasInfo=G.gasInfo?g.GasInfo.toJSON(G.gasInfo):void 0),G.result!==void 0&&(I.result=G.result?g.Result.toJSON(G.result):void 0),I},fromPartial(G){let I=ee();return I.gasInfo=G.gasInfo!==void 0&&G.gasInfo!==null?g.GasInfo.fromPartial(G.gasInfo):void 0,I.result=G.result!==void 0&&G.result!==null?g.Result.fromPartial(G.result):void 0,I}};function T(){return{hash:""}}e.GetTxRequest={encode(G,I=j.Writer.create()){return G.hash!==""&&I.uint32(10).string(G.hash),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=T();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.hash=C.string();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{hash:(0,F.isSet)(G.hash)?String(G.hash):""}},toJSON(G){let I={};return G.hash!==void 0&&(I.hash=G.hash),I},fromPartial(G){var C;let I=T();return I.hash=(C=G.hash)!=null?C:"",I}};function se(){return{tx:void 0,txResponse:void 0}}e.GetTxResponse={encode(G,I=j.Writer.create()){return G.tx!==void 0&&f.Tx.encode(G.tx,I.uint32(10).fork()).ldelim(),G.txResponse!==void 0&&g.TxResponse.encode(G.txResponse,I.uint32(18).fork()).ldelim(),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=se();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.tx=f.Tx.decode(C,C.uint32());break;case 2:W.txResponse=g.TxResponse.decode(C,C.uint32());break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{tx:(0,F.isSet)(G.tx)?f.Tx.fromJSON(G.tx):void 0,txResponse:(0,F.isSet)(G.txResponse)?g.TxResponse.fromJSON(G.txResponse):void 0}},toJSON(G){let I={};return G.tx!==void 0&&(I.tx=G.tx?f.Tx.toJSON(G.tx):void 0),G.txResponse!==void 0&&(I.txResponse=G.txResponse?g.TxResponse.toJSON(G.txResponse):void 0),I},fromPartial(G){let I=se();return I.tx=G.tx!==void 0&&G.tx!==null?f.Tx.fromPartial(G.tx):void 0,I.txResponse=G.txResponse!==void 0&&G.txResponse!==null?g.TxResponse.fromPartial(G.txResponse):void 0,I}};function p(){return{height:F.Long.ZERO,pagination:void 0}}e.GetBlockWithTxsRequest={encode(G,I=j.Writer.create()){return G.height.isZero()||I.uint32(8).int64(G.height),G.pagination!==void 0&&l.PageRequest.encode(G.pagination,I.uint32(18).fork()).ldelim(),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=p();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.height=C.int64();break;case 2:W.pagination=l.PageRequest.decode(C,C.uint32());break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{height:(0,F.isSet)(G.height)?F.Long.fromValue(G.height):F.Long.ZERO,pagination:(0,F.isSet)(G.pagination)?l.PageRequest.fromJSON(G.pagination):void 0}},toJSON(G){let I={};return G.height!==void 0&&(I.height=(G.height||F.Long.ZERO).toString()),G.pagination!==void 0&&(I.pagination=G.pagination?l.PageRequest.toJSON(G.pagination):void 0),I},fromPartial(G){let I=p();return I.height=G.height!==void 0&&G.height!==null?F.Long.fromValue(G.height):F.Long.ZERO,I.pagination=G.pagination!==void 0&&G.pagination!==null?l.PageRequest.fromPartial(G.pagination):void 0,I}};function L(){return{txs:[],blockId:void 0,block:void 0,pagination:void 0}}e.GetBlockWithTxsResponse={encode(G,I=j.Writer.create()){for(let C of G.txs)f.Tx.encode(C,I.uint32(10).fork()).ldelim();return G.blockId!==void 0&&w.BlockID.encode(G.blockId,I.uint32(18).fork()).ldelim(),G.block!==void 0&&N.Block.encode(G.block,I.uint32(26).fork()).ldelim(),G.pagination!==void 0&&l.PageResponse.encode(G.pagination,I.uint32(34).fork()).ldelim(),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=L();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.txs.push(f.Tx.decode(C,C.uint32()));break;case 2:W.blockId=w.BlockID.decode(C,C.uint32());break;case 3:W.block=N.Block.decode(C,C.uint32());break;case 4:W.pagination=l.PageResponse.decode(C,C.uint32());break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{txs:Array.isArray(G==null?void 0:G.txs)?G.txs.map(I=>f.Tx.fromJSON(I)):[],blockId:(0,F.isSet)(G.blockId)?w.BlockID.fromJSON(G.blockId):void 0,block:(0,F.isSet)(G.block)?N.Block.fromJSON(G.block):void 0,pagination:(0,F.isSet)(G.pagination)?l.PageResponse.fromJSON(G.pagination):void 0}},toJSON(G){let I={};return G.txs?I.txs=G.txs.map(C=>C?f.Tx.toJSON(C):void 0):I.txs=[],G.blockId!==void 0&&(I.blockId=G.blockId?w.BlockID.toJSON(G.blockId):void 0),G.block!==void 0&&(I.block=G.block?N.Block.toJSON(G.block):void 0),G.pagination!==void 0&&(I.pagination=G.pagination?l.PageResponse.toJSON(G.pagination):void 0),I},fromPartial(G){var C;let I=L();return I.txs=((C=G.txs)==null?void 0:C.map(D=>f.Tx.fromPartial(D)))||[],I.blockId=G.blockId!==void 0&&G.blockId!==null?w.BlockID.fromPartial(G.blockId):void 0,I.block=G.block!==void 0&&G.block!==null?N.Block.fromPartial(G.block):void 0,I.pagination=G.pagination!==void 0&&G.pagination!==null?l.PageResponse.fromPartial(G.pagination):void 0,I}};function V(){return{txBytes:new Uint8Array}}e.TxDecodeRequest={encode(G,I=j.Writer.create()){return G.txBytes.length!==0&&I.uint32(10).bytes(G.txBytes),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=V();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.txBytes=C.bytes();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{txBytes:(0,F.isSet)(G.txBytes)?(0,F.bytesFromBase64)(G.txBytes):new Uint8Array}},toJSON(G){let I={};return G.txBytes!==void 0&&(I.txBytes=(0,F.base64FromBytes)(G.txBytes!==void 0?G.txBytes:new Uint8Array)),I},fromPartial(G){var C;let I=V();return I.txBytes=(C=G.txBytes)!=null?C:new Uint8Array,I}};function K(){return{tx:void 0}}e.TxDecodeResponse={encode(G,I=j.Writer.create()){return G.tx!==void 0&&f.Tx.encode(G.tx,I.uint32(10).fork()).ldelim(),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=K();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.tx=f.Tx.decode(C,C.uint32());break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{tx:(0,F.isSet)(G.tx)?f.Tx.fromJSON(G.tx):void 0}},toJSON(G){let I={};return G.tx!==void 0&&(I.tx=G.tx?f.Tx.toJSON(G.tx):void 0),I},fromPartial(G){let I=K();return I.tx=G.tx!==void 0&&G.tx!==null?f.Tx.fromPartial(G.tx):void 0,I}};function m(){return{tx:void 0}}e.TxEncodeRequest={encode(G,I=j.Writer.create()){return G.tx!==void 0&&f.Tx.encode(G.tx,I.uint32(10).fork()).ldelim(),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=m();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.tx=f.Tx.decode(C,C.uint32());break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{tx:(0,F.isSet)(G.tx)?f.Tx.fromJSON(G.tx):void 0}},toJSON(G){let I={};return G.tx!==void 0&&(I.tx=G.tx?f.Tx.toJSON(G.tx):void 0),I},fromPartial(G){let I=m();return I.tx=G.tx!==void 0&&G.tx!==null?f.Tx.fromPartial(G.tx):void 0,I}};function h(){return{txBytes:new Uint8Array}}e.TxEncodeResponse={encode(G,I=j.Writer.create()){return G.txBytes.length!==0&&I.uint32(10).bytes(G.txBytes),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=h();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.txBytes=C.bytes();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{txBytes:(0,F.isSet)(G.txBytes)?(0,F.bytesFromBase64)(G.txBytes):new Uint8Array}},toJSON(G){let I={};return G.txBytes!==void 0&&(I.txBytes=(0,F.base64FromBytes)(G.txBytes!==void 0?G.txBytes:new Uint8Array)),I},fromPartial(G){var C;let I=h();return I.txBytes=(C=G.txBytes)!=null?C:new Uint8Array,I}};function _(){return{aminoJson:""}}e.TxEncodeAminoRequest={encode(G,I=j.Writer.create()){return G.aminoJson!==""&&I.uint32(10).string(G.aminoJson),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=_();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.aminoJson=C.string();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{aminoJson:(0,F.isSet)(G.aminoJson)?String(G.aminoJson):""}},toJSON(G){let I={};return G.aminoJson!==void 0&&(I.aminoJson=G.aminoJson),I},fromPartial(G){var C;let I=_();return I.aminoJson=(C=G.aminoJson)!=null?C:"",I}};function b(){return{aminoBinary:new Uint8Array}}e.TxEncodeAminoResponse={encode(G,I=j.Writer.create()){return G.aminoBinary.length!==0&&I.uint32(10).bytes(G.aminoBinary),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=b();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.aminoBinary=C.bytes();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{aminoBinary:(0,F.isSet)(G.aminoBinary)?(0,F.bytesFromBase64)(G.aminoBinary):new Uint8Array}},toJSON(G){let I={};return G.aminoBinary!==void 0&&(I.aminoBinary=(0,F.base64FromBytes)(G.aminoBinary!==void 0?G.aminoBinary:new Uint8Array)),I},fromPartial(G){var C;let I=b();return I.aminoBinary=(C=G.aminoBinary)!=null?C:new Uint8Array,I}};function O(){return{aminoBinary:new Uint8Array}}e.TxDecodeAminoRequest={encode(G,I=j.Writer.create()){return G.aminoBinary.length!==0&&I.uint32(10).bytes(G.aminoBinary),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=O();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.aminoBinary=C.bytes();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{aminoBinary:(0,F.isSet)(G.aminoBinary)?(0,F.bytesFromBase64)(G.aminoBinary):new Uint8Array}},toJSON(G){let I={};return G.aminoBinary!==void 0&&(I.aminoBinary=(0,F.base64FromBytes)(G.aminoBinary!==void 0?G.aminoBinary:new Uint8Array)),I},fromPartial(G){var C;let I=O();return I.aminoBinary=(C=G.aminoBinary)!=null?C:new Uint8Array,I}};function J(){return{aminoJson:""}}e.TxDecodeAminoResponse={encode(G,I=j.Writer.create()){return G.aminoJson!==""&&I.uint32(10).string(G.aminoJson),I},decode(G,I){let C=G instanceof j.Reader?G:new j.Reader(G),D=I===void 0?C.len:C.pos+I,W=J();for(;C.pos<D;){let ae=C.uint32();switch(ae>>>3){case 1:W.aminoJson=C.string();break;default:C.skipType(ae&7);break}}return W},fromJSON(G){return{aminoJson:(0,F.isSet)(G.aminoJson)?String(G.aminoJson):""}},toJSON(G){let I={};return G.aminoJson!==void 0&&(I.aminoJson=G.aminoJson),I},fromPartial(G){var C;let I=J();return I.aminoJson=(C=G.aminoJson)!=null?C:"",I}};class ie{constructor(I){this.rpc=I,this.Simulate=this.Simulate.bind(this),this.GetTx=this.GetTx.bind(this),this.BroadcastTx=this.BroadcastTx.bind(this),this.GetTxsEvent=this.GetTxsEvent.bind(this),this.GetBlockWithTxs=this.GetBlockWithTxs.bind(this),this.TxDecode=this.TxDecode.bind(this),this.TxEncode=this.TxEncode.bind(this),this.TxEncodeAmino=this.TxEncodeAmino.bind(this),this.TxDecodeAmino=this.TxDecodeAmino.bind(this)}Simulate(I){let C=e.SimulateRequest.encode(I).finish();return this.rpc.request("cosmos.tx.v1beta1.Service","Simulate",C).then(W=>e.SimulateResponse.decode(new j.Reader(W)))}GetTx(I){let C=e.GetTxRequest.encode(I).finish();return this.rpc.request("cosmos.tx.v1beta1.Service","GetTx",C).then(W=>e.GetTxResponse.decode(new j.Reader(W)))}BroadcastTx(I){let C=e.BroadcastTxRequest.encode(I).finish();return this.rpc.request("cosmos.tx.v1beta1.Service","BroadcastTx",C).then(W=>e.BroadcastTxResponse.decode(new j.Reader(W)))}GetTxsEvent(I){let C=e.GetTxsEventRequest.encode(I).finish();return this.rpc.request("cosmos.tx.v1beta1.Service","GetTxsEvent",C).then(W=>e.GetTxsEventResponse.decode(new j.Reader(W)))}GetBlockWithTxs(I){let C=e.GetBlockWithTxsRequest.encode(I).finish();return this.rpc.request("cosmos.tx.v1beta1.Service","GetBlockWithTxs",C).then(W=>e.GetBlockWithTxsResponse.decode(new j.Reader(W)))}TxDecode(I){let C=e.TxDecodeRequest.encode(I).finish();return this.rpc.request("cosmos.tx.v1beta1.Service","TxDecode",C).then(W=>e.TxDecodeResponse.decode(new j.Reader(W)))}TxEncode(I){let C=e.TxEncodeRequest.encode(I).finish();return this.rpc.request("cosmos.tx.v1beta1.Service","TxEncode",C).then(W=>e.TxEncodeResponse.decode(new j.Reader(W)))}TxEncodeAmino(I){let C=e.TxEncodeAminoRequest.encode(I).finish();return this.rpc.request("cosmos.tx.v1beta1.Service","TxEncodeAmino",C).then(W=>e.TxEncodeAminoResponse.decode(new j.Reader(W)))}TxDecodeAmino(I){let C=e.TxDecodeAminoRequest.encode(I).finish();return this.rpc.request("cosmos.tx.v1beta1.Service","TxDecodeAmino",C).then(W=>e.TxDecodeAminoResponse.decode(new j.Reader(W)))}}e.ServiceClientImpl=ie})(Y$r);var Ibs=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mvt,"__esModule",{value:!0});mvt.setupTxExtension=void 0;var Cbs=MF,_bs=MSe,NLr=Y$r,VHe=fW,Ebs=Ibs(qM),Bbs=Rw;function vbs(e){let i=(0,Bbs.createProtobufRpcClient)(e),A=new NLr.ServiceClientImpl(i);return{tx:{getTx:c=>Jt(this,null,function*(){let f={hash:c};return yield A.GetTx(f)}),simulate:(c,f,l,g)=>Jt(this,null,function*(){let w=VHe.Tx.fromPartial({authInfo:VHe.AuthInfo.fromPartial({fee:VHe.Fee.fromPartial({}),signerInfos:[{publicKey:(0,Cbs.encodePubkey)(l),sequence:Ebs.default.fromNumber(g,!0),modeInfo:{single:{mode:_bs.SignMode.SIGN_MODE_UNSPECIFIED}}}]}),body:VHe.TxBody.fromPartial({messages:Array.from(c),memo:f}),signatures:[new Uint8Array]}),N=NLr.SimulateRequest.fromPartial({txBytes:VHe.Tx.encode(w).finish()});return yield A.Simulate(N)})}}}mvt.setupTxExtension=vbs;var pSe={},bbs=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pSe,"__esModule",{value:!0});pSe.createVestingAminoConverters=pSe.isAminoMsgCreateVestingAccount=void 0;var Sbs=bbs(qM);function wbs(e){return e.type==="cosmos-sdk/MsgCreateVestingAccount"}pSe.isAminoMsgCreateVestingAccount=wbs;function Qbs(){return{"/cosmos.vesting.v1beta1.MsgCreateVestingAccount":{aminoType:"cosmos-sdk/MsgCreateVestingAccount",toAmino:({fromAddress:e,toAddress:i,amount:A,endTime:c,delayed:f})=>({from_address:e,to_address:i,amount:[...A],end_time:c.toString(),delayed:f}),fromAmino:({from_address:e,to_address:i,amount:A,end_time:c,delayed:f})=>({fromAddress:e,toAddress:i,amount:[...A],endTime:Sbs.default.fromString(c),delayed:f})}}}pSe.createVestingAminoConverters=Qbs;var Ivt={},z$r={};(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(R,M,U,E){E===void 0&&(E=U);var Q=Object.getOwnPropertyDescriptor(M,U);(!Q||("get"in Q?!M.__esModule:Q.writable||Q.configurable))&&(Q={enumerable:!0,get:function(){return M[U]}}),Object.defineProperty(R,E,Q)}:function(R,M,U,E){E===void 0&&(E=U),R[E]=M[U]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(R,M){Object.defineProperty(R,"default",{enumerable:!0,value:M})}:function(R,M){R.default=M}),c=Fr&&Fr.__importStar||function(R){if(R&&R.__esModule)return R;var M={};if(R!=null)for(var U in R)U!=="default"&&Object.prototype.hasOwnProperty.call(R,U)&&i(M,R,U);return A(M,R),M};Object.defineProperty(e,"__esModule",{value:!0}),e.MsgClientImpl=e.MsgCreatePeriodicVestingAccountResponse=e.MsgCreatePeriodicVestingAccount=e.MsgCreatePermanentLockedAccountResponse=e.MsgCreatePermanentLockedAccount=e.MsgCreateVestingAccountResponse=e.MsgCreateVestingAccount=e.protobufPackage=void 0;let f=gg,l=iIn,g=Ns,w=c(BA);e.protobufPackage="cosmos.vesting.v1beta1";function N(){return{fromAddress:"",toAddress:"",amount:[],endTime:g.Long.ZERO,delayed:!1}}e.MsgCreateVestingAccount={encode(R,M=w.Writer.create()){R.fromAddress!==""&&M.uint32(10).string(R.fromAddress),R.toAddress!==""&&M.uint32(18).string(R.toAddress);for(let U of R.amount)f.Coin.encode(U,M.uint32(26).fork()).ldelim();return R.endTime.isZero()||M.uint32(32).int64(R.endTime),R.delayed===!0&&M.uint32(40).bool(R.delayed),M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=N();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.fromAddress=U.string();break;case 2:Q.toAddress=U.string();break;case 3:Q.amount.push(f.Coin.decode(U,U.uint32()));break;case 4:Q.endTime=U.int64();break;case 5:Q.delayed=U.bool();break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{fromAddress:(0,g.isSet)(R.fromAddress)?String(R.fromAddress):"",toAddress:(0,g.isSet)(R.toAddress)?String(R.toAddress):"",amount:Array.isArray(R==null?void 0:R.amount)?R.amount.map(M=>f.Coin.fromJSON(M)):[],endTime:(0,g.isSet)(R.endTime)?g.Long.fromValue(R.endTime):g.Long.ZERO,delayed:(0,g.isSet)(R.delayed)?!!R.delayed:!1}},toJSON(R){let M={};return R.fromAddress!==void 0&&(M.fromAddress=R.fromAddress),R.toAddress!==void 0&&(M.toAddress=R.toAddress),R.amount?M.amount=R.amount.map(U=>U?f.Coin.toJSON(U):void 0):M.amount=[],R.endTime!==void 0&&(M.endTime=(R.endTime||g.Long.ZERO).toString()),R.delayed!==void 0&&(M.delayed=R.delayed),M},fromPartial(R){var U,E,Q,H;let M=N();return M.fromAddress=(U=R.fromAddress)!=null?U:"",M.toAddress=(E=R.toAddress)!=null?E:"",M.amount=((Q=R.amount)==null?void 0:Q.map(re=>f.Coin.fromPartial(re)))||[],M.endTime=R.endTime!==void 0&&R.endTime!==null?g.Long.fromValue(R.endTime):g.Long.ZERO,M.delayed=(H=R.delayed)!=null?H:!1,M}};function F(){return{}}e.MsgCreateVestingAccountResponse={encode(R,M=w.Writer.create()){return M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=F();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){default:U.skipType(H&7);break}}return Q},fromJSON(R){return{}},toJSON(R){return{}},fromPartial(R){return F()}};function j(){return{fromAddress:"",toAddress:"",amount:[]}}e.MsgCreatePermanentLockedAccount={encode(R,M=w.Writer.create()){R.fromAddress!==""&&M.uint32(10).string(R.fromAddress),R.toAddress!==""&&M.uint32(18).string(R.toAddress);for(let U of R.amount)f.Coin.encode(U,M.uint32(26).fork()).ldelim();return M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=j();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.fromAddress=U.string();break;case 2:Q.toAddress=U.string();break;case 3:Q.amount.push(f.Coin.decode(U,U.uint32()));break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{fromAddress:(0,g.isSet)(R.fromAddress)?String(R.fromAddress):"",toAddress:(0,g.isSet)(R.toAddress)?String(R.toAddress):"",amount:Array.isArray(R==null?void 0:R.amount)?R.amount.map(M=>f.Coin.fromJSON(M)):[]}},toJSON(R){let M={};return R.fromAddress!==void 0&&(M.fromAddress=R.fromAddress),R.toAddress!==void 0&&(M.toAddress=R.toAddress),R.amount?M.amount=R.amount.map(U=>U?f.Coin.toJSON(U):void 0):M.amount=[],M},fromPartial(R){var U,E,Q;let M=j();return M.fromAddress=(U=R.fromAddress)!=null?U:"",M.toAddress=(E=R.toAddress)!=null?E:"",M.amount=((Q=R.amount)==null?void 0:Q.map(H=>f.Coin.fromPartial(H)))||[],M}};function te(){return{}}e.MsgCreatePermanentLockedAccountResponse={encode(R,M=w.Writer.create()){return M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=te();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){default:U.skipType(H&7);break}}return Q},fromJSON(R){return{}},toJSON(R){return{}},fromPartial(R){return te()}};function v(){return{fromAddress:"",toAddress:"",startTime:g.Long.ZERO,vestingPeriods:[]}}e.MsgCreatePeriodicVestingAccount={encode(R,M=w.Writer.create()){R.fromAddress!==""&&M.uint32(10).string(R.fromAddress),R.toAddress!==""&&M.uint32(18).string(R.toAddress),R.startTime.isZero()||M.uint32(24).int64(R.startTime);for(let U of R.vestingPeriods)l.Period.encode(U,M.uint32(34).fork()).ldelim();return M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=v();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){case 1:Q.fromAddress=U.string();break;case 2:Q.toAddress=U.string();break;case 3:Q.startTime=U.int64();break;case 4:Q.vestingPeriods.push(l.Period.decode(U,U.uint32()));break;default:U.skipType(H&7);break}}return Q},fromJSON(R){return{fromAddress:(0,g.isSet)(R.fromAddress)?String(R.fromAddress):"",toAddress:(0,g.isSet)(R.toAddress)?String(R.toAddress):"",startTime:(0,g.isSet)(R.startTime)?g.Long.fromValue(R.startTime):g.Long.ZERO,vestingPeriods:Array.isArray(R==null?void 0:R.vestingPeriods)?R.vestingPeriods.map(M=>l.Period.fromJSON(M)):[]}},toJSON(R){let M={};return R.fromAddress!==void 0&&(M.fromAddress=R.fromAddress),R.toAddress!==void 0&&(M.toAddress=R.toAddress),R.startTime!==void 0&&(M.startTime=(R.startTime||g.Long.ZERO).toString()),R.vestingPeriods?M.vestingPeriods=R.vestingPeriods.map(U=>U?l.Period.toJSON(U):void 0):M.vestingPeriods=[],M},fromPartial(R){var U,E,Q;let M=v();return M.fromAddress=(U=R.fromAddress)!=null?U:"",M.toAddress=(E=R.toAddress)!=null?E:"",M.startTime=R.startTime!==void 0&&R.startTime!==null?g.Long.fromValue(R.startTime):g.Long.ZERO,M.vestingPeriods=((Q=R.vestingPeriods)==null?void 0:Q.map(H=>l.Period.fromPartial(H)))||[],M}};function ne(){return{}}e.MsgCreatePeriodicVestingAccountResponse={encode(R,M=w.Writer.create()){return M},decode(R,M){let U=R instanceof w.Reader?R:new w.Reader(R),E=M===void 0?U.len:U.pos+M,Q=ne();for(;U.pos<E;){let H=U.uint32();switch(H>>>3){default:U.skipType(H&7);break}}return Q},fromJSON(R){return{}},toJSON(R){return{}},fromPartial(R){return ne()}};class Z{constructor(M){this.rpc=M,this.CreateVestingAccount=this.CreateVestingAccount.bind(this),this.CreatePermanentLockedAccount=this.CreatePermanentLockedAccount.bind(this),this.CreatePeriodicVestingAccount=this.CreatePeriodicVestingAccount.bind(this)}CreateVestingAccount(M){let U=e.MsgCreateVestingAccount.encode(M).finish();return this.rpc.request("cosmos.vesting.v1beta1.Msg","CreateVestingAccount",U).then(Q=>e.MsgCreateVestingAccountResponse.decode(new w.Reader(Q)))}CreatePermanentLockedAccount(M){let U=e.MsgCreatePermanentLockedAccount.encode(M).finish();return this.rpc.request("cosmos.vesting.v1beta1.Msg","CreatePermanentLockedAccount",U).then(Q=>e.MsgCreatePermanentLockedAccountResponse.decode(new w.Reader(Q)))}CreatePeriodicVestingAccount(M){let U=e.MsgCreatePeriodicVestingAccount.encode(M).finish();return this.rpc.request("cosmos.vesting.v1beta1.Msg","CreatePeriodicVestingAccount",U).then(Q=>e.MsgCreatePeriodicVestingAccountResponse.decode(new w.Reader(Q)))}}e.MsgClientImpl=Z})(z$r);Object.defineProperty(Ivt,"__esModule",{value:!0});Ivt.vestingTypes=void 0;var kbs=z$r;Ivt.vestingTypes=[["/cosmos.vesting.v1beta1.MsgCreateVestingAccount",kbs.MsgCreateVestingAccount]];(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isAminoMsgCreateValidator=e.isAminoMsgBeginRedelegate=e.createStakingAminoConverters=e.setupSlashingExtension=e.isAminoMsgUnjail=e.createSlashingAminoConverters=e.setupMintExtension=e.setupIbcExtension=e.isMsgTransferEncodeObject=e.ibcTypes=e.isAminoMsgTransfer=e.createIbcAminoConverters=e.groupTypes=e.createGroupAminoConverters=e.setupGovExtension=e.isMsgVoteWeightedEncodeObject=e.isMsgVoteEncodeObject=e.isMsgSubmitProposalEncodeObject=e.isMsgDepositEncodeObject=e.govTypes=e.isAminoMsgVoteWeighted=e.isAminoMsgVote=e.isAminoMsgSubmitProposal=e.isAminoMsgDeposit=e.createGovAminoConverters=e.setupFeegrantExtension=e.feegrantTypes=e.createFeegrantAminoConverters=e.isAminoMsgSubmitEvidence=e.createEvidenceAminoConverters=e.setupDistributionExtension=e.isMsgWithdrawDelegatorRewardEncodeObject=e.distributionTypes=e.isAminoMsgWithdrawValidatorCommission=e.isAminoMsgWithdrawDelegatorReward=e.isAminoMsgSetWithdrawAddress=e.isAminoMsgFundCommunityPool=e.createDistributionAminoConverters=e.isAminoMsgVerifyInvariant=e.createCrysisAminoConverters=e.setupBankExtension=e.isMsgSendEncodeObject=e.bankTypes=e.isAminoMsgSend=e.isAminoMsgMultiSend=e.createBankAminoConverters=e.setupAuthzExtension=e.authzTypes=e.createAuthzAminoConverters=e.setupAuthExtension=void 0,e.vestingTypes=e.isAminoMsgCreateVestingAccount=e.createVestingAminoConverters=e.setupTxExtension=e.setupStakingExtension=e.stakingTypes=e.isMsgUndelegateEncodeObject=e.isMsgEditValidatorEncodeObject=e.isMsgDelegateEncodeObject=e.isMsgCreateValidatorEncodeObject=e.isMsgBeginRedelegateEncodeObject=e.isAminoMsgUndelegate=e.isAminoMsgEditValidator=e.isAminoMsgDelegate=void 0;var i=LBt;Object.defineProperty(e,"setupAuthExtension",{enumerable:!0,get:function(){return i.setupAuthExtension}});var A=jBt;Object.defineProperty(e,"createAuthzAminoConverters",{enumerable:!0,get:function(){return A.createAuthzAminoConverters}});var c=evt;Object.defineProperty(e,"authzTypes",{enumerable:!0,get:function(){return c.authzTypes}});var f=tvt;Object.defineProperty(e,"setupAuthzExtension",{enumerable:!0,get:function(){return f.setupAuthzExtension}});var l=qie;Object.defineProperty(e,"createBankAminoConverters",{enumerable:!0,get:function(){return l.createBankAminoConverters}}),Object.defineProperty(e,"isAminoMsgMultiSend",{enumerable:!0,get:function(){return l.isAminoMsgMultiSend}}),Object.defineProperty(e,"isAminoMsgSend",{enumerable:!0,get:function(){return l.isAminoMsgSend}});var g=ASe;Object.defineProperty(e,"bankTypes",{enumerable:!0,get:function(){return g.bankTypes}}),Object.defineProperty(e,"isMsgSendEncodeObject",{enumerable:!0,get:function(){return g.isMsgSendEncodeObject}});var w=nvt;Object.defineProperty(e,"setupBankExtension",{enumerable:!0,get:function(){return w.setupBankExtension}});var N=dSe;Object.defineProperty(e,"createCrysisAminoConverters",{enumerable:!0,get:function(){return N.createCrysisAminoConverters}}),Object.defineProperty(e,"isAminoMsgVerifyInvariant",{enumerable:!0,get:function(){return N.isAminoMsgVerifyInvariant}});var F=hM;Object.defineProperty(e,"createDistributionAminoConverters",{enumerable:!0,get:function(){return F.createDistributionAminoConverters}}),Object.defineProperty(e,"isAminoMsgFundCommunityPool",{enumerable:!0,get:function(){return F.isAminoMsgFundCommunityPool}}),Object.defineProperty(e,"isAminoMsgSetWithdrawAddress",{enumerable:!0,get:function(){return F.isAminoMsgSetWithdrawAddress}}),Object.defineProperty(e,"isAminoMsgWithdrawDelegatorReward",{enumerable:!0,get:function(){return F.isAminoMsgWithdrawDelegatorReward}}),Object.defineProperty(e,"isAminoMsgWithdrawValidatorCommission",{enumerable:!0,get:function(){return F.isAminoMsgWithdrawValidatorCommission}});var j=cSe;Object.defineProperty(e,"distributionTypes",{enumerable:!0,get:function(){return j.distributionTypes}}),Object.defineProperty(e,"isMsgWithdrawDelegatorRewardEncodeObject",{enumerable:!0,get:function(){return j.isMsgWithdrawDelegatorRewardEncodeObject}});var te=rvt;Object.defineProperty(e,"setupDistributionExtension",{enumerable:!0,get:function(){return te.setupDistributionExtension}});var v=uSe;Object.defineProperty(e,"createEvidenceAminoConverters",{enumerable:!0,get:function(){return v.createEvidenceAminoConverters}}),Object.defineProperty(e,"isAminoMsgSubmitEvidence",{enumerable:!0,get:function(){return v.isAminoMsgSubmitEvidence}});var ne=ivt;Object.defineProperty(e,"createFeegrantAminoConverters",{enumerable:!0,get:function(){return ne.createFeegrantAminoConverters}});var Z=ovt;Object.defineProperty(e,"feegrantTypes",{enumerable:!0,get:function(){return Z.feegrantTypes}});var R=avt;Object.defineProperty(e,"setupFeegrantExtension",{enumerable:!0,get:function(){return R.setupFeegrantExtension}});var M=gM;Object.defineProperty(e,"createGovAminoConverters",{enumerable:!0,get:function(){return M.createGovAminoConverters}}),Object.defineProperty(e,"isAminoMsgDeposit",{enumerable:!0,get:function(){return M.isAminoMsgDeposit}}),Object.defineProperty(e,"isAminoMsgSubmitProposal",{enumerable:!0,get:function(){return M.isAminoMsgSubmitProposal}}),Object.defineProperty(e,"isAminoMsgVote",{enumerable:!0,get:function(){return M.isAminoMsgVote}}),Object.defineProperty(e,"isAminoMsgVoteWeighted",{enumerable:!0,get:function(){return M.isAminoMsgVoteWeighted}});var U=pM;Object.defineProperty(e,"govTypes",{enumerable:!0,get:function(){return U.govTypes}}),Object.defineProperty(e,"isMsgDepositEncodeObject",{enumerable:!0,get:function(){return U.isMsgDepositEncodeObject}}),Object.defineProperty(e,"isMsgSubmitProposalEncodeObject",{enumerable:!0,get:function(){return U.isMsgSubmitProposalEncodeObject}}),Object.defineProperty(e,"isMsgVoteEncodeObject",{enumerable:!0,get:function(){return U.isMsgVoteEncodeObject}}),Object.defineProperty(e,"isMsgVoteWeightedEncodeObject",{enumerable:!0,get:function(){return U.isMsgVoteWeightedEncodeObject}});var E=Avt;Object.defineProperty(e,"setupGovExtension",{enumerable:!0,get:function(){return E.setupGovExtension}});var Q=dvt;Object.defineProperty(e,"createGroupAminoConverters",{enumerable:!0,get:function(){return Q.createGroupAminoConverters}});var H=cvt;Object.defineProperty(e,"groupTypes",{enumerable:!0,get:function(){return H.groupTypes}});var re=fSe;Object.defineProperty(e,"createIbcAminoConverters",{enumerable:!0,get:function(){return re.createIbcAminoConverters}}),Object.defineProperty(e,"isAminoMsgTransfer",{enumerable:!0,get:function(){return re.isAminoMsgTransfer}});var ee=lSe;Object.defineProperty(e,"ibcTypes",{enumerable:!0,get:function(){return ee.ibcTypes}}),Object.defineProperty(e,"isMsgTransferEncodeObject",{enumerable:!0,get:function(){return ee.isMsgTransferEncodeObject}});var T=lvt;Object.defineProperty(e,"setupIbcExtension",{enumerable:!0,get:function(){return T.setupIbcExtension}});var se=gvt;Object.defineProperty(e,"setupMintExtension",{enumerable:!0,get:function(){return se.setupMintExtension}});var p=hSe;Object.defineProperty(e,"createSlashingAminoConverters",{enumerable:!0,get:function(){return p.createSlashingAminoConverters}}),Object.defineProperty(e,"isAminoMsgUnjail",{enumerable:!0,get:function(){return p.isAminoMsgUnjail}});var L=pvt;Object.defineProperty(e,"setupSlashingExtension",{enumerable:!0,get:function(){return L.setupSlashingExtension}});var V=NB;Object.defineProperty(e,"createStakingAminoConverters",{enumerable:!0,get:function(){return V.createStakingAminoConverters}}),Object.defineProperty(e,"isAminoMsgBeginRedelegate",{enumerable:!0,get:function(){return V.isAminoMsgBeginRedelegate}}),Object.defineProperty(e,"isAminoMsgCreateValidator",{enumerable:!0,get:function(){return V.isAminoMsgCreateValidator}}),Object.defineProperty(e,"isAminoMsgDelegate",{enumerable:!0,get:function(){return V.isAminoMsgDelegate}}),Object.defineProperty(e,"isAminoMsgEditValidator",{enumerable:!0,get:function(){return V.isAminoMsgEditValidator}}),Object.defineProperty(e,"isAminoMsgUndelegate",{enumerable:!0,get:function(){return V.isAminoMsgUndelegate}});var K=sD;Object.defineProperty(e,"isMsgBeginRedelegateEncodeObject",{enumerable:!0,get:function(){return K.isMsgBeginRedelegateEncodeObject}}),Object.defineProperty(e,"isMsgCreateValidatorEncodeObject",{enumerable:!0,get:function(){return K.isMsgCreateValidatorEncodeObject}}),Object.defineProperty(e,"isMsgDelegateEncodeObject",{enumerable:!0,get:function(){return K.isMsgDelegateEncodeObject}}),Object.defineProperty(e,"isMsgEditValidatorEncodeObject",{enumerable:!0,get:function(){return K.isMsgEditValidatorEncodeObject}}),Object.defineProperty(e,"isMsgUndelegateEncodeObject",{enumerable:!0,get:function(){return K.isMsgUndelegateEncodeObject}}),Object.defineProperty(e,"stakingTypes",{enumerable:!0,get:function(){return K.stakingTypes}});var m=yvt;Object.defineProperty(e,"setupStakingExtension",{enumerable:!0,get:function(){return m.setupStakingExtension}});var h=mvt;Object.defineProperty(e,"setupTxExtension",{enumerable:!0,get:function(){return h.setupTxExtension}});var _=pSe;Object.defineProperty(e,"createVestingAminoConverters",{enumerable:!0,get:function(){return _.createVestingAminoConverters}}),Object.defineProperty(e,"isAminoMsgCreateVestingAccount",{enumerable:!0,get:function(){return _.isAminoMsgCreateVestingAccount}});var b=Ivt;Object.defineProperty(e,"vestingTypes",{enumerable:!0,get:function(){return b.vestingTypes}})})(gGe);var Wie={},Dbs=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Wie,"__esModule",{value:!0});Wie.makeMultisignedTxBytes=Wie.makeMultisignedTx=Wie.makeCompactBitArray=void 0;var Rbs=uoe,Pbs=K2,Obs=MF,Bpn=wK,Nbs=MSe,xLr=fW,W$r=fW,MLr=Dbs(qM);function Z$r(e){let i=Math.ceil(e.length/8),A=e.length-Math.floor(e.length/8)*8,c=new Uint8Array(i);return e.forEach((f,l)=>{let g=Math.floor(l/8),w=l%8;f&&(c[g]|=1<<7-w)}),Bpn.CompactBitArray.fromPartial({elems:c,extraBitsStored:A})}Wie.makeCompactBitArray=Z$r;function X$r(e,i,A,c,f){let l=Array.from(f.keys()),g=(0,Pbs.fromBech32)(l[0]).prefix,w=Array(e.value.pubkeys.length).fill(!1),N=new Array;for(let ne=0;ne<e.value.pubkeys.length;ne++){let Z=(0,Rbs.pubkeyToAddress)(e.value.pubkeys[ne],g),R=f.get(Z);R&&(w[ne]=!0,N.push(R))}let F={publicKey:(0,Obs.encodePubkey)(e),modeInfo:{multi:{bitarray:Z$r(w),modeInfos:N.map(ne=>({single:{mode:Nbs.SignMode.SIGN_MODE_LEGACY_AMINO_JSON}}))}},sequence:MLr.default.fromNumber(i)},j=xLr.AuthInfo.fromPartial({signerInfos:[F],fee:{amount:[...A.amount],gasLimit:MLr.default.fromString(A.gas)}}),te=xLr.AuthInfo.encode(j).finish();return W$r.TxRaw.fromPartial({bodyBytes:c,authInfoBytes:te,signatures:[Bpn.MultiSignature.encode(Bpn.MultiSignature.fromPartial({signatures:N})).finish()]})}Wie.makeMultisignedTx=X$r;function xbs(e,i,A,c,f){let l=X$r(e,i,A,c,f);return Uint8Array.from(W$r.TxRaw.encode(l).finish())}Wie.makeMultisignedTxBytes=xbs;var $$r={},SIn={},IK={};Object.defineProperty(IK,"__esModule",{value:!0});IK.pubkeyToAddress=IK.pubkeyToRawAddress=IK.rawSecp256k1PubkeyToRawAddress=IK.rawEd25519PubkeyToRawAddress=void 0;var vpn=bD,Mbs=K2;function j$r(e){if(e.length!==32)throw new Error(`Invalid Ed25519 pubkey length: ${e.length}`);return(0,vpn.sha256)(e).slice(0,20)}IK.rawEd25519PubkeyToRawAddress=j$r;function ejr(e){if(e.length!==33)throw new Error(`Invalid Secp256k1 pubkey length (compressed): ${e.length}`);return(0,vpn.ripemd160)((0,vpn.sha256)(e))}IK.rawSecp256k1PubkeyToRawAddress=ejr;function tjr(e,i){switch(e){case"ed25519":return j$r(i);case"secp256k1":return ejr(i);default:throw new Error(`Pubkey type ${e} not supported`)}}IK.pubkeyToRawAddress=tjr;function Tbs(e,i){return(0,Mbs.toHex)(tjr(e,i)).toUpperCase()}IK.pubkeyToAddress=Tbs;var dD={};Object.defineProperty(dD,"__esModule",{value:!0});dD.DateTime=dD.toSeconds=dD.fromSeconds=dD.toRfc3339WithNanoseconds=dD.fromRfc3339WithNanoseconds=void 0;var Ubs=K2,Fbs=EE;function njr(e){let i=(0,Ubs.fromRfc3339)(e),A=e.match(/\.(\d+)Z$/),c=A?A[1].slice(3):"";return i.nanoseconds=parseInt(c.padEnd(6,"0"),10),i}dD.fromRfc3339WithNanoseconds=njr;function rjr(e){var c,f;let i=e.toISOString(),A=(f=(c=e.nanoseconds)==null?void 0:c.toString())!=null?f:"";return`${i.slice(0,-1)}${A.padStart(6,"0")}Z`}dD.toRfc3339WithNanoseconds=rjr;function Jbs(e,i=0){let A=new Fbs.Uint32(i).toNumber();if(A>999999999)throw new Error("Nano seconds must not exceed 999999999");let c=new Date(e*1e3+Math.floor(A/1e6));return c.nanoseconds=A%1e6,c}dD.fromSeconds=Jbs;function Hbs(e){var i;return{seconds:Math.floor(e.getTime()/1e3),nanos:e.getTime()%1e3*1e6+((i=e.nanoseconds)!=null?i:0)}}dD.toSeconds=Hbs;var bpn=class{static decode(i){return njr(i)}static encode(i){return rjr(i)}};dD.DateTime=bpn;var Cvt={},_vt={},Evt={},Bvt={};Object.defineProperty(Bvt,"__esModule",{value:!0});Bvt.makeJsonRpcId=void 0;var Lbs=1e4;function Gbs(){return Lbs+=1}Bvt.makeJsonRpcId=Gbs;var vvt={},jz={};Object.defineProperty(jz,"__esModule",{value:!0});jz.jsonRpcCode=jz.isJsonRpcSuccessResponse=jz.isJsonRpcErrorResponse=void 0;function ijr(e){return typeof e.error=="object"}jz.isJsonRpcErrorResponse=ijr;function qbs(e){return!ijr(e)}jz.isJsonRpcSuccessResponse=qbs;jz.jsonRpcCode={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:{default:-32e3}};Object.defineProperty(vvt,"__esModule",{value:!0});vvt.JsonRpcClient=void 0;var Kbs=$Ge,Ybs=jz,Spn=class{constructor(i){this.connection=i}run(i){return Jt(this,null,function*(){let A=this.connection.responseStream.filter(l=>l.id===i.id),c=(0,Kbs.firstEvent)(A);this.connection.sendRequest(i);let f=yield c;if((0,Ybs.isJsonRpcErrorResponse)(f)){let l=f.error;throw new Error(`JSON RPC error: code=${l.code}; message='${l.message}'`)}return f})}};vvt.JsonRpcClient=Spn;var yM={},Zie={};Object.defineProperty(Zie,"__esModule",{value:!0});Zie.isJsonCompatibleDictionary=Zie.isJsonCompatibleArray=Zie.isJsonCompatibleValue=void 0;function wIn(e){return!!(typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null||ojr(e)||ajr(e))}Zie.isJsonCompatibleValue=wIn;function ojr(e){if(!Array.isArray(e))return!1;for(let i of e)if(!wIn(i))return!1;return!0}Zie.isJsonCompatibleArray=ojr;function ajr(e){return typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]"?!1:Object.values(e).every(wIn)}Zie.isJsonCompatibleDictionary=ajr;Object.defineProperty(yM,"__esModule",{value:!0});yM.parseJsonRpcResponse=yM.parseJsonRpcSuccessResponse=yM.parseJsonRpcErrorResponse=yM.parseJsonRpcRequest=yM.parseJsonRpcId=void 0;var Xie=Zie;function sjr(e){if(!(0,Xie.isJsonCompatibleDictionary)(e))throw new Error("Data must be JSON compatible dictionary");let i=e.id;return typeof i!="number"&&typeof i!="string"?null:i}yM.parseJsonRpcId=sjr;function Vbs(e){if(!(0,Xie.isJsonCompatibleDictionary)(e))throw new Error("Data must be JSON compatible dictionary");if(e.jsonrpc!=="2.0")throw new Error(`Got unexpected jsonrpc version: ${e.jsonrpc}`);let i=sjr(e);if(i===null)throw new Error("Invalid id field");let A=e.method;if(typeof A!="string")throw new Error("Invalid method field");if(!(0,Xie.isJsonCompatibleArray)(e.params)&&!(0,Xie.isJsonCompatibleDictionary)(e.params))throw new Error("Invalid params field");return{jsonrpc:"2.0",id:i,method:A,params:e.params}}yM.parseJsonRpcRequest=Vbs;function zbs(e){if(typeof e.code!="number")throw new Error("Error property 'code' is not a number");if(typeof e.message!="string")throw new Error("Error property 'message' is not a string");let i;if(e.data===void 0)i=void 0;else if((0,Xie.isJsonCompatibleValue)(e.data))i=e.data;else throw new Error("Error property 'data' is defined but not a JSON compatible value.");return Di({code:e.code,message:e.message},i!==void 0?{data:i}:{})}function Ajr(e){if(!(0,Xie.isJsonCompatibleDictionary)(e))throw new Error("Data must be JSON compatible dictionary");if(e.jsonrpc!=="2.0")throw new Error(`Got unexpected jsonrpc version: ${JSON.stringify(e)}`);let i=e.id;if(typeof i!="number"&&typeof i!="string"&&i!==null)throw new Error("Invalid id field");if(typeof e.error=="undefined"||!(0,Xie.isJsonCompatibleDictionary)(e.error))throw new Error("Invalid error field");return{jsonrpc:"2.0",id:i,error:zbs(e.error)}}yM.parseJsonRpcErrorResponse=Ajr;function djr(e){if(!(0,Xie.isJsonCompatibleDictionary)(e))throw new Error("Data must be JSON compatible dictionary");if(e.jsonrpc!=="2.0")throw new Error(`Got unexpected jsonrpc version: ${JSON.stringify(e)}`);let i=e.id;if(typeof i!="number"&&typeof i!="string")throw new Error("Invalid id field");if(typeof e.result=="undefined")throw new Error("Invalid result field");let A=e.result;return{jsonrpc:"2.0",id:i,result:A}}yM.parseJsonRpcSuccessResponse=djr;function Wbs(e){let i;try{i=Ajr(e)}catch(A){i=djr(e)}return i}yM.parseJsonRpcResponse=Wbs;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.jsonRpcCode=e.isJsonRpcSuccessResponse=e.isJsonRpcErrorResponse=e.parseJsonRpcSuccessResponse=e.parseJsonRpcResponse=e.parseJsonRpcRequest=e.parseJsonRpcId=e.parseJsonRpcErrorResponse=e.JsonRpcClient=e.makeJsonRpcId=void 0;var i=Bvt;Object.defineProperty(e,"makeJsonRpcId",{enumerable:!0,get:function(){return i.makeJsonRpcId}});var A=vvt;Object.defineProperty(e,"JsonRpcClient",{enumerable:!0,get:function(){return A.JsonRpcClient}});var c=yM;Object.defineProperty(e,"parseJsonRpcErrorResponse",{enumerable:!0,get:function(){return c.parseJsonRpcErrorResponse}}),Object.defineProperty(e,"parseJsonRpcId",{enumerable:!0,get:function(){return c.parseJsonRpcId}}),Object.defineProperty(e,"parseJsonRpcRequest",{enumerable:!0,get:function(){return c.parseJsonRpcRequest}}),Object.defineProperty(e,"parseJsonRpcResponse",{enumerable:!0,get:function(){return c.parseJsonRpcResponse}}),Object.defineProperty(e,"parseJsonRpcSuccessResponse",{enumerable:!0,get:function(){return c.parseJsonRpcSuccessResponse}});var f=jz;Object.defineProperty(e,"isJsonRpcErrorResponse",{enumerable:!0,get:function(){return f.isJsonRpcErrorResponse}}),Object.defineProperty(e,"isJsonRpcSuccessResponse",{enumerable:!0,get:function(){return f.isJsonRpcSuccessResponse}}),Object.defineProperty(e,"jsonRpcCode",{enumerable:!0,get:function(){return f.jsonRpcCode}})})(Evt);var eqe={},QIn={exports:{}},cjr=function e(i,A){return function(){for(var f=new Array(arguments.length),l=0;l<f.length;l++)f[l]=arguments[l];return i.apply(A,f)}},Zbs=cjr,Vfe=Object.prototype.toString;function kIn(e){return Vfe.call(e)==="[object Array]"}function wpn(e){return typeof e=="undefined"}function Xbs(e){return e!==null&&!wpn(e)&&e.constructor!==null&&!wpn(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function $bs(e){return Vfe.call(e)==="[object ArrayBuffer]"}function jbs(e){return typeof FormData!="undefined"&&e instanceof FormData}function eSs(e){var i;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?i=ArrayBuffer.isView(e):i=e&&e.buffer&&e.buffer instanceof ArrayBuffer,i}function tSs(e){return typeof e=="string"}function nSs(e){return typeof e=="number"}function ujr(e){return e!==null&&typeof e=="object"}function i_t(e){if(Vfe.call(e)!=="[object Object]")return!1;var i=Object.getPrototypeOf(e);return i===null||i===Object.prototype}function rSs(e){return Vfe.call(e)==="[object Date]"}function iSs(e){return Vfe.call(e)==="[object File]"}function oSs(e){return Vfe.call(e)==="[object Blob]"}function fjr(e){return Vfe.call(e)==="[object Function]"}function aSs(e){return ujr(e)&&fjr(e.pipe)}function sSs(e){return typeof URLSearchParams!="undefined"&&e instanceof URLSearchParams}function ASs(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function dSs(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function DIn(e,i){if(!(e===null||typeof e=="undefined"))if(typeof e!="object"&&(e=[e]),kIn(e))for(var A=0,c=e.length;A<c;A++)i.call(null,e[A],A,e);else for(var f in e)Object.prototype.hasOwnProperty.call(e,f)&&i.call(null,e[f],f,e)}function Qpn(){var e={};function i(f,l){i_t(e[l])&&i_t(f)?e[l]=Qpn(e[l],f):i_t(f)?e[l]=Qpn({},f):kIn(f)?e[l]=f.slice():e[l]=f}for(var A=0,c=arguments.length;A<c;A++)DIn(arguments[A],i);return e}function cSs(e,i,A){return DIn(i,function(f,l){A&&typeof f=="function"?e[l]=Zbs(f,A):e[l]=f}),e}function uSs(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var JR={isArray:kIn,isArrayBuffer:$bs,isBuffer:Xbs,isFormData:jbs,isArrayBufferView:eSs,isString:tSs,isNumber:nSs,isObject:ujr,isPlainObject:i_t,isUndefined:wpn,isDate:rSs,isFile:iSs,isBlob:oSs,isFunction:fjr,isStream:aSs,isURLSearchParams:sSs,isStandardBrowserEnv:dSs,forEach:DIn,merge:Qpn,extend:cSs,trim:ASs,stripBOM:uSs},T6e=JR;function TLr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var ljr=function e(i,A,c){if(!A)return i;var f;if(c)f=c(A);else if(T6e.isURLSearchParams(A))f=A.toString();else{var l=[];T6e.forEach(A,function(N,F){N===null||typeof N=="undefined"||(T6e.isArray(N)?F=F+"[]":N=[N],T6e.forEach(N,function(te){T6e.isDate(te)?te=te.toISOString():T6e.isObject(te)&&(te=JSON.stringify(te)),l.push(TLr(F)+"="+TLr(te))}))}),f=l.join("&")}if(f){var g=i.indexOf("#");g!==-1&&(i=i.slice(0,g)),i+=(i.indexOf("?")===-1?"?":"&")+f}return i},fSs=JR;function bvt(){this.handlers=[]}bvt.prototype.use=function e(i,A,c){return this.handlers.push({fulfilled:i,rejected:A,synchronous:c?c.synchronous:!1,runWhen:c?c.runWhen:null}),this.handlers.length-1};bvt.prototype.eject=function e(i){this.handlers[i]&&(this.handlers[i]=null)};bvt.prototype.forEach=function e(i){fSs.forEach(this.handlers,function(c){c!==null&&i(c)})};var lSs=bvt,hSs=JR,gSs=function e(i,A){hSs.forEach(i,function(f,l){l!==A&&l.toUpperCase()===A.toUpperCase()&&(i[A]=f,delete i[l])})},hjr=function e(i,A,c,f,l){return i.config=A,c&&(i.code=c),i.request=f,i.response=l,i.isAxiosError=!0,i.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},i},F2n,ULr;function gjr(){if(ULr)return F2n;ULr=1;var e=hjr;return F2n=function(A,c,f,l,g){var w=new Error(A);return e(w,c,f,l,g)},F2n}var J2n,FLr;function pSs(){if(FLr)return J2n;FLr=1;var e=gjr();return J2n=function(A,c,f){var l=f.config.validateStatus;!f.status||!l||l(f.status)?A(f):c(e("Request failed with status code "+f.status,f.config,null,f.request,f))},J2n}var H2n,JLr;function ySs(){if(JLr)return H2n;JLr=1;var e=JR;return H2n=e.isStandardBrowserEnv()?function(){return{write:function(c,f,l,g,w,N){var F=[];F.push(c+"="+encodeURIComponent(f)),e.isNumber(l)&&F.push("expires="+new Date(l).toGMTString()),e.isString(g)&&F.push("path="+g),e.isString(w)&&F.push("domain="+w),N===!0&&F.push("secure"),document.cookie=F.join("; ")},read:function(c){var f=document.cookie.match(new RegExp("(^|;\\s*)("+c+")=([^;]*)"));return f?decodeURIComponent(f[3]):null},remove:function(c){this.write(c,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),H2n}var L2n,HLr;function mSs(){return HLr||(HLr=1,L2n=function(i){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(i)}),L2n}var G2n,LLr;function ISs(){return LLr||(LLr=1,G2n=function(i,A){return A?i.replace(/\/+$/,"")+"/"+A.replace(/^\/+/,""):i}),G2n}var q2n,GLr;function CSs(){if(GLr)return q2n;GLr=1;var e=mSs(),i=ISs();return q2n=function(c,f){return c&&!e(f)?i(c,f):f},q2n}var K2n,qLr;function _Ss(){if(qLr)return K2n;qLr=1;var e=JR,i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return K2n=function(c){var f={},l,g,w;return c&&e.forEach(c.split(`
263
263
  `),function(F){if(w=F.indexOf(":"),l=e.trim(F.substr(0,w)).toLowerCase(),g=e.trim(F.substr(w+1)),l){if(f[l]&&i.indexOf(l)>=0)return;l==="set-cookie"?f[l]=(f[l]?f[l]:[]).concat([g]):f[l]=f[l]?f[l]+", "+g:g}}),f},K2n}var Y2n,KLr;function ESs(){if(KLr)return Y2n;KLr=1;var e=JR;return Y2n=e.isStandardBrowserEnv()?function(){var A=/(msie|trident)/i.test(navigator.userAgent),c=document.createElement("a"),f;function l(g){var w=g;return A&&(c.setAttribute("href",w),w=c.href),c.setAttribute("href",w),{href:c.href,protocol:c.protocol?c.protocol.replace(/:$/,""):"",host:c.host,search:c.search?c.search.replace(/^\?/,""):"",hash:c.hash?c.hash.replace(/^#/,""):"",hostname:c.hostname,port:c.port,pathname:c.pathname.charAt(0)==="/"?c.pathname:"/"+c.pathname}}return f=l(window.location.href),function(w){var N=e.isString(w)?l(w):w;return N.protocol===f.protocol&&N.host===f.host}}():function(){return function(){return!0}}(),Y2n}var V2n,YLr;function VLr(){if(YLr)return V2n;YLr=1;var e=JR,i=pSs(),A=ySs(),c=ljr,f=CSs(),l=_Ss(),g=ESs(),w=gjr();return V2n=function(F){return new Promise(function(te,v){var ne=F.data,Z=F.headers,R=F.responseType;e.isFormData(ne)&&delete Z["Content-Type"];var M=new XMLHttpRequest;if(F.auth){var U=F.auth.username||"",E=F.auth.password?unescape(encodeURIComponent(F.auth.password)):"";Z.Authorization="Basic "+btoa(U+":"+E)}var Q=f(F.baseURL,F.url);M.open(F.method.toUpperCase(),c(Q,F.params,F.paramsSerializer),!0),M.timeout=F.timeout;function H(){if(M){var ee="getAllResponseHeaders"in M?l(M.getAllResponseHeaders()):null,T=!R||R==="text"||R==="json"?M.responseText:M.response,se={data:T,status:M.status,statusText:M.statusText,headers:ee,config:F,request:M};i(te,v,se),M=null}}if("onloadend"in M?M.onloadend=H:M.onreadystatechange=function(){!M||M.readyState!==4||M.status===0&&!(M.responseURL&&M.responseURL.indexOf("file:")===0)||setTimeout(H)},M.onabort=function(){M&&(v(w("Request aborted",F,"ECONNABORTED",M)),M=null)},M.onerror=function(){v(w("Network Error",F,null,M)),M=null},M.ontimeout=function(){var T="timeout of "+F.timeout+"ms exceeded";F.timeoutErrorMessage&&(T=F.timeoutErrorMessage),v(w(T,F,F.transitional&&F.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",M)),M=null},e.isStandardBrowserEnv()){var re=(F.withCredentials||g(Q))&&F.xsrfCookieName?A.read(F.xsrfCookieName):void 0;re&&(Z[F.xsrfHeaderName]=re)}"setRequestHeader"in M&&e.forEach(Z,function(T,se){typeof ne=="undefined"&&se.toLowerCase()==="content-type"?delete Z[se]:M.setRequestHeader(se,T)}),e.isUndefined(F.withCredentials)||(M.withCredentials=!!F.withCredentials),R&&R!=="json"&&(M.responseType=F.responseType),typeof F.onDownloadProgress=="function"&&M.addEventListener("progress",F.onDownloadProgress),typeof F.onUploadProgress=="function"&&M.upload&&M.upload.addEventListener("progress",F.onUploadProgress),F.cancelToken&&F.cancelToken.promise.then(function(T){M&&(M.abort(),v(T),M=null)}),ne||(ne=null),M.send(ne)})},V2n}var uE=JR,zLr=gSs,BSs=hjr,vSs={"Content-Type":"application/x-www-form-urlencoded"};function WLr(e,i){!uE.isUndefined(e)&&uE.isUndefined(e["Content-Type"])&&(e["Content-Type"]=i)}function bSs(){var e;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(e=VLr()),e}function SSs(e,i,A){if(uE.isString(e))try{return(i||JSON.parse)(e),uE.trim(e)}catch(c){if(c.name!=="SyntaxError")throw c}return(A||JSON.stringify)(e)}var Svt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:bSs(),transformRequest:[function e(i,A){return zLr(A,"Accept"),zLr(A,"Content-Type"),uE.isFormData(i)||uE.isArrayBuffer(i)||uE.isBuffer(i)||uE.isStream(i)||uE.isFile(i)||uE.isBlob(i)?i:uE.isArrayBufferView(i)?i.buffer:uE.isURLSearchParams(i)?(WLr(A,"application/x-www-form-urlencoded;charset=utf-8"),i.toString()):uE.isObject(i)||A&&A["Content-Type"]==="application/json"?(WLr(A,"application/json"),SSs(i)):i}],transformResponse:[function e(i){var A=this.transitional,c=A&&A.silentJSONParsing,f=A&&A.forcedJSONParsing,l=!c&&this.responseType==="json";if(l||f&&uE.isString(i)&&i.length)try{return JSON.parse(i)}catch(g){if(l)throw g.name==="SyntaxError"?BSs(g,this,"E_JSON_PARSE"):g}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function e(i){return i>=200&&i<300}};Svt.headers={common:{Accept:"application/json, text/plain, */*"}};uE.forEach(["delete","get","head"],function e(i){Svt.headers[i]={}});uE.forEach(["post","put","patch"],function e(i){Svt.headers[i]=uE.merge(vSs)});var RIn=Svt,wSs=JR,QSs=RIn,kSs=function e(i,A,c){var f=this||QSs;return wSs.forEach(c,function(g){i=g.call(f,i,A)}),i},z2n,ZLr;function pjr(){return ZLr||(ZLr=1,z2n=function(i){return!!(i&&i.__CANCEL__)}),z2n}var XLr=JR,W2n=kSs,DSs=pjr(),RSs=RIn;function Z2n(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var PSs=function e(i){Z2n(i),i.headers=i.headers||{},i.data=W2n.call(i,i.data,i.headers,i.transformRequest),i.headers=XLr.merge(i.headers.common||{},i.headers[i.method]||{},i.headers),XLr.forEach(["delete","get","head","post","put","patch","common"],function(f){delete i.headers[f]});var A=i.adapter||RSs.adapter;return A(i).then(function(f){return Z2n(i),f.data=W2n.call(i,f.data,f.headers,i.transformResponse),f},function(f){return DSs(f)||(Z2n(i),f&&f.response&&(f.response.data=W2n.call(i,f.response.data,f.response.headers,i.transformResponse))),Promise.reject(f)})},vB=JR,yjr=function e(i,A){A=A||{};var c={},f=["url","method","data"],l=["headers","auth","proxy","params"],g=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],w=["validateStatus"];function N(v,ne){return vB.isPlainObject(v)&&vB.isPlainObject(ne)?vB.merge(v,ne):vB.isPlainObject(ne)?vB.merge({},ne):vB.isArray(ne)?ne.slice():ne}function F(v){vB.isUndefined(A[v])?vB.isUndefined(i[v])||(c[v]=N(void 0,i[v])):c[v]=N(i[v],A[v])}vB.forEach(f,function(ne){vB.isUndefined(A[ne])||(c[ne]=N(void 0,A[ne]))}),vB.forEach(l,F),vB.forEach(g,function(ne){vB.isUndefined(A[ne])?vB.isUndefined(i[ne])||(c[ne]=N(void 0,i[ne])):c[ne]=N(void 0,A[ne])}),vB.forEach(w,function(ne){ne in A?c[ne]=N(i[ne],A[ne]):ne in i&&(c[ne]=N(void 0,i[ne]))});var j=f.concat(l).concat(g).concat(w),te=Object.keys(i).concat(Object.keys(A)).filter(function(ne){return j.indexOf(ne)===-1});return vB.forEach(te,F),c},OSs="axios",NSs="0.21.4",xSs="Promise based HTTP client for the browser and node.js",MSs="index.js",TSs={test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},USs={type:"git",url:"https://github.com/axios/axios.git"},FSs=["xhr","http","ajax","promise","node"],JSs="Matt Zabriskie",HSs="MIT",LSs={url:"https://github.com/axios/axios/issues"},GSs="https://axios-http.com",qSs={coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},KSs={"./lib/adapters/http.js":"./lib/adapters/xhr.js"},YSs="dist/axios.min.js",VSs="dist/axios.min.js",zSs="./index.d.ts",WSs={"follow-redirects":"^1.14.0"},ZSs=[{path:"./dist/axios.min.js",threshold:"5kB"}],XSs={name:OSs,version:NSs,description:xSs,main:MSs,scripts:TSs,repository:USs,keywords:FSs,author:JSs,license:HSs,bugs:LSs,homepage:GSs,devDependencies:qSs,browser:KSs,jsdelivr:YSs,unpkg:VSs,typings:zSs,dependencies:WSs,bundlesize:ZSs},mjr=XSs,PIn={};["object","boolean","number","function","string","symbol"].forEach(function(e,i){PIn[e]=function(c){return typeof c===e||"a"+(i<1?"n ":" ")+e}});var $Lr={},$Ss=mjr.version.split(".");function Ijr(e,i){for(var A=i?i.split("."):$Ss,c=e.split("."),f=0;f<3;f++){if(A[f]>c[f])return!0;if(A[f]<c[f])return!1}return!1}PIn.transitional=function e(i,A,c){var f=A&&Ijr(A);function l(g,w){return"[Axios v"+mjr.version+"] Transitional option '"+g+"'"+w+(c?". "+c:"")}return function(g,w,N){if(i===!1)throw new Error(l(w," has been removed in "+A));return f&&!$Lr[w]&&($Lr[w]=!0,console.warn(l(w," has been deprecated since v"+A+" and will be removed in the near future"))),i?i(g,w,N):!0}};function jSs(e,i,A){if(typeof e!="object")throw new TypeError("options must be an object");for(var c=Object.keys(e),f=c.length;f-- >0;){var l=c[f],g=i[l];if(g){var w=e[l],N=w===void 0||g(w,l,e);if(N!==!0)throw new TypeError("option "+l+" must be "+N);continue}if(A!==!0)throw Error("Unknown option "+l)}}var ews={isOlderVersion:Ijr,assertOptions:jSs,validators:PIn},Cjr=JR,tws=ljr,jLr=lSs,eGr=PSs,wvt=yjr,_jr=ews,U6e=_jr.validators;function tqe(e){this.defaults=e,this.interceptors={request:new jLr,response:new jLr}}tqe.prototype.request=function e(i){typeof i=="string"?(i=arguments[1]||{},i.url=arguments[0]):i=i||{},i=wvt(this.defaults,i),i.method?i.method=i.method.toLowerCase():this.defaults.method?i.method=this.defaults.method.toLowerCase():i.method="get";var A=i.transitional;A!==void 0&&_jr.assertOptions(A,{silentJSONParsing:U6e.transitional(U6e.boolean,"1.0.0"),forcedJSONParsing:U6e.transitional(U6e.boolean,"1.0.0"),clarifyTimeoutError:U6e.transitional(U6e.boolean,"1.0.0")},!1);var c=[],f=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(i)===!1||(f=f&&v.synchronous,c.unshift(v.fulfilled,v.rejected))});var l=[];this.interceptors.response.forEach(function(v){l.push(v.fulfilled,v.rejected)});var g;if(!f){var w=[eGr,void 0];for(Array.prototype.unshift.apply(w,c),w=w.concat(l),g=Promise.resolve(i);w.length;)g=g.then(w.shift(),w.shift());return g}for(var N=i;c.length;){var F=c.shift(),j=c.shift();try{N=F(N)}catch(te){j(te);break}}try{g=eGr(N)}catch(te){return Promise.reject(te)}for(;l.length;)g=g.then(l.shift(),l.shift());return g};tqe.prototype.getUri=function e(i){return i=wvt(this.defaults,i),tws(i.url,i.params,i.paramsSerializer).replace(/^\?/,"")};Cjr.forEach(["delete","get","head","options"],function e(i){tqe.prototype[i]=function(A,c){return this.request(wvt(c||{},{method:i,url:A,data:(c||{}).data}))}});Cjr.forEach(["post","put","patch"],function e(i){tqe.prototype[i]=function(A,c,f){return this.request(wvt(f||{},{method:i,url:A,data:c}))}});var nws=tqe,X2n,tGr;function Ejr(){if(tGr)return X2n;tGr=1;function e(i){this.message=i}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,X2n=e,X2n}var $2n,nGr;function rws(){if(nGr)return $2n;nGr=1;var e=Ejr();function i(A){if(typeof A!="function")throw new TypeError("executor must be a function.");var c;this.promise=new Promise(function(g){c=g});var f=this;A(function(g){f.reason||(f.reason=new e(g),c(f.reason))})}return i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var c,f=new i(function(g){c=g});return{token:f,cancel:c}},$2n=i,$2n}var j2n,rGr;function iws(){return rGr||(rGr=1,j2n=function(i){return function(c){return i.apply(null,c)}}),j2n}var ehn,iGr;function ows(){return iGr||(iGr=1,ehn=function(i){return typeof i=="object"&&i.isAxiosError===!0}),ehn}var oGr=JR,aws=cjr,o_t=nws,sws=yjr,Aws=RIn;function Bjr(e){var i=new o_t(e),A=aws(o_t.prototype.request,i);return oGr.extend(A,o_t.prototype,i),oGr.extend(A,i),A}var qF=Bjr(Aws);qF.Axios=o_t;qF.create=function e(i){return Bjr(sws(qF.defaults,i))};qF.Cancel=Ejr();qF.CancelToken=rws();qF.isCancel=pjr();qF.all=function e(i){return Promise.all(i)};qF.spread=iws();qF.isAxiosError=ows();QIn.exports=qF;QIn.exports.default=qF;var dws=QIn.exports,cws=dws,uws=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(eqe,"__esModule",{value:!0});eqe.http=void 0;var fws=uws(cws);function lws(e){if(e.status>=400)throw new Error(`Bad status on response: ${e.status}`);return e}function hws(e){return e.toString().includes("emitExperimentalWarning")}function gws(e,i,A,c){return Jt(this,null,function*(){if(typeof fetch=="function"&&!hws(fetch)){let f={method:e,body:c?JSON.stringify(c):void 0,headers:Di({"Content-Type":"application/json"},A)};return fetch(i,f).then(lws).then(l=>l.json())}else return fws.default.request({url:i,method:e,data:c,headers:A}).then(f=>f.data)})}eqe.http=gws;var aW={};Object.defineProperty(aW,"__esModule",{value:!0});aW.hasProtocol=aW.instanceOfRpcStreamingClient=void 0;function pws(e){return typeof e.listen=="function"}aW.instanceOfRpcStreamingClient=pws;function yws(e){return e.search("://")!==-1}aW.hasProtocol=yws;Object.defineProperty(_vt,"__esModule",{value:!0});_vt.HttpBatchClient=void 0;var aGr=Evt,mws=eqe,Iws=aW,sGr={dispatchInterval:20,batchSizeLimit:20},kpn=class{constructor(i,A={}){var c,f;this.queue=[],this.options={batchSizeLimit:(c=A.batchSizeLimit)!=null?c:sGr.batchSizeLimit,dispatchInterval:(f=A.dispatchInterval)!=null?f:sGr.dispatchInterval},typeof i=="string"?this.url=(0,Iws.hasProtocol)(i)?i:"http://"+i:(this.url=i.url,this.headers=i.headers),this.timer=setInterval(()=>this.tick(),A.dispatchInterval),this.validate()}disconnect(){this.timer&&clearInterval(this.timer),this.timer=void 0}execute(i){return Jt(this,null,function*(){return new Promise((A,c)=>{this.queue.push({request:i,resolve:A,reject:c}),this.queue.length>=this.options.batchSizeLimit&&this.tick()})})}validate(){if(!this.options.batchSizeLimit||!Number.isSafeInteger(this.options.batchSizeLimit)||this.options.batchSizeLimit<1)throw new Error("batchSizeLimit must be a safe integer >= 1")}tick(){let i=this.queue.splice(0,this.options.batchSizeLimit);if(!i.length)return;let A=i.map(f=>f.request),c=A.map(f=>f.id);(0,mws.http)("POST",this.url,this.headers,A).then(f=>{(Array.isArray(f)?f:[f]).forEach(g=>{let w=i.find(te=>te.request.id===g.id);if(!w)return;let{reject:N,resolve:F}=w,j=(0,aGr.parseJsonRpcResponse)(g);(0,aGr.isJsonRpcErrorResponse)(j)?N(new Error(JSON.stringify(j.error))):F(j)})},f=>{for(let l of c){let g=i.find(w=>w.request.id===l);if(!g)return;g.reject(f)}})}};_vt.HttpBatchClient=kpn;var Qvt={};Object.defineProperty(Qvt,"__esModule",{value:!0});Qvt.HttpClient=void 0;var AGr=Evt,Cws=eqe,_ws=aW,Dpn=class{constructor(i){typeof i=="string"?this.url=(0,_ws.hasProtocol)(i)?i:"http://"+i:(this.url=i.url,this.headers=i.headers)}disconnect(){}execute(i){return Jt(this,null,function*(){let A=(0,AGr.parseJsonRpcResponse)(yield(0,Cws.http)("POST",this.url,this.headers,i));if((0,AGr.isJsonRpcErrorResponse)(A))throw new Error(JSON.stringify(A.error));return A})}};Qvt.HttpClient=Dpn;var kvt={},vjr={},OIn={},nqe={},rqe={},q6e=null;typeof WebSocket!="undefined"?q6e=WebSocket:typeof MozWebSocket!="undefined"?q6e=MozWebSocket:typeof Fr!="undefined"?q6e=Fr.WebSocket||Fr.MozWebSocket:typeof window!="undefined"?q6e=window.WebSocket||window.MozWebSocket:typeof self!="undefined"&&(q6e=self.WebSocket||self.MozWebSocket);var Ews=q6e,Bws=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(rqe,"__esModule",{value:!0});rqe.SocketWrapper=void 0;var F6e=Bws(Ews);function vws(){return typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.node!="undefined"}var Rpn=class{constructor(i,A,c,f,l,g=1e4){this.closed=!1,this.connected=new Promise((w,N)=>{this.connectedResolver=w,this.connectedRejecter=N}),this.url=i,this.messageHandler=A,this.errorHandler=c,this.openHandler=f,this.closeHandler=l,this.timeout=g}connect(){let i=new F6e.default(this.url);i.onerror=c=>{this.clearTimeout(),this.errorHandler&&this.errorHandler(c)},i.onmessage=c=>{this.messageHandler({type:c.type,data:c.data})},i.onopen=c=>{this.clearTimeout(),this.connectedResolver(),this.openHandler&&this.openHandler()},i.onclose=c=>{this.closed=!0,this.closeHandler&&this.closeHandler(c)};let A=Date.now();this.timeoutId=setTimeout(()=>{i.onmessage=()=>0,i.onerror=()=>0,i.onopen=()=>0,i.onclose=()=>0,i.close(),this.socket=void 0;let c=Math.floor(Date.now()-A);this.connectedRejecter(`Connection attempt timed out after ${c} ms`)},this.timeout),this.socket=i}disconnect(){if(!this.socket)throw new Error("Socket undefined. This must be called after connecting.");switch(this.clearTimeout(),this.socket.readyState){case F6e.default.OPEN:this.socket.close(1e3);break;case F6e.default.CLOSED:break;case F6e.default.CONNECTING:this.socket.onopen=()=>0,this.socket.onclose=()=>0,this.socket.onerror=()=>0,this.socket.onmessage=()=>0,this.socket=void 0,this.closeHandler&&this.closeHandler({wasClean:!1,code:4001});break;case F6e.default.CLOSING:break;default:throw new Error(`Unknown readyState: ${this.socket.readyState}`)}}send(i){return Jt(this,null,function*(){return new Promise((A,c)=>{if(!this.socket)throw new Error("Socket undefined. This must be called after connecting.");if(this.closed)throw new Error("Socket was closed, so no data can be sent anymore.");if(this.socket.readyState!==F6e.default.OPEN)throw new Error("Websocket is not open");vws()?this.socket.send(i,f=>f?c(f):A()):(this.socket.send(i),A())})})}clearTimeout(){if(!this.timeoutId)throw new Error("Timeout ID not set. This should not happen and usually means connect() was not called.");clearTimeout(this.timeoutId)}};rqe.SocketWrapper=Rpn;Object.defineProperty(nqe,"__esModule",{value:!0});nqe.StreamingSocket=void 0;var bws=mE,Sws=rqe,Ppn=class{constructor(i,A=1e4){this.socket=new Sws.SocketWrapper(i,f=>{this.eventProducerListener&&this.eventProducerListener.next(f)},f=>{this.eventProducerListener&&this.eventProducerListener.error(f)},()=>{},f=>{this.eventProducerListener&&(f.wasClean?this.eventProducerListener.complete():this.eventProducerListener.error("Socket was closed unclean"))},A),this.connected=this.socket.connected;let c={start:f=>this.eventProducerListener=f,stop:()=>this.eventProducerListener=void 0};this.events=bws.Stream.create(c)}connect(){this.socket.connect()}disconnect(){this.socket.disconnect()}send(i){return Jt(this,null,function*(){return this.socket.send(i)})}};nqe.StreamingSocket=Ppn;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.QueueingStreamingSocket=e.ConnectionStatus=void 0;let i=$Ge,A=mE,c=nqe;var f;(function(g){g[g.Unconnected=0]="Unconnected",g[g.Connecting=1]="Connecting",g[g.Connected=2]="Connected",g[g.Disconnected=3]="Disconnected"})(f=e.ConnectionStatus||(e.ConnectionStatus={}));class l{constructor(w,N=1e4,F){this.queue=[],this.isProcessingQueue=!1,this.url=w,this.timeout=N,this.reconnectedHandler=F;let j={start:te=>this.eventProducerListener=te,stop:()=>this.eventProducerListener=void 0};this.events=A.Stream.create(j),this.connectionStatusProducer=new i.DefaultValueProducer(f.Unconnected),this.connectionStatus=new i.ValueAndUpdates(this.connectionStatusProducer),this.socket=new c.StreamingSocket(this.url,this.timeout),this.socket.events.subscribe({next:te=>{if(!this.eventProducerListener)throw new Error("No event producer listener set");this.eventProducerListener.next(te)},error:()=>this.connectionStatusProducer.update(f.Disconnected)})}connect(){this.connectionStatusProducer.update(f.Connecting),this.socket.connected.then(()=>Jt(this,null,function*(){return this.connectionStatusProducer.update(f.Connected),this.processQueue()}),()=>this.connectionStatusProducer.update(f.Disconnected)),this.socket.connect()}disconnect(){this.connectionStatusProducer.update(f.Disconnected),this.socket.disconnect()}reconnect(){this.socket=new c.StreamingSocket(this.url,this.timeout),this.socket.events.subscribe({next:w=>{if(!this.eventProducerListener)throw new Error("No event producer listener set");this.eventProducerListener.next(w)},error:()=>this.connectionStatusProducer.update(f.Disconnected)}),this.socket.connected.then(()=>{this.reconnectedHandler&&this.reconnectedHandler()}),this.connect()}getQueueLength(){return this.queue.length}queueRequest(w){this.queue.push(w),this.processQueue()}processQueue(){return Jt(this,null,function*(){if(this.isProcessingQueue||this.connectionStatus.value!==f.Connected)return;this.isProcessingQueue=!0;let w;for(;w=this.queue.shift();)try{yield this.socket.send(w),this.isProcessingQueue=!1}catch(N){this.queue.unshift(w),this.isProcessingQueue=!1;return}})}}e.QueueingStreamingSocket=l})(OIn);var Dvt={};Object.defineProperty(Dvt,"__esModule",{value:!0});Dvt.ReconnectingSocket=void 0;var wws=mE,thn=OIn,Opn=class e{static calculateTimeout(i){return Math.min(hi(2,i)*100,5e3)}constructor(i,A=1e4,c){this.unconnected=!0,this.disconnected=!1,this.timeoutIndex=0,this.reconnectTimeout=null;let f={start:l=>this.eventProducerListener=l,stop:()=>this.eventProducerListener=void 0};this.events=wws.Stream.create(f),this.socket=new thn.QueueingStreamingSocket(i,A,c),this.socket.events.subscribe({next:l=>{this.eventProducerListener&&this.eventProducerListener.next(l)},error:l=>{this.eventProducerListener&&this.eventProducerListener.error(l)}}),this.connectionStatus=this.socket.connectionStatus,this.connectionStatus.updates.subscribe({next:l=>{l===thn.ConnectionStatus.Connected&&(this.timeoutIndex=0),l===thn.ConnectionStatus.Disconnected&&(this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.reconnectTimeout=setTimeout(()=>this.socket.reconnect(),e.calculateTimeout(this.timeoutIndex++)))}})}connect(){if(!this.unconnected)throw new Error("Cannot connect: socket has already connected");this.socket.connect(),this.unconnected=!1}disconnect(){if(this.unconnected)throw new Error("Cannot disconnect: socket has not yet connected");this.socket.disconnect(),this.eventProducerListener&&this.eventProducerListener.complete(),this.disconnected=!0}queueRequest(i){if(this.disconnected)throw new Error("Cannot queue request: socket has disconnected");this.socket.queueRequest(i)}};Dvt.ReconnectingSocket=Opn;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.StreamingSocket=e.SocketWrapper=e.ReconnectingSocket=e.QueueingStreamingSocket=e.ConnectionStatus=void 0;var i=OIn;Object.defineProperty(e,"ConnectionStatus",{enumerable:!0,get:function(){return i.ConnectionStatus}}),Object.defineProperty(e,"QueueingStreamingSocket",{enumerable:!0,get:function(){return i.QueueingStreamingSocket}});var A=Dvt;Object.defineProperty(e,"ReconnectingSocket",{enumerable:!0,get:function(){return A.ReconnectingSocket}});var c=rqe;Object.defineProperty(e,"SocketWrapper",{enumerable:!0,get:function(){return c.SocketWrapper}});var f=nqe;Object.defineProperty(e,"StreamingSocket",{enumerable:!0,get:function(){return f.StreamingSocket}})})(vjr);Object.defineProperty(kvt,"__esModule",{value:!0});kvt.WebsocketClient=void 0;var CEt=Evt,dGr=vjr,Qws=$Ge,kws=mE,Dws=aW;function Rws(e){throw e}function bjr(e){if(e.type!=="message")throw new Error(`Unexcepted message type on websocket: ${e.type}`);return(0,CEt.parseJsonRpcResponse)(JSON.parse(e.data))}var Npn=class{constructor(i,A){this.running=!1,this.subscriptions=[],this.request=i,this.socket=A}start(i){if(this.running)throw Error("Already started. Please stop first before restarting.");this.running=!0,this.connectToClient(i),this.socket.queueRequest(JSON.stringify(this.request))}stop(){this.running=!1;let i=Yo(Di({},this.request),{method:"unsubscribe"});try{this.socket.queueRequest(JSON.stringify(i))}catch(A){if(!(A instanceof Error&&A.message.match(/socket has disconnected/i)))throw A}}connectToClient(i){let A=this.socket.events.map(bjr),c=A.filter(g=>g.id===this.request.id).subscribe({next:g=>{(0,CEt.isJsonRpcErrorResponse)(g)&&(this.closeSubscriptions(),i.error(JSON.stringify(g.error))),c.unsubscribe()}}),f=A.filter(g=>g.id===this.request.id).subscribe({next:g=>{(0,CEt.isJsonRpcErrorResponse)(g)?(this.closeSubscriptions(),i.error(JSON.stringify(g.error))):i.next(g.result)}}),l=A.subscribe({error:g=>{this.closeSubscriptions(),i.error(g)},complete:()=>{this.closeSubscriptions(),i.complete()}});this.subscriptions.push(c,f,l)}closeSubscriptions(){for(let i of this.subscriptions)i.unsubscribe();this.subscriptions=[]}},xpn=class{constructor(i,A=Rws){this.subscriptionStreams=new Map;let c=i.endsWith("/")?"websocket":"/websocket",f=(0,Dws.hasProtocol)(i)?i:"ws://"+i;this.url=f+c,this.socket=new dGr.ReconnectingSocket(this.url);let l=this.socket.events.subscribe({error:g=>{A(g),l.unsubscribe()}});this.jsonRpcResponseStream=this.socket.events.map(bjr),this.socket.connect()}execute(i){return Jt(this,null,function*(){let A=this.responseForRequestId(i.id);this.socket.queueRequest(JSON.stringify(i));let c=yield A;if((0,CEt.isJsonRpcErrorResponse)(c))throw new Error(JSON.stringify(c.error));return c})}listen(i){if(i.method!=="subscribe")throw new Error('Request method must be "subscribe" to start event listening');let A=i.params.query;if(typeof A!="string")throw new Error("request.params.query must be a string");if(!this.subscriptionStreams.has(A)){let c=new Npn(i,this.socket),f=kws.Stream.create(c);this.subscriptionStreams.set(A,f)}return this.subscriptionStreams.get(A).filter(c=>c.query!==void 0)}connected(){return Jt(this,null,function*(){yield this.socket.connectionStatus.waitFor(dGr.ConnectionStatus.Connected)})}disconnect(){this.socket.disconnect()}responseForRequestId(i){return Jt(this,null,function*(){return(0,Qws.firstEvent)(this.jsonRpcResponseStream.filter(A=>A.id===i))})}};kvt.WebsocketClient=xpn;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WebsocketClient=e.instanceOfRpcStreamingClient=e.HttpClient=e.HttpBatchClient=void 0;var i=_vt;Object.defineProperty(e,"HttpBatchClient",{enumerable:!0,get:function(){return i.HttpBatchClient}});var A=Qvt;Object.defineProperty(e,"HttpClient",{enumerable:!0,get:function(){return A.HttpClient}});var c=aW;Object.defineProperty(e,"instanceOfRpcStreamingClient",{enumerable:!0,get:function(){return c.instanceOfRpcStreamingClient}});var f=kvt;Object.defineProperty(e,"WebsocketClient",{enumerable:!0,get:function(){return f.WebsocketClient}})})(Cvt);var WLe={},Rvt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.buildQuery=e.SubscriptionEventType=e.Method=void 0,function(A){A.AbciInfo="abci_info",A.AbciQuery="abci_query",A.Block="block",A.Blockchain="blockchain",A.BlockResults="block_results",A.BlockSearch="block_search",A.BroadcastTxAsync="broadcast_tx_async",A.BroadcastTxSync="broadcast_tx_sync",A.BroadcastTxCommit="broadcast_tx_commit",A.Commit="commit",A.Genesis="genesis",A.Health="health",A.NumUnconfirmedTxs="num_unconfirmed_txs",A.Status="status",A.Subscribe="subscribe",A.Tx="tx",A.TxSearch="tx_search",A.Validators="validators",A.Unsubscribe="unsubscribe"}(e.Method||(e.Method={})),function(A){A.NewBlock="NewBlock",A.NewBlockHeader="NewBlockHeader",A.Tx="Tx"}(e.SubscriptionEventType||(e.SubscriptionEventType={}));function i(A){let f=(A.tags?A.tags:[]).map(g=>`${g.key}='${g.value}'`),l=A.raw?[A.raw]:[];return[...f,...l].join(" AND ")}e.buildQuery=i})(Rvt);var Sjr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.VoteType=e.broadcastTxCommitSuccess=e.broadcastTxSyncSuccess=void 0;function i(c){return c.code===0}e.broadcastTxSyncSuccess=i;function A(c){return c.checkTx.code===0&&!!c.deliverTx&&c.deliverTx.code===0}e.broadcastTxCommitSuccess=A,function(c){c[c.PreVote=1]="PreVote",c[c.PreCommit=2]="PreCommit"}(e.VoteType||(e.VoteType={}))})(Sjr);var Pvt={},zfe={};Object.defineProperty(zfe,"__esModule",{value:!0});zfe.createJsonRpcRequest=void 0;var cGr="123456789";function Pws(){return cGr[Math.floor(Math.random()*cGr.length)]}function Ows(){return parseInt(Array.from({length:12}).map(()=>Pws()).join(""),10)}function Nws(e,i){let A=i?Di({},i):{};return{jsonrpc:"2.0",id:Ows(),method:e,params:A}}zfe.createJsonRpcRequest=Nws;var Ovt={},Sfe={},I2={};Object.defineProperty(I2,"__esModule",{value:!0});I2.encodeBlockId=I2.encodeVersion=I2.encodeBytes=I2.encodeTime=I2.encodeUvarint=I2.encodeString=I2.dictionaryToStringMap=I2.may=I2.assertNotEmpty=I2.assertObject=I2.assertArray=I2.assertNumber=I2.assertString=I2.assertBoolean=I2.assertSet=void 0;var xws=K2;function Wfe(e){if(e===void 0)throw new Error("Value must not be undefined");if(e===null)throw new Error("Value must not be null");return e}I2.assertSet=Wfe;function Mws(e){if(Wfe(e),typeof e!="boolean")throw new Error("Value must be a boolean");return e}I2.assertBoolean=Mws;function Tws(e){if(Wfe(e),typeof e!="string")throw new Error("Value must be a string");return e}I2.assertString=Tws;function Uws(e){if(Wfe(e),typeof e!="number")throw new Error("Value must be a number");return e}I2.assertNumber=Uws;function Fws(e){if(Wfe(e),!Array.isArray(e))throw new Error("Value must be a an array");return e}I2.assertArray=Fws;function Jws(e){if(Wfe(e),typeof e!="object")throw new Error("Value must be an object");if(Object.prototype.toString.call(e)!=="[object Object]")throw new Error("Value must be a simple object");return e}I2.assertObject=Jws;function Hws(e){if(Wfe(e),typeof e=="number"&&e===0)throw new Error("must provide a non-zero value");if(e.length===0)throw new Error("must provide a non-empty value");return e}I2.assertNotEmpty=Hws;function Lws(e,i){return i==null?void 0:e(i)}I2.may=Lws;function Gws(e){let i=new Map;for(let A of Object.keys(e)){let c=e[A];if(typeof c!="string")throw new Error("Found dictionary value of type other than string");i.set(A,c)}return i}I2.dictionaryToStringMap=Gws;function qws(e){let i=(0,xws.toUtf8)(e);return Uint8Array.from([i.length,...i])}I2.encodeString=qws;function ySe(e){return e>=128?Uint8Array.from([e&255|128,...ySe(e>>7)]):Uint8Array.from([e&255])}I2.encodeUvarint=ySe;function Kws(e){let i=e.getTime(),A=Math.floor(i/1e3),c=A?[8,...ySe(A)]:new Uint8Array,f=(e.nanoseconds||0)+i%1e3*1e6,l=f?[16,...ySe(f)]:new Uint8Array;return Uint8Array.from([...c,...l])}I2.encodeTime=Kws;function Yws(e){if(e.length>=128)throw new Error("Not implemented for byte arrays of length 128 or more");return e.length?Uint8Array.from([e.length,...e]):new Uint8Array}I2.encodeBytes=Yws;function Vws(e){let i=e.block?Uint8Array.from([8,...ySe(e.block)]):new Uint8Array,A=e.app?Uint8Array.from([16,...ySe(e.app)]):new Uint8Array;return Uint8Array.from([...i,...A])}I2.encodeVersion=Vws;function zws(e){return Uint8Array.from([10,e.hash.length,...e.hash,18,e.parts.hash.length+4,8,e.parts.total,18,e.parts.hash.length,...e.parts.hash])}I2.encodeBlockId=zws;Object.defineProperty(Sfe,"__esModule",{value:!0});Sfe.hashBlock=Sfe.hashTx=void 0;var NIn=bD,Vk=I2;function Wws(e){return(0,NIn.sha256)(e)}Sfe.hashTx=Wws;function Zws(e){if(e<1)throw new Error("Cannot split an empty tree");let i=hi(2,Math.floor(Math.log2(e)));return i<e?i:i/2}function Xws(e){let i=new NIn.Sha256(Uint8Array.from([0]));return i.update(e),i.digest()}function $ws(e,i){let A=new NIn.Sha256(Uint8Array.from([1]));return A.update(e),A.update(i),A.digest()}function Mpn(e){switch(e.length){case 0:throw new Error("Cannot hash empty tree");case 1:return Xws(e[0]);default:{let i=Zws(e.length),A=Mpn(e.slice(0,i)),c=Mpn(e.slice(i));return $ws(A,c)}}}function jws(e){if(!e.lastBlockId)throw new Error("Hashing a block header with no last block ID (i.e. header at height 1) is not supported. If you need this, contributions are welcome. Please add documentation and test vectors for this case.");let i=[(0,Vk.encodeVersion)(e.version),(0,Vk.encodeString)(e.chainId),(0,Vk.encodeUvarint)(e.height),(0,Vk.encodeTime)(e.time),(0,Vk.encodeBlockId)(e.lastBlockId),(0,Vk.encodeBytes)(e.lastCommitHash),(0,Vk.encodeBytes)(e.dataHash),(0,Vk.encodeBytes)(e.validatorsHash),(0,Vk.encodeBytes)(e.nextValidatorsHash),(0,Vk.encodeBytes)(e.consensusHash),(0,Vk.encodeBytes)(e.appHash),(0,Vk.encodeBytes)(e.lastResultsHash),(0,Vk.encodeBytes)(e.evidenceHash),(0,Vk.encodeBytes)(e.proposerAddress)];return Mpn(i)}Sfe.hashBlock=jws;var Nvt={},TF={};Object.defineProperty(TF,"__esModule",{value:!0});TF.smallIntToApi=TF.apiToBigInt=TF.apiToSmallInt=void 0;var Tpn=EE,e5s=I2;function t5s(e){return(typeof e=="number"?new Tpn.Int53(e):Tpn.Int53.fromString(e)).toNumber()}TF.apiToSmallInt=t5s;function n5s(e){if((0,e5s.assertString)(e),!e.match(/^-?[0-9]+$/))throw new Error("Invalid string format");return BigInt(e)}TF.apiToBigInt=n5s;function r5s(e){return new Tpn.Int53(e).toString()}TF.smallIntToApi=r5s;var i5s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),o5s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),a5s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&i5s(i,e,A);return o5s(i,e),i};Object.defineProperty(Nvt,"__esModule",{value:!0});Nvt.Params=void 0;var xIn=K2,UF=TF,bB=zfe,yD=I2,s5s=a5s(Rvt);function nhn(e){return{height:(0,yD.may)(UF.smallIntToApi,e.height)}}function A5s(e){return{minHeight:(0,yD.may)(UF.smallIntToApi,e.minHeight),maxHeight:(0,yD.may)(UF.smallIntToApi,e.maxHeight)}}function d5s(e){return{query:e.query,page:(0,yD.may)(UF.smallIntToApi,e.page),per_page:(0,yD.may)(UF.smallIntToApi,e.per_page),order_by:e.order_by}}function c5s(e){return{path:(0,yD.assertNotEmpty)(e.path),data:(0,xIn.toHex)(e.data),height:(0,yD.may)(UF.smallIntToApi,e.height),prove:e.prove}}function u5s(e){return{tx:(0,xIn.toBase64)((0,yD.assertNotEmpty)(e.tx))}}function f5s(e){return{hash:(0,xIn.toBase64)((0,yD.assertNotEmpty)(e.hash)),prove:e.prove}}function l5s(e){return{query:e.query,prove:e.prove,page:(0,yD.may)(UF.smallIntToApi,e.page),per_page:(0,yD.may)(UF.smallIntToApi,e.per_page),order_by:e.order_by}}function h5s(e){return{height:(0,yD.may)(UF.smallIntToApi,e.height),page:(0,yD.may)(UF.smallIntToApi,e.page),per_page:(0,yD.may)(UF.smallIntToApi,e.per_page)}}var Upn=class{static encodeAbciInfo(i){return(0,bB.createJsonRpcRequest)(i.method)}static encodeAbciQuery(i){return(0,bB.createJsonRpcRequest)(i.method,c5s(i.params))}static encodeBlock(i){return(0,bB.createJsonRpcRequest)(i.method,nhn(i.params))}static encodeBlockchain(i){return(0,bB.createJsonRpcRequest)(i.method,A5s(i.params))}static encodeBlockResults(i){return(0,bB.createJsonRpcRequest)(i.method,nhn(i.params))}static encodeBlockSearch(i){return(0,bB.createJsonRpcRequest)(i.method,d5s(i.params))}static encodeBroadcastTx(i){return(0,bB.createJsonRpcRequest)(i.method,u5s(i.params))}static encodeCommit(i){return(0,bB.createJsonRpcRequest)(i.method,nhn(i.params))}static encodeGenesis(i){return(0,bB.createJsonRpcRequest)(i.method)}static encodeHealth(i){return(0,bB.createJsonRpcRequest)(i.method)}static encodeNumUnconfirmedTxs(i){return(0,bB.createJsonRpcRequest)(i.method)}static encodeStatus(i){return(0,bB.createJsonRpcRequest)(i.method)}static encodeSubscribe(i){let A={key:"tm.event",value:i.query.type},c=s5s.buildQuery({tags:[A],raw:i.query.raw});return(0,bB.createJsonRpcRequest)("subscribe",{query:c})}static encodeTx(i){return(0,bB.createJsonRpcRequest)(i.method,f5s(i.params))}static encodeTxSearch(i){return(0,bB.createJsonRpcRequest)(i.method,l5s(i.params))}static encodeValidators(i){return(0,bB.createJsonRpcRequest)(i.method,h5s(i.params))}};Nvt.Params=Upn;var mM={},xvt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BlockIdFlag=void 0,function(i){i[i.Unknown=0]="Unknown",i[i.Absent=1]="Absent",i[i.Commit=2]="Commit",i[i.Nil=3]="Nil",i[i.Unrecognized=-1]="Unrecognized"}(e.BlockIdFlag||(e.BlockIdFlag={}))})(xvt);Object.defineProperty(mM,"__esModule",{value:!0});mM.Responses=mM.decodeValidatorInfo=mM.decodeValidatorGenesis=mM.decodeValidatorUpdate=mM.decodeEvent=void 0;var uf=K2,wjr=O3,pGe=dD,hf=TF,g5s=xvt,Ra=I2,p5s=Sfe;function y5s(e){return{data:e.data,lastBlockHeight:(0,Ra.may)(hf.apiToSmallInt,e.last_block_height),lastBlockAppHash:(0,Ra.may)(uf.fromBase64,e.last_block_app_hash)}}function m5s(e){return{ops:e.ops.map(i=>({type:i.type,key:(0,uf.fromBase64)(i.key),data:(0,uf.fromBase64)(i.data)}))}}function I5s(e){var i,A,c,f;return{key:(0,uf.fromBase64)((0,Ra.assertString)((i=e.key)!=null?i:"")),value:(0,uf.fromBase64)((0,Ra.assertString)((A=e.value)!=null?A:"")),proof:(0,Ra.may)(m5s,e.proofOps),height:(0,Ra.may)(hf.apiToSmallInt,e.height),code:(0,Ra.may)(hf.apiToSmallInt,e.code),codespace:(0,Ra.assertString)((c=e.codespace)!=null?c:""),index:(0,Ra.may)(hf.apiToSmallInt,e.index),log:e.log,info:(0,Ra.assertString)((f=e.info)!=null?f:"")}}function C5s(e){var i;return{key:(0,uf.fromBase64)((0,Ra.assertNotEmpty)(e.key)),value:(0,uf.fromBase64)((0,Ra.assertString)((i=e.value)!=null?i:""))}}function _5s(e){return(0,Ra.assertArray)(e).map(C5s)}function Qjr(e){return{type:e.type,attributes:e.attributes?_5s(e.attributes):[]}}mM.decodeEvent=Qjr;function Fpn(e){return(0,Ra.assertArray)(e).map(Qjr)}function mSe(e){var i,A,c;return{code:(0,hf.apiToSmallInt)((0,Ra.assertNumber)((i=e.code)!=null?i:0)),codespace:e.codespace,log:e.log,data:(0,Ra.may)(uf.fromBase64,e.data),events:e.events?Fpn(e.events):[],gasWanted:(0,hf.apiToSmallInt)((A=e.gas_wanted)!=null?A:"0"),gasUsed:(0,hf.apiToSmallInt)((c=e.gas_used)!=null?c:"0")}}function MIn(e){if("Sum"in e){let[[i,A]]=Object.entries(e.Sum.value);return(0,wjr.assert)(i==="ed25519"||i==="secp256k1",`unknown pubkey type: ${i}`),{algorithm:i,data:(0,uf.fromBase64)((0,Ra.assertNotEmpty)(A))}}else switch(e.type){case"tendermint/PubKeyEd25519":return{algorithm:"ed25519",data:(0,uf.fromBase64)((0,Ra.assertNotEmpty)(e.value))};case"tendermint/PubKeySecp256k1":return{algorithm:"secp256k1",data:(0,uf.fromBase64)((0,Ra.assertNotEmpty)(e.value))};default:throw new Error(`unknown pubkey type: ${e.type}`)}}function E5s(e){return{maxBytes:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.max_bytes)),maxGas:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.max_gas))}}function B5s(e){return{maxAgeNumBlocks:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.max_age_num_blocks)),maxAgeDuration:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.max_age_duration))}}function kjr(e){return{block:E5s((0,Ra.assertObject)(e.block)),evidence:B5s((0,Ra.assertObject)(e.evidence))}}function Djr(e){var i;return{pubkey:MIn((0,Ra.assertObject)(e.pub_key)),votingPower:(0,hf.apiToBigInt)((i=e.power)!=null?i:"0")}}mM.decodeValidatorUpdate=Djr;function v5s(e){return{height:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.height)),results:(e.txs_results||[]).map(mSe),validatorUpdates:(e.validator_updates||[]).map(Djr),consensusUpdates:(0,Ra.may)(kjr,e.consensus_param_updates),beginBlockEvents:Fpn(e.begin_block_events||[]),endBlockEvents:Fpn(e.end_block_events||[])}}function Mvt(e){return{hash:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.hash)),parts:{total:(0,Ra.assertNotEmpty)(e.parts.total),hash:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.parts.hash))}}}function b5s(e){var i;return{block:(0,hf.apiToSmallInt)(e.block),app:(0,hf.apiToSmallInt)((i=e.app)!=null?i:0)}}function Tvt(e){return{version:b5s(e.version),chainId:(0,Ra.assertNotEmpty)(e.chain_id),height:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.height)),time:(0,pGe.fromRfc3339WithNanoseconds)((0,Ra.assertNotEmpty)(e.time)),lastBlockId:e.last_block_id.hash?Mvt(e.last_block_id):null,lastCommitHash:(0,uf.fromHex)((0,Ra.assertSet)(e.last_commit_hash)),dataHash:(0,uf.fromHex)((0,Ra.assertSet)(e.data_hash)),validatorsHash:(0,uf.fromHex)((0,Ra.assertSet)(e.validators_hash)),nextValidatorsHash:(0,uf.fromHex)((0,Ra.assertSet)(e.next_validators_hash)),consensusHash:(0,uf.fromHex)((0,Ra.assertSet)(e.consensus_hash)),appHash:(0,uf.fromHex)((0,Ra.assertSet)(e.app_hash)),lastResultsHash:(0,uf.fromHex)((0,Ra.assertSet)(e.last_results_hash)),evidenceHash:(0,uf.fromHex)((0,Ra.assertSet)(e.evidence_hash)),proposerAddress:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.proposer_address))}}function S5s(e){return{blockId:Mvt(e.block_id),blockSize:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.block_size)),header:Tvt(e.header),numTxs:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.num_txs))}}function w5s(e){return{lastHeight:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.last_height)),blockMetas:(0,Ra.assertArray)(e.block_metas).map(S5s)}}function Q5s(e){return Yo(Di({},mSe(e)),{hash:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.hash))})}function k5s(e){return{height:(0,hf.apiToSmallInt)(e.height),hash:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.hash)),checkTx:mSe((0,Ra.assertObject)(e.check_tx)),deliverTx:(0,Ra.may)(mSe,e.deliver_tx)}}function D5s(e){return(0,wjr.assert)(e in g5s.BlockIdFlag),e}function R5s(e){return e&&!e.startsWith("0001-01-01")?(0,pGe.fromRfc3339WithNanoseconds)(e):void 0}function P5s(e){return{blockIdFlag:D5s(e.block_id_flag),validatorAddress:e.validator_address?(0,uf.fromHex)(e.validator_address):void 0,timestamp:R5s(e.timestamp),signature:e.signature?(0,uf.fromBase64)(e.signature):void 0}}function Rjr(e){return{blockId:Mvt((0,Ra.assertObject)(e.block_id)),height:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.height)),round:(0,hf.apiToSmallInt)(e.round),signatures:(0,Ra.assertArray)(e.signatures).map(P5s)}}function O5s(e){return{canonical:(0,Ra.assertBoolean)(e.canonical),header:Tvt(e.signed_header.header),commit:Rjr(e.signed_header.commit)}}function Pjr(e){return{address:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.address)),pubkey:MIn((0,Ra.assertObject)(e.pub_key)),votingPower:(0,hf.apiToBigInt)((0,Ra.assertNotEmpty)(e.power))}}mM.decodeValidatorGenesis=Pjr;function N5s(e){return{genesisTime:(0,pGe.fromRfc3339WithNanoseconds)((0,Ra.assertNotEmpty)(e.genesis_time)),chainId:(0,Ra.assertNotEmpty)(e.chain_id),consensusParams:kjr(e.consensus_params),validators:e.validators?(0,Ra.assertArray)(e.validators).map(Pjr):[],appHash:(0,uf.fromHex)((0,Ra.assertSet)(e.app_hash)),appState:e.app_state}}function TIn(e){return{pubkey:MIn((0,Ra.assertObject)(e.pub_key)),votingPower:(0,hf.apiToBigInt)((0,Ra.assertNotEmpty)(e.voting_power)),address:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.address)),proposerPriority:e.proposer_priority?(0,hf.apiToSmallInt)(e.proposer_priority):void 0}}mM.decodeValidatorInfo=TIn;function x5s(e){return{id:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.id)),listenAddr:(0,Ra.assertNotEmpty)(e.listen_addr),network:(0,Ra.assertNotEmpty)(e.network),version:(0,Ra.assertString)(e.version),channels:(0,Ra.assertNotEmpty)(e.channels),moniker:(0,Ra.assertNotEmpty)(e.moniker),other:(0,Ra.dictionaryToStringMap)(e.other),protocolVersion:{app:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.protocol_version.app)),block:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.protocol_version.block)),p2p:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.protocol_version.p2p))}}}function M5s(e){let i=e.earliest_block_height?(0,hf.apiToSmallInt)(e.earliest_block_height):void 0,A=e.earliest_block_time?(0,pGe.fromRfc3339WithNanoseconds)(e.earliest_block_time):void 0;return{earliestAppHash:e.earliest_app_hash?(0,uf.fromHex)(e.earliest_app_hash):void 0,earliestBlockHash:e.earliest_block_hash?(0,uf.fromHex)(e.earliest_block_hash):void 0,earliestBlockHeight:i||void 0,earliestBlockTime:A!=null&&A.getTime()?A:void 0,latestBlockHash:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.latest_block_hash)),latestAppHash:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.latest_app_hash)),latestBlockTime:(0,pGe.fromRfc3339WithNanoseconds)((0,Ra.assertNotEmpty)(e.latest_block_time)),latestBlockHeight:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.latest_block_height)),catchingUp:(0,Ra.assertBoolean)(e.catching_up)}}function T5s(e){return{nodeInfo:x5s(e.node_info),syncInfo:M5s(e.sync_info),validatorInfo:TIn(e.validator_info)}}function U5s(e){return{data:(0,uf.fromBase64)((0,Ra.assertNotEmpty)(e.data)),rootHash:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.root_hash)),proof:{total:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.proof.total)),index:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.proof.index)),leafHash:(0,uf.fromBase64)((0,Ra.assertNotEmpty)(e.proof.leaf_hash)),aunts:(0,Ra.assertArray)(e.proof.aunts).map(uf.fromBase64)}}}function Ojr(e){return{tx:(0,uf.fromBase64)((0,Ra.assertNotEmpty)(e.tx)),result:mSe((0,Ra.assertObject)(e.tx_result)),height:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.height)),index:(0,hf.apiToSmallInt)((0,Ra.assertNumber)(e.index)),hash:(0,uf.fromHex)((0,Ra.assertNotEmpty)(e.hash)),proof:(0,Ra.may)(U5s,e.proof)}}function F5s(e){return{totalCount:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.total_count)),txs:(0,Ra.assertArray)(e.txs).map(Ojr)}}function J5s(e){let i=(0,uf.fromBase64)((0,Ra.assertNotEmpty)(e.tx));return{tx:i,hash:(0,p5s.hashTx)(i),result:mSe(e.result),height:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.height))}}function H5s(e){return{blockHeight:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.block_height)),validators:(0,Ra.assertArray)(e.validators).map(TIn),count:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.count)),total:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.total))}}function Njr(e){var i,A;return{header:Tvt((0,Ra.assertObject)(e.header)),lastCommit:e.last_commit.block_id.hash?Rjr((0,Ra.assertObject)(e.last_commit)):null,txs:e.data.txs?(0,Ra.assertArray)(e.data.txs).map(uf.fromBase64):[],evidence:(A=(i=e.evidence)==null?void 0:i.evidence)!=null?A:[]}}function xjr(e){return{blockId:Mvt(e.block_id),block:Njr(e.block)}}function L5s(e){return{totalCount:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.total_count)),blocks:(0,Ra.assertArray)(e.blocks).map(xjr)}}function G5s(e){return{total:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.total)),totalBytes:(0,hf.apiToSmallInt)((0,Ra.assertNotEmpty)(e.total_bytes))}}var Jpn=class e{static decodeAbciInfo(i){return y5s((0,Ra.assertObject)(i.result.response))}static decodeAbciQuery(i){return I5s((0,Ra.assertObject)(i.result.response))}static decodeBlock(i){return xjr(i.result)}static decodeBlockResults(i){return v5s(i.result)}static decodeBlockSearch(i){return L5s(i.result)}static decodeBlockchain(i){return w5s(i.result)}static decodeBroadcastTxSync(i){return Q5s(i.result)}static decodeBroadcastTxAsync(i){return e.decodeBroadcastTxSync(i)}static decodeBroadcastTxCommit(i){return k5s(i.result)}static decodeCommit(i){return O5s(i.result)}static decodeGenesis(i){return N5s((0,Ra.assertObject)(i.result.genesis))}static decodeHealth(){return null}static decodeNumUnconfirmedTxs(i){return G5s(i.result)}static decodeStatus(i){return T5s(i.result)}static decodeNewBlockEvent(i){return Njr(i.data.value.block)}static decodeNewBlockHeaderEvent(i){return Tvt(i.data.value.header)}static decodeTxEvent(i){return J5s(i.data.value.TxResult)}static decodeTx(i){return Ojr(i.result)}static decodeTxSearch(i){return F5s(i.result)}static decodeValidators(i){return H5s(i.result)}};mM.Responses=Jpn;Object.defineProperty(Ovt,"__esModule",{value:!0});Ovt.adaptor34=void 0;var uGr=Sfe,q5s=Nvt,K5s=mM;Ovt.adaptor34={params:q5s.Params,responses:K5s.Responses,hashTx:uGr.hashTx,hashBlock:uGr.hashBlock};var Y5s=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),V5s=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),z5s=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&Y5s(i,e,A);return V5s(i,e),i};Object.defineProperty(Pvt,"__esModule",{value:!0});Pvt.Tendermint34Client=void 0;var W5s=zfe,k3t=Cvt,fGr=Ovt,wp=z5s(Rvt),Hpn=class e{static connect(i){return Jt(this,null,function*(){let A;return typeof i=="object"?A=new k3t.HttpClient(i):A=i.startsWith("http://")||i.startsWith("https://")?new k3t.HttpClient(i):new k3t.WebsocketClient(i),yield this.detectVersion(A),e.create(A)})}static create(i){return Jt(this,null,function*(){return new e(i)})}static detectVersion(i){return Jt(this,null,function*(){let A=(0,W5s.createJsonRpcRequest)(wp.Method.Status),f=(yield i.execute(A)).result;if(!f||!f.node_info)throw new Error("Unrecognized format for status response");let l=f.node_info.version;if(typeof l!="string")throw new Error("Unrecognized version format: must be string");return l})}constructor(i){this.client=i,this.p=fGr.adaptor34.params,this.r=fGr.adaptor34.responses}disconnect(){this.client.disconnect()}abciInfo(){return Jt(this,null,function*(){let i={method:wp.Method.AbciInfo};return this.doCall(i,this.p.encodeAbciInfo,this.r.decodeAbciInfo)})}abciQuery(i){return Jt(this,null,function*(){let A={params:i,method:wp.Method.AbciQuery};return this.doCall(A,this.p.encodeAbciQuery,this.r.decodeAbciQuery)})}block(i){return Jt(this,null,function*(){let A={method:wp.Method.Block,params:{height:i}};return this.doCall(A,this.p.encodeBlock,this.r.decodeBlock)})}blockResults(i){return Jt(this,null,function*(){let A={method:wp.Method.BlockResults,params:{height:i}};return this.doCall(A,this.p.encodeBlockResults,this.r.decodeBlockResults)})}blockSearch(i){return Jt(this,null,function*(){let A={params:i,method:wp.Method.BlockSearch},c=yield this.doCall(A,this.p.encodeBlockSearch,this.r.decodeBlockSearch);return Yo(Di({},c),{blocks:[...c.blocks].sort((f,l)=>f.block.header.height-l.block.header.height)})})}blockSearchAll(i){return Jt(this,null,function*(){let A=i.page||1,c=[],f=!1;for(;!f;){let l=yield this.blockSearch(Yo(Di({},i),{page:A}));c.push(...l.blocks),c.length<l.totalCount?A++:f=!0}return c.sort((l,g)=>l.block.header.height-g.block.header.height),{totalCount:c.length,blocks:c}})}blockchain(i,A){return Jt(this,null,function*(){let c={method:wp.Method.Blockchain,params:{minHeight:i,maxHeight:A}};return this.doCall(c,this.p.encodeBlockchain,this.r.decodeBlockchain)})}broadcastTxSync(i){return Jt(this,null,function*(){let A={params:i,method:wp.Method.BroadcastTxSync};return this.doCall(A,this.p.encodeBroadcastTx,this.r.decodeBroadcastTxSync)})}broadcastTxAsync(i){return Jt(this,null,function*(){let A={params:i,method:wp.Method.BroadcastTxAsync};return this.doCall(A,this.p.encodeBroadcastTx,this.r.decodeBroadcastTxAsync)})}broadcastTxCommit(i){return Jt(this,null,function*(){let A={params:i,method:wp.Method.BroadcastTxCommit};return this.doCall(A,this.p.encodeBroadcastTx,this.r.decodeBroadcastTxCommit)})}commit(i){return Jt(this,null,function*(){let A={method:wp.Method.Commit,params:{height:i}};return this.doCall(A,this.p.encodeCommit,this.r.decodeCommit)})}genesis(){return Jt(this,null,function*(){let i={method:wp.Method.Genesis};return this.doCall(i,this.p.encodeGenesis,this.r.decodeGenesis)})}health(){return Jt(this,null,function*(){let i={method:wp.Method.Health};return this.doCall(i,this.p.encodeHealth,this.r.decodeHealth)})}numUnconfirmedTxs(){return Jt(this,null,function*(){let i={method:wp.Method.NumUnconfirmedTxs};return this.doCall(i,this.p.encodeNumUnconfirmedTxs,this.r.decodeNumUnconfirmedTxs)})}status(){return Jt(this,null,function*(){let i={method:wp.Method.Status};return this.doCall(i,this.p.encodeStatus,this.r.decodeStatus)})}subscribeNewBlock(){let i={method:wp.Method.Subscribe,query:{type:wp.SubscriptionEventType.NewBlock}};return this.subscribe(i,this.r.decodeNewBlockEvent)}subscribeNewBlockHeader(){let i={method:wp.Method.Subscribe,query:{type:wp.SubscriptionEventType.NewBlockHeader}};return this.subscribe(i,this.r.decodeNewBlockHeaderEvent)}subscribeTx(i){let A={method:wp.Method.Subscribe,query:{type:wp.SubscriptionEventType.Tx,raw:i}};return this.subscribe(A,this.r.decodeTxEvent)}tx(i){return Jt(this,null,function*(){let A={params:i,method:wp.Method.Tx};return this.doCall(A,this.p.encodeTx,this.r.decodeTx)})}txSearch(i){return Jt(this,null,function*(){let A={params:i,method:wp.Method.TxSearch};return this.doCall(A,this.p.encodeTxSearch,this.r.decodeTxSearch)})}txSearchAll(i){return Jt(this,null,function*(){let A=i.page||1,c=[],f=!1;for(;!f;){let l=yield this.txSearch(Yo(Di({},i),{page:A}));c.push(...l.txs),c.length<l.totalCount?A++:f=!0}return{totalCount:c.length,txs:c}})}validators(i){return Jt(this,null,function*(){let A={method:wp.Method.Validators,params:i};return this.doCall(A,this.p.encodeValidators,this.r.decodeValidators)})}validatorsAll(i){return Jt(this,null,function*(){let A=[],c=1,f=!1,l=i;for(;!f;){let g=yield this.validators({per_page:50,height:l,page:c});A.push(...g.validators),l=l||g.blockHeight,A.length<g.total?c++:f=!0}return{blockHeight:l!=null?l:0,count:A.length,total:A.length,validators:A}})}doCall(i,A,c){return Jt(this,null,function*(){let f=A(i),l=yield this.client.execute(f);return c(l)})}subscribe(i,A){if(!(0,k3t.instanceOfRpcStreamingClient)(this.client))throw new Error("This RPC client type cannot subscribe to events");let c=this.p.encodeSubscribe(i);return this.client.listen(c).map(l=>A(l))}};Pvt.Tendermint34Client=Hpn;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Tendermint34Client=e.VoteType=e.broadcastTxSyncSuccess=e.broadcastTxCommitSuccess=e.SubscriptionEventType=e.Method=void 0;var i=Rvt;Object.defineProperty(e,"Method",{enumerable:!0,get:function(){return i.Method}}),Object.defineProperty(e,"SubscriptionEventType",{enumerable:!0,get:function(){return i.SubscriptionEventType}});var A=Sjr;Object.defineProperty(e,"broadcastTxCommitSuccess",{enumerable:!0,get:function(){return A.broadcastTxCommitSuccess}}),Object.defineProperty(e,"broadcastTxSyncSuccess",{enumerable:!0,get:function(){return A.broadcastTxSyncSuccess}}),Object.defineProperty(e,"VoteType",{enumerable:!0,get:function(){return A.VoteType}});var c=Pvt;Object.defineProperty(e,"Tendermint34Client",{enumerable:!0,get:function(){return c.Tendermint34Client}})})(WLe);var _Et={},Uvt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.buildQuery=e.SubscriptionEventType=e.Method=void 0,function(A){A.AbciInfo="abci_info",A.AbciQuery="abci_query",A.Block="block",A.Blockchain="blockchain",A.BlockResults="block_results",A.BlockSearch="block_search",A.BroadcastTxAsync="broadcast_tx_async",A.BroadcastTxSync="broadcast_tx_sync",A.BroadcastTxCommit="broadcast_tx_commit",A.Commit="commit",A.Genesis="genesis",A.Health="health",A.NumUnconfirmedTxs="num_unconfirmed_txs",A.Status="status",A.Subscribe="subscribe",A.Tx="tx",A.TxSearch="tx_search",A.Validators="validators",A.Unsubscribe="unsubscribe"}(e.Method||(e.Method={})),function(A){A.NewBlock="NewBlock",A.NewBlockHeader="NewBlockHeader",A.Tx="Tx"}(e.SubscriptionEventType||(e.SubscriptionEventType={}));function i(A){let f=(A.tags?A.tags:[]).map(g=>`${g.key}='${g.value}'`),l=A.raw?[A.raw]:[];return[...f,...l].join(" AND ")}e.buildQuery=i})(Uvt);var Mjr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.VoteType=e.broadcastTxCommitSuccess=e.broadcastTxSyncSuccess=void 0;function i(c){return c.code===0}e.broadcastTxSyncSuccess=i;function A(c){return c.checkTx.code===0&&!!c.deliverTx&&c.deliverTx.code===0}e.broadcastTxCommitSuccess=A,function(c){c[c.PreVote=1]="PreVote",c[c.PreCommit=2]="PreCommit"}(e.VoteType||(e.VoteType={}))})(Mjr);var Fvt={},Jvt={},wfe={},G2={};Object.defineProperty(G2,"__esModule",{value:!0});G2.encodeBlockId=G2.encodeVersion=G2.encodeBytes=G2.encodeTime=G2.encodeUvarint=G2.encodeString=G2.dictionaryToStringMap=G2.may=G2.assertNotEmpty=G2.assertObject=G2.assertArray=G2.assertNumber=G2.assertString=G2.assertBoolean=G2.assertSet=void 0;var Z5s=K2;function Zfe(e){if(e===void 0)throw new Error("Value must not be undefined");if(e===null)throw new Error("Value must not be null");return e}G2.assertSet=Zfe;function X5s(e){if(Zfe(e),typeof e!="boolean")throw new Error("Value must be a boolean");return e}G2.assertBoolean=X5s;function $5s(e){if(Zfe(e),typeof e!="string")throw new Error("Value must be a string");return e}G2.assertString=$5s;function j5s(e){if(Zfe(e),typeof e!="number")throw new Error("Value must be a number");return e}G2.assertNumber=j5s;function eQs(e){if(Zfe(e),!Array.isArray(e))throw new Error("Value must be a an array");return e}G2.assertArray=eQs;function tQs(e){if(Zfe(e),typeof e!="object")throw new Error("Value must be an object");if(Object.prototype.toString.call(e)!=="[object Object]")throw new Error("Value must be a simple object");return e}G2.assertObject=tQs;function nQs(e){if(Zfe(e),typeof e=="number"&&e===0)throw new Error("must provide a non-zero value");if(e.length===0)throw new Error("must provide a non-empty value");return e}G2.assertNotEmpty=nQs;function rQs(e,i){return i==null?void 0:e(i)}G2.may=rQs;function iQs(e){let i=new Map;for(let A of Object.keys(e)){let c=e[A];if(typeof c!="string")throw new Error("Found dictionary value of type other than string");i.set(A,c)}return i}G2.dictionaryToStringMap=iQs;function oQs(e){let i=(0,Z5s.toUtf8)(e);return Uint8Array.from([i.length,...i])}G2.encodeString=oQs;function ISe(e){return e>=128?Uint8Array.from([e&255|128,...ISe(e>>7)]):Uint8Array.from([e&255])}G2.encodeUvarint=ISe;function aQs(e){let i=e.getTime(),A=Math.floor(i/1e3),c=A?[8,...ISe(A)]:new Uint8Array,f=(e.nanoseconds||0)+i%1e3*1e6,l=f?[16,...ISe(f)]:new Uint8Array;return Uint8Array.from([...c,...l])}G2.encodeTime=aQs;function sQs(e){if(e.length>=128)throw new Error("Not implemented for byte arrays of length 128 or more");return e.length?Uint8Array.from([e.length,...e]):new Uint8Array}G2.encodeBytes=sQs;function AQs(e){let i=e.block?Uint8Array.from([8,...ISe(e.block)]):new Uint8Array,A=e.app?Uint8Array.from([16,...ISe(e.app)]):new Uint8Array;return Uint8Array.from([...i,...A])}G2.encodeVersion=AQs;function dQs(e){return Uint8Array.from([10,e.hash.length,...e.hash,18,e.parts.hash.length+4,8,e.parts.total,18,e.parts.hash.length,...e.parts.hash])}G2.encodeBlockId=dQs;Object.defineProperty(wfe,"__esModule",{value:!0});wfe.hashBlock=wfe.hashTx=void 0;var UIn=bD,zk=G2;function cQs(e){return(0,UIn.sha256)(e)}wfe.hashTx=cQs;function uQs(e){if(e<1)throw new Error("Cannot split an empty tree");let i=hi(2,Math.floor(Math.log2(e)));return i<e?i:i/2}function fQs(e){let i=new UIn.Sha256(Uint8Array.from([0]));return i.update(e),i.digest()}function lQs(e,i){let A=new UIn.Sha256(Uint8Array.from([1]));return A.update(e),A.update(i),A.digest()}function Lpn(e){switch(e.length){case 0:throw new Error("Cannot hash empty tree");case 1:return fQs(e[0]);default:{let i=uQs(e.length),A=Lpn(e.slice(0,i)),c=Lpn(e.slice(i));return lQs(A,c)}}}function hQs(e){if(!e.lastBlockId)throw new Error("Hashing a block header with no last block ID (i.e. header at height 1) is not supported. If you need this, contributions are welcome. Please add documentation and test vectors for this case.");let i=[(0,zk.encodeVersion)(e.version),(0,zk.encodeString)(e.chainId),(0,zk.encodeUvarint)(e.height),(0,zk.encodeTime)(e.time),(0,zk.encodeBlockId)(e.lastBlockId),(0,zk.encodeBytes)(e.lastCommitHash),(0,zk.encodeBytes)(e.dataHash),(0,zk.encodeBytes)(e.validatorsHash),(0,zk.encodeBytes)(e.nextValidatorsHash),(0,zk.encodeBytes)(e.consensusHash),(0,zk.encodeBytes)(e.appHash),(0,zk.encodeBytes)(e.lastResultsHash),(0,zk.encodeBytes)(e.evidenceHash),(0,zk.encodeBytes)(e.proposerAddress)];return Lpn(i)}wfe.hashBlock=hQs;var Hvt={},gQs=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),pQs=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),yQs=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&gQs(i,e,A);return pQs(i,e),i};Object.defineProperty(Hvt,"__esModule",{value:!0});Hvt.Params=void 0;var FIn=K2,FF=TF,SB=zfe,mD=G2,mQs=yQs(Uvt);function rhn(e){return{height:(0,mD.may)(FF.smallIntToApi,e.height)}}function IQs(e){return{minHeight:(0,mD.may)(FF.smallIntToApi,e.minHeight),maxHeight:(0,mD.may)(FF.smallIntToApi,e.maxHeight)}}function CQs(e){return{query:e.query,page:(0,mD.may)(FF.smallIntToApi,e.page),per_page:(0,mD.may)(FF.smallIntToApi,e.per_page),order_by:e.order_by}}function _Qs(e){return{path:(0,mD.assertNotEmpty)(e.path),data:(0,FIn.toHex)(e.data),height:(0,mD.may)(FF.smallIntToApi,e.height),prove:e.prove}}function EQs(e){return{tx:(0,FIn.toBase64)((0,mD.assertNotEmpty)(e.tx))}}function BQs(e){return{hash:(0,FIn.toBase64)((0,mD.assertNotEmpty)(e.hash)),prove:e.prove}}function vQs(e){return{query:e.query,prove:e.prove,page:(0,mD.may)(FF.smallIntToApi,e.page),per_page:(0,mD.may)(FF.smallIntToApi,e.per_page),order_by:e.order_by}}function bQs(e){return{height:(0,mD.may)(FF.smallIntToApi,e.height),page:(0,mD.may)(FF.smallIntToApi,e.page),per_page:(0,mD.may)(FF.smallIntToApi,e.per_page)}}var Gpn=class{static encodeAbciInfo(i){return(0,SB.createJsonRpcRequest)(i.method)}static encodeAbciQuery(i){return(0,SB.createJsonRpcRequest)(i.method,_Qs(i.params))}static encodeBlock(i){return(0,SB.createJsonRpcRequest)(i.method,rhn(i.params))}static encodeBlockchain(i){return(0,SB.createJsonRpcRequest)(i.method,IQs(i.params))}static encodeBlockResults(i){return(0,SB.createJsonRpcRequest)(i.method,rhn(i.params))}static encodeBlockSearch(i){return(0,SB.createJsonRpcRequest)(i.method,CQs(i.params))}static encodeBroadcastTx(i){return(0,SB.createJsonRpcRequest)(i.method,EQs(i.params))}static encodeCommit(i){return(0,SB.createJsonRpcRequest)(i.method,rhn(i.params))}static encodeGenesis(i){return(0,SB.createJsonRpcRequest)(i.method)}static encodeHealth(i){return(0,SB.createJsonRpcRequest)(i.method)}static encodeNumUnconfirmedTxs(i){return(0,SB.createJsonRpcRequest)(i.method)}static encodeStatus(i){return(0,SB.createJsonRpcRequest)(i.method)}static encodeSubscribe(i){let A={key:"tm.event",value:i.query.type},c=mQs.buildQuery({tags:[A],raw:i.query.raw});return(0,SB.createJsonRpcRequest)("subscribe",{query:c})}static encodeTx(i){return(0,SB.createJsonRpcRequest)(i.method,BQs(i.params))}static encodeTxSearch(i){return(0,SB.createJsonRpcRequest)(i.method,vQs(i.params))}static encodeValidators(i){return(0,SB.createJsonRpcRequest)(i.method,bQs(i.params))}};Hvt.Params=Gpn;var IM={};Object.defineProperty(IM,"__esModule",{value:!0});IM.Responses=IM.decodeValidatorInfo=IM.decodeValidatorGenesis=IM.decodeValidatorUpdate=IM.decodeEvent=void 0;var nl=K2,Tjr=O3,yGe=dD,gf=TF,SQs=xvt,Ka=G2,wQs=wfe;function QQs(e){return{data:e.data,lastBlockHeight:(0,Ka.may)(gf.apiToSmallInt,e.last_block_height),lastBlockAppHash:(0,Ka.may)(nl.fromBase64,e.last_block_app_hash)}}function kQs(e){return{ops:e.ops.map(i=>({type:i.type,key:(0,nl.fromBase64)(i.key),data:(0,nl.fromBase64)(i.data)}))}}function DQs(e){var i,A,c,f;return{key:(0,nl.fromBase64)((0,Ka.assertString)((i=e.key)!=null?i:"")),value:(0,nl.fromBase64)((0,Ka.assertString)((A=e.value)!=null?A:"")),proof:(0,Ka.may)(kQs,e.proofOps),height:(0,Ka.may)(gf.apiToSmallInt,e.height),code:(0,Ka.may)(gf.apiToSmallInt,e.code),codespace:(0,Ka.assertString)((c=e.codespace)!=null?c:""),index:(0,Ka.may)(gf.apiToSmallInt,e.index),log:e.log,info:(0,Ka.assertString)((f=e.info)!=null?f:"")}}function RQs(e){var i;return{key:(0,Ka.assertNotEmpty)(e.key),value:(i=e.value)!=null?i:""}}function PQs(e){return(0,Ka.assertArray)(e).map(RQs)}function Ujr(e){return{type:e.type,attributes:e.attributes?PQs(e.attributes):[]}}IM.decodeEvent=Ujr;function qpn(e){return(0,Ka.assertArray)(e).map(Ujr)}function CSe(e){var i,A,c;return{code:(0,gf.apiToSmallInt)((0,Ka.assertNumber)((i=e.code)!=null?i:0)),codespace:e.codespace,log:e.log,data:(0,Ka.may)(nl.fromBase64,e.data),events:e.events?qpn(e.events):[],gasWanted:(0,gf.apiToSmallInt)((A=e.gas_wanted)!=null?A:"0"),gasUsed:(0,gf.apiToSmallInt)((c=e.gas_used)!=null?c:"0")}}function JIn(e){if("Sum"in e){let[[i,A]]=Object.entries(e.Sum.value);return(0,Tjr.assert)(i==="ed25519"||i==="secp256k1",`unknown pubkey type: ${i}`),{algorithm:i,data:(0,nl.fromBase64)((0,Ka.assertNotEmpty)(A))}}else switch(e.type){case"tendermint/PubKeyEd25519":return{algorithm:"ed25519",data:(0,nl.fromBase64)((0,Ka.assertNotEmpty)(e.value))};case"tendermint/PubKeySecp256k1":return{algorithm:"secp256k1",data:(0,nl.fromBase64)((0,Ka.assertNotEmpty)(e.value))};default:throw new Error(`unknown pubkey type: ${e.type}`)}}function OQs(e){return{maxBytes:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.max_bytes)),maxGas:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.max_gas))}}function NQs(e){return{maxAgeNumBlocks:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.max_age_num_blocks)),maxAgeDuration:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.max_age_duration))}}function Fjr(e){return{block:OQs((0,Ka.assertObject)(e.block)),evidence:NQs((0,Ka.assertObject)(e.evidence))}}function Jjr(e){var i;return{pubkey:JIn((0,Ka.assertObject)(e.pub_key)),votingPower:(0,gf.apiToBigInt)((i=e.power)!=null?i:"0")}}IM.decodeValidatorUpdate=Jjr;function xQs(e){return{height:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.height)),results:(e.txs_results||[]).map(CSe),validatorUpdates:(e.validator_updates||[]).map(Jjr),consensusUpdates:(0,Ka.may)(Fjr,e.consensus_param_updates),beginBlockEvents:qpn(e.begin_block_events||[]),endBlockEvents:qpn(e.end_block_events||[])}}function Lvt(e){return{hash:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.hash)),parts:{total:(0,Ka.assertNotEmpty)(e.parts.total),hash:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.parts.hash))}}}function MQs(e){var i;return{block:(0,gf.apiToSmallInt)(e.block),app:(0,gf.apiToSmallInt)((i=e.app)!=null?i:0)}}function Gvt(e){return{version:MQs(e.version),chainId:(0,Ka.assertNotEmpty)(e.chain_id),height:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.height)),time:(0,yGe.fromRfc3339WithNanoseconds)((0,Ka.assertNotEmpty)(e.time)),lastBlockId:e.last_block_id.hash?Lvt(e.last_block_id):null,lastCommitHash:(0,nl.fromHex)((0,Ka.assertSet)(e.last_commit_hash)),dataHash:(0,nl.fromHex)((0,Ka.assertSet)(e.data_hash)),validatorsHash:(0,nl.fromHex)((0,Ka.assertSet)(e.validators_hash)),nextValidatorsHash:(0,nl.fromHex)((0,Ka.assertSet)(e.next_validators_hash)),consensusHash:(0,nl.fromHex)((0,Ka.assertSet)(e.consensus_hash)),appHash:(0,nl.fromHex)((0,Ka.assertSet)(e.app_hash)),lastResultsHash:(0,nl.fromHex)((0,Ka.assertSet)(e.last_results_hash)),evidenceHash:(0,nl.fromHex)((0,Ka.assertSet)(e.evidence_hash)),proposerAddress:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.proposer_address))}}function TQs(e){return{blockId:Lvt(e.block_id),blockSize:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.block_size)),header:Gvt(e.header),numTxs:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.num_txs))}}function UQs(e){return{lastHeight:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.last_height)),blockMetas:(0,Ka.assertArray)(e.block_metas).map(TQs)}}function FQs(e){return Yo(Di({},CSe(e)),{hash:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.hash))})}function JQs(e){return{height:(0,gf.apiToSmallInt)(e.height),hash:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.hash)),checkTx:CSe((0,Ka.assertObject)(e.check_tx)),deliverTx:(0,Ka.may)(CSe,e.deliver_tx)}}function HQs(e){return(0,Tjr.assert)(e in SQs.BlockIdFlag),e}function LQs(e){return e&&!e.startsWith("0001-01-01")?(0,yGe.fromRfc3339WithNanoseconds)(e):void 0}function GQs(e){return{blockIdFlag:HQs(e.block_id_flag),validatorAddress:e.validator_address?(0,nl.fromHex)(e.validator_address):void 0,timestamp:LQs(e.timestamp),signature:e.signature?(0,nl.fromBase64)(e.signature):void 0}}function Hjr(e){return{blockId:Lvt((0,Ka.assertObject)(e.block_id)),height:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.height)),round:(0,gf.apiToSmallInt)(e.round),signatures:(0,Ka.assertArray)(e.signatures).map(GQs)}}function qQs(e){return{canonical:(0,Ka.assertBoolean)(e.canonical),header:Gvt(e.signed_header.header),commit:Hjr(e.signed_header.commit)}}function Ljr(e){return{address:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.address)),pubkey:JIn((0,Ka.assertObject)(e.pub_key)),votingPower:(0,gf.apiToBigInt)((0,Ka.assertNotEmpty)(e.power))}}IM.decodeValidatorGenesis=Ljr;function KQs(e){return{genesisTime:(0,yGe.fromRfc3339WithNanoseconds)((0,Ka.assertNotEmpty)(e.genesis_time)),chainId:(0,Ka.assertNotEmpty)(e.chain_id),consensusParams:Fjr(e.consensus_params),validators:e.validators?(0,Ka.assertArray)(e.validators).map(Ljr):[],appHash:(0,nl.fromHex)((0,Ka.assertSet)(e.app_hash)),appState:e.app_state}}function HIn(e){return{pubkey:JIn((0,Ka.assertObject)(e.pub_key)),votingPower:(0,gf.apiToBigInt)((0,Ka.assertNotEmpty)(e.voting_power)),address:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.address)),proposerPriority:e.proposer_priority?(0,gf.apiToSmallInt)(e.proposer_priority):void 0}}IM.decodeValidatorInfo=HIn;function YQs(e){return{id:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.id)),listenAddr:(0,Ka.assertNotEmpty)(e.listen_addr),network:(0,Ka.assertNotEmpty)(e.network),version:(0,Ka.assertString)(e.version),channels:(0,Ka.assertNotEmpty)(e.channels),moniker:(0,Ka.assertNotEmpty)(e.moniker),other:(0,Ka.dictionaryToStringMap)(e.other),protocolVersion:{app:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.protocol_version.app)),block:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.protocol_version.block)),p2p:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.protocol_version.p2p))}}}function VQs(e){let i=e.earliest_block_height?(0,gf.apiToSmallInt)(e.earliest_block_height):void 0,A=e.earliest_block_time?(0,yGe.fromRfc3339WithNanoseconds)(e.earliest_block_time):void 0;return{earliestAppHash:e.earliest_app_hash?(0,nl.fromHex)(e.earliest_app_hash):void 0,earliestBlockHash:e.earliest_block_hash?(0,nl.fromHex)(e.earliest_block_hash):void 0,earliestBlockHeight:i||void 0,earliestBlockTime:A!=null&&A.getTime()?A:void 0,latestBlockHash:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.latest_block_hash)),latestAppHash:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.latest_app_hash)),latestBlockTime:(0,yGe.fromRfc3339WithNanoseconds)((0,Ka.assertNotEmpty)(e.latest_block_time)),latestBlockHeight:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.latest_block_height)),catchingUp:(0,Ka.assertBoolean)(e.catching_up)}}function zQs(e){return{nodeInfo:YQs(e.node_info),syncInfo:VQs(e.sync_info),validatorInfo:HIn(e.validator_info)}}function WQs(e){return{data:(0,nl.fromBase64)((0,Ka.assertNotEmpty)(e.data)),rootHash:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.root_hash)),proof:{total:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.proof.total)),index:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.proof.index)),leafHash:(0,nl.fromBase64)((0,Ka.assertNotEmpty)(e.proof.leaf_hash)),aunts:(0,Ka.assertArray)(e.proof.aunts).map(nl.fromBase64)}}}function Gjr(e){return{tx:(0,nl.fromBase64)((0,Ka.assertNotEmpty)(e.tx)),result:CSe((0,Ka.assertObject)(e.tx_result)),height:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.height)),index:(0,gf.apiToSmallInt)((0,Ka.assertNumber)(e.index)),hash:(0,nl.fromHex)((0,Ka.assertNotEmpty)(e.hash)),proof:(0,Ka.may)(WQs,e.proof)}}function ZQs(e){return{totalCount:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.total_count)),txs:(0,Ka.assertArray)(e.txs).map(Gjr)}}function XQs(e){let i=(0,nl.fromBase64)((0,Ka.assertNotEmpty)(e.tx));return{tx:i,hash:(0,wQs.hashTx)(i),result:CSe(e.result),height:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.height))}}function $Qs(e){return{blockHeight:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.block_height)),validators:(0,Ka.assertArray)(e.validators).map(HIn),count:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.count)),total:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.total))}}function qjr(e){var i,A;return{header:Gvt((0,Ka.assertObject)(e.header)),lastCommit:e.last_commit.block_id.hash?Hjr((0,Ka.assertObject)(e.last_commit)):null,txs:e.data.txs?(0,Ka.assertArray)(e.data.txs).map(nl.fromBase64):[],evidence:(A=(i=e.evidence)==null?void 0:i.evidence)!=null?A:[]}}function Kjr(e){return{blockId:Lvt(e.block_id),block:qjr(e.block)}}function jQs(e){return{totalCount:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.total_count)),blocks:(0,Ka.assertArray)(e.blocks).map(Kjr)}}function eks(e){return{total:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.total)),totalBytes:(0,gf.apiToSmallInt)((0,Ka.assertNotEmpty)(e.total_bytes))}}var Kpn=class e{static decodeAbciInfo(i){return QQs((0,Ka.assertObject)(i.result.response))}static decodeAbciQuery(i){return DQs((0,Ka.assertObject)(i.result.response))}static decodeBlock(i){return Kjr(i.result)}static decodeBlockResults(i){return xQs(i.result)}static decodeBlockSearch(i){return jQs(i.result)}static decodeBlockchain(i){return UQs(i.result)}static decodeBroadcastTxSync(i){return FQs(i.result)}static decodeBroadcastTxAsync(i){return e.decodeBroadcastTxSync(i)}static decodeBroadcastTxCommit(i){return JQs(i.result)}static decodeCommit(i){return qQs(i.result)}static decodeGenesis(i){return KQs((0,Ka.assertObject)(i.result.genesis))}static decodeHealth(){return null}static decodeNumUnconfirmedTxs(i){return eks(i.result)}static decodeStatus(i){return zQs(i.result)}static decodeNewBlockEvent(i){return qjr(i.data.value.block)}static decodeNewBlockHeaderEvent(i){return Gvt(i.data.value.header)}static decodeTxEvent(i){return XQs(i.data.value.TxResult)}static decodeTx(i){return Gjr(i.result)}static decodeTxSearch(i){return ZQs(i.result)}static decodeValidators(i){return $Qs(i.result)}};IM.Responses=Kpn;Object.defineProperty(Jvt,"__esModule",{value:!0});Jvt.adaptor37=void 0;var lGr=wfe,tks=Hvt,nks=IM;Jvt.adaptor37={params:tks.Params,responses:nks.Responses,hashTx:lGr.hashTx,hashBlock:lGr.hashBlock};var rks=Fr&&Fr.__createBinding||(Object.create?function(e,i,A,c){c===void 0&&(c=A);var f=Object.getOwnPropertyDescriptor(i,A);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[A]}}),Object.defineProperty(e,c,f)}:function(e,i,A,c){c===void 0&&(c=A),e[c]=i[A]}),iks=Fr&&Fr.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),oks=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var A in e)A!=="default"&&Object.prototype.hasOwnProperty.call(e,A)&&rks(i,e,A);return iks(i,e),i};Object.defineProperty(Fvt,"__esModule",{value:!0});Fvt.Tendermint37Client=void 0;var aks=zfe,D3t=Cvt,hGr=Jvt,Qp=oks(Uvt),Ypn=class e{static connect(i){return Jt(this,null,function*(){let A;return typeof i=="object"?A=new D3t.HttpClient(i):A=i.startsWith("http://")||i.startsWith("https://")?new D3t.HttpClient(i):new D3t.WebsocketClient(i),yield this.detectVersion(A),e.create(A)})}static create(i){return Jt(this,null,function*(){return new e(i)})}static detectVersion(i){return Jt(this,null,function*(){let A=(0,aks.createJsonRpcRequest)(Qp.Method.Status),f=(yield i.execute(A)).result;if(!f||!f.node_info)throw new Error("Unrecognized format for status response");let l=f.node_info.version;if(typeof l!="string")throw new Error("Unrecognized version format: must be string");return l})}constructor(i){this.client=i,this.p=hGr.adaptor37.params,this.r=hGr.adaptor37.responses}disconnect(){this.client.disconnect()}abciInfo(){return Jt(this,null,function*(){let i={method:Qp.Method.AbciInfo};return this.doCall(i,this.p.encodeAbciInfo,this.r.decodeAbciInfo)})}abciQuery(i){return Jt(this,null,function*(){let A={params:i,method:Qp.Method.AbciQuery};return this.doCall(A,this.p.encodeAbciQuery,this.r.decodeAbciQuery)})}block(i){return Jt(this,null,function*(){let A={method:Qp.Method.Block,params:{height:i}};return this.doCall(A,this.p.encodeBlock,this.r.decodeBlock)})}blockResults(i){return Jt(this,null,function*(){let A={method:Qp.Method.BlockResults,params:{height:i}};return this.doCall(A,this.p.encodeBlockResults,this.r.decodeBlockResults)})}blockSearch(i){return Jt(this,null,function*(){let A={params:i,method:Qp.Method.BlockSearch},c=yield this.doCall(A,this.p.encodeBlockSearch,this.r.decodeBlockSearch);return Yo(Di({},c),{blocks:[...c.blocks].sort((f,l)=>f.block.header.height-l.block.header.height)})})}blockSearchAll(i){return Jt(this,null,function*(){let A=i.page||1,c=[],f=!1;for(;!f;){let l=yield this.blockSearch(Yo(Di({},i),{page:A}));c.push(...l.blocks),c.length<l.totalCount?A++:f=!0}return c.sort((l,g)=>l.block.header.height-g.block.header.height),{totalCount:c.length,blocks:c}})}blockchain(i,A){return Jt(this,null,function*(){let c={method:Qp.Method.Blockchain,params:{minHeight:i,maxHeight:A}};return this.doCall(c,this.p.encodeBlockchain,this.r.decodeBlockchain)})}broadcastTxSync(i){return Jt(this,null,function*(){let A={params:i,method:Qp.Method.BroadcastTxSync};return this.doCall(A,this.p.encodeBroadcastTx,this.r.decodeBroadcastTxSync)})}broadcastTxAsync(i){return Jt(this,null,function*(){let A={params:i,method:Qp.Method.BroadcastTxAsync};return this.doCall(A,this.p.encodeBroadcastTx,this.r.decodeBroadcastTxAsync)})}broadcastTxCommit(i){return Jt(this,null,function*(){let A={params:i,method:Qp.Method.BroadcastTxCommit};return this.doCall(A,this.p.encodeBroadcastTx,this.r.decodeBroadcastTxCommit)})}commit(i){return Jt(this,null,function*(){let A={method:Qp.Method.Commit,params:{height:i}};return this.doCall(A,this.p.encodeCommit,this.r.decodeCommit)})}genesis(){return Jt(this,null,function*(){let i={method:Qp.Method.Genesis};return this.doCall(i,this.p.encodeGenesis,this.r.decodeGenesis)})}health(){return Jt(this,null,function*(){let i={method:Qp.Method.Health};return this.doCall(i,this.p.encodeHealth,this.r.decodeHealth)})}numUnconfirmedTxs(){return Jt(this,null,function*(){let i={method:Qp.Method.NumUnconfirmedTxs};return this.doCall(i,this.p.encodeNumUnconfirmedTxs,this.r.decodeNumUnconfirmedTxs)})}status(){return Jt(this,null,function*(){let i={method:Qp.Method.Status};return this.doCall(i,this.p.encodeStatus,this.r.decodeStatus)})}subscribeNewBlock(){let i={method:Qp.Method.Subscribe,query:{type:Qp.SubscriptionEventType.NewBlock}};return this.subscribe(i,this.r.decodeNewBlockEvent)}subscribeNewBlockHeader(){let i={method:Qp.Method.Subscribe,query:{type:Qp.SubscriptionEventType.NewBlockHeader}};return this.subscribe(i,this.r.decodeNewBlockHeaderEvent)}subscribeTx(i){let A={method:Qp.Method.Subscribe,query:{type:Qp.SubscriptionEventType.Tx,raw:i}};return this.subscribe(A,this.r.decodeTxEvent)}tx(i){return Jt(this,null,function*(){let A={params:i,method:Qp.Method.Tx};return this.doCall(A,this.p.encodeTx,this.r.decodeTx)})}txSearch(i){return Jt(this,null,function*(){let A={params:i,method:Qp.Method.TxSearch};return this.doCall(A,this.p.encodeTxSearch,this.r.decodeTxSearch)})}txSearchAll(i){return Jt(this,null,function*(){let A=i.page||1,c=[],f=!1;for(;!f;){let l=yield this.txSearch(Yo(Di({},i),{page:A}));c.push(...l.txs),c.length<l.totalCount?A++:f=!0}return{totalCount:c.length,txs:c}})}validators(i){return Jt(this,null,function*(){let A={method:Qp.Method.Validators,params:i};return this.doCall(A,this.p.encodeValidators,this.r.decodeValidators)})}validatorsAll(i){return Jt(this,null,function*(){let A=[],c=1,f=!1,l=i;for(;!f;){let g=yield this.validators({per_page:50,height:l,page:c});A.push(...g.validators),l=l||g.blockHeight,A.length<g.total?c++:f=!0}return{blockHeight:l!=null?l:0,count:A.length,total:A.length,validators:A}})}doCall(i,A,c){return Jt(this,null,function*(){let f=A(i),l=yield this.client.execute(f);return c(l)})}subscribe(i,A){if(!(0,D3t.instanceOfRpcStreamingClient)(this.client))throw new Error("This RPC client type cannot subscribe to events");let c=this.p.encodeSubscribe(i);return this.client.listen(c).map(l=>A(l))}};Fvt.Tendermint37Client=Ypn;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Tendermint37Client=e.VoteType=e.broadcastTxSyncSuccess=e.broadcastTxCommitSuccess=e.SubscriptionEventType=e.Method=void 0;var i=Uvt;Object.defineProperty(e,"Method",{enumerable:!0,get:function(){return i.Method}}),Object.defineProperty(e,"SubscriptionEventType",{enumerable:!0,get:function(){return i.SubscriptionEventType}});var A=Mjr;Object.defineProperty(e,"broadcastTxCommitSuccess",{enumerable:!0,get:function(){return A.broadcastTxCommitSuccess}}),Object.defineProperty(e,"broadcastTxSyncSuccess",{enumerable:!0,get:function(){return A.broadcastTxSyncSuccess}}),Object.defineProperty(e,"VoteType",{enumerable:!0,get:function(){return A.VoteType}});var c=Fvt;Object.defineProperty(e,"Tendermint37Client",{enumerable:!0,get:function(){return c.Tendermint37Client}})})(_Et);var _Se={};Object.defineProperty(_Se,"__esModule",{value:!0});_Se.isTendermint37Client=_Se.isTendermint34Client=void 0;var sks=WLe,Aks=_Et;function dks(e){return e instanceof sks.Tendermint34Client}_Se.isTendermint34Client=dks;function cks(e){return e instanceof Aks.Tendermint37Client}_Se.isTendermint37Client=cks;(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(v,ne,Z,R){R===void 0&&(R=Z);var M=Object.getOwnPropertyDescriptor(ne,Z);(!M||("get"in M?!ne.__esModule:M.writable||M.configurable))&&(M={enumerable:!0,get:function(){return ne[Z]}}),Object.defineProperty(v,R,M)}:function(v,ne,Z,R){R===void 0&&(R=Z),v[R]=ne[Z]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(v,ne){Object.defineProperty(v,"default",{enumerable:!0,value:ne})}:function(v,ne){v.default=ne}),c=Fr&&Fr.__importStar||function(v){if(v&&v.__esModule)return v;var ne={};if(v!=null)for(var Z in v)Z!=="default"&&Object.prototype.hasOwnProperty.call(v,Z)&&i(ne,v,Z);return A(ne,v),ne};Object.defineProperty(e,"__esModule",{value:!0}),e.BlockIdFlag=e.isTendermint37Client=e.isTendermint34Client=e.Tendermint37Client=e.tendermint37=e.Tendermint34Client=e.tendermint34=e.VoteType=e.SubscriptionEventType=e.Method=e.broadcastTxSyncSuccess=e.broadcastTxCommitSuccess=e.WebsocketClient=e.HttpClient=e.HttpBatchClient=e.toSeconds=e.toRfc3339WithNanoseconds=e.fromSeconds=e.fromRfc3339WithNanoseconds=e.DateTime=e.rawSecp256k1PubkeyToRawAddress=e.rawEd25519PubkeyToRawAddress=e.pubkeyToRawAddress=e.pubkeyToAddress=void 0;var f=IK;Object.defineProperty(e,"pubkeyToAddress",{enumerable:!0,get:function(){return f.pubkeyToAddress}}),Object.defineProperty(e,"pubkeyToRawAddress",{enumerable:!0,get:function(){return f.pubkeyToRawAddress}}),Object.defineProperty(e,"rawEd25519PubkeyToRawAddress",{enumerable:!0,get:function(){return f.rawEd25519PubkeyToRawAddress}}),Object.defineProperty(e,"rawSecp256k1PubkeyToRawAddress",{enumerable:!0,get:function(){return f.rawSecp256k1PubkeyToRawAddress}});var l=dD;Object.defineProperty(e,"DateTime",{enumerable:!0,get:function(){return l.DateTime}}),Object.defineProperty(e,"fromRfc3339WithNanoseconds",{enumerable:!0,get:function(){return l.fromRfc3339WithNanoseconds}}),Object.defineProperty(e,"fromSeconds",{enumerable:!0,get:function(){return l.fromSeconds}}),Object.defineProperty(e,"toRfc3339WithNanoseconds",{enumerable:!0,get:function(){return l.toRfc3339WithNanoseconds}}),Object.defineProperty(e,"toSeconds",{enumerable:!0,get:function(){return l.toSeconds}});var g=Cvt;Object.defineProperty(e,"HttpBatchClient",{enumerable:!0,get:function(){return g.HttpBatchClient}}),Object.defineProperty(e,"HttpClient",{enumerable:!0,get:function(){return g.HttpClient}}),Object.defineProperty(e,"WebsocketClient",{enumerable:!0,get:function(){return g.WebsocketClient}});var w=WLe;Object.defineProperty(e,"broadcastTxCommitSuccess",{enumerable:!0,get:function(){return w.broadcastTxCommitSuccess}}),Object.defineProperty(e,"broadcastTxSyncSuccess",{enumerable:!0,get:function(){return w.broadcastTxSyncSuccess}}),Object.defineProperty(e,"Method",{enumerable:!0,get:function(){return w.Method}}),Object.defineProperty(e,"SubscriptionEventType",{enumerable:!0,get:function(){return w.SubscriptionEventType}}),Object.defineProperty(e,"VoteType",{enumerable:!0,get:function(){return w.VoteType}}),e.tendermint34=c(WLe);var N=WLe;Object.defineProperty(e,"Tendermint34Client",{enumerable:!0,get:function(){return N.Tendermint34Client}}),e.tendermint37=c(_Et);var F=_Et;Object.defineProperty(e,"Tendermint37Client",{enumerable:!0,get:function(){return F.Tendermint37Client}});var j=_Se;Object.defineProperty(e,"isTendermint34Client",{enumerable:!0,get:function(){return j.isTendermint34Client}}),Object.defineProperty(e,"isTendermint37Client",{enumerable:!0,get:function(){return j.isTendermint37Client}});var te=xvt;Object.defineProperty(e,"BlockIdFlag",{enumerable:!0,get:function(){return te.BlockIdFlag}})})(SIn);var hE={};Object.defineProperty(hE,"__esModule",{value:!0});hE.StargateClient=hE.BroadcastTxError=hE.assertIsDeliverTxFailure=hE.assertIsDeliverTxSuccess=hE.isDeliverTxSuccess=hE.isDeliverTxFailure=hE.TimeoutError=void 0;var uks=uoe,ihn=K2,gGr=EE,ohn=SIn,pGr=O3,fks=bIn,lks=zGe,hks=ZGe,R3t=gGe,gks=Rw,EEt=class extends Error{constructor(i,A){super(i),this.txId=A}};hE.TimeoutError=EEt;function LIn(e){return!!e.code}hE.isDeliverTxFailure=LIn;function Yjr(e){return!LIn(e)}hE.isDeliverTxSuccess=Yjr;function pks(e){if(LIn(e))throw new Error(`Error when broadcasting tx ${e.transactionHash} at height ${e.height}. Code: ${e.code}; Raw log: ${e.rawLog}`)}hE.assertIsDeliverTxSuccess=pks;function yks(e){if(Yjr(e))throw new Error(`Transaction ${e.transactionHash} did not fail at height ${e.height}. Code: ${e.code}; Raw log: ${e.rawLog}`)}hE.assertIsDeliverTxFailure=yks;var BEt=class extends Error{constructor(i,A,c){super(`Broadcasting transaction failed with code ${i} (codespace: ${A}). Log: ${c}`),this.code=i,this.codespace=A,this.log=c}};hE.BroadcastTxError=BEt;var Vpn=class e{static connect(c){return Jt(this,arguments,function*(i,A={}){let f,l=yield ohn.Tendermint37Client.connect(i);return(yield l.status()).nodeInfo.version.startsWith("0.37.")?f=l:(l.disconnect(),f=yield ohn.Tendermint34Client.connect(i)),e.create(f,A)})}static create(c){return Jt(this,arguments,function*(i,A={}){return new e(i,A)})}constructor(i,A){i&&(this.tmClient=i,this.queryClient=gks.QueryClient.withExtensions(i,R3t.setupAuthExtension,R3t.setupBankExtension,R3t.setupStakingExtension,R3t.setupTxExtension));let{accountParser:c=lks.accountFromAny}=A;this.accountParser=c}getTmClient(){return this.tmClient}forceGetTmClient(){if(!this.tmClient)throw new Error("Tendermint client not available. You cannot use online functionality in offline mode.");return this.tmClient}getQueryClient(){return this.queryClient}forceGetQueryClient(){if(!this.queryClient)throw new Error("Query client not available. You cannot use online functionality in offline mode.");return this.queryClient}getChainId(){return Jt(this,null,function*(){if(!this.chainId){let A=(yield this.forceGetTmClient().status()).nodeInfo.network;if(!A)throw new Error("Chain ID must not be empty");this.chainId=A}return this.chainId})}getHeight(){return Jt(this,null,function*(){return(yield this.forceGetTmClient().status()).syncInfo.latestBlockHeight})}getAccount(i){return Jt(this,null,function*(){try{let A=yield this.forceGetQueryClient().auth.account(i);return A?this.accountParser(A):null}catch(A){if(/rpc error: code = NotFound/i.test(A.toString()))return null;throw A}})}getSequence(i){return Jt(this,null,function*(){let A=yield this.getAccount(i);if(!A)throw new Error(`Account '${i}' does not exist on chain. Send some tokens there before trying to query sequence.`);return{accountNumber:A.accountNumber,sequence:A.sequence}})}getBlock(i){return Jt(this,null,function*(){let A=yield this.forceGetTmClient().block(i);return{id:(0,ihn.toHex)(A.blockId.hash).toUpperCase(),header:{version:{block:new gGr.Uint53(A.block.header.version.block).toString(),app:new gGr.Uint53(A.block.header.version.app).toString()},height:A.block.header.height,chainId:A.block.header.chainId,time:(0,ohn.toRfc3339WithNanoseconds)(A.block.header.time)},txs:A.block.txs}})}getBalance(i,A){return Jt(this,null,function*(){return this.forceGetQueryClient().bank.balance(i,A)})}getAllBalances(i){return Jt(this,null,function*(){return this.forceGetQueryClient().bank.allBalances(i)})}getBalanceStaked(i){return Jt(this,null,function*(){let A=[],c;do{let{delegationResponses:l,pagination:g}=yield this.forceGetQueryClient().staking.delegatorDelegations(i,c),w=l||[];A.push(...w),c=g==null?void 0:g.nextKey}while(c!==void 0&&c.length!==0);return A.reduce((l,g)=>((0,pGr.assert)(g.balance),l!==null?(0,uks.addCoins)(l,g.balance):g.balance),null)})}getDelegation(i,A){return Jt(this,null,function*(){var f;let c;try{c=(f=(yield this.forceGetQueryClient().staking.delegation(i,A)).delegationResponse)==null?void 0:f.balance}catch(l){if(!l.toString().includes("key not found"))throw l}return c||null})}getTx(i){return Jt(this,null,function*(){var c;return(c=(yield this.txsQuery(`tx.hash='${i}'`))[0])!=null?c:null})}searchTx(i){return Jt(this,null,function*(){let A;if(typeof i=="string")A=i;else if(Array.isArray(i))A=i.map(c=>`${c.key}='${c.value}'`).join(" AND ");else throw new Error("Got unsupported query type. See CosmJS 0.31 CHANGELOG for API breaking changes here.");return this.txsQuery(A)})}disconnect(){this.tmClient&&this.tmClient.disconnect()}broadcastTx(i,A=6e4,c=3e3){return Jt(this,null,function*(){let f=!1,l=setTimeout(()=>{f=!0},A),g=N=>Jt(this,null,function*(){if(f)throw new EEt(`Transaction with ID ${N} was submitted but was not yet found on the chain. You might want to check later. There was a wait of ${A/1e3} seconds.`,N);yield(0,pGr.sleep)(c);let F=yield this.getTx(N);return F?{code:F.code,height:F.height,txIndex:F.txIndex,events:F.events,rawLog:F.rawLog,transactionHash:N,msgResponses:F.msgResponses,gasUsed:F.gasUsed,gasWanted:F.gasWanted}:g(N)}),w=yield this.broadcastTxSync(i);return new Promise((N,F)=>g(w).then(j=>{clearTimeout(l),N(j)},j=>{clearTimeout(l),F(j)}))})}broadcastTxSync(i){return Jt(this,null,function*(){var f;let A=yield this.forceGetTmClient().broadcastTxSync({tx:i});return A.code?Promise.reject(new BEt(A.code,(f=A.codespace)!=null?f:"",A.log)):(0,ihn.toHex)(A.hash).toUpperCase()})}txsQuery(i){return Jt(this,null,function*(){return(yield this.forceGetTmClient().txSearchAll({query:i})).txs.map(c=>{var l;let f=fks.TxMsgData.decode((l=c.result.data)!=null?l:new Uint8Array);return{height:c.height,txIndex:c.index,hash:(0,ihn.toHex)(c.hash).toUpperCase(),code:c.result.code,events:c.result.events.map(hks.fromTendermintEvent),rawLog:c.result.log||"",tx:c.tx,msgResponses:f.msgResponses,gasUsed:c.result.gasUsed,gasWanted:c.result.gasWanted}})})}};hE.StargateClient=Vpn;(function(e){var i=Fr&&Fr.__importDefault||function(ee){return ee&&ee.__esModule?ee:{default:ee}};Object.defineProperty(e,"__esModule",{value:!0}),e.SigningStargateClient=e.createDefaultAminoConverters=e.defaultRegistryTypes=void 0;let A=uoe,c=K2,f=EE,l=MF,g=SIn,w=O3,N=gg,F=yIn,j=EIn,te=MSe,v=fW,ne=uvt,Z=i(qM),R=WGe,M=Bfe,U=gGe,E=gGe,Q=hE;e.defaultRegistryTypes=[["/cosmos.base.v1beta1.Coin",N.Coin],...U.authzTypes,...U.bankTypes,...U.distributionTypes,...U.feegrantTypes,...U.govTypes,...U.groupTypes,...U.stakingTypes,...U.ibcTypes,...U.vestingTypes];function H(){return Di(Di(Di(Di(Di(Di(Di(Di({},(0,E.createAuthzAminoConverters)()),(0,E.createBankAminoConverters)()),(0,E.createDistributionAminoConverters)()),(0,E.createGovAminoConverters)()),(0,E.createStakingAminoConverters)()),(0,E.createIbcAminoConverters)()),(0,E.createFeegrantAminoConverters)()),(0,E.createVestingAminoConverters)())}e.createDefaultAminoConverters=H;class re extends Q.StargateClient{static connectWithSigner(L,V){return Jt(this,arguments,function*(T,se,p={}){let K,m=yield g.Tendermint37Client.connect(T);return(yield m.status()).nodeInfo.version.startsWith("0.37.")?K=m:(m.disconnect(),K=yield g.Tendermint34Client.connect(T)),re.createWithSigner(K,se,p)})}static createWithSigner(L,V){return Jt(this,arguments,function*(T,se,p={}){return new re(T,se,p)})}static offline(p){return Jt(this,arguments,function*(T,se={}){return new re(void 0,T,se)})}constructor(T,se,p){super(T,p);let{registry:L=new l.Registry(e.defaultRegistryTypes),aminoTypes:V=new R.AminoTypes(H())}=p;this.registry=L,this.aminoTypes=V,this.signer=se,this.broadcastTimeoutMs=p.broadcastTimeoutMs,this.broadcastPollIntervalMs=p.broadcastPollIntervalMs,this.gasPrice=p.gasPrice}simulate(T,se,p){return Jt(this,null,function*(){let L=se.map(_=>this.registry.encodeAsAny(_)),V=(yield this.signer.getAccounts()).find(_=>_.address===T);if(!V)throw new Error("Failed to retrieve account from signer");let K=(0,A.encodeSecp256k1Pubkey)(V.pubkey),{sequence:m}=yield this.getSequence(T),{gasInfo:h}=yield this.forceGetQueryClient().tx.simulate(L,p,K,m);return(0,w.assertDefined)(h),f.Uint53.fromString(h.gasUsed.toString()).toNumber()})}sendTokens(T,se,p,L,V=""){return Jt(this,null,function*(){let K={typeUrl:"/cosmos.bank.v1beta1.MsgSend",value:{fromAddress:T,toAddress:se,amount:[...p]}};return this.signAndBroadcast(T,[K],L,V)})}delegateTokens(T,se,p,L,V=""){return Jt(this,null,function*(){let K={typeUrl:"/cosmos.staking.v1beta1.MsgDelegate",value:j.MsgDelegate.fromPartial({delegatorAddress:T,validatorAddress:se,amount:p})};return this.signAndBroadcast(T,[K],L,V)})}undelegateTokens(T,se,p,L,V=""){return Jt(this,null,function*(){let K={typeUrl:"/cosmos.staking.v1beta1.MsgUndelegate",value:j.MsgUndelegate.fromPartial({delegatorAddress:T,validatorAddress:se,amount:p})};return this.signAndBroadcast(T,[K],L,V)})}withdrawRewards(T,se,p,L=""){return Jt(this,null,function*(){let V={typeUrl:"/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",value:F.MsgWithdrawDelegatorReward.fromPartial({delegatorAddress:T,validatorAddress:se})};return this.signAndBroadcast(T,[V],p,L)})}sendIbcTokens(T,se,p,L,V,K,m,h,_=""){return Jt(this,null,function*(){let b=m?Z.default.fromNumber(m).multiply(1e9):void 0,O={typeUrl:"/ibc.applications.transfer.v1.MsgTransfer",value:ne.MsgTransfer.fromPartial({sourcePort:L,sourceChannel:V,sender:T,receiver:se,token:p,timeoutHeight:K,timeoutTimestamp:b})};return this.signAndBroadcast(T,[O],h,_)})}signAndBroadcast(T,se,p,L=""){return Jt(this,null,function*(){let V;if(p=="auto"||typeof p=="number"){(0,w.assertDefined)(this.gasPrice,"Gas price must be set in the client options when auto gas is used.");let h=yield this.simulate(T,se,L),_=typeof p=="number"?p:1.4;V=(0,M.calculateFee)(Math.round(h*_),this.gasPrice)}else V=p;let K=yield this.sign(T,se,V,L),m=v.TxRaw.encode(K).finish();return this.broadcastTx(m,this.broadcastTimeoutMs,this.broadcastPollIntervalMs)})}signAndBroadcastSync(T,se,p,L=""){return Jt(this,null,function*(){let V;if(p=="auto"||typeof p=="number"){(0,w.assertDefined)(this.gasPrice,"Gas price must be set in the client options when auto gas is used.");let h=yield this.simulate(T,se,L),_=typeof p=="number"?p:1.3;V=(0,M.calculateFee)(Math.round(h*_),this.gasPrice)}else V=p;let K=yield this.sign(T,se,V,L),m=v.TxRaw.encode(K).finish();return this.broadcastTxSync(m)})}sign(T,se,p,L,V){return Jt(this,null,function*(){let K;if(V)K=V;else{let{accountNumber:m,sequence:h}=yield this.getSequence(T),_=yield this.getChainId();K={accountNumber:m,sequence:h,chainId:_}}return(0,l.isOfflineDirectSigner)(this.signer)?this.signDirect(T,se,p,L,K):this.signAmino(T,se,p,L,K)})}signAmino(h,_,b,O,J){return Jt(this,arguments,function*(T,se,p,L,{accountNumber:V,sequence:K,chainId:m}){(0,w.assert)(!(0,l.isOfflineDirectSigner)(this.signer));let ie=(yield this.signer.getAccounts()).find(ut=>ut.address===T);if(!ie)throw new Error("Failed to retrieve account from signer");let G=(0,l.encodePubkey)((0,A.encodeSecp256k1Pubkey)(ie.pubkey)),I=te.SignMode.SIGN_MODE_LEGACY_AMINO_JSON,C=se.map(ut=>this.aminoTypes.toAmino(ut)),D=(0,A.makeSignDoc)(C,p,m,L,V,K),{signature:W,signed:ae}=yield this.signer.signAmino(T,D),Xe={typeUrl:"/cosmos.tx.v1beta1.TxBody",value:{messages:ae.msgs.map(ut=>this.aminoTypes.fromAmino(ut)),memo:ae.memo}},nt=this.registry.encode(Xe),Ke=f.Int53.fromString(ae.fee.gas).toNumber(),It=f.Int53.fromString(ae.sequence).toNumber(),rt=(0,l.makeAuthInfoBytes)([{pubkey:G,sequence:It}],ae.fee.amount,Ke,ae.fee.granter,ae.fee.payer,I);return v.TxRaw.fromPartial({bodyBytes:nt,authInfoBytes:rt,signatures:[(0,c.fromBase64)(W.signature)]})})}signDirect(h,_,b,O,J){return Jt(this,arguments,function*(T,se,p,L,{accountNumber:V,sequence:K,chainId:m}){(0,w.assert)((0,l.isOfflineDirectSigner)(this.signer));let ie=(yield this.signer.getAccounts()).find(nt=>nt.address===T);if(!ie)throw new Error("Failed to retrieve account from signer");let G=(0,l.encodePubkey)((0,A.encodeSecp256k1Pubkey)(ie.pubkey)),I={typeUrl:"/cosmos.tx.v1beta1.TxBody",value:{messages:se,memo:L}},C=this.registry.encode(I),D=f.Int53.fromString(p.gas).toNumber(),W=(0,l.makeAuthInfoBytes)([{pubkey:G,sequence:K}],p.amount,D,p.granter,p.payer),ae=(0,l.makeSignDoc)(C,W,m,V),{signature:ye,signed:Xe}=yield this.signer.signDirect(T,ae);return v.TxRaw.fromPartial({bodyBytes:Xe.bodyBytes,authInfoBytes:Xe.authInfoBytes,signatures:[(0,c.fromBase64)(ye.signature)]})})}}e.SigningStargateClient=re})($$r);(function(e){var i=Fr&&Fr.__createBinding||(Object.create?function(Z,R,M,U){U===void 0&&(U=M);var E=Object.getOwnPropertyDescriptor(R,M);(!E||("get"in E?!R.__esModule:E.writable||E.configurable))&&(E={enumerable:!0,get:function(){return R[M]}}),Object.defineProperty(Z,U,E)}:function(Z,R,M,U){U===void 0&&(U=M),Z[U]=R[M]}),A=Fr&&Fr.__setModuleDefault||(Object.create?function(Z,R){Object.defineProperty(Z,"default",{enumerable:!0,value:R})}:function(Z,R){Z.default=R}),c=Fr&&Fr.__importStar||function(Z){if(Z&&Z.__esModule)return Z;var R={};if(Z!=null)for(var M in Z)M!=="default"&&Object.prototype.hasOwnProperty.call(Z,M)&&i(R,Z,M);return A(R,Z),R};Object.defineProperty(e,"__esModule",{value:!0}),e.isMsgWithdrawDelegatorRewardEncodeObject=e.isMsgVoteWeightedEncodeObject=e.isMsgVoteEncodeObject=e.isMsgUndelegateEncodeObject=e.isMsgTransferEncodeObject=e.isMsgSubmitProposalEncodeObject=e.isMsgSendEncodeObject=e.isMsgEditValidatorEncodeObject=e.isMsgDepositEncodeObject=e.isMsgDelegateEncodeObject=e.isMsgCreateValidatorEncodeObject=e.isMsgBeginRedelegateEncodeObject=e.isAminoMsgWithdrawValidatorCommission=e.isAminoMsgWithdrawDelegatorReward=e.isAminoMsgVoteWeighted=e.isAminoMsgVote=e.isAminoMsgVerifyInvariant=e.isAminoMsgUnjail=e.isAminoMsgUndelegate=e.isAminoMsgTransfer=e.isAminoMsgSubmitProposal=e.isAminoMsgSubmitEvidence=e.isAminoMsgSetWithdrawAddress=e.isAminoMsgSend=e.isAminoMsgMultiSend=e.isAminoMsgFundCommunityPool=e.isAminoMsgEditValidator=e.isAminoMsgDeposit=e.isAminoMsgDelegate=e.isAminoMsgCreateVestingAccount=e.isAminoMsgCreateValidator=e.isAminoMsgBeginRedelegate=e.createVestingAminoConverters=e.createStakingAminoConverters=e.createSlashingAminoConverters=e.createIbcAminoConverters=e.createGroupAminoConverters=e.createGovAminoConverters=e.createFeegrantAminoConverters=e.createEvidenceAminoConverters=e.createDistributionAminoConverters=e.createCrysisAminoConverters=e.createBankAminoConverters=e.createAuthzAminoConverters=e.logs=e.GasPrice=e.calculateFee=e.fromTendermintEvent=e.AminoTypes=e.accountFromAny=void 0,e.parseCoins=e.makeCosmoshubPath=e.coins=e.coin=e.TimeoutError=e.StargateClient=e.isDeliverTxSuccess=e.isDeliverTxFailure=e.BroadcastTxError=e.assertIsDeliverTxSuccess=e.assertIsDeliverTxFailure=e.SigningStargateClient=e.defaultRegistryTypes=e.createDefaultAminoConverters=e.QueryClient=e.decodeCosmosSdkDecFromProto=e.createProtobufRpcClient=e.createPagination=e.makeMultisignedTxBytes=e.makeMultisignedTx=e.setupTxExtension=e.setupStakingExtension=e.setupSlashingExtension=e.setupMintExtension=e.setupIbcExtension=e.setupGovExtension=e.setupFeegrantExtension=e.setupDistributionExtension=e.setupBankExtension=e.setupAuthzExtension=e.setupAuthExtension=void 0;var f=zGe;Object.defineProperty(e,"accountFromAny",{enumerable:!0,get:function(){return f.accountFromAny}});var l=WGe;Object.defineProperty(e,"AminoTypes",{enumerable:!0,get:function(){return l.AminoTypes}});var g=ZGe;Object.defineProperty(e,"fromTendermintEvent",{enumerable:!0,get:function(){return g.fromTendermintEvent}});var w=Bfe;Object.defineProperty(e,"calculateFee",{enumerable:!0,get:function(){return w.calculateFee}}),Object.defineProperty(e,"GasPrice",{enumerable:!0,get:function(){return w.GasPrice}}),e.logs=c(aD);var N=gGe;Object.defineProperty(e,"createAuthzAminoConverters",{enumerable:!0,get:function(){return N.createAuthzAminoConverters}}),Object.defineProperty(e,"createBankAminoConverters",{enumerable:!0,get:function(){return N.createBankAminoConverters}}),Object.defineProperty(e,"createCrysisAminoConverters",{enumerable:!0,get:function(){return N.createCrysisAminoConverters}}),Object.defineProperty(e,"createDistributionAminoConverters",{enumerable:!0,get:function(){return N.createDistributionAminoConverters}}),Object.defineProperty(e,"createEvidenceAminoConverters",{enumerable:!0,get:function(){return N.createEvidenceAminoConverters}}),Object.defineProperty(e,"createFeegrantAminoConverters",{enumerable:!0,get:function(){return N.createFeegrantAminoConverters}}),Object.defineProperty(e,"createGovAminoConverters",{enumerable:!0,get:function(){return N.createGovAminoConverters}}),Object.defineProperty(e,"createGroupAminoConverters",{enumerable:!0,get:function(){return N.createGroupAminoConverters}}),Object.defineProperty(e,"createIbcAminoConverters",{enumerable:!0,get:function(){return N.createIbcAminoConverters}}),Object.defineProperty(e,"createSlashingAminoConverters",{enumerable:!0,get:function(){return N.createSlashingAminoConverters}}),Object.defineProperty(e,"createStakingAminoConverters",{enumerable:!0,get:function(){return N.createStakingAminoConverters}}),Object.defineProperty(e,"createVestingAminoConverters",{enumerable:!0,get:function(){return N.createVestingAminoConverters}}),Object.defineProperty(e,"isAminoMsgBeginRedelegate",{enumerable:!0,get:function(){return N.isAminoMsgBeginRedelegate}}),Object.defineProperty(e,"isAminoMsgCreateValidator",{enumerable:!0,get:function(){return N.isAminoMsgCreateValidator}}),Object.defineProperty(e,"isAminoMsgCreateVestingAccount",{enumerable:!0,get:function(){return N.isAminoMsgCreateVestingAccount}}),Object.defineProperty(e,"isAminoMsgDelegate",{enumerable:!0,get:function(){return N.isAminoMsgDelegate}}),Object.defineProperty(e,"isAminoMsgDeposit",{enumerable:!0,get:function(){return N.isAminoMsgDeposit}}),Object.defineProperty(e,"isAminoMsgEditValidator",{enumerable:!0,get:function(){return N.isAminoMsgEditValidator}}),Object.defineProperty(e,"isAminoMsgFundCommunityPool",{enumerable:!0,get:function(){return N.isAminoMsgFundCommunityPool}}),Object.defineProperty(e,"isAminoMsgMultiSend",{enumerable:!0,get:function(){return N.isAminoMsgMultiSend}}),Object.defineProperty(e,"isAminoMsgSend",{enumerable:!0,get:function(){return N.isAminoMsgSend}}),Object.defineProperty(e,"isAminoMsgSetWithdrawAddress",{enumerable:!0,get:function(){return N.isAminoMsgSetWithdrawAddress}}),Object.defineProperty(e,"isAminoMsgSubmitEvidence",{enumerable:!0,get:function(){return N.isAminoMsgSubmitEvidence}}),Object.defineProperty(e,"isAminoMsgSubmitProposal",{enumerable:!0,get:function(){return N.isAminoMsgSubmitProposal}}),Object.defineProperty(e,"isAminoMsgTransfer",{enumerable:!0,get:function(){return N.isAminoMsgTransfer}}),Object.defineProperty(e,"isAminoMsgUndelegate",{enumerable:!0,get:function(){return N.isAminoMsgUndelegate}}),Object.defineProperty(e,"isAminoMsgUnjail",{enumerable:!0,get:function(){return N.isAminoMsgUnjail}}),Object.defineProperty(e,"isAminoMsgVerifyInvariant",{enumerable:!0,get:function(){return N.isAminoMsgVerifyInvariant}}),Object.defineProperty(e,"isAminoMsgVote",{enumerable:!0,get:function(){return N.isAminoMsgVote}}),Object.defineProperty(e,"isAminoMsgVoteWeighted",{enumerable:!0,get:function(){return N.isAminoMsgVoteWeighted}}),Object.defineProperty(e,"isAminoMsgWithdrawDelegatorReward",{enumerable:!0,get:function(){return N.isAminoMsgWithdrawDelegatorReward}}),Object.defineProperty(e,"isAminoMsgWithdrawValidatorCommission",{enumerable:!0,get:function(){return N.isAminoMsgWithdrawValidatorCommission}}),Object.defineProperty(e,"isMsgBeginRedelegateEncodeObject",{enumerable:!0,get:function(){return N.isMsgBeginRedelegateEncodeObject}}),Object.defineProperty(e,"isMsgCreateValidatorEncodeObject",{enumerable:!0,get:function(){return N.isMsgCreateValidatorEncodeObject}}),Object.defineProperty(e,"isMsgDelegateEncodeObject",{enumerable:!0,get:function(){return N.isMsgDelegateEncodeObject}}),Object.defineProperty(e,"isMsgDepositEncodeObject",{enumerable:!0,get:function(){return N.isMsgDepositEncodeObject}}),Object.defineProperty(e,"isMsgEditValidatorEncodeObject",{enumerable:!0,get:function(){return N.isMsgEditValidatorEncodeObject}}),Object.defineProperty(e,"isMsgSendEncodeObject",{enumerable:!0,get:function(){return N.isMsgSendEncodeObject}}),Object.defineProperty(e,"isMsgSubmitProposalEncodeObject",{enumerable:!0,get:function(){return N.isMsgSubmitProposalEncodeObject}}),Object.defineProperty(e,"isMsgTransferEncodeObject",{enumerable:!0,get:function(){return N.isMsgTransferEncodeObject}}),Object.defineProperty(e,"isMsgUndelegateEncodeObject",{enumerable:!0,get:function(){return N.isMsgUndelegateEncodeObject}}),Object.defineProperty(e,"isMsgVoteEncodeObject",{enumerable:!0,get:function(){return N.isMsgVoteEncodeObject}}),Object.defineProperty(e,"isMsgVoteWeightedEncodeObject",{enumerable:!0,get:function(){return N.isMsgVoteWeightedEncodeObject}}),Object.defineProperty(e,"isMsgWithdrawDelegatorRewardEncodeObject",{enumerable:!0,get:function(){return N.isMsgWithdrawDelegatorRewardEncodeObject}}),Object.defineProperty(e,"setupAuthExtension",{enumerable:!0,get:function(){return N.setupAuthExtension}}),Object.defineProperty(e,"setupAuthzExtension",{enumerable:!0,get:function(){return N.setupAuthzExtension}}),Object.defineProperty(e,"setupBankExtension",{enumerable:!0,get:function(){return N.setupBankExtension}}),Object.defineProperty(e,"setupDistributionExtension",{enumerable:!0,get:function(){return N.setupDistributionExtension}}),Object.defineProperty(e,"setupFeegrantExtension",{enumerable:!0,get:function(){return N.setupFeegrantExtension}}),Object.defineProperty(e,"setupGovExtension",{enumerable:!0,get:function(){return N.setupGovExtension}}),Object.defineProperty(e,"setupIbcExtension",{enumerable:!0,get:function(){return N.setupIbcExtension}}),Object.defineProperty(e,"setupMintExtension",{enumerable:!0,get:function(){return N.setupMintExtension}}),Object.defineProperty(e,"setupSlashingExtension",{enumerable:!0,get:function(){return N.setupSlashingExtension}}),Object.defineProperty(e,"setupStakingExtension",{enumerable:!0,get:function(){return N.setupStakingExtension}}),Object.defineProperty(e,"setupTxExtension",{enumerable:!0,get:function(){return N.setupTxExtension}});var F=Wie;Object.defineProperty(e,"makeMultisignedTx",{enumerable:!0,get:function(){return F.makeMultisignedTx}}),Object.defineProperty(e,"makeMultisignedTxBytes",{enumerable:!0,get:function(){return F.makeMultisignedTxBytes}});var j=Rw;Object.defineProperty(e,"createPagination",{enumerable:!0,get:function(){return j.createPagination}}),Object.defineProperty(e,"createProtobufRpcClient",{enumerable:!0,get:function(){return j.createProtobufRpcClient}}),Object.defineProperty(e,"decodeCosmosSdkDecFromProto",{enumerable:!0,get:function(){return j.decodeCosmosSdkDecFromProto}}),Object.defineProperty(e,"QueryClient",{enumerable:!0,get:function(){return j.QueryClient}});var te=$$r;Object.defineProperty(e,"createDefaultAminoConverters",{enumerable:!0,get:function(){return te.createDefaultAminoConverters}}),Object.defineProperty(e,"defaultRegistryTypes",{enumerable:!0,get:function(){return te.defaultRegistryTypes}}),Object.defineProperty(e,"SigningStargateClient",{enumerable:!0,get:function(){return te.SigningStargateClient}});var v=hE;Object.defineProperty(e,"assertIsDeliverTxFailure",{enumerable:!0,get:function(){return v.assertIsDeliverTxFailure}}),Object.defineProperty(e,"assertIsDeliverTxSuccess",{enumerable:!0,get:function(){return v.assertIsDeliverTxSuccess}}),Object.defineProperty(e,"BroadcastTxError",{enumerable:!0,get:function(){return v.BroadcastTxError}}),Object.defineProperty(e,"isDeliverTxFailure",{enumerable:!0,get:function(){return v.isDeliverTxFailure}}),Object.defineProperty(e,"isDeliverTxSuccess",{enumerable:!0,get:function(){return v.isDeliverTxSuccess}}),Object.defineProperty(e,"StargateClient",{enumerable:!0,get:function(){return v.StargateClient}}),Object.defineProperty(e,"TimeoutError",{enumerable:!0,get:function(){return v.TimeoutError}});var ne=MF;Object.defineProperty(e,"coin",{enumerable:!0,get:function(){return ne.coin}}),Object.defineProperty(e,"coins",{enumerable:!0,get:function(){return ne.coins}}),Object.defineProperty(e,"makeCosmoshubPath",{enumerable:!0,get:function(){return ne.makeCosmoshubPath}}),Object.defineProperty(e,"parseCoins",{enumerable:!0,get:function(){return ne.parseCoins}})})($3t);var iqe={},YSe={},qvt={},vEt={exports:{}};vEt.exports;(function(e,i){var A=vSe,c=A.Buffer;function f(g,w){for(var N in g)w[N]=g[N]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?e.exports=A:(f(A,i),i.Buffer=l);function l(g,w,N){return c(g,w,N)}l.prototype=Object.create(c.prototype),f(c,l),l.from=function(g,w,N){if(typeof g=="number")throw new TypeError("Argument must not be a number");return c(g,w,N)},l.alloc=function(g,w,N){if(typeof g!="number")throw new TypeError("Argument must be a number");var F=c(g);return w!==void 0?typeof N=="string"?F.fill(w,N):F.fill(w):F.fill(0),F},l.allocUnsafe=function(g){if(typeof g!="number")throw new TypeError("Argument must be a number");return c(g)},l.allocUnsafeSlow=function(g){if(typeof g!="number")throw new TypeError("Argument must be a number");return A.SlowBuffer(g)}})(vEt,vEt.exports);var Pw=vEt.exports,bEt={exports:{}},Vjr=XGr.EventEmitter,ahn,yGr;function mks(){if(yGr)return ahn;yGr=1;function e(Z,R){var M=Object.keys(Z);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(Z);R&&(U=U.filter(function(E){return Object.getOwnPropertyDescriptor(Z,E).enumerable})),M.push.apply(M,U)}return M}function i(Z){for(var R=1;R<arguments.length;R++){var M=arguments[R]!=null?arguments[R]:{};R%2?e(Object(M),!0).forEach(function(U){A(Z,U,M[U])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Z,Object.getOwnPropertyDescriptors(M)):e(Object(M)).forEach(function(U){Object.defineProperty(Z,U,Object.getOwnPropertyDescriptor(M,U))})}return Z}function A(Z,R,M){return R=g(R),R in Z?Object.defineProperty(Z,R,{value:M,enumerable:!0,configurable:!0,writable:!0}):Z[R]=M,Z}function c(Z,R){if(!(Z instanceof R))throw new TypeError("Cannot call a class as a function")}function f(Z,R){for(var M=0;M<R.length;M++){var U=R[M];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(Z,g(U.key),U)}}function l(Z,R,M){return R&&f(Z.prototype,R),M&&f(Z,M),Object.defineProperty(Z,"prototype",{writable:!1}),Z}function g(Z){var R=w(Z,"string");return typeof R=="symbol"?R:String(R)}function w(Z,R){if(typeof Z!="object"||Z===null)return Z;var M=Z[Symbol.toPrimitive];if(M!==void 0){var U=M.call(Z,R||"default");if(typeof U!="object")return U;throw new TypeError("@@toPrimitive must return a primitive value.")}return(R==="string"?String:Number)(Z)}var N=vSe,F=N.Buffer,j=zue,te=j.inspect,v=te&&te.custom||"inspect";function ne(Z,R,M){F.prototype.copy.call(Z,R,M)}return ahn=function(){function Z(){c(this,Z),this.head=null,this.tail=null,this.length=0}return l(Z,[{key:"push",value:function(M){var U={data:M,next:null};this.length>0?this.tail.next=U:this.head=U,this.tail=U,++this.length}},{key:"unshift",value:function(M){var U={data:M,next:this.head};this.length===0&&(this.tail=U),this.head=U,++this.length}},{key:"shift",value:function(){if(this.length!==0){var M=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,M}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(M){if(this.length===0)return"";for(var U=this.head,E=""+U.data;U=U.next;)E+=M+U.data;return E}},{key:"concat",value:function(M){if(this.length===0)return F.alloc(0);for(var U=F.allocUnsafe(M>>>0),E=this.head,Q=0;E;)ne(E.data,U,Q),Q+=E.data.length,E=E.next;return U}},{key:"consume",value:function(M,U){var E;return M<this.head.data.length?(E=this.head.data.slice(0,M),this.head.data=this.head.data.slice(M)):M===this.head.data.length?E=this.shift():E=U?this._getString(M):this._getBuffer(M),E}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(M){var U=this.head,E=1,Q=U.data;for(M-=Q.length;U=U.next;){var H=U.data,re=M>H.length?H.length:M;if(re===H.length?Q+=H:Q+=H.slice(0,M),M-=re,M===0){re===H.length?(++E,U.next?this.head=U.next:this.head=this.tail=null):(this.head=U,U.data=H.slice(re));break}++E}return this.length-=E,Q}},{key:"_getBuffer",value:function(M){var U=F.allocUnsafe(M),E=this.head,Q=1;for(E.data.copy(U),M-=E.data.length;E=E.next;){var H=E.data,re=M>H.length?H.length:M;if(H.copy(U,U.length-M,0,re),M-=re,M===0){re===H.length?(++Q,E.next?this.head=E.next:this.head=this.tail=null):(this.head=E,E.data=H.slice(re));break}++Q}return this.length-=Q,U}},{key:v,value:function(M,U){return te(this,i(i({},U),{},{depth:0,customInspect:!1}))}}]),Z}(),ahn}function Iks(e,i){var A=this,c=this._readableState&&this._readableState.destroyed,f=this._writableState&&this._writableState.destroyed;return c||f?(i?i(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(zpn,this,e)):process.nextTick(zpn,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(l){!i&&l?A._writableState?A._writableState.errorEmitted?process.nextTick(a_t,A):(A._writableState.errorEmitted=!0,process.nextTick(mGr,A,l)):process.nextTick(mGr,A,l):i?(process.nextTick(a_t,A),i(l)):process.nextTick(a_t,A)}),this)}function mGr(e,i){zpn(e,i),a_t(e)}function a_t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Cks(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function zpn(e,i){e.emit("error",i)}function _ks(e,i){var A=e._readableState,c=e._writableState;A&&A.autoDestroy||c&&c.autoDestroy?e.destroy(i):e.emit("error",i)}var zjr={destroy:Iks,undestroy:Cks,errorOrDestroy:_ks},Xfe={};function Eks(e,i){e.prototype=Object.create(i.prototype),e.prototype.constructor=e,e.__proto__=i}var Wjr={};function VM(e,i,A){A||(A=Error);function c(l,g,w){return typeof i=="string"?i:i(l,g,w)}var f=function(l){Eks(g,l);function g(w,N,F){return l.call(this,c(w,N,F))||this}return g}(A);f.prototype.name=A.name,f.prototype.code=e,Wjr[e]=f}function IGr(e,i){if(Array.isArray(e)){var A=e.length;return e=e.map(function(c){return String(c)}),A>2?"one of ".concat(i," ").concat(e.slice(0,A-1).join(", "),", or ")+e[A-1]:A===2?"one of ".concat(i," ").concat(e[0]," or ").concat(e[1]):"of ".concat(i," ").concat(e[0])}else return"of ".concat(i," ").concat(String(e))}function Bks(e,i,A){return e.substr(!A||A<0?0:+A,i.length)===i}function vks(e,i,A){return(A===void 0||A>e.length)&&(A=e.length),e.substring(A-i.length,A)===i}function bks(e,i,A){return typeof A!="number"&&(A=0),A+i.length>e.length?!1:e.indexOf(i,A)!==-1}VM("ERR_INVALID_OPT_VALUE",function(e,i){return'The value "'+i+'" is invalid for option "'+e+'"'},TypeError);VM("ERR_INVALID_ARG_TYPE",function(e,i,A){var c;typeof i=="string"&&Bks(i,"not ")?(c="must not be",i=i.replace(/^not /,"")):c="must be";var f;if(vks(e," argument"))f="The ".concat(e," ").concat(c," ").concat(IGr(i,"type"));else{var l=bks(e,".")?"property":"argument";f='The "'.concat(e,'" ').concat(l," ").concat(c," ").concat(IGr(i,"type"))}return f+=". Received type ".concat(typeof A),f},TypeError);VM("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");VM("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});VM("ERR_STREAM_PREMATURE_CLOSE","Premature close");VM("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});VM("ERR_MULTIPLE_CALLBACK","Callback called multiple times");VM("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");VM("ERR_STREAM_WRITE_AFTER_END","write after end");VM("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);VM("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);VM("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");Xfe.codes=Wjr;var Sks=Xfe.codes.ERR_INVALID_OPT_VALUE;function wks(e,i,A){return e.highWaterMark!=null?e.highWaterMark:i?e[A]:null}function Qks(e,i,A,c){var f=wks(i,c,A);if(f!=null){if(!(isFinite(f)&&Math.floor(f)===f)||f<0){var l=c?A:"highWaterMark";throw new Sks(l,f)}return Math.floor(f)}return e.objectMode?16:16*1024}var Zjr={getHighWaterMark:Qks},shn,CGr;function kks(){if(CGr)return shn;CGr=1,shn=e;function e(A,c){if(i("noDeprecation"))return A;var f=!1;function l(){if(!f){if(i("throwDeprecation"))throw new Error(c);i("traceDeprecation")?console.trace(c):console.warn(c),f=!0}return A.apply(this,arguments)}return l}function i(A){try{if(!Fr.localStorage)return!1}catch(f){return!1}var c=Fr.localStorage[A];return c==null?!1:String(c).toLowerCase()==="true"}return shn}var Ahn,_Gr;function Xjr(){if(_Gr)return Ahn;_Gr=1,Ahn=se;function e(ye){var Xe=this;this.next=null,this.entry=null,this.finish=function(){ae(Xe,ye)}}var i;se.WritableState=ee;var A={deprecate:kks()},c=Vjr,f=vSe.Buffer,l=(typeof Fr!="undefined"?Fr:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function g(ye){return f.from(ye)}function w(ye){return f.isBuffer(ye)||ye instanceof l}var N=zjr,F=Zjr,j=F.getHighWaterMark,te=Xfe.codes,v=te.ERR_INVALID_ARG_TYPE,ne=te.ERR_METHOD_NOT_IMPLEMENTED,Z=te.ERR_MULTIPLE_CALLBACK,R=te.ERR_STREAM_CANNOT_PIPE,M=te.ERR_STREAM_DESTROYED,U=te.ERR_STREAM_NULL_VALUES,E=te.ERR_STREAM_WRITE_AFTER_END,Q=te.ERR_UNKNOWN_ENCODING,H=N.errorOrDestroy;gm(se,c);function re(){}function ee(ye,Xe,nt){i=i||ESe(),ye=ye||{},typeof nt!="boolean"&&(nt=Xe instanceof i),this.objectMode=!!ye.objectMode,nt&&(this.objectMode=this.objectMode||!!ye.writableObjectMode),this.highWaterMark=j(this,ye,"writableHighWaterMark",nt),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Ke=ye.decodeStrings===!1;this.decodeStrings=!Ke,this.defaultEncoding=ye.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(It){b(Xe,It)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=ye.emitClose!==!1,this.autoDestroy=!!ye.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}ee.prototype.getBuffer=function(){for(var Xe=this.bufferedRequest,nt=[];Xe;)nt.push(Xe),Xe=Xe.next;return nt},function(){try{Object.defineProperty(ee.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(ye){}}();var T;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(T=Function.prototype[Symbol.hasInstance],Object.defineProperty(se,Symbol.hasInstance,{value:function(Xe){return T.call(this,Xe)?!0:this!==se?!1:Xe&&Xe._writableState instanceof ee}})):T=function(Xe){return Xe instanceof this};function se(ye){i=i||ESe();var Xe=this instanceof i;if(!Xe&&!T.call(se,this))return new se(ye);this._writableState=new ee(ye,this,Xe),this.writable=!0,ye&&(typeof ye.write=="function"&&(this._write=ye.write),typeof ye.writev=="function"&&(this._writev=ye.writev),typeof ye.destroy=="function"&&(this._destroy=ye.destroy),typeof ye.final=="function"&&(this._final=ye.final)),c.call(this)}se.prototype.pipe=function(){H(this,new R)};function p(ye,Xe){var nt=new E;H(ye,nt),process.nextTick(Xe,nt)}function L(ye,Xe,nt,Ke){var It;return nt===null?It=new U:typeof nt!="string"&&!Xe.objectMode&&(It=new v("chunk",["string","Buffer"],nt)),It?(H(ye,It),process.nextTick(Ke,It),!1):!0}se.prototype.write=function(ye,Xe,nt){var Ke=this._writableState,It=!1,rt=!Ke.objectMode&&w(ye);return rt&&!f.isBuffer(ye)&&(ye=g(ye)),typeof Xe=="function"&&(nt=Xe,Xe=null),rt?Xe="buffer":Xe||(Xe=Ke.defaultEncoding),typeof nt!="function"&&(nt=re),Ke.ending?p(this,nt):(rt||L(this,Ke,ye,nt))&&(Ke.pendingcb++,It=K(this,Ke,rt,ye,Xe,nt)),It},se.prototype.cork=function(){this._writableState.corked++},se.prototype.uncork=function(){var ye=this._writableState;ye.corked&&(ye.corked--,!ye.writing&&!ye.corked&&!ye.bufferProcessing&&ye.bufferedRequest&&ie(this,ye))},se.prototype.setDefaultEncoding=function(Xe){if(typeof Xe=="string"&&(Xe=Xe.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Xe+"").toLowerCase())>-1))throw new Q(Xe);return this._writableState.defaultEncoding=Xe,this},Object.defineProperty(se.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function V(ye,Xe,nt){return!ye.objectMode&&ye.decodeStrings!==!1&&typeof Xe=="string"&&(Xe=f.from(Xe,nt)),Xe}Object.defineProperty(se.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function K(ye,Xe,nt,Ke,It,rt){if(!nt){var ut=V(Xe,Ke,It);Ke!==ut&&(nt=!0,It="buffer",Ke=ut)}var Rt=Xe.objectMode?1:Ke.length;Xe.length+=Rt;var Ee=Xe.length<Xe.highWaterMark;if(Ee||(Xe.needDrain=!0),Xe.writing||Xe.corked){var Pt=Xe.lastBufferedRequest;Xe.lastBufferedRequest={chunk:Ke,encoding:It,isBuf:nt,callback:rt,next:null},Pt?Pt.next=Xe.lastBufferedRequest:Xe.bufferedRequest=Xe.lastBufferedRequest,Xe.bufferedRequestCount+=1}else m(ye,Xe,!1,Rt,Ke,It,rt);return Ee}function m(ye,Xe,nt,Ke,It,rt,ut){Xe.writelen=Ke,Xe.writecb=ut,Xe.writing=!0,Xe.sync=!0,Xe.destroyed?Xe.onwrite(new M("write")):nt?ye._writev(It,Xe.onwrite):ye._write(It,rt,Xe.onwrite),Xe.sync=!1}function h(ye,Xe,nt,Ke,It){--Xe.pendingcb,nt?(process.nextTick(It,Ke),process.nextTick(D,ye,Xe),ye._writableState.errorEmitted=!0,H(ye,Ke)):(It(Ke),ye._writableState.errorEmitted=!0,H(ye,Ke),D(ye,Xe))}function _(ye){ye.writing=!1,ye.writecb=null,ye.length-=ye.writelen,ye.writelen=0}function b(ye,Xe){var nt=ye._writableState,Ke=nt.sync,It=nt.writecb;if(typeof It!="function")throw new Z;if(_(nt),Xe)h(ye,nt,Ke,Xe,It);else{var rt=G(nt)||ye.destroyed;!rt&&!nt.corked&&!nt.bufferProcessing&&nt.bufferedRequest&&ie(ye,nt),Ke?process.nextTick(O,ye,nt,rt,It):O(ye,nt,rt,It)}}function O(ye,Xe,nt,Ke){nt||J(ye,Xe),Xe.pendingcb--,Ke(),D(ye,Xe)}function J(ye,Xe){Xe.length===0&&Xe.needDrain&&(Xe.needDrain=!1,ye.emit("drain"))}function ie(ye,Xe){Xe.bufferProcessing=!0;var nt=Xe.bufferedRequest;if(ye._writev&&nt&&nt.next){var Ke=Xe.bufferedRequestCount,It=new Array(Ke),rt=Xe.corkedRequestsFree;rt.entry=nt;for(var ut=0,Rt=!0;nt;)It[ut]=nt,nt.isBuf||(Rt=!1),nt=nt.next,ut+=1;It.allBuffers=Rt,m(ye,Xe,!0,Xe.length,It,"",rt.finish),Xe.pendingcb++,Xe.lastBufferedRequest=null,rt.next?(Xe.corkedRequestsFree=rt.next,rt.next=null):Xe.corkedRequestsFree=new e(Xe),Xe.bufferedRequestCount=0}else{for(;nt;){var Ee=nt.chunk,Pt=nt.encoding,_e=nt.callback,we=Xe.objectMode?1:Ee.length;if(m(ye,Xe,!1,we,Ee,Pt,_e),nt=nt.next,Xe.bufferedRequestCount--,Xe.writing)break}nt===null&&(Xe.lastBufferedRequest=null)}Xe.bufferedRequest=nt,Xe.bufferProcessing=!1}se.prototype._write=function(ye,Xe,nt){nt(new ne("_write()"))},se.prototype._writev=null,se.prototype.end=function(ye,Xe,nt){var Ke=this._writableState;return typeof ye=="function"?(nt=ye,ye=null,Xe=null):typeof Xe=="function"&&(nt=Xe,Xe=null),ye!=null&&this.write(ye,Xe),Ke.corked&&(Ke.corked=1,this.uncork()),Ke.ending||W(this,Ke,nt),this},Object.defineProperty(se.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function G(ye){return ye.ending&&ye.length===0&&ye.bufferedRequest===null&&!ye.finished&&!ye.writing}function I(ye,Xe){ye._final(function(nt){Xe.pendingcb--,nt&&H(ye,nt),Xe.prefinished=!0,ye.emit("prefinish"),D(ye,Xe)})}function C(ye,Xe){!Xe.prefinished&&!Xe.finalCalled&&(typeof ye._final=="function"&&!Xe.destroyed?(Xe.pendingcb++,Xe.finalCalled=!0,process.nextTick(I,ye,Xe)):(Xe.prefinished=!0,ye.emit("prefinish")))}function D(ye,Xe){var nt=G(Xe);if(nt&&(C(ye,Xe),Xe.pendingcb===0&&(Xe.finished=!0,ye.emit("finish"),Xe.autoDestroy))){var Ke=ye._readableState;(!Ke||Ke.autoDestroy&&Ke.endEmitted)&&ye.destroy()}return nt}function W(ye,Xe,nt){Xe.ending=!0,D(ye,Xe),nt&&(Xe.finished?process.nextTick(nt):ye.once("finish",nt)),Xe.ended=!0,ye.writable=!1}function ae(ye,Xe,nt){var Ke=ye.entry;for(ye.entry=null;Ke;){var It=Ke.callback;Xe.pendingcb--,It(nt),Ke=Ke.next}Xe.corkedRequestsFree.next=ye}return Object.defineProperty(se.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(Xe){this._writableState&&(this._writableState.destroyed=Xe)}}),se.prototype.destroy=N.destroy,se.prototype._undestroy=N.undestroy,se.prototype._destroy=function(ye,Xe){Xe(ye)},Ahn}var dhn,EGr;function ESe(){if(EGr)return dhn;EGr=1;var e=Object.keys||function(F){var j=[];for(var te in F)j.push(te);return j};dhn=g;var i=jjr(),A=Xjr();gm(g,i);for(var c=e(A.prototype),f=0;f<c.length;f++){var l=c[f];g.prototype[l]||(g.prototype[l]=A.prototype[l])}function g(F){if(!(this instanceof g))return new g(F);i.call(this,F),A.call(this,F),this.allowHalfOpen=!0,F&&(F.readable===!1&&(this.readable=!1),F.writable===!1&&(this.writable=!1),F.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",w)))}Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(g.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(g.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function w(){this._writableState.ended||process.nextTick(N,this)}function N(F){F.end()}return Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(j){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=j,this._writableState.destroyed=j)}}),dhn}var chn={},BGr;function vGr(){if(BGr)return chn;BGr=1;var e=Pw.Buffer,i=e.isEncoding||function(U){switch(U=""+U,U&&U.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function A(U){if(!U)return"utf8";for(var E;;)switch(U){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return U;default:if(E)return;U=(""+U).toLowerCase(),E=!0}}function c(U){var E=A(U);if(typeof E!="string"&&(e.isEncoding===i||!i(U)))throw new Error("Unknown encoding: "+U);return E||U}chn.StringDecoder=f;function f(U){this.encoding=c(U);var E;switch(this.encoding){case"utf16le":this.text=te,this.end=v,E=4;break;case"utf8":this.fillLast=N,E=4;break;case"base64":this.text=ne,this.end=Z,E=3;break;default:this.write=R,this.end=M;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(E)}f.prototype.write=function(U){if(U.length===0)return"";var E,Q;if(this.lastNeed){if(E=this.fillLast(U),E===void 0)return"";Q=this.lastNeed,this.lastNeed=0}else Q=0;return Q<U.length?E?E+this.text(U,Q):this.text(U,Q):E||""},f.prototype.end=j,f.prototype.text=F,f.prototype.fillLast=function(U){if(this.lastNeed<=U.length)return U.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);U.copy(this.lastChar,this.lastTotal-this.lastNeed,0,U.length),this.lastNeed-=U.length};function l(U){return U<=127?0:U>>5===6?2:U>>4===14?3:U>>3===30?4:U>>6===2?-1:-2}function g(U,E,Q){var H=E.length-1;if(H<Q)return 0;var re=l(E[H]);return re>=0?(re>0&&(U.lastNeed=re-1),re):--H<Q||re===-2?0:(re=l(E[H]),re>=0?(re>0&&(U.lastNeed=re-2),re):--H<Q||re===-2?0:(re=l(E[H]),re>=0?(re>0&&(re===2?re=0:U.lastNeed=re-3),re):0))}function w(U,E,Q){if((E[0]&192)!==128)return U.lastNeed=0,"\uFFFD";if(U.lastNeed>1&&E.length>1){if((E[1]&192)!==128)return U.lastNeed=1,"\uFFFD";if(U.lastNeed>2&&E.length>2&&(E[2]&192)!==128)return U.lastNeed=2,"\uFFFD"}}function N(U){var E=this.lastTotal-this.lastNeed,Q=w(this,U);if(Q!==void 0)return Q;if(this.lastNeed<=U.length)return U.copy(this.lastChar,E,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);U.copy(this.lastChar,E,0,U.length),this.lastNeed-=U.length}function F(U,E){var Q=g(this,U,E);if(!this.lastNeed)return U.toString("utf8",E);this.lastTotal=Q;var H=U.length-(Q-this.lastNeed);return U.copy(this.lastChar,0,H),U.toString("utf8",E,H)}function j(U){var E=U&&U.length?this.write(U):"";return this.lastNeed?E+"\uFFFD":E}function te(U,E){if((U.length-E)%2===0){var Q=U.toString("utf16le",E);if(Q){var H=Q.charCodeAt(Q.length-1);if(H>=55296&&H<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=U[U.length-2],this.lastChar[1]=U[U.length-1],Q.slice(0,-1)}return Q}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=U[U.length-1],U.toString("utf16le",E,U.length-1)}function v(U){var E=U&&U.length?this.write(U):"";if(this.lastNeed){var Q=this.lastTotal-this.lastNeed;return E+this.lastChar.toString("utf16le",0,Q)}return E}function ne(U,E){var Q=(U.length-E)%3;return Q===0?U.toString("base64",E):(this.lastNeed=3-Q,this.lastTotal=3,Q===1?this.lastChar[0]=U[U.length-1]:(this.lastChar[0]=U[U.length-2],this.lastChar[1]=U[U.length-1]),U.toString("base64",E,U.length-Q))}function Z(U){var E=U&&U.length?this.write(U):"";return this.lastNeed?E+this.lastChar.toString("base64",0,3-this.lastNeed):E}function R(U){return U.toString(this.encoding)}function M(U){return U&&U.length?this.write(U):""}return chn}var bGr=Xfe.codes.ERR_STREAM_PREMATURE_CLOSE;function Dks(e){var i=!1;return function(){if(!i){i=!0;for(var A=arguments.length,c=new Array(A),f=0;f<A;f++)c[f]=arguments[f];e.apply(this,c)}}}function Rks(){}function Pks(e){return e.setHeader&&typeof e.abort=="function"}function $jr(e,i,A){if(typeof i=="function")return $jr(e,null,i);i||(i={}),A=Dks(A||Rks);var c=i.readable||i.readable!==!1&&e.readable,f=i.writable||i.writable!==!1&&e.writable,l=function(){e.writable||w()},g=e._writableState&&e._writableState.finished,w=function(){f=!1,g=!0,c||A.call(e)},N=e._readableState&&e._readableState.endEmitted,F=function(){c=!1,N=!0,f||A.call(e)},j=function(Z){A.call(e,Z)},te=function(){var Z;if(c&&!N)return(!e._readableState||!e._readableState.ended)&&(Z=new bGr),A.call(e,Z);if(f&&!g)return(!e._writableState||!e._writableState.ended)&&(Z=new bGr),A.call(e,Z)},v=function(){e.req.on("finish",w)};return Pks(e)?(e.on("complete",w),e.on("abort",te),e.req?v():e.on("request",v)):f&&!e._writableState&&(e.on("end",l),e.on("close",l)),e.on("end",F),e.on("finish",w),i.error!==!1&&e.on("error",j),e.on("close",te),function(){e.removeListener("complete",w),e.removeListener("abort",te),e.removeListener("request",v),e.req&&e.req.removeListener("finish",w),e.removeListener("end",l),e.removeListener("close",l),e.removeListener("finish",w),e.removeListener("end",F),e.removeListener("error",j),e.removeListener("close",te)}}var GIn=$jr,uhn,SGr;function Oks(){if(SGr)return uhn;SGr=1;var e;function i(Q,H,re){return H=A(H),H in Q?Object.defineProperty(Q,H,{value:re,enumerable:!0,configurable:!0,writable:!0}):Q[H]=re,Q}function A(Q){var H=c(Q,"string");return typeof H=="symbol"?H:String(H)}function c(Q,H){if(typeof Q!="object"||Q===null)return Q;var re=Q[Symbol.toPrimitive];if(re!==void 0){var ee=re.call(Q,H||"default");if(typeof ee!="object")return ee;throw new TypeError("@@toPrimitive must return a primitive value.")}return(H==="string"?String:Number)(Q)}var f=GIn,l=Symbol("lastResolve"),g=Symbol("lastReject"),w=Symbol("error"),N=Symbol("ended"),F=Symbol("lastPromise"),j=Symbol("handlePromise"),te=Symbol("stream");function v(Q,H){return{value:Q,done:H}}function ne(Q){var H=Q[l];if(H!==null){var re=Q[te].read();re!==null&&(Q[F]=null,Q[l]=null,Q[g]=null,H(v(re,!1)))}}function Z(Q){process.nextTick(ne,Q)}function R(Q,H){return function(re,ee){Q.then(function(){if(H[N]){re(v(void 0,!0));return}H[j](re,ee)},ee)}}var M=Object.getPrototypeOf(function(){}),U=Object.setPrototypeOf((e={get stream(){return this[te]},next:function(){var H=this,re=this[w];if(re!==null)return Promise.reject(re);if(this[N])return Promise.resolve(v(void 0,!0));if(this[te].destroyed)return new Promise(function(p,L){process.nextTick(function(){H[w]?L(H[w]):p(v(void 0,!0))})});var ee=this[F],T;if(ee)T=new Promise(R(ee,this));else{var se=this[te].read();if(se!==null)return Promise.resolve(v(se,!1));T=new Promise(this[j])}return this[F]=T,T}},i(e,Symbol.asyncIterator,function(){return this}),i(e,"return",function(){var H=this;return new Promise(function(re,ee){H[te].destroy(null,function(T){if(T){ee(T);return}re(v(void 0,!0))})})}),e),M),E=function(H){var re,ee=Object.create(U,(re={},i(re,te,{value:H,writable:!0}),i(re,l,{value:null,writable:!0}),i(re,g,{value:null,writable:!0}),i(re,w,{value:null,writable:!0}),i(re,N,{value:H._readableState.endEmitted,writable:!0}),i(re,j,{value:function(se,p){var L=ee[te].read();L?(ee[F]=null,ee[l]=null,ee[g]=null,se(v(L,!1))):(ee[l]=se,ee[g]=p)},writable:!0}),re));return ee[F]=null,f(H,function(T){if(T&&T.code!=="ERR_STREAM_PREMATURE_CLOSE"){var se=ee[g];se!==null&&(ee[F]=null,ee[l]=null,ee[g]=null,se(T)),ee[w]=T;return}var p=ee[l];p!==null&&(ee[F]=null,ee[l]=null,ee[g]=null,p(v(void 0,!0))),ee[N]=!0}),H.on("readable",Z.bind(null,ee)),ee};return uhn=E,uhn}var fhn,wGr;function Nks(){return wGr||(wGr=1,fhn=function(){throw new Error("Readable.from is not available in the browser")}),fhn}var lhn,QGr;function jjr(){if(QGr)return lhn;QGr=1,lhn=p;var e;p.ReadableState=se,XGr.EventEmitter;var i=function(ut,Rt){return ut.listeners(Rt).length},A=Vjr,c=vSe.Buffer,f=(typeof Fr!="undefined"?Fr:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function l(rt){return c.from(rt)}function g(rt){return c.isBuffer(rt)||rt instanceof f}var w=zue,N;w&&w.debuglog?N=w.debuglog("stream"):N=function(){};var F=mks(),j=zjr,te=Zjr,v=te.getHighWaterMark,ne=Xfe.codes,Z=ne.ERR_INVALID_ARG_TYPE,R=ne.ERR_STREAM_PUSH_AFTER_EOF,M=ne.ERR_METHOD_NOT_IMPLEMENTED,U=ne.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,Q,H;gm(p,A);var re=j.errorOrDestroy,ee=["error","close","destroy","pause","resume"];function T(rt,ut,Rt){if(typeof rt.prependListener=="function")return rt.prependListener(ut,Rt);!rt._events||!rt._events[ut]?rt.on(ut,Rt):Array.isArray(rt._events[ut])?rt._events[ut].unshift(Rt):rt._events[ut]=[Rt,rt._events[ut]]}function se(rt,ut,Rt){e=e||ESe(),rt=rt||{},typeof Rt!="boolean"&&(Rt=ut instanceof e),this.objectMode=!!rt.objectMode,Rt&&(this.objectMode=this.objectMode||!!rt.readableObjectMode),this.highWaterMark=v(this,rt,"readableHighWaterMark",Rt),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=rt.emitClose!==!1,this.autoDestroy=!!rt.autoDestroy,this.destroyed=!1,this.defaultEncoding=rt.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,rt.encoding&&(E||(E=vGr().StringDecoder),this.decoder=new E(rt.encoding),this.encoding=rt.encoding)}function p(rt){if(e=e||ESe(),!(this instanceof p))return new p(rt);var ut=this instanceof e;this._readableState=new se(rt,this,ut),this.readable=!0,rt&&(typeof rt.read=="function"&&(this._read=rt.read),typeof rt.destroy=="function"&&(this._destroy=rt.destroy)),A.call(this)}Object.defineProperty(p.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(ut){this._readableState&&(this._readableState.destroyed=ut)}}),p.prototype.destroy=j.destroy,p.prototype._undestroy=j.undestroy,p.prototype._destroy=function(rt,ut){ut(rt)},p.prototype.push=function(rt,ut){var Rt=this._readableState,Ee;return Rt.objectMode?Ee=!0:typeof rt=="string"&&(ut=ut||Rt.defaultEncoding,ut!==Rt.encoding&&(rt=c.from(rt,ut),ut=""),Ee=!0),L(this,rt,ut,!1,Ee)},p.prototype.unshift=function(rt){return L(this,rt,null,!0,!1)};function L(rt,ut,Rt,Ee,Pt){N("readableAddChunk",ut);var _e=rt._readableState;if(ut===null)_e.reading=!1,b(rt,_e);else{var we;if(Pt||(we=K(_e,ut)),we)re(rt,we);else if(_e.objectMode||ut&&ut.length>0)if(typeof ut!="string"&&!_e.objectMode&&Object.getPrototypeOf(ut)!==c.prototype&&(ut=l(ut)),Ee)_e.endEmitted?re(rt,new U):V(rt,_e,ut,!0);else if(_e.ended)re(rt,new R);else{if(_e.destroyed)return!1;_e.reading=!1,_e.decoder&&!Rt?(ut=_e.decoder.write(ut),_e.objectMode||ut.length!==0?V(rt,_e,ut,!1):ie(rt,_e)):V(rt,_e,ut,!1)}else Ee||(_e.reading=!1,ie(rt,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function V(rt,ut,Rt,Ee){ut.flowing&&ut.length===0&&!ut.sync?(ut.awaitDrain=0,rt.emit("data",Rt)):(ut.length+=ut.objectMode?1:Rt.length,Ee?ut.buffer.unshift(Rt):ut.buffer.push(Rt),ut.needReadable&&O(rt)),ie(rt,ut)}function K(rt,ut){var Rt;return!g(ut)&&typeof ut!="string"&&ut!==void 0&&!rt.objectMode&&(Rt=new Z("chunk",["string","Buffer","Uint8Array"],ut)),Rt}p.prototype.isPaused=function(){return this._readableState.flowing===!1},p.prototype.setEncoding=function(rt){E||(E=vGr().StringDecoder);var ut=new E(rt);this._readableState.decoder=ut,this._readableState.encoding=this._readableState.decoder.encoding;for(var Rt=this._readableState.buffer.head,Ee="";Rt!==null;)Ee+=ut.write(Rt.data),Rt=Rt.next;return this._readableState.buffer.clear(),Ee!==""&&this._readableState.buffer.push(Ee),this._readableState.length=Ee.length,this};var m=1073741824;function h(rt){return rt>=m?rt=m:(rt--,rt|=rt>>>1,rt|=rt>>>2,rt|=rt>>>4,rt|=rt>>>8,rt|=rt>>>16,rt++),rt}function _(rt,ut){return rt<=0||ut.length===0&&ut.ended?0:ut.objectMode?1:rt!==rt?ut.flowing&&ut.length?ut.buffer.head.data.length:ut.length:(rt>ut.highWaterMark&&(ut.highWaterMark=h(rt)),rt<=ut.length?rt:ut.ended?ut.length:(ut.needReadable=!0,0))}p.prototype.read=function(rt){N("read",rt),rt=parseInt(rt,10);var ut=this._readableState,Rt=rt;if(rt!==0&&(ut.emittedReadable=!1),rt===0&&ut.needReadable&&((ut.highWaterMark!==0?ut.length>=ut.highWaterMark:ut.length>0)||ut.ended))return N("read: emitReadable",ut.length,ut.ended),ut.length===0&&ut.ended?nt(this):O(this),null;if(rt=_(rt,ut),rt===0&&ut.ended)return ut.length===0&&nt(this),null;var Ee=ut.needReadable;N("need readable",Ee),(ut.length===0||ut.length-rt<ut.highWaterMark)&&(Ee=!0,N("length less than watermark",Ee)),ut.ended||ut.reading?(Ee=!1,N("reading or ended",Ee)):Ee&&(N("do read"),ut.reading=!0,ut.sync=!0,ut.length===0&&(ut.needReadable=!0),this._read(ut.highWaterMark),ut.sync=!1,ut.reading||(rt=_(Rt,ut)));var Pt;return rt>0?Pt=Xe(rt,ut):Pt=null,Pt===null?(ut.needReadable=ut.length<=ut.highWaterMark,rt=0):(ut.length-=rt,ut.awaitDrain=0),ut.length===0&&(ut.ended||(ut.needReadable=!0),Rt!==rt&&ut.ended&&nt(this)),Pt!==null&&this.emit("data",Pt),Pt};function b(rt,ut){if(N("onEofChunk"),!ut.ended){if(ut.decoder){var Rt=ut.decoder.end();Rt&&Rt.length&&(ut.buffer.push(Rt),ut.length+=ut.objectMode?1:Rt.length)}ut.ended=!0,ut.sync?O(rt):(ut.needReadable=!1,ut.emittedReadable||(ut.emittedReadable=!0,J(rt)))}}function O(rt){var ut=rt._readableState;N("emitReadable",ut.needReadable,ut.emittedReadable),ut.needReadable=!1,ut.emittedReadable||(N("emitReadable",ut.flowing),ut.emittedReadable=!0,process.nextTick(J,rt))}function J(rt){var ut=rt._readableState;N("emitReadable_",ut.destroyed,ut.length,ut.ended),!ut.destroyed&&(ut.length||ut.ended)&&(rt.emit("readable"),ut.emittedReadable=!1),ut.needReadable=!ut.flowing&&!ut.ended&&ut.length<=ut.highWaterMark,ye(rt)}function ie(rt,ut){ut.readingMore||(ut.readingMore=!0,process.nextTick(G,rt,ut))}function G(rt,ut){for(;!ut.reading&&!ut.ended&&(ut.length<ut.highWaterMark||ut.flowing&&ut.length===0);){var Rt=ut.length;if(N("maybeReadMore read 0"),rt.read(0),Rt===ut.length)break}ut.readingMore=!1}p.prototype._read=function(rt){re(this,new M("_read()"))},p.prototype.pipe=function(rt,ut){var Rt=this,Ee=this._readableState;switch(Ee.pipesCount){case 0:Ee.pipes=rt;break;case 1:Ee.pipes=[Ee.pipes,rt];break;default:Ee.pipes.push(rt);break}Ee.pipesCount+=1,N("pipe count=%d opts=%j",Ee.pipesCount,ut);var Pt=(!ut||ut.end!==!1)&&rt!==process.stdout&&rt!==process.stderr,_e=Pt?xe:rn;Ee.endEmitted?process.nextTick(_e):Rt.once("end",_e),rt.on("unpipe",we);function we(un,fr){N("onunpipe"),un===Rt&&fr&&fr.hasUnpiped===!1&&(fr.hasUnpiped=!0,ht())}function xe(){N("onend"),rt.end()}var Ye=I(Rt);rt.on("drain",Ye);var X=!1;function ht(){N("cleanup"),rt.removeListener("close",Wt),rt.removeListener("finish",yn),rt.removeListener("drain",Ye),rt.removeListener("error",zt),rt.removeListener("unpipe",we),Rt.removeListener("end",xe),Rt.removeListener("end",rn),Rt.removeListener("data",Ut),X=!0,Ee.awaitDrain&&(!rt._writableState||rt._writableState.needDrain)&&Ye()}Rt.on("data",Ut);function Ut(un){N("ondata");var fr=rt.write(un);N("dest.write",fr),fr===!1&&((Ee.pipesCount===1&&Ee.pipes===rt||Ee.pipesCount>1&&It(Ee.pipes,rt)!==-1)&&!X&&(N("false write response, pause",Ee.awaitDrain),Ee.awaitDrain++),Rt.pause())}function zt(un){N("onerror",un),rn(),rt.removeListener("error",zt),i(rt,"error")===0&&re(rt,un)}T(rt,"error",zt);function Wt(){rt.removeListener("finish",yn),rn()}rt.once("close",Wt);function yn(){N("onfinish"),rt.removeListener("close",Wt),rn()}rt.once("finish",yn);function rn(){N("unpipe"),Rt.unpipe(rt)}return rt.emit("pipe",Rt),Ee.flowing||(N("pipe resume"),Rt.resume()),rt};function I(rt){return function(){var Rt=rt._readableState;N("pipeOnDrain",Rt.awaitDrain),Rt.awaitDrain&&Rt.awaitDrain--,Rt.awaitDrain===0&&i(rt,"data")&&(Rt.flowing=!0,ye(rt))}}p.prototype.unpipe=function(rt){var ut=this._readableState,Rt={hasUnpiped:!1};if(ut.pipesCount===0)return this;if(ut.pipesCount===1)return rt&&rt!==ut.pipes?this:(rt||(rt=ut.pipes),ut.pipes=null,ut.pipesCount=0,ut.flowing=!1,rt&&rt.emit("unpipe",this,Rt),this);if(!rt){var Ee=ut.pipes,Pt=ut.pipesCount;ut.pipes=null,ut.pipesCount=0,ut.flowing=!1;for(var _e=0;_e<Pt;_e++)Ee[_e].emit("unpipe",this,{hasUnpiped:!1});return this}var we=It(ut.pipes,rt);return we===-1?this:(ut.pipes.splice(we,1),ut.pipesCount-=1,ut.pipesCount===1&&(ut.pipes=ut.pipes[0]),rt.emit("unpipe",this,Rt),this)},p.prototype.on=function(rt,ut){var Rt=A.prototype.on.call(this,rt,ut),Ee=this._readableState;return rt==="data"?(Ee.readableListening=this.listenerCount("readable")>0,Ee.flowing!==!1&&this.resume()):rt==="readable"&&!Ee.endEmitted&&!Ee.readableListening&&(Ee.readableListening=Ee.needReadable=!0,Ee.flowing=!1,Ee.emittedReadable=!1,N("on readable",Ee.length,Ee.reading),Ee.length?O(this):Ee.reading||process.nextTick(D,this)),Rt},p.prototype.addListener=p.prototype.on,p.prototype.removeListener=function(rt,ut){var Rt=A.prototype.removeListener.call(this,rt,ut);return rt==="readable"&&process.nextTick(C,this),Rt},p.prototype.removeAllListeners=function(rt){var ut=A.prototype.removeAllListeners.apply(this,arguments);return(rt==="readable"||rt===void 0)&&process.nextTick(C,this),ut};function C(rt){var ut=rt._readableState;ut.readableListening=rt.listenerCount("readable")>0,ut.resumeScheduled&&!ut.paused?ut.flowing=!0:rt.listenerCount("data")>0&&rt.resume()}function D(rt){N("readable nexttick read 0"),rt.read(0)}p.prototype.resume=function(){var rt=this._readableState;return rt.flowing||(N("resume"),rt.flowing=!rt.readableListening,W(this,rt)),rt.paused=!1,this};function W(rt,ut){ut.resumeScheduled||(ut.resumeScheduled=!0,process.nextTick(ae,rt,ut))}function ae(rt,ut){N("resume",ut.reading),ut.reading||rt.read(0),ut.resumeScheduled=!1,rt.emit("resume"),ye(rt),ut.flowing&&!ut.reading&&rt.read(0)}p.prototype.pause=function(){return N("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(N("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function ye(rt){var ut=rt._readableState;for(N("flow",ut.flowing);ut.flowing&&rt.read()!==null;);}p.prototype.wrap=function(rt){var ut=this,Rt=this._readableState,Ee=!1;rt.on("end",function(){if(N("wrapped end"),Rt.decoder&&!Rt.ended){var we=Rt.decoder.end();we&&we.length&&ut.push(we)}ut.push(null)}),rt.on("data",function(we){if(N("wrapped data"),Rt.decoder&&(we=Rt.decoder.write(we)),!(Rt.objectMode&&we==null)&&!(!Rt.objectMode&&(!we||!we.length))){var xe=ut.push(we);xe||(Ee=!0,rt.pause())}});for(var Pt in rt)this[Pt]===void 0&&typeof rt[Pt]=="function"&&(this[Pt]=function(xe){return function(){return rt[xe].apply(rt,arguments)}}(Pt));for(var _e=0;_e<ee.length;_e++)rt.on(ee[_e],this.emit.bind(this,ee[_e]));return this._read=function(we){N("wrapped _read",we),Ee&&(Ee=!1,rt.resume())},this},typeof Symbol=="function"&&(p.prototype[Symbol.asyncIterator]=function(){return Q===void 0&&(Q=Oks()),Q(this)}),Object.defineProperty(p.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(p.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(p.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(ut){this._readableState&&(this._readableState.flowing=ut)}}),p._fromList=Xe,Object.defineProperty(p.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Xe(rt,ut){if(ut.length===0)return null;var Rt;return ut.objectMode?Rt=ut.buffer.shift():!rt||rt>=ut.length?(ut.decoder?Rt=ut.buffer.join(""):ut.buffer.length===1?Rt=ut.buffer.first():Rt=ut.buffer.concat(ut.length),ut.buffer.clear()):Rt=ut.buffer.consume(rt,ut.decoder),Rt}function nt(rt){var ut=rt._readableState;N("endReadable",ut.endEmitted),ut.endEmitted||(ut.ended=!0,process.nextTick(Ke,ut,rt))}function Ke(rt,ut){if(N("endReadableNT",rt.endEmitted,rt.length),!rt.endEmitted&&rt.length===0&&(rt.endEmitted=!0,ut.readable=!1,ut.emit("end"),rt.autoDestroy)){var Rt=ut._writableState;(!Rt||Rt.autoDestroy&&Rt.finished)&&ut.destroy()}}typeof Symbol=="function"&&(p.from=function(rt,ut){return H===void 0&&(H=Nks()),H(p,rt,ut)});function It(rt,ut){for(var Rt=0,Ee=rt.length;Rt<Ee;Rt++)if(rt[Rt]===ut)return Rt;return-1}return lhn}var eei=sW,Kvt=Xfe.codes,xks=Kvt.ERR_METHOD_NOT_IMPLEMENTED,Mks=Kvt.ERR_MULTIPLE_CALLBACK,Tks=Kvt.ERR_TRANSFORM_ALREADY_TRANSFORMING,Uks=Kvt.ERR_TRANSFORM_WITH_LENGTH_0,Yvt=ESe();gm(sW,Yvt);function Fks(e,i){var A=this._transformState;A.transforming=!1;var c=A.writecb;if(c===null)return this.emit("error",new Mks);A.writechunk=null,A.writecb=null,i!=null&&this.push(i),c(e);var f=this._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&this._read(f.highWaterMark)}function sW(e){if(!(this instanceof sW))return new sW(e);Yvt.call(this,e),this._transformState={afterTransform:Fks.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",Jks)}function Jks(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(i,A){kGr(e,i,A)}):kGr(this,null,null)}sW.prototype.push=function(e,i){return this._transformState.needTransform=!1,Yvt.prototype.push.call(this,e,i)};sW.prototype._transform=function(e,i,A){A(new xks("_transform()"))};sW.prototype._write=function(e,i,A){var c=this._transformState;if(c.writecb=A,c.writechunk=e,c.writeencoding=i,!c.transforming){var f=this._readableState;(c.needTransform||f.needReadable||f.length<f.highWaterMark)&&this._read(f.highWaterMark)}};sW.prototype._read=function(e){var i=this._transformState;i.writechunk!==null&&!i.transforming?(i.transforming=!0,this._transform(i.writechunk,i.writeencoding,i.afterTransform)):i.needTransform=!0};sW.prototype._destroy=function(e,i){Yvt.prototype._destroy.call(this,e,function(A){i(A)})};function kGr(e,i,A){if(i)return e.emit("error",i);if(A!=null&&e.push(A),e._writableState.length)throw new Uks;if(e._transformState.transforming)throw new Tks;return e.push(null)}var Hks=mGe,tei=eei;gm(mGe,tei);function mGe(e){if(!(this instanceof mGe))return new mGe(e);tei.call(this,e)}mGe.prototype._transform=function(e,i,A){A(null,e)};var hhn;function Lks(e){var i=!1;return function(){i||(i=!0,e.apply(void 0,arguments))}}var nei=Xfe.codes,Gks=nei.ERR_MISSING_ARGS,qks=nei.ERR_STREAM_DESTROYED;function DGr(e){if(e)throw e}function Kks(e){return e.setHeader&&typeof e.abort=="function"}function Yks(e,i,A,c){c=Lks(c);var f=!1;e.on("close",function(){f=!0}),hhn===void 0&&(hhn=GIn),hhn(e,{readable:i,writable:A},function(g){if(g)return c(g);f=!0,c()});var l=!1;return function(g){if(!f&&!l){if(l=!0,Kks(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();c(g||new qks("pipe"))}}}function RGr(e){e()}function Vks(e,i){return e.pipe(i)}function zks(e){return!e.length||typeof e[e.length-1]!="function"?DGr:e.pop()}function Wks(){for(var e=arguments.length,i=new Array(e),A=0;A<e;A++)i[A]=arguments[A];var c=zks(i);if(Array.isArray(i[0])&&(i=i[0]),i.length<2)throw new Gks("streams");var f,l=i.map(function(g,w){var N=w<i.length-1,F=w>0;return Yks(g,N,F,function(j){f||(f=j),j&&l.forEach(RGr),!N&&(l.forEach(RGr),c(f))})});return i.reduce(Vks)}var Zks=Wks;bEt.exports;(function(e,i){i=e.exports=jjr(),i.Stream=i,i.Readable=i,i.Writable=Xjr(),i.Duplex=ESe(),i.Transform=eei,i.PassThrough=Hks,i.finished=GIn,i.pipeline=Zks})(bEt,bEt.exports);var Xks=bEt.exports,SEt=Pw.Buffer,rei=Xks.Transform,$ks=gm;function jks(e,i){if(!SEt.isBuffer(e)&&typeof e!="string")throw new TypeError(i+" must be a string or a buffer")}function goe(e){rei.call(this),this._block=SEt.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}$ks(goe,rei);goe.prototype._transform=function(e,i,A){var c=null;try{this.update(e,i)}catch(f){c=f}A(c)};goe.prototype._flush=function(e){var i=null;try{this.push(this.digest())}catch(A){i=A}e(i)};goe.prototype.update=function(e,i){if(jks(e,"Data"),this._finalized)throw new Error("Digest already called");SEt.isBuffer(e)||(e=SEt.from(e,i));for(var A=this._block,c=0;this._blockOffset+e.length-c>=this._blockSize;){for(var f=this._blockOffset;f<this._blockSize;)A[f++]=e[c++];this._update(),this._blockOffset=0}for(;c<e.length;)A[this._blockOffset++]=e[c++];for(var l=0,g=e.length*8;g>0;++l)this._length[l]+=g,g=this._length[l]/4294967296|0,g>0&&(this._length[l]-=4294967296*g);return this};goe.prototype._update=function(){throw new Error("_update is not implemented")};goe.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var i=this._digest();e!==void 0&&(i=i.toString(e)),this._block.fill(0),this._blockOffset=0;for(var A=0;A<4;++A)this._length[A]=0;return i};goe.prototype._digest=function(){throw new Error("_digest is not implemented")};var iei=goe,eDs=gm,oei=iei,tDs=Pw.Buffer,nDs=new Array(16);function Vvt(){oei.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}eDs(Vvt,oei);Vvt.prototype._update=function(){for(var e=nDs,i=0;i<16;++i)e[i]=this._block.readInt32LE(i*4);var A=this._a,c=this._b,f=this._c,l=this._d;A=wB(A,c,f,l,e[0],3614090360,7),l=wB(l,A,c,f,e[1],3905402710,12),f=wB(f,l,A,c,e[2],606105819,17),c=wB(c,f,l,A,e[3],3250441966,22),A=wB(A,c,f,l,e[4],4118548399,7),l=wB(l,A,c,f,e[5],1200080426,12),f=wB(f,l,A,c,e[6],2821735955,17),c=wB(c,f,l,A,e[7],4249261313,22),A=wB(A,c,f,l,e[8],1770035416,7),l=wB(l,A,c,f,e[9],2336552879,12),f=wB(f,l,A,c,e[10],4294925233,17),c=wB(c,f,l,A,e[11],2304563134,22),A=wB(A,c,f,l,e[12],1804603682,7),l=wB(l,A,c,f,e[13],4254626195,12),f=wB(f,l,A,c,e[14],2792965006,17),c=wB(c,f,l,A,e[15],1236535329,22),A=QB(A,c,f,l,e[1],4129170786,5),l=QB(l,A,c,f,e[6],3225465664,9),f=QB(f,l,A,c,e[11],643717713,14),c=QB(c,f,l,A,e[0],3921069994,20),A=QB(A,c,f,l,e[5],3593408605,5),l=QB(l,A,c,f,e[10],38016083,9),f=QB(f,l,A,c,e[15],3634488961,14),c=QB(c,f,l,A,e[4],3889429448,20),A=QB(A,c,f,l,e[9],568446438,5),l=QB(l,A,c,f,e[14],3275163606,9),f=QB(f,l,A,c,e[3],4107603335,14),c=QB(c,f,l,A,e[8],1163531501,20),A=QB(A,c,f,l,e[13],2850285829,5),l=QB(l,A,c,f,e[2],4243563512,9),f=QB(f,l,A,c,e[7],1735328473,14),c=QB(c,f,l,A,e[12],2368359562,20),A=kB(A,c,f,l,e[5],4294588738,4),l=kB(l,A,c,f,e[8],2272392833,11),f=kB(f,l,A,c,e[11],1839030562,16),c=kB(c,f,l,A,e[14],4259657740,23),A=kB(A,c,f,l,e[1],2763975236,4),l=kB(l,A,c,f,e[4],1272893353,11),f=kB(f,l,A,c,e[7],4139469664,16),c=kB(c,f,l,A,e[10],3200236656,23),A=kB(A,c,f,l,e[13],681279174,4),l=kB(l,A,c,f,e[0],3936430074,11),f=kB(f,l,A,c,e[3],3572445317,16),c=kB(c,f,l,A,e[6],76029189,23),A=kB(A,c,f,l,e[9],3654602809,4),l=kB(l,A,c,f,e[12],3873151461,11),f=kB(f,l,A,c,e[15],530742520,16),c=kB(c,f,l,A,e[2],3299628645,23),A=DB(A,c,f,l,e[0],4096336452,6),l=DB(l,A,c,f,e[7],1126891415,10),f=DB(f,l,A,c,e[14],2878612391,15),c=DB(c,f,l,A,e[5],4237533241,21),A=DB(A,c,f,l,e[12],1700485571,6),l=DB(l,A,c,f,e[3],2399980690,10),f=DB(f,l,A,c,e[10],4293915773,15),c=DB(c,f,l,A,e[1],2240044497,21),A=DB(A,c,f,l,e[8],1873313359,6),l=DB(l,A,c,f,e[15],4264355552,10),f=DB(f,l,A,c,e[6],2734768916,15),c=DB(c,f,l,A,e[13],1309151649,21),A=DB(A,c,f,l,e[4],4149444226,6),l=DB(l,A,c,f,e[11],3174756917,10),f=DB(f,l,A,c,e[2],718787259,15),c=DB(c,f,l,A,e[9],3951481745,21),this._a=this._a+A|0,this._b=this._b+c|0,this._c=this._c+f|0,this._d=this._d+l|0};Vvt.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=tDs.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};function zvt(e,i){return e<<i|e>>>32-i}function wB(e,i,A,c,f,l,g){return zvt(e+(i&A|~i&c)+f+l|0,g)+i|0}function QB(e,i,A,c,f,l,g){return zvt(e+(i&c|A&~c)+f+l|0,g)+i|0}function kB(e,i,A,c,f,l,g){return zvt(e+(i^A^c)+f+l|0,g)+i|0}function DB(e,i,A,c,f,l,g){return zvt(e+(A^(i|~c))+f+l|0,g)+i|0}var aei=Vvt,ghn=vSe.Buffer,rDs=gm,sei=iei,iDs=new Array(16),zHe=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],WHe=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ZHe=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],XHe=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],$He=[0,1518500249,1859775393,2400959708,2840853838],jHe=[1352829926,1548603684,1836072691,2053994217,0];function Wvt(){sei.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}rDs(Wvt,sei);Wvt.prototype._update=function(){for(var e=iDs,i=0;i<16;++i)e[i]=this._block.readInt32LE(i*4);for(var A=this._a|0,c=this._b|0,f=this._c|0,l=this._d|0,g=this._e|0,w=this._a|0,N=this._b|0,F=this._c|0,j=this._d|0,te=this._e|0,v=0;v<80;v+=1){var ne,Z;v<16?(ne=PGr(A,c,f,l,g,e[zHe[v]],$He[0],ZHe[v]),Z=MGr(w,N,F,j,te,e[WHe[v]],jHe[0],XHe[v])):v<32?(ne=OGr(A,c,f,l,g,e[zHe[v]],$He[1],ZHe[v]),Z=xGr(w,N,F,j,te,e[WHe[v]],jHe[1],XHe[v])):v<48?(ne=NGr(A,c,f,l,g,e[zHe[v]],$He[2],ZHe[v]),Z=NGr(w,N,F,j,te,e[WHe[v]],jHe[2],XHe[v])):v<64?(ne=xGr(A,c,f,l,g,e[zHe[v]],$He[3],ZHe[v]),Z=OGr(w,N,F,j,te,e[WHe[v]],jHe[3],XHe[v])):(ne=MGr(A,c,f,l,g,e[zHe[v]],$He[4],ZHe[v]),Z=PGr(w,N,F,j,te,e[WHe[v]],jHe[4],XHe[v])),A=g,g=l,l=Qfe(f,10),f=c,c=ne,w=te,te=j,j=Qfe(F,10),F=N,N=Z}var R=this._b+f+j|0;this._b=this._c+l+te|0,this._c=this._d+g+w|0,this._d=this._e+A+N|0,this._e=this._a+c+F|0,this._a=R};Wvt.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=ghn.alloc?ghn.alloc(20):new ghn(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};function Qfe(e,i){return e<<i|e>>>32-i}function PGr(e,i,A,c,f,l,g,w){return Qfe(e+(i^A^c)+l+g|0,w)+f|0}function OGr(e,i,A,c,f,l,g,w){return Qfe(e+(i&A|~i&c)+l+g|0,w)+f|0}function NGr(e,i,A,c,f,l,g,w){return Qfe(e+((i|~A)^c)+l+g|0,w)+f|0}function xGr(e,i,A,c,f,l,g,w){return Qfe(e+(i&c|A&~c)+l+g|0,w)+f|0}function MGr(e,i,A,c,f,l,g,w){return Qfe(e+(i^(A|~c))+l+g|0,w)+f|0}var Aei=Wvt,dei={exports:{}},cei=Pw.Buffer;function Zvt(e,i){this._block=cei.alloc(e),this._finalSize=i,this._blockSize=e,this._len=0}Zvt.prototype.update=function(e,i){typeof e=="string"&&(i=i||"utf8",e=cei.from(e,i));for(var A=this._block,c=this._blockSize,f=e.length,l=this._len,g=0;g<f;){for(var w=l%c,N=Math.min(f-g,c-w),F=0;F<N;F++)A[w+F]=e[g+F];l+=N,g+=N,l%c===0&&this._update(A)}return this._len+=f,this};Zvt.prototype.digest=function(e){var i=this._len%this._blockSize;this._block[i]=128,this._block.fill(0,i+1),i>=this._finalSize&&(this._update(this._block),this._block.fill(0));var A=this._len*8;if(A<=4294967295)this._block.writeUInt32BE(A,this._blockSize-4);else{var c=(A&4294967295)>>>0,f=(A-c)/4294967296;this._block.writeUInt32BE(f,this._blockSize-8),this._block.writeUInt32BE(c,this._blockSize-4)}this._update(this._block);var l=this._hash();return e?l.toString(e):l};Zvt.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var VSe=Zvt,oDs=gm,uei=VSe,aDs=Pw.Buffer,sDs=[1518500249,1859775393,-1894007588,-899497514],ADs=new Array(80);function oqe(){this.init(),this._w=ADs,uei.call(this,64,56)}oDs(oqe,uei);oqe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function dDs(e){return e<<5|e>>>27}function cDs(e){return e<<30|e>>>2}function uDs(e,i,A,c){return e===0?i&A|~i&c:e===2?i&A|i&c|A&c:i^A^c}oqe.prototype._update=function(e){for(var i=this._w,A=this._a|0,c=this._b|0,f=this._c|0,l=this._d|0,g=this._e|0,w=0;w<16;++w)i[w]=e.readInt32BE(w*4);for(;w<80;++w)i[w]=i[w-3]^i[w-8]^i[w-14]^i[w-16];for(var N=0;N<80;++N){var F=~~(N/20),j=dDs(A)+uDs(F,c,f,l)+g+i[N]+sDs[F]|0;g=l,l=f,f=cDs(c),c=A,A=j}this._a=A+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=l+this._d|0,this._e=g+this._e|0};oqe.prototype._hash=function(){var e=aDs.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var fDs=oqe,lDs=gm,fei=VSe,hDs=Pw.Buffer,gDs=[1518500249,1859775393,-1894007588,-899497514],pDs=new Array(80);function aqe(){this.init(),this._w=pDs,fei.call(this,64,56)}lDs(aqe,fei);aqe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function yDs(e){return e<<1|e>>>31}function mDs(e){return e<<5|e>>>27}function IDs(e){return e<<30|e>>>2}function CDs(e,i,A,c){return e===0?i&A|~i&c:e===2?i&A|i&c|A&c:i^A^c}aqe.prototype._update=function(e){for(var i=this._w,A=this._a|0,c=this._b|0,f=this._c|0,l=this._d|0,g=this._e|0,w=0;w<16;++w)i[w]=e.readInt32BE(w*4);for(;w<80;++w)i[w]=yDs(i[w-3]^i[w-8]^i[w-14]^i[w-16]);for(var N=0;N<80;++N){var F=~~(N/20),j=mDs(A)+CDs(F,c,f,l)+g+i[N]+gDs[F]|0;g=l,l=f,f=IDs(c),c=A,A=j}this._a=A+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=l+this._d|0,this._e=g+this._e|0};aqe.prototype._hash=function(){var e=hDs.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var _Ds=aqe,EDs=gm,lei=VSe,BDs=Pw.Buffer,vDs=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],bDs=new Array(64);function sqe(){this.init(),this._w=bDs,lei.call(this,64,56)}EDs(sqe,lei);sqe.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function SDs(e,i,A){return A^e&(i^A)}function wDs(e,i,A){return e&i|A&(e|i)}function QDs(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function kDs(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function DDs(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function RDs(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}sqe.prototype._update=function(e){for(var i=this._w,A=this._a|0,c=this._b|0,f=this._c|0,l=this._d|0,g=this._e|0,w=this._f|0,N=this._g|0,F=this._h|0,j=0;j<16;++j)i[j]=e.readInt32BE(j*4);for(;j<64;++j)i[j]=RDs(i[j-2])+i[j-7]+DDs(i[j-15])+i[j-16]|0;for(var te=0;te<64;++te){var v=F+kDs(g)+SDs(g,w,N)+vDs[te]+i[te]|0,ne=QDs(A)+wDs(A,c,f)|0;F=N,N=w,w=g,g=l+v|0,l=f,f=c,c=A,A=v+ne|0}this._a=A+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=l+this._d|0,this._e=g+this._e|0,this._f=w+this._f|0,this._g=N+this._g|0,this._h=F+this._h|0};sqe.prototype._hash=function(){var e=BDs.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var hei=sqe,PDs=gm,ODs=hei,NDs=VSe,xDs=Pw.Buffer,MDs=new Array(64);function Xvt(){this.init(),this._w=MDs,NDs.call(this,64,56)}PDs(Xvt,ODs);Xvt.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Xvt.prototype._hash=function(){var e=xDs.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var TDs=Xvt,UDs=gm,gei=VSe,FDs=Pw.Buffer,TGr=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],JDs=new Array(160);function Aqe(){this.init(),this._w=JDs,gei.call(this,128,112)}UDs(Aqe,gei);Aqe.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function UGr(e,i,A){return A^e&(i^A)}function FGr(e,i,A){return e&i|A&(e|i)}function JGr(e,i){return(e>>>28|i<<4)^(i>>>2|e<<30)^(i>>>7|e<<25)}function HGr(e,i){return(e>>>14|i<<18)^(e>>>18|i<<14)^(i>>>9|e<<23)}function HDs(e,i){return(e>>>1|i<<31)^(e>>>8|i<<24)^e>>>7}function LDs(e,i){return(e>>>1|i<<31)^(e>>>8|i<<24)^(e>>>7|i<<25)}function GDs(e,i){return(e>>>19|i<<13)^(i>>>29|e<<3)^e>>>6}function qDs(e,i){return(e>>>19|i<<13)^(i>>>29|e<<3)^(e>>>6|i<<26)}function p3(e,i){return e>>>0<i>>>0?1:0}Aqe.prototype._update=function(e){for(var i=this._w,A=this._ah|0,c=this._bh|0,f=this._ch|0,l=this._dh|0,g=this._eh|0,w=this._fh|0,N=this._gh|0,F=this._hh|0,j=this._al|0,te=this._bl|0,v=this._cl|0,ne=this._dl|0,Z=this._el|0,R=this._fl|0,M=this._gl|0,U=this._hl|0,E=0;E<32;E+=2)i[E]=e.readInt32BE(E*4),i[E+1]=e.readInt32BE(E*4+4);for(;E<160;E+=2){var Q=i[E-30],H=i[E-15*2+1],re=HDs(Q,H),ee=LDs(H,Q);Q=i[E-2*2],H=i[E-2*2+1];var T=GDs(Q,H),se=qDs(H,Q),p=i[E-7*2],L=i[E-7*2+1],V=i[E-16*2],K=i[E-16*2+1],m=ee+L|0,h=re+p+p3(m,ee)|0;m=m+se|0,h=h+T+p3(m,se)|0,m=m+K|0,h=h+V+p3(m,K)|0,i[E]=h,i[E+1]=m}for(var _=0;_<160;_+=2){h=i[_],m=i[_+1];var b=FGr(A,c,f),O=FGr(j,te,v),J=JGr(A,j),ie=JGr(j,A),G=HGr(g,Z),I=HGr(Z,g),C=TGr[_],D=TGr[_+1],W=UGr(g,w,N),ae=UGr(Z,R,M),ye=U+I|0,Xe=F+G+p3(ye,U)|0;ye=ye+ae|0,Xe=Xe+W+p3(ye,ae)|0,ye=ye+D|0,Xe=Xe+C+p3(ye,D)|0,ye=ye+m|0,Xe=Xe+h+p3(ye,m)|0;var nt=ie+O|0,Ke=J+b+p3(nt,ie)|0;F=N,U=M,N=w,M=R,w=g,R=Z,Z=ne+ye|0,g=l+Xe+p3(Z,ne)|0,l=f,ne=v,f=c,v=te,c=A,te=j,j=ye+nt|0,A=Xe+Ke+p3(j,ye)|0}this._al=this._al+j|0,this._bl=this._bl+te|0,this._cl=this._cl+v|0,this._dl=this._dl+ne|0,this._el=this._el+Z|0,this._fl=this._fl+R|0,this._gl=this._gl+M|0,this._hl=this._hl+U|0,this._ah=this._ah+A+p3(this._al,j)|0,this._bh=this._bh+c+p3(this._bl,te)|0,this._ch=this._ch+f+p3(this._cl,v)|0,this._dh=this._dh+l+p3(this._dl,ne)|0,this._eh=this._eh+g+p3(this._el,Z)|0,this._fh=this._fh+w+p3(this._fl,R)|0,this._gh=this._gh+N+p3(this._gl,M)|0,this._hh=this._hh+F+p3(this._hl,U)|0};Aqe.prototype._hash=function(){var e=FDs.allocUnsafe(64);function i(A,c,f){e.writeInt32BE(A,f),e.writeInt32BE(c,f+4)}return i(this._ah,this._al,0),i(this._bh,this._bl,8),i(this._ch,this._cl,16),i(this._dh,this._dl,24),i(this._eh,this._el,32),i(this._fh,this._fl,40),i(this._gh,this._gl,48),i(this._hh,this._hl,56),e};var pei=Aqe,KDs=gm,YDs=pei,VDs=VSe,zDs=Pw.Buffer,WDs=new Array(160);function $vt(){this.init(),this._w=WDs,VDs.call(this,128,112)}KDs($vt,YDs);$vt.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};$vt.prototype._hash=function(){var e=zDs.allocUnsafe(48);function i(A,c,f){e.writeInt32BE(A,f),e.writeInt32BE(c,f+4)}return i(this._ah,this._al,0),i(this._bh,this._bl,8),i(this._ch,this._cl,16),i(this._dh,this._dl,24),i(this._eh,this._el,32),i(this._fh,this._fl,40),e};var ZDs=$vt,$fe=dei.exports=function e(i){i=i.toLowerCase();var A=$fe[i];if(!A)throw new Error(i+" is not supported (we accept pull requests)");return new A};$fe.sha=fDs;$fe.sha1=_Ds;$fe.sha224=TDs;$fe.sha256=hei;$fe.sha384=ZDs;$fe.sha512=pei;var yei=dei.exports,mei=Pw.Buffer,Iei=wrs.Transform,XDs=Qrs.StringDecoder,$Ds=gm;function VF(e){Iei.call(this),this.hashMode=typeof e=="string",this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}$Ds(VF,Iei);VF.prototype.update=function(e,i,A){typeof e=="string"&&(e=mei.from(e,i));var c=this._update(e);return this.hashMode?this:(A&&(c=this._toString(c,A)),c)};VF.prototype.setAutoPadding=function(){};VF.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};VF.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};VF.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};VF.prototype._transform=function(e,i,A){var c;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(f){c=f}finally{A(c)}};VF.prototype._flush=function(e){var i;try{this.push(this.__final())}catch(A){i=A}e(i)};VF.prototype._finalOrDigest=function(e){var i=this.__final()||mei.alloc(0);return e&&(i=this._toString(i,e,!0)),i};VF.prototype._toString=function(e,i,A){if(this._decoder||(this._decoder=new XDs(i),this._encoding=i),this._encoding!==i)throw new Error("can't switch encodings");var c=this._decoder.write(e);return A&&(c+=this._decoder.end()),c};var qIn=VF,jDs=gm,e7s=aei,t7s=Aei,n7s=yei,Cei=qIn;function jvt(e){Cei.call(this,"digest"),this._hash=e}jDs(jvt,Cei);jvt.prototype._update=function(e){this._hash.update(e)};jvt.prototype._final=function(){return this._hash.digest()};var _ei=function e(i){return i=i.toLowerCase(),i==="md5"?new e7s:i==="rmd160"||i==="ripemd160"?new t7s:new jvt(n7s(i))},r7s=gm,Zue=Pw.Buffer,Eei=qIn,i7s=Zue.alloc(128),J6e=64;function e6t(e,i){Eei.call(this,"digest"),typeof i=="string"&&(i=Zue.from(i)),this._alg=e,this._key=i,i.length>J6e?i=e(i):i.length<J6e&&(i=Zue.concat([i,i7s],J6e));for(var A=this._ipad=Zue.allocUnsafe(J6e),c=this._opad=Zue.allocUnsafe(J6e),f=0;f<J6e;f++)A[f]=i[f]^54,c[f]=i[f]^92;this._hash=[A]}r7s(e6t,Eei);e6t.prototype._update=function(e){this._hash.push(e)};e6t.prototype._final=function(){var e=this._alg(Zue.concat(this._hash));return this._alg(Zue.concat([this._opad,e]))};var o7s=e6t,a7s=aei,s7s=function(e){return new a7s().update(e).digest()},A7s=gm,d7s=o7s,Bei=qIn,HLe=Pw.Buffer,c7s=s7s,Wpn=Aei,Zpn=yei,u7s=HLe.alloc(128);function IGe(e,i){Bei.call(this,"digest"),typeof i=="string"&&(i=HLe.from(i));var A=e==="sha512"||e==="sha384"?128:64;if(this._alg=e,this._key=i,i.length>A){var c=e==="rmd160"?new Wpn:Zpn(e);i=c.update(i).digest()}else i.length<A&&(i=HLe.concat([i,u7s],A));for(var f=this._ipad=HLe.allocUnsafe(A),l=this._opad=HLe.allocUnsafe(A),g=0;g<A;g++)f[g]=i[g]^54,l[g]=i[g]^92;this._hash=e==="rmd160"?new Wpn:Zpn(e),this._hash.update(f)}A7s(IGe,Bei);IGe.prototype._update=function(e){this._hash.update(e)};IGe.prototype._final=function(){var e=this._hash.digest(),i=this._alg==="rmd160"?new Wpn:Zpn(this._alg);return i.update(this._opad).update(e).digest()};var vei=function e(i,A){return i=i.toLowerCase(),i==="rmd160"||i==="ripemd160"?new IGe("rmd160",A):i==="md5"?new d7s(c7s,A):new IGe(i,A)};Object.defineProperty(qvt,"__esModule",{value:!0});var phn=_ei,f7s=vei;function l7s(e){let i=phn("sha256").update(e).digest();try{return phn("rmd160").update(i).digest()}catch(A){return phn("ripemd160").update(i).digest()}}qvt.hash160=l7s;function h7s(e,i){return f7s("sha512",e).update(i).digest()}qvt.hmacSHA512=h7s;var P3t=Pw.Buffer;function g7s(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),A=0;A<i.length;A++)i[A]=255;for(var c=0;c<e.length;c++){var f=e.charAt(c),l=f.charCodeAt(0);if(i[l]!==255)throw new TypeError(f+" is ambiguous");i[l]=c}var g=e.length,w=e.charAt(0),N=Math.log(g)/Math.log(256),F=Math.log(256)/Math.log(g);function j(ne){if((Array.isArray(ne)||ne instanceof Uint8Array)&&(ne=P3t.from(ne)),!P3t.isBuffer(ne))throw new TypeError("Expected Buffer");if(ne.length===0)return"";for(var Z=0,R=0,M=0,U=ne.length;M!==U&&ne[M]===0;)M++,Z++;for(var E=(U-M)*F+1>>>0,Q=new Uint8Array(E);M!==U;){for(var H=ne[M],re=0,ee=E-1;(H!==0||re<R)&&ee!==-1;ee--,re++)H+=256*Q[ee]>>>0,Q[ee]=H%g>>>0,H=H/g>>>0;if(H!==0)throw new Error("Non-zero carry");R=re,M++}for(var T=E-R;T!==E&&Q[T]===0;)T++;for(var se=w.repeat(Z);T<E;++T)se+=e.charAt(Q[T]);return se}function te(ne){if(typeof ne!="string")throw new TypeError("Expected String");if(ne.length===0)return P3t.alloc(0);for(var Z=0,R=0,M=0;ne[Z]===w;)R++,Z++;for(var U=(ne.length-Z)*N+1>>>0,E=new Uint8Array(U);ne[Z];){var Q=i[ne.charCodeAt(Z)];if(Q===255)return;for(var H=0,re=U-1;(Q!==0||H<M)&&re!==-1;re--,H++)Q+=g*E[re]>>>0,E[re]=Q%256>>>0,Q=Q/256>>>0;if(Q!==0)throw new Error("Non-zero carry");M=H,Z++}for(var ee=U-M;ee!==U&&E[ee]===0;)ee++;var T=P3t.allocUnsafe(R+(U-ee));T.fill(0,0,R);for(var se=R;ee!==U;)T[se++]=E[ee++];return T}function v(ne){var Z=te(ne);if(Z)return Z;throw new Error("Non-base"+g+" character")}return{encode:j,decodeUnsafe:te,decode:v}}var p7s=g7s,y7s=p7s,m7s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",I7s=y7s(m7s),yhn=I7s,C7s=Pw.Buffer,_7s=function(e){function i(l){var g=e(l);return yhn.encode(C7s.concat([l,g],l.length+4))}function A(l){var g=l.slice(0,-4),w=l.slice(-4),N=e(g);if(!(w[0]^N[0]|w[1]^N[1]|w[2]^N[2]|w[3]^N[3]))return g}function c(l){var g=yhn.decodeUnsafe(l);if(g)return A(g)}function f(l){var g=yhn.decode(l),w=A(g);if(!w)throw new Error("Invalid checksum");return w}return{encode:i,decode:f,decodeUnsafe:c}},LGr=_ei,E7s=_7s;function B7s(e){var i=LGr("sha256").update(e).digest();return LGr("sha256").update(i).digest()}var bei=E7s(B7s),Aie=vei,v7s=Buffer.alloc(1,1),GGr=Buffer.alloc(1,0);function b7s(e,i,A,c,f){let l=Buffer.alloc(32,0),g=Buffer.alloc(32,1);l=Aie("sha256",l).update(g).update(GGr).update(i).update(e).update(f||"").digest(),g=Aie("sha256",l).update(g).digest(),l=Aie("sha256",l).update(g).update(v7s).update(i).update(e).update(f||"").digest(),g=Aie("sha256",l).update(g).digest(),g=Aie("sha256",l).update(g).digest();let w=g;for(;!c(w)||!A(w);)l=Aie("sha256",l).update(g).update(GGr).digest(),g=Aie("sha256",l).update(g).digest(),g=Aie("sha256",l).update(g).digest(),w=g;return w}var S7s=b7s,w7s=KK,Q7s=GGe.ec,KIn=new Q7s("secp256k1"),k7s=S7s,wEt=Buffer.alloc(32,0),QEt=Buffer.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),qGr=Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),PF=KIn.curve.n,Sei=PF.shrn(1),t6t=KIn.curve.g,n6t="Expected Private",kfe="Expected Point",r6t="Expected Tweak",wei="Expected Hash",D7s="Expected Signature",R7s="Expected Extra Data (32 bytes)";function CGe(e){return Buffer.isBuffer(e)&&e.length===32}function i6t(e){return CGe(e)?e.compare(QEt)<0:!1}function ioe(e){if(!Buffer.isBuffer(e)||e.length<33)return!1;let i=e[0],A=e.slice(1,33);if(A.compare(wEt)===0||A.compare(qGr)>=0)return!1;if((i===2||i===3)&&e.length===33){try{Dfe(e)}catch(f){return!1}return!0}let c=e.slice(33);return c.compare(wEt)===0||c.compare(qGr)>=0?!1:i===4&&e.length===65}function Qei(e){return e[0]!==4}function P7s(e){return ioe(e)?Qei(e):!1}function ooe(e){return CGe(e)?e.compare(wEt)>0&&e.compare(QEt)<0:!1}function O7s(e){let i=e.slice(0,32),A=e.slice(32,64);return Buffer.isBuffer(e)&&e.length===64&&i.compare(QEt)<0&&A.compare(QEt)<0}function dqe(e,i){return e===void 0&&i!==void 0?Qei(i):e===void 0?!0:e}function OR(e){return new w7s(e)}function kEt(e){return e.toArrayLike(Buffer,"be",32)}function Dfe(e){return KIn.curve.decodePoint(e)}function BSe(e,i){return Buffer.from(e._encode(i))}function N7s(e,i,A){if(!ioe(e))throw new TypeError(kfe);if(!ioe(i))throw new TypeError(kfe);let c=Dfe(e),f=Dfe(i),l=c.add(f);if(l.isInfinity())return null;let g=dqe(A,e);return BSe(l,g)}function x7s(e,i,A){if(!ioe(e))throw new TypeError(kfe);if(!i6t(i))throw new TypeError(r6t);let c=dqe(A,e),f=Dfe(e);if(i.compare(wEt)===0)return BSe(f,c);let l=OR(i),g=t6t.mul(l),w=f.add(g);return w.isInfinity()?null:BSe(w,c)}function M7s(e,i){if(!ioe(e))throw new TypeError(kfe);let A=Dfe(e);if(A.isInfinity())throw new TypeError(kfe);let c=dqe(i,e);return BSe(A,c)}function T7s(e,i){if(!ooe(e))throw new TypeError(n6t);let A=OR(e),c=t6t.mul(A);if(c.isInfinity())return null;let f=dqe(i);return BSe(c,f)}function U7s(e,i,A){if(!ioe(e))throw new TypeError(kfe);if(!i6t(i))throw new TypeError(r6t);let c=dqe(A,e),f=Dfe(e),l=OR(i),g=f.mul(l);return g.isInfinity()?null:BSe(g,c)}function F7s(e,i){if(!ooe(e))throw new TypeError(n6t);if(!i6t(i))throw new TypeError(r6t);let A=OR(e),c=OR(i),f=kEt(A.add(c).umod(PF));return ooe(f)?f:null}function J7s(e,i){if(!ooe(e))throw new TypeError(n6t);if(!i6t(i))throw new TypeError(r6t);let A=OR(e),c=OR(i),f=kEt(A.sub(c).umod(PF));return ooe(f)?f:null}function H7s(e,i){return kei(e,i)}function L7s(e,i,A){return kei(e,i,A)}function kei(e,i,A){if(!CGe(e))throw new TypeError(wei);if(!ooe(i))throw new TypeError(n6t);if(A!==void 0&&!CGe(A))throw new TypeError(R7s);let c=OR(i),f=OR(e),l,g;k7s(e,i,function(F){let j=OR(F),te=t6t.mul(j);return!(te.isInfinity()||(l=te.x.umod(PF),l.isZero()===0)||(g=j.invm(PF).mul(f.add(c.mul(l))).umod(PF),g.isZero()===0))},ooe,A),g.cmp(Sei)>0&&(g=PF.sub(g));let N=Buffer.allocUnsafe(64);return kEt(l).copy(N,0),kEt(g).copy(N,32),N}function G7s(e,i,A,c){if(!CGe(e))throw new TypeError(wei);if(!ioe(i))throw new TypeError(kfe);if(!O7s(A))throw new TypeError(D7s);let f=Dfe(i),l=OR(A.slice(0,32)),g=OR(A.slice(32,64));if(c&&g.cmp(Sei)>0||l.gtn(0)<=0||g.gtn(0)<=0)return!1;let w=OR(e),N=g.invm(PF),F=w.mul(N).umod(PF),j=l.mul(N).umod(PF),te=t6t.mulAdd(F,f,j);return te.isInfinity()?!1:te.x.umod(PF).eq(l)}var q7s={isPoint:ioe,isPointCompressed:P7s,isPrivate:ooe,pointAdd:N7s,pointAddScalar:x7s,pointCompress:M7s,pointFromScalar:T7s,pointMultiply:U7s,privateAdd:F7s,privateSub:J7s,sign:H7s,signWithEntropy:L7s,verify:G7s},_Ge={Array:function(e){return e!=null&&e.constructor===Array},Boolean:function(e){return typeof e=="boolean"},Function:function(e){return typeof e=="function"},Nil:function(e){return e==null},Number:function(e){return typeof e=="number"},Object:function(e){return typeof e=="object"},String:function(e){return typeof e=="string"},"":function(){return!0}};_Ge.Null=_Ge.Nil;for(mhn in _Ge)_Ge[mhn].toJSON=function(e){return e}.bind(null,mhn);var mhn,YIn=_Ge,Afe=YIn;function Dei(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function VIn(e){return Afe.Nil(e)?"":Dei(e.constructor)}function K7s(e){return Afe.Function(e)?"":Afe.String(e)?JSON.stringify(e):e&&Afe.Object(e)?"":e}function zIn(e,i){Error.captureStackTrace&&Error.captureStackTrace(e,i)}function DEt(e){return Afe.Function(e)?e.toJSON?e.toJSON():Dei(e):Afe.Array(e)?"Array":e&&Afe.Object(e)?"Object":e!==void 0?e:""}function Rei(e,i,A){var c=K7s(i);return"Expected "+DEt(e)+", got"+(A!==""?" "+A:"")+(c!==""?" "+c:"")}function AW(e,i,A){A=A||VIn(i),this.message=Rei(e,i,A),zIn(this,AW),this.__type=e,this.__value=i,this.__valueTypeName=A}AW.prototype=Object.create(Error.prototype);AW.prototype.constructor=AW;function Y7s(e,i,A,c,f){var l='" of type ';return i==="key"&&(l='" with key type '),Rei('property "'+DEt(A)+l+DEt(e),c,f)}function U8e(e,i,A,c,f){e?(f=f||VIn(c),this.message=Y7s(e,A,i,c,f)):this.message='Unexpected property "'+i+'"',zIn(this,AW),this.__label=A,this.__property=i,this.__type=e,this.__value=c,this.__valueTypeName=f}U8e.prototype=Object.create(Error.prototype);U8e.prototype.constructor=AW;function V7s(e,i){return new AW(e,{},i)}function z7s(e,i,A){return e instanceof U8e?(i=i+"."+e.__property,e=new U8e(e.__type,i,e.__label,e.__value,e.__valueTypeName)):e instanceof AW&&(e=new U8e(e.__type,i,A,e.__value,e.__valueTypeName)),zIn(e),e}var Pei={TfTypeError:AW,TfPropertyTypeError:U8e,tfCustomError:V7s,tfSubError:z7s,tfJSON:DEt,getValueTypeName:VIn},Ihn,KGr;function W7s(){if(KGr)return Ihn;KGr=1;var e=YIn,i=Pei;function A(ee){return Buffer.isBuffer(ee)}function c(ee){return typeof ee=="string"&&/^([0-9a-f]{2})+$/i.test(ee)}function f(ee,T){var se=ee.toJSON();function p(L){if(!ee(L))return!1;if(L.length===T)return!0;throw i.tfCustomError(se+"(Length: "+T+")",se+"(Length: "+L.length+")")}return p.toJSON=function(){return se},p}var l=f.bind(null,e.Array),g=f.bind(null,A),w=f.bind(null,c),N=f.bind(null,e.String);function F(ee,T,se){se=se||e.Number;function p(L,V){return se(L,V)&&L>ee&&L<T}return p.toJSON=function(){return`${se.toJSON()} between [${ee}, ${T}]`},p}var j=Math.pow(2,53)-1;function te(ee){return typeof ee=="number"&&isFinite(ee)}function v(ee){return ee<<24>>24===ee}function ne(ee){return ee<<16>>16===ee}function Z(ee){return(ee|0)===ee}function R(ee){return typeof ee=="number"&&ee>=-j&&ee<=j&&Math.floor(ee)===ee}function M(ee){return(ee&255)===ee}function U(ee){return(ee&65535)===ee}function E(ee){return ee>>>0===ee}function Q(ee){return typeof ee=="number"&&ee>=0&&ee<=j&&Math.floor(ee)===ee}var H={ArrayN:l,Buffer:A,BufferN:g,Finite:te,Hex:c,HexN:w,Int8:v,Int16:ne,Int32:Z,Int53:R,Range:F,StringN:N,UInt8:M,UInt16:U,UInt32:E,UInt53:Q};for(var re in H)H[re].toJSON=function(ee){return ee}.bind(null,re);return Ihn=H,Ihn}var cqe=Pei,fE=YIn,Gz=cqe.tfJSON,Oei=cqe.TfTypeError,Nei=cqe.TfPropertyTypeError,eLe=cqe.tfSubError,Z7s=cqe.getValueTypeName,qz={arrayOf:function e(i,A){i=$q(i),A=A||{};function c(f,l){return!fE.Array(f)||fE.Nil(f)||A.minLength!==void 0&&f.length<A.minLength||A.maxLength!==void 0&&f.length>A.maxLength||A.length!==void 0&&f.length!==A.length?!1:f.every(function(g,w){try{return Ew(i,g,l)}catch(N){throw eLe(N,w)}})}return c.toJSON=function(){var f="["+Gz(i)+"]";return A.length!==void 0?f+="{"+A.length+"}":(A.minLength!==void 0||A.maxLength!==void 0)&&(f+="{"+(A.minLength===void 0?0:A.minLength)+","+(A.maxLength===void 0?1/0:A.maxLength)+"}"),f},c},maybe:function e(i){i=$q(i);function A(c,f){return fE.Nil(c)||i(c,f,e)}return A.toJSON=function(){return"?"+Gz(i)},A},map:function e(i,A){i=$q(i),A&&(A=$q(A));function c(f,l){if(!fE.Object(f)||fE.Nil(f))return!1;for(var g in f){try{A&&Ew(A,g,l)}catch(N){throw eLe(N,g,"key")}try{var w=f[g];Ew(i,w,l)}catch(N){throw eLe(N,g)}}return!0}return A?c.toJSON=function(){return"{"+Gz(A)+": "+Gz(i)+"}"}:c.toJSON=function(){return"{"+Gz(i)+"}"},c},object:function e(i){var A={};for(var c in i)A[c]=$q(i[c]);function f(l,g){if(!fE.Object(l)||fE.Nil(l))return!1;var w;try{for(w in A){var N=A[w],F=l[w];Ew(N,F,g)}}catch(j){throw eLe(j,w)}if(g){for(w in l)if(!A[w])throw new Nei(void 0,w)}return!0}return f.toJSON=function(){return Gz(A)},f},anyOf:function e(){var i=[].slice.call(arguments).map($q);function A(c,f){return i.some(function(l){try{return Ew(l,c,f)}catch(g){return!1}})}return A.toJSON=function(){return i.map(Gz).join("|")},A},allOf:function e(){var i=[].slice.call(arguments).map($q);function A(c,f){return i.every(function(l){try{return Ew(l,c,f)}catch(g){return!1}})}return A.toJSON=function(){return i.map(Gz).join(" & ")},A},quacksLike:function e(i){function A(c){return i===Z7s(c)}return A.toJSON=function(){return i},A},tuple:function e(){var i=[].slice.call(arguments).map($q);function A(c,f){return fE.Nil(c)||fE.Nil(c.length)||f&&c.length!==i.length?!1:i.every(function(l,g){try{return Ew(l,c[g],f)}catch(w){throw eLe(w,g)}})}return A.toJSON=function(){return"("+i.map(Gz).join(", ")+")"},A},value:function e(i){function A(c){return c===i}return A.toJSON=function(){return i},A}};qz.oneOf=qz.anyOf;function $q(e){if(fE.String(e))return e[0]==="?"?qz.maybe(e.slice(1)):fE[e]||qz.quacksLike(e);if(e&&fE.Object(e)){if(fE.Array(e)){if(e.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return qz.arrayOf(e[0])}return qz.object(e)}else if(fE.Function(e))return e;return qz.value(e)}function Ew(e,i,A,c){if(fE.Function(e)){if(e(i,A))return!0;throw new Oei(c||e,i)}return Ew($q(e),i,A)}for(eW in fE)Ew[eW]=fE[eW];var eW;for(eW in qz)Ew[eW]=qz[eW];var YGr=W7s();for(eW in YGr)Ew[eW]=YGr[eW];Ew.compile=$q;Ew.TfTypeError=Oei;Ew.TfPropertyTypeError=Nei;var X7s=Ew,Xpn=bei;function xei(e,i){if(i!==void 0&&e[0]!==i)throw new Error("Invalid network version");if(e.length===33)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(e.length!==34)throw new Error("Invalid WIF length");if(e[33]!==1)throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function $pn(e,i,A){var c=new Buffer(A?34:33);return c.writeUInt8(e,0),i.copy(c,1),A&&(c[33]=1),c}function $7s(e,i){return xei(Xpn.decode(e),i)}function j7s(e,i,A){return typeof e=="number"?Xpn.encode($pn(e,i,A)):Xpn.encode($pn(e.version,e.privateKey,e.compressed))}var eRs={decode:$7s,decodeRaw:xei,encode:j7s,encodeRaw:$pn};Object.defineProperty(YSe,"__esModule",{value:!0});var jpn=qvt,Mei=bei,jq=q7s,pE=X7s,tRs=eRs,eyn=pE.BufferN(32),nRs=pE.compile({wif:pE.UInt8,bip32:{public:pE.UInt32,private:pE.UInt32}}),o6t={messagePrefix:`Bitcoin Signed Message:
264
- `,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},VGr=2147483648,rRs=Math.pow(2,31)-1;function iRs(e){return pE.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)!==null}function oRs(e){return pE.UInt32(e)&&e<=rRs}var REt=class{constructor(i,A,c,f,l=0,g=0,w=0){this.__D=i,this.__Q=A,this.chainCode=c,this.network=f,this.__DEPTH=l,this.__INDEX=g,this.__PARENT_FINGERPRINT=w,pE(nRs,f),this.lowR=!1}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get publicKey(){return this.__Q===void 0&&(this.__Q=jq.pointFromScalar(this.__D,!0)),this.__Q}get privateKey(){return this.__D}get identifier(){return jpn.hash160(this.publicKey)}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return this.__D===void 0}neutered(){return PEt(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){let i=this.network,A=this.isNeutered()?i.bip32.public:i.bip32.private,c=Buffer.allocUnsafe(78);return c.writeUInt32BE(A,0),c.writeUInt8(this.depth,4),c.writeUInt32BE(this.parentFingerprint,5),c.writeUInt32BE(this.index,9),this.chainCode.copy(c,13),this.isNeutered()?this.publicKey.copy(c,45):(c.writeUInt8(0,45),this.privateKey.copy(c,46)),Mei.encode(c)}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return tRs.encode(this.network.wif,this.privateKey,!0)}derive(i){pE(pE.UInt32,i);let A=i>=VGr,c=Buffer.allocUnsafe(37);if(A){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");c[0]=0,this.privateKey.copy(c,1),c.writeUInt32BE(i,33)}else this.publicKey.copy(c,0),c.writeUInt32BE(i,33);let f=jpn.hmacSHA512(this.chainCode,c),l=f.slice(0,32),g=f.slice(32);if(!jq.isPrivate(l))return this.derive(i+1);let w;if(this.isNeutered()){let N=jq.pointAddScalar(this.publicKey,l,!0);if(N===null)return this.derive(i+1);w=PEt(N,g,this.network,this.depth+1,i,this.fingerprint.readUInt32BE(0))}else{let N=jq.privateAdd(this.privateKey,l);if(N==null)return this.derive(i+1);w=WIn(N,g,this.network,this.depth+1,i,this.fingerprint.readUInt32BE(0))}return w}deriveHardened(i){return pE(oRs,i),this.derive(i+VGr)}derivePath(i){pE(iRs,i);let A=i.split("/");if(A[0]==="m"){if(this.parentFingerprint)throw new TypeError("Expected master, got child");A=A.slice(1)}return A.reduce((c,f)=>{let l;return f.slice(-1)==="'"?(l=parseInt(f.slice(0,-1),10),c.deriveHardened(l)):(l=parseInt(f,10),c.derive(l))},this)}sign(i,A){if(!this.privateKey)throw new Error("Missing private key");if(A===void 0&&(A=this.lowR),A===!1)return jq.sign(i,this.privateKey);{let c=jq.sign(i,this.privateKey),f=Buffer.alloc(32,0),l=0;for(;c[0]>127;)l++,f.writeUIntLE(l,0,6),c=jq.signWithEntropy(i,this.privateKey,f);return c}}verify(i,A){return jq.verify(i,this.publicKey,A)}};function aRs(e,i){let A=Mei.decode(e);if(A.length!==78)throw new TypeError("Invalid buffer length");i=i||o6t;let c=A.readUInt32BE(0);if(c!==i.bip32.private&&c!==i.bip32.public)throw new TypeError("Invalid network version");let f=A[4],l=A.readUInt32BE(5);if(f===0&&l!==0)throw new TypeError("Invalid parent fingerprint");let g=A.readUInt32BE(9);if(f===0&&g!==0)throw new TypeError("Invalid index");let w=A.slice(13,45),N;if(c===i.bip32.private){if(A.readUInt8(45)!==0)throw new TypeError("Invalid private key");let F=A.slice(46,78);N=WIn(F,w,i,f,g,l)}else{let F=A.slice(45,78);N=PEt(F,w,i,f,g,l)}return N}YSe.fromBase58=aRs;function Tei(e,i,A){return WIn(e,i,A)}YSe.fromPrivateKey=Tei;function WIn(e,i,A,c,f,l){if(pE({privateKey:eyn,chainCode:eyn},{privateKey:e,chainCode:i}),A=A||o6t,!jq.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return new REt(e,void 0,i,A,c,f,l)}function sRs(e,i,A){return PEt(e,i,A)}YSe.fromPublicKey=sRs;function PEt(e,i,A,c,f,l){if(pE({publicKey:pE.BufferN(33),chainCode:eyn},{publicKey:e,chainCode:i}),A=A||o6t,!jq.isPoint(e))throw new TypeError("Point is not on the curve");return new REt(void 0,e,i,A,c,f,l)}function ARs(e,i){if(pE(pE.Buffer,e),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");i=i||o6t;let A=jpn.hmacSHA512(Buffer.from("Bitcoin seed","utf8"),e),c=A.slice(0,32),f=A.slice(32);return Tei(c,f,i)}YSe.fromSeed=ARs;Object.defineProperty(iqe,"__esModule",{value:!0});var a6t=YSe,dRs=iqe.fromSeed=a6t.fromSeed;iqe.fromBase58=a6t.fromBase58;iqe.fromPublicKey=a6t.fromPublicKey;iqe.fromPrivateKey=a6t.fromPrivateKey;var Ph={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function nM(e,i){if(!e)throw new Error(i)}function H2(e,i,A){if(nM(i instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),A!==void 0)if(Array.isArray(A)){let c=A.join(", "),f=`Expected ${e} to be an Uint8Array with length [${c}]`;nM(A.includes(i.length),f)}else{let c=`Expected ${e} to be an Uint8Array with length ${A}`;nM(i.length===A,c)}}function Tue(e){nM(K6e(e)==="Boolean","Expected compressed to be a Boolean")}function kF(e=A=>new Uint8Array(A),i){return typeof e=="function"&&(e=e(i)),H2("output",e,i),e}function K6e(e){return Object.prototype.toString.call(e).slice(8,-1)}var cRs=e=>({contextRandomize(i){switch(nM(i===null||i instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),i!==null&&H2("seed",i,32),e.contextRandomize(i)){case 1:throw new Error(Ph.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(i){return H2("private key",i,32),e.privateKeyVerify(i)===0},privateKeyNegate(i){switch(H2("private key",i,32),e.privateKeyNegate(i)){case 0:return i;case 1:throw new Error(Ph.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(i,A){switch(H2("private key",i,32),H2("tweak",A,32),e.privateKeyTweakAdd(i,A)){case 0:return i;case 1:throw new Error(Ph.TWEAK_ADD)}},privateKeyTweakMul(i,A){switch(H2("private key",i,32),H2("tweak",A,32),e.privateKeyTweakMul(i,A)){case 0:return i;case 1:throw new Error(Ph.TWEAK_MUL)}},publicKeyVerify(i){return H2("public key",i,[33,65]),e.publicKeyVerify(i)===0},publicKeyCreate(i,A=!0,c){switch(H2("private key",i,32),Tue(A),c=kF(c,A?33:65),e.publicKeyCreate(c,i)){case 0:return c;case 1:throw new Error(Ph.SECKEY_INVALID);case 2:throw new Error(Ph.PUBKEY_SERIALIZE)}},publicKeyConvert(i,A=!0,c){switch(H2("public key",i,[33,65]),Tue(A),c=kF(c,A?33:65),e.publicKeyConvert(c,i)){case 0:return c;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.PUBKEY_SERIALIZE)}},publicKeyNegate(i,A=!0,c){switch(H2("public key",i,[33,65]),Tue(A),c=kF(c,A?33:65),e.publicKeyNegate(c,i)){case 0:return c;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.IMPOSSIBLE_CASE);case 3:throw new Error(Ph.PUBKEY_SERIALIZE)}},publicKeyCombine(i,A=!0,c){nM(Array.isArray(i),"Expected public keys to be an Array"),nM(i.length>0,"Expected public keys array will have more than zero items");for(let f of i)H2("public key",f,[33,65]);switch(Tue(A),c=kF(c,A?33:65),e.publicKeyCombine(c,i)){case 0:return c;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.PUBKEY_COMBINE);case 3:throw new Error(Ph.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(i,A,c=!0,f){switch(H2("public key",i,[33,65]),H2("tweak",A,32),Tue(c),f=kF(f,c?33:65),e.publicKeyTweakAdd(f,i,A)){case 0:return f;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.TWEAK_ADD)}},publicKeyTweakMul(i,A,c=!0,f){switch(H2("public key",i,[33,65]),H2("tweak",A,32),Tue(c),f=kF(f,c?33:65),e.publicKeyTweakMul(f,i,A)){case 0:return f;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.TWEAK_MUL)}},signatureNormalize(i){switch(H2("signature",i,64),e.signatureNormalize(i)){case 0:return i;case 1:throw new Error(Ph.SIG_PARSE)}},signatureExport(i,A){H2("signature",i,64),A=kF(A,72);let c={output:A,outputlen:72};switch(e.signatureExport(c,i)){case 0:return A.slice(0,c.outputlen);case 1:throw new Error(Ph.SIG_PARSE);case 2:throw new Error(Ph.IMPOSSIBLE_CASE)}},signatureImport(i,A){switch(H2("signature",i),A=kF(A,64),e.signatureImport(A,i)){case 0:return A;case 1:throw new Error(Ph.SIG_PARSE);case 2:throw new Error(Ph.IMPOSSIBLE_CASE)}},ecdsaSign(i,A,c={},f){H2("message",i,32),H2("private key",A,32),nM(K6e(c)==="Object","Expected options to be an Object"),c.data!==void 0&&H2("options.data",c.data),c.noncefn!==void 0&&nM(K6e(c.noncefn)==="Function","Expected options.noncefn to be a Function"),f=kF(f,64);let l={signature:f,recid:null};switch(e.ecdsaSign(l,i,A,c.data,c.noncefn)){case 0:return l;case 1:throw new Error(Ph.SIGN);case 2:throw new Error(Ph.IMPOSSIBLE_CASE)}},ecdsaVerify(i,A,c){switch(H2("signature",i,64),H2("message",A,32),H2("public key",c,[33,65]),e.ecdsaVerify(i,A,c)){case 0:return!0;case 3:return!1;case 1:throw new Error(Ph.SIG_PARSE);case 2:throw new Error(Ph.PUBKEY_PARSE)}},ecdsaRecover(i,A,c,f=!0,l){switch(H2("signature",i,64),nM(K6e(A)==="Number"&&A>=0&&A<=3,"Expected recovery id to be a Number within interval [0, 3]"),H2("message",c,32),Tue(f),l=kF(l,f?33:65),e.ecdsaRecover(l,i,A,c)){case 0:return l;case 1:throw new Error(Ph.SIG_PARSE);case 2:throw new Error(Ph.RECOVER);case 3:throw new Error(Ph.IMPOSSIBLE_CASE)}},ecdh(i,A,c={},f){switch(H2("public key",i,[33,65]),H2("private key",A,32),nM(K6e(c)==="Object","Expected options to be an Object"),c.data!==void 0&&H2("options.data",c.data),c.hashfn!==void 0?(nM(K6e(c.hashfn)==="Function","Expected options.hashfn to be a Function"),c.xbuf!==void 0&&H2("options.xbuf",c.xbuf,32),c.ybuf!==void 0&&H2("options.ybuf",c.ybuf,32),H2("output",f)):f=kF(f,32),e.ecdh(f,i,A,c.data,c.hashfn,c.xbuf,c.ybuf)){case 0:return f;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.ECDH)}}}),uRs=GGe.ec,eK=new uRs("secp256k1"),y2=eK.curve,Yg=y2.n.constructor;function fRs(e,i){let A=new Yg(i);if(A.cmp(y2.p)>=0)return null;A=A.toRed(y2.red);let c=A.redSqr().redIMul(A).redIAdd(y2.b).redSqrt();return e===3!==c.isOdd()&&(c=c.redNeg()),eK.keyPair({pub:{x:A,y:c}})}function lRs(e,i,A){let c=new Yg(i),f=new Yg(A);if(c.cmp(y2.p)>=0||f.cmp(y2.p)>=0||(c=c.toRed(y2.red),f=f.toRed(y2.red),(e===6||e===7)&&f.isOdd()!==(e===7)))return null;let l=c.redSqr().redIMul(c);return f.redSqr().redISub(l.redIAdd(y2.b)).isZero()?eK.keyPair({pub:{x:c,y:f}}):null}function die(e){let i=e[0];switch(i){case 2:case 3:return e.length!==33?null:fRs(i,e.subarray(1,33));case 4:case 6:case 7:return e.length!==65?null:lRs(i,e.subarray(1,33),e.subarray(33,65));default:return null}}function Uue(e,i){let A=i.encode(null,e.length===33);for(let c=0;c<e.length;++c)e[c]=A[c]}var hRs={contextRandomize(){return 0},privateKeyVerify(e){let i=new Yg(e);return i.cmp(y2.n)<0&&!i.isZero()?0:1},privateKeyNegate(e){let i=new Yg(e),A=y2.n.sub(i).umod(y2.n).toArrayLike(Uint8Array,"be",32);return e.set(A),0},privateKeyTweakAdd(e,i){let A=new Yg(i);if(A.cmp(y2.n)>=0||(A.iadd(new Yg(e)),A.cmp(y2.n)>=0&&A.isub(y2.n),A.isZero()))return 1;let c=A.toArrayLike(Uint8Array,"be",32);return e.set(c),0},privateKeyTweakMul(e,i){let A=new Yg(i);if(A.cmp(y2.n)>=0||A.isZero())return 1;A.imul(new Yg(e)),A.cmp(y2.n)>=0&&(A=A.umod(y2.n));let c=A.toArrayLike(Uint8Array,"be",32);return e.set(c),0},publicKeyVerify(e){return die(e)===null?1:0},publicKeyCreate(e,i){let A=new Yg(i);if(A.cmp(y2.n)>=0||A.isZero())return 1;let c=eK.keyFromPrivate(i).getPublic();return Uue(e,c),0},publicKeyConvert(e,i){let A=die(i);if(A===null)return 1;let c=A.getPublic();return Uue(e,c),0},publicKeyNegate(e,i){let A=die(i);if(A===null)return 1;let c=A.getPublic();return c.y=c.y.redNeg(),Uue(e,c),0},publicKeyCombine(e,i){let A=new Array(i.length);for(let f=0;f<i.length;++f)if(A[f]=die(i[f]),A[f]===null)return 1;let c=A[0].getPublic();for(let f=1;f<A.length;++f)c=c.add(A[f].pub);return c.isInfinity()?2:(Uue(e,c),0)},publicKeyTweakAdd(e,i,A){let c=die(i);if(c===null)return 1;if(A=new Yg(A),A.cmp(y2.n)>=0)return 2;let f=c.getPublic().add(y2.g.mul(A));return f.isInfinity()?2:(Uue(e,f),0)},publicKeyTweakMul(e,i,A){let c=die(i);if(c===null)return 1;if(A=new Yg(A),A.cmp(y2.n)>=0||A.isZero())return 2;let f=c.getPublic().mul(A);return Uue(e,f),0},signatureNormalize(e){let i=new Yg(e.subarray(0,32)),A=new Yg(e.subarray(32,64));return i.cmp(y2.n)>=0||A.cmp(y2.n)>=0?1:(A.cmp(eK.nh)===1&&e.set(y2.n.sub(A).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,i){let A=i.subarray(0,32),c=i.subarray(32,64);if(new Yg(A).cmp(y2.n)>=0||new Yg(c).cmp(y2.n)>=0)return 1;let{output:f}=e,l=f.subarray(4,37);l[0]=0,l.set(A,1);let g=33,w=0;for(;g>1&&l[w]===0&&!(l[w+1]&128);--g,++w);if(l=l.subarray(w),l[0]&128||g>1&&l[0]===0&&!(l[1]&128))return 1;let N=f.subarray(39,72);N[0]=0,N.set(c,1);let F=33,j=0;for(;F>1&&N[j]===0&&!(N[j+1]&128);--F,++j);return N=N.subarray(j),N[0]&128||F>1&&N[0]===0&&!(N[1]&128)?1:(e.outputlen=6+g+F,f[0]=48,f[1]=e.outputlen-2,f[2]=2,f[3]=l.length,f.set(l,4),f[4+g]=2,f[5+g]=N.length,f.set(N,6+g),0)},signatureImport(e,i){if(i.length<8||i.length>72||i[0]!==48||i[1]!==i.length-2||i[2]!==2)return 1;let A=i[3];if(A===0||5+A>=i.length||i[4+A]!==2)return 1;let c=i[5+A];if(c===0||6+A+c!==i.length||i[4]&128||A>1&&i[4]===0&&!(i[5]&128)||i[A+6]&128||c>1&&i[A+6]===0&&!(i[A+7]&128))return 1;let f=i.subarray(4,4+A);if(f.length===33&&f[0]===0&&(f=f.subarray(1)),f.length>32)return 1;let l=i.subarray(6+A);if(l.length===33&&l[0]===0&&(l=l.slice(1)),l.length>32)throw new Error("S length is too long");let g=new Yg(f);g.cmp(y2.n)>=0&&(g=new Yg(0));let w=new Yg(i.subarray(6+A));return w.cmp(y2.n)>=0&&(w=new Yg(0)),e.set(g.toArrayLike(Uint8Array,"be",32),0),e.set(w.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,i,A,c,f){if(f){let w=f;f=N=>{let F=w(i,A,null,c,N);if(!(F instanceof Uint8Array&&F.length===32))throw new Error("This is the way");return new Yg(F)}}let l=new Yg(A);if(l.cmp(y2.n)>=0||l.isZero())return 1;let g;try{g=eK.sign(i,A,{canonical:!0,k:f,pers:c})}catch(w){return 1}return e.signature.set(g.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(g.s.toArrayLike(Uint8Array,"be",32),32),e.recid=g.recoveryParam,0},ecdsaVerify(e,i,A){let c={r:e.subarray(0,32),s:e.subarray(32,64)},f=new Yg(c.r),l=new Yg(c.s);if(f.cmp(y2.n)>=0||l.cmp(y2.n)>=0)return 1;if(l.cmp(eK.nh)===1||f.isZero()||l.isZero())return 3;let g=die(A);if(g===null)return 2;let w=g.getPublic();return eK.verify(i,c,w)?0:3},ecdsaRecover(e,i,A,c){let f={r:i.slice(0,32),s:i.slice(32,64)},l=new Yg(f.r),g=new Yg(f.s);if(l.cmp(y2.n)>=0||g.cmp(y2.n)>=0)return 1;if(l.isZero()||g.isZero())return 2;let w;try{w=eK.recoverPubKey(c,f,A)}catch(N){return 2}return Uue(e,w),0},ecdh(e,i,A,c,f,l,g){let w=die(i);if(w===null)return 1;let N=new Yg(A);if(N.cmp(y2.n)>=0||N.isZero())return 2;let F=w.getPublic().mul(N);if(f===void 0){let j=F.encode(null,!0),te=eK.hash().update(j).digest();for(let v=0;v<32;++v)e[v]=te[v]}else{l||(l=new Uint8Array(32));let j=F.getX().toArray("be",32);for(let Z=0;Z<32;++Z)l[Z]=j[Z];g||(g=new Uint8Array(32));let te=F.getY().toArray("be",32);for(let Z=0;Z<32;++Z)g[Z]=te[Z];let v=f(l,g,c);if(!(v instanceof Uint8Array&&v.length===e.length))return 2;e.set(v)}return 0}},gRs=cRs(hRs);function s6t(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function pRs(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function hMs(...e){let i=l=>l,A=(l,g)=>w=>l(g(w)),c=e.map(l=>l.encode).reduceRight(A,i),f=e.map(l=>l.decode).reduce(A,i);return{encode:c,decode:f}}function gMs(e){return{encode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return i.map(A=>{if(A<0||A>=e.length)throw new Error(`Digit index outside alphabet: ${A} (alphabet: ${e.length})`);return e[A]})},decode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="string")throw new Error("alphabet.decode input should be array of strings");return i.map(A=>{if(typeof A!="string")throw new Error(`alphabet.decode: not string element=${A}`);let c=e.indexOf(A);if(c===-1)throw new Error(`Unknown letter: "${A}". Allowed: ${e}`);return c})}}}function pMs(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="string")throw new Error("join.encode input should be array of strings");for(let A of i)if(typeof A!="string")throw new Error(`join.encode: non-string input=${A}`);return i.join(e)},decode:i=>{if(typeof i!="string")throw new Error("join.decode input should be string");return i.split(e)}}}function yMs(e,i="="){if(typeof i!="string")throw new Error("padding chr should be string");return{encode(A){if(!Array.isArray(A)||A.length&&typeof A[0]!="string")throw new Error("padding.encode input should be array of strings");for(let c of A)if(typeof c!="string")throw new Error(`padding.encode: non-string input=${c}`);for(;A.length*e%8;)A.push(i);return A},decode(A){if(!Array.isArray(A)||A.length&&typeof A[0]!="string")throw new Error("padding.encode input should be array of strings");for(let f of A)if(typeof f!="string")throw new Error(`padding.decode: non-string input=${f}`);let c=A.length;if(c*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;c>0&&A[c-1]===i;c--)if(!((c-1)*e%8))throw new Error("Invalid padding: string has too much padding");return A.slice(0,c)}}}function mMs(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:i=>i,decode:i=>e(i)}}var Uei=(e,i)=>i?Uei(i,e%i):e,OEt=(e,i)=>e+(i-Uei(e,i));function zGr(e,i,A,c){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(i<=0||i>32)throw new Error(`convertRadix2: wrong from=${i}`);if(A<=0||A>32)throw new Error(`convertRadix2: wrong to=${A}`);if(OEt(i,A)>32)throw new Error(`convertRadix2: carry overflow from=${i} to=${A} carryBits=${OEt(i,A)}`);let f=0,l=0,g=hi(2,A)-1,w=[];for(let N of e){if(N>=hi(2,i))throw new Error(`convertRadix2: invalid data word=${N} from=${i}`);if(f=f<<i|N,l+i>32)throw new Error(`convertRadix2: carry overflow pos=${l} from=${i}`);for(l+=i;l>=A;l-=A)w.push((f>>l-A&g)>>>0);f&=hi(2,l)-1}if(f=f<<A-l&g,!c&&l>=i)throw new Error("Excess padding");if(!c&&f)throw new Error(`Non-zero padding: ${f}`);return c&&l>0&&w.push(f>>>0),w}function IMs(e,i=!1){if(e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(OEt(8,e)>32||OEt(e,8)>32)throw new Error("radix2: carry overflow");return{encode:A=>{if(!pRs(A))throw new Error("radix2.encode input should be Uint8Array");return zGr(Array.from(A),8,e,!i)},decode:A=>{if(!Array.isArray(A)||A.length&&typeof A[0]!="number")throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(zGr(A,e,8,i))}}}function Fei(e){let i=e.startsWith("m/")?e:`m/${e}`;return bD.stringToPath(i)}var F8e;(function(e){e.TRANSFER="transfer"})(F8e||(F8e={}));var tyn=class extends f1n{constructor(i){super(i.chain,i),this.clientUrls=i.clientUrls,this.prefix=this.getPrefix(this.getNetwork()),this.defaultDecimals=i.defaultDecimals,this.defaultFee=i.defaultFee,this.baseDenom=i.baseDenom,this.registry=new MF.Registry([...$3t.defaultRegistryTypes,...i.registryTypes]),this.startgateClient=new V_t(()=>this.connectClient(this.clientUrls[i.network||E3.Mainnet]))}connectClient(i){return Zre(this,void 0,void 0,function*(){return $3t.StargateClient.connect(i)})}setNetwork(i){super.setNetwork(i),this.startgateClient=new V_t(()=>this.connectClient(this.clientUrls[i])),this.prefix=this.getPrefix(i)}splitAmountAndDenom(i){let A=[];return i.forEach(c=>{let f=/^(\d+)(.*)$/,l=c.match(f);if(l){let g=l[1],w=l[2];A.push({amount:g,denom:w})}}),A}mapIndexedTxToTx(i){return Zre(this,void 0,void 0,function*(){let A=new Map,c=new Map;i.events.slice(7).forEach(N=>{if(N.type==="transfer"){let F=N.attributes.find(v=>v.key==="amount"),j=N.attributes.find(v=>v.key==="sender"),te=N.attributes.find(v=>v.key==="recipient");try{let v=F.value.split(","),ne=this.splitAmountAndDenom(v),Z={};ne.forEach(R=>{R.denom in Z?Z[R.denom]=Z[R.denom].plus(Yz(R.amount,this.defaultDecimals)):Z[R.denom]=Yz(R.amount,this.defaultDecimals)}),Object.entries(Z).forEach(([R,M])=>{let U=this.assetFromDenom(R);if(U){let E=`${te.value}${SJr(U)}`;if(A.has(E)){let H=A.get(te.value);H.amount=H.amount.plus(M),A.set(E,H)}else A.set(E,{amount:M,asset:U,address:te.value});let Q=`${j.value}${SJr(U)}`;if(c.has(Q)){let H=c.get(Q);H.amount=H.amount.plus(M),c.set(Q,H)}else c.set(Q,{amount:M,asset:U,address:j.value})}})}catch(v){console.error("Error:",v)}}});let f=[];for(let N of A.values()){let F={to:N.address,amount:N.amount,asset:N.asset};f.push(F)}let l=[];for(let N of c.values()){let F={from:N.address,amount:N.amount,asset:N.asset};l.push(F)}let w=yield(yield this.startgateClient.getValue()).getBlock(i.height);return{asset:l[0].asset,from:l,to:f,date:new Date(w.header.time),type:c1n.Transfer,hash:i.hash}})}getFees(){return Promise.resolve(l1n(cGe.FlatFee,this.defaultFee))}hash160(i){let A=O3t.createHash("sha256").update(i).digest();try{return O3t.createHash("rmd160").update(A).digest()}catch(c){return O3t.createHash("ripemd160").update(A).digest()}}getAddress(i){let A=fWr(this.phrase),f=dRs(A).derivePath(this.getFullDerivationPath(i||0));if(!f.privateKey)throw new Error("child does not have a privateKey");let l=gRs.publicKeyCreate(f.privateKey),g=this.hash160(Uint8Array.from(l)),w=p1n.toWords(Buffer.from(g));return p1n.encode(this.prefix,w)}getAddressAsync(i=0){return Zre(this,void 0,void 0,function*(){return this.getAddress(i)})}validateAddress(i){try{let{prefix:A}=K2.fromBech32(i);return A===this.prefix}catch(A){return!1}}getBalance(i,A){return Zre(this,void 0,void 0,function*(){let f=yield(yield this.startgateClient.getValue()).getAllBalances(i),l=[];return f.forEach(g=>{let w=this.assetFromDenom(g.denom);w&&l.push({asset:w,amount:Yz(g.amount,this.getAssetDecimals(w))})}),l})}getTransactions(i){return Zre(this,void 0,void 0,function*(){if(i!=null&&i.startTime||i!=null&&i.limit||i!=null&&i.offset)throw Error("Not supported param limit for this client");let A=yield this.startgateClient.getValue(),c=yield A.searchTx([{key:"message.sender",value:i==null?void 0:i.address}]),l=[...yield A.searchTx([{key:"transfer.recipient",value:i==null?void 0:i.address}]),...c],g=l.map(N=>this.mapIndexedTxToTx(N)),w=yield Promise.all(g);return{total:l.length,txs:w}})}getTransactionData(i,A){return Zre(this,void 0,void 0,function*(){let f=yield(yield this.startgateClient.getValue()).getTx(i);if(!f)throw Error(`Can not find transaction ${i}`);return this.mapIndexedTxToTx(f)})}transfer(i){return Zre(this,void 0,void 0,function*(){let A=yield this.getAddressAsync(i.walletIndex||0),{rawUnsignedTx:c}=yield this.prepareTx({sender:A,recipient:i.recipient,asset:i.asset,amount:i.amount,memo:i.memo}),f=MF.decodeTxRaw(K2.fromBase64(c)),l=yield MF.DirectSecp256k1HdWallet.fromMnemonic(this.phrase,{prefix:this.prefix,hdPaths:[Fei(this.getFullDerivationPath(i.walletIndex||0))]}),g=yield $3t.SigningStargateClient.connectWithSigner(this.clientUrls[this.network],l,{registry:this.registry}),w=f.body.messages.map(F=>({typeUrl:this.getMsgTypeUrlByType(F8e.TRANSFER),value:g.registry.decode(F)}));return(yield g.signAndBroadcast(A,w,this.getStandardFee(this.getAssetInfo().asset),f.body.memo)).transactionHash})}broadcastTx(i){return Zre(this,void 0,void 0,function*(){return(yield(yield this.startgateClient.getValue()).broadcastTx(K2.fromBase64(i))).transactionHash})}},ZIn={exports:{}};ZIn.exports;(function(e){(function(i){var A,c=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,f=Math.ceil,l=Math.floor,g="[BigNumber Error] ",w=g+"Number primitive has more than 15 significant digits: ",N=1e14,F=14,j=9007199254740991,te=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],v=1e7,ne=1e9;function Z(ee){var T,se,p,L=D.prototype={constructor:D,toString:null,valueOf:null},V=new D(1),K=20,m=4,h=-7,_=21,b=-1e7,O=1e7,J=!1,ie=1,G=0,I={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},C="0123456789abcdefghijklmnopqrstuvwxyz";function D(Ke,It){var rt,ut,Rt,Ee,Pt,_e,we,xe,Ye=this;if(!(Ye instanceof D))return new D(Ke,It);if(It==null){if(Ke&&Ke._isBigNumber===!0){Ye.s=Ke.s,!Ke.c||Ke.e>O?Ye.c=Ye.e=null:Ke.e<b?Ye.c=[Ye.e=0]:(Ye.e=Ke.e,Ye.c=Ke.c.slice());return}if((_e=typeof Ke=="number")&&Ke*0==0){if(Ye.s=1/Ke<0?(Ke=-Ke,-1):1,Ke===~~Ke){for(Ee=0,Pt=Ke;Pt>=10;Pt/=10,Ee++);Ee>O?Ye.c=Ye.e=null:(Ye.e=Ee,Ye.c=[Ke]);return}xe=String(Ke)}else{if(!c.test(xe=String(Ke)))return p(Ye,xe,_e);Ye.s=xe.charCodeAt(0)==45?(xe=xe.slice(1),-1):1}(Ee=xe.indexOf("."))>-1&&(xe=xe.replace(".","")),(Pt=xe.search(/e/i))>0?(Ee<0&&(Ee=Pt),Ee+=+xe.slice(Pt+1),xe=xe.substring(0,Pt)):Ee<0&&(Ee=xe.length)}else{if(E(It,2,C.length,"Base"),It==10)return Ye=new D(Ke),Xe(Ye,K+Ye.e+1,m);if(xe=String(Ke),_e=typeof Ke=="number"){if(Ke*0!=0)return p(Ye,xe,_e,It);if(Ye.s=1/Ke<0?(xe=xe.slice(1),-1):1,D.DEBUG&&xe.replace(/^0\.0*|\./,"").length>15)throw Error(w+Ke)}else Ye.s=xe.charCodeAt(0)===45?(xe=xe.slice(1),-1):1;for(rt=C.slice(0,It),Ee=Pt=0,we=xe.length;Pt<we;Pt++)if(rt.indexOf(ut=xe.charAt(Pt))<0){if(ut=="."){if(Pt>Ee){Ee=we;continue}}else if(!Rt&&(xe==xe.toUpperCase()&&(xe=xe.toLowerCase())||xe==xe.toLowerCase()&&(xe=xe.toUpperCase()))){Rt=!0,Pt=-1,Ee=0;continue}return p(Ye,String(Ke),_e,It)}_e=!1,xe=se(xe,It,10,Ye.s),(Ee=xe.indexOf("."))>-1?xe=xe.replace(".",""):Ee=xe.length}for(Pt=0;xe.charCodeAt(Pt)===48;Pt++);for(we=xe.length;xe.charCodeAt(--we)===48;);if(xe=xe.slice(Pt,++we)){if(we-=Pt,_e&&D.DEBUG&&we>15&&(Ke>j||Ke!==l(Ke)))throw Error(w+Ye.s*Ke);if((Ee=Ee-Pt-1)>O)Ye.c=Ye.e=null;else if(Ee<b)Ye.c=[Ye.e=0];else{if(Ye.e=Ee,Ye.c=[],Pt=(Ee+1)%F,Ee<0&&(Pt+=F),Pt<we){for(Pt&&Ye.c.push(+xe.slice(0,Pt)),we-=F;Pt<we;)Ye.c.push(+xe.slice(Pt,Pt+=F));Pt=F-(xe=xe.slice(Pt)).length}else Pt-=we;for(;Pt--;xe+="0");Ye.c.push(+xe)}}else Ye.c=[Ye.e=0]}D.clone=Z,D.ROUND_UP=0,D.ROUND_DOWN=1,D.ROUND_CEIL=2,D.ROUND_FLOOR=3,D.ROUND_HALF_UP=4,D.ROUND_HALF_DOWN=5,D.ROUND_HALF_EVEN=6,D.ROUND_HALF_CEIL=7,D.ROUND_HALF_FLOOR=8,D.EUCLID=9,D.config=D.set=function(Ke){var It,rt;if(Ke!=null)if(typeof Ke=="object"){if(Ke.hasOwnProperty(It="DECIMAL_PLACES")&&(rt=Ke[It],E(rt,0,ne,It),K=rt),Ke.hasOwnProperty(It="ROUNDING_MODE")&&(rt=Ke[It],E(rt,0,8,It),m=rt),Ke.hasOwnProperty(It="EXPONENTIAL_AT")&&(rt=Ke[It],rt&&rt.pop?(E(rt[0],-ne,0,It),E(rt[1],0,ne,It),h=rt[0],_=rt[1]):(E(rt,-ne,ne,It),h=-(_=rt<0?-rt:rt))),Ke.hasOwnProperty(It="RANGE"))if(rt=Ke[It],rt&&rt.pop)E(rt[0],-ne,-1,It),E(rt[1],1,ne,It),b=rt[0],O=rt[1];else if(E(rt,-ne,ne,It),rt)b=-(O=rt<0?-rt:rt);else throw Error(g+It+" cannot be zero: "+rt);if(Ke.hasOwnProperty(It="CRYPTO"))if(rt=Ke[It],rt===!!rt)if(rt)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))J=rt;else throw J=!rt,Error(g+"crypto unavailable");else J=rt;else throw Error(g+It+" not true or false: "+rt);if(Ke.hasOwnProperty(It="MODULO_MODE")&&(rt=Ke[It],E(rt,0,9,It),ie=rt),Ke.hasOwnProperty(It="POW_PRECISION")&&(rt=Ke[It],E(rt,0,ne,It),G=rt),Ke.hasOwnProperty(It="FORMAT"))if(rt=Ke[It],typeof rt=="object")I=rt;else throw Error(g+It+" not an object: "+rt);if(Ke.hasOwnProperty(It="ALPHABET"))if(rt=Ke[It],typeof rt=="string"&&!/^.$|[+-.\s]|(.).*\1/.test(rt))C=rt;else throw Error(g+It+" invalid: "+rt)}else throw Error(g+"Object expected: "+Ke);return{DECIMAL_PLACES:K,ROUNDING_MODE:m,EXPONENTIAL_AT:[h,_],RANGE:[b,O],CRYPTO:J,MODULO_MODE:ie,POW_PRECISION:G,FORMAT:I,ALPHABET:C}},D.isBigNumber=function(Ke){if(!Ke||Ke._isBigNumber!==!0)return!1;if(!D.DEBUG)return!0;var It,rt,ut=Ke.c,Rt=Ke.e,Ee=Ke.s;e:if({}.toString.call(ut)=="[object Array]"){if((Ee===1||Ee===-1)&&Rt>=-ne&&Rt<=ne&&Rt===l(Rt)){if(ut[0]===0){if(Rt===0&&ut.length===1)return!0;break e}if(It=(Rt+1)%F,It<1&&(It+=F),String(ut[0]).length==It){for(It=0;It<ut.length;It++)if(rt=ut[It],rt<0||rt>=N||rt!==l(rt))break e;if(rt!==0)return!0}}}else if(ut===null&&Rt===null&&(Ee===null||Ee===1||Ee===-1))return!0;throw Error(g+"Invalid BigNumber: "+Ke)},D.maximum=D.max=function(){return ae(arguments,L.lt)},D.minimum=D.min=function(){return ae(arguments,L.gt)},D.random=function(){var Ke=9007199254740992,It=Math.random()*Ke&2097151?function(){return l(Math.random()*Ke)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(rt){var ut,Rt,Ee,Pt,_e,we=0,xe=[],Ye=new D(V);if(rt==null?rt=K:E(rt,0,ne),Pt=f(rt/F),J)if(crypto.getRandomValues){for(ut=crypto.getRandomValues(new Uint32Array(Pt*=2));we<Pt;)_e=ut[we]*131072+(ut[we+1]>>>11),_e>=9e15?(Rt=crypto.getRandomValues(new Uint32Array(2)),ut[we]=Rt[0],ut[we+1]=Rt[1]):(xe.push(_e%1e14),we+=2);we=Pt/2}else if(crypto.randomBytes){for(ut=crypto.randomBytes(Pt*=7);we<Pt;)_e=(ut[we]&31)*281474976710656+ut[we+1]*1099511627776+ut[we+2]*4294967296+ut[we+3]*16777216+(ut[we+4]<<16)+(ut[we+5]<<8)+ut[we+6],_e>=9e15?crypto.randomBytes(7).copy(ut,we):(xe.push(_e%1e14),we+=7);we=Pt/7}else throw J=!1,Error(g+"crypto unavailable");if(!J)for(;we<Pt;)_e=It(),_e<9e15&&(xe[we++]=_e%1e14);for(Pt=xe[--we],rt%=F,Pt&&rt&&(_e=te[F-rt],xe[we]=l(Pt/_e)*_e);xe[we]===0;xe.pop(),we--);if(we<0)xe=[Ee=0];else{for(Ee=-1;xe[0]===0;xe.splice(0,1),Ee-=F);for(we=1,_e=xe[0];_e>=10;_e/=10,we++);we<F&&(Ee-=F-we)}return Ye.e=Ee,Ye.c=xe,Ye}}(),D.sum=function(){for(var Ke=1,It=arguments,rt=new D(It[0]);Ke<It.length;)rt=rt.plus(It[Ke++]);return rt},se=function(){var Ke="0123456789";function It(rt,ut,Rt,Ee){for(var Pt,_e=[0],we,xe=0,Ye=rt.length;xe<Ye;){for(we=_e.length;we--;_e[we]*=ut);for(_e[0]+=Ee.indexOf(rt.charAt(xe++)),Pt=0;Pt<_e.length;Pt++)_e[Pt]>Rt-1&&(_e[Pt+1]==null&&(_e[Pt+1]=0),_e[Pt+1]+=_e[Pt]/Rt|0,_e[Pt]%=Rt)}return _e.reverse()}return function(rt,ut,Rt,Ee,Pt){var _e,we,xe,Ye,X,ht,Ut,zt,Wt=rt.indexOf("."),yn=K,rn=m;for(Wt>=0&&(Ye=G,G=0,rt=rt.replace(".",""),zt=new D(ut),ht=zt.pow(rt.length-Wt),G=Ye,zt.c=It(re(M(ht.c),ht.e,"0"),10,Rt,Ke),zt.e=zt.c.length),Ut=It(rt,ut,Rt,Pt?(_e=C,Ke):(_e=Ke,C)),xe=Ye=Ut.length;Ut[--Ye]==0;Ut.pop());if(!Ut[0])return _e.charAt(0);if(Wt<0?--xe:(ht.c=Ut,ht.e=xe,ht.s=Ee,ht=T(ht,zt,yn,rn,Rt),Ut=ht.c,X=ht.r,xe=ht.e),we=xe+yn+1,Wt=Ut[we],Ye=Rt/2,X=X||we<0||Ut[we+1]!=null,X=rn<4?(Wt!=null||X)&&(rn==0||rn==(ht.s<0?3:2)):Wt>Ye||Wt==Ye&&(rn==4||X||rn==6&&Ut[we-1]&1||rn==(ht.s<0?8:7)),we<1||!Ut[0])rt=X?re(_e.charAt(1),-yn,_e.charAt(0)):_e.charAt(0);else{if(Ut.length=we,X)for(--Rt;++Ut[--we]>Rt;)Ut[we]=0,we||(++xe,Ut=[1].concat(Ut));for(Ye=Ut.length;!Ut[--Ye];);for(Wt=0,rt="";Wt<=Ye;rt+=_e.charAt(Ut[Wt++]));rt=re(rt,xe,_e.charAt(0))}return rt}}(),T=function(){function Ke(ut,Rt,Ee){var Pt,_e,we,xe,Ye=0,X=ut.length,ht=Rt%v,Ut=Rt/v|0;for(ut=ut.slice();X--;)we=ut[X]%v,xe=ut[X]/v|0,Pt=Ut*we+xe*ht,_e=ht*we+Pt%v*v+Ye,Ye=(_e/Ee|0)+(Pt/v|0)+Ut*xe,ut[X]=_e%Ee;return Ye&&(ut=[Ye].concat(ut)),ut}function It(ut,Rt,Ee,Pt){var _e,we;if(Ee!=Pt)we=Ee>Pt?1:-1;else for(_e=we=0;_e<Ee;_e++)if(ut[_e]!=Rt[_e]){we=ut[_e]>Rt[_e]?1:-1;break}return we}function rt(ut,Rt,Ee,Pt){for(var _e=0;Ee--;)ut[Ee]-=_e,_e=ut[Ee]<Rt[Ee]?1:0,ut[Ee]=_e*Pt+ut[Ee]-Rt[Ee];for(;!ut[0]&&ut.length>1;ut.splice(0,1));}return function(ut,Rt,Ee,Pt,_e){var we,xe,Ye,X,ht,Ut,zt,Wt,yn,rn,un,fr,ir,Ln,Br,Zn,Jn,_r=ut.s==Rt.s?1:-1,Yn=ut.c,kn=Rt.c;if(!Yn||!Yn[0]||!kn||!kn[0])return new D(!ut.s||!Rt.s||(Yn?kn&&Yn[0]==kn[0]:!kn)?NaN:Yn&&Yn[0]==0||!kn?_r*0:_r/0);for(Wt=new D(_r),yn=Wt.c=[],xe=ut.e-Rt.e,_r=Ee+xe+1,_e||(_e=N,xe=R(ut.e/F)-R(Rt.e/F),_r=_r/F|0),Ye=0;kn[Ye]==(Yn[Ye]||0);Ye++);if(kn[Ye]>(Yn[Ye]||0)&&xe--,_r<0)yn.push(1),X=!0;else{for(Ln=Yn.length,Zn=kn.length,Ye=0,_r+=2,ht=l(_e/(kn[0]+1)),ht>1&&(kn=Ke(kn,ht,_e),Yn=Ke(Yn,ht,_e),Zn=kn.length,Ln=Yn.length),ir=Zn,rn=Yn.slice(0,Zn),un=rn.length;un<Zn;rn[un++]=0);Jn=kn.slice(),Jn=[0].concat(Jn),Br=kn[0],kn[1]>=_e/2&&Br++;do{if(ht=0,we=It(kn,rn,Zn,un),we<0){if(fr=rn[0],Zn!=un&&(fr=fr*_e+(rn[1]||0)),ht=l(fr/Br),ht>1)for(ht>=_e&&(ht=_e-1),Ut=Ke(kn,ht,_e),zt=Ut.length,un=rn.length;It(Ut,rn,zt,un)==1;)ht--,rt(Ut,Zn<zt?Jn:kn,zt,_e),zt=Ut.length,we=1;else ht==0&&(we=ht=1),Ut=kn.slice(),zt=Ut.length;if(zt<un&&(Ut=[0].concat(Ut)),rt(rn,Ut,un,_e),un=rn.length,we==-1)for(;It(kn,rn,Zn,un)<1;)ht++,rt(rn,Zn<un?Jn:kn,un,_e),un=rn.length}else we===0&&(ht++,rn=[0]);yn[Ye++]=ht,rn[0]?rn[un++]=Yn[ir]||0:(rn=[Yn[ir]],un=1)}while((ir++<Ln||rn[0]!=null)&&_r--);X=rn[0]!=null,yn[0]||yn.splice(0,1)}if(_e==N){for(Ye=1,_r=yn[0];_r>=10;_r/=10,Ye++);Xe(Wt,Ee+(Wt.e=Ye+xe*F-1)+1,Pt,X)}else Wt.e=xe,Wt.r=+X;return Wt}}();function W(Ke,It,rt,ut){var Rt,Ee,Pt,_e,we;if(rt==null?rt=m:E(rt,0,8),!Ke.c)return Ke.toString();if(Rt=Ke.c[0],Pt=Ke.e,It==null)we=M(Ke.c),we=ut==1||ut==2&&(Pt<=h||Pt>=_)?H(we,Pt):re(we,Pt,"0");else if(Ke=Xe(new D(Ke),It,rt),Ee=Ke.e,we=M(Ke.c),_e=we.length,ut==1||ut==2&&(It<=Ee||Ee<=h)){for(;_e<It;we+="0",_e++);we=H(we,Ee)}else if(It-=Pt,we=re(we,Ee,"0"),Ee+1>_e){if(--It>0)for(we+=".";It--;we+="0");}else if(It+=Ee-_e,It>0)for(Ee+1==_e&&(we+=".");It--;we+="0");return Ke.s<0&&Rt?"-"+we:we}function ae(Ke,It){for(var rt,ut=1,Rt=new D(Ke[0]);ut<Ke.length;ut++)if(rt=new D(Ke[ut]),rt.s)It.call(Rt,rt)&&(Rt=rt);else{Rt=rt;break}return Rt}function ye(Ke,It,rt){for(var ut=1,Rt=It.length;!It[--Rt];It.pop());for(Rt=It[0];Rt>=10;Rt/=10,ut++);return(rt=ut+rt*F-1)>O?Ke.c=Ke.e=null:rt<b?Ke.c=[Ke.e=0]:(Ke.e=rt,Ke.c=It),Ke}p=function(){var Ke=/^(-?)0([xbo])(?=\w[\w.]*$)/i,It=/^([^.]+)\.$/,rt=/^\.([^.]+)$/,ut=/^-?(Infinity|NaN)$/,Rt=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(Ee,Pt,_e,we){var xe,Ye=_e?Pt:Pt.replace(Rt,"");if(ut.test(Ye))Ee.s=isNaN(Ye)?null:Ye<0?-1:1;else{if(!_e&&(Ye=Ye.replace(Ke,function(X,ht,Ut){return xe=(Ut=Ut.toLowerCase())=="x"?16:Ut=="b"?2:8,!we||we==xe?ht:X}),we&&(xe=we,Ye=Ye.replace(It,"$1").replace(rt,"0.$1")),Pt!=Ye))return new D(Ye,xe);if(D.DEBUG)throw Error(g+"Not a"+(we?" base "+we:"")+" number: "+Pt);Ee.s=null}Ee.c=Ee.e=null}}();function Xe(Ke,It,rt,ut){var Rt,Ee,Pt,_e,we,xe,Ye,X=Ke.c,ht=te;if(X){e:{for(Rt=1,_e=X[0];_e>=10;_e/=10,Rt++);if(Ee=It-Rt,Ee<0)Ee+=F,Pt=It,we=X[xe=0],Ye=we/ht[Rt-Pt-1]%10|0;else if(xe=f((Ee+1)/F),xe>=X.length)if(ut){for(;X.length<=xe;X.push(0));we=Ye=0,Rt=1,Ee%=F,Pt=Ee-F+1}else break e;else{for(we=_e=X[xe],Rt=1;_e>=10;_e/=10,Rt++);Ee%=F,Pt=Ee-F+Rt,Ye=Pt<0?0:we/ht[Rt-Pt-1]%10|0}if(ut=ut||It<0||X[xe+1]!=null||(Pt<0?we:we%ht[Rt-Pt-1]),ut=rt<4?(Ye||ut)&&(rt==0||rt==(Ke.s<0?3:2)):Ye>5||Ye==5&&(rt==4||ut||rt==6&&(Ee>0?Pt>0?we/ht[Rt-Pt]:0:X[xe-1])%10&1||rt==(Ke.s<0?8:7)),It<1||!X[0])return X.length=0,ut?(It-=Ke.e+1,X[0]=ht[(F-It%F)%F],Ke.e=-It||0):X[0]=Ke.e=0,Ke;if(Ee==0?(X.length=xe,_e=1,xe--):(X.length=xe+1,_e=ht[F-Ee],X[xe]=Pt>0?l(we/ht[Rt-Pt]%ht[Pt])*_e:0),ut)for(;;)if(xe==0){for(Ee=1,Pt=X[0];Pt>=10;Pt/=10,Ee++);for(Pt=X[0]+=_e,_e=1;Pt>=10;Pt/=10,_e++);Ee!=_e&&(Ke.e++,X[0]==N&&(X[0]=1));break}else{if(X[xe]+=_e,X[xe]!=N)break;X[xe--]=0,_e=1}for(Ee=X.length;X[--Ee]===0;X.pop());}Ke.e>O?Ke.c=Ke.e=null:Ke.e<b&&(Ke.c=[Ke.e=0])}return Ke}function nt(Ke){var It,rt=Ke.e;return rt===null?Ke.toString():(It=M(Ke.c),It=rt<=h||rt>=_?H(It,rt):re(It,rt,"0"),Ke.s<0?"-"+It:It)}return L.absoluteValue=L.abs=function(){var Ke=new D(this);return Ke.s<0&&(Ke.s=1),Ke},L.comparedTo=function(Ke,It){return U(this,new D(Ke,It))},L.decimalPlaces=L.dp=function(Ke,It){var rt,ut,Rt,Ee=this;if(Ke!=null)return E(Ke,0,ne),It==null?It=m:E(It,0,8),Xe(new D(Ee),Ke+Ee.e+1,It);if(!(rt=Ee.c))return null;if(ut=((Rt=rt.length-1)-R(this.e/F))*F,Rt=rt[Rt])for(;Rt%10==0;Rt/=10,ut--);return ut<0&&(ut=0),ut},L.dividedBy=L.div=function(Ke,It){return T(this,new D(Ke,It),K,m)},L.dividedToIntegerBy=L.idiv=function(Ke,It){return T(this,new D(Ke,It),0,1)},L.exponentiatedBy=L.pow=function(Ke,It){var rt,ut,Rt,Ee,Pt,_e,we,xe,Ye,X=this;if(Ke=new D(Ke),Ke.c&&!Ke.isInteger())throw Error(g+"Exponent not an integer: "+nt(Ke));if(It!=null&&(It=new D(It)),_e=Ke.e>14,!X.c||!X.c[0]||X.c[0]==1&&!X.e&&X.c.length==1||!Ke.c||!Ke.c[0])return Ye=new D(Math.pow(+nt(X),_e?2-Q(Ke):+nt(Ke))),It?Ye.mod(It):Ye;if(we=Ke.s<0,It){if(It.c?!It.c[0]:!It.s)return new D(NaN);ut=!we&&X.isInteger()&&It.isInteger(),ut&&(X=X.mod(It))}else{if(Ke.e>9&&(X.e>0||X.e<-1||(X.e==0?X.c[0]>1||_e&&X.c[1]>=24e7:X.c[0]<8e13||_e&&X.c[0]<=9999975e7)))return Ee=X.s<0&&Q(Ke)?-0:0,X.e>-1&&(Ee=1/Ee),new D(we?1/Ee:Ee);G&&(Ee=f(G/F+2))}for(_e?(rt=new D(.5),we&&(Ke.s=1),xe=Q(Ke)):(Rt=Math.abs(+nt(Ke)),xe=Rt%2),Ye=new D(V);;){if(xe){if(Ye=Ye.times(X),!Ye.c)break;Ee?Ye.c.length>Ee&&(Ye.c.length=Ee):ut&&(Ye=Ye.mod(It))}if(Rt){if(Rt=l(Rt/2),Rt===0)break;xe=Rt%2}else if(Ke=Ke.times(rt),Xe(Ke,Ke.e+1,1),Ke.e>14)xe=Q(Ke);else{if(Rt=+nt(Ke),Rt===0)break;xe=Rt%2}X=X.times(X),Ee?X.c&&X.c.length>Ee&&(X.c.length=Ee):ut&&(X=X.mod(It))}return ut?Ye:(we&&(Ye=V.div(Ye)),It?Ye.mod(It):Ee?Xe(Ye,G,m,Pt):Ye)},L.integerValue=function(Ke){var It=new D(this);return Ke==null?Ke=m:E(Ke,0,8),Xe(It,It.e+1,Ke)},L.isEqualTo=L.eq=function(Ke,It){return U(this,new D(Ke,It))===0},L.isFinite=function(){return!!this.c},L.isGreaterThan=L.gt=function(Ke,It){return U(this,new D(Ke,It))>0},L.isGreaterThanOrEqualTo=L.gte=function(Ke,It){return(It=U(this,new D(Ke,It)))===1||It===0},L.isInteger=function(){return!!this.c&&R(this.e/F)>this.c.length-2},L.isLessThan=L.lt=function(Ke,It){return U(this,new D(Ke,It))<0},L.isLessThanOrEqualTo=L.lte=function(Ke,It){return(It=U(this,new D(Ke,It)))===-1||It===0},L.isNaN=function(){return!this.s},L.isNegative=function(){return this.s<0},L.isPositive=function(){return this.s>0},L.isZero=function(){return!!this.c&&this.c[0]==0},L.minus=function(Ke,It){var rt,ut,Rt,Ee,Pt=this,_e=Pt.s;if(Ke=new D(Ke,It),It=Ke.s,!_e||!It)return new D(NaN);if(_e!=It)return Ke.s=-It,Pt.plus(Ke);var we=Pt.e/F,xe=Ke.e/F,Ye=Pt.c,X=Ke.c;if(!we||!xe){if(!Ye||!X)return Ye?(Ke.s=-It,Ke):new D(X?Pt:NaN);if(!Ye[0]||!X[0])return X[0]?(Ke.s=-It,Ke):new D(Ye[0]?Pt:m==3?-0:0)}if(we=R(we),xe=R(xe),Ye=Ye.slice(),_e=we-xe){for((Ee=_e<0)?(_e=-_e,Rt=Ye):(xe=we,Rt=X),Rt.reverse(),It=_e;It--;Rt.push(0));Rt.reverse()}else for(ut=(Ee=(_e=Ye.length)<(It=X.length))?_e:It,_e=It=0;It<ut;It++)if(Ye[It]!=X[It]){Ee=Ye[It]<X[It];break}if(Ee&&(Rt=Ye,Ye=X,X=Rt,Ke.s=-Ke.s),It=(ut=X.length)-(rt=Ye.length),It>0)for(;It--;Ye[rt++]=0);for(It=N-1;ut>_e;){if(Ye[--ut]<X[ut]){for(rt=ut;rt&&!Ye[--rt];Ye[rt]=It);--Ye[rt],Ye[ut]+=N}Ye[ut]-=X[ut]}for(;Ye[0]==0;Ye.splice(0,1),--xe);return Ye[0]?ye(Ke,Ye,xe):(Ke.s=m==3?-1:1,Ke.c=[Ke.e=0],Ke)},L.modulo=L.mod=function(Ke,It){var rt,ut,Rt=this;return Ke=new D(Ke,It),!Rt.c||!Ke.s||Ke.c&&!Ke.c[0]?new D(NaN):!Ke.c||Rt.c&&!Rt.c[0]?new D(Rt):(ie==9?(ut=Ke.s,Ke.s=1,rt=T(Rt,Ke,0,3),Ke.s=ut,rt.s*=ut):rt=T(Rt,Ke,0,ie),Ke=Rt.minus(rt.times(Ke)),!Ke.c[0]&&ie==1&&(Ke.s=Rt.s),Ke)},L.multipliedBy=L.times=function(Ke,It){var rt,ut,Rt,Ee,Pt,_e,we,xe,Ye,X,ht,Ut,zt,Wt,yn,rn=this,un=rn.c,fr=(Ke=new D(Ke,It)).c;if(!un||!fr||!un[0]||!fr[0])return!rn.s||!Ke.s||un&&!un[0]&&!fr||fr&&!fr[0]&&!un?Ke.c=Ke.e=Ke.s=null:(Ke.s*=rn.s,!un||!fr?Ke.c=Ke.e=null:(Ke.c=[0],Ke.e=0)),Ke;for(ut=R(rn.e/F)+R(Ke.e/F),Ke.s*=rn.s,we=un.length,X=fr.length,we<X&&(zt=un,un=fr,fr=zt,Rt=we,we=X,X=Rt),Rt=we+X,zt=[];Rt--;zt.push(0));for(Wt=N,yn=v,Rt=X;--Rt>=0;){for(rt=0,ht=fr[Rt]%yn,Ut=fr[Rt]/yn|0,Pt=we,Ee=Rt+Pt;Ee>Rt;)xe=un[--Pt]%yn,Ye=un[Pt]/yn|0,_e=Ut*xe+Ye*ht,xe=ht*xe+_e%yn*yn+zt[Ee]+rt,rt=(xe/Wt|0)+(_e/yn|0)+Ut*Ye,zt[Ee--]=xe%Wt;zt[Ee]=rt}return rt?++ut:zt.splice(0,1),ye(Ke,zt,ut)},L.negated=function(){var Ke=new D(this);return Ke.s=-Ke.s||null,Ke},L.plus=function(Ke,It){var rt,ut=this,Rt=ut.s;if(Ke=new D(Ke,It),It=Ke.s,!Rt||!It)return new D(NaN);if(Rt!=It)return Ke.s=-It,ut.minus(Ke);var Ee=ut.e/F,Pt=Ke.e/F,_e=ut.c,we=Ke.c;if(!Ee||!Pt){if(!_e||!we)return new D(Rt/0);if(!_e[0]||!we[0])return we[0]?Ke:new D(_e[0]?ut:Rt*0)}if(Ee=R(Ee),Pt=R(Pt),_e=_e.slice(),Rt=Ee-Pt){for(Rt>0?(Pt=Ee,rt=we):(Rt=-Rt,rt=_e),rt.reverse();Rt--;rt.push(0));rt.reverse()}for(Rt=_e.length,It=we.length,Rt-It<0&&(rt=we,we=_e,_e=rt,It=Rt),Rt=0;It;)Rt=(_e[--It]=_e[It]+we[It]+Rt)/N|0,_e[It]=N===_e[It]?0:_e[It]%N;return Rt&&(_e=[Rt].concat(_e),++Pt),ye(Ke,_e,Pt)},L.precision=L.sd=function(Ke,It){var rt,ut,Rt,Ee=this;if(Ke!=null&&Ke!==!!Ke)return E(Ke,1,ne),It==null?It=m:E(It,0,8),Xe(new D(Ee),Ke,It);if(!(rt=Ee.c))return null;if(Rt=rt.length-1,ut=Rt*F+1,Rt=rt[Rt]){for(;Rt%10==0;Rt/=10,ut--);for(Rt=rt[0];Rt>=10;Rt/=10,ut++);}return Ke&&Ee.e+1>ut&&(ut=Ee.e+1),ut},L.shiftedBy=function(Ke){return E(Ke,-j,j),this.times("1e"+Ke)},L.squareRoot=L.sqrt=function(){var Ke,It,rt,ut,Rt,Ee=this,Pt=Ee.c,_e=Ee.s,we=Ee.e,xe=K+4,Ye=new D("0.5");if(_e!==1||!Pt||!Pt[0])return new D(!_e||_e<0&&(!Pt||Pt[0])?NaN:Pt?Ee:1/0);if(_e=Math.sqrt(+nt(Ee)),_e==0||_e==1/0?(It=M(Pt),(It.length+we)%2==0&&(It+="0"),_e=Math.sqrt(+It),we=R((we+1)/2)-(we<0||we%2),_e==1/0?It="1e"+we:(It=_e.toExponential(),It=It.slice(0,It.indexOf("e")+1)+we),rt=new D(It)):rt=new D(_e+""),rt.c[0]){for(we=rt.e,_e=we+xe,_e<3&&(_e=0);;)if(Rt=rt,rt=Ye.times(Rt.plus(T(Ee,Rt,xe,1))),M(Rt.c).slice(0,_e)===(It=M(rt.c)).slice(0,_e))if(rt.e<we&&--_e,It=It.slice(_e-3,_e+1),It=="9999"||!ut&&It=="4999"){if(!ut&&(Xe(Rt,Rt.e+K+2,0),Rt.times(Rt).eq(Ee))){rt=Rt;break}xe+=4,_e+=4,ut=1}else{(!+It||!+It.slice(1)&&It.charAt(0)=="5")&&(Xe(rt,rt.e+K+2,1),Ke=!rt.times(rt).eq(Ee));break}}return Xe(rt,rt.e+K+1,m,Ke)},L.toExponential=function(Ke,It){return Ke!=null&&(E(Ke,0,ne),Ke++),W(this,Ke,It,1)},L.toFixed=function(Ke,It){return Ke!=null&&(E(Ke,0,ne),Ke=Ke+this.e+1),W(this,Ke,It)},L.toFormat=function(Ke,It,rt){var ut,Rt=this;if(rt==null)Ke!=null&&It&&typeof It=="object"?(rt=It,It=null):Ke&&typeof Ke=="object"?(rt=Ke,Ke=It=null):rt=I;else if(typeof rt!="object")throw Error(g+"Argument not an object: "+rt);if(ut=Rt.toFixed(Ke,It),Rt.c){var Ee,Pt=ut.split("."),_e=+rt.groupSize,we=+rt.secondaryGroupSize,xe=rt.groupSeparator||"",Ye=Pt[0],X=Pt[1],ht=Rt.s<0,Ut=ht?Ye.slice(1):Ye,zt=Ut.length;if(we&&(Ee=_e,_e=we,we=Ee,zt-=Ee),_e>0&&zt>0){for(Ee=zt%_e||_e,Ye=Ut.substr(0,Ee);Ee<zt;Ee+=_e)Ye+=xe+Ut.substr(Ee,_e);we>0&&(Ye+=xe+Ut.slice(Ee)),ht&&(Ye="-"+Ye)}ut=X?Ye+(rt.decimalSeparator||"")+((we=+rt.fractionGroupSize)?X.replace(new RegExp("\\d{"+we+"}\\B","g"),"$&"+(rt.fractionGroupSeparator||"")):X):Ye}return(rt.prefix||"")+ut+(rt.suffix||"")},L.toFraction=function(Ke){var It,rt,ut,Rt,Ee,Pt,_e,we,xe,Ye,X,ht,Ut=this,zt=Ut.c;if(Ke!=null&&(_e=new D(Ke),!_e.isInteger()&&(_e.c||_e.s!==1)||_e.lt(V)))throw Error(g+"Argument "+(_e.isInteger()?"out of range: ":"not an integer: ")+nt(_e));if(!zt)return new D(Ut);for(It=new D(V),xe=rt=new D(V),ut=we=new D(V),ht=M(zt),Ee=It.e=ht.length-Ut.e-1,It.c[0]=te[(Pt=Ee%F)<0?F+Pt:Pt],Ke=!Ke||_e.comparedTo(It)>0?Ee>0?It:xe:_e,Pt=O,O=1/0,_e=new D(ht),we.c[0]=0;Ye=T(_e,It,0,1),Rt=rt.plus(Ye.times(ut)),Rt.comparedTo(Ke)!=1;)rt=ut,ut=Rt,xe=we.plus(Ye.times(Rt=xe)),we=Rt,It=_e.minus(Ye.times(Rt=It)),_e=Rt;return Rt=T(Ke.minus(rt),ut,0,1),we=we.plus(Rt.times(xe)),rt=rt.plus(Rt.times(ut)),we.s=xe.s=Ut.s,Ee=Ee*2,X=T(xe,ut,Ee,m).minus(Ut).abs().comparedTo(T(we,rt,Ee,m).minus(Ut).abs())<1?[xe,ut]:[we,rt],O=Pt,X},L.toNumber=function(){return+nt(this)},L.toPrecision=function(Ke,It){return Ke!=null&&E(Ke,1,ne),W(this,Ke,It,2)},L.toString=function(Ke){var It,rt=this,ut=rt.s,Rt=rt.e;return Rt===null?ut?(It="Infinity",ut<0&&(It="-"+It)):It="NaN":(Ke==null?It=Rt<=h||Rt>=_?H(M(rt.c),Rt):re(M(rt.c),Rt,"0"):Ke===10?(rt=Xe(new D(rt),K+Rt+1,m),It=re(M(rt.c),rt.e,"0")):(E(Ke,2,C.length,"Base"),It=se(re(M(rt.c),Rt,"0"),10,Ke,ut,!0)),ut<0&&rt.c[0]&&(It="-"+It)),It},L.valueOf=L.toJSON=function(){return nt(this)},L._isBigNumber=!0,ee!=null&&D.set(ee),D}function R(ee){var T=ee|0;return ee>0||ee===T?T:T-1}function M(ee){for(var T,se,p=1,L=ee.length,V=ee[0]+"";p<L;){for(T=ee[p++]+"",se=F-T.length;se--;T="0"+T);V+=T}for(L=V.length;V.charCodeAt(--L)===48;);return V.slice(0,L+1||1)}function U(ee,T){var se,p,L=ee.c,V=T.c,K=ee.s,m=T.s,h=ee.e,_=T.e;if(!K||!m)return null;if(se=L&&!L[0],p=V&&!V[0],se||p)return se?p?0:-m:K;if(K!=m)return K;if(se=K<0,p=h==_,!L||!V)return p?0:!L^se?1:-1;if(!p)return h>_^se?1:-1;for(m=(h=L.length)<(_=V.length)?h:_,K=0;K<m;K++)if(L[K]!=V[K])return L[K]>V[K]^se?1:-1;return h==_?0:h>_^se?1:-1}function E(ee,T,se,p){if(ee<T||ee>se||ee!==l(ee))throw Error(g+(p||"Argument")+(typeof ee=="number"?ee<T||ee>se?" out of range: ":" not an integer: ":" not a primitive number: ")+String(ee))}function Q(ee){var T=ee.c.length-1;return R(ee.e/F)==T&&ee.c[T]%2!=0}function H(ee,T){return(ee.length>1?ee.charAt(0)+"."+ee.slice(1):ee)+(T<0?"e":"e+")+T}function re(ee,T,se){var p,L;if(T<0){for(L=se+".";++T;L+=se);ee=L+ee}else if(p=ee.length,++T>p){for(L=se,T-=p;--T;L+=se);ee+=L}else T<p&&(ee=ee.slice(0,T)+"."+ee.slice(T));return ee}A=Z(),A.default=A.BigNumber=A,e.exports?e.exports=A:(i||(i=typeof self!="undefined"&&self?self:window),i.BigNumber=A)})(Gr)})(ZIn);var yRs=ZIn.exports,mRs=krs(yRs),Jei={},IRs=$Gr(Vys);(function(e){Object.defineProperty(e,"__esModule",{value:!0});var i=IRs,A=xEt;function c(M){return M&&typeof M=="object"&&"default"in M?M:{default:M}}var f=c(A);function l(M,U,E,Q){function H(re){return re instanceof E?re:new E(function(ee){ee(re)})}return new(E||(E=Promise))(function(re,ee){function T(L){try{p(Q.next(L))}catch(V){ee(V)}}function se(L){try{p(Q.throw(L))}catch(V){ee(V)}}function p(L){L.done?re(L.value):H(L.value).then(T,se)}p((Q=Q.apply(M,U||[])).next())})}e.Network=void 0,function(M){M.Mainnet="mainnet",M.Stagenet="stagenet",M.Testnet="testnet"}(e.Network||(e.Network={})),e.TxType=void 0,function(M){M.Transfer="transfer",M.Unknown="unknown"}(e.TxType||(e.TxType={})),e.FeeOption=void 0,function(M){M.Average="average",M.Fast="fast",M.Fastest="fastest"}(e.FeeOption||(e.FeeOption={})),e.FeeType=void 0,function(M){M.FlatFee="base",M.PerByte="byte"}(e.FeeType||(e.FeeType={}));let g="https://thornode.ninerealms.com/thorchain",w="https://stagenet-thornode.ninerealms.com/thorchain",N="https://testnet.thornode.thorchain.info/thorchain";class F{constructor(U,E){if(this.phrase="",this.chain=U,this.network=E.network||e.Network.Testnet,this.feeBounds=E.feeBounds||{lower:1,upper:1/0},this.network===e.Network.Stagenet&&console.warn("WARNING: This is using stagenet! Real assets are being used!"),E.rootDerivationPaths&&(this.rootDerivationPaths=E.rootDerivationPaths),E.phrase){if(!i.validatePhrase(E.phrase))throw new Error("Invalid phrase");this.phrase=E.phrase}}setNetwork(U){if(!U)throw new Error("Network must be provided");this.network=U,this.network===e.Network.Stagenet&&console.warn("WARNING: This is using stagenet! Real assets are being used!")}getNetwork(){return this.network}getFeeRateFromThorchain(){return l(this,void 0,void 0,function*(){let U=yield this.thornodeAPIGet("/inbound_addresses");if(!Array.isArray(U))throw new Error("bad response from Thornode API");let E=U.find(Q=>Q.chain===this.chain&&typeof Q.gas_rate=="string");if(!E)throw new Error(`Thornode API /inbound_addresses does not contain fees for ${this.chain}`);return Number(E.gas_rate)})}thornodeAPIGet(U){return l(this,void 0,void 0,function*(){let E=(()=>{switch(this.network){case e.Network.Mainnet:return g;case e.Network.Stagenet:return w;case e.Network.Testnet:return N}})();return(yield f.default.get(E+U)).data})}setPhrase(U,E=0){if(this.phrase!==U){if(!i.validatePhrase(U))throw new Error("Invalid phrase");this.phrase=U}return this.getAddress(E)}getFullDerivationPath(U){return this.rootDerivationPaths?`${this.rootDerivationPaths[this.network]}${U}`:""}purgeClient(){this.phrase=""}}function j(M){return Object.values(e.FeeOption).reduce((U,E)=>(U[E]=M,U),{})}function te(M){return Object.assign(Object.assign({},j(M)),{[e.FeeOption.Average]:M*.5,[e.FeeOption.Fastest]:M*5})}function v(M,U){if(U<M.lower||U>M.upper)throw Error(`Fee outside of predetermined bounds: ${U.toString()}`)}function ne(M,U){return Object.values(e.FeeOption).reduce((E,Q)=>(E[Q]=U,E),{type:M})}function Z(M,U){return Object.assign(Object.assign({},ne(M,U)),{[e.FeeOption.Average]:U.times(.5),[e.FeeOption.Fastest]:U.times(5)})}class R{constructor(U,E,Q){this.explorerUrl=U,this.explorerAddressUrlTemplate=E,this.explorerTxUrlTemplate=Q}getExplorerUrl(){return this.explorerUrl}getExplorerAddressUrl(U){return this.explorerAddressUrlTemplate.replace("%%ADDRESS%%",U)}getExplorerTxUrl(U){return this.explorerTxUrlTemplate.replace("%%TX_ID%%",U)}}e.Protocol=void 0,function(M){M[M.THORCHAIN=1]="THORCHAIN"}(e.Protocol||(e.Protocol={})),e.BaseXChainClient=F,e.ExplorerProvider=R,e.checkFeeBounds=v,e.singleFee=ne,e.singleFeeRate=j,e.standardFeeRates=te,e.standardFees=Z})(Jei);var WGr="https://bigdipper.live/cosmos",CRs="https://explorer.theta-testnet.polypore.xyz",_Rs=()=>({[E3.Testnet]:"https://rpc.sentry-02.theta-testnet.polypore.xyz",[E3.Stagenet]:"https://rpc.cosmos.directory/cosmoshub",[E3.Mainnet]:"https://rpc.cosmos.directory/cosmoshub"}),ERs=()=>({[E3.Mainnet]:"m/44'/118'/0'/0/",[E3.Testnet]:"m/44'/118'/0'/0/",[E3.Stagenet]:"m/44'/118'/0'/0/"}),BRs=()=>({[E3.Mainnet]:WGr,[E3.Testnet]:CRs,[E3.Stagenet]:WGr}),vRs=e=>hWr(e,Xue)?wRs:null,CMs=e=>N3t(void 0,void 0,void 0,function*(){var i;let{data:A}=yield xEt.get(`${e}/node_info`);return((i=A==null?void 0:A.node_info)===null||i===void 0?void 0:i.network)||Promise.reject("Could not parse chain id")}),bRs=()=>"cosmos",LLe=6,SRs="200000",Hei=Yz(5e3,LLe),XIn="GAIA",Xue={chain:XIn,symbol:"ATOM",ticker:"ATOM",synth:!1},wRs="uatom",QRs="/cosmos.bank.v1beta1.MsgSend",ZGr={chain:XIn,network:Jei.Network.Mainnet,clientUrls:_Rs(),rootDerivationPaths:ERs(),prefix:"cosmos",defaultDecimals:6,defaultFee:Hei,baseDenom:"uatom",registryTypes:[]},NEt=class extends tyn{constructor(i=ZGr){super(Object.assign(Object.assign({},ZGr),i))}getAssetInfo(){return{asset:Xue,decimal:LLe}}getAssetDecimals(i){return hWr(i,Xue)?LLe:this.defaultDecimals}getExplorerUrl(){return BRs()[this.network]}getExplorerAddressUrl(i){return`${this.getExplorerUrl()}/accounts/${i}`}getExplorerTxUrl(i){return`${this.getExplorerUrl()}/transactions/${i}`}assetFromDenom(i){return i===this.getDenom(Xue)?Xue:i.startsWith("ibc/")?{chain:XIn,symbol:i,ticker:"",synth:!1}:null}getDenom(i){return vRs(i)}getFees(){return N3t(this,void 0,void 0,function*(){try{let i=yield this.getFeeRateFromThorchain(),A=LLe-8,c=i*Math.pow(10,A),f=Yz(c,LLe);return l1n(cGe.FlatFee,f)}catch(i){return l1n(cGe.FlatFee,Hei)}})}prepareTx({sender:i,recipient:A,asset:c,amount:f,memo:l}){return N3t(this,void 0,void 0,function*(){if(!this.validateAddress(i))throw Error("Invalid sender address");if(!this.validateAddress(A))throw Error("Invalid recipient address");let g=this.getDenom(c||this.getAssetInfo().asset);if(!g)throw Error(`Invalid asset ${c==null?void 0:c.symbol} - Only ${this.baseDenom} asset is currently supported to transfer`);let w={amount:f.amount().toString(),denom:g},N={typeUrl:"/cosmos.tx.v1beta1.TxBody",value:{messages:[{typeUrl:this.getMsgTypeUrlByType(F8e.TRANSFER),value:{fromAddress:i,toAddress:A,amount:[w]}}],memo:l}},F=DM.TxRaw.fromPartial({bodyBytes:this.registry.encode(N)});return{rawUnsignedTx:q2.toBase64(DM.TxRaw.encode(F).finish())}})}transferOffline({walletIndex:i=0,recipient:A,asset:c,amount:f,memo:l,gasLimit:g=new mRs(SRs)}){return N3t(this,void 0,void 0,function*(){let w=yield this.getAddressAsync(i),{rawUnsignedTx:N}=yield this.prepareTx({sender:w,recipient:A,asset:c,amount:f,memo:l}),F=PK.decodeTxRaw(q2.fromBase64(N)),j=yield PK.DirectSecp256k1HdWallet.fromMnemonic(this.phrase,{prefix:this.prefix,hdPaths:[Fei(this.getFullDerivationPath(i))]}),te=yield U3t.SigningStargateClient.connectWithSigner(this.clientUrls[this.network],j,{registry:this.registry}),v=F.body.messages.map(Z=>({typeUrl:this.getMsgTypeUrlByType(F8e.TRANSFER),value:te.registry.decode(Z)})),ne=yield te.sign(w,v,{amount:[],gas:g.toString()},F.body.memo);return q2.toBase64(DM.TxRaw.encode(ne).finish())})}getPrefix(){return bRs()}getMsgTypeUrlByType(i){return{[F8e.TRANSFER]:QRs}[i]}getStandardFee(i){let A=this.getDenom(i),c=U3t.GasPrice.fromString(`0.006${A}`);return U3t.calculateFee(9e4,c)}};import*as Ow from"bitcoinjs-lib";import kRs from"coinselect/accumulative";import $In from"coininfo";function uqe(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var Lei=1e5,DRs=8,RRs=100,PRs=2e7,zSe="DOGE",c6t={chain:zSe,symbol:"DOGE",ticker:"DOGE",synth:!1},Gei=new By("https://blockchair.com/dogecoin","https://blockchair.com/dogecoin/address/%%ADDRESS%%","https://blockchair.com/dogecoin/transaction/%%TX_ID%%"),ORs=new By("https://blockexplorer.one/dogecoin/testnet","https://blockexplorer.one/dogecoin/testnet/address/%%ADDRESS%%","https://blockexplorer.one/dogecoin/testnet/tx/%%TX_ID%%"),NRs={[eo.Testnet]:ORs,[eo.Stagenet]:Gei,[eo.Mainnet]:Gei},xRs=new QT("https://sochain.com/api/v3",process.env.SOCHAIN_API_KEY||"",zSe,c6t,8,wT.DOGETEST),qei=new QT("https://sochain.com/api/v3",process.env.SOCHAIN_API_KEY||"",zSe,c6t,8,wT.DOGE),kMs={[eo.Testnet]:xRs,[eo.Stagenet]:qei,[eo.Mainnet]:qei},Kei=new vY("https://api.blockcypher.com/v1",zSe,c6t,8,bY.DOGE,process.env.BLOCKCYPHER_API_KEY||""),MRs={[eo.Testnet]:void 0,[eo.Stagenet]:Kei,[eo.Mainnet]:Kei},Yei=new AH({baseUrl:"https://app.bitgo.com",chain:zSe}),TRs={[eo.Testnet]:void 0,[eo.Stagenet]:Yei,[eo.Mainnet]:Yei},URs=10,FRs=41,JRs=107,jIn=9,Vei=25;function HRs(){return FRs+JRs}var A6t=e=>{switch(e){case eo.Mainnet:return $In.dogecoin.main.toBitcoinJS();case eo.Stagenet:return $In.dogecoin.main.toBitcoinJS();case eo.Testnet:{let i={private:70615956,public:70617039},A=$In.dogecoin.test;return A.versions.bip32=i,A.toBitcoinJS()}}},LRs=(e,i)=>{try{return Ow.address.toOutputScript(e,A6t(i)),!0}catch(A){return!1}};var eCn={network:eo.Mainnet,phrase:"",explorerProviders:NRs,dataProviders:[TRs,MRs],rootDerivationPaths:{[eo.Mainnet]:"m/44'/3'/0'/0/",[eo.Stagenet]:"m/44'/3'/0'/0/",[eo.Testnet]:"m/44'/1'/0'/0/"},feeBounds:{lower:RRs,upper:PRs}},d6t=class extends sH{constructor(i=eCn){super(zSe,{network:i.network,rootDerivationPaths:i.rootDerivationPaths,phrase:i.phrase,feeBounds:i.feeBounds,explorerProviders:i.explorerProviders,dataProviders:i.dataProviders}),this.buildTx=({amount:A,recipient:c,memo:f,feeRate:l,sender:g})=>uqe(this,void 0,void 0,function*(){if(!this.validateAddress(c))throw new Error("Invalid address");let w=yield this.scanUTXOs(g,!1);if(w.length===0)throw new Error("No UTXOs to send");let N=Number(l.toFixed(0)),F=f?this.compileMemo(f):null,j=[];j.push({address:c,value:A.amount().toNumber()}),F&&j.push({script:F,value:0});let{inputs:te,outputs:v}=kRs(w,j,N);if(!te||!v)throw new Error("Balance insufficient for transaction");let ne=new Ow.Psbt({network:A6t(this.network)});ne.setMaximumFeeRate(75e5);for(let Z of te)ne.addInput({hash:Z.hash,index:Z.index,nonWitnessUtxo:Buffer.from(Z.txHex,"hex")});return v.forEach(Z=>{Z.address||(Z.address=g),Z.script?F&&ne.addOutput({script:F,value:0}):ne.addOutput(Z)}),{psbt:ne,utxos:w}})}getAddress(i=0){if(i<0)throw new Error("index must be greater than zero");if(this.phrase){let A=A6t(this.network),c=this.getDogeKeys(this.phrase,i),{address:f}=Ow.payments.p2pkh({pubkey:c.publicKey,network:A});if(!f)throw new Error("Address not defined");return f}throw new Error("Phrase must be provided")}getAddressAsync(i=0){return uqe(this,void 0,void 0,function*(){return this.getAddress(i)})}getAssetInfo(){return{asset:c6t,decimal:DRs}}getDogeKeys(i,A=0){let c=A6t(this.network),f=hX(i),l=Ow.bip32.fromSeed(f,c).derivePath(this.getFullDerivationPath(A));if(!l.privateKey)throw new Error("Could not get private key from phrase");return Ow.ECPair.fromPrivateKey(l.privateKey,{network:c})}validateAddress(i){return LRs(i,this.network)}transfer(i){return uqe(this,void 0,void 0,function*(){let A=i.feeRate||(yield this.getFeeRates())[sd.Fast];ST(this.feeBounds,A);let c=(i==null?void 0:i.walletIndex)||0,{rawUnsignedTx:f}=yield this.prepareTx(Object.assign(Object.assign({},i),{feeRate:A,sender:yield this.getAddressAsync(c)})),l=this.getDogeKeys(this.phrase,c),g=Ow.Psbt.fromBase64(f,{maximumFeeRate:75e5});g.signAllInputs(l),g.finalizeAllInputs();let w=g.extractTransaction().toHex();return yield this.roundRobinBroadcastTx(w)})}createTxInfo(i){return uqe(this,void 0,void 0,function*(){let{psbt:A,utxos:c}=yield this.buildTx(i);return{utxos:c,newTxHex:A.data.globalMap.unsignedTx.toBuffer().toString("hex")}})}prepareTx({sender:i,memo:A,amount:c,recipient:f,feeRate:l}){return uqe(this,void 0,void 0,function*(){let{psbt:g}=yield this.buildTx({sender:i,recipient:f,amount:c,feeRate:l,memo:A});return{rawUnsignedTx:g.toBase64()}})}compileMemo(i){let A=Buffer.from(i,"utf8");return Ow.script.compile([Ow.opcodes.OP_RETURN,A])}getFeeFromUtxos(i,A,c=null){let f=i.length>0?i.reduce(w=>w+HRs(),0)+i.length:0,l=URs+f+jIn+Vei+jIn+Vei;c&&(l+=jIn+c.length);let g=l*A;return g>Lei?g:Lei}};import*as Nw from"bitcoinjs-lib";import GRs from"coinselect/accumulative";import zei from"coininfo";import Wei from"axios";function WSe(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var Zei=1e3,qRs=.5,KRs=500,YRs=8,ZSe="LTC",l6t={chain:ZSe,symbol:"LTC",ticker:"LTC",synth:!1},Xei=new By("https://blockchair.com/litecoin/","https://blockchair.com/litecoin/address/%%ADDRESS%%","https://blockchair.com/litecoin/transaction/%%TX_ID%%"),VRs=new By("https://blockexplorer.one/litecoin/testnet/","https://blockexplorer.one/litecoin/testnet/address/%%ADDRESS%%","https://blockexplorer.one/litecoin/testnet/blockHash/%%TX_ID%%"),zRs={[eo.Testnet]:VRs,[eo.Stagenet]:Xei,[eo.Mainnet]:Xei},WRs=new QT("https://sochain.com/api/v3",process.env.SOCHAIN_API_KEY||"",ZSe,l6t,8,wT.LTCTEST),$ei=new QT("https://sochain.com/api/v3",process.env.SOCHAIN_API_KEY||"",ZSe,l6t,8,wT.LTC),FMs={[eo.Testnet]:WRs,[eo.Stagenet]:$ei,[eo.Mainnet]:$ei},jei=new vY("https://api.blockcypher.com/v1",ZSe,l6t,8,bY.LTC,process.env.BLOCKCYPHER_API_KEY||""),ZRs={[eo.Testnet]:void 0,[eo.Stagenet]:jei,[eo.Mainnet]:jei},eti=new AH({baseUrl:"https://app.bitgo.com",chain:ZSe}),XRs={[eo.Testnet]:void 0,[eo.Stagenet]:eti,[eo.Mainnet]:eti},$Rs=({txHex:e,auth:i,nodeUrl:A})=>WSe(void 0,void 0,void 0,function*(){let c=new Date().getTime().toString(),f={jsonrpc:"2.0",method:"sendrawtransaction",params:[e],id:c},l;if(i?l=(yield Wei.post(A,f,{auth:i})).data:l=(yield Wei.post(A,f)).data,l.error)throw new Error(`Failed to broadcast the transaction: ${l.error}`);return l.result}),jRs=10,e9s=41,t9s=107,tCn=9,tti=25;function n9s(e){var i;return e9s+(!((i=e.witnessUtxo)===null||i===void 0)&&i.script?e.witnessUtxo.script.length:t9s)}var u6t=e=>{switch(e){case eo.Mainnet:case eo.Stagenet:return zei.litecoin.main.toBitcoinJS();case eo.Testnet:return zei.litecoin.test.toBitcoinJS()}},r9s=(e,i)=>{try{return Nw.address.toOutputScript(e,u6t(i)),!0}catch(A){return!1}},i9s=e=>WSe(void 0,void 0,void 0,function*(){return yield $Rs(e)});var nCn={network:eo.Mainnet,phrase:"",explorerProviders:zRs,dataProviders:[XRs,ZRs],rootDerivationPaths:{[eo.Mainnet]:"m/84'/2'/0'/0/",[eo.Testnet]:"m/84'/1'/0'/0/",[eo.Stagenet]:"m/84'/2'/0'/0/"},feeBounds:{lower:qRs,upper:KRs},nodeUrls:{[eo.Mainnet]:"https://litecoin.ninerealms.com",[eo.Stagenet]:"https://litecoin.ninerealms.com",[eo.Testnet]:"https://testnet.ltc.thorchain.info"}},f6t=class extends sH{constructor(i=nCn){super(ZSe,{network:i.network,rootDerivationPaths:i.rootDerivationPaths,phrase:i.phrase,feeBounds:i.feeBounds,explorerProviders:i.explorerProviders,dataProviders:i.dataProviders}),this.nodeUrls=i.nodeUrls,this.nodeAuth=i.nodeAuth}getAddress(i=0){if(i<0)throw new Error("index must be greater than zero");if(this.phrase){let A=u6t(this.network),c=this.getLtcKeys(this.phrase,i),{address:f}=Nw.payments.p2wpkh({pubkey:c.publicKey,network:A});if(!f)throw new Error("Address not defined");return f}throw new Error("Phrase must be provided")}getAddressAsync(i=0){return WSe(this,void 0,void 0,function*(){return this.getAddress(i)})}getAssetInfo(){return{asset:l6t,decimal:YRs}}getLtcKeys(i,A=0){let c=u6t(this.network),f=hX(i),l=Nw.bip32.fromSeed(f,c).derivePath(this.getFullDerivationPath(A));if(!l.privateKey)throw new Error("Could not get private key from phrase");return Nw.ECPair.fromPrivateKey(l.privateKey,{network:c})}validateAddress(i){return r9s(i,this.network)}transfer(i){return WSe(this,void 0,void 0,function*(){let A=i.feeRate||(yield this.getFeeRates())[sd.Fast];ST(this.feeBounds,A);let c=i.walletIndex||0,{rawUnsignedTx:f}=yield this.prepareTx(Object.assign(Object.assign({},i),{feeRate:A,sender:yield this.getAddressAsync(c)})),l=Nw.Psbt.fromBase64(f),g=this.getLtcKeys(this.phrase,c);l.signAllInputs(g),l.finalizeAllInputs();let w=l.extractTransaction().toHex();return yield i9s({txHex:w,nodeUrl:this.nodeUrls[this.network],auth:this.nodeAuth})})}buildTx({amount:i,recipient:A,memo:c,feeRate:f,sender:l}){return WSe(this,void 0,void 0,function*(){if(!this.validateAddress(A))throw new Error("Invalid address");let g=yield this.scanUTXOs(l,!1);if(g.length===0)throw new Error("No utxos to send");let w=Number(f.toFixed(0)),N=c?this.compileMemo(c):null,F=[];F.push({address:A,value:i.amount().toNumber()}),N&&F.push({script:N,value:0});let{inputs:j,outputs:te}=GRs(g,F,w);if(!j||!te)throw new Error("Insufficient Balance for transaction");let v=new Nw.Psbt({network:u6t(this.network)});return j.forEach(ne=>v.addInput({hash:ne.hash,index:ne.index,witnessUtxo:ne.witnessUtxo})),te.forEach(ne=>{ne.address||(ne.address=l),ne.script?N&&v.addOutput({script:N,value:0}):v.addOutput(ne)}),{psbt:v,utxos:g}})}prepareTx({sender:i,memo:A,amount:c,recipient:f,feeRate:l}){return WSe(this,void 0,void 0,function*(){let{psbt:g}=yield this.buildTx({sender:i,recipient:f,amount:c,feeRate:l,memo:A});return{rawUnsignedTx:g.toBase64()}})}compileMemo(i){let A=Buffer.from(i,"utf8");return Nw.script.compile([Nw.opcodes.OP_RETURN,A])}getFeeFromUtxos(i,A,c=null){let f=i.length>0?i.reduce((w,N)=>w+n9s(N),0)+i.length:0,l=jRs+f+i.length+tCn+tti+tCn+tti;c&&(l+=tCn+c.length);let g=l*A;return g>Zei?g:Zei}};import{BigNumber as SD}from"bignumber.js";import J1 from"axios";var o9s="https://midgard.ninerealms.com/";function rc(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var H1="http://localhost".replace(/\/+$/,""),rCn=class{constructor(i,A=H1,c=J1){this.basePath=A,this.axios=c,i&&(this.configuration=i,this.basePath=i.basePath||this.basePath)}},iCn=class extends Error{constructor(i,A){super(A),this.field=i,this.name="RequiredError"}},$1="https://example.com",zF=function(e,i,A){if(A==null)throw new iCn(i,`Required parameter ${i} was null or undefined when calling ${e}.`)};function oCn(e,i,A=""){typeof i=="object"?Array.isArray(i)?i.forEach(c=>oCn(e,c,A)):Object.keys(i).forEach(c=>oCn(e,i[c],`${A}${A!==""?".":""}${c}`)):e.has(A)?e.append(A,i):e.set(A,i)}var j1=function(e,...i){let A=new URLSearchParams(e.search);oCn(A,i),e.search=A.toString()},ep=function(e){return e.pathname+e.search+e.hash},tp=function(e,i,A,c){return(f=i,l=A)=>{let g=Object.assign(Object.assign({},e.options),{url:((c==null?void 0:c.basePath)||l)+e.url});return f.request(g)}};var a9s=function(e){return{getActions:(i,A,c,f,l,g,w,N,F,j,te,v,ne,Z={})=>rc(this,void 0,void 0,function*(){let R="/v2/actions",M=new URL(R,$1),U;e&&(U=e.baseOptions);let E=Object.assign(Object.assign({method:"GET"},U),Z),Q={},H={};i!==void 0&&(H.address=i),A!==void 0&&(H.txid=A),c!==void 0&&(H.asset=c),f!==void 0&&(H.type=f),l!==void 0&&(H.affiliate=l),g!==void 0&&(H.limit=g),w!==void 0&&(H.offset=w),N!==void 0&&(H.nextPageToken=N),F!==void 0&&(H.timestamp=F),j!==void 0&&(H.height=j),te!==void 0&&(H.prevPageToken=te),v!==void 0&&(H.fromTimestamp=v),ne!==void 0&&(H.fromHeight=ne),j1(M,H);let re=U&&U.headers?U.headers:{};return E.headers=Object.assign(Object.assign(Object.assign({},Q),re),Z.headers),{url:ep(M),options:E}}),getBalance:(i,A,c,f={})=>rc(this,void 0,void 0,function*(){zF("getBalance","address",i);let l="/v2/balance/{address}".replace("{address}",encodeURIComponent(String(i))),g=new URL(l,$1),w;e&&(w=e.baseOptions);let N=Object.assign(Object.assign({method:"GET"},w),f),F={},j={};A!==void 0&&(j.timestamp=A),c!==void 0&&(j.height=c),j1(g,j);let te=w&&w.headers?w.headers:{};return N.headers=Object.assign(Object.assign(Object.assign({},F),te),f.headers),{url:ep(g),options:N}}),getBorrowerDetail:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getBorrowerDetail","address",i);let c="/v2/borrower/{address}".replace("{address}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getBorrowersAddresses:(i,A={})=>rc(this,void 0,void 0,function*(){let c="/v2/borrowers",f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.asset=i),j1(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getChurns:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/churns",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getDepthHistory:(i,A,c,f,l,g={})=>rc(this,void 0,void 0,function*(){zF("getDepthHistory","pool",i);let w="/v2/history/depths/{pool}".replace("{pool}",encodeURIComponent(String(i))),N=new URL(w,$1),F;e&&(F=e.baseOptions);let j=Object.assign(Object.assign({method:"GET"},F),g),te={},v={};A!==void 0&&(v.interval=A),c!==void 0&&(v.count=c),f!==void 0&&(v.to=f),l!==void 0&&(v.from=l),j1(N,v);let ne=F&&F.headers?F.headers:{};return j.headers=Object.assign(Object.assign(Object.assign({},te),ne),g.headers),{url:ep(N),options:j}}),getEarningsHistory:(i,A,c,f,l={})=>rc(this,void 0,void 0,function*(){let g="/v2/history/earnings",w=new URL(g,$1),N;e&&(N=e.baseOptions);let F=Object.assign(Object.assign({method:"GET"},N),l),j={},te={};i!==void 0&&(te.interval=i),A!==void 0&&(te.count=A),c!==void 0&&(te.to=c),f!==void 0&&(te.from=f),j1(w,te);let v=N&&N.headers?N.headers:{};return F.headers=Object.assign(Object.assign(Object.assign({},j),v),l.headers),{url:ep(w),options:F}}),getHealth:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/health",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getKnownPools:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/knownpools",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getLiquidityHistory:(i,A,c,f,l,g={})=>rc(this,void 0,void 0,function*(){let w="/v2/history/liquidity_changes",N=new URL(w,$1),F;e&&(F=e.baseOptions);let j=Object.assign(Object.assign({method:"GET"},F),g),te={},v={};i!==void 0&&(v.pool=i),A!==void 0&&(v.interval=A),c!==void 0&&(v.count=c),f!==void 0&&(v.to=f),l!==void 0&&(v.from=l),j1(N,v);let ne=F&&F.headers?F.headers:{};return j.headers=Object.assign(Object.assign(Object.assign({},te),ne),g.headers),{url:ep(N),options:j}}),getMemberDetail:(i,A,c={})=>rc(this,void 0,void 0,function*(){zF("getMemberDetail","address",i);let f="/v2/member/{address}".replace("{address}",encodeURIComponent(String(i))),l=new URL(f,$1),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.showSavers=A),j1(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:ep(l),options:w}}),getMembersAdresses:(i,A={})=>rc(this,void 0,void 0,function*(){let c="/v2/members",f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.pool=i),j1(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getNetworkData:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/network",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getNodes:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/nodes",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getPool:(i,A,c={})=>rc(this,void 0,void 0,function*(){zF("getPool","asset",i);let f="/v2/pool/{asset}".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,$1),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.period=A),j1(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:ep(l),options:w}}),getPoolStats:(i,A,c={})=>rc(this,void 0,void 0,function*(){zF("getPoolStats","asset",i);let f="/v2/pool/{asset}/stats".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,$1),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.period=A),j1(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:ep(l),options:w}}),getPools:(i,A,c={})=>rc(this,void 0,void 0,function*(){let f="/v2/pools",l=new URL(f,$1),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};i!==void 0&&(F.status=i),A!==void 0&&(F.period=A),j1(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:ep(l),options:w}}),getSaverDetail:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getSaverDetail","address",i);let c="/v2/saver/{address}".replace("{address}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getSaversHistory:(i,A,c,f,l,g={})=>rc(this,void 0,void 0,function*(){zF("getSaversHistory","pool",i);let w="/v2/history/savers/{pool}".replace("{pool}",encodeURIComponent(String(i))),N=new URL(w,$1),F;e&&(F=e.baseOptions);let j=Object.assign(Object.assign({method:"GET"},F),g),te={},v={};A!==void 0&&(v.interval=A),c!==void 0&&(v.count=c),f!==void 0&&(v.to=f),l!==void 0&&(v.from=l),j1(N,v);let ne=F&&F.headers?F.headers:{};return j.headers=Object.assign(Object.assign(Object.assign({},te),ne),g.headers),{url:ep(N),options:j}}),getStats:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/stats",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getSwapHistory:(i,A,c,f,l,g={})=>rc(this,void 0,void 0,function*(){let w="/v2/history/swaps",N=new URL(w,$1),F;e&&(F=e.baseOptions);let j=Object.assign(Object.assign({method:"GET"},F),g),te={},v={};i!==void 0&&(v.pool=i),A!==void 0&&(v.interval=A),c!==void 0&&(v.count=c),f!==void 0&&(v.to=f),l!==void 0&&(v.from=l),j1(N,v);let ne=F&&F.headers?F.headers:{};return j.headers=Object.assign(Object.assign(Object.assign({},te),ne),g.headers),{url:ep(N),options:j}}),getTHORNameDetail:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getTHORNameDetail","name",i);let c="/v2/thorname/lookup/{name}".replace("{name}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getTHORNamesByAddress:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getTHORNamesByAddress","address",i);let c="/v2/thorname/rlookup/{address}".replace("{address}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getTHORNamesOwnerByAddress:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getTHORNamesOwnerByAddress","address",i);let c="/v2/thorname/owner/{address}".replace("{address}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getTVLHistory:(i,A,c,f,l={})=>rc(this,void 0,void 0,function*(){let g="/v2/history/tvl",w=new URL(g,$1),N;e&&(N=e.baseOptions);let F=Object.assign(Object.assign({method:"GET"},N),l),j={},te={};i!==void 0&&(te.interval=i),A!==void 0&&(te.count=A),c!==void 0&&(te.to=c),f!==void 0&&(te.from=f),j1(w,te);let v=N&&N.headers?N.headers:{};return F.headers=Object.assign(Object.assign(Object.assign({},j),v),l.headers),{url:ep(w),options:F}})}},np=function(e){let i=a9s(e);return{getActions(A,c,f,l,g,w,N,F,j,te,v,ne,Z,R){return rc(this,void 0,void 0,function*(){let M=yield i.getActions(A,c,f,l,g,w,N,F,j,te,v,ne,Z,R);return tp(M,J1,H1,e)})},getBalance(A,c,f,l){return rc(this,void 0,void 0,function*(){let g=yield i.getBalance(A,c,f,l);return tp(g,J1,H1,e)})},getBorrowerDetail(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getBorrowerDetail(A,c);return tp(f,J1,H1,e)})},getBorrowersAddresses(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getBorrowersAddresses(A,c);return tp(f,J1,H1,e)})},getChurns(A){return rc(this,void 0,void 0,function*(){let c=yield i.getChurns(A);return tp(c,J1,H1,e)})},getDepthHistory(A,c,f,l,g,w){return rc(this,void 0,void 0,function*(){let N=yield i.getDepthHistory(A,c,f,l,g,w);return tp(N,J1,H1,e)})},getEarningsHistory(A,c,f,l,g){return rc(this,void 0,void 0,function*(){let w=yield i.getEarningsHistory(A,c,f,l,g);return tp(w,J1,H1,e)})},getHealth(A){return rc(this,void 0,void 0,function*(){let c=yield i.getHealth(A);return tp(c,J1,H1,e)})},getKnownPools(A){return rc(this,void 0,void 0,function*(){let c=yield i.getKnownPools(A);return tp(c,J1,H1,e)})},getLiquidityHistory(A,c,f,l,g,w){return rc(this,void 0,void 0,function*(){let N=yield i.getLiquidityHistory(A,c,f,l,g,w);return tp(N,J1,H1,e)})},getMemberDetail(A,c,f){return rc(this,void 0,void 0,function*(){let l=yield i.getMemberDetail(A,c,f);return tp(l,J1,H1,e)})},getMembersAdresses(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getMembersAdresses(A,c);return tp(f,J1,H1,e)})},getNetworkData(A){return rc(this,void 0,void 0,function*(){let c=yield i.getNetworkData(A);return tp(c,J1,H1,e)})},getNodes(A){return rc(this,void 0,void 0,function*(){let c=yield i.getNodes(A);return tp(c,J1,H1,e)})},getPool(A,c,f){return rc(this,void 0,void 0,function*(){let l=yield i.getPool(A,c,f);return tp(l,J1,H1,e)})},getPoolStats(A,c,f){return rc(this,void 0,void 0,function*(){let l=yield i.getPoolStats(A,c,f);return tp(l,J1,H1,e)})},getPools(A,c,f){return rc(this,void 0,void 0,function*(){let l=yield i.getPools(A,c,f);return tp(l,J1,H1,e)})},getSaverDetail(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getSaverDetail(A,c);return tp(f,J1,H1,e)})},getSaversHistory(A,c,f,l,g,w){return rc(this,void 0,void 0,function*(){let N=yield i.getSaversHistory(A,c,f,l,g,w);return tp(N,J1,H1,e)})},getStats(A){return rc(this,void 0,void 0,function*(){let c=yield i.getStats(A);return tp(c,J1,H1,e)})},getSwapHistory(A,c,f,l,g,w){return rc(this,void 0,void 0,function*(){let N=yield i.getSwapHistory(A,c,f,l,g,w);return tp(N,J1,H1,e)})},getTHORNameDetail(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getTHORNameDetail(A,c);return tp(f,J1,H1,e)})},getTHORNamesByAddress(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getTHORNamesByAddress(A,c);return tp(f,J1,H1,e)})},getTHORNamesOwnerByAddress(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getTHORNamesOwnerByAddress(A,c);return tp(f,J1,H1,e)})},getTVLHistory(A,c,f,l,g){return rc(this,void 0,void 0,function*(){let w=yield i.getTVLHistory(A,c,f,l,g);return tp(w,J1,H1,e)})}}};var aCn=class extends rCn{getActions(i,A,c,f,l,g,w,N,F,j,te,v,ne,Z){return np(this.configuration).getActions(i,A,c,f,l,g,w,N,F,j,te,v,ne,Z).then(R=>R(this.axios,this.basePath))}getBalance(i,A,c,f){return np(this.configuration).getBalance(i,A,c,f).then(l=>l(this.axios,this.basePath))}getBorrowerDetail(i,A){return np(this.configuration).getBorrowerDetail(i,A).then(c=>c(this.axios,this.basePath))}getBorrowersAddresses(i,A){return np(this.configuration).getBorrowersAddresses(i,A).then(c=>c(this.axios,this.basePath))}getChurns(i){return np(this.configuration).getChurns(i).then(A=>A(this.axios,this.basePath))}getDepthHistory(i,A,c,f,l,g){return np(this.configuration).getDepthHistory(i,A,c,f,l,g).then(w=>w(this.axios,this.basePath))}getEarningsHistory(i,A,c,f,l){return np(this.configuration).getEarningsHistory(i,A,c,f,l).then(g=>g(this.axios,this.basePath))}getHealth(i){return np(this.configuration).getHealth(i).then(A=>A(this.axios,this.basePath))}getKnownPools(i){return np(this.configuration).getKnownPools(i).then(A=>A(this.axios,this.basePath))}getLiquidityHistory(i,A,c,f,l,g){return np(this.configuration).getLiquidityHistory(i,A,c,f,l,g).then(w=>w(this.axios,this.basePath))}getMemberDetail(i,A,c){return np(this.configuration).getMemberDetail(i,A,c).then(f=>f(this.axios,this.basePath))}getMembersAdresses(i,A){return np(this.configuration).getMembersAdresses(i,A).then(c=>c(this.axios,this.basePath))}getNetworkData(i){return np(this.configuration).getNetworkData(i).then(A=>A(this.axios,this.basePath))}getNodes(i){return np(this.configuration).getNodes(i).then(A=>A(this.axios,this.basePath))}getPool(i,A,c){return np(this.configuration).getPool(i,A,c).then(f=>f(this.axios,this.basePath))}getPoolStats(i,A,c){return np(this.configuration).getPoolStats(i,A,c).then(f=>f(this.axios,this.basePath))}getPools(i,A,c){return np(this.configuration).getPools(i,A,c).then(f=>f(this.axios,this.basePath))}getSaverDetail(i,A){return np(this.configuration).getSaverDetail(i,A).then(c=>c(this.axios,this.basePath))}getSaversHistory(i,A,c,f,l,g){return np(this.configuration).getSaversHistory(i,A,c,f,l,g).then(w=>w(this.axios,this.basePath))}getStats(i){return np(this.configuration).getStats(i).then(A=>A(this.axios,this.basePath))}getSwapHistory(i,A,c,f,l,g){return np(this.configuration).getSwapHistory(i,A,c,f,l,g).then(w=>w(this.axios,this.basePath))}getTHORNameDetail(i,A){return np(this.configuration).getTHORNameDetail(i,A).then(c=>c(this.axios,this.basePath))}getTHORNamesByAddress(i,A){return np(this.configuration).getTHORNamesByAddress(i,A).then(c=>c(this.axios,this.basePath))}getTHORNamesOwnerByAddress(i,A){return np(this.configuration).getTHORNamesOwnerByAddress(i,A).then(c=>c(this.axios,this.basePath))}getTVLHistory(i,A,c,f,l){return np(this.configuration).getTVLHistory(i,A,c,f,l).then(g=>g(this.axios,this.basePath))}};var fqe=class{constructor(i={}){this.apiKey=i.apiKey,this.username=i.username,this.password=i.password,this.accessToken=i.accessToken,this.basePath=i.basePath,this.baseOptions=i.baseOptions,this.formDataCtor=i.formDataCtor}isJsonMime(i){let A=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return i!==null&&(A.test(i)||i.toLowerCase()==="application/json-patch+json")}},s9s=o9s,A9s=new fqe({basePath:s9s}),h6t=class extends aCn{constructor(i=A9s){super(i)}};import d9s from"axios";import nti from"axios-retry";function zM(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var c9s={mainnet:{apiRetries:3,midgardBaseUrls:["https://midgard.ninerealms.com"]},stagenet:{apiRetries:3,midgardBaseUrls:["https://stagenet-midgard.ninerealms.com"]},testnet:{apiRetries:3,midgardBaseUrls:["https://testnet.midgard.thorchain.info"]}},sCn=class{constructor(i=eo.Mainnet,A){this.network=i,this.config=A!=null?A:c9s[this.network],nti(d9s,{retries:this.config.apiRetries,retryDelay:nti.exponentialDelay}),this.midgardApis=this.config.midgardBaseUrls.map(c=>new h6t(new fqe({basePath:c})))}getSavers(i){return zM(this,void 0,void 0,function*(){for(let A of this.midgardApis)try{return(yield A.getSaverDetail(i)).data}catch(c){}throw Error("Midgard not responding")})}getPools(){return zM(this,void 0,void 0,function*(){for(let i of this.midgardApis)try{return(yield i.getPools()).data}catch(A){}throw new Error("Midgard not responding")})}getTHORNameDetails(i){return zM(this,void 0,void 0,function*(){for(let A of this.midgardApis)try{let c=yield A.getTHORNameDetail(i);if(c.status==404)return;if(c.status==200)return c.data}catch(c){if(c.response.status==404)return}throw Error("Midgard not responding")})}getTHORNameReverseLookup(i){return zM(this,void 0,void 0,function*(){for(let A of this.midgardApis)try{let c=yield A.getTHORNamesByAddress(i);if(c.status==404)return[];if(c.status==200)return c.data}catch(c){if(c.response.status==404)return[]}throw Error("Midgard not responding")})}getActions({address:i,txid:A,asset:c,type:f,affiliate:l,limit:g,offset:w,nextPageToken:N,timestamp:F,height:j,prevPageToken:te,fromTimestamp:v,fromHeight:ne}){return zM(this,void 0,void 0,function*(){for(let Z of this.midgardApis)try{return(yield Z.getActions(i,A,c,f,l,g,w,N,F,j,te,v,ne)).data}catch(R){}throw new Error("Midgard not responding")})}},u9s=5e3,f9s=5e3,l9s=new sCn,ACn=class{constructor(i=l9s){this.midgard=i,this.cachedPools=new bI(()=>this.midgard.getPools(),u9s),this.cachedSavers=new bI(()=>this.midgard.getSavers(""),f9s)}getPools(){return zM(this,void 0,void 0,function*(){return this.cachedPools.getValue()})}getSavers(i){return zM(this,void 0,void 0,function*(){return this.cachedSavers.getValue(i)})}};yl("AVAX.AVAX");yl("BTC.BTC");yl("GAIA.ATOM");var h9s=yl("THOR.RUNE"),g9s=e=>ec(e)===ec(h9s),p9s=8,y9s=new ACn,g6t=class{constructor(i=y9s){this.midgardCache=i}getPool(i){return zM(this,void 0,void 0,function*(){let c=(yield this.midgardCache.getPools()).find(f=>f.asset===i);if(!c)throw new Error(`Can't find pool for asset: ${i}`);return c})}getSaverPositions(i){return zM(this,void 0,void 0,function*(){let A=new Set;i.forEach(N=>A.add(N.address));let c=Array.from(A).join(","),f=yield this.midgardCache.getSavers(c),l=[],g=[],w=f.pools.map(N=>zM(this,void 0,void 0,function*(){let F=tJ(N.pool);if(F){let j=yield this.getPool(N.pool),te=new ia(wo(N.assetAdded).minus(N.assetWithdrawn),F),v=Number(N==null?void 0:N.saverUnits),ne=Number(j.saversUnits),Z=Number(j.saversDepth),R=v/ne*Z,M=new ia(wo(R),F),U=M.minus(te).div(te).times(100),E=(Date.now()/1e3-Number(N.dateLastAdded))/(365*86400);g.push({depositValue:te,redeemableValue:M,lastAddHeight:-1,percentageGrowth:U.assetAmount.amount().toNumber(),ageInYears:E,ageInDays:E*365,asset:F,errors:l})}}));return yield Promise.all(w),g})}getDecimalForAsset(i){return zM(this,void 0,void 0,function*(){if(g9s(i)||i.synth)return p9s;let A=yield this.getPool(ec(i));return Number(A.nativeDecimal)})}getActions({address:i,txid:A,asset:c,type:f,affiliate:l,limit:g,offset:w,nextPageToken:N,timestamp:F,height:j,prevPageToken:te,fromTimestamp:v,fromHeight:ne}){return zM(this,void 0,void 0,function*(){return this.midgardCache.midgard.getActions({address:i,txid:A,asset:c,type:f,affiliate:l,limit:g,offset:w,nextPageToken:N,timestamp:F,height:j,prevPageToken:te,fromTimestamp:v,fromHeight:ne})})}};import gl from"axios";function Y0(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var pl="http://localhost".replace(/\/+$/,""),WF=class{constructor(i,A=pl,c=gl){this.basePath=A,this.axios=c,i&&(this.configuration=i,this.basePath=i.basePath||this.basePath)}},dCn=class extends Error{constructor(i,A){super(A),this.field=i,this.name="RequiredError"}},ml="https://example.com",x3=function(e,i,A){if(A==null)throw new dCn(i,`Required parameter ${i} was null or undefined when calling ${e}.`)};function cCn(e,i,A=""){typeof i=="object"?Array.isArray(i)?i.forEach(c=>cCn(e,c,A)):Object.keys(i).forEach(c=>cCn(e,i[c],`${A}${A!==""?".":""}${c}`)):e.has(A)?e.append(A,i):e.set(A,i)}var Il=function(e,...i){let A=new URLSearchParams(e.search);cCn(A,i),e.search=A.toString()},Cl=function(e){return e.pathname+e.search+e.hash},_l=function(e,i,A,c){return(f=i,l=A)=>{let g=Object.assign(Object.assign({},e.options),{url:((c==null?void 0:c.basePath)||l)+e.url});return f.request(g)}};var m9s=function(e){return{liquidityProvider:(i,A,c,f={})=>Y0(this,void 0,void 0,function*(){x3("liquidityProvider","asset",i),x3("liquidityProvider","address",A);let l="/thorchain/pool/{asset}/liquidity_provider/{address}".replace("{asset}",encodeURIComponent(String(i))).replace("{address}",encodeURIComponent(String(A))),g=new URL(l,ml),w;e&&(w=e.baseOptions);let N=Object.assign(Object.assign({method:"GET"},w),f),F={},j={};c!==void 0&&(j.height=c),Il(g,j);let te=w&&w.headers?w.headers:{};return N.headers=Object.assign(Object.assign(Object.assign({},F),te),f.headers),{url:Cl(g),options:N}}),liquidityProviders:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("liquidityProviders","asset",i);let f="/thorchain/pool/{asset}/liquidity_providers".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}})}},rti=function(e){let i=m9s(e);return{liquidityProvider(A,c,f,l){return Y0(this,void 0,void 0,function*(){let g=yield i.liquidityProvider(A,c,f,l);return _l(g,gl,pl,e)})},liquidityProviders(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.liquidityProviders(A,c,f);return _l(l,gl,pl,e)})}}};var m6t=class extends WF{liquidityProvider(i,A,c,f){return rti(this.configuration).liquidityProvider(i,A,c,f).then(l=>l(this.axios,this.basePath))}liquidityProviders(i,A,c){return rti(this.configuration).liquidityProviders(i,A,c).then(f=>f(this.axios,this.basePath))}},I9s=function(e){return{mimir:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimir",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),mimirAdmin:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimir/admin",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),mimirKey:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("mimirKey","key",i);let f="/thorchain/mimir/key/{key}".replace("{key}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),mimirNode:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("mimirNode","address",i);let f="/thorchain/mimir/node/{address}".replace("{address}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),mimirNodes:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimir/nodes_all",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),mimirV2:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimirV2",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),mimirV2IDs:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimirV2/ids",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}})}},jfe=function(e){let i=I9s(e);return{mimir(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimir(A,c);return _l(f,gl,pl,e)})},mimirAdmin(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimirAdmin(A,c);return _l(f,gl,pl,e)})},mimirKey(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.mimirKey(A,c,f);return _l(l,gl,pl,e)})},mimirNode(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.mimirNode(A,c,f);return _l(l,gl,pl,e)})},mimirNodes(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimirNodes(A,c);return _l(f,gl,pl,e)})},mimirV2(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimirV2(A,c);return _l(f,gl,pl,e)})},mimirV2IDs(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimirV2IDs(A,c);return _l(f,gl,pl,e)})}}};var I6t=class extends WF{mimir(i,A){return jfe(this.configuration).mimir(i,A).then(c=>c(this.axios,this.basePath))}mimirAdmin(i,A){return jfe(this.configuration).mimirAdmin(i,A).then(c=>c(this.axios,this.basePath))}mimirKey(i,A,c){return jfe(this.configuration).mimirKey(i,A,c).then(f=>f(this.axios,this.basePath))}mimirNode(i,A,c){return jfe(this.configuration).mimirNode(i,A,c).then(f=>f(this.axios,this.basePath))}mimirNodes(i,A){return jfe(this.configuration).mimirNodes(i,A).then(c=>c(this.axios,this.basePath))}mimirV2(i,A){return jfe(this.configuration).mimirV2(i,A).then(c=>c(this.axios,this.basePath))}mimirV2IDs(i,A){return jfe(this.configuration).mimirV2IDs(i,A).then(c=>c(this.axios,this.basePath))}},C9s=function(e){return{ban:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("ban","address",i);let f="/thorchain/ban/{address}".replace("{address}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),constants:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/constants",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),inboundAddresses:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/inbound_addresses",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),lastblock:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/lastblock",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),lastblockChain:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("lastblockChain","chain",i);let f="/thorchain/lastblock/{chain}".replace("{chain}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),network:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/network",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),ragnarok:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/ragnarok",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),version:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/version",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}})}},poe=function(e){let i=C9s(e);return{ban(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.ban(A,c,f);return _l(l,gl,pl,e)})},constants(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.constants(A,c);return _l(f,gl,pl,e)})},inboundAddresses(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.inboundAddresses(A,c);return _l(f,gl,pl,e)})},lastblock(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.lastblock(A,c);return _l(f,gl,pl,e)})},lastblockChain(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.lastblockChain(A,c,f);return _l(l,gl,pl,e)})},network(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.network(A,c);return _l(f,gl,pl,e)})},ragnarok(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.ragnarok(A,c);return _l(f,gl,pl,e)})},version(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.version(A,c);return _l(f,gl,pl,e)})}}};var C6t=class extends WF{ban(i,A,c){return poe(this.configuration).ban(i,A,c).then(f=>f(this.axios,this.basePath))}constants(i,A){return poe(this.configuration).constants(i,A).then(c=>c(this.axios,this.basePath))}inboundAddresses(i,A){return poe(this.configuration).inboundAddresses(i,A).then(c=>c(this.axios,this.basePath))}lastblock(i,A){return poe(this.configuration).lastblock(i,A).then(c=>c(this.axios,this.basePath))}lastblockChain(i,A,c){return poe(this.configuration).lastblockChain(i,A,c).then(f=>f(this.axios,this.basePath))}network(i,A){return poe(this.configuration).network(i,A).then(c=>c(this.axios,this.basePath))}ragnarok(i,A){return poe(this.configuration).ragnarok(i,A).then(c=>c(this.axios,this.basePath))}version(i,A){return poe(this.configuration).version(i,A).then(c=>c(this.axios,this.basePath))}};var _9s=function(e){return{dpool:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("dpool","asset",i);let f="/thorchain/dpool/{asset}".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),dpools:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/dpools",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),pool:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("pool","asset",i);let f="/thorchain/pool/{asset}".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),pools:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/pools",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}})}},p6t=function(e){let i=_9s(e);return{dpool(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.dpool(A,c,f);return _l(l,gl,pl,e)})},dpools(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.dpools(A,c);return _l(f,gl,pl,e)})},pool(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.pool(A,c,f);return _l(l,gl,pl,e)})},pools(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.pools(A,c);return _l(f,gl,pl,e)})}}};var _6t=class extends WF{dpool(i,A,c){return p6t(this.configuration).dpool(i,A,c).then(f=>f(this.axios,this.basePath))}dpools(i,A){return p6t(this.configuration).dpools(i,A).then(c=>c(this.axios,this.basePath))}pool(i,A,c){return p6t(this.configuration).pool(i,A,c).then(f=>f(this.axios,this.basePath))}pools(i,A){return p6t(this.configuration).pools(i,A).then(c=>c(this.axios,this.basePath))}},E9s=function(e){return{queue:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/queue",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),queueOutbound:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/queue/outbound",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),queueScheduled:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/queue/scheduled",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),queueSwap:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/queue/swap",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}})}},y6t=function(e){let i=E9s(e);return{queue(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.queue(A,c);return _l(f,gl,pl,e)})},queueOutbound(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.queueOutbound(A,c);return _l(f,gl,pl,e)})},queueScheduled(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.queueScheduled(A,c);return _l(f,gl,pl,e)})},queueSwap(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.queueSwap(A,c);return _l(f,gl,pl,e)})}}};var E6t=class extends WF{queue(i,A){return y6t(this.configuration).queue(i,A).then(c=>c(this.axios,this.basePath))}queueOutbound(i,A){return y6t(this.configuration).queueOutbound(i,A).then(c=>c(this.axios,this.basePath))}queueScheduled(i,A){return y6t(this.configuration).queueScheduled(i,A).then(c=>c(this.axios,this.basePath))}queueSwap(i,A){return y6t(this.configuration).queueSwap(i,A).then(c=>c(this.axios,this.basePath))}},B9s=function(e){return{quoteloanclose:(i,A,c,f,l,g,w={})=>Y0(this,void 0,void 0,function*(){let N="/thorchain/quote/loan/close",F=new URL(N,ml),j;e&&(j=e.baseOptions);let te=Object.assign(Object.assign({method:"GET"},j),w),v={},ne={};i!==void 0&&(ne.height=i),A!==void 0&&(ne.from_asset=A),c!==void 0&&(ne.repay_bps=c),f!==void 0&&(ne.to_asset=f),l!==void 0&&(ne.loan_owner=l),g!==void 0&&(ne.min_out=g),Il(F,ne);let Z=j&&j.headers?j.headers:{};return te.headers=Object.assign(Object.assign(Object.assign({},v),Z),w.headers),{url:Cl(F),options:te}}),quoteloanopen:(i,A,c,f,l,g,w,N,F={})=>Y0(this,void 0,void 0,function*(){let j="/thorchain/quote/loan/open",te=new URL(j,ml),v;e&&(v=e.baseOptions);let ne=Object.assign(Object.assign({method:"GET"},v),F),Z={},R={};i!==void 0&&(R.height=i),A!==void 0&&(R.from_asset=A),c!==void 0&&(R.amount=c),f!==void 0&&(R.to_asset=f),l!==void 0&&(R.destination=l),g!==void 0&&(R.min_out=g),w!==void 0&&(R.affiliate_bps=w),N!==void 0&&(R.affiliate=N),Il(te,R);let M=v&&v.headers?v.headers:{};return ne.headers=Object.assign(Object.assign(Object.assign({},Z),M),F.headers),{url:Cl(te),options:ne}}),quotesaverdeposit:(i,A,c,f={})=>Y0(this,void 0,void 0,function*(){let l="/thorchain/quote/saver/deposit",g=new URL(l,ml),w;e&&(w=e.baseOptions);let N=Object.assign(Object.assign({method:"GET"},w),f),F={},j={};i!==void 0&&(j.height=i),A!==void 0&&(j.asset=A),c!==void 0&&(j.amount=c),Il(g,j);let te=w&&w.headers?w.headers:{};return N.headers=Object.assign(Object.assign(Object.assign({},F),te),f.headers),{url:Cl(g),options:N}}),quotesaverwithdraw:(i,A,c,f,l={})=>Y0(this,void 0,void 0,function*(){let g="/thorchain/quote/saver/withdraw",w=new URL(g,ml),N;e&&(N=e.baseOptions);let F=Object.assign(Object.assign({method:"GET"},N),l),j={},te={};i!==void 0&&(te.height=i),A!==void 0&&(te.asset=A),c!==void 0&&(te.address=c),f!==void 0&&(te.withdraw_bps=f),Il(w,te);let v=N&&N.headers?N.headers:{};return F.headers=Object.assign(Object.assign(Object.assign({},j),v),l.headers),{url:Cl(w),options:F}}),quoteswap:(i,A,c,f,l,g,w,N,F,j,te,v={})=>Y0(this,void 0,void 0,function*(){let ne="/thorchain/quote/swap",Z=new URL(ne,ml),R;e&&(R=e.baseOptions);let M=Object.assign(Object.assign({method:"GET"},R),v),U={},E={};i!==void 0&&(E.height=i),A!==void 0&&(E.from_asset=A),c!==void 0&&(E.to_asset=c),f!==void 0&&(E.amount=f),l!==void 0&&(E.destination=l),g!==void 0&&(E.refund_address=g),w!==void 0&&(E.streaming_interval=w),N!==void 0&&(E.streaming_quantity=N),F!==void 0&&(E.tolerance_bps=F),j!==void 0&&(E.affiliate_bps=j),te!==void 0&&(E.affiliate=te),Il(Z,E);let Q=R&&R.headers?R.headers:{};return M.headers=Object.assign(Object.assign(Object.assign({},U),Q),v.headers),{url:Cl(Z),options:M}})}},lqe=function(e){let i=B9s(e);return{quoteloanclose(A,c,f,l,g,w,N){return Y0(this,void 0,void 0,function*(){let F=yield i.quoteloanclose(A,c,f,l,g,w,N);return _l(F,gl,pl,e)})},quoteloanopen(A,c,f,l,g,w,N,F,j){return Y0(this,void 0,void 0,function*(){let te=yield i.quoteloanopen(A,c,f,l,g,w,N,F,j);return _l(te,gl,pl,e)})},quotesaverdeposit(A,c,f,l){return Y0(this,void 0,void 0,function*(){let g=yield i.quotesaverdeposit(A,c,f,l);return _l(g,gl,pl,e)})},quotesaverwithdraw(A,c,f,l,g){return Y0(this,void 0,void 0,function*(){let w=yield i.quotesaverwithdraw(A,c,f,l,g);return _l(w,gl,pl,e)})},quoteswap(A,c,f,l,g,w,N,F,j,te,v,ne){return Y0(this,void 0,void 0,function*(){let Z=yield i.quoteswap(A,c,f,l,g,w,N,F,j,te,v,ne);return _l(Z,gl,pl,e)})}}};var B6t=class extends WF{quoteloanclose(i,A,c,f,l,g,w){return lqe(this.configuration).quoteloanclose(i,A,c,f,l,g,w).then(N=>N(this.axios,this.basePath))}quoteloanopen(i,A,c,f,l,g,w,N,F){return lqe(this.configuration).quoteloanopen(i,A,c,f,l,g,w,N,F).then(j=>j(this.axios,this.basePath))}quotesaverdeposit(i,A,c,f){return lqe(this.configuration).quotesaverdeposit(i,A,c,f).then(l=>l(this.axios,this.basePath))}quotesaverwithdraw(i,A,c,f,l){return lqe(this.configuration).quotesaverwithdraw(i,A,c,f,l).then(g=>g(this.axios,this.basePath))}quoteswap(i,A,c,f,l,g,w,N,F,j,te,v){return lqe(this.configuration).quoteswap(i,A,c,f,l,g,w,N,F,j,te,v).then(ne=>ne(this.axios,this.basePath))}},v9s=function(e){return{saver:(i,A,c,f={})=>Y0(this,void 0,void 0,function*(){x3("saver","asset",i),x3("saver","address",A);let l="/thorchain/pool/{asset}/saver/{address}".replace("{asset}",encodeURIComponent(String(i))).replace("{address}",encodeURIComponent(String(A))),g=new URL(l,ml),w;e&&(w=e.baseOptions);let N=Object.assign(Object.assign({method:"GET"},w),f),F={},j={};c!==void 0&&(j.height=c),Il(g,j);let te=w&&w.headers?w.headers:{};return N.headers=Object.assign(Object.assign(Object.assign({},F),te),f.headers),{url:Cl(g),options:N}}),savers:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("savers","asset",i);let f="/thorchain/pool/{asset}/savers".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}})}},iti=function(e){let i=v9s(e);return{saver(A,c,f,l){return Y0(this,void 0,void 0,function*(){let g=yield i.saver(A,c,f,l);return _l(g,gl,pl,e)})},savers(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.savers(A,c,f);return _l(l,gl,pl,e)})}}};var v6t=class extends WF{saver(i,A,c,f){return iti(this.configuration).saver(i,A,c,f).then(l=>l(this.axios,this.basePath))}savers(i,A,c){return iti(this.configuration).savers(i,A,c).then(f=>f(this.axios,this.basePath))}};var b9s=function(e){return{thorname:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("thorname","name",i);let f="/thorchain/thorname/{name}".replace("{name}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}})}},S9s=function(e){let i=b9s(e);return{thorname(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.thorname(A,c,f);return _l(l,gl,pl,e)})}}};var b6t=class extends WF{thorname(i,A,c){return S9s(this.configuration).thorname(i,A,c).then(f=>f(this.axios,this.basePath))}};var w9s=function(e){return{tx:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("tx","hash",i);let f="/thorchain/tx/{hash}".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),txSigners:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("txSigners","hash",i);let f="/thorchain/tx/details/{hash}".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),txSignersOld:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("txSignersOld","hash",i);let f="/thorchain/tx/{hash}/signers".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),txStages:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("txStages","hash",i);let f="/thorchain/tx/stages/{hash}".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),txStatus:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("txStatus","hash",i);let f="/thorchain/tx/status/{hash}".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}})}},hqe=function(e){let i=w9s(e);return{tx(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.tx(A,c,f);return _l(l,gl,pl,e)})},txSigners(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.txSigners(A,c,f);return _l(l,gl,pl,e)})},txSignersOld(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.txSignersOld(A,c,f);return _l(l,gl,pl,e)})},txStages(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.txStages(A,c,f);return _l(l,gl,pl,e)})},txStatus(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.txStatus(A,c,f);return _l(l,gl,pl,e)})}}};var S6t=class extends WF{tx(i,A,c){return hqe(this.configuration).tx(i,A,c).then(f=>f(this.axios,this.basePath))}txSigners(i,A,c){return hqe(this.configuration).txSigners(i,A,c).then(f=>f(this.axios,this.basePath))}txSignersOld(i,A,c){return hqe(this.configuration).txSignersOld(i,A,c).then(f=>f(this.axios,this.basePath))}txStages(i,A,c){return hqe(this.configuration).txStages(i,A,c).then(f=>f(this.axios,this.basePath))}txStatus(i,A,c){return hqe(this.configuration).txStatus(i,A,c).then(f=>f(this.axios,this.basePath))}};var WM=class{constructor(i={}){this.apiKey=i.apiKey,this.username=i.username,this.password=i.password,this.accessToken=i.accessToken,this.basePath=i.basePath,this.baseOptions=i.baseOptions,this.formDataCtor=i.formDataCtor}isJsonMime(i){let A=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return i!==null&&(A.test(i)||i.toLowerCase()==="application/json-patch+json")}};import Q9s from"axios";import oti from"axios-retry";function jd(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var k9s={BCH:{blockReward:6.25,avgBlockTimeInSecs:600},BTC:{blockReward:6.25,avgBlockTimeInSecs:600},ETH:{blockReward:2,avgBlockTimeInSecs:13},AVAX:{blockReward:2,avgBlockTimeInSecs:3},LTC:{blockReward:12.5,avgBlockTimeInSecs:150},DOGE:{blockReward:1e4,avgBlockTimeInSecs:60},GAIA:{blockReward:0,avgBlockTimeInSecs:6},BNB:{blockReward:0,avgBlockTimeInSecs:6},THOR:{blockReward:0,avgBlockTimeInSecs:6},BSC:{blockReward:0,avgBlockTimeInSecs:3},MAYA:{blockReward:0,avgBlockTimeInSecs:6}},lCn=class{constructor(i){this.thornodeDetails=i;let A=tJ(this.thornodeDetails.asset);if(!A)throw new Error(`could not parse ${this.thornodeDetails.asset}`);this.asset=A,this.assetString=this.thornodeDetails.asset,this.assetBalance=wo(this.thornodeDetails.balance_asset),this.runeBalance=wo(this.thornodeDetails.balance_rune),this.runeToAssetRatio=this.runeBalance.amount().div(this.assetBalance.amount()),this.assetToRuneRatio=this.assetBalance.amount().div(this.runeBalance.amount())}isAvailable(){return this.thornodeDetails.status.toLowerCase()==="available"}},k6t=yl("BNB.BNB"),gqe=yl("AVAX.AVAX"),hCn=yl("BTC.BTC"),gCn=yl("BCH.BCH"),pqe=yl("ETH.ETH"),pCn=yl("DOGE.DOGE"),yCn=yl("LTC.LTC"),mCn=yl("GAIA.ATOM"),ICn=yl("MAYA.CACAO"),CCn=yl("BSC.BNB"),hh=yl("THOR.RUNE"),iTs=yl("ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48"),D6t="BNB",_Cn="BTC",ECn="BCH",BCn="ETH",R6t="GAIA",vCn="DOGE",bCn="LTC",SCn="AVAX",wCn="MAYA",QCn="BSC",ele="THOR",uCn=8,$Se=e=>ec(e)===ec(hh),yqe=(e,i)=>{let A=e.baseAmount.decimal,c=e.baseAmount.amount(),f=i-A;return c=c.times(Math.pow(10,f)),wo(c,i).amount()},BI=(e,i)=>{let A=e.baseAmount.amount(),c=i-e.baseAmount.decimal;return new ia(wo(A.times(Math.pow(10,c)),i),e.asset)},XSe=e=>{switch(e){case D6t:return k6t;case _Cn:return hCn;case BCn:return pqe;case ele:return hh;case R6t:return mCn;case ECn:return gCn;case bCn:return yCn;case vCn:return pCn;case SCn:return gqe;case QCn:return CCn;case wCn:return ICn;default:throw Error("Unknown chain")}},w6t=(e,i)=>{if(e.synth)return new ia(wo(2e6),hh);switch(e.chain){case _Cn:return new ia(wo(i.gasRate.multipliedBy(i.outboundTxSize)),hCn);case ECn:return new ia(wo(i.gasRate.multipliedBy(i.outboundTxSize)),gCn);case bCn:return new ia(wo(i.gasRate.multipliedBy(i.outboundTxSize)),yCn);case vCn:return new ia(wo(i.gasRate.multipliedBy(i.outboundTxSize)),pCn);case D6t:return new ia(wo(i.gasRate),k6t);case BCn:let A=i.gasRate,c=wo(A.multipliedBy(Math.pow(10,9)),18);return Fy(e,pqe)?new ia(c.times(21e3),pqe):new ia(c.times(7e4),pqe);case SCn:let f=i.gasRate,l=wo(f.multipliedBy(Math.pow(10,9)),18);return Fy(e,gqe)?new ia(l.times(21e3),gqe):new ia(l.times(7e4),gqe);case R6t:return new ia(wo(i.gasRate),mCn);case ele:return new ia(wo(2e6),hh);case QCn:return new ia(wo(i.gasRate),CCn);case wCn:return new ia(wo(i.gasRate),ICn)}throw new Error(`could not calculate inbound fee for ${e.chain}`)},Q6t=(e,i)=>{if(e.synth)return new ia(wo(2e6),hh);switch(e.chain){case _Cn:return new ia(wo(i.outboundFee),hCn);case ECn:return new ia(wo(i.outboundFee),gCn);case bCn:return new ia(wo(i.outboundFee),yCn);case vCn:return new ia(wo(i.outboundFee),pCn);case D6t:return new ia(wo(i.outboundFee),k6t);case BCn:return new ia(wo(i.outboundFee.multipliedBy(Math.pow(10,9)),18),pqe);case SCn:return new ia(wo(i.outboundFee.multipliedBy(Math.pow(10,9)),18),gqe);case R6t:return new ia(wo(i.outboundFee),mCn);case QCn:return new ia(wo(i.outboundFee),CCn);case ele:return new ia(wo(2e6),hh);case wCn:return new ia(wo(2e6),ICn)}throw new Error(`could not calculate outbound fee for ${e.chain}`)},D9s=(e,i)=>{let A=yqe(e.asset,8),c=new SD(i.thornodeDetails.LP_units),f=e.rune.baseAmount.amount(),l=A,g=i.runeBalance.amount(),w=i.assetBalance.amount(),N=g.times(l),F=f.times(w),j=c.times(N.plus(F)),te=g.times(w).times(2);return j.div(te)},fCn=(e,i)=>{let A=e.liquidityUnits,c=e.totalUnits,f=i.runeBalance.amount(),g=i.assetBalance.amount().times(A).div(c),w=f.times(A).div(c);return{assetShare:new ia(wo(g),i.asset),runeShare:new ia(wo(w),hh)}},ati=(e,i)=>{let A=yqe(e.asset,8),c=e.rune.baseAmount.amount(),f=A,l=i.runeBalance.amount(),g=i.assetBalance.amount(),w=f.times(l).minus(g.times(c)),N=g.times(c).plus(l.times(g));return w.div(N).abs()},R9s=(e,i,A)=>{let c=e.rune.amount(),f=e.asset.amount(),l=i.runeShare.baseAmount.amount(),g=i.assetShare.baseAmount.amount(),w=l.div(g),N=f.times(w).plus(c).minus(g.times(w).plus(l)),F=f.times(l.div(g)).plus(c).minus(l.plus(l)),j=N>=F?N:F,te=A.current,v=A.lastAdded||0,ne=A.fullProtection,Z=(te-v)/ne,R=Math.min(Z,1),M=j.times(R),U=M.lt(0)?new SD(0):M;return{ILProtection:new ia(wo(U),hh),totalDays:(Z*100).toFixed(2)}},P9s={mainnet:{apiRetries:3,thornodeBaseUrls:["https://thornode.ninerealms.com"]},stagenet:{apiRetries:3,thornodeBaseUrls:["https://stagenet-thornode.ninerealms.com"]},testnet:{apiRetries:3,thornodeBaseUrls:["https://testnet.thornode.thorchain.info"]}},mqe=class{constructor(i=eo.Mainnet,A){this.network=i,this.config=A!=null?A:P9s[this.network],oti(Q9s,{retries:this.config.apiRetries,retryDelay:oti.exponentialDelay}),this.transactionsApi=this.config.thornodeBaseUrls.map(c=>new S6t(new WM({basePath:c}))),this.queueApi=this.config.thornodeBaseUrls.map(c=>new E6t(new WM({basePath:c}))),this.networkApi=this.config.thornodeBaseUrls.map(c=>new C6t(new WM({basePath:c}))),this.poolsApi=this.config.thornodeBaseUrls.map(c=>new _6t(new WM({basePath:c}))),this.liquidityProvidersApi=this.config.thornodeBaseUrls.map(c=>new m6t(new WM({basePath:c}))),this.saversApi=this.config.thornodeBaseUrls.map(c=>new v6t(new WM({basePath:c}))),this.quoteApi=this.config.thornodeBaseUrls.map(c=>new B6t(new WM({basePath:c}))),this.mimirApi=this.config.thornodeBaseUrls.map(c=>new I6t(new WM({basePath:c}))),this.thornamesApi=this.config.thornodeBaseUrls.map(c=>new b6t(new WM({basePath:c})))}getscheduledQueue(){return jd(this,void 0,void 0,function*(){for(let i of this.queueApi)try{return(yield i.queueScheduled()).data}catch(A){throw new Error("THORNode not responding")}throw Error("THORNode not responding")})}getQueue(){return jd(this,void 0,void 0,function*(){for(let i of this.queueApi)try{return(yield i.queue()).data}catch(A){throw new Error("THORNode not responding")}throw Error("THORNode not responding")})}getMimir(){return jd(this,void 0,void 0,function*(){for(let i of this.mimirApi)try{return(yield i.mimir()).data}catch(A){throw new Error("THORNode not responding")}throw Error("THORNode not responding")})}getTxData(i){return jd(this,void 0,void 0,function*(){for(let A of this.transactionsApi)try{return(yield A.tx(i)).data}catch(c){return{observed_tx:void 0,keysign_metric:void 0}}throw new Error("THORNode not responding")})}getTxDetail(i){return jd(this,void 0,void 0,function*(){for(let A of this.transactionsApi)try{return(yield A.txSigners(i)).data}catch(c){throw new Error("THORNode not responding")}throw new Error("THORNode not responding")})}getLastBlock(i){return jd(this,void 0,void 0,function*(){for(let A of this.networkApi)try{return(yield A.lastblock(i)).data}catch(c){}throw new Error("THORNode not responding")})}getPools(){return jd(this,void 0,void 0,function*(){for(let i of this.poolsApi)try{return(yield i.pools()).data}catch(A){}throw new Error("THORNode not responding")})}getPool(i){return jd(this,void 0,void 0,function*(){for(let A of this.poolsApi)try{return(yield A.pool(i)).data}catch(c){}throw new Error("THORNode not responding")})}getTcConstants(){return jd(this,void 0,void 0,function*(){for(let i of this.networkApi)try{let A=yield i.constants();if(A.data.int_64_values)return A.data.int_64_values}catch(A){}throw new Error("THORNode not responding")})}getNetworkValues(){return jd(this,void 0,void 0,function*(){let[i,A]=yield Promise.all([this.getMimir(),this.getTcConstants()]),c={};for(let[f,l]of Object.entries(A))c[f.toUpperCase()]=parseInt(l);for(let[f,l]of Object.entries(i))c[f]=parseInt(l);return c})}getLiquidityProvider(i,A,c){return jd(this,void 0,void 0,function*(){for(let f of this.liquidityProvidersApi)try{return(yield f.liquidityProviders(i,c)).data.find(g=>g.asset_address===A||g.rune_address===A)}catch(l){}throw new Error("THORNode not responding")})}getInboundAddresses(){return jd(this,void 0,void 0,function*(){for(let i of this.networkApi)try{return(yield i.inboundAddresses()).data}catch(A){}throw new Error("THORNode not responding")})}getSavers(i,A){return jd(this,void 0,void 0,function*(){for(let c of this.saversApi)try{return(yield c.savers(i,A)).data}catch(f){}throw new Error("THORNode not responding")})}getSaver(i,A,c){return jd(this,void 0,void 0,function*(){for(let f of this.saversApi)try{return(yield f.saver(i,A,c)).data}catch(l){}throw new Error("THORNode not responding")})}getSaversDepositQuote(i,A,c){return jd(this,void 0,void 0,function*(){for(let f of this.quoteApi)try{return(yield f.quotesaverdeposit(c,i,A)).data}catch(l){}throw new Error("THORNode not responding")})}getSaversWithdrawQuote(i){return jd(this,void 0,void 0,function*(){for(let A of this.quoteApi)try{return(yield A.quotesaverwithdraw(i.height,`${i.asset.chain}.${i.asset.symbol}`,i.address,i.withdrawBps)).data}catch(c){}throw new Error("THORNode not responding")})}getSwapQuote(i,A,c,f,l,g,w,N,F,j,te){return jd(this,void 0,void 0,function*(){for(let v of this.quoteApi)try{return(yield v.quoteswap(j,i,A,c,f,te,l,g,w,N,F)).data}catch(ne){}throw new Error("THORNode not responding")})}getLoanQuoteOpen(i,A,c,f,l,g,w,N){return jd(this,void 0,void 0,function*(){for(let F of this.quoteApi)try{return(yield F.quoteloanopen(N,i,A,c,f,l,g,w)).data}catch(j){}throw new Error("THORNode is not responding")})}getLoanQuoteClose(i,A,c,f,l,g){return jd(this,void 0,void 0,function*(){for(let w of this.quoteApi)try{return(yield w.quoteloanclose(g,i,A,c,f,l)).data}catch(N){}throw new Error("THORNode is not responding")})}getThornameDetails(i,A){return jd(this,void 0,void 0,function*(){for(let c of this.thornamesApi)try{return(yield c.thorname(i,A)).data}catch(f){}throw new Error("THORNode is not responding")})}},O9s=new SD(1),N9s=10*60*1e3,x9s=new mqe,M9s=new g6t,Iqe=class{constructor(i=x9s,A=M9s,c=6e3,f=6e3,l=N9s){this.thornode=i,this.midgardQuery=A,this.poolCache=new bI(()=>this.refreshPoolCache(),c),this.inboundDetailCache=new bI(()=>this.refreshInboundDetailCache(),f),this.networkValuesCache=new bI(()=>i.getNetworkValues(),l)}getExchangeRate(i,A){return jd(this,void 0,void 0,function*(){let c;if(Fy(i,A))c=O9s;else if($Se(i))c=(yield this.getPoolForAsset(A)).assetToRuneRatio;else if($Se(A))c=(yield this.getPoolForAsset(i)).runeToAssetRatio;else{let f=yield this.getPoolForAsset(i),l=yield this.getPoolForAsset(A);c=f.runeToAssetRatio.times(l.assetToRuneRatio)}return c})}getPoolForAsset(i){return jd(this,void 0,void 0,function*(){if($Se(i))throw Error("AssetRuneNative doesn't have a pool");let c=(yield this.getPools())[`${i.chain}.${i.ticker}`];if(c)return c;throw Error(`Pool for ${ec(i)} not found`)})}getPools(){return jd(this,void 0,void 0,function*(){let i=yield this.poolCache.getValue();if(i)return i;throw Error("Could not refresh pools")})}refreshPoolCache(){return jd(this,void 0,void 0,function*(){try{let i=yield this.thornode.getPools(),A={};if(i){for(let c of i)try{let f=i.find(g=>g.asset===c.asset);if(!f)throw Error(`Could not find thornode pool ${c.asset}`);let l=new lCn(f);A[`${l.asset.chain}.${l.asset.ticker}`]=l}catch(f){console.log(f)}return A}}catch(i){console.error("Error refreshing pool cache:",i)}})}refreshInboundDetailCache(){return jd(this,void 0,void 0,function*(){let[i,A]=yield Promise.all([this.thornode.getMimir(),this.thornode.getInboundAddresses()]),c={};for(let l of A){let g=l.chain;if(!g||!l.gas_rate||!l.address||!l.gas_rate_units||!l.outbound_tx_size||!l.outbound_fee||!l.gas_rate_units)throw new Error("Missing required inbound info");let w={chain:g,address:l.address,router:l.router,gasRate:new SD(l.gas_rate),gasRateUnits:l.gas_rate_units,outboundTxSize:new SD(l.outbound_tx_size),outboundFee:new SD(l.outbound_fee),haltedChain:(l==null?void 0:l.halted)||!!i[`HALT${g}CHAIN`]||!!i.HALTCHAINGLOBAL,haltedTrading:!!i.HALTTRADING||!!i[`HALT${g}TRADING`],haltedLP:!!i.PAUSELP||!!i[`PAUSELP${g}`]};c[g]=w}let f={chain:ele,address:"",router:"",gasRate:new SD(0),gasRateUnits:"",outboundTxSize:new SD(0),outboundFee:new SD(0),haltedChain:!1,haltedTrading:!!i.HALTTRADING,haltedLP:!1};return c[ele]=f,c})}convert(i,A){return jd(this,void 0,void 0,function*(){let c=yield this.getExchangeRate(i.asset,A),f=yield this.midgardQuery.getDecimalForAsset(A),l=i.baseAmount.decimal,g=i.baseAmount.times(c).amount(),w=f-l;g=g.times(Math.pow(10,w));let N=wo(g,f);return new ia(N,A)})}getRouterAddressForChain(i){return jd(this,void 0,void 0,function*(){let A=(yield this.getInboundDetails())[i];if(!(A!=null&&A.router))throw new Error("router address is not defined");return A==null?void 0:A.router})}getInboundDetails(){return jd(this,void 0,void 0,function*(){if(this.inboundDetailCache)return yield this.inboundDetailCache.getValue();throw Error("Could not refresh inbound details ")})}getNetworkValues(){return jd(this,void 0,void 0,function*(){if(this.networkValuesCache)return yield this.networkValuesCache.getValue();throw Error("Could not refresh network values ")})}},T9s=new Iqe,tle=class{constructor(i=T9s,A=k9s){this.thorchainCache=i,this.chainAttributes=A}quoteSwap({fromAsset:i,destinationAsset:A,amount:c,destinationAddress:f,streamingInterval:l,streamingQuantity:g,toleranceBps:w,affiliateBps:N,affiliateAddress:F,height:j}){return jd(this,void 0,void 0,function*(){let te=[],v=yield this.validateAmount(c);v&&te.push(v.message);let ne=ec(i),Z=ec(A),R=yqe(c,8),M=yield this.thorchainCache.thornode.getSwapQuote(ne,Z,R.toNumber(),f,l,g,w,N,F,j),U;typeof M=="string"?U={error:M}:U=M;let E=JSON.parse(JSON.stringify(U));if(E.error&&te.push(`Thornode request quote: ${E.error}`),te.length>0)return{memo:"",toAddress:"",dustThreshold:new ia(wo(0),hh),expiry:new Date,txEstimate:{totalFees:{asset:A,affiliateFee:new ia(wo(0),hh),outboundFee:new ia(wo(0),hh)},slipBasisPoints:0,netOutput:new ia(wo(0),A),outboundDelaySeconds:0,inboundConfirmationSeconds:0,canSwap:!1,errors:te,netOutputStreaming:new ia(wo(0),hh),maxStreamingQuantity:0,outboundDelayBlocks:0,streamingSlipBasisPoints:0,streamingSwapBlocks:0,streamingSwapSeconds:0,totalSwapSeconds:0,warning:""}};let Q=yl(M.fees.asset),H=yield this.thorchainCache.midgardQuery.getDecimalForAsset(Q),re=yield this.thorchainCache.midgardQuery.getDecimalForAsset(A);return M.recommended_min_amount_in&&R.toNumber()<Number(M.recommended_min_amount_in)&&te.push(`Error amount in: ${R.toNumber()} is less than reccommended Min Amount: ${M.recommended_min_amount_in}`),M.memo===void 0&&te.push(`Error parsing swap quote: Memo is ${M.memo}`),{memo:M.memo?M.memo:"",dustThreshold:BI(new ia(wo(M.dust_threshold),i),c.baseAmount.decimal),toAddress:M.inbound_address?M.inbound_address:"",expiry:new Date(M.expiry*1e3),txEstimate:{totalFees:{asset:i,affiliateFee:BI(new ia(wo(M.fees.affiliate),Q),H),outboundFee:BI(new ia(wo(M.fees.outbound),Q),H)},slipBasisPoints:M.slippage_bps,netOutput:BI(new ia(wo(M.expected_amount_out),A),re),netOutputStreaming:BI(new ia(wo(M.expected_amount_out_streaming),A),re),outboundDelaySeconds:M.outbound_delay_seconds,inboundConfirmationSeconds:M.inbound_confirmation_seconds,recommendedMinAmountIn:M.recommended_min_amount_in,maxStreamingQuantity:M.max_streaming_quantity?M.max_streaming_quantity:0,outboundDelayBlocks:M.outbound_delay_blocks,streamingSlipBasisPoints:M.streaming_slippage_bps,streamingSwapBlocks:M.streaming_swap_blocks?M.streaming_swap_blocks:0,streamingSwapSeconds:M.streaming_swap_seconds?M.streaming_swap_seconds:0,totalSwapSeconds:M.total_swap_seconds?M.total_swap_seconds:0,canSwap:!(!M.memo||te.length>0),errors:te,warning:M.warning}}})}validateAmount(i){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i.asset);if(i.baseAmount.decimal!==A)return new Error(`Invalid number of decimals: ${ec(i.asset)} must have ${A} decimals`)})}outboundDelay(i){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.getNetworkValues(),c=new ia(wo(A.MINTXOUTVOLUMETHRESHOLD),hh),f=A.MAXTXOUTOFFSET,l=new ia(wo(A.TXOUTDELAYRATE),hh).assetAmount.amount().toNumber(),g=yield this.thorchainCache.thornode.getQueue(),w=new ia(wo(g.scheduled_outbound_value),hh),N=this.chainAttributes[ele].avgBlockTimeInSecs,F=yield this.thorchainCache.convert(i,hh);if(F.lt(c))return N;if(w==null)throw new Error("Could not return Scheduled Outbound Value");let te=F.plus(w).div(c);l=l-te.assetAmount.amount().toNumber()<=1?1:l;let v=F.assetAmount.amount().toNumber()/l;return v=v>f?f:v,v*N})}getFeesIn(i,A){return jd(this,void 0,void 0,function*(){return{asset:i.asset,outboundFee:yield this.convert(i.outboundFee,A),affiliateFee:yield this.convert(i.affiliateFee,A)}})}convert(i,A){return jd(this,void 0,void 0,function*(){return yield this.thorchainCache.convert(i,A)})}confCounting(i){return jd(this,void 0,void 0,function*(){if($Se(i.asset)||i.asset.chain==D6t||i.asset.chain==R6t||i.asset.synth)return this.chainAttributes[ele].avgBlockTimeInSecs;let A=XSe(i.asset.chain),f=(yield this.thorchainCache.convert(i,A)).assetAmount,l=this.chainAttributes[i.asset.chain];return Math.ceil(f.amount().div(l.blockReward).toNumber())*l.avgBlockTimeInSecs})}estimateAddLP(i){return jd(this,void 0,void 0,function*(){let A=[];(i.asset.asset.synth||i.rune.asset.synth)&&A.push("you cannot add liquidity with a synth"),$Se(i.rune.asset)||A.push("params.rune must be THOR.RUNE");let c=yield this.thorchainCache.getPoolForAsset(i.asset.asset),f=D9s({asset:i.asset,rune:i.rune},c),l=yield this.thorchainCache.getInboundDetails(),g={liquidityUnits:f,totalUnits:new SD(c.thornodeDetails.LP_units)},w=fCn(g,c),N=yield this.confCounting(i.asset),F=yield this.confCounting(i.rune),j=N>F?N:F,te=new ia(wo(0),i.asset.asset),v=new ia(wo(0),hh);i.asset.assetAmount.eq(0)||(te=w6t(i.asset.asset,l[i.asset.asset.chain]),te.assetAmount.amount().times(3).gt(i.asset.assetAmount.amount())&&A.push("Asset amount is less than fees")),i.rune.assetAmount.eq(0)||(v=w6t(i.rune.asset,l[i.rune.asset.chain]),v.assetAmount.amount().times(3).gt(i.rune.assetAmount.amount())&&A.push("Rune amount is less than fees"));let ne=(yield this.convert(te,hh)).plus(v),Z=ati({asset:i.asset,rune:i.rune},c);return{assetPool:c.thornodeDetails.asset,slipPercent:Z.times(100),poolShare:w,lpUnits:wo(f),runeToAssetRatio:c.runeToAssetRatio,inbound:{fees:{asset:te,rune:v,total:ne}},estimatedWaitSeconds:j,errors:A,canAdd:!(A.length>0)}})}checkLiquidityPosition(i,A){return jd(this,void 0,void 0,function*(){let c=yield this.thorchainCache.getPoolForAsset(i);if(!c)throw Error(`Could not find pool for ${i}`);if(!A)throw Error(`No address provided ${A}`);let f=yield this.thorchainCache.thornode.getLiquidityProvider(c.assetString,A);if(!f)throw Error(`Could not find LP for ${A}`);let l=(yield this.thorchainCache.thornode.getLastBlock()).find(E=>E.chain===i.chain);if(!l)throw Error("Could not get block data");let g={totalUnits:new SD(c.thornodeDetails.LP_units),liquidityUnits:new SD(f.units)},w=yield this.thorchainCache.thornode.getNetworkValues(),N={current:l.thorchain,lastAdded:f.last_add_height,fullProtection:w.FULLIMPLOSSPROTECTIONBLOCKS},F=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i),j={asset:wo(f.asset_deposit_value,F),rune:wo(f.rune_deposit_value)},te=fCn(g,c),v=Math.sqrt(j.asset.times(j.rune).div(g.liquidityUnits).amount().toNumber()),Z=Math.sqrt(te.assetShare.baseAmount.times(te.runeShare.baseAmount).div(g.liquidityUnits).amount().toNumber())-v,R=Z>0?Z/v:0,M=R9s(j,te,N);return{poolShare:te,lpGrowth:`${(R*100).toFixed(2)} %`,position:f,impermanentLossProtection:M}})}getPoolRatios(i){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.getPoolForAsset(i);return{assetToRune:A.assetToRuneRatio,runeToAsset:A.runeToAssetRatio}})}estimateWithdrawLP(i){return jd(this,void 0,void 0,function*(){let A=i.assetAddress?i.assetAddress:i.runeAddress,c=yield this.checkLiquidityPosition(i.asset,A),f=yield this.getDustValues(i.asset),l=yield this.thorchainCache.getPoolForAsset(i.asset),g=fCn({liquidityUnits:new SD(c.position.units),totalUnits:new SD(l.thornodeDetails.LP_units)},l),w=ati({asset:g.assetShare,rune:g.runeShare},l),N=yield this.confCounting(g.assetShare.div(i.percentage/100)),F=yield this.confCounting(g.runeShare.div(i.percentage/100)),j=0;c.position.asset_address&&c.position.rune_address?j=N>F?N:F:c.position.asset_address?j=N:j=F;let v=(yield this.thorchainCache.getInboundDetails())[i.asset.chain],ne=w6t(hh,v),Z=w6t(i.asset,v),R=Q6t(hh,v),M=Q6t(i.asset,v);return{assetAddress:c.position.asset_address,runeAddress:c.position.rune_address,slipPercent:w.times(100),inbound:{minToSend:{rune:f.rune,asset:f.asset,total:(yield this.convert(f.asset,hh)).plus(f.rune)},fees:{rune:ne,asset:Z,total:(yield this.convert(Z,hh)).plus(ne)}},outboundFee:{asset:M,rune:R,total:(yield this.convert(M,hh)).plus(R)},assetAmount:g.assetShare,runeAmount:g.runeShare,lpGrowth:c.lpGrowth,estimatedWaitSeconds:j,impermanentLossProtection:c.impermanentLossProtection,assetPool:l.thornodeDetails.asset}})}getDustValues(i){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i);switch(i.chain){case"BNB":return{asset:new ia(mf(fl(1e-6,A)),k6t),rune:new ia(mf(fl(0)),hh)};case"BTC":case"BCH":case"LTC":return{asset:new ia(mf(fl(1e-4,A)),i),rune:new ia(mf(fl(0)),hh)};case"ETH":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"THOR":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"GAIA":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"DOGE":return{asset:new ia(mf(fl(.01,A)),i),rune:new ia(mf(fl(0)),hh)};case"AVAX":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"BSC":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"MAYA":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};default:throw Error("Unknown chain")}})}estimateAddSaver(i){return jd(this,void 0,void 0,function*(){let A=[];A=yield this.getAddSaversEstimateErrors(i);let c=i.baseAmount.decimal!=8?yqe(i,8):i.baseAmount.amount(),f=yield this.thorchainCache.thornode.getSaversDepositQuote(ec(i.asset),c.toNumber()),l=JSON.parse(JSON.stringify(f));if(l.error&&A.push(`Thornode request quote failed: ${l.error}`),f.recommended_min_amount_in&&i.baseAmount.amount().toNumber()<Number(f.recommended_min_amount_in)&&A.push(`Error amount in: ${i.baseAmount.amount().toNumber()} is less than recommended Min Amount: ${f.recommended_min_amount_in}`),A.length>0)return{assetAmount:i,estimatedDepositValue:new ia(wo(0),i.asset),fee:{affiliate:new ia(wo(0),i.asset),asset:i.asset,outbound:new ia(wo(0),i.asset),liquidity:new ia(wo(0),i.asset),totalBps:f.fees.total_bps||0},expiry:new Date(0),toAddress:"",memo:"",saverCapFilledPercent:-1,estimatedWaitTime:-1,slipBasisPoints:-1,recommendedMinAmountIn:f.recommended_min_amount_in,canAddSaver:!1,errors:A};let g=(yield this.thorchainCache.getPoolForAsset(i.asset)).thornodeDetails,w=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i.asset),N=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i.asset),F={affiliate:BI(new ia(wo(f.fees.affiliate),i.asset),w),asset:yl(f.fees.asset),outbound:BI(new ia(wo(f.fees.outbound),yl(f.fees.asset)),N),liquidity:BI(new ia(wo(f.fees.liquidity),yl(f.fees.asset)),N),totalBps:f.fees.total_bps||0},j=Number(g.synth_supply)/Number(g.balance_asset)*100;return{assetAmount:BI(new ia(wo(f.expected_amount_out),i.asset),w),estimatedDepositValue:BI(new ia(wo(f.expected_amount_deposit),i.asset),w),fee:F,expiry:new Date(f.expiry),toAddress:f.inbound_address,memo:f.memo,estimatedWaitTime:f.inbound_confirmation_seconds||0,canAddSaver:A.length===0,slipBasisPoints:f.slippage_bps,saverCapFilledPercent:j,recommendedMinAmountIn:f.recommended_min_amount_in,errors:A}})}estimateWithdrawSaver(i){return jd(this,void 0,void 0,function*(){let A=[];($Se(i.asset)||i.asset.synth)&&A.push("Native Rune and synth assets are not supported only L1's");let c=yield this.thorchainCache.getInboundDetails(),f=yield this.getSaverPosition(i);if(f.errors.length>0){for(let v=0;v<f.errors.length;v++)A.push(f.errors[v]);return{dustAmount:new ia(wo(0),XSe(i.asset.chain)),dustThreshold:new ia(wo(0),XSe(i.asset.chain)),expectedAssetAmount:new ia(mf(fl(f.redeemableValue.assetAmount.amount())),i.asset),fee:{affiliate:new ia(mf(fl(0)),i.asset),asset:i.asset,liquidity:new ia(wo(0),i.asset),outbound:new ia(mf(fl(Q6t(i.asset,c[i.asset.chain]).assetAmount.amount())),i.asset),totalBps:0},expiry:new Date(0),toAddress:"",memo:"",inboundDelayBlocks:0,inboundDelaySeconds:0,outBoundDelayBlocks:0,outBoundDelaySeconds:0,slipBasisPoints:-1,errors:A}}let l=yield this.thorchainCache.thornode.getSaversWithdrawQuote(i),g=JSON.parse(JSON.stringify(l));if(g.error&&A.push(`Thornode request quote failed: ${g.error}`),A.length>0)return{dustAmount:new ia(wo(0),XSe(i.asset.chain)),dustThreshold:new ia(wo(0),XSe(i.asset.chain)),expectedAssetAmount:new ia(mf(fl(0)),i.asset),fee:{affiliate:new ia(wo(0),i.asset),asset:i.asset,liquidity:new ia(wo(0),i.asset),outbound:new ia(wo(0),i.asset),totalBps:0},expiry:new Date(0),toAddress:"",memo:"",inboundDelayBlocks:0,inboundDelaySeconds:0,outBoundDelayBlocks:0,outBoundDelaySeconds:0,slipBasisPoints:-1,errors:A};let w=yl(l.fees.asset),N=XSe(i.asset.chain),F=yield this.thorchainCache.midgardQuery.getDecimalForAsset(w),j=yield this.thorchainCache.midgardQuery.getDecimalForAsset(N);return{dustAmount:BI(new ia(wo(l.dust_amount),N),j),dustThreshold:BI(new ia(wo(l.dust_threshold),N),j),expectedAssetAmount:BI(new ia(wo(l.expected_amount_out),i.asset),F),fee:{affiliate:BI(new ia(wo(l.fees.affiliate),w),F),asset:w,liquidity:BI(new ia(wo(l.fees.liquidity),w),F),outbound:BI(new ia(wo(l.fees.outbound),w),F),totalBps:l.fees.total_bps||0},expiry:new Date(l.expiry),toAddress:l.inbound_address,memo:l.memo,inboundDelayBlocks:l.inbound_confirmation_blocks||0,inboundDelaySeconds:l.inbound_confirmation_seconds||0,outBoundDelayBlocks:l.outbound_delay_blocks||0,outBoundDelaySeconds:l.outbound_delay_seconds||0,slipBasisPoints:l.slippage_bps,errors:A}})}getSaverPosition(i){return jd(this,void 0,void 0,function*(){let A=[],c=yield this.thorchainCache.getInboundDetails(),f=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i.asset),l=(yield this.thorchainCache.thornode.getLastBlock()).find(H=>H.chain===i.asset.chain),g=(yield this.thorchainCache.thornode.getSavers(`${i.asset.chain}.${i.asset.symbol}`)).find(H=>H.asset_address.toLowerCase()===i.address.toLowerCase()),w=(yield this.thorchainCache.getPoolForAsset(i.asset)).thornodeDetails;g||A.push(`Could not find position for ${i.address}`),g!=null&&g.last_add_height||A.push(`Could not find position for ${i.address}`),l!=null&&l.thorchain||A.push("Could not get thorchain block height");let N=Q6t(i.asset,c[i.asset.chain]),F=yqe(N,8);Number(g==null?void 0:g.asset_redeem_value)<F.toNumber()&&A.push("Unlikely to withdraw balance as outbound fee is greater than redeemable amount");let j=Number(g==null?void 0:g.units),te=Number(g==null?void 0:g.last_add_height),v=Number(w.savers_units),ne=Number(w.savers_depth),Z=j/v*ne,R=BI(new ia(wo(g==null?void 0:g.asset_deposit_value),i.asset),f),M=BI(new ia(wo(Z),i.asset),f),U=(Number(l==null?void 0:l.thorchain)-te)/(365*86400/6),E=M.minus(R).div(R).times(100);return{depositValue:R,redeemableValue:M,lastAddHeight:Number(g==null?void 0:g.last_add_height),percentageGrowth:E.assetAmount.amount().toNumber(),ageInYears:U,ageInDays:U*365,asset:i.asset,errors:A}})}getAddSaversEstimateErrors(i){return jd(this,void 0,void 0,function*(){let A=[],c=yield this.thorchainCache.getPools(),f=Object.values(c).filter(j=>j.thornodeDetails.savers_depth!=="0"),l=yield this.thorchainCache.getInboundDetails();f.find(j=>ec(j.asset)===ec(i.asset))||A.push(` ${ec(i.asset)} does not have a saver's pool`),l[i.asset.chain].haltedChain&&A.push(`${i.asset.chain} is halted, cannot add`),(yield this.thorchainCache.getPoolForAsset(i.asset)).thornodeDetails.status.toLowerCase()!=="available"&&A.push(`Pool is not available for this asset ${ec(i.asset)}`);let N=new ia(wo(l[i.asset.chain].gasRate),i.asset),F=yield this.convert(N,i.asset);return i.lte(F)&&A.push("Add amount does not cover fees"),A})}getLoanQuoteOpen({asset:i,amount:A,targetAsset:c,destination:f,minOut:l,affiliateBps:g,affiliate:w,height:N}){return jd(this,void 0,void 0,function*(){let F=[],j=yield this.thorchainCache.thornode.getLoanQuoteOpen(`${i.chain}.${i.symbol}`,A.baseAmount.amount().toNumber(),`${c.chain}.${c.symbol}`,f,l,g,w,N),te=JSON.parse(JSON.stringify(j));return te.error&&F.push(`Thornode request quote failed: ${te.error}`),j.recommended_min_amount_in&&A.baseAmount.amount().toNumber()<Number(j.recommended_min_amount_in)&&F.push(`Error amount in: ${A.baseAmount.amount().toNumber()} is less than reccommended Min Amount: ${j.recommended_min_amount_in}`),F.length>0?{inboundAddress:"",expectedWaitTime:{outboundDelayBlocks:void 0,outbondDelaySeconds:void 0},fees:{asset:"",liquidity:void 0,outbound:void 0,total_bps:void 0},slippageBps:void 0,router:void 0,expiry:0,warning:"",notes:"",dustThreshold:void 0,recommendedMinAmountIn:j.recommended_min_amount_in,memo:void 0,expectedAmountOut:"",expectedCollateralizationRatio:"",expectedCollateralDeposited:"",expectedDebtIssued:"",errors:F}:{inboundAddress:j.inbound_address,expectedWaitTime:{outboundDelayBlocks:j.outbound_delay_blocks,outbondDelaySeconds:j.outbound_delay_seconds},fees:{asset:j.fees.asset,liquidity:j.fees.liquidity,outbound:j.fees.outbound,total_bps:j.fees.total_bps},slippageBps:j.slippage_bps,router:j.router,expiry:j.expiry,warning:j.warning,notes:j.notes,dustThreshold:j.dust_threshold,recommendedMinAmountIn:j.recommended_min_amount_in,memo:j.memo,expectedAmountOut:j.expected_amount_out,expectedCollateralizationRatio:j.expected_collateralization_ratio,expectedCollateralDeposited:j.expected_collateral_deposited,expectedDebtIssued:j.expected_debt_issued,errors:F}})}getLoanQuoteClose({asset:i,amount:A,loanAsset:c,loanOwner:f,minOut:l,height:g}){return jd(this,void 0,void 0,function*(){let w=[],N=yield this.thorchainCache.thornode.getLoanQuoteClose(`${i.chain}.${i.symbol}`,A.baseAmount.amount().toNumber(),`${c.chain}.${c.symbol}`,f,l,g),F=JSON.parse(JSON.stringify(N));return F.error&&w.push(`Thornode request quote failed: ${F.error}`),w.length>0?{inboundAddress:"",expectedWaitTime:{outboundDelayBlocks:void 0,outbondDelaySeconds:void 0},fees:{asset:"",liquidity:void 0,outbound:void 0,total_bps:void 0},slippageBps:void 0,router:void 0,expiry:0,warning:"",notes:"",dustThreshold:void 0,recommendedMinAmountIn:N.recommended_min_amount_in,memo:void 0,expectedAmountOut:"",expectedCollateralWithdrawn:"",expectedDebtRepaid:"",errors:w}:{inboundAddress:N.inbound_address,expectedWaitTime:{outboundDelayBlocks:N.outbound_delay_blocks,outbondDelaySeconds:N.outbound_delay_seconds},fees:{asset:N.fees.asset,liquidity:N.fees.liquidity,outbound:N.fees.outbound,total_bps:N.fees.total_bps},slippageBps:N.slippage_bps,router:N.router,expiry:N.expiry,warning:N.warning,notes:N.notes,dustThreshold:N.dust_threshold,recommendedMinAmountIn:N.recommended_min_amount_in,memo:N.memo,expectedAmountOut:N.expected_amount_out,expectedCollateralWithdrawn:N.expected_collateral_withdrawn,expectedDebtRepaid:N.expected_debt_repaid,errors:w}})}getThornameDetails(i,A){return jd(this,void 0,void 0,function*(){let c=[];try{let f=yield this.thorchainCache.thornode.getThornameDetails(i,A),l=JSON.parse(JSON.stringify(f));if(l.error&&c.push(`Thornode request quote failed: ${l.error}`),c.length>0)return{name:"",expireBlockHeight:0,owner:"",preferredAsset:"",affiliateCollectorRune:"",aliases:[],error:c};let g=f.aliases.map(N=>({chain:N.chain,address:N.address}));return{name:f.name||"",expireBlockHeight:f.expire_block_height||0,owner:f.owner||"",preferredAsset:f.preferred_asset||"",affiliateCollectorRune:f.affiliate_collector_rune||"",aliases:g||[]}}catch(f){return{name:"",expireBlockHeight:0,owner:"",preferredAsset:"",affiliateCollectorRune:"",aliases:[],error:c}}})}estimateThorname(i){return jd(this,void 0,void 0,function*(){let A=yield this.getThornameDetails(i.thorname);if(A.owner!==""&&!i.isUpdate)throw Error("Thorname already registered");let f=(yield this.thorchainCache.thornode.getLastBlock())[0].thorchain,l=i.isUpdate?A==null?void 0:A.expireBlockHeight:f,g=i.isUpdate?0:5259600;if(i.expirity){let v=Math.floor(Date.now()/1e3),Z=Math.floor(i.expirity.getTime()/1e3)-v,R=Math.round(Z/6),M=f+R;g=A!=null&&A.expireBlockHeight?M-(A==null?void 0:A.expireBlockHeight):R}let w=yield this.thorchainCache.thornode.getTcConstants(),N=i.isUpdate?wo(0):wo(w.TNSRegisterFee),F=wo(w.TNSFeePerBlock).times(g>0?g:0),j=new ia(N.plus(F),hh);return{memo:`~:${i.thorname}:${i.chain}:${i.chainAddress}:${i.owner?i.owner:""}:${i.preferredAsset?ec(i.preferredAsset):""}:${i.isUpdate?"":l+g}`.replace(/^:+|:+$/g,""),value:j}})}getInboundDetails(){return jd(this,void 0,void 0,function*(){return this.thorchainCache.getInboundDetails()})}getChainInboundDetails(i){return jd(this,void 0,void 0,function*(){let A=yield this.getInboundDetails();if(!A[i])throw Error(`No inbound details known for ${i} chain`);return A[i]})}getSwapHistory({addresses:i}){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.midgardQuery.midgardCache.midgard.getActions({address:i.join(","),type:"swap"}),c=yield this.thorchainCache.getPools(),f=(l,g,w)=>{let N=g in l&&l[g].thornodeDetails.decimals||uCn;return N===uCn?new ia(wo(w),yl(g)):BI(new ia(wo(w),yl(g)),N)};return{count:A.count?Number(A.count):0,swaps:A.actions.map(l=>({date:new Date(Number(l.date)/Math.pow(10,6)),status:l.status,inboundTx:{hash:l.in[0].txID,address:l.in[0].address,amount:f(c,l.in[0].coins[0].asset,l.in[0].coins[0].amount)},outboundTx:{hash:l.out[0].txID,address:l.out[0].address,amount:f(c,l.out[0].coins[0].asset,l.out[0].coins[0].amount)}}))}})}},sti;(function(e){e.Swap="Swap",e.AddLP="AddLP",e.WithdrawLP="WithdrawLP",e.AddSaver="AddSaver",e.WithdrawSaver="WithdrawSaver",e.Refund="Refund",e.Other="Other",e.Unknown="Unknown"})(sti||(sti={}));var Ati;(function(e){e.Observed_Consensus="Observed_Consensus",e.Observed_Incomplete="Observed_Incomplete",e.Unknown="Unknown"})(Ati||(Ati={}));var dti;(function(e){e.Complete="Complete",e.Complete_Refunded="Complete_Refunded",e.Complete_Below_Dust="Complete_Below_Dust",e.Incomplete="Incomplete"})(dti||(dti={}));var cti;(function(e){e.Complete="Complete",e.Complete_Refunded="Complete_Refunded",e.Complete_Below_Dust="Complete_Below_Dust",e.Incomplete="Incomplete"})(cti||(cti={}));var uti;(function(e){e.Complete="Complete",e.Incomplete="Incomplete",e.Complete_Refunded="Complete_Refunded"})(uti||(uti={}));var fti;(function(e){e.Complete="Complete",e.Incomplete="Incomplete",e.Complete_Refunded="Complete_Refunded"})(fti||(fti={}));var lti;(function(e){e.Complete="Complete",e.Complete_Refunded="Complete_Refunded",e.Complete_Below_Dust="Complete_Below_Dust",e.Incomplete="Incomplete"})(lti||(lti={}));import{ethers as hti}from"ethers";function pm(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}function Vm(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var U9s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,kCn=Math.ceil,zK=Math.floor,QD="[BigNumber Error] ",gti=QD+"Number primitive has more than 15 significant digits: ",ZF=1e14,ku=14,DCn=9007199254740991,RCn=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],yoe=1e7,M3=1e9;function xti(e){var i,A,c,f=E.prototype={constructor:E,toString:null,valueOf:null},l=new E(1),g=20,w=4,N=-7,F=21,j=-1e7,te=1e7,v=!1,ne=1,Z=0,R={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",U=!0;function E(se,p){var L,V,K,m,h,_,b,O,J=this;if(!(J instanceof E))return new E(se,p);if(p==null){if(se&&se._isBigNumber===!0){J.s=se.s,!se.c||se.e>te?J.c=J.e=null:se.e<j?J.c=[J.e=0]:(J.e=se.e,J.c=se.c.slice());return}if((_=typeof se=="number")&&se*0==0){if(J.s=1/se<0?(se=-se,-1):1,se===~~se){for(m=0,h=se;h>=10;h/=10,m++);m>te?J.c=J.e=null:(J.e=m,J.c=[se]);return}O=String(se)}else{if(!U9s.test(O=String(se)))return c(J,O,_);J.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(m=O.indexOf("."))>-1&&(O=O.replace(".","")),(h=O.search(/e/i))>0?(m<0&&(m=h),m+=+O.slice(h+1),O=O.substring(0,h)):m<0&&(m=O.length)}else{if(Ty(p,2,M.length,"Base"),p==10&&U)return J=new E(se),ee(J,g+J.e+1,w);if(O=String(se),_=typeof se=="number"){if(se*0!=0)return c(J,O,_,p);if(J.s=1/se<0?(O=O.slice(1),-1):1,E.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(gti+se)}else J.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(L=M.slice(0,p),m=h=0,b=O.length;h<b;h++)if(L.indexOf(V=O.charAt(h))<0){if(V=="."){if(h>m){m=b;continue}}else if(!K&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){K=!0,h=-1,m=0;continue}return c(J,String(se),_,p)}_=!1,O=A(O,p,10,J.s),(m=O.indexOf("."))>-1?O=O.replace(".",""):m=O.length}for(h=0;O.charCodeAt(h)===48;h++);for(b=O.length;O.charCodeAt(--b)===48;);if(O=O.slice(h,++b)){if(b-=h,_&&E.DEBUG&&b>15&&(se>DCn||se!==zK(se)))throw Error(gti+J.s*se);if((m=m-h-1)>te)J.c=J.e=null;else if(m<j)J.c=[J.e=0];else{if(J.e=m,J.c=[],h=(m+1)%ku,m<0&&(h+=ku),h<b){for(h&&J.c.push(+O.slice(0,h)),b-=ku;h<b;)J.c.push(+O.slice(h,h+=ku));h=ku-(O=O.slice(h)).length}else h-=b;for(;h--;O+="0");J.c.push(+O)}}else J.c=[J.e=0]}E.clone=xti,E.ROUND_UP=0,E.ROUND_DOWN=1,E.ROUND_CEIL=2,E.ROUND_FLOOR=3,E.ROUND_HALF_UP=4,E.ROUND_HALF_DOWN=5,E.ROUND_HALF_EVEN=6,E.ROUND_HALF_CEIL=7,E.ROUND_HALF_FLOOR=8,E.EUCLID=9,E.config=E.set=function(se){var p,L;if(se!=null)if(typeof se=="object"){if(se.hasOwnProperty(p="DECIMAL_PLACES")&&(L=se[p],Ty(L,0,M3,p),g=L),se.hasOwnProperty(p="ROUNDING_MODE")&&(L=se[p],Ty(L,0,8,p),w=L),se.hasOwnProperty(p="EXPONENTIAL_AT")&&(L=se[p],L&&L.pop?(Ty(L[0],-M3,0,p),Ty(L[1],0,M3,p),N=L[0],F=L[1]):(Ty(L,-M3,M3,p),N=-(F=L<0?-L:L))),se.hasOwnProperty(p="RANGE"))if(L=se[p],L&&L.pop)Ty(L[0],-M3,-1,p),Ty(L[1],1,M3,p),j=L[0],te=L[1];else if(Ty(L,-M3,M3,p),L)j=-(te=L<0?-L:L);else throw Error(QD+p+" cannot be zero: "+L);if(se.hasOwnProperty(p="CRYPTO"))if(L=se[p],L===!!L)if(L)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))v=L;else throw v=!L,Error(QD+"crypto unavailable");else v=L;else throw Error(QD+p+" not true or false: "+L);if(se.hasOwnProperty(p="MODULO_MODE")&&(L=se[p],Ty(L,0,9,p),ne=L),se.hasOwnProperty(p="POW_PRECISION")&&(L=se[p],Ty(L,0,M3,p),Z=L),se.hasOwnProperty(p="FORMAT"))if(L=se[p],typeof L=="object")R=L;else throw Error(QD+p+" not an object: "+L);if(se.hasOwnProperty(p="ALPHABET"))if(L=se[p],typeof L=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(L))U=L.slice(0,10)=="0123456789",M=L;else throw Error(QD+p+" invalid: "+L)}else throw Error(QD+"Object expected: "+se);return{DECIMAL_PLACES:g,ROUNDING_MODE:w,EXPONENTIAL_AT:[N,F],RANGE:[j,te],CRYPTO:v,MODULO_MODE:ne,POW_PRECISION:Z,FORMAT:R,ALPHABET:M}},E.isBigNumber=function(se){if(!se||se._isBigNumber!==!0)return!1;if(!E.DEBUG)return!0;var p,L,V=se.c,K=se.e,m=se.s;e:if({}.toString.call(V)=="[object Array]"){if((m===1||m===-1)&&K>=-M3&&K<=M3&&K===zK(K)){if(V[0]===0){if(K===0&&V.length===1)return!0;break e}if(p=(K+1)%ku,p<1&&(p+=ku),String(V[0]).length==p){for(p=0;p<V.length;p++)if(L=V[p],L<0||L>=ZF||L!==zK(L))break e;if(L!==0)return!0}}}else if(V===null&&K===null&&(m===null||m===1||m===-1))return!0;throw Error(QD+"Invalid BigNumber: "+se)},E.maximum=E.max=function(){return H(arguments,f.lt)},E.minimum=E.min=function(){return H(arguments,f.gt)},E.random=function(){var se=9007199254740992,p=Math.random()*se&2097151?function(){return zK(Math.random()*se)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(L){var V,K,m,h,_,b=0,O=[],J=new E(l);if(L==null?L=g:Ty(L,0,M3),h=kCn(L/ku),v)if(crypto.getRandomValues){for(V=crypto.getRandomValues(new Uint32Array(h*=2));b<h;)_=V[b]*131072+(V[b+1]>>>11),_>=9e15?(K=crypto.getRandomValues(new Uint32Array(2)),V[b]=K[0],V[b+1]=K[1]):(O.push(_%1e14),b+=2);b=h/2}else if(crypto.randomBytes){for(V=crypto.randomBytes(h*=7);b<h;)_=(V[b]&31)*281474976710656+V[b+1]*1099511627776+V[b+2]*4294967296+V[b+3]*16777216+(V[b+4]<<16)+(V[b+5]<<8)+V[b+6],_>=9e15?crypto.randomBytes(7).copy(V,b):(O.push(_%1e14),b+=7);b=h/7}else throw v=!1,Error(QD+"crypto unavailable");if(!v)for(;b<h;)_=p(),_<9e15&&(O[b++]=_%1e14);for(h=O[--b],L%=ku,h&&L&&(_=RCn[ku-L],O[b]=zK(h/_)*_);O[b]===0;O.pop(),b--);if(b<0)O=[m=0];else{for(m=-1;O[0]===0;O.splice(0,1),m-=ku);for(b=1,_=O[0];_>=10;_/=10,b++);b<ku&&(m-=ku-b)}return J.e=m,J.c=O,J}}(),E.sum=function(){for(var se=1,p=arguments,L=new E(p[0]);se<p.length;)L=L.plus(p[se++]);return L},A=function(){var se="0123456789";function p(L,V,K,m){for(var h,_=[0],b,O=0,J=L.length;O<J;){for(b=_.length;b--;_[b]*=V);for(_[0]+=m.indexOf(L.charAt(O++)),h=0;h<_.length;h++)_[h]>K-1&&(_[h+1]==null&&(_[h+1]=0),_[h+1]+=_[h]/K|0,_[h]%=K)}return _.reverse()}return function(L,V,K,m,h){var _,b,O,J,ie,G,I,C,D=L.indexOf("."),W=g,ae=w;for(D>=0&&(J=Z,Z=0,L=L.replace(".",""),C=new E(V),G=C.pow(L.length-D),Z=J,C.c=p(hW(ZM(G.c),G.e,"0"),10,K,se),C.e=C.c.length),I=p(L,V,K,h?(_=M,se):(_=se,M)),O=J=I.length;I[--J]==0;I.pop());if(!I[0])return _.charAt(0);if(D<0?--O:(G.c=I,G.e=O,G.s=m,G=i(G,C,W,ae,K),I=G.c,ie=G.r,O=G.e),b=O+W+1,D=I[b],J=K/2,ie=ie||b<0||I[b+1]!=null,ie=ae<4?(D!=null||ie)&&(ae==0||ae==(G.s<0?3:2)):D>J||D==J&&(ae==4||ie||ae==6&&I[b-1]&1||ae==(G.s<0?8:7)),b<1||!I[0])L=ie?hW(_.charAt(1),-W,_.charAt(0)):_.charAt(0);else{if(I.length=b,ie)for(--K;++I[--b]>K;)I[b]=0,b||(++O,I=[1].concat(I));for(J=I.length;!I[--J];);for(D=0,L="";D<=J;L+=_.charAt(I[D++]));L=hW(L,O,_.charAt(0))}return L}}(),i=function(){function se(V,K,m){var h,_,b,O,J=0,ie=V.length,G=K%yoe,I=K/yoe|0;for(V=V.slice();ie--;)b=V[ie]%yoe,O=V[ie]/yoe|0,h=I*b+O*G,_=G*b+h%yoe*yoe+J,J=(_/m|0)+(h/yoe|0)+I*O,V[ie]=_%m;return J&&(V=[J].concat(V)),V}function p(V,K,m,h){var _,b;if(m!=h)b=m>h?1:-1;else for(_=b=0;_<m;_++)if(V[_]!=K[_]){b=V[_]>K[_]?1:-1;break}return b}function L(V,K,m,h){for(var _=0;m--;)V[m]-=_,_=V[m]<K[m]?1:0,V[m]=_*h+V[m]-K[m];for(;!V[0]&&V.length>1;V.splice(0,1));}return function(V,K,m,h,_){var b,O,J,ie,G,I,C,D,W,ae,ye,Xe,nt,Ke,It,rt,ut,Rt=V.s==K.s?1:-1,Ee=V.c,Pt=K.c;if(!Ee||!Ee[0]||!Pt||!Pt[0])return new E(!V.s||!K.s||(Ee?Pt&&Ee[0]==Pt[0]:!Pt)?NaN:Ee&&Ee[0]==0||!Pt?Rt*0:Rt/0);for(D=new E(Rt),W=D.c=[],O=V.e-K.e,Rt=m+O+1,_||(_=ZF,O=$M(V.e/ku)-$M(K.e/ku),Rt=Rt/ku|0),J=0;Pt[J]==(Ee[J]||0);J++);if(Pt[J]>(Ee[J]||0)&&O--,Rt<0)W.push(1),ie=!0;else{for(Ke=Ee.length,rt=Pt.length,J=0,Rt+=2,G=zK(_/(Pt[0]+1)),G>1&&(Pt=se(Pt,G,_),Ee=se(Ee,G,_),rt=Pt.length,Ke=Ee.length),nt=rt,ae=Ee.slice(0,rt),ye=ae.length;ye<rt;ae[ye++]=0);ut=Pt.slice(),ut=[0].concat(ut),It=Pt[0],Pt[1]>=_/2&&It++;do{if(G=0,b=p(Pt,ae,rt,ye),b<0){if(Xe=ae[0],rt!=ye&&(Xe=Xe*_+(ae[1]||0)),G=zK(Xe/It),G>1)for(G>=_&&(G=_-1),I=se(Pt,G,_),C=I.length,ye=ae.length;p(I,ae,C,ye)==1;)G--,L(I,rt<C?ut:Pt,C,_),C=I.length,b=1;else G==0&&(b=G=1),I=Pt.slice(),C=I.length;if(C<ye&&(I=[0].concat(I)),L(ae,I,ye,_),ye=ae.length,b==-1)for(;p(Pt,ae,rt,ye)<1;)G++,L(ae,rt<ye?ut:Pt,ye,_),ye=ae.length}else b===0&&(G++,ae=[0]);W[J++]=G,ae[0]?ae[ye++]=Ee[nt]||0:(ae=[Ee[nt]],ye=1)}while((nt++<Ke||ae[0]!=null)&&Rt--);ie=ae[0]!=null,W[0]||W.splice(0,1)}if(_==ZF){for(J=1,Rt=W[0];Rt>=10;Rt/=10,J++);ee(D,m+(D.e=J+O*ku-1)+1,h,ie)}else D.e=O,D.r=+ie;return D}}();function Q(se,p,L,V){var K,m,h,_,b;if(L==null?L=w:Ty(L,0,8),!se.c)return se.toString();if(K=se.c[0],h=se.e,p==null)b=ZM(se.c),b=V==1||V==2&&(h<=N||h>=F)?O6t(b,h):hW(b,h,"0");else if(se=ee(new E(se),p,L),m=se.e,b=ZM(se.c),_=b.length,V==1||V==2&&(p<=m||m<=N)){for(;_<p;b+="0",_++);b=O6t(b,m)}else if(p-=h,b=hW(b,m,"0"),m+1>_){if(--p>0)for(b+=".";p--;b+="0");}else if(p+=m-_,p>0)for(m+1==_&&(b+=".");p--;b+="0");return se.s<0&&K?"-"+b:b}function H(se,p){for(var L,V=1,K=new E(se[0]);V<se.length;V++)if(L=new E(se[V]),L.s)p.call(K,L)&&(K=L);else{K=L;break}return K}function re(se,p,L){for(var V=1,K=p.length;!p[--K];p.pop());for(K=p[0];K>=10;K/=10,V++);return(L=V+L*ku-1)>te?se.c=se.e=null:L<j?se.c=[se.e=0]:(se.e=L,se.c=p),se}c=function(){var se=/^(-?)0([xbo])(?=\w[\w.]*$)/i,p=/^([^.]+)\.$/,L=/^\.([^.]+)$/,V=/^-?(Infinity|NaN)$/,K=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(m,h,_,b){var O,J=_?h:h.replace(K,"");if(V.test(J))m.s=isNaN(J)?null:J<0?-1:1;else{if(!_&&(J=J.replace(se,function(ie,G,I){return O=(I=I.toLowerCase())=="x"?16:I=="b"?2:8,!b||b==O?G:ie}),b&&(O=b,J=J.replace(p,"$1").replace(L,"0.$1")),h!=J))return new E(J,O);if(E.DEBUG)throw Error(QD+"Not a"+(b?" base "+b:"")+" number: "+h);m.s=null}m.c=m.e=null}}();function ee(se,p,L,V){var K,m,h,_,b,O,J,ie=se.c,G=RCn;if(ie){e:{for(K=1,_=ie[0];_>=10;_/=10,K++);if(m=p-K,m<0)m+=ku,h=p,b=ie[O=0],J=b/G[K-h-1]%10|0;else if(O=kCn((m+1)/ku),O>=ie.length)if(V){for(;ie.length<=O;ie.push(0));b=J=0,K=1,m%=ku,h=m-ku+1}else break e;else{for(b=_=ie[O],K=1;_>=10;_/=10,K++);m%=ku,h=m-ku+K,J=h<0?0:b/G[K-h-1]%10|0}if(V=V||p<0||ie[O+1]!=null||(h<0?b:b%G[K-h-1]),V=L<4?(J||V)&&(L==0||L==(se.s<0?3:2)):J>5||J==5&&(L==4||V||L==6&&(m>0?h>0?b/G[K-h]:0:ie[O-1])%10&1||L==(se.s<0?8:7)),p<1||!ie[0])return ie.length=0,V?(p-=se.e+1,ie[0]=G[(ku-p%ku)%ku],se.e=-p||0):ie[0]=se.e=0,se;if(m==0?(ie.length=O,_=1,O--):(ie.length=O+1,_=G[ku-m],ie[O]=h>0?zK(b/G[K-h]%G[h])*_:0),V)for(;;)if(O==0){for(m=1,h=ie[0];h>=10;h/=10,m++);for(h=ie[0]+=_,_=1;h>=10;h/=10,_++);m!=_&&(se.e++,ie[0]==ZF&&(ie[0]=1));break}else{if(ie[O]+=_,ie[O]!=ZF)break;ie[O--]=0,_=1}for(m=ie.length;ie[--m]===0;ie.pop());}se.e>te?se.c=se.e=null:se.e<j&&(se.c=[se.e=0])}return se}function T(se){var p,L=se.e;return L===null?se.toString():(p=ZM(se.c),p=L<=N||L>=F?O6t(p,L):hW(p,L,"0"),se.s<0?"-"+p:p)}return f.absoluteValue=f.abs=function(){var se=new E(this);return se.s<0&&(se.s=1),se},f.comparedTo=function(se,p){return jSe(this,new E(se,p))},f.decimalPlaces=f.dp=function(se,p){var L,V,K,m=this;if(se!=null)return Ty(se,0,M3),p==null?p=w:Ty(p,0,8),ee(new E(m),se+m.e+1,p);if(!(L=m.c))return null;if(V=((K=L.length-1)-$M(this.e/ku))*ku,K=L[K])for(;K%10==0;K/=10,V--);return V<0&&(V=0),V},f.dividedBy=f.div=function(se,p){return i(this,new E(se,p),g,w)},f.dividedToIntegerBy=f.idiv=function(se,p){return i(this,new E(se,p),0,1)},f.exponentiatedBy=f.pow=function(se,p){var L,V,K,m,h,_,b,O,J,ie=this;if(se=new E(se),se.c&&!se.isInteger())throw Error(QD+"Exponent not an integer: "+T(se));if(p!=null&&(p=new E(p)),_=se.e>14,!ie.c||!ie.c[0]||ie.c[0]==1&&!ie.e&&ie.c.length==1||!se.c||!se.c[0])return J=new E(Math.pow(+T(ie),_?se.s*(2-P6t(se)):+T(se))),p?J.mod(p):J;if(b=se.s<0,p){if(p.c?!p.c[0]:!p.s)return new E(NaN);V=!b&&ie.isInteger()&&p.isInteger(),V&&(ie=ie.mod(p))}else{if(se.e>9&&(ie.e>0||ie.e<-1||(ie.e==0?ie.c[0]>1||_&&ie.c[1]>=24e7:ie.c[0]<8e13||_&&ie.c[0]<=9999975e7)))return m=ie.s<0&&P6t(se)?-0:0,ie.e>-1&&(m=1/m),new E(b?1/m:m);Z&&(m=kCn(Z/ku+2))}for(_?(L=new E(.5),b&&(se.s=1),O=P6t(se)):(K=Math.abs(+T(se)),O=K%2),J=new E(l);;){if(O){if(J=J.times(ie),!J.c)break;m?J.c.length>m&&(J.c.length=m):V&&(J=J.mod(p))}if(K){if(K=zK(K/2),K===0)break;O=K%2}else if(se=se.times(L),ee(se,se.e+1,1),se.e>14)O=P6t(se);else{if(K=+T(se),K===0)break;O=K%2}ie=ie.times(ie),m?ie.c&&ie.c.length>m&&(ie.c.length=m):V&&(ie=ie.mod(p))}return V?J:(b&&(J=l.div(J)),p?J.mod(p):m?ee(J,Z,w,h):J)},f.integerValue=function(se){var p=new E(this);return se==null?se=w:Ty(se,0,8),ee(p,p.e+1,se)},f.isEqualTo=f.eq=function(se,p){return jSe(this,new E(se,p))===0},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(se,p){return jSe(this,new E(se,p))>0},f.isGreaterThanOrEqualTo=f.gte=function(se,p){return(p=jSe(this,new E(se,p)))===1||p===0},f.isInteger=function(){return!!this.c&&$M(this.e/ku)>this.c.length-2},f.isLessThan=f.lt=function(se,p){return jSe(this,new E(se,p))<0},f.isLessThanOrEqualTo=f.lte=function(se,p){return(p=jSe(this,new E(se,p)))===-1||p===0},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&this.c[0]==0},f.minus=function(se,p){var L,V,K,m,h=this,_=h.s;if(se=new E(se,p),p=se.s,!_||!p)return new E(NaN);if(_!=p)return se.s=-p,h.plus(se);var b=h.e/ku,O=se.e/ku,J=h.c,ie=se.c;if(!b||!O){if(!J||!ie)return J?(se.s=-p,se):new E(ie?h:NaN);if(!J[0]||!ie[0])return ie[0]?(se.s=-p,se):new E(J[0]?h:w==3?-0:0)}if(b=$M(b),O=$M(O),J=J.slice(),_=b-O){for((m=_<0)?(_=-_,K=J):(O=b,K=ie),K.reverse(),p=_;p--;K.push(0));K.reverse()}else for(V=(m=(_=J.length)<(p=ie.length))?_:p,_=p=0;p<V;p++)if(J[p]!=ie[p]){m=J[p]<ie[p];break}if(m&&(K=J,J=ie,ie=K,se.s=-se.s),p=(V=ie.length)-(L=J.length),p>0)for(;p--;J[L++]=0);for(p=ZF-1;V>_;){if(J[--V]<ie[V]){for(L=V;L&&!J[--L];J[L]=p);--J[L],J[V]+=ZF}J[V]-=ie[V]}for(;J[0]==0;J.splice(0,1),--O);return J[0]?re(se,J,O):(se.s=w==3?-1:1,se.c=[se.e=0],se)},f.modulo=f.mod=function(se,p){var L,V,K=this;return se=new E(se,p),!K.c||!se.s||se.c&&!se.c[0]?new E(NaN):!se.c||K.c&&!K.c[0]?new E(K):(ne==9?(V=se.s,se.s=1,L=i(K,se,0,3),se.s=V,L.s*=V):L=i(K,se,0,ne),se=K.minus(L.times(se)),!se.c[0]&&ne==1&&(se.s=K.s),se)},f.multipliedBy=f.times=function(se,p){var L,V,K,m,h,_,b,O,J,ie,G,I,C,D,W,ae=this,ye=ae.c,Xe=(se=new E(se,p)).c;if(!ye||!Xe||!ye[0]||!Xe[0])return!ae.s||!se.s||ye&&!ye[0]&&!Xe||Xe&&!Xe[0]&&!ye?se.c=se.e=se.s=null:(se.s*=ae.s,!ye||!Xe?se.c=se.e=null:(se.c=[0],se.e=0)),se;for(V=$M(ae.e/ku)+$M(se.e/ku),se.s*=ae.s,b=ye.length,ie=Xe.length,b<ie&&(C=ye,ye=Xe,Xe=C,K=b,b=ie,ie=K),K=b+ie,C=[];K--;C.push(0));for(D=ZF,W=yoe,K=ie;--K>=0;){for(L=0,G=Xe[K]%W,I=Xe[K]/W|0,h=b,m=K+h;m>K;)O=ye[--h]%W,J=ye[h]/W|0,_=I*O+J*G,O=G*O+_%W*W+C[m]+L,L=(O/D|0)+(_/W|0)+I*J,C[m--]=O%D;C[m]=L}return L?++V:C.splice(0,1),re(se,C,V)},f.negated=function(){var se=new E(this);return se.s=-se.s||null,se},f.plus=function(se,p){var L,V=this,K=V.s;if(se=new E(se,p),p=se.s,!K||!p)return new E(NaN);if(K!=p)return se.s=-p,V.minus(se);var m=V.e/ku,h=se.e/ku,_=V.c,b=se.c;if(!m||!h){if(!_||!b)return new E(K/0);if(!_[0]||!b[0])return b[0]?se:new E(_[0]?V:K*0)}if(m=$M(m),h=$M(h),_=_.slice(),K=m-h){for(K>0?(h=m,L=b):(K=-K,L=_),L.reverse();K--;L.push(0));L.reverse()}for(K=_.length,p=b.length,K-p<0&&(L=b,b=_,_=L,p=K),K=0;p;)K=(_[--p]=_[p]+b[p]+K)/ZF|0,_[p]=ZF===_[p]?0:_[p]%ZF;return K&&(_=[K].concat(_),++h),re(se,_,h)},f.precision=f.sd=function(se,p){var L,V,K,m=this;if(se!=null&&se!==!!se)return Ty(se,1,M3),p==null?p=w:Ty(p,0,8),ee(new E(m),se,p);if(!(L=m.c))return null;if(K=L.length-1,V=K*ku+1,K=L[K]){for(;K%10==0;K/=10,V--);for(K=L[0];K>=10;K/=10,V++);}return se&&m.e+1>V&&(V=m.e+1),V},f.shiftedBy=function(se){return Ty(se,-DCn,DCn),this.times("1e"+se)},f.squareRoot=f.sqrt=function(){var se,p,L,V,K,m=this,h=m.c,_=m.s,b=m.e,O=g+4,J=new E("0.5");if(_!==1||!h||!h[0])return new E(!_||_<0&&(!h||h[0])?NaN:h?m:1/0);if(_=Math.sqrt(+T(m)),_==0||_==1/0?(p=ZM(h),(p.length+b)%2==0&&(p+="0"),_=Math.sqrt(+p),b=$M((b+1)/2)-(b<0||b%2),_==1/0?p="5e"+b:(p=_.toExponential(),p=p.slice(0,p.indexOf("e")+1)+b),L=new E(p)):L=new E(_+""),L.c[0]){for(b=L.e,_=b+O,_<3&&(_=0);;)if(K=L,L=J.times(K.plus(i(m,K,O,1))),ZM(K.c).slice(0,_)===(p=ZM(L.c)).slice(0,_))if(L.e<b&&--_,p=p.slice(_-3,_+1),p=="9999"||!V&&p=="4999"){if(!V&&(ee(K,K.e+g+2,0),K.times(K).eq(m))){L=K;break}O+=4,_+=4,V=1}else{(!+p||!+p.slice(1)&&p.charAt(0)=="5")&&(ee(L,L.e+g+2,1),se=!L.times(L).eq(m));break}}return ee(L,L.e+g+1,w,se)},f.toExponential=function(se,p){return se!=null&&(Ty(se,0,M3),se++),Q(this,se,p,1)},f.toFixed=function(se,p){return se!=null&&(Ty(se,0,M3),se=se+this.e+1),Q(this,se,p)},f.toFormat=function(se,p,L){var V,K=this;if(L==null)se!=null&&p&&typeof p=="object"?(L=p,p=null):se&&typeof se=="object"?(L=se,se=p=null):L=R;else if(typeof L!="object")throw Error(QD+"Argument not an object: "+L);if(V=K.toFixed(se,p),K.c){var m,h=V.split("."),_=+L.groupSize,b=+L.secondaryGroupSize,O=L.groupSeparator||"",J=h[0],ie=h[1],G=K.s<0,I=G?J.slice(1):J,C=I.length;if(b&&(m=_,_=b,b=m,C-=m),_>0&&C>0){for(m=C%_||_,J=I.substr(0,m);m<C;m+=_)J+=O+I.substr(m,_);b>0&&(J+=O+I.slice(m)),G&&(J="-"+J)}V=ie?J+(L.decimalSeparator||"")+((b=+L.fractionGroupSize)?ie.replace(new RegExp("\\d{"+b+"}\\B","g"),"$&"+(L.fractionGroupSeparator||"")):ie):J}return(L.prefix||"")+V+(L.suffix||"")},f.toFraction=function(se){var p,L,V,K,m,h,_,b,O,J,ie,G,I=this,C=I.c;if(se!=null&&(_=new E(se),!_.isInteger()&&(_.c||_.s!==1)||_.lt(l)))throw Error(QD+"Argument "+(_.isInteger()?"out of range: ":"not an integer: ")+T(_));if(!C)return new E(I);for(p=new E(l),O=L=new E(l),V=b=new E(l),G=ZM(C),m=p.e=G.length-I.e-1,p.c[0]=RCn[(h=m%ku)<0?ku+h:h],se=!se||_.comparedTo(p)>0?m>0?p:O:_,h=te,te=1/0,_=new E(G),b.c[0]=0;J=i(_,p,0,1),K=L.plus(J.times(V)),K.comparedTo(se)!=1;)L=V,V=K,O=b.plus(J.times(K=O)),b=K,p=_.minus(J.times(K=p)),_=K;return K=i(se.minus(L),V,0,1),b=b.plus(K.times(O)),L=L.plus(K.times(V)),b.s=O.s=I.s,m=m*2,ie=i(O,V,m,w).minus(I).abs().comparedTo(i(b,L,m,w).minus(I).abs())<1?[O,V]:[b,L],te=h,ie},f.toNumber=function(){return+T(this)},f.toPrecision=function(se,p){return se!=null&&Ty(se,1,M3),Q(this,se,p,2)},f.toString=function(se){var p,L=this,V=L.s,K=L.e;return K===null?V?(p="Infinity",V<0&&(p="-"+p)):p="NaN":(se==null?p=K<=N||K>=F?O6t(ZM(L.c),K):hW(ZM(L.c),K,"0"):se===10&&U?(L=ee(new E(L),g+K+1,w),p=hW(ZM(L.c),L.e,"0")):(Ty(se,2,M.length,"Base"),p=A(hW(ZM(L.c),K,"0"),10,se,V,!0)),V<0&&L.c[0]&&(p="-"+p)),p},f.valueOf=f.toJSON=function(){return T(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,e!=null&&E.set(e),E}function $M(e){var i=e|0;return e>0||e===i?i:i-1}function ZM(e){for(var i,A,c=1,f=e.length,l=e[0]+"";c<f;){for(i=e[c++]+"",A=ku-i.length;A--;i="0"+i);l+=i}for(f=l.length;l.charCodeAt(--f)===48;);return l.slice(0,f+1||1)}function jSe(e,i){var A,c,f=e.c,l=i.c,g=e.s,w=i.s,N=e.e,F=i.e;if(!g||!w)return null;if(A=f&&!f[0],c=l&&!l[0],A||c)return A?c?0:-w:g;if(g!=w)return g;if(A=g<0,c=N==F,!f||!l)return c?0:!f^A?1:-1;if(!c)return N>F^A?1:-1;for(w=(N=f.length)<(F=l.length)?N:F,g=0;g<w;g++)if(f[g]!=l[g])return f[g]>l[g]^A?1:-1;return N==F?0:N>F^A?1:-1}function Ty(e,i,A,c){if(e<i||e>A||e!==zK(e))throw Error(QD+(c||"Argument")+(typeof e=="number"?e<i||e>A?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function P6t(e){var i=e.c.length-1;return $M(e.e/ku)==i&&e.c[i]%2!=0}function O6t(e,i){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(i<0?"e":"e+")+i}function hW(e,i,A){var c,f;if(i<0){for(f=A+".";++i;f+=A);e=f+e}else if(c=e.length,++i>c){for(f=A,i-=c;--i;f+=A);e+=f}else i<c&&(e=e.slice(0,i)+"."+e.slice(i));return e}var o3n=xti(),PCn=e=>new o3n(e),F9s=e=>!e.isNaN(),pti;(function(e){e.BEFORE="before",e.AFTER="after"})(pti||(pti={}));var J9s=(e,i=2)=>{let A=PCn(e||0),c=F9s(A)?A.toFixed(i):PCn(0).toFixed(i);return PCn(c)},TCn;(function(e){e.Base="BASE",e.Asset="ASSET"})(TCn||(TCn={}));var gW=e=>typeof e=="string"||typeof e=="number"||e instanceof o3n,H9s=8,nle=(e,i=H9s)=>{let A=J9s(e,0);return{type:TCn.Base,amount:()=>A,plus:(c,f=i)=>nle(A.plus(gW(c)?c:c.amount()),f),minus:(c,f=i)=>nle(A.minus(gW(c)?c:c.amount()),f),times:(c,f=i)=>nle(A.times(gW(c)?c:c.amount()),f),div:(c,f=i)=>nle(A.div(gW(c)?c:c.amount()).decimalPlaces(0,o3n.ROUND_DOWN),f),lt:c=>A.lt(gW(c)?c:c.amount()),lte:c=>A.lte(gW(c)?c:c.amount()),gt:c=>A.gt(gW(c)?c:c.amount()),gte:c=>A.gte(gW(c)?c:c.amount()),eq:c=>A.eq(gW(c)?c:c.amount()),decimal:i}},yti;(function(e){e.RUNE="\u16B1",e.BTC="\u20BF",e.SATOSHI="\u26A1",e.ETH="\u039E",e.USD="$",e.DASH="\u0110",e.LTC="\u0141",e.DOGE="\xD0"})(yti||(yti={}));var L9s=e=>e.replace(/^0(x|X)/,""),mti=e=>{let i=e.symbol.slice(e.ticker.length+1);return L9s(i)},Mti=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Tti(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a3n={exports:{}};a3n.exports;(function(e){(function(i,A){function c(m,h){if(!m)throw new Error(h||"Assertion failed")}function f(m,h){m.super_=h;var _=function(){};_.prototype=h.prototype,m.prototype=new _,m.prototype.constructor=m}function l(m,h,_){if(l.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((h==="le"||h==="be")&&(_=h,h=10),this._init(m||0,h||10,_||"be"))}typeof i=="object"?i.exports=l:A.BN=l,l.BN=l,l.wordSize=26;var g;try{typeof window!="undefined"&&typeof window.Buffer!="undefined"?g=window.Buffer:g=gs("buffer").Buffer}catch(m){}l.isBN=function(h){return h instanceof l?!0:h!==null&&typeof h=="object"&&h.constructor.wordSize===l.wordSize&&Array.isArray(h.words)},l.max=function(h,_){return h.cmp(_)>0?h:_},l.min=function(h,_){return h.cmp(_)<0?h:_},l.prototype._init=function(h,_,b){if(typeof h=="number")return this._initNumber(h,_,b);if(typeof h=="object")return this._initArray(h,_,b);_==="hex"&&(_=16),c(_===(_|0)&&_>=2&&_<=36),h=h.toString().replace(/\s+/g,"");var O=0;h[0]==="-"&&(O++,this.negative=1),O<h.length&&(_===16?this._parseHex(h,O,b):(this._parseBase(h,_,O),b==="le"&&this._initArray(this.toArray(),_,b)))},l.prototype._initNumber=function(h,_,b){h<0&&(this.negative=1,h=-h),h<67108864?(this.words=[h&67108863],this.length=1):h<4503599627370496?(this.words=[h&67108863,h/67108864&67108863],this.length=2):(c(h<9007199254740992),this.words=[h&67108863,h/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),_,b)},l.prototype._initArray=function(h,_,b){if(c(typeof h.length=="number"),h.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(h.length/3),this.words=new Array(this.length);for(var O=0;O<this.length;O++)this.words[O]=0;var J,ie,G=0;if(b==="be")for(O=h.length-1,J=0;O>=0;O-=3)ie=h[O]|h[O-1]<<8|h[O-2]<<16,this.words[J]|=ie<<G&67108863,this.words[J+1]=ie>>>26-G&67108863,G+=24,G>=26&&(G-=26,J++);else if(b==="le")for(O=0,J=0;O<h.length;O+=3)ie=h[O]|h[O+1]<<8|h[O+2]<<16,this.words[J]|=ie<<G&67108863,this.words[J+1]=ie>>>26-G&67108863,G+=24,G>=26&&(G-=26,J++);return this._strip()};function w(m,h){var _=m.charCodeAt(h);if(_>=48&&_<=57)return _-48;if(_>=65&&_<=70)return _-55;if(_>=97&&_<=102)return _-87;c(!1,"Invalid character in "+m)}function N(m,h,_){var b=w(m,_);return _-1>=h&&(b|=w(m,_-1)<<4),b}l.prototype._parseHex=function(h,_,b){this.length=Math.ceil((h.length-_)/6),this.words=new Array(this.length);for(var O=0;O<this.length;O++)this.words[O]=0;var J=0,ie=0,G;if(b==="be")for(O=h.length-1;O>=_;O-=2)G=N(h,_,O)<<J,this.words[ie]|=G&67108863,J>=18?(J-=18,ie+=1,this.words[ie]|=G>>>26):J+=8;else{var I=h.length-_;for(O=I%2===0?_+1:_;O<h.length;O+=2)G=N(h,_,O)<<J,this.words[ie]|=G&67108863,J>=18?(J-=18,ie+=1,this.words[ie]|=G>>>26):J+=8}this._strip()};function F(m,h,_,b){for(var O=0,J=0,ie=Math.min(m.length,_),G=h;G<ie;G++){var I=m.charCodeAt(G)-48;O*=b,I>=49?J=I-49+10:I>=17?J=I-17+10:J=I,c(I>=0&&J<b,"Invalid character"),O+=J}return O}l.prototype._parseBase=function(h,_,b){this.words=[0],this.length=1;for(var O=0,J=1;J<=67108863;J*=_)O++;O--,J=J/_|0;for(var ie=h.length-b,G=ie%O,I=Math.min(ie,ie-G)+b,C=0,D=b;D<I;D+=O)C=F(h,D,D+O,_),this.imuln(J),this.words[0]+C<67108864?this.words[0]+=C:this._iaddn(C);if(G!==0){var W=1;for(C=F(h,D,h.length,_),D=0;D<G;D++)W*=_;this.imuln(W),this.words[0]+C<67108864?this.words[0]+=C:this._iaddn(C)}this._strip()},l.prototype.copy=function(h){h.words=new Array(this.length);for(var _=0;_<this.length;_++)h.words[_]=this.words[_];h.length=this.length,h.negative=this.negative,h.red=this.red};function j(m,h){m.words=h.words,m.length=h.length,m.negative=h.negative,m.red=h.red}if(l.prototype._move=function(h){j(h,this)},l.prototype.clone=function(){var h=new l(null);return this.copy(h),h},l.prototype._expand=function(h){for(;this.length<h;)this.words[this.length++]=0;return this},l.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},l.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol!="undefined"&&typeof Symbol.for=="function")try{l.prototype[Symbol.for("nodejs.util.inspect.custom")]=te}catch(m){l.prototype.inspect=te}else l.prototype.inspect=te;function te(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var v=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],ne=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Z=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];l.prototype.toString=function(h,_){h=h||10,_=_|0||1;var b;if(h===16||h==="hex"){b="";for(var O=0,J=0,ie=0;ie<this.length;ie++){var G=this.words[ie],I=((G<<O|J)&16777215).toString(16);J=G>>>24-O&16777215,O+=2,O>=26&&(O-=26,ie--),J!==0||ie!==this.length-1?b=v[6-I.length]+I+b:b=I+b}for(J!==0&&(b=J.toString(16)+b);b.length%_!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(h===(h|0)&&h>=2&&h<=36){var C=ne[h],D=Z[h];b="";var W=this.clone();for(W.negative=0;!W.isZero();){var ae=W.modrn(D).toString(h);W=W.idivn(D),W.isZero()?b=ae+b:b=v[C-ae.length]+ae+b}for(this.isZero()&&(b="0"+b);b.length%_!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}c(!1,"Base should be between 2 and 36")},l.prototype.toNumber=function(){var h=this.words[0];return this.length===2?h+=this.words[1]*67108864:this.length===3&&this.words[2]===1?h+=4503599627370496+this.words[1]*67108864:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-h:h},l.prototype.toJSON=function(){return this.toString(16,2)},g&&(l.prototype.toBuffer=function(h,_){return this.toArrayLike(g,h,_)}),l.prototype.toArray=function(h,_){return this.toArrayLike(Array,h,_)};var R=function(h,_){return h.allocUnsafe?h.allocUnsafe(_):new h(_)};l.prototype.toArrayLike=function(h,_,b){this._strip();var O=this.byteLength(),J=b||Math.max(1,O);c(O<=J,"byte array longer than desired length"),c(J>0,"Requested array length <= 0");var ie=R(h,J),G=_==="le"?"LE":"BE";return this["_toArrayLike"+G](ie,O),ie},l.prototype._toArrayLikeLE=function(h,_){for(var b=0,O=0,J=0,ie=0;J<this.length;J++){var G=this.words[J]<<ie|O;h[b++]=G&255,b<h.length&&(h[b++]=G>>8&255),b<h.length&&(h[b++]=G>>16&255),ie===6?(b<h.length&&(h[b++]=G>>24&255),O=0,ie=0):(O=G>>>24,ie+=2)}if(b<h.length)for(h[b++]=O;b<h.length;)h[b++]=0},l.prototype._toArrayLikeBE=function(h,_){for(var b=h.length-1,O=0,J=0,ie=0;J<this.length;J++){var G=this.words[J]<<ie|O;h[b--]=G&255,b>=0&&(h[b--]=G>>8&255),b>=0&&(h[b--]=G>>16&255),ie===6?(b>=0&&(h[b--]=G>>24&255),O=0,ie=0):(O=G>>>24,ie+=2)}if(b>=0)for(h[b--]=O;b>=0;)h[b--]=0},Math.clz32?l.prototype._countBits=function(h){return 32-Math.clz32(h)}:l.prototype._countBits=function(h){var _=h,b=0;return _>=4096&&(b+=13,_>>>=13),_>=64&&(b+=7,_>>>=7),_>=8&&(b+=4,_>>>=4),_>=2&&(b+=2,_>>>=2),b+_},l.prototype._zeroBits=function(h){if(h===0)return 26;var _=h,b=0;return _&8191||(b+=13,_>>>=13),_&127||(b+=7,_>>>=7),_&15||(b+=4,_>>>=4),_&3||(b+=2,_>>>=2),_&1||b++,b},l.prototype.bitLength=function(){var h=this.words[this.length-1],_=this._countBits(h);return(this.length-1)*26+_};function M(m){for(var h=new Array(m.bitLength()),_=0;_<h.length;_++){var b=_/26|0,O=_%26;h[_]=m.words[b]>>>O&1}return h}l.prototype.zeroBits=function(){if(this.isZero())return 0;for(var h=0,_=0;_<this.length;_++){var b=this._zeroBits(this.words[_]);if(h+=b,b!==26)break}return h},l.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},l.prototype.toTwos=function(h){return this.negative!==0?this.abs().inotn(h).iaddn(1):this.clone()},l.prototype.fromTwos=function(h){return this.testn(h-1)?this.notn(h).iaddn(1).ineg():this.clone()},l.prototype.isNeg=function(){return this.negative!==0},l.prototype.neg=function(){return this.clone().ineg()},l.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},l.prototype.iuor=function(h){for(;this.length<h.length;)this.words[this.length++]=0;for(var _=0;_<h.length;_++)this.words[_]=this.words[_]|h.words[_];return this._strip()},l.prototype.ior=function(h){return c((this.negative|h.negative)===0),this.iuor(h)},l.prototype.or=function(h){return this.length>h.length?this.clone().ior(h):h.clone().ior(this)},l.prototype.uor=function(h){return this.length>h.length?this.clone().iuor(h):h.clone().iuor(this)},l.prototype.iuand=function(h){var _;this.length>h.length?_=h:_=this;for(var b=0;b<_.length;b++)this.words[b]=this.words[b]&h.words[b];return this.length=_.length,this._strip()},l.prototype.iand=function(h){return c((this.negative|h.negative)===0),this.iuand(h)},l.prototype.and=function(h){return this.length>h.length?this.clone().iand(h):h.clone().iand(this)},l.prototype.uand=function(h){return this.length>h.length?this.clone().iuand(h):h.clone().iuand(this)},l.prototype.iuxor=function(h){var _,b;this.length>h.length?(_=this,b=h):(_=h,b=this);for(var O=0;O<b.length;O++)this.words[O]=_.words[O]^b.words[O];if(this!==_)for(;O<_.length;O++)this.words[O]=_.words[O];return this.length=_.length,this._strip()},l.prototype.ixor=function(h){return c((this.negative|h.negative)===0),this.iuxor(h)},l.prototype.xor=function(h){return this.length>h.length?this.clone().ixor(h):h.clone().ixor(this)},l.prototype.uxor=function(h){return this.length>h.length?this.clone().iuxor(h):h.clone().iuxor(this)},l.prototype.inotn=function(h){c(typeof h=="number"&&h>=0);var _=Math.ceil(h/26)|0,b=h%26;this._expand(_),b>0&&_--;for(var O=0;O<_;O++)this.words[O]=~this.words[O]&67108863;return b>0&&(this.words[O]=~this.words[O]&67108863>>26-b),this._strip()},l.prototype.notn=function(h){return this.clone().inotn(h)},l.prototype.setn=function(h,_){c(typeof h=="number"&&h>=0);var b=h/26|0,O=h%26;return this._expand(b+1),_?this.words[b]=this.words[b]|1<<O:this.words[b]=this.words[b]&~(1<<O),this._strip()},l.prototype.iadd=function(h){var _;if(this.negative!==0&&h.negative===0)return this.negative=0,_=this.isub(h),this.negative^=1,this._normSign();if(this.negative===0&&h.negative!==0)return h.negative=0,_=this.isub(h),h.negative=1,_._normSign();var b,O;this.length>h.length?(b=this,O=h):(b=h,O=this);for(var J=0,ie=0;ie<O.length;ie++)_=(b.words[ie]|0)+(O.words[ie]|0)+J,this.words[ie]=_&67108863,J=_>>>26;for(;J!==0&&ie<b.length;ie++)_=(b.words[ie]|0)+J,this.words[ie]=_&67108863,J=_>>>26;if(this.length=b.length,J!==0)this.words[this.length]=J,this.length++;else if(b!==this)for(;ie<b.length;ie++)this.words[ie]=b.words[ie];return this},l.prototype.add=function(h){var _;return h.negative!==0&&this.negative===0?(h.negative=0,_=this.sub(h),h.negative^=1,_):h.negative===0&&this.negative!==0?(this.negative=0,_=h.sub(this),this.negative=1,_):this.length>h.length?this.clone().iadd(h):h.clone().iadd(this)},l.prototype.isub=function(h){if(h.negative!==0){h.negative=0;var _=this.iadd(h);return h.negative=1,_._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(h),this.negative=1,this._normSign();var b=this.cmp(h);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var O,J;b>0?(O=this,J=h):(O=h,J=this);for(var ie=0,G=0;G<J.length;G++)_=(O.words[G]|0)-(J.words[G]|0)+ie,ie=_>>26,this.words[G]=_&67108863;for(;ie!==0&&G<O.length;G++)_=(O.words[G]|0)+ie,ie=_>>26,this.words[G]=_&67108863;if(ie===0&&G<O.length&&O!==this)for(;G<O.length;G++)this.words[G]=O.words[G];return this.length=Math.max(this.length,G),O!==this&&(this.negative=1),this._strip()},l.prototype.sub=function(h){return this.clone().isub(h)};function U(m,h,_){_.negative=h.negative^m.negative;var b=m.length+h.length|0;_.length=b,b=b-1|0;var O=m.words[0]|0,J=h.words[0]|0,ie=O*J,G=ie&67108863,I=ie/67108864|0;_.words[0]=G;for(var C=1;C<b;C++){for(var D=I>>>26,W=I&67108863,ae=Math.min(C,h.length-1),ye=Math.max(0,C-m.length+1);ye<=ae;ye++){var Xe=C-ye|0;O=m.words[Xe]|0,J=h.words[ye]|0,ie=O*J+W,D+=ie/67108864|0,W=ie&67108863}_.words[C]=W|0,I=D|0}return I!==0?_.words[C]=I|0:_.length--,_._strip()}var E=function(h,_,b){var O=h.words,J=_.words,ie=b.words,G=0,I,C,D,W=O[0]|0,ae=W&8191,ye=W>>>13,Xe=O[1]|0,nt=Xe&8191,Ke=Xe>>>13,It=O[2]|0,rt=It&8191,ut=It>>>13,Rt=O[3]|0,Ee=Rt&8191,Pt=Rt>>>13,_e=O[4]|0,we=_e&8191,xe=_e>>>13,Ye=O[5]|0,X=Ye&8191,ht=Ye>>>13,Ut=O[6]|0,zt=Ut&8191,Wt=Ut>>>13,yn=O[7]|0,rn=yn&8191,un=yn>>>13,fr=O[8]|0,ir=fr&8191,Ln=fr>>>13,Br=O[9]|0,Zn=Br&8191,Jn=Br>>>13,_r=J[0]|0,Yn=_r&8191,kn=_r>>>13,Y=J[1]|0,fe=Y&8191,be=Y>>>13,qt=J[2]|0,ct=qt&8191,Ft=qt>>>13,vr=J[3]|0,$n=vr&8191,Hn=vr>>>13,kr=J[4]|0,sr=kr&8191,Wn=kr>>>13,Xr=J[5]|0,pr=Xr&8191,Gn=Xr>>>13,Or=J[6]|0,lt=Or&8191,Bt=Or>>>13,Ot=J[7]|0,We=Ot&8191,Qt=Ot>>>13,fn=J[8]|0,tn=fn&8191,Re=fn>>>13,Vn=J[9]|0,De=Vn&8191,Je=Vn>>>13;b.negative=h.negative^_.negative,b.length=19,I=Math.imul(ae,Yn),C=Math.imul(ae,kn),C=C+Math.imul(ye,Yn)|0,D=Math.imul(ye,kn);var je=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(je>>>26)|0,je&=67108863,I=Math.imul(nt,Yn),C=Math.imul(nt,kn),C=C+Math.imul(Ke,Yn)|0,D=Math.imul(Ke,kn),I=I+Math.imul(ae,fe)|0,C=C+Math.imul(ae,be)|0,C=C+Math.imul(ye,fe)|0,D=D+Math.imul(ye,be)|0;var st=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(st>>>26)|0,st&=67108863,I=Math.imul(rt,Yn),C=Math.imul(rt,kn),C=C+Math.imul(ut,Yn)|0,D=Math.imul(ut,kn),I=I+Math.imul(nt,fe)|0,C=C+Math.imul(nt,be)|0,C=C+Math.imul(Ke,fe)|0,D=D+Math.imul(Ke,be)|0,I=I+Math.imul(ae,ct)|0,C=C+Math.imul(ae,Ft)|0,C=C+Math.imul(ye,ct)|0,D=D+Math.imul(ye,Ft)|0;var Et=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Et>>>26)|0,Et&=67108863,I=Math.imul(Ee,Yn),C=Math.imul(Ee,kn),C=C+Math.imul(Pt,Yn)|0,D=Math.imul(Pt,kn),I=I+Math.imul(rt,fe)|0,C=C+Math.imul(rt,be)|0,C=C+Math.imul(ut,fe)|0,D=D+Math.imul(ut,be)|0,I=I+Math.imul(nt,ct)|0,C=C+Math.imul(nt,Ft)|0,C=C+Math.imul(Ke,ct)|0,D=D+Math.imul(Ke,Ft)|0,I=I+Math.imul(ae,$n)|0,C=C+Math.imul(ae,Hn)|0,C=C+Math.imul(ye,$n)|0,D=D+Math.imul(ye,Hn)|0;var Mt=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,I=Math.imul(we,Yn),C=Math.imul(we,kn),C=C+Math.imul(xe,Yn)|0,D=Math.imul(xe,kn),I=I+Math.imul(Ee,fe)|0,C=C+Math.imul(Ee,be)|0,C=C+Math.imul(Pt,fe)|0,D=D+Math.imul(Pt,be)|0,I=I+Math.imul(rt,ct)|0,C=C+Math.imul(rt,Ft)|0,C=C+Math.imul(ut,ct)|0,D=D+Math.imul(ut,Ft)|0,I=I+Math.imul(nt,$n)|0,C=C+Math.imul(nt,Hn)|0,C=C+Math.imul(Ke,$n)|0,D=D+Math.imul(Ke,Hn)|0,I=I+Math.imul(ae,sr)|0,C=C+Math.imul(ae,Wn)|0,C=C+Math.imul(ye,sr)|0,D=D+Math.imul(ye,Wn)|0;var Vt=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,I=Math.imul(X,Yn),C=Math.imul(X,kn),C=C+Math.imul(ht,Yn)|0,D=Math.imul(ht,kn),I=I+Math.imul(we,fe)|0,C=C+Math.imul(we,be)|0,C=C+Math.imul(xe,fe)|0,D=D+Math.imul(xe,be)|0,I=I+Math.imul(Ee,ct)|0,C=C+Math.imul(Ee,Ft)|0,C=C+Math.imul(Pt,ct)|0,D=D+Math.imul(Pt,Ft)|0,I=I+Math.imul(rt,$n)|0,C=C+Math.imul(rt,Hn)|0,C=C+Math.imul(ut,$n)|0,D=D+Math.imul(ut,Hn)|0,I=I+Math.imul(nt,sr)|0,C=C+Math.imul(nt,Wn)|0,C=C+Math.imul(Ke,sr)|0,D=D+Math.imul(Ke,Wn)|0,I=I+Math.imul(ae,pr)|0,C=C+Math.imul(ae,Gn)|0,C=C+Math.imul(ye,pr)|0,D=D+Math.imul(ye,Gn)|0;var nn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(nn>>>26)|0,nn&=67108863,I=Math.imul(zt,Yn),C=Math.imul(zt,kn),C=C+Math.imul(Wt,Yn)|0,D=Math.imul(Wt,kn),I=I+Math.imul(X,fe)|0,C=C+Math.imul(X,be)|0,C=C+Math.imul(ht,fe)|0,D=D+Math.imul(ht,be)|0,I=I+Math.imul(we,ct)|0,C=C+Math.imul(we,Ft)|0,C=C+Math.imul(xe,ct)|0,D=D+Math.imul(xe,Ft)|0,I=I+Math.imul(Ee,$n)|0,C=C+Math.imul(Ee,Hn)|0,C=C+Math.imul(Pt,$n)|0,D=D+Math.imul(Pt,Hn)|0,I=I+Math.imul(rt,sr)|0,C=C+Math.imul(rt,Wn)|0,C=C+Math.imul(ut,sr)|0,D=D+Math.imul(ut,Wn)|0,I=I+Math.imul(nt,pr)|0,C=C+Math.imul(nt,Gn)|0,C=C+Math.imul(Ke,pr)|0,D=D+Math.imul(Ke,Gn)|0,I=I+Math.imul(ae,lt)|0,C=C+Math.imul(ae,Bt)|0,C=C+Math.imul(ye,lt)|0,D=D+Math.imul(ye,Bt)|0;var wn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(wn>>>26)|0,wn&=67108863,I=Math.imul(rn,Yn),C=Math.imul(rn,kn),C=C+Math.imul(un,Yn)|0,D=Math.imul(un,kn),I=I+Math.imul(zt,fe)|0,C=C+Math.imul(zt,be)|0,C=C+Math.imul(Wt,fe)|0,D=D+Math.imul(Wt,be)|0,I=I+Math.imul(X,ct)|0,C=C+Math.imul(X,Ft)|0,C=C+Math.imul(ht,ct)|0,D=D+Math.imul(ht,Ft)|0,I=I+Math.imul(we,$n)|0,C=C+Math.imul(we,Hn)|0,C=C+Math.imul(xe,$n)|0,D=D+Math.imul(xe,Hn)|0,I=I+Math.imul(Ee,sr)|0,C=C+Math.imul(Ee,Wn)|0,C=C+Math.imul(Pt,sr)|0,D=D+Math.imul(Pt,Wn)|0,I=I+Math.imul(rt,pr)|0,C=C+Math.imul(rt,Gn)|0,C=C+Math.imul(ut,pr)|0,D=D+Math.imul(ut,Gn)|0,I=I+Math.imul(nt,lt)|0,C=C+Math.imul(nt,Bt)|0,C=C+Math.imul(Ke,lt)|0,D=D+Math.imul(Ke,Bt)|0,I=I+Math.imul(ae,We)|0,C=C+Math.imul(ae,Qt)|0,C=C+Math.imul(ye,We)|0,D=D+Math.imul(ye,Qt)|0;var Qn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,I=Math.imul(ir,Yn),C=Math.imul(ir,kn),C=C+Math.imul(Ln,Yn)|0,D=Math.imul(Ln,kn),I=I+Math.imul(rn,fe)|0,C=C+Math.imul(rn,be)|0,C=C+Math.imul(un,fe)|0,D=D+Math.imul(un,be)|0,I=I+Math.imul(zt,ct)|0,C=C+Math.imul(zt,Ft)|0,C=C+Math.imul(Wt,ct)|0,D=D+Math.imul(Wt,Ft)|0,I=I+Math.imul(X,$n)|0,C=C+Math.imul(X,Hn)|0,C=C+Math.imul(ht,$n)|0,D=D+Math.imul(ht,Hn)|0,I=I+Math.imul(we,sr)|0,C=C+Math.imul(we,Wn)|0,C=C+Math.imul(xe,sr)|0,D=D+Math.imul(xe,Wn)|0,I=I+Math.imul(Ee,pr)|0,C=C+Math.imul(Ee,Gn)|0,C=C+Math.imul(Pt,pr)|0,D=D+Math.imul(Pt,Gn)|0,I=I+Math.imul(rt,lt)|0,C=C+Math.imul(rt,Bt)|0,C=C+Math.imul(ut,lt)|0,D=D+Math.imul(ut,Bt)|0,I=I+Math.imul(nt,We)|0,C=C+Math.imul(nt,Qt)|0,C=C+Math.imul(Ke,We)|0,D=D+Math.imul(Ke,Qt)|0,I=I+Math.imul(ae,tn)|0,C=C+Math.imul(ae,Re)|0,C=C+Math.imul(ye,tn)|0,D=D+Math.imul(ye,Re)|0;var Tn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,I=Math.imul(Zn,Yn),C=Math.imul(Zn,kn),C=C+Math.imul(Jn,Yn)|0,D=Math.imul(Jn,kn),I=I+Math.imul(ir,fe)|0,C=C+Math.imul(ir,be)|0,C=C+Math.imul(Ln,fe)|0,D=D+Math.imul(Ln,be)|0,I=I+Math.imul(rn,ct)|0,C=C+Math.imul(rn,Ft)|0,C=C+Math.imul(un,ct)|0,D=D+Math.imul(un,Ft)|0,I=I+Math.imul(zt,$n)|0,C=C+Math.imul(zt,Hn)|0,C=C+Math.imul(Wt,$n)|0,D=D+Math.imul(Wt,Hn)|0,I=I+Math.imul(X,sr)|0,C=C+Math.imul(X,Wn)|0,C=C+Math.imul(ht,sr)|0,D=D+Math.imul(ht,Wn)|0,I=I+Math.imul(we,pr)|0,C=C+Math.imul(we,Gn)|0,C=C+Math.imul(xe,pr)|0,D=D+Math.imul(xe,Gn)|0,I=I+Math.imul(Ee,lt)|0,C=C+Math.imul(Ee,Bt)|0,C=C+Math.imul(Pt,lt)|0,D=D+Math.imul(Pt,Bt)|0,I=I+Math.imul(rt,We)|0,C=C+Math.imul(rt,Qt)|0,C=C+Math.imul(ut,We)|0,D=D+Math.imul(ut,Qt)|0,I=I+Math.imul(nt,tn)|0,C=C+Math.imul(nt,Re)|0,C=C+Math.imul(Ke,tn)|0,D=D+Math.imul(Ke,Re)|0,I=I+Math.imul(ae,De)|0,C=C+Math.imul(ae,Je)|0,C=C+Math.imul(ye,De)|0,D=D+Math.imul(ye,Je)|0;var er=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(er>>>26)|0,er&=67108863,I=Math.imul(Zn,fe),C=Math.imul(Zn,be),C=C+Math.imul(Jn,fe)|0,D=Math.imul(Jn,be),I=I+Math.imul(ir,ct)|0,C=C+Math.imul(ir,Ft)|0,C=C+Math.imul(Ln,ct)|0,D=D+Math.imul(Ln,Ft)|0,I=I+Math.imul(rn,$n)|0,C=C+Math.imul(rn,Hn)|0,C=C+Math.imul(un,$n)|0,D=D+Math.imul(un,Hn)|0,I=I+Math.imul(zt,sr)|0,C=C+Math.imul(zt,Wn)|0,C=C+Math.imul(Wt,sr)|0,D=D+Math.imul(Wt,Wn)|0,I=I+Math.imul(X,pr)|0,C=C+Math.imul(X,Gn)|0,C=C+Math.imul(ht,pr)|0,D=D+Math.imul(ht,Gn)|0,I=I+Math.imul(we,lt)|0,C=C+Math.imul(we,Bt)|0,C=C+Math.imul(xe,lt)|0,D=D+Math.imul(xe,Bt)|0,I=I+Math.imul(Ee,We)|0,C=C+Math.imul(Ee,Qt)|0,C=C+Math.imul(Pt,We)|0,D=D+Math.imul(Pt,Qt)|0,I=I+Math.imul(rt,tn)|0,C=C+Math.imul(rt,Re)|0,C=C+Math.imul(ut,tn)|0,D=D+Math.imul(ut,Re)|0,I=I+Math.imul(nt,De)|0,C=C+Math.imul(nt,Je)|0,C=C+Math.imul(Ke,De)|0,D=D+Math.imul(Ke,Je)|0;var S=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(S>>>26)|0,S&=67108863,I=Math.imul(Zn,ct),C=Math.imul(Zn,Ft),C=C+Math.imul(Jn,ct)|0,D=Math.imul(Jn,Ft),I=I+Math.imul(ir,$n)|0,C=C+Math.imul(ir,Hn)|0,C=C+Math.imul(Ln,$n)|0,D=D+Math.imul(Ln,Hn)|0,I=I+Math.imul(rn,sr)|0,C=C+Math.imul(rn,Wn)|0,C=C+Math.imul(un,sr)|0,D=D+Math.imul(un,Wn)|0,I=I+Math.imul(zt,pr)|0,C=C+Math.imul(zt,Gn)|0,C=C+Math.imul(Wt,pr)|0,D=D+Math.imul(Wt,Gn)|0,I=I+Math.imul(X,lt)|0,C=C+Math.imul(X,Bt)|0,C=C+Math.imul(ht,lt)|0,D=D+Math.imul(ht,Bt)|0,I=I+Math.imul(we,We)|0,C=C+Math.imul(we,Qt)|0,C=C+Math.imul(xe,We)|0,D=D+Math.imul(xe,Qt)|0,I=I+Math.imul(Ee,tn)|0,C=C+Math.imul(Ee,Re)|0,C=C+Math.imul(Pt,tn)|0,D=D+Math.imul(Pt,Re)|0,I=I+Math.imul(rt,De)|0,C=C+Math.imul(rt,Je)|0,C=C+Math.imul(ut,De)|0,D=D+Math.imul(ut,Je)|0;var t=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(t>>>26)|0,t&=67108863,I=Math.imul(Zn,$n),C=Math.imul(Zn,Hn),C=C+Math.imul(Jn,$n)|0,D=Math.imul(Jn,Hn),I=I+Math.imul(ir,sr)|0,C=C+Math.imul(ir,Wn)|0,C=C+Math.imul(Ln,sr)|0,D=D+Math.imul(Ln,Wn)|0,I=I+Math.imul(rn,pr)|0,C=C+Math.imul(rn,Gn)|0,C=C+Math.imul(un,pr)|0,D=D+Math.imul(un,Gn)|0,I=I+Math.imul(zt,lt)|0,C=C+Math.imul(zt,Bt)|0,C=C+Math.imul(Wt,lt)|0,D=D+Math.imul(Wt,Bt)|0,I=I+Math.imul(X,We)|0,C=C+Math.imul(X,Qt)|0,C=C+Math.imul(ht,We)|0,D=D+Math.imul(ht,Qt)|0,I=I+Math.imul(we,tn)|0,C=C+Math.imul(we,Re)|0,C=C+Math.imul(xe,tn)|0,D=D+Math.imul(xe,Re)|0,I=I+Math.imul(Ee,De)|0,C=C+Math.imul(Ee,Je)|0,C=C+Math.imul(Pt,De)|0,D=D+Math.imul(Pt,Je)|0;var u=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(u>>>26)|0,u&=67108863,I=Math.imul(Zn,sr),C=Math.imul(Zn,Wn),C=C+Math.imul(Jn,sr)|0,D=Math.imul(Jn,Wn),I=I+Math.imul(ir,pr)|0,C=C+Math.imul(ir,Gn)|0,C=C+Math.imul(Ln,pr)|0,D=D+Math.imul(Ln,Gn)|0,I=I+Math.imul(rn,lt)|0,C=C+Math.imul(rn,Bt)|0,C=C+Math.imul(un,lt)|0,D=D+Math.imul(un,Bt)|0,I=I+Math.imul(zt,We)|0,C=C+Math.imul(zt,Qt)|0,C=C+Math.imul(Wt,We)|0,D=D+Math.imul(Wt,Qt)|0,I=I+Math.imul(X,tn)|0,C=C+Math.imul(X,Re)|0,C=C+Math.imul(ht,tn)|0,D=D+Math.imul(ht,Re)|0,I=I+Math.imul(we,De)|0,C=C+Math.imul(we,Je)|0,C=C+Math.imul(xe,De)|0,D=D+Math.imul(xe,Je)|0;var lr=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(lr>>>26)|0,lr&=67108863,I=Math.imul(Zn,pr),C=Math.imul(Zn,Gn),C=C+Math.imul(Jn,pr)|0,D=Math.imul(Jn,Gn),I=I+Math.imul(ir,lt)|0,C=C+Math.imul(ir,Bt)|0,C=C+Math.imul(Ln,lt)|0,D=D+Math.imul(Ln,Bt)|0,I=I+Math.imul(rn,We)|0,C=C+Math.imul(rn,Qt)|0,C=C+Math.imul(un,We)|0,D=D+Math.imul(un,Qt)|0,I=I+Math.imul(zt,tn)|0,C=C+Math.imul(zt,Re)|0,C=C+Math.imul(Wt,tn)|0,D=D+Math.imul(Wt,Re)|0,I=I+Math.imul(X,De)|0,C=C+Math.imul(X,Je)|0,C=C+Math.imul(ht,De)|0,D=D+Math.imul(ht,Je)|0;var mn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(mn>>>26)|0,mn&=67108863,I=Math.imul(Zn,lt),C=Math.imul(Zn,Bt),C=C+Math.imul(Jn,lt)|0,D=Math.imul(Jn,Bt),I=I+Math.imul(ir,We)|0,C=C+Math.imul(ir,Qt)|0,C=C+Math.imul(Ln,We)|0,D=D+Math.imul(Ln,Qt)|0,I=I+Math.imul(rn,tn)|0,C=C+Math.imul(rn,Re)|0,C=C+Math.imul(un,tn)|0,D=D+Math.imul(un,Re)|0,I=I+Math.imul(zt,De)|0,C=C+Math.imul(zt,Je)|0,C=C+Math.imul(Wt,De)|0,D=D+Math.imul(Wt,Je)|0;var Rn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,I=Math.imul(Zn,We),C=Math.imul(Zn,Qt),C=C+Math.imul(Jn,We)|0,D=Math.imul(Jn,Qt),I=I+Math.imul(ir,tn)|0,C=C+Math.imul(ir,Re)|0,C=C+Math.imul(Ln,tn)|0,D=D+Math.imul(Ln,Re)|0,I=I+Math.imul(rn,De)|0,C=C+Math.imul(rn,Je)|0,C=C+Math.imul(un,De)|0,D=D+Math.imul(un,Je)|0;var On=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(On>>>26)|0,On&=67108863,I=Math.imul(Zn,tn),C=Math.imul(Zn,Re),C=C+Math.imul(Jn,tn)|0,D=Math.imul(Jn,Re),I=I+Math.imul(ir,De)|0,C=C+Math.imul(ir,Je)|0,C=C+Math.imul(Ln,De)|0,D=D+Math.imul(Ln,Je)|0;var tr=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(tr>>>26)|0,tr&=67108863,I=Math.imul(Zn,De),C=Math.imul(Zn,Je),C=C+Math.imul(Jn,De)|0,D=Math.imul(Jn,Je);var Xn=(G+I|0)+((C&8191)<<13)|0;return G=(D+(C>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,ie[0]=je,ie[1]=st,ie[2]=Et,ie[3]=Mt,ie[4]=Vt,ie[5]=nn,ie[6]=wn,ie[7]=Qn,ie[8]=Tn,ie[9]=er,ie[10]=S,ie[11]=t,ie[12]=u,ie[13]=lr,ie[14]=mn,ie[15]=Rn,ie[16]=On,ie[17]=tr,ie[18]=Xn,G!==0&&(ie[19]=G,b.length++),b};Math.imul||(E=U);function Q(m,h,_){_.negative=h.negative^m.negative,_.length=m.length+h.length;for(var b=0,O=0,J=0;J<_.length-1;J++){var ie=O;O=0;for(var G=b&67108863,I=Math.min(J,h.length-1),C=Math.max(0,J-m.length+1);C<=I;C++){var D=J-C,W=m.words[D]|0,ae=h.words[C]|0,ye=W*ae,Xe=ye&67108863;ie=ie+(ye/67108864|0)|0,Xe=Xe+G|0,G=Xe&67108863,ie=ie+(Xe>>>26)|0,O+=ie>>>26,ie&=67108863}_.words[J]=G,b=ie,ie=O}return b!==0?_.words[J]=b:_.length--,_._strip()}function H(m,h,_){return Q(m,h,_)}l.prototype.mulTo=function(h,_){var b,O=this.length+h.length;return this.length===10&&h.length===10?b=E(this,h,_):O<63?b=U(this,h,_):O<1024?b=Q(this,h,_):b=H(this,h,_),b},l.prototype.mul=function(h){var _=new l(null);return _.words=new Array(this.length+h.length),this.mulTo(h,_)},l.prototype.mulf=function(h){var _=new l(null);return _.words=new Array(this.length+h.length),H(this,h,_)},l.prototype.imul=function(h){return this.clone().mulTo(h,this)},l.prototype.imuln=function(h){var _=h<0;_&&(h=-h),c(typeof h=="number"),c(h<67108864);for(var b=0,O=0;O<this.length;O++){var J=(this.words[O]|0)*h,ie=(J&67108863)+(b&67108863);b>>=26,b+=J/67108864|0,b+=ie>>>26,this.words[O]=ie&67108863}return b!==0&&(this.words[O]=b,this.length++),_?this.ineg():this},l.prototype.muln=function(h){return this.clone().imuln(h)},l.prototype.sqr=function(){return this.mul(this)},l.prototype.isqr=function(){return this.imul(this.clone())},l.prototype.pow=function(h){var _=M(h);if(_.length===0)return new l(1);for(var b=this,O=0;O<_.length&&_[O]===0;O++,b=b.sqr());if(++O<_.length)for(var J=b.sqr();O<_.length;O++,J=J.sqr())_[O]!==0&&(b=b.mul(J));return b},l.prototype.iushln=function(h){c(typeof h=="number"&&h>=0);var _=h%26,b=(h-_)/26,O=67108863>>>26-_<<26-_,J;if(_!==0){var ie=0;for(J=0;J<this.length;J++){var G=this.words[J]&O,I=(this.words[J]|0)-G<<_;this.words[J]=I|ie,ie=G>>>26-_}ie&&(this.words[J]=ie,this.length++)}if(b!==0){for(J=this.length-1;J>=0;J--)this.words[J+b]=this.words[J];for(J=0;J<b;J++)this.words[J]=0;this.length+=b}return this._strip()},l.prototype.ishln=function(h){return c(this.negative===0),this.iushln(h)},l.prototype.iushrn=function(h,_,b){c(typeof h=="number"&&h>=0);var O;_?O=(_-_%26)/26:O=0;var J=h%26,ie=Math.min((h-J)/26,this.length),G=67108863^67108863>>>J<<J,I=b;if(O-=ie,O=Math.max(0,O),I){for(var C=0;C<ie;C++)I.words[C]=this.words[C];I.length=ie}if(ie!==0)if(this.length>ie)for(this.length-=ie,C=0;C<this.length;C++)this.words[C]=this.words[C+ie];else this.words[0]=0,this.length=1;var D=0;for(C=this.length-1;C>=0&&(D!==0||C>=O);C--){var W=this.words[C]|0;this.words[C]=D<<26-J|W>>>J,D=W&G}return I&&D!==0&&(I.words[I.length++]=D),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},l.prototype.ishrn=function(h,_,b){return c(this.negative===0),this.iushrn(h,_,b)},l.prototype.shln=function(h){return this.clone().ishln(h)},l.prototype.ushln=function(h){return this.clone().iushln(h)},l.prototype.shrn=function(h){return this.clone().ishrn(h)},l.prototype.ushrn=function(h){return this.clone().iushrn(h)},l.prototype.testn=function(h){c(typeof h=="number"&&h>=0);var _=h%26,b=(h-_)/26,O=1<<_;if(this.length<=b)return!1;var J=this.words[b];return!!(J&O)},l.prototype.imaskn=function(h){c(typeof h=="number"&&h>=0);var _=h%26,b=(h-_)/26;if(c(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(_!==0&&b++,this.length=Math.min(b,this.length),_!==0){var O=67108863^67108863>>>_<<_;this.words[this.length-1]&=O}return this._strip()},l.prototype.maskn=function(h){return this.clone().imaskn(h)},l.prototype.iaddn=function(h){return c(typeof h=="number"),c(h<67108864),h<0?this.isubn(-h):this.negative!==0?this.length===1&&(this.words[0]|0)<=h?(this.words[0]=h-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(h),this.negative=1,this):this._iaddn(h)},l.prototype._iaddn=function(h){this.words[0]+=h;for(var _=0;_<this.length&&this.words[_]>=67108864;_++)this.words[_]-=67108864,_===this.length-1?this.words[_+1]=1:this.words[_+1]++;return this.length=Math.max(this.length,_+1),this},l.prototype.isubn=function(h){if(c(typeof h=="number"),c(h<67108864),h<0)return this.iaddn(-h);if(this.negative!==0)return this.negative=0,this.iaddn(h),this.negative=1,this;if(this.words[0]-=h,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var _=0;_<this.length&&this.words[_]<0;_++)this.words[_]+=67108864,this.words[_+1]-=1;return this._strip()},l.prototype.addn=function(h){return this.clone().iaddn(h)},l.prototype.subn=function(h){return this.clone().isubn(h)},l.prototype.iabs=function(){return this.negative=0,this},l.prototype.abs=function(){return this.clone().iabs()},l.prototype._ishlnsubmul=function(h,_,b){var O=h.length+b,J;this._expand(O);var ie,G=0;for(J=0;J<h.length;J++){ie=(this.words[J+b]|0)+G;var I=(h.words[J]|0)*_;ie-=I&67108863,G=(ie>>26)-(I/67108864|0),this.words[J+b]=ie&67108863}for(;J<this.length-b;J++)ie=(this.words[J+b]|0)+G,G=ie>>26,this.words[J+b]=ie&67108863;if(G===0)return this._strip();for(c(G===-1),G=0,J=0;J<this.length;J++)ie=-(this.words[J]|0)+G,G=ie>>26,this.words[J]=ie&67108863;return this.negative=1,this._strip()},l.prototype._wordDiv=function(h,_){var b=this.length-h.length,O=this.clone(),J=h,ie=J.words[J.length-1]|0,G=this._countBits(ie);b=26-G,b!==0&&(J=J.ushln(b),O.iushln(b),ie=J.words[J.length-1]|0);var I=O.length-J.length,C;if(_!=="mod"){C=new l(null),C.length=I+1,C.words=new Array(C.length);for(var D=0;D<C.length;D++)C.words[D]=0}var W=O.clone()._ishlnsubmul(J,1,I);W.negative===0&&(O=W,C&&(C.words[I]=1));for(var ae=I-1;ae>=0;ae--){var ye=(O.words[J.length+ae]|0)*67108864+(O.words[J.length+ae-1]|0);for(ye=Math.min(ye/ie|0,67108863),O._ishlnsubmul(J,ye,ae);O.negative!==0;)ye--,O.negative=0,O._ishlnsubmul(J,1,ae),O.isZero()||(O.negative^=1);C&&(C.words[ae]=ye)}return C&&C._strip(),O._strip(),_!=="div"&&b!==0&&O.iushrn(b),{div:C||null,mod:O}},l.prototype.divmod=function(h,_,b){if(c(!h.isZero()),this.isZero())return{div:new l(0),mod:new l(0)};var O,J,ie;return this.negative!==0&&h.negative===0?(ie=this.neg().divmod(h,_),_!=="mod"&&(O=ie.div.neg()),_!=="div"&&(J=ie.mod.neg(),b&&J.negative!==0&&J.iadd(h)),{div:O,mod:J}):this.negative===0&&h.negative!==0?(ie=this.divmod(h.neg(),_),_!=="mod"&&(O=ie.div.neg()),{div:O,mod:ie.mod}):this.negative&h.negative?(ie=this.neg().divmod(h.neg(),_),_!=="div"&&(J=ie.mod.neg(),b&&J.negative!==0&&J.isub(h)),{div:ie.div,mod:J}):h.length>this.length||this.cmp(h)<0?{div:new l(0),mod:this}:h.length===1?_==="div"?{div:this.divn(h.words[0]),mod:null}:_==="mod"?{div:null,mod:new l(this.modrn(h.words[0]))}:{div:this.divn(h.words[0]),mod:new l(this.modrn(h.words[0]))}:this._wordDiv(h,_)},l.prototype.div=function(h){return this.divmod(h,"div",!1).div},l.prototype.mod=function(h){return this.divmod(h,"mod",!1).mod},l.prototype.umod=function(h){return this.divmod(h,"mod",!0).mod},l.prototype.divRound=function(h){var _=this.divmod(h);if(_.mod.isZero())return _.div;var b=_.div.negative!==0?_.mod.isub(h):_.mod,O=h.ushrn(1),J=h.andln(1),ie=b.cmp(O);return ie<0||J===1&&ie===0?_.div:_.div.negative!==0?_.div.isubn(1):_.div.iaddn(1)},l.prototype.modrn=function(h){var _=h<0;_&&(h=-h),c(h<=67108863);for(var b=(1<<26)%h,O=0,J=this.length-1;J>=0;J--)O=(b*O+(this.words[J]|0))%h;return _?-O:O},l.prototype.modn=function(h){return this.modrn(h)},l.prototype.idivn=function(h){var _=h<0;_&&(h=-h),c(h<=67108863);for(var b=0,O=this.length-1;O>=0;O--){var J=(this.words[O]|0)+b*67108864;this.words[O]=J/h|0,b=J%h}return this._strip(),_?this.ineg():this},l.prototype.divn=function(h){return this.clone().idivn(h)},l.prototype.egcd=function(h){c(h.negative===0),c(!h.isZero());var _=this,b=h.clone();_.negative!==0?_=_.umod(h):_=_.clone();for(var O=new l(1),J=new l(0),ie=new l(0),G=new l(1),I=0;_.isEven()&&b.isEven();)_.iushrn(1),b.iushrn(1),++I;for(var C=b.clone(),D=_.clone();!_.isZero();){for(var W=0,ae=1;!(_.words[0]&ae)&&W<26;++W,ae<<=1);if(W>0)for(_.iushrn(W);W-- >0;)(O.isOdd()||J.isOdd())&&(O.iadd(C),J.isub(D)),O.iushrn(1),J.iushrn(1);for(var ye=0,Xe=1;!(b.words[0]&Xe)&&ye<26;++ye,Xe<<=1);if(ye>0)for(b.iushrn(ye);ye-- >0;)(ie.isOdd()||G.isOdd())&&(ie.iadd(C),G.isub(D)),ie.iushrn(1),G.iushrn(1);_.cmp(b)>=0?(_.isub(b),O.isub(ie),J.isub(G)):(b.isub(_),ie.isub(O),G.isub(J))}return{a:ie,b:G,gcd:b.iushln(I)}},l.prototype._invmp=function(h){c(h.negative===0),c(!h.isZero());var _=this,b=h.clone();_.negative!==0?_=_.umod(h):_=_.clone();for(var O=new l(1),J=new l(0),ie=b.clone();_.cmpn(1)>0&&b.cmpn(1)>0;){for(var G=0,I=1;!(_.words[0]&I)&&G<26;++G,I<<=1);if(G>0)for(_.iushrn(G);G-- >0;)O.isOdd()&&O.iadd(ie),O.iushrn(1);for(var C=0,D=1;!(b.words[0]&D)&&C<26;++C,D<<=1);if(C>0)for(b.iushrn(C);C-- >0;)J.isOdd()&&J.iadd(ie),J.iushrn(1);_.cmp(b)>=0?(_.isub(b),O.isub(J)):(b.isub(_),J.isub(O))}var W;return _.cmpn(1)===0?W=O:W=J,W.cmpn(0)<0&&W.iadd(h),W},l.prototype.gcd=function(h){if(this.isZero())return h.abs();if(h.isZero())return this.abs();var _=this.clone(),b=h.clone();_.negative=0,b.negative=0;for(var O=0;_.isEven()&&b.isEven();O++)_.iushrn(1),b.iushrn(1);do{for(;_.isEven();)_.iushrn(1);for(;b.isEven();)b.iushrn(1);var J=_.cmp(b);if(J<0){var ie=_;_=b,b=ie}else if(J===0||b.cmpn(1)===0)break;_.isub(b)}while(!0);return b.iushln(O)},l.prototype.invm=function(h){return this.egcd(h).a.umod(h)},l.prototype.isEven=function(){return(this.words[0]&1)===0},l.prototype.isOdd=function(){return(this.words[0]&1)===1},l.prototype.andln=function(h){return this.words[0]&h},l.prototype.bincn=function(h){c(typeof h=="number");var _=h%26,b=(h-_)/26,O=1<<_;if(this.length<=b)return this._expand(b+1),this.words[b]|=O,this;for(var J=O,ie=b;J!==0&&ie<this.length;ie++){var G=this.words[ie]|0;G+=J,J=G>>>26,G&=67108863,this.words[ie]=G}return J!==0&&(this.words[ie]=J,this.length++),this},l.prototype.isZero=function(){return this.length===1&&this.words[0]===0},l.prototype.cmpn=function(h){var _=h<0;if(this.negative!==0&&!_)return-1;if(this.negative===0&&_)return 1;this._strip();var b;if(this.length>1)b=1;else{_&&(h=-h),c(h<=67108863,"Number is too big");var O=this.words[0]|0;b=O===h?0:O<h?-1:1}return this.negative!==0?-b|0:b},l.prototype.cmp=function(h){if(this.negative!==0&&h.negative===0)return-1;if(this.negative===0&&h.negative!==0)return 1;var _=this.ucmp(h);return this.negative!==0?-_|0:_},l.prototype.ucmp=function(h){if(this.length>h.length)return 1;if(this.length<h.length)return-1;for(var _=0,b=this.length-1;b>=0;b--){var O=this.words[b]|0,J=h.words[b]|0;if(O!==J){O<J?_=-1:O>J&&(_=1);break}}return _},l.prototype.gtn=function(h){return this.cmpn(h)===1},l.prototype.gt=function(h){return this.cmp(h)===1},l.prototype.gten=function(h){return this.cmpn(h)>=0},l.prototype.gte=function(h){return this.cmp(h)>=0},l.prototype.ltn=function(h){return this.cmpn(h)===-1},l.prototype.lt=function(h){return this.cmp(h)===-1},l.prototype.lten=function(h){return this.cmpn(h)<=0},l.prototype.lte=function(h){return this.cmp(h)<=0},l.prototype.eqn=function(h){return this.cmpn(h)===0},l.prototype.eq=function(h){return this.cmp(h)===0},l.red=function(h){return new V(h)},l.prototype.toRed=function(h){return c(!this.red,"Already a number in reduction context"),c(this.negative===0,"red works only with positives"),h.convertTo(this)._forceRed(h)},l.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},l.prototype._forceRed=function(h){return this.red=h,this},l.prototype.forceRed=function(h){return c(!this.red,"Already a number in reduction context"),this._forceRed(h)},l.prototype.redAdd=function(h){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,h)},l.prototype.redIAdd=function(h){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,h)},l.prototype.redSub=function(h){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,h)},l.prototype.redISub=function(h){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,h)},l.prototype.redShl=function(h){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,h)},l.prototype.redMul=function(h){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.mul(this,h)},l.prototype.redIMul=function(h){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.imul(this,h)},l.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},l.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},l.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},l.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},l.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},l.prototype.redPow=function(h){return c(this.red&&!h.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,h)};var re={k256:null,p224:null,p192:null,p25519:null};function ee(m,h){this.name=m,this.p=new l(h,16),this.n=this.p.bitLength(),this.k=new l(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ee.prototype._tmp=function(){var h=new l(null);return h.words=new Array(Math.ceil(this.n/13)),h},ee.prototype.ireduce=function(h){var _=h,b;do this.split(_,this.tmp),_=this.imulK(_),_=_.iadd(this.tmp),b=_.bitLength();while(b>this.n);var O=b<this.n?-1:_.ucmp(this.p);return O===0?(_.words[0]=0,_.length=1):O>0?_.isub(this.p):_.strip!==void 0?_.strip():_._strip(),_},ee.prototype.split=function(h,_){h.iushrn(this.n,0,_)},ee.prototype.imulK=function(h){return h.imul(this.k)};function T(){ee.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}f(T,ee),T.prototype.split=function(h,_){for(var b=4194303,O=Math.min(h.length,9),J=0;J<O;J++)_.words[J]=h.words[J];if(_.length=O,h.length<=9){h.words[0]=0,h.length=1;return}var ie=h.words[9];for(_.words[_.length++]=ie&b,J=10;J<h.length;J++){var G=h.words[J]|0;h.words[J-10]=(G&b)<<4|ie>>>22,ie=G}ie>>>=22,h.words[J-10]=ie,ie===0&&h.length>10?h.length-=10:h.length-=9},T.prototype.imulK=function(h){h.words[h.length]=0,h.words[h.length+1]=0,h.length+=2;for(var _=0,b=0;b<h.length;b++){var O=h.words[b]|0;_+=O*977,h.words[b]=_&67108863,_=O*64+(_/67108864|0)}return h.words[h.length-1]===0&&(h.length--,h.words[h.length-1]===0&&h.length--),h};function se(){ee.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}f(se,ee);function p(){ee.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}f(p,ee);function L(){ee.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}f(L,ee),L.prototype.imulK=function(h){for(var _=0,b=0;b<h.length;b++){var O=(h.words[b]|0)*19+_,J=O&67108863;O>>>=26,h.words[b]=J,_=O}return _!==0&&(h.words[h.length++]=_),h},l._prime=function(h){if(re[h])return re[h];var _;if(h==="k256")_=new T;else if(h==="p224")_=new se;else if(h==="p192")_=new p;else if(h==="p25519")_=new L;else throw new Error("Unknown prime "+h);return re[h]=_,_};function V(m){if(typeof m=="string"){var h=l._prime(m);this.m=h.p,this.prime=h}else c(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}V.prototype._verify1=function(h){c(h.negative===0,"red works only with positives"),c(h.red,"red works only with red numbers")},V.prototype._verify2=function(h,_){c((h.negative|_.negative)===0,"red works only with positives"),c(h.red&&h.red===_.red,"red works only with red numbers")},V.prototype.imod=function(h){return this.prime?this.prime.ireduce(h)._forceRed(this):(j(h,h.umod(this.m)._forceRed(this)),h)},V.prototype.neg=function(h){return h.isZero()?h.clone():this.m.sub(h)._forceRed(this)},V.prototype.add=function(h,_){this._verify2(h,_);var b=h.add(_);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},V.prototype.iadd=function(h,_){this._verify2(h,_);var b=h.iadd(_);return b.cmp(this.m)>=0&&b.isub(this.m),b},V.prototype.sub=function(h,_){this._verify2(h,_);var b=h.sub(_);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},V.prototype.isub=function(h,_){this._verify2(h,_);var b=h.isub(_);return b.cmpn(0)<0&&b.iadd(this.m),b},V.prototype.shl=function(h,_){return this._verify1(h),this.imod(h.ushln(_))},V.prototype.imul=function(h,_){return this._verify2(h,_),this.imod(h.imul(_))},V.prototype.mul=function(h,_){return this._verify2(h,_),this.imod(h.mul(_))},V.prototype.isqr=function(h){return this.imul(h,h.clone())},V.prototype.sqr=function(h){return this.mul(h,h)},V.prototype.sqrt=function(h){if(h.isZero())return h.clone();var _=this.m.andln(3);if(c(_%2===1),_===3){var b=this.m.add(new l(1)).iushrn(2);return this.pow(h,b)}for(var O=this.m.subn(1),J=0;!O.isZero()&&O.andln(1)===0;)J++,O.iushrn(1);c(!O.isZero());var ie=new l(1).toRed(this),G=ie.redNeg(),I=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new l(2*C*C).toRed(this);this.pow(C,I).cmp(G)!==0;)C.redIAdd(G);for(var D=this.pow(C,O),W=this.pow(h,O.addn(1).iushrn(1)),ae=this.pow(h,O),ye=J;ae.cmp(ie)!==0;){for(var Xe=ae,nt=0;Xe.cmp(ie)!==0;nt++)Xe=Xe.redSqr();c(nt<ye);var Ke=this.pow(D,new l(1).iushln(ye-nt-1));W=W.redMul(Ke),D=Ke.redSqr(),ae=ae.redMul(D),ye=nt}return W},V.prototype.invm=function(h){var _=h._invmp(this.m);return _.negative!==0?(_.negative=0,this.imod(_).redNeg()):this.imod(_)},V.prototype.pow=function(h,_){if(_.isZero())return new l(1).toRed(this);if(_.cmpn(1)===0)return h.clone();var b=4,O=new Array(1<<b);O[0]=new l(1).toRed(this),O[1]=h;for(var J=2;J<O.length;J++)O[J]=this.mul(O[J-1],h);var ie=O[0],G=0,I=0,C=_.bitLength()%26;for(C===0&&(C=26),J=_.length-1;J>=0;J--){for(var D=_.words[J],W=C-1;W>=0;W--){var ae=D>>W&1;if(ie!==O[0]&&(ie=this.sqr(ie)),ae===0&&G===0){I=0;continue}G<<=1,G|=ae,I++,!(I!==b&&(J!==0||W!==0))&&(ie=this.mul(ie,O[G]),I=0,G=0)}C=26}return ie},V.prototype.convertTo=function(h){var _=h.umod(this.m);return _===h?_.clone():_},V.prototype.convertFrom=function(h){var _=h.clone();return _.red=null,_},l.mont=function(h){return new K(h)};function K(m){V.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new l(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}f(K,V),K.prototype.convertTo=function(h){return this.imod(h.ushln(this.shift))},K.prototype.convertFrom=function(h){var _=this.imod(h.mul(this.rinv));return _.red=null,_},K.prototype.imul=function(h,_){if(h.isZero()||_.isZero())return h.words[0]=0,h.length=1,h;var b=h.imul(_),O=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),J=b.isub(O).iushrn(this.shift),ie=J;return J.cmp(this.m)>=0?ie=J.isub(this.m):J.cmpn(0)<0&&(ie=J.iadd(this.m)),ie._forceRed(this)},K.prototype.mul=function(h,_){if(h.isZero()||_.isZero())return new l(0)._forceRed(this);var b=h.mul(_),O=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),J=b.isub(O).iushrn(this.shift),ie=J;return J.cmp(this.m)>=0?ie=J.isub(this.m):J.cmpn(0)<0&&(ie=J.iadd(this.m)),ie._forceRed(this)},K.prototype.invm=function(h){var _=this.imod(h._invmp(this.m).mul(this.r2));return _._forceRed(this)}})(e,Mti)})(a3n);var G9s=a3n.exports,q9s=Tti(G9s),K9s="logger/5.7.0",Iti=!1,Cti=!1,T6t={debug:1,default:2,info:2,warning:3,error:4,off:5},_ti=T6t.default,OCn=null;function Y9s(){try{let e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(i=>{try{if("test".normalize(i)!=="test")throw new Error("bad normalize")}catch(A){e.push(i)}}),e.length)throw new Error("missing "+e.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(e){return e.message}return null}var Eti=Y9s(),UCn;(function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"})(UCn||(UCn={}));var $F;(function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"})($F||($F={}));var Bti="0123456789abcdef",dd=class e{constructor(i){Object.defineProperty(this,"version",{enumerable:!0,value:i,writable:!1})}_log(i,A){let c=i.toLowerCase();T6t[c]==null&&this.throwArgumentError("invalid log level name","logLevel",i),!(_ti>T6t[c])&&console.log.apply(console,A)}debug(...i){this._log(e.levels.DEBUG,i)}info(...i){this._log(e.levels.INFO,i)}warn(...i){this._log(e.levels.WARNING,i)}makeError(i,A,c){if(Cti)return this.makeError("censored error",A,{});A||(A=e.errors.UNKNOWN_ERROR),c||(c={});let f=[];Object.keys(c).forEach(N=>{let F=c[N];try{if(F instanceof Uint8Array){let j="";for(let te=0;te<F.length;te++)j+=Bti[F[te]>>4],j+=Bti[F[te]&15];f.push(N+"=Uint8Array(0x"+j+")")}else f.push(N+"="+JSON.stringify(F))}catch(j){f.push(N+"="+JSON.stringify(c[N].toString()))}}),f.push(`code=${A}`),f.push(`version=${this.version}`);let l=i,g="";switch(A){case $F.NUMERIC_FAULT:{g="NUMERIC_FAULT";let N=i;switch(N){case"overflow":case"underflow":case"division-by-zero":g+="-"+N;break;case"negative-power":case"negative-width":g+="-unsupported";break;case"unbound-bitwise-result":g+="-unbound-result";break}break}case $F.CALL_EXCEPTION:case $F.INSUFFICIENT_FUNDS:case $F.MISSING_NEW:case $F.NONCE_EXPIRED:case $F.REPLACEMENT_UNDERPRICED:case $F.TRANSACTION_REPLACED:case $F.UNPREDICTABLE_GAS_LIMIT:g=A;break}g&&(i+=" [ See: https://links.ethers.org/v5-errors-"+g+" ]"),f.length&&(i+=" ("+f.join(", ")+")");let w=new Error(i);return w.reason=l,w.code=A,Object.keys(c).forEach(function(N){w[N]=c[N]}),w}throwError(i,A,c){throw this.makeError(i,A,c)}throwArgumentError(i,A,c){return this.throwError(i,e.errors.INVALID_ARGUMENT,{argument:A,value:c})}assert(i,A,c,f){i||this.throwError(A,c,f)}assertArgument(i,A,c,f){i||this.throwArgumentError(A,c,f)}checkNormalize(i){Eti&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Eti})}checkSafeUint53(i,A){typeof i=="number"&&(A==null&&(A="value not safe"),(i<0||i>=9007199254740991)&&this.throwError(A,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:i}),i%1&&this.throwError(A,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:i}))}checkArgumentCount(i,A,c){c?c=": "+c:c="",i<A&&this.throwError("missing argument"+c,e.errors.MISSING_ARGUMENT,{count:i,expectedCount:A}),i>A&&this.throwError("too many arguments"+c,e.errors.UNEXPECTED_ARGUMENT,{count:i,expectedCount:A})}checkNew(i,A){(i===Object||i==null)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:A.name})}checkAbstract(i,A){i===A?this.throwError("cannot instantiate abstract class "+JSON.stringify(A.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:i.name,operation:"new"}):(i===Object||i==null)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:A.name})}static globalLogger(){return OCn||(OCn=new e(K9s)),OCn}static setCensorship(i,A){if(!i&&A&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Iti){if(!i)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Cti=!!i,Iti=!!A}static setLogLevel(i){let A=T6t[i.toLowerCase()];if(A==null){e.globalLogger().warn("invalid log level - "+i);return}_ti=A}static from(i){return new e(i)}};dd.errors=$F;dd.levels=UCn;var V9s="bytes/5.7.0",yW=new dd(V9s);function Uti(e){return!!e.toHexString}function _qe(e){return e.slice||(e.slice=function(){let i=Array.prototype.slice.call(arguments);return _qe(new Uint8Array(Array.prototype.slice.apply(e,i)))}),e}function z9s(e){return kD(e)&&!(e.length%2)||Z6t(e)}function vti(e){return typeof e=="number"&&e==e&&e%1===0}function Z6t(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!vti(e.length)||e.length<0)return!1;for(let i=0;i<e.length;i++){let A=e[i];if(!vti(A)||A<0||A>=256)return!1}return!0}function T3(e,i){if(i||(i={}),typeof e=="number"){yW.checkSafeUint53(e,"invalid arrayify value");let A=[];for(;e;)A.unshift(e&255),e=parseInt(String(e/256));return A.length===0&&A.push(0),_qe(new Uint8Array(A))}if(i.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),Uti(e)&&(e=e.toHexString()),kD(e)){let A=e.substring(2);A.length%2&&(i.hexPad==="left"?A="0"+A:i.hexPad==="right"?A+="0":yW.throwArgumentError("hex data is odd-length","value",e));let c=[];for(let f=0;f<A.length;f+=2)c.push(parseInt(A.substring(f,f+2),16));return _qe(new Uint8Array(c))}return Z6t(e)?_qe(new Uint8Array(e)):yW.throwArgumentError("invalid arrayify value","value",e)}function iwe(e){let i=e.map(f=>T3(f)),A=i.reduce((f,l)=>f+l.length,0),c=new Uint8Array(A);return i.reduce((f,l)=>(c.set(l,f),f+l.length),0),_qe(c)}function W9s(e){let i=T3(e);if(i.length===0)return i;let A=0;for(;A<i.length&&i[A]===0;)A++;return A&&(i=i.slice(A)),i}function kD(e,i){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||i&&e.length!==2+2*i)}var NCn="0123456789abcdef";function Lm(e,i){if(i||(i={}),typeof e=="number"){yW.checkSafeUint53(e,"invalid hexlify value");let A="";for(;e;)A=NCn[e&15]+A,e=Math.floor(e/16);return A.length?(A.length%2&&(A="0"+A),"0x"+A):"0x00"}if(typeof e=="bigint")return e=e.toString(16),e.length%2?"0x0"+e:"0x"+e;if(i.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),Uti(e))return e.toHexString();if(kD(e))return e.length%2&&(i.hexPad==="left"?e="0x0"+e.substring(2):i.hexPad==="right"?e+="0":yW.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Z6t(e)){let A="0x";for(let c=0;c<e.length;c++){let f=e[c];A+=NCn[(f&240)>>4]+NCn[f&15]}return A}return yW.throwArgumentError("invalid hexlify value","value",e)}function Z9s(e){if(typeof e!="string")e=Lm(e);else if(!kD(e)||e.length%2)return null;return(e.length-2)/2}function Fti(e,i,A){return typeof e!="string"?e=Lm(e):(!kD(e)||e.length%2)&&yW.throwArgumentError("invalid hexData","value",e),i=2+2*i,A!=null?"0x"+e.substring(i,2+2*A):"0x"+e.substring(i)}function X9s(e){let i="0x";return e.forEach(A=>{i+=Lm(A).substring(2)}),i}function Jti(e,i){for(typeof e!="string"?e=Lm(e):kD(e)||yW.throwArgumentError("invalid hex string","value",e),e.length>2*i+2&&yW.throwArgumentError("value out of range","value",arguments[1]);e.length<2*i+2;)e="0x0"+e.substring(2);return e}var $9s="bignumber/5.7.0",J6t=q9s.BN,pW=new dd($9s),xCn={},bti=9007199254740991,Sti=!1,Vg=class e{constructor(i,A){i!==xCn&&pW.throwError("cannot call constructor directly; use BigNumber.from",dd.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=A,this._isBigNumber=!0,Object.freeze(this)}fromTwos(i){return wD(n2(this).fromTwos(i))}toTwos(i){return wD(n2(this).toTwos(i))}abs(){return this._hex[0]==="-"?e.from(this._hex.substring(1)):this}add(i){return wD(n2(this).add(n2(i)))}sub(i){return wD(n2(this).sub(n2(i)))}div(i){return e.from(i).isZero()&&XM("division-by-zero","div"),wD(n2(this).div(n2(i)))}mul(i){return wD(n2(this).mul(n2(i)))}mod(i){let A=n2(i);return A.isNeg()&&XM("division-by-zero","mod"),wD(n2(this).umod(A))}pow(i){let A=n2(i);return A.isNeg()&&XM("negative-power","pow"),wD(n2(this).pow(A))}and(i){let A=n2(i);return(this.isNegative()||A.isNeg())&&XM("unbound-bitwise-result","and"),wD(n2(this).and(A))}or(i){let A=n2(i);return(this.isNegative()||A.isNeg())&&XM("unbound-bitwise-result","or"),wD(n2(this).or(A))}xor(i){let A=n2(i);return(this.isNegative()||A.isNeg())&&XM("unbound-bitwise-result","xor"),wD(n2(this).xor(A))}mask(i){return(this.isNegative()||i<0)&&XM("negative-width","mask"),wD(n2(this).maskn(i))}shl(i){return(this.isNegative()||i<0)&&XM("negative-width","shl"),wD(n2(this).shln(i))}shr(i){return(this.isNegative()||i<0)&&XM("negative-width","shr"),wD(n2(this).shrn(i))}eq(i){return n2(this).eq(n2(i))}lt(i){return n2(this).lt(n2(i))}lte(i){return n2(this).lte(n2(i))}gt(i){return n2(this).gt(n2(i))}gte(i){return n2(this).gte(n2(i))}isNegative(){return this._hex[0]==="-"}isZero(){return n2(this).isZero()}toNumber(){try{return n2(this).toNumber()}catch(i){XM("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(i){}return pW.throwError("this platform does not support BigInt",dd.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Sti||(Sti=!0,pW.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?pW.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",dd.errors.UNEXPECTED_ARGUMENT,{}):pW.throwError("BigNumber.toString does not accept parameters",dd.errors.UNEXPECTED_ARGUMENT,{})),n2(this).toString(10)}toHexString(){return this._hex}toJSON(i){return{type:"BigNumber",hex:this.toHexString()}}static from(i){if(i instanceof e)return i;if(typeof i=="string")return i.match(/^-?0x[0-9a-f]+$/i)?new e(xCn,Eqe(i)):i.match(/^-?[0-9]+$/)?new e(xCn,Eqe(new J6t(i))):pW.throwArgumentError("invalid BigNumber string","value",i);if(typeof i=="number")return i%1&&XM("underflow","BigNumber.from",i),(i>=bti||i<=-bti)&&XM("overflow","BigNumber.from",i),e.from(String(i));let A=i;if(typeof A=="bigint")return e.from(A.toString());if(Z6t(A))return e.from(Lm(A));if(A)if(A.toHexString){let c=A.toHexString();if(typeof c=="string")return e.from(c)}else{let c=A._hex;if(c==null&&A.type==="BigNumber"&&(c=A.hex),typeof c=="string"&&(kD(c)||c[0]==="-"&&kD(c.substring(1))))return e.from(c)}return pW.throwArgumentError("invalid BigNumber value","value",i)}static isBigNumber(i){return!!(i&&i._isBigNumber)}};function Eqe(e){if(typeof e!="string")return Eqe(e.toString(16));if(e[0]==="-")return e=e.substring(1),e[0]==="-"&&pW.throwArgumentError("invalid hex","value",e),e=Eqe(e),e==="0x00"?e:"-"+e;if(e.substring(0,2)!=="0x"&&(e="0x"+e),e==="0x")return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&e.substring(0,4)==="0x00";)e="0x"+e.substring(4);return e}function wD(e){return Vg.from(Eqe(e))}function n2(e){let i=Vg.from(e).toHexString();return i[0]==="-"?new J6t("-"+i.substring(3),16):new J6t(i.substring(2),16)}function XM(e,i,A){let c={fault:e,operation:i};return A!=null&&(c.value=A),pW.throwError(e,dd.errors.NUMERIC_FAULT,c)}function j9s(e){return new J6t(e,36).toString(16)}var ePs="properties/5.7.0",tPs=function(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})},Hti=new dd(ePs);function yd(e,i,A){Object.defineProperty(e,i,{enumerable:!0,value:A,writable:!1})}function Cqe(e,i){for(let A=0;A<32;A++){if(e[i])return e[i];if(!e.prototype||typeof e.prototype!="object")break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function moe(e){return tPs(this,void 0,void 0,function*(){let i=Object.keys(e).map(c=>{let f=e[c];return Promise.resolve(f).then(l=>({key:c,value:l}))});return(yield Promise.all(i)).reduce((c,f)=>(c[f.key]=f.value,c),{})})}function owe(e){let i={};for(let A in e)i[A]=e[A];return i}var nPs={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Lti(e){if(e==null||nPs[typeof e])return!0;if(Array.isArray(e)||typeof e=="object"){if(!Object.isFrozen(e))return!1;let i=Object.keys(e);for(let A=0;A<i.length;A++){let c=null;try{c=e[i[A]]}catch(f){continue}if(!Lti(c))return!1}return!0}return Hti.throwArgumentError(`Cannot deepCopy ${typeof e}`,"object",e)}function rPs(e){if(Lti(e))return e;if(Array.isArray(e))return Object.freeze(e.map(i=>Bqe(i)));if(typeof e=="object"){let i={};for(let A in e){let c=e[A];c!==void 0&&yd(i,A,Bqe(c))}return i}return Hti.throwArgumentError(`Cannot deepCopy ${typeof e}`,"object",e)}function Bqe(e){return rPs(e)}var awe=class{constructor(i){for(let A in i)this[A]=Bqe(i[A])}},Rqe="abi/5.7.0",C2=new dd(Rqe),rle={},wti={calldata:!0,memory:!0,storage:!0},iPs={calldata:!0,memory:!0};function N6t(e,i){if(e==="bytes"||e==="string"){if(wti[i])return!0}else if(e==="address"){if(i==="payable")return!0}else if((e.indexOf("[")>=0||e==="tuple")&&iPs[i])return!0;return(wti[i]||i==="payable")&&C2.throwArgumentError("invalid modifier","name",i),!1}function oPs(e,i){let A=e;function c(w){C2.throwArgumentError(`unexpected character at position ${w}`,"param",e)}e=e.replace(/\s/g," ");function f(w){let N={type:"",name:"",parent:w,state:{allowType:!0}};return i&&(N.indexed=!1),N}let l={type:"",name:"",state:{allowType:!0}},g=l;for(let w=0;w<e.length;w++){let N=e[w];switch(N){case"(":g.state.allowType&&g.type===""?g.type="tuple":g.state.allowParams||c(w),g.state.allowType=!1,g.type=ewe(g.type),g.components=[f(g)],g=g.components[0];break;case")":delete g.state,g.name==="indexed"&&(i||c(w),g.indexed=!0,g.name=""),N6t(g.type,g.name)&&(g.name=""),g.type=ewe(g.type);let F=g;g=g.parent,g||c(w),delete F.parent,g.state.allowParams=!1,g.state.allowName=!0,g.state.allowArray=!0;break;case",":delete g.state,g.name==="indexed"&&(i||c(w),g.indexed=!0,g.name=""),N6t(g.type,g.name)&&(g.name=""),g.type=ewe(g.type);let j=f(g.parent);g.parent.components.push(j),delete g.parent,g=j;break;case" ":g.state.allowType&&g.type!==""&&(g.type=ewe(g.type),delete g.state.allowType,g.state.allowName=!0,g.state.allowParams=!0),g.state.allowName&&g.name!==""&&(g.name==="indexed"?(i||c(w),g.indexed&&c(w),g.indexed=!0,g.name=""):N6t(g.type,g.name)?g.name="":g.state.allowName=!1);break;case"[":g.state.allowArray||c(w),g.type+=N,g.state.allowArray=!1,g.state.allowName=!1,g.state.readArray=!0;break;case"]":g.state.readArray||c(w),g.type+=N,g.state.readArray=!1,g.state.allowArray=!0,g.state.allowName=!0;break;default:g.state.allowType?(g.type+=N,g.state.allowParams=!0,g.state.allowArray=!0):g.state.allowName?(g.name+=N,delete g.state.allowArray):g.state.readArray?g.type+=N:c(w)}}return g.parent&&C2.throwArgumentError("unexpected eof","param",e),delete l.state,g.name==="indexed"?(i||c(A.length-7),g.indexed&&c(A.length-7),g.indexed=!0,g.name=""):N6t(g.type,g.name)&&(g.name=""),l.type=ewe(l.type),l}function U6t(e,i){for(let A in i)yd(e,A,i[A])}var Nh=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),aPs=new RegExp(/^(.*)\[([0-9]*)\]$/),eT=class e{constructor(i,A){i!==rle&&C2.throwError("use fromString",dd.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),U6t(this,A);let c=this.type.match(aPs);c?U6t(this,{arrayLength:parseInt(c[2]||"-1"),arrayChildren:e.fromObject({type:c[1],components:this.components}),baseType:"array"}):U6t(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json){let c={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(c.indexed=this.indexed),this.components&&(c.components=this.components.map(f=>JSON.parse(f.format(i)))),JSON.stringify(c)}let A="";return this.baseType==="array"?(A+=this.arrayChildren.format(i),A+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(i!==Nh.sighash&&(A+=this.type),A+="("+this.components.map(c=>c.format(i)).join(i===Nh.full?", ":",")+")"):A+=this.type,i!==Nh.sighash&&(this.indexed===!0&&(A+=" indexed"),i===Nh.full&&this.name&&(A+=" "+this.name)),A}static from(i,A){return typeof i=="string"?e.fromString(i,A):e.fromObject(i)}static fromObject(i){return e.isParamType(i)?i:new e(rle,{name:i.name||null,type:ewe(i.type),indexed:i.indexed==null?null:!!i.indexed,components:i.components?i.components.map(e.fromObject):null})}static fromString(i,A){function c(f){return e.fromObject({name:f.name,type:f.type,indexed:f.indexed,components:f.components})}return c(oPs(i,!!A))}static isParamType(i){return!!(i!=null&&i._isParamType)}};function vqe(e,i){return APs(e).map(A=>eT.fromString(A,i))}var swe=class e{constructor(i,A){i!==rle&&C2.throwError("use a static from method",dd.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),U6t(this,A),this._isFragment=!0,Object.freeze(this)}static from(i){return e.isFragment(i)?i:typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isFragment(i))return i;switch(i.type){case"function":return dwe.fromObject(i);case"event":return bqe.fromObject(i);case"constructor":return Awe.fromObject(i);case"error":return H6t.fromObject(i);case"fallback":case"receive":return null}return C2.throwArgumentError("invalid fragment object","value",i)}static fromString(i){return i=i.replace(/\s/g," "),i=i.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),i=i.trim(),i.split(" ")[0]==="event"?bqe.fromString(i.substring(5).trim()):i.split(" ")[0]==="function"?dwe.fromString(i.substring(8).trim()):i.split("(")[0].trim()==="constructor"?Awe.fromString(i.trim()):i.split(" ")[0]==="error"?H6t.fromString(i.substring(5).trim()):C2.throwArgumentError("unsupported fragment","value",i)}static isFragment(i){return!!(i&&i._isFragment)}},bqe=class e extends swe{format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(c=>JSON.parse(c.format(i)))});let A="";return i!==Nh.sighash&&(A+="event "),A+=this.name+"("+this.inputs.map(c=>c.format(i)).join(i===Nh.full?", ":",")+") ",i!==Nh.sighash&&this.anonymous&&(A+="anonymous "),A.trim()}static from(i){return typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isEventFragment(i))return i;i.type!=="event"&&C2.throwArgumentError("invalid event object","value",i);let A={name:Sqe(i.name),anonymous:i.anonymous,inputs:i.inputs?i.inputs.map(eT.fromObject):[],type:"event"};return new e(rle,A)}static fromString(i){let A=i.match(wqe);A||C2.throwArgumentError("invalid event string","value",i);let c=!1;return A[3].split(" ").forEach(f=>{switch(f.trim()){case"anonymous":c=!0;break;case"":break;default:C2.warn("unknown modifier: "+f)}}),e.fromObject({name:A[1].trim(),anonymous:c,inputs:vqe(A[2],!0),type:"event"})}static isEventFragment(i){return i&&i._isFragment&&i.type==="event"}};function Gti(e,i){i.gas=null;let A=e.split("@");return A.length!==1?(A.length>2&&C2.throwArgumentError("invalid human-readable ABI signature","value",e),A[1].match(/^[0-9]+$/)||C2.throwArgumentError("invalid human-readable ABI signature gas","value",e),i.gas=Vg.from(A[1]),A[0]):e}function qti(e,i){i.constant=!1,i.payable=!1,i.stateMutability="nonpayable",e.split(" ").forEach(A=>{switch(A.trim()){case"constant":i.constant=!0;break;case"payable":i.payable=!0,i.stateMutability="payable";break;case"nonpayable":i.payable=!1,i.stateMutability="nonpayable";break;case"pure":i.constant=!0,i.stateMutability="pure";break;case"view":i.constant=!0,i.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+A)}})}function Kti(e){let i={constant:!1,payable:!0,stateMutability:"payable"};return e.stateMutability!=null?(i.stateMutability=e.stateMutability,i.constant=i.stateMutability==="view"||i.stateMutability==="pure",e.constant!=null&&!!e.constant!==i.constant&&C2.throwArgumentError("cannot have constant function with mutability "+i.stateMutability,"value",e),i.payable=i.stateMutability==="payable",e.payable!=null&&!!e.payable!==i.payable&&C2.throwArgumentError("cannot have payable function with mutability "+i.stateMutability,"value",e)):e.payable!=null?(i.payable=!!e.payable,e.constant==null&&!i.payable&&e.type!=="constructor"&&C2.throwArgumentError("unable to determine stateMutability","value",e),i.constant=!!e.constant,i.constant?i.stateMutability="view":i.stateMutability=i.payable?"payable":"nonpayable",i.payable&&i.constant&&C2.throwArgumentError("cannot have constant payable function","value",e)):e.constant!=null?(i.constant=!!e.constant,i.payable=!i.constant,i.stateMutability=i.constant?"view":"payable"):e.type!=="constructor"&&C2.throwArgumentError("unable to determine stateMutability","value",e),i}var Awe=class e extends swe{format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(c=>JSON.parse(c.format(i)))});i===Nh.sighash&&C2.throwError("cannot format a constructor for sighash",dd.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let A="constructor("+this.inputs.map(c=>c.format(i)).join(i===Nh.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(A+=this.stateMutability+" "),A.trim()}static from(i){return typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isConstructorFragment(i))return i;i.type!=="constructor"&&C2.throwArgumentError("invalid constructor object","value",i);let A=Kti(i);A.constant&&C2.throwArgumentError("constructor cannot be constant","value",i);let c={name:null,type:i.type,inputs:i.inputs?i.inputs.map(eT.fromObject):[],payable:A.payable,stateMutability:A.stateMutability,gas:i.gas?Vg.from(i.gas):null};return new e(rle,c)}static fromString(i){let A={type:"constructor"};i=Gti(i,A);let c=i.match(wqe);return(!c||c[1].trim()!=="constructor")&&C2.throwArgumentError("invalid constructor string","value",i),A.inputs=vqe(c[2].trim(),!1),qti(c[3].trim(),A),e.fromObject(A)}static isConstructorFragment(i){return i&&i._isFragment&&i.type==="constructor"}},dwe=class e extends Awe{format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(c=>JSON.parse(c.format(i))),outputs:this.outputs.map(c=>JSON.parse(c.format(i)))});let A="";return i!==Nh.sighash&&(A+="function "),A+=this.name+"("+this.inputs.map(c=>c.format(i)).join(i===Nh.full?", ":",")+") ",i!==Nh.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(A+=this.stateMutability+" "):this.constant&&(A+="view "),this.outputs&&this.outputs.length&&(A+="returns ("+this.outputs.map(c=>c.format(i)).join(", ")+") "),this.gas!=null&&(A+="@"+this.gas.toString()+" ")),A.trim()}static from(i){return typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isFunctionFragment(i))return i;i.type!=="function"&&C2.throwArgumentError("invalid function object","value",i);let A=Kti(i),c={type:i.type,name:Sqe(i.name),constant:A.constant,inputs:i.inputs?i.inputs.map(eT.fromObject):[],outputs:i.outputs?i.outputs.map(eT.fromObject):[],payable:A.payable,stateMutability:A.stateMutability,gas:i.gas?Vg.from(i.gas):null};return new e(rle,c)}static fromString(i){let A={type:"function"};i=Gti(i,A);let c=i.split(" returns ");c.length>2&&C2.throwArgumentError("invalid function string","value",i);let f=c[0].match(wqe);if(f||C2.throwArgumentError("invalid function signature","value",i),A.name=f[1].trim(),A.name&&Sqe(A.name),A.inputs=vqe(f[2],!1),qti(f[3].trim(),A),c.length>1){let l=c[1].match(wqe);(l[1].trim()!=""||l[3].trim()!="")&&C2.throwArgumentError("unexpected tokens","value",i),A.outputs=vqe(l[2],!1)}else A.outputs=[];return e.fromObject(A)}static isFunctionFragment(i){return i&&i._isFragment&&i.type==="function"}};function Qti(e){let i=e.format();return(i==="Error(string)"||i==="Panic(uint256)")&&C2.throwArgumentError(`cannot specify user defined ${i} error`,"fragment",e),e}var H6t=class e extends swe{format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(c=>JSON.parse(c.format(i)))});let A="";return i!==Nh.sighash&&(A+="error "),A+=this.name+"("+this.inputs.map(c=>c.format(i)).join(i===Nh.full?", ":",")+") ",A.trim()}static from(i){return typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isErrorFragment(i))return i;i.type!=="error"&&C2.throwArgumentError("invalid error object","value",i);let A={type:i.type,name:Sqe(i.name),inputs:i.inputs?i.inputs.map(eT.fromObject):[]};return Qti(new e(rle,A))}static fromString(i){let A={type:"error"},c=i.match(wqe);return c||C2.throwArgumentError("invalid error signature","value",i),A.name=c[1].trim(),A.name&&Sqe(A.name),A.inputs=vqe(c[2],!1),Qti(e.fromObject(A))}static isErrorFragment(i){return i&&i._isFragment&&i.type==="error"}};function ewe(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var sPs=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Sqe(e){return(!e||!e.match(sPs))&&C2.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}var wqe=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function APs(e){e=e.trim();let i=[],A="",c=0;for(let f=0;f<e.length;f++){let l=e[f];l===","&&c===0?(i.push(A),A=""):(A+=l,l==="("?c++:l===")"&&(c--,c===-1&&C2.throwArgumentError("unbalanced parenthesis","value",e)))}return A&&i.push(A),i}var s3n=new dd(Rqe);function dPs(e){let i=[],A=function(c,f){if(Array.isArray(f))for(let l in f){let g=c.slice();g.push(l);try{A(g,f[l])}catch(w){i.push({path:g,error:w})}}};return A([],e),i}var jF=class{constructor(i,A,c,f){this.name=i,this.type=A,this.localName=c,this.dynamic=f}_throwError(i,A){s3n.throwArgumentError(i,this.localName,A)}},Qqe=class{constructor(i){yd(this,"wordSize",i||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(i)}get data(){return X9s(this._data)}get length(){return this._dataLength}_writeData(i){return this._data.push(i),this._dataLength+=i.length,i.length}appendWriter(i){return this._writeData(iwe(i._data))}writeBytes(i){let A=T3(i),c=A.length%this.wordSize;return c&&(A=iwe([A,this._padding.slice(c)])),this._writeData(A)}_getValue(i){let A=T3(Vg.from(i));return A.length>this.wordSize&&s3n.throwError("value out-of-bounds",dd.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:A.length}),A.length%this.wordSize&&(A=iwe([this._padding.slice(A.length%this.wordSize),A])),A}writeValue(i){return this._writeData(this._getValue(i))}writeUpdatableValue(){let i=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,A=>{this._data[i]=this._getValue(A)}}},FCn=class e{constructor(i,A,c,f){yd(this,"_data",T3(i)),yd(this,"wordSize",A||32),yd(this,"_coerceFunc",c),yd(this,"allowLoose",f),this._offset=0}get data(){return Lm(this._data)}get consumed(){return this._offset}static coerce(i,A){let c=i.match("^u?int([0-9]+)$");return c&&parseInt(c[1])<=48&&(A=A.toNumber()),A}coerce(i,A){return this._coerceFunc?this._coerceFunc(i,A):e.coerce(i,A)}_peekBytes(i,A,c){let f=Math.ceil(A/this.wordSize)*this.wordSize;return this._offset+f>this._data.length&&(this.allowLoose&&c&&this._offset+A<=this._data.length?f=A:s3n.throwError("data out-of-bounds",dd.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+f})),this._data.slice(this._offset,this._offset+f)}subReader(i){return new e(this._data.slice(this._offset+i),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(i,A){let c=this._peekBytes(0,i,!!A);return this._offset+=c.length,c.slice(0,i)}readValue(){return Vg.from(this.readBytes(this.wordSize))}},A3n={exports:{}};A3n.exports;(function(e){(function(){var i="input is invalid type",A="finalize already called",c=typeof window=="object",f=c?window:{};f.JS_SHA3_NO_WINDOW&&(c=!1);var l=!c&&typeof self=="object",g=!f.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;g?f=Mti:l&&(f=self);var w=!f.JS_SHA3_NO_COMMON_JS&&!0&&e.exports,N=!f.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",F="0123456789abcdef".split(""),j=[31,7936,2031616,520093696],te=[4,1024,262144,67108864],v=[1,256,65536,16777216],ne=[6,1536,393216,100663296],Z=[0,8,16,24],R=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],M=[224,256,384,512],U=[128,256],E=["hex","buffer","arrayBuffer","array","digest"],Q={128:168,256:136};(f.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(ae){return Object.prototype.toString.call(ae)==="[object Array]"}),N&&(f.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(ae){return typeof ae=="object"&&ae.buffer&&ae.buffer.constructor===ArrayBuffer});for(var H=function(ae,ye,Xe){return function(nt){return new C(ae,ye,ae).update(nt)[Xe]()}},re=function(ae,ye,Xe){return function(nt,Ke){return new C(ae,ye,Ke).update(nt)[Xe]()}},ee=function(ae,ye,Xe){return function(nt,Ke,It,rt){return h["cshake"+ae].update(nt,Ke,It,rt)[Xe]()}},T=function(ae,ye,Xe){return function(nt,Ke,It,rt){return h["kmac"+ae].update(nt,Ke,It,rt)[Xe]()}},se=function(ae,ye,Xe,nt){for(var Ke=0;Ke<E.length;++Ke){var It=E[Ke];ae[It]=ye(Xe,nt,It)}return ae},p=function(ae,ye){var Xe=H(ae,ye,"hex");return Xe.create=function(){return new C(ae,ye,ae)},Xe.update=function(nt){return Xe.create().update(nt)},se(Xe,H,ae,ye)},L=function(ae,ye){var Xe=re(ae,ye,"hex");return Xe.create=function(nt){return new C(ae,ye,nt)},Xe.update=function(nt,Ke){return Xe.create(Ke).update(nt)},se(Xe,re,ae,ye)},V=function(ae,ye){var Xe=Q[ae],nt=ee(ae,ye,"hex");return nt.create=function(Ke,It,rt){return!It&&!rt?h["shake"+ae].create(Ke):new C(ae,ye,Ke).bytepad([It,rt],Xe)},nt.update=function(Ke,It,rt,ut){return nt.create(It,rt,ut).update(Ke)},se(nt,ee,ae,ye)},K=function(ae,ye){var Xe=Q[ae],nt=T(ae,ye,"hex");return nt.create=function(Ke,It,rt){return new D(ae,ye,It).bytepad(["KMAC",rt],Xe).bytepad([Ke],Xe)},nt.update=function(Ke,It,rt,ut){return nt.create(Ke,rt,ut).update(It)},se(nt,T,ae,ye)},m=[{name:"keccak",padding:v,bits:M,createMethod:p},{name:"sha3",padding:ne,bits:M,createMethod:p},{name:"shake",padding:j,bits:U,createMethod:L},{name:"cshake",padding:te,bits:U,createMethod:V},{name:"kmac",padding:te,bits:U,createMethod:K}],h={},_=[],b=0;b<m.length;++b)for(var O=m[b],J=O.bits,ie=0;ie<J.length;++ie){var G=O.name+"_"+J[ie];if(_.push(G),h[G]=O.createMethod(J[ie],O.padding),O.name!=="sha3"){var I=O.name+J[ie];_.push(I),h[I]=h[G]}}function C(ae,ye,Xe){this.blocks=[],this.s=[],this.padding=ye,this.outputBits=Xe,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(ae<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Xe>>5,this.extraBytes=(Xe&31)>>3;for(var nt=0;nt<50;++nt)this.s[nt]=0}C.prototype.update=function(ae){if(this.finalized)throw new Error(A);var ye,Xe=typeof ae;if(Xe!=="string"){if(Xe==="object"){if(ae===null)throw new Error(i);if(N&&ae.constructor===ArrayBuffer)ae=new Uint8Array(ae);else if(!Array.isArray(ae)&&(!N||!ArrayBuffer.isView(ae)))throw new Error(i)}else throw new Error(i);ye=!0}for(var nt=this.blocks,Ke=this.byteCount,It=ae.length,rt=this.blockCount,ut=0,Rt=this.s,Ee,Pt;ut<It;){if(this.reset)for(this.reset=!1,nt[0]=this.block,Ee=1;Ee<rt+1;++Ee)nt[Ee]=0;if(ye)for(Ee=this.start;ut<It&&Ee<Ke;++ut)nt[Ee>>2]|=ae[ut]<<Z[Ee++&3];else for(Ee=this.start;ut<It&&Ee<Ke;++ut)Pt=ae.charCodeAt(ut),Pt<128?nt[Ee>>2]|=Pt<<Z[Ee++&3]:Pt<2048?(nt[Ee>>2]|=(192|Pt>>6)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt&63)<<Z[Ee++&3]):Pt<55296||Pt>=57344?(nt[Ee>>2]|=(224|Pt>>12)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt>>6&63)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt&63)<<Z[Ee++&3]):(Pt=65536+((Pt&1023)<<10|ae.charCodeAt(++ut)&1023),nt[Ee>>2]|=(240|Pt>>18)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt>>12&63)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt>>6&63)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt&63)<<Z[Ee++&3]);if(this.lastByteIndex=Ee,Ee>=Ke){for(this.start=Ee-Ke,this.block=nt[rt],Ee=0;Ee<rt;++Ee)Rt[Ee]^=nt[Ee];W(Rt),this.reset=!0}else this.start=Ee}return this},C.prototype.encode=function(ae,ye){var Xe=ae&255,nt=1,Ke=[Xe];for(ae=ae>>8,Xe=ae&255;Xe>0;)Ke.unshift(Xe),ae=ae>>8,Xe=ae&255,++nt;return ye?Ke.push(nt):Ke.unshift(nt),this.update(Ke),Ke.length},C.prototype.encodeString=function(ae){var ye,Xe=typeof ae;if(Xe!=="string"){if(Xe==="object"){if(ae===null)throw new Error(i);if(N&&ae.constructor===ArrayBuffer)ae=new Uint8Array(ae);else if(!Array.isArray(ae)&&(!N||!ArrayBuffer.isView(ae)))throw new Error(i)}else throw new Error(i);ye=!0}var nt=0,Ke=ae.length;if(ye)nt=Ke;else for(var It=0;It<ae.length;++It){var rt=ae.charCodeAt(It);rt<128?nt+=1:rt<2048?nt+=2:rt<55296||rt>=57344?nt+=3:(rt=65536+((rt&1023)<<10|ae.charCodeAt(++It)&1023),nt+=4)}return nt+=this.encode(nt*8),this.update(ae),nt},C.prototype.bytepad=function(ae,ye){for(var Xe=this.encode(ye),nt=0;nt<ae.length;++nt)Xe+=this.encodeString(ae[nt]);var Ke=ye-Xe%ye,It=[];return It.length=Ke,this.update(It),this},C.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var ae=this.blocks,ye=this.lastByteIndex,Xe=this.blockCount,nt=this.s;if(ae[ye>>2]|=this.padding[ye&3],this.lastByteIndex===this.byteCount)for(ae[0]=ae[Xe],ye=1;ye<Xe+1;++ye)ae[ye]=0;for(ae[Xe-1]|=2147483648,ye=0;ye<Xe;++ye)nt[ye]^=ae[ye];W(nt)}},C.prototype.toString=C.prototype.hex=function(){this.finalize();for(var ae=this.blockCount,ye=this.s,Xe=this.outputBlocks,nt=this.extraBytes,Ke=0,It=0,rt="",ut;It<Xe;){for(Ke=0;Ke<ae&&It<Xe;++Ke,++It)ut=ye[Ke],rt+=F[ut>>4&15]+F[ut&15]+F[ut>>12&15]+F[ut>>8&15]+F[ut>>20&15]+F[ut>>16&15]+F[ut>>28&15]+F[ut>>24&15];It%ae===0&&(W(ye),Ke=0)}return nt&&(ut=ye[Ke],rt+=F[ut>>4&15]+F[ut&15],nt>1&&(rt+=F[ut>>12&15]+F[ut>>8&15]),nt>2&&(rt+=F[ut>>20&15]+F[ut>>16&15])),rt},C.prototype.arrayBuffer=function(){this.finalize();var ae=this.blockCount,ye=this.s,Xe=this.outputBlocks,nt=this.extraBytes,Ke=0,It=0,rt=this.outputBits>>3,ut;nt?ut=new ArrayBuffer(Xe+1<<2):ut=new ArrayBuffer(rt);for(var Rt=new Uint32Array(ut);It<Xe;){for(Ke=0;Ke<ae&&It<Xe;++Ke,++It)Rt[It]=ye[Ke];It%ae===0&&W(ye)}return nt&&(Rt[Ke]=ye[Ke],ut=ut.slice(0,rt)),ut},C.prototype.buffer=C.prototype.arrayBuffer,C.prototype.digest=C.prototype.array=function(){this.finalize();for(var ae=this.blockCount,ye=this.s,Xe=this.outputBlocks,nt=this.extraBytes,Ke=0,It=0,rt=[],ut,Rt;It<Xe;){for(Ke=0;Ke<ae&&It<Xe;++Ke,++It)ut=It<<2,Rt=ye[Ke],rt[ut]=Rt&255,rt[ut+1]=Rt>>8&255,rt[ut+2]=Rt>>16&255,rt[ut+3]=Rt>>24&255;It%ae===0&&W(ye)}return nt&&(ut=It<<2,Rt=ye[Ke],rt[ut]=Rt&255,nt>1&&(rt[ut+1]=Rt>>8&255),nt>2&&(rt[ut+2]=Rt>>16&255)),rt};function D(ae,ye,Xe){C.call(this,ae,ye,Xe)}D.prototype=new C,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var W=function(ae){var ye,Xe,nt,Ke,It,rt,ut,Rt,Ee,Pt,_e,we,xe,Ye,X,ht,Ut,zt,Wt,yn,rn,un,fr,ir,Ln,Br,Zn,Jn,_r,Yn,kn,Y,fe,be,qt,ct,Ft,vr,$n,Hn,kr,sr,Wn,Xr,pr,Gn,Or,lt,Bt,Ot,We,Qt,fn,tn,Re,Vn,De,Je,je,st,Et,Mt,Vt;for(nt=0;nt<48;nt+=2)Ke=ae[0]^ae[10]^ae[20]^ae[30]^ae[40],It=ae[1]^ae[11]^ae[21]^ae[31]^ae[41],rt=ae[2]^ae[12]^ae[22]^ae[32]^ae[42],ut=ae[3]^ae[13]^ae[23]^ae[33]^ae[43],Rt=ae[4]^ae[14]^ae[24]^ae[34]^ae[44],Ee=ae[5]^ae[15]^ae[25]^ae[35]^ae[45],Pt=ae[6]^ae[16]^ae[26]^ae[36]^ae[46],_e=ae[7]^ae[17]^ae[27]^ae[37]^ae[47],we=ae[8]^ae[18]^ae[28]^ae[38]^ae[48],xe=ae[9]^ae[19]^ae[29]^ae[39]^ae[49],ye=we^(rt<<1|ut>>>31),Xe=xe^(ut<<1|rt>>>31),ae[0]^=ye,ae[1]^=Xe,ae[10]^=ye,ae[11]^=Xe,ae[20]^=ye,ae[21]^=Xe,ae[30]^=ye,ae[31]^=Xe,ae[40]^=ye,ae[41]^=Xe,ye=Ke^(Rt<<1|Ee>>>31),Xe=It^(Ee<<1|Rt>>>31),ae[2]^=ye,ae[3]^=Xe,ae[12]^=ye,ae[13]^=Xe,ae[22]^=ye,ae[23]^=Xe,ae[32]^=ye,ae[33]^=Xe,ae[42]^=ye,ae[43]^=Xe,ye=rt^(Pt<<1|_e>>>31),Xe=ut^(_e<<1|Pt>>>31),ae[4]^=ye,ae[5]^=Xe,ae[14]^=ye,ae[15]^=Xe,ae[24]^=ye,ae[25]^=Xe,ae[34]^=ye,ae[35]^=Xe,ae[44]^=ye,ae[45]^=Xe,ye=Rt^(we<<1|xe>>>31),Xe=Ee^(xe<<1|we>>>31),ae[6]^=ye,ae[7]^=Xe,ae[16]^=ye,ae[17]^=Xe,ae[26]^=ye,ae[27]^=Xe,ae[36]^=ye,ae[37]^=Xe,ae[46]^=ye,ae[47]^=Xe,ye=Pt^(Ke<<1|It>>>31),Xe=_e^(It<<1|Ke>>>31),ae[8]^=ye,ae[9]^=Xe,ae[18]^=ye,ae[19]^=Xe,ae[28]^=ye,ae[29]^=Xe,ae[38]^=ye,ae[39]^=Xe,ae[48]^=ye,ae[49]^=Xe,Ye=ae[0],X=ae[1],Gn=ae[11]<<4|ae[10]>>>28,Or=ae[10]<<4|ae[11]>>>28,Jn=ae[20]<<3|ae[21]>>>29,_r=ae[21]<<3|ae[20]>>>29,st=ae[31]<<9|ae[30]>>>23,Et=ae[30]<<9|ae[31]>>>23,sr=ae[40]<<18|ae[41]>>>14,Wn=ae[41]<<18|ae[40]>>>14,be=ae[2]<<1|ae[3]>>>31,qt=ae[3]<<1|ae[2]>>>31,ht=ae[13]<<12|ae[12]>>>20,Ut=ae[12]<<12|ae[13]>>>20,lt=ae[22]<<10|ae[23]>>>22,Bt=ae[23]<<10|ae[22]>>>22,Yn=ae[33]<<13|ae[32]>>>19,kn=ae[32]<<13|ae[33]>>>19,Mt=ae[42]<<2|ae[43]>>>30,Vt=ae[43]<<2|ae[42]>>>30,tn=ae[5]<<30|ae[4]>>>2,Re=ae[4]<<30|ae[5]>>>2,ct=ae[14]<<6|ae[15]>>>26,Ft=ae[15]<<6|ae[14]>>>26,zt=ae[25]<<11|ae[24]>>>21,Wt=ae[24]<<11|ae[25]>>>21,Ot=ae[34]<<15|ae[35]>>>17,We=ae[35]<<15|ae[34]>>>17,Y=ae[45]<<29|ae[44]>>>3,fe=ae[44]<<29|ae[45]>>>3,ir=ae[6]<<28|ae[7]>>>4,Ln=ae[7]<<28|ae[6]>>>4,Vn=ae[17]<<23|ae[16]>>>9,De=ae[16]<<23|ae[17]>>>9,vr=ae[26]<<25|ae[27]>>>7,$n=ae[27]<<25|ae[26]>>>7,yn=ae[36]<<21|ae[37]>>>11,rn=ae[37]<<21|ae[36]>>>11,Qt=ae[47]<<24|ae[46]>>>8,fn=ae[46]<<24|ae[47]>>>8,Xr=ae[8]<<27|ae[9]>>>5,pr=ae[9]<<27|ae[8]>>>5,Br=ae[18]<<20|ae[19]>>>12,Zn=ae[19]<<20|ae[18]>>>12,Je=ae[29]<<7|ae[28]>>>25,je=ae[28]<<7|ae[29]>>>25,Hn=ae[38]<<8|ae[39]>>>24,kr=ae[39]<<8|ae[38]>>>24,un=ae[48]<<14|ae[49]>>>18,fr=ae[49]<<14|ae[48]>>>18,ae[0]=Ye^~ht&zt,ae[1]=X^~Ut&Wt,ae[10]=ir^~Br&Jn,ae[11]=Ln^~Zn&_r,ae[20]=be^~ct&vr,ae[21]=qt^~Ft&$n,ae[30]=Xr^~Gn&lt,ae[31]=pr^~Or&Bt,ae[40]=tn^~Vn&Je,ae[41]=Re^~De&je,ae[2]=ht^~zt&yn,ae[3]=Ut^~Wt&rn,ae[12]=Br^~Jn&Yn,ae[13]=Zn^~_r&kn,ae[22]=ct^~vr&Hn,ae[23]=Ft^~$n&kr,ae[32]=Gn^~lt&Ot,ae[33]=Or^~Bt&We,ae[42]=Vn^~Je&st,ae[43]=De^~je&Et,ae[4]=zt^~yn&un,ae[5]=Wt^~rn&fr,ae[14]=Jn^~Yn&Y,ae[15]=_r^~kn&fe,ae[24]=vr^~Hn&sr,ae[25]=$n^~kr&Wn,ae[34]=lt^~Ot&Qt,ae[35]=Bt^~We&fn,ae[44]=Je^~st&Mt,ae[45]=je^~Et&Vt,ae[6]=yn^~un&Ye,ae[7]=rn^~fr&X,ae[16]=Yn^~Y&ir,ae[17]=kn^~fe&Ln,ae[26]=Hn^~sr&be,ae[27]=kr^~Wn&qt,ae[36]=Ot^~Qt&Xr,ae[37]=We^~fn&pr,ae[46]=st^~Mt&tn,ae[47]=Et^~Vt&Re,ae[8]=un^~Ye&ht,ae[9]=fr^~X&Ut,ae[18]=Y^~ir&Br,ae[19]=fe^~Ln&Zn,ae[28]=sr^~be&ct,ae[29]=Wn^~qt&Ft,ae[38]=Qt^~Xr&Gn,ae[39]=fn^~pr&Or,ae[48]=Mt^~tn&Vn,ae[49]=Vt^~Re&De,ae[0]^=R[nt],ae[1]^=R[nt+1]};if(w)e.exports=h;else for(b=0;b<_.length;++b)f[_[b]]=h[_[b]]})()})(A3n);var cPs=A3n.exports,uPs=Tti(cPs);function kqe(e){return"0x"+uPs.keccak_256(T3(e))}var fPs="rlp/5.7.0",lPs=new dd(fPs);function kti(e){let i=[];for(;e;)i.unshift(e&255),e>>=8;return i}function Yti(e){if(Array.isArray(e)){let c=[];if(e.forEach(function(l){c=c.concat(Yti(l))}),c.length<=55)return c.unshift(192+c.length),c;let f=kti(c.length);return f.unshift(247+f.length),f.concat(c)}z9s(e)||lPs.throwArgumentError("RLP object must be BytesLike","object",e);let i=Array.prototype.slice.call(T3(e));if(i.length===1&&i[0]<=127)return i;if(i.length<=55)return i.unshift(128+i.length),i;let A=kti(i.length);return A.unshift(183+A.length),A.concat(i)}function hPs(e){return Lm(Yti(e))}var gPs="address/5.7.0",twe=new dd(gPs);function Dti(e){kD(e,20)||twe.throwArgumentError("invalid address","address",e),e=e.toLowerCase();let i=e.substring(2).split(""),A=new Uint8Array(40);for(let f=0;f<40;f++)A[f]=i[f].charCodeAt(0);let c=T3(kqe(A));for(let f=0;f<40;f+=2)c[f>>1]>>4>=8&&(i[f]=i[f].toUpperCase()),(c[f>>1]&15)>=8&&(i[f+1]=i[f+1].toUpperCase());return"0x"+i.join("")}var pPs=9007199254740991;function yPs(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}var d3n={};for(let e=0;e<10;e++)d3n[String(e)]=String(e);for(let e=0;e<26;e++)d3n[String.fromCharCode(65+e)]=String(10+e);var Rti=Math.floor(yPs(pPs));function mPs(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let i=e.split("").map(c=>d3n[c]).join("");for(;i.length>=Rti;){let c=i.substring(0,Rti);i=parseInt(c,10)%97+i.substring(c.length)}let A=String(98-parseInt(i,10)%97);for(;A.length<2;)A="0"+A;return A}function mW(e){let i=null;if(typeof e!="string"&&twe.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))e.substring(0,2)!=="0x"&&(e="0x"+e),i=Dti(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&i!==e&&twe.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==mPs(e)&&twe.throwArgumentError("bad icap checksum","address",e),i=j9s(e.substring(4));i.length<40;)i="0"+i;i=Dti("0x"+i)}else twe.throwArgumentError("invalid address","address",e);return i}function IPs(e){let i=null;try{i=mW(e.from)}catch(c){twe.throwArgumentError("missing from address","transaction",e)}let A=W9s(T3(Vg.from(e.nonce).toHexString()));return mW(Fti(kqe(hPs([i,A])),12))}var JCn=class extends jF{constructor(i){super("address","address",i,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(i,A){try{A=mW(A)}catch(c){this._throwError(c.message,A)}return i.writeValue(A)}decode(i){return mW(Jti(i.readValue().toHexString(),20))}},HCn=class extends jF{constructor(i){super(i.name,i.type,void 0,i.dynamic),this.coder=i}defaultValue(){return this.coder.defaultValue()}encode(i,A){return this.coder.encode(i,A)}decode(i){return this.coder.decode(i)}},nwe=new dd(Rqe);function Vti(e,i,A){let c=null;if(Array.isArray(A))c=A;else if(A&&typeof A=="object"){let N={};c=i.map(F=>{let j=F.localName;return j||nwe.throwError("cannot encode object for signature with missing names",dd.errors.INVALID_ARGUMENT,{argument:"values",coder:F,value:A}),N[j]&&nwe.throwError("cannot encode object for signature with duplicate names",dd.errors.INVALID_ARGUMENT,{argument:"values",coder:F,value:A}),N[j]=!0,A[j]})}else nwe.throwArgumentError("invalid tuple value","tuple",A);i.length!==c.length&&nwe.throwArgumentError("types/value length mismatch","tuple",A);let f=new Qqe(e.wordSize),l=new Qqe(e.wordSize),g=[];i.forEach((N,F)=>{let j=c[F];if(N.dynamic){let te=l.length;N.encode(l,j);let v=f.writeUpdatableValue();g.push(ne=>{v(ne+te)})}else N.encode(f,j)}),g.forEach(N=>{N(f.length)});let w=e.appendWriter(f);return w+=e.appendWriter(l),w}function zti(e,i){let A=[],c=e.subReader(0);i.forEach(l=>{let g=null;if(l.dynamic){let w=e.readValue(),N=c.subReader(w.toNumber());try{g=l.decode(N)}catch(F){if(F.code===dd.errors.BUFFER_OVERRUN)throw F;g=F,g.baseType=l.name,g.name=l.localName,g.type=l.type}}else try{g=l.decode(e)}catch(w){if(w.code===dd.errors.BUFFER_OVERRUN)throw w;g=w,g.baseType=l.name,g.name=l.localName,g.type=l.type}g!=null&&A.push(g)});let f=i.reduce((l,g)=>{let w=g.localName;return w&&(l[w]||(l[w]=0),l[w]++),l},{});i.forEach((l,g)=>{let w=l.localName;if(!w||f[w]!==1||(w==="length"&&(w="_length"),A[w]!=null))return;let N=A[g];N instanceof Error?Object.defineProperty(A,w,{enumerable:!0,get:()=>{throw N}}):A[w]=N});for(let l=0;l<A.length;l++){let g=A[l];g instanceof Error&&Object.defineProperty(A,l,{enumerable:!0,get:()=>{throw g}})}return Object.freeze(A)}var LCn=class extends jF{constructor(i,A,c){let f=i.type+"["+(A>=0?A:"")+"]",l=A===-1||i.dynamic;super("array",f,c,l),this.coder=i,this.length=A}defaultValue(){let i=this.coder.defaultValue(),A=[];for(let c=0;c<this.length;c++)A.push(i);return A}encode(i,A){Array.isArray(A)||this._throwError("expected array value",A);let c=this.length;c===-1&&(c=A.length,i.writeValue(A.length)),nwe.checkArgumentCount(A.length,c,"coder array"+(this.localName?" "+this.localName:""));let f=[];for(let l=0;l<A.length;l++)f.push(this.coder);return Vti(i,f,A)}decode(i){let A=this.length;A===-1&&(A=i.readValue().toNumber(),A*32>i._data.length&&nwe.throwError("insufficient data length",dd.errors.BUFFER_OVERRUN,{length:i._data.length,count:A}));let c=[];for(let f=0;f<A;f++)c.push(new HCn(this.coder));return i.coerce(this.name,zti(i,c))}},GCn=class extends jF{constructor(i){super("bool","bool",i,!1)}defaultValue(){return!1}encode(i,A){return i.writeValue(A?1:0)}decode(i){return i.coerce(this.type,!i.readValue().isZero())}},L6t=class extends jF{constructor(i,A){super(i,i,A,!0)}defaultValue(){return"0x"}encode(i,A){A=T3(A);let c=i.writeValue(A.length);return c+=i.writeBytes(A),c}decode(i){return i.readBytes(i.readValue().toNumber(),!0)}},qCn=class extends L6t{constructor(i){super("bytes",i)}decode(i){return i.coerce(this.name,Lm(super.decode(i)))}},KCn=class extends jF{constructor(i,A){let c="bytes"+String(i);super(c,c,A,!1),this.size=i}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(i,A){let c=T3(A);return c.length!==this.size&&this._throwError("incorrect data length",A),i.writeBytes(c)}decode(i){return i.coerce(this.name,Lm(i.readBytes(this.size)))}},YCn=class extends jF{constructor(i){super("null","",i,!1)}defaultValue(){return null}encode(i,A){return A!=null&&this._throwError("not null",A),i.writeBytes([])}decode(i){return i.readBytes(0),i.coerce(this.name,null)}},CPs=Vg.from(-1),_Ps=Vg.from(0),EPs=Vg.from(1),BPs=Vg.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),VCn=class extends jF{constructor(i,A,c){let f=(A?"int":"uint")+i*8;super(f,f,c,!1),this.size=i,this.signed=A}defaultValue(){return 0}encode(i,A){let c=Vg.from(A),f=BPs.mask(i.wordSize*8);if(this.signed){let l=f.mask(this.size*8-1);(c.gt(l)||c.lt(l.add(EPs).mul(CPs)))&&this._throwError("value out-of-bounds",A)}else(c.lt(_Ps)||c.gt(f.mask(this.size*8)))&&this._throwError("value out-of-bounds",A);return c=c.toTwos(this.size*8).mask(this.size*8),this.signed&&(c=c.fromTwos(this.size*8).toTwos(8*i.wordSize)),i.writeValue(c)}decode(i){let A=i.readValue().mask(this.size*8);return this.signed&&(A=A.fromTwos(this.size*8)),i.coerce(this.name,A)}},vPs="strings/5.7.0",Wti=new dd(vPs),G6t;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(G6t||(G6t={}));var HR;(function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"})(HR||(HR={}));function bPs(e,i,A,c,f){return Wti.throwArgumentError(`invalid codepoint at offset ${i}; ${e}`,"bytes",A)}function Zti(e,i,A,c,f){if(e===HR.BAD_PREFIX||e===HR.UNEXPECTED_CONTINUE){let l=0;for(let g=i+1;g<A.length&&A[g]>>6===2;g++)l++;return l}return e===HR.OVERRUN?A.length-i-1:0}function SPs(e,i,A,c,f){return e===HR.OVERLONG?(c.push(f),0):(c.push(65533),Zti(e,i,A))}var wPs=Object.freeze({error:bPs,ignore:Zti,replace:SPs});function QPs(e,i){i==null&&(i=wPs.error),e=T3(e);let A=[],c=0;for(;c<e.length;){let f=e[c++];if(!(f>>7)){A.push(f);continue}let l=null,g=null;if((f&224)===192)l=1,g=127;else if((f&240)===224)l=2,g=2047;else if((f&248)===240)l=3,g=65535;else{(f&192)===128?c+=i(HR.UNEXPECTED_CONTINUE,c-1,e,A):c+=i(HR.BAD_PREFIX,c-1,e,A);continue}if(c-1+l>=e.length){c+=i(HR.OVERRUN,c-1,e,A);continue}let w=f&(1<<8-l-1)-1;for(let N=0;N<l;N++){let F=e[c];if((F&192)!=128){c+=i(HR.MISSING_CONTINUE,c,e,A),w=null;break}w=w<<6|F&63,c++}if(w!==null){if(w>1114111){c+=i(HR.OUT_OF_RANGE,c-1-l,e,A,w);continue}if(w>=55296&&w<=57343){c+=i(HR.UTF16_SURROGATE,c-1-l,e,A,w);continue}if(w<=g){c+=i(HR.OVERLONG,c-1-l,e,A,w);continue}A.push(w)}}return A}function Xti(e,i=G6t.current){i!=G6t.current&&(Wti.checkNormalize(),e=e.normalize(i));let A=[];for(let c=0;c<e.length;c++){let f=e.charCodeAt(c);if(f<128)A.push(f);else if(f<2048)A.push(f>>6|192),A.push(f&63|128);else if((f&64512)==55296){c++;let l=e.charCodeAt(c);if(c>=e.length||(l&64512)!==56320)throw new Error("invalid utf-8 string");let g=65536+((f&1023)<<10)+(l&1023);A.push(g>>18|240),A.push(g>>12&63|128),A.push(g>>6&63|128),A.push(g&63|128)}else A.push(f>>12|224),A.push(f>>6&63|128),A.push(f&63|128)}return T3(A)}function kPs(e){return e.map(i=>i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10&1023)+55296,(i&1023)+56320))).join("")}function DPs(e,i){return kPs(QPs(e,i))}var zCn=class extends L6t{constructor(i){super("string",i)}defaultValue(){return""}encode(i,A){return super.encode(i,Xti(A))}decode(i){return DPs(super.decode(i))}},rwe=class extends jF{constructor(i,A){let c=!1,f=[];i.forEach(g=>{g.dynamic&&(c=!0),f.push(g.type)});let l="tuple("+f.join(",")+")";super("tuple",l,A,c),this.coders=i}defaultValue(){let i=[];this.coders.forEach(c=>{i.push(c.defaultValue())});let A=this.coders.reduce((c,f)=>{let l=f.localName;return l&&(c[l]||(c[l]=0),c[l]++),c},{});return this.coders.forEach((c,f)=>{let l=c.localName;!l||A[l]!==1||(l==="length"&&(l="_length"),i[l]==null&&(i[l]=i[f]))}),Object.freeze(i)}encode(i,A){return Vti(i,this.coders,A)}decode(i){return i.coerce(this.name,zti(i,this.coders))}},x6t=new dd(Rqe),RPs=new RegExp(/^bytes([0-9]*)$/),PPs=new RegExp(/^(u?int)([0-9]*)$/),WCn=class{constructor(i){yd(this,"coerceFunc",i||null)}_getCoder(i){switch(i.baseType){case"address":return new JCn(i.name);case"bool":return new GCn(i.name);case"string":return new zCn(i.name);case"bytes":return new qCn(i.name);case"array":return new LCn(this._getCoder(i.arrayChildren),i.arrayLength,i.name);case"tuple":return new rwe((i.components||[]).map(c=>this._getCoder(c)),i.name);case"":return new YCn(i.name)}let A=i.type.match(PPs);if(A){let c=parseInt(A[2]||"256");return(c===0||c>256||c%8!==0)&&x6t.throwArgumentError("invalid "+A[1]+" bit length","param",i),new VCn(c/8,A[1]==="int",i.name)}if(A=i.type.match(RPs),A){let c=parseInt(A[1]);return(c===0||c>32)&&x6t.throwArgumentError("invalid bytes length","param",i),new KCn(c,i.name)}return x6t.throwArgumentError("invalid type","type",i.type)}_getWordSize(){return 32}_getReader(i,A){return new FCn(i,this._getWordSize(),this.coerceFunc,A)}_getWriter(){return new Qqe(this._getWordSize())}getDefaultValue(i){let A=i.map(f=>this._getCoder(eT.from(f)));return new rwe(A,"_").defaultValue()}encode(i,A){i.length!==A.length&&x6t.throwError("types/values length mismatch",dd.errors.INVALID_ARGUMENT,{count:{types:i.length,values:A.length},value:{types:i,values:A}});let c=i.map(g=>this._getCoder(eT.from(g))),f=new rwe(c,"_"),l=this._getWriter();return f.encode(l,A),l.data}decode(i,A,c){let f=i.map(g=>this._getCoder(eT.from(g)));return new rwe(f,"_").decode(this._getReader(T3(A),c))}},OPs=new WCn;function M6t(e){return kqe(Xti(e))}var Uy=new dd(Rqe),ZCn=class extends awe{},XCn=class extends awe{},$Cn=class extends awe{},Dqe=class extends awe{static isIndexed(i){return!!(i&&i._isIndexed)}},NPs={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Pti(e,i){let A=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return A.error=i,A}var q6t=class{constructor(i){let A=[];typeof i=="string"?A=JSON.parse(i):A=i,yd(this,"fragments",A.map(c=>swe.from(c)).filter(c=>c!=null)),yd(this,"_abiCoder",Cqe(new.target,"getAbiCoder")()),yd(this,"functions",{}),yd(this,"errors",{}),yd(this,"events",{}),yd(this,"structs",{}),this.fragments.forEach(c=>{let f=null;switch(c.type){case"constructor":if(this.deploy){Uy.warn("duplicate definition - constructor");return}yd(this,"deploy",c);return;case"function":f=this.functions;break;case"event":f=this.events;break;case"error":f=this.errors;break;default:return}let l=c.format();if(f[l]){Uy.warn("duplicate definition - "+l);return}f[l]=c}),this.deploy||yd(this,"deploy",Awe.from({payable:!1,type:"constructor"})),yd(this,"_isInterface",!0)}format(i){i||(i=Nh.full),i===Nh.sighash&&Uy.throwArgumentError("interface does not support formatting sighash","format",i);let A=this.fragments.map(c=>c.format(i));return i===Nh.json?JSON.stringify(A.map(c=>JSON.parse(c))):A}static getAbiCoder(){return OPs}static getAddress(i){return mW(i)}static getSighash(i){return Fti(M6t(i.format()),0,4)}static getEventTopic(i){return M6t(i.format())}getFunction(i){if(kD(i)){for(let c in this.functions)if(i===this.getSighash(c))return this.functions[c];Uy.throwArgumentError("no matching function","sighash",i)}if(i.indexOf("(")===-1){let c=i.trim(),f=Object.keys(this.functions).filter(l=>l.split("(")[0]===c);return f.length===0?Uy.throwArgumentError("no matching function","name",c):f.length>1&&Uy.throwArgumentError("multiple matching functions","name",c),this.functions[f[0]]}let A=this.functions[dwe.fromString(i).format()];return A||Uy.throwArgumentError("no matching function","signature",i),A}getEvent(i){if(kD(i)){let c=i.toLowerCase();for(let f in this.events)if(c===this.getEventTopic(f))return this.events[f];Uy.throwArgumentError("no matching event","topichash",c)}if(i.indexOf("(")===-1){let c=i.trim(),f=Object.keys(this.events).filter(l=>l.split("(")[0]===c);return f.length===0?Uy.throwArgumentError("no matching event","name",c):f.length>1&&Uy.throwArgumentError("multiple matching events","name",c),this.events[f[0]]}let A=this.events[bqe.fromString(i).format()];return A||Uy.throwArgumentError("no matching event","signature",i),A}getError(i){if(kD(i)){let c=Cqe(this.constructor,"getSighash");for(let f in this.errors){let l=this.errors[f];if(i===c(l))return this.errors[f]}Uy.throwArgumentError("no matching error","sighash",i)}if(i.indexOf("(")===-1){let c=i.trim(),f=Object.keys(this.errors).filter(l=>l.split("(")[0]===c);return f.length===0?Uy.throwArgumentError("no matching error","name",c):f.length>1&&Uy.throwArgumentError("multiple matching errors","name",c),this.errors[f[0]]}let A=this.errors[dwe.fromString(i).format()];return A||Uy.throwArgumentError("no matching error","signature",i),A}getSighash(i){if(typeof i=="string")try{i=this.getFunction(i)}catch(A){try{i=this.getError(i)}catch(c){throw A}}return Cqe(this.constructor,"getSighash")(i)}getEventTopic(i){return typeof i=="string"&&(i=this.getEvent(i)),Cqe(this.constructor,"getEventTopic")(i)}_decodeParams(i,A){return this._abiCoder.decode(i,A)}_encodeParams(i,A){return this._abiCoder.encode(i,A)}encodeDeploy(i){return this._encodeParams(this.deploy.inputs,i||[])}decodeErrorResult(i,A){typeof i=="string"&&(i=this.getError(i));let c=T3(A);return Lm(c.slice(0,4))!==this.getSighash(i)&&Uy.throwArgumentError(`data signature does not match error ${i.name}.`,"data",Lm(c)),this._decodeParams(i.inputs,c.slice(4))}encodeErrorResult(i,A){return typeof i=="string"&&(i=this.getError(i)),Lm(iwe([this.getSighash(i),this._encodeParams(i.inputs,A||[])]))}decodeFunctionData(i,A){typeof i=="string"&&(i=this.getFunction(i));let c=T3(A);return Lm(c.slice(0,4))!==this.getSighash(i)&&Uy.throwArgumentError(`data signature does not match function ${i.name}.`,"data",Lm(c)),this._decodeParams(i.inputs,c.slice(4))}encodeFunctionData(i,A){return typeof i=="string"&&(i=this.getFunction(i)),Lm(iwe([this.getSighash(i),this._encodeParams(i.inputs,A||[])]))}decodeFunctionResult(i,A){typeof i=="string"&&(i=this.getFunction(i));let c=T3(A),f=null,l="",g=null,w=null,N=null;switch(c.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(i.outputs,c)}catch(F){}break;case 4:{let F=Lm(c.slice(0,4)),j=NPs[F];if(j)g=this._abiCoder.decode(j.inputs,c.slice(4)),w=j.name,N=j.signature,j.reason&&(f=g[0]),w==="Error"?l=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(g[0])}`:w==="Panic"&&(l=`; VM Exception while processing transaction: reverted with panic code ${g[0]}`);else try{let te=this.getError(F);g=this._abiCoder.decode(te.inputs,c.slice(4)),w=te.name,N=te.format()}catch(te){}break}}return Uy.throwError("call revert exception"+l,dd.errors.CALL_EXCEPTION,{method:i.format(),data:Lm(A),errorArgs:g,errorName:w,errorSignature:N,reason:f})}encodeFunctionResult(i,A){return typeof i=="string"&&(i=this.getFunction(i)),Lm(this._abiCoder.encode(i.outputs,A||[]))}encodeFilterTopics(i,A){typeof i=="string"&&(i=this.getEvent(i)),A.length>i.inputs.length&&Uy.throwError("too many arguments for "+i.format(),dd.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:A});let c=[];i.anonymous||c.push(this.getEventTopic(i));let f=(l,g)=>l.type==="string"?M6t(g):l.type==="bytes"?kqe(Lm(g)):(l.type==="bool"&&typeof g=="boolean"&&(g=g?"0x01":"0x00"),l.type.match(/^u?int/)&&(g=Vg.from(g).toHexString()),l.type==="address"&&this._abiCoder.encode(["address"],[g]),Jti(Lm(g),32));for(A.forEach((l,g)=>{let w=i.inputs[g];if(!w.indexed){l!=null&&Uy.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+w.name,l);return}l==null?c.push(null):w.baseType==="array"||w.baseType==="tuple"?Uy.throwArgumentError("filtering with tuples or arrays not supported","contract."+w.name,l):Array.isArray(l)?c.push(l.map(N=>f(w,N))):c.push(f(w,l))});c.length&&c[c.length-1]===null;)c.pop();return c}encodeEventLog(i,A){typeof i=="string"&&(i=this.getEvent(i));let c=[],f=[],l=[];return i.anonymous||c.push(this.getEventTopic(i)),A.length!==i.inputs.length&&Uy.throwArgumentError("event arguments/values mismatch","values",A),i.inputs.forEach((g,w)=>{let N=A[w];if(g.indexed)if(g.type==="string")c.push(M6t(N));else if(g.type==="bytes")c.push(kqe(N));else{if(g.baseType==="tuple"||g.baseType==="array")throw new Error("not implemented");c.push(this._abiCoder.encode([g.type],[N]))}else f.push(g),l.push(N)}),{data:this._abiCoder.encode(f,l),topics:c}}decodeEventLog(i,A,c){if(typeof i=="string"&&(i=this.getEvent(i)),c!=null&&!i.anonymous){let v=this.getEventTopic(i);(!kD(c[0],32)||c[0].toLowerCase()!==v)&&Uy.throwError("fragment/topic mismatch",dd.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:v,value:c[0]}),c=c.slice(1)}let f=[],l=[],g=[];i.inputs.forEach((v,ne)=>{v.indexed?v.type==="string"||v.type==="bytes"||v.baseType==="tuple"||v.baseType==="array"?(f.push(eT.fromObject({type:"bytes32",name:v.name})),g.push(!0)):(f.push(v),g.push(!1)):(l.push(v),g.push(!1))});let w=c!=null?this._abiCoder.decode(f,iwe(c)):null,N=this._abiCoder.decode(l,A,!0),F=[],j=0,te=0;i.inputs.forEach((v,ne)=>{if(v.indexed)if(w==null)F[ne]=new Dqe({_isIndexed:!0,hash:null});else if(g[ne])F[ne]=new Dqe({_isIndexed:!0,hash:w[te++]});else try{F[ne]=w[te++]}catch(Z){F[ne]=Z}else try{F[ne]=N[j++]}catch(Z){F[ne]=Z}if(v.name&&F[v.name]==null){let Z=F[ne];Z instanceof Error?Object.defineProperty(F,v.name,{enumerable:!0,get:()=>{throw Pti(`property ${JSON.stringify(v.name)}`,Z)}}):F[v.name]=Z}});for(let v=0;v<F.length;v++){let ne=F[v];ne instanceof Error&&Object.defineProperty(F,v,{enumerable:!0,get:()=>{throw Pti(`index ${v}`,ne)}})}return Object.freeze(F)}parseTransaction(i){let A=this.getFunction(i.data.substring(0,10).toLowerCase());return A?new XCn({args:this._abiCoder.decode(A.inputs,"0x"+i.data.substring(10)),functionFragment:A,name:A.name,signature:A.format(),sighash:this.getSighash(A),value:Vg.from(i.value||"0")}):null}parseLog(i){let A=this.getEvent(i.topics[0]);return!A||A.anonymous?null:new ZCn({eventFragment:A,name:A.name,signature:A.format(),topic:this.getEventTopic(A),args:this.decodeEventLog(A,i.data,i.topics)})}parseError(i){let A=Lm(i),c=this.getError(A.substring(0,10).toLowerCase());return c?new $Cn({args:this._abiCoder.decode(c.inputs,"0x"+A.substring(10)),errorFragment:c,name:c.name,signature:c.format(),sighash:this.getSighash(c)}):null}static isInterface(i){return!!(i&&i._isInterface)}},xPs="abstract-provider/5.7.0",MPs=function(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})},TPs=new dd(xPs),jCn=class e{constructor(){TPs.checkAbstract(new.target,e),yd(this,"_isProvider",!0)}getFeeData(){return MPs(this,void 0,void 0,function*(){let{block:i,gasPrice:A}=yield moe({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(g=>null)}),c=null,f=null,l=null;return i&&i.baseFeePerGas&&(c=i.baseFeePerGas,l=Vg.from("1500000000"),f=i.baseFeePerGas.mul(2).add(l)),{lastBaseFeePerGas:c,maxFeePerGas:f,maxPriorityFeePerGas:l,gasPrice:A}})}addListener(i,A){return this.on(i,A)}removeListener(i,A){return this.off(i,A)}static isProvider(i){return!!(i&&i._isProvider)}},UPs="abstract-signer/5.7.0",XF=function(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})},jM=new dd(UPs),FPs=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],JPs=[dd.errors.INSUFFICIENT_FUNDS,dd.errors.NONCE_EXPIRED,dd.errors.REPLACEMENT_UNDERPRICED],K6t=class e{constructor(){jM.checkAbstract(new.target,e),yd(this,"_isSigner",!0)}getBalance(i){return XF(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),i)})}getTransactionCount(i){return XF(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),i)})}estimateGas(i){return XF(this,void 0,void 0,function*(){this._checkProvider("estimateGas");let A=yield moe(this.checkTransaction(i));return yield this.provider.estimateGas(A)})}call(i,A){return XF(this,void 0,void 0,function*(){this._checkProvider("call");let c=yield moe(this.checkTransaction(i));return yield this.provider.call(c,A)})}sendTransaction(i){return XF(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");let A=yield this.populateTransaction(i),c=yield this.signTransaction(A);return yield this.provider.sendTransaction(c)})}getChainId(){return XF(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return XF(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return XF(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(i){return XF(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(i)})}checkTransaction(i){for(let c in i)FPs.indexOf(c)===-1&&jM.throwArgumentError("invalid transaction key: "+c,"transaction",i);let A=owe(i);return A.from==null?A.from=this.getAddress():A.from=Promise.all([Promise.resolve(A.from),this.getAddress()]).then(c=>(c[0].toLowerCase()!==c[1].toLowerCase()&&jM.throwArgumentError("from address mismatch","transaction",i),c[0])),A}populateTransaction(i){return XF(this,void 0,void 0,function*(){let A=yield moe(this.checkTransaction(i));A.to!=null&&(A.to=Promise.resolve(A.to).then(f=>XF(this,void 0,void 0,function*(){if(f==null)return null;let l=yield this.resolveName(f);return l==null&&jM.throwArgumentError("provided ENS name resolves to null","tx.to",f),l})),A.to.catch(f=>{}));let c=A.maxFeePerGas!=null||A.maxPriorityFeePerGas!=null;if(A.gasPrice!=null&&(A.type===2||c)?jM.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",i):(A.type===0||A.type===1)&&c&&jM.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",i),(A.type===2||A.type==null)&&A.maxFeePerGas!=null&&A.maxPriorityFeePerGas!=null)A.type=2;else if(A.type===0||A.type===1)A.gasPrice==null&&(A.gasPrice=this.getGasPrice());else{let f=yield this.getFeeData();if(A.type==null)if(f.maxFeePerGas!=null&&f.maxPriorityFeePerGas!=null)if(A.type=2,A.gasPrice!=null){let l=A.gasPrice;delete A.gasPrice,A.maxFeePerGas=l,A.maxPriorityFeePerGas=l}else A.maxFeePerGas==null&&(A.maxFeePerGas=f.maxFeePerGas),A.maxPriorityFeePerGas==null&&(A.maxPriorityFeePerGas=f.maxPriorityFeePerGas);else f.gasPrice!=null?(c&&jM.throwError("network does not support EIP-1559",dd.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),A.gasPrice==null&&(A.gasPrice=f.gasPrice),A.type=0):jM.throwError("failed to get consistent fee data",dd.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else A.type===2&&(A.maxFeePerGas==null&&(A.maxFeePerGas=f.maxFeePerGas),A.maxPriorityFeePerGas==null&&(A.maxPriorityFeePerGas=f.maxPriorityFeePerGas))}return A.nonce==null&&(A.nonce=this.getTransactionCount("pending")),A.gasLimit==null&&(A.gasLimit=this.estimateGas(A).catch(f=>{if(JPs.indexOf(f.code)>=0)throw f;return jM.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",dd.errors.UNPREDICTABLE_GAS_LIMIT,{error:f,tx:A})})),A.chainId==null?A.chainId=this.getChainId():A.chainId=Promise.all([Promise.resolve(A.chainId),this.getChainId()]).then(f=>(f[1]!==0&&f[0]!==f[1]&&jM.throwArgumentError("chainId address mismatch","transaction",i),f[0])),yield moe(A)})}_checkProvider(i){this.provider||jM.throwError("missing provider",dd.errors.UNSUPPORTED_OPERATION,{operation:i||"_checkProvider"})}static isSigner(i){return!!(i&&i._isSigner)}},e3n=class e extends K6t{constructor(i,A){super(),yd(this,"address",i),yd(this,"provider",A||null)}getAddress(){return Promise.resolve(this.address)}_fail(i,A){return Promise.resolve().then(()=>{jM.throwError(i,dd.errors.UNSUPPORTED_OPERATION,{operation:A})})}signMessage(i){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(i){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(i,A,c){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(i){return new e(this.address,i)}},HPs="transactions/5.7.0",$ti=new dd(HPs),Oti;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(Oti||(Oti={}));function MCn(e,i){return{address:mW(e),storageKeys:(i||[]).map((A,c)=>(Z9s(A)!==32&&$ti.throwArgumentError("invalid access list storageKey",`accessList[${e}:${c}]`,A),A.toLowerCase()))}}function LPs(e){if(Array.isArray(e))return e.map((A,c)=>Array.isArray(A)?(A.length>2&&$ti.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${c}]`,A),MCn(A[0],A[1])):MCn(A.address,A.storageKeys));let i=Object.keys(e).map(A=>{let c=e[A].reduce((f,l)=>(f[l]=!0,f),{});return MCn(A,Object.keys(c).sort())});return i.sort((A,c)=>A.address.localeCompare(c.address)),i}var GPs="contracts/5.7.0",ile=function(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})},Gm=new dd(GPs);function Y6t(e,i){return ile(this,void 0,void 0,function*(){let A=yield i;typeof A!="string"&&Gm.throwArgumentError("invalid address or ENS name","name",A);try{return mW(A)}catch(f){}e||Gm.throwError("a provider or signer is needed to resolve ENS names",dd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});let c=yield e.resolveName(A);return c==null&&Gm.throwArgumentError("resolver or addr is not configured for ENS name","name",A),c})}function F6t(e,i,A){return ile(this,void 0,void 0,function*(){return Array.isArray(A)?yield Promise.all(A.map((c,f)=>F6t(e,Array.isArray(i)?i[f]:i[c.name],c))):A.type==="address"?yield Y6t(e,i):A.type==="tuple"?yield F6t(e,i,A.components):A.baseType==="array"?Array.isArray(i)?yield Promise.all(i.map(c=>F6t(e,c,A.arrayChildren))):Promise.reject(Gm.makeError("invalid value for array",dd.errors.INVALID_ARGUMENT,{argument:"value",value:i})):i})}function X6t(e,i,A){return ile(this,void 0,void 0,function*(){let c={};A.length===i.inputs.length+1&&typeof A[A.length-1]=="object"&&(c=owe(A.pop())),Gm.checkArgumentCount(A.length,i.inputs.length,"passed to contract"),e.signer?c.from?c.from=moe({override:Y6t(e.signer,c.from),signer:e.signer.getAddress()}).then(F=>ile(this,void 0,void 0,function*(){return mW(F.signer)!==F.override&&Gm.throwError("Contract with a Signer cannot override from",dd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),F.override})):c.from=e.signer.getAddress():c.from&&(c.from=Y6t(e.provider,c.from));let f=yield moe({args:F6t(e.signer||e.provider,A,i.inputs),address:e.resolvedAddress,overrides:moe(c)||{}}),l=e.interface.encodeFunctionData(i,f.args),g={data:l,to:f.address},w=f.overrides;if(w.nonce!=null&&(g.nonce=Vg.from(w.nonce).toNumber()),w.gasLimit!=null&&(g.gasLimit=Vg.from(w.gasLimit)),w.gasPrice!=null&&(g.gasPrice=Vg.from(w.gasPrice)),w.maxFeePerGas!=null&&(g.maxFeePerGas=Vg.from(w.maxFeePerGas)),w.maxPriorityFeePerGas!=null&&(g.maxPriorityFeePerGas=Vg.from(w.maxPriorityFeePerGas)),w.from!=null&&(g.from=w.from),w.type!=null&&(g.type=w.type),w.accessList!=null&&(g.accessList=LPs(w.accessList)),g.gasLimit==null&&i.gas!=null){let F=21e3,j=T3(l);for(let te=0;te<j.length;te++)F+=4,j[te]&&(F+=64);g.gasLimit=Vg.from(i.gas).add(F)}if(w.value){let F=Vg.from(w.value);!F.isZero()&&!i.payable&&Gm.throwError("non-payable method cannot override value",dd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:c.value}),g.value=F}w.customData&&(g.customData=owe(w.customData)),w.ccipReadEnabled&&(g.ccipReadEnabled=!!w.ccipReadEnabled),delete c.nonce,delete c.gasLimit,delete c.gasPrice,delete c.from,delete c.value,delete c.type,delete c.accessList,delete c.maxFeePerGas,delete c.maxPriorityFeePerGas,delete c.customData,delete c.ccipReadEnabled;let N=Object.keys(c).filter(F=>c[F]!=null);return N.length&&Gm.throwError(`cannot override ${N.map(F=>JSON.stringify(F)).join(",")}`,dd.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:N}),g})}function qPs(e,i){return function(...A){return X6t(e,i,A)}}function KPs(e,i){let A=e.signer||e.provider;return function(...c){return ile(this,void 0,void 0,function*(){A||Gm.throwError("estimate require a provider or signer",dd.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});let f=yield X6t(e,i,c);return yield A.estimateGas(f)})}}function YPs(e,i){let A=i.wait.bind(i);i.wait=c=>A(c).then(f=>(f.events=f.logs.map(l=>{let g=Bqe(l),w=null;try{w=e.interface.parseLog(l)}catch(N){}return w&&(g.args=w.args,g.decode=(N,F)=>e.interface.decodeEventLog(w.eventFragment,N,F),g.event=w.name,g.eventSignature=w.signature),g.removeListener=()=>e.provider,g.getBlock=()=>e.provider.getBlock(f.blockHash),g.getTransaction=()=>e.provider.getTransaction(f.transactionHash),g.getTransactionReceipt=()=>Promise.resolve(f),g}),f))}function jti(e,i,A){let c=e.signer||e.provider;return function(...f){return ile(this,void 0,void 0,function*(){let l;if(f.length===i.inputs.length+1&&typeof f[f.length-1]=="object"){let N=owe(f.pop());N.blockTag!=null&&(l=yield N.blockTag),delete N.blockTag,f.push(N)}e.deployTransaction!=null&&(yield e._deployed(l));let g=yield X6t(e,i,f),w=yield c.call(g,l);try{let N=e.interface.decodeFunctionResult(i,w);return A&&i.outputs.length===1&&(N=N[0]),N}catch(N){throw N.code===dd.errors.CALL_EXCEPTION&&(N.address=e.address,N.args=f,N.transaction=g),N}})}}function VPs(e,i){return function(...A){return ile(this,void 0,void 0,function*(){e.signer||Gm.throwError("sending a transaction requires a signer",dd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),e.deployTransaction!=null&&(yield e._deployed());let c=yield X6t(e,i,A),f=yield e.signer.sendTransaction(c);return YPs(e,f),f})}}function Nti(e,i,A){return i.constant?jti(e,i,A):VPs(e,i)}function eni(e){return e.address&&(e.topics==null||e.topics.length===0)?"*":(e.address||"*")+"@"+(e.topics?e.topics.map(i=>Array.isArray(i)?i.join("|"):i).join(":"):"")}var ole=class{constructor(i,A){yd(this,"tag",i),yd(this,"filter",A),this._listeners=[]}addListener(i,A){this._listeners.push({listener:i,once:A})}removeListener(i){let A=!1;this._listeners=this._listeners.filter(c=>A||c.listener!==i?!0:(A=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(i=>i.listener)}listenerCount(){return this._listeners.length}run(i){let A=this.listenerCount();return this._listeners=this._listeners.filter(c=>{let f=i.slice();return setTimeout(()=>{c.listener.apply(this,f)},0),!c.once}),A}prepareEvent(i){}getEmit(i){return[i]}},t3n=class extends ole{constructor(){super("error",null)}},V6t=class extends ole{constructor(i,A,c,f){let l={address:i},g=A.getEventTopic(c);f?(g!==f[0]&&Gm.throwArgumentError("topic mismatch","topics",f),l.topics=f.slice()):l.topics=[g],super(eni(l),l),yd(this,"address",i),yd(this,"interface",A),yd(this,"fragment",c)}prepareEvent(i){super.prepareEvent(i),i.event=this.fragment.name,i.eventSignature=this.fragment.format(),i.decode=(A,c)=>this.interface.decodeEventLog(this.fragment,A,c);try{i.args=this.interface.decodeEventLog(this.fragment,i.data,i.topics)}catch(A){i.args=null,i.decodeError=A}}getEmit(i){let A=dPs(i.args);if(A.length)throw A[0].error;let c=(i.args||[]).slice();return c.push(i),c}},z6t=class extends ole{constructor(i,A){super("*",{address:i}),yd(this,"address",i),yd(this,"interface",A)}prepareEvent(i){super.prepareEvent(i);try{let A=this.interface.parseLog(i);i.event=A.name,i.eventSignature=A.signature,i.decode=(c,f)=>this.interface.decodeEventLog(A.eventFragment,c,f),i.args=A.args}catch(A){}}},n3n=class{constructor(i,A,c){yd(this,"interface",Cqe(new.target,"getInterface")(A)),c==null?(yd(this,"provider",null),yd(this,"signer",null)):K6t.isSigner(c)?(yd(this,"provider",c.provider||null),yd(this,"signer",c)):jCn.isProvider(c)?(yd(this,"provider",c),yd(this,"signer",null)):Gm.throwArgumentError("invalid signer or provider","signerOrProvider",c),yd(this,"callStatic",{}),yd(this,"estimateGas",{}),yd(this,"functions",{}),yd(this,"populateTransaction",{}),yd(this,"filters",{});{let g={};Object.keys(this.interface.events).forEach(w=>{let N=this.interface.events[w];yd(this.filters,w,(...F)=>({address:this.address,topics:this.interface.encodeFilterTopics(N,F)})),g[N.name]||(g[N.name]=[]),g[N.name].push(w)}),Object.keys(g).forEach(w=>{let N=g[w];N.length===1?yd(this.filters,w,this.filters[N[0]]):Gm.warn(`Duplicate definition of ${w} (${N.join(", ")})`)})}if(yd(this,"_runningEvents",{}),yd(this,"_wrappedEmits",{}),i==null&&Gm.throwArgumentError("invalid contract address or ENS name","addressOrName",i),yd(this,"address",i),this.provider)yd(this,"resolvedAddress",Y6t(this.provider,i));else try{yd(this,"resolvedAddress",Promise.resolve(mW(i)))}catch(g){Gm.throwError("provider is required to use ENS name as contract address",dd.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(g=>{});let f={},l={};Object.keys(this.interface.functions).forEach(g=>{let w=this.interface.functions[g];if(l[g]){Gm.warn(`Duplicate ABI entry for ${JSON.stringify(g)}`);return}l[g]=!0;{let N=w.name;f[`%${N}`]||(f[`%${N}`]=[]),f[`%${N}`].push(g)}this[g]==null&&yd(this,g,Nti(this,w,!0)),this.functions[g]==null&&yd(this.functions,g,Nti(this,w,!1)),this.callStatic[g]==null&&yd(this.callStatic,g,jti(this,w,!0)),this.populateTransaction[g]==null&&yd(this.populateTransaction,g,qPs(this,w)),this.estimateGas[g]==null&&yd(this.estimateGas,g,KPs(this,w))}),Object.keys(f).forEach(g=>{let w=f[g];if(w.length>1)return;g=g.substring(1);let N=w[0];try{this[g]==null&&yd(this,g,this[N])}catch(F){}this.functions[g]==null&&yd(this.functions,g,this.functions[N]),this.callStatic[g]==null&&yd(this.callStatic,g,this.callStatic[N]),this.populateTransaction[g]==null&&yd(this.populateTransaction,g,this.populateTransaction[N]),this.estimateGas[g]==null&&yd(this.estimateGas,g,this.estimateGas[N])})}static getContractAddress(i){return IPs(i)}static getInterface(i){return q6t.isInterface(i)?i:new q6t(i)}deployed(){return this._deployed()}_deployed(i){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,i).then(A=>(A==="0x"&&Gm.throwError("contract not deployed",dd.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(i){this.signer||Gm.throwError("sending a transactions require a signer",dd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});let A=owe(i||{});return["from","to"].forEach(function(c){A[c]!=null&&Gm.throwError("cannot override "+c,dd.errors.UNSUPPORTED_OPERATION,{operation:c})}),A.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(A))}connect(i){typeof i=="string"&&(i=new e3n(i,this.provider));let A=new this.constructor(this.address,this.interface,i);return this.deployTransaction&&yd(A,"deployTransaction",this.deployTransaction),A}attach(i){return new this.constructor(i,this.interface,this.signer||this.provider)}static isIndexed(i){return Dqe.isIndexed(i)}_normalizeRunningEvent(i){return this._runningEvents[i.tag]?this._runningEvents[i.tag]:i}_getRunningEvent(i){if(typeof i=="string"){if(i==="error")return this._normalizeRunningEvent(new t3n);if(i==="event")return this._normalizeRunningEvent(new ole("event",null));if(i==="*")return this._normalizeRunningEvent(new z6t(this.address,this.interface));let A=this.interface.getEvent(i);return this._normalizeRunningEvent(new V6t(this.address,this.interface,A))}if(i.topics&&i.topics.length>0){try{let c=i.topics[0];if(typeof c!="string")throw new Error("invalid topic");let f=this.interface.getEvent(c);return this._normalizeRunningEvent(new V6t(this.address,this.interface,f,i.topics))}catch(c){}let A={address:this.address,topics:i.topics};return this._normalizeRunningEvent(new ole(eni(A),A))}return this._normalizeRunningEvent(new z6t(this.address,this.interface))}_checkRunningEvents(i){if(i.listenerCount()===0){delete this._runningEvents[i.tag];let A=this._wrappedEmits[i.tag];A&&i.filter&&(this.provider.off(i.filter,A),delete this._wrappedEmits[i.tag])}}_wrapEvent(i,A,c){let f=Bqe(A);return f.removeListener=()=>{c&&(i.removeListener(c),this._checkRunningEvents(i))},f.getBlock=()=>this.provider.getBlock(A.blockHash),f.getTransaction=()=>this.provider.getTransaction(A.transactionHash),f.getTransactionReceipt=()=>this.provider.getTransactionReceipt(A.transactionHash),i.prepareEvent(f),f}_addEventListener(i,A,c){if(this.provider||Gm.throwError("events require a provider or a signer with a provider",dd.errors.UNSUPPORTED_OPERATION,{operation:"once"}),i.addListener(A,c),this._runningEvents[i.tag]=i,!this._wrappedEmits[i.tag]){let f=l=>{let g=this._wrapEvent(i,l,A);if(g.decodeError==null)try{let w=i.getEmit(g);this.emit(i.filter,...w)}catch(w){g.decodeError=w.error}i.filter!=null&&this.emit("event",g),g.decodeError!=null&&this.emit("error",g.decodeError,g)};this._wrappedEmits[i.tag]=f,i.filter!=null&&this.provider.on(i.filter,f)}}queryFilter(i,A,c){let f=this._getRunningEvent(i),l=owe(f.filter);return typeof A=="string"&&kD(A,32)?(c!=null&&Gm.throwArgumentError("cannot specify toBlock with blockhash","toBlock",c),l.blockHash=A):(l.fromBlock=A!=null?A:0,l.toBlock=c!=null?c:"latest"),this.provider.getLogs(l).then(g=>g.map(w=>this._wrapEvent(f,w,null)))}on(i,A){return this._addEventListener(this._getRunningEvent(i),A,!1),this}once(i,A){return this._addEventListener(this._getRunningEvent(i),A,!0),this}emit(i,...A){if(!this.provider)return!1;let c=this._getRunningEvent(i),f=c.run(A)>0;return this._checkRunningEvents(c),f}listenerCount(i){return this.provider?i==null?Object.keys(this._runningEvents).reduce((A,c)=>A+this._runningEvents[c].listenerCount(),0):this._getRunningEvent(i).listenerCount():0}listeners(i){if(!this.provider)return[];if(i==null){let A=[];for(let c in this._runningEvents)this._runningEvents[c].listeners().forEach(f=>{A.push(f)});return A}return this._getRunningEvent(i).listeners()}removeAllListeners(i){if(!this.provider)return this;if(i==null){for(let c in this._runningEvents){let f=this._runningEvents[c];f.removeAllListeners(),this._checkRunningEvents(f)}return this}let A=this._getRunningEvent(i);return A.removeAllListeners(),this._checkRunningEvents(A),this}off(i,A){if(!this.provider)return this;let c=this._getRunningEvent(i);return c.removeListener(A),this._checkRunningEvents(c),this}removeListener(i,A){return this.off(i,A)}},r3n=class extends n3n{},zPs="ethers/5.7.2";new dd(zPs);function WPs(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var ZPs=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"success",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"success",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"success",type:"bool"}],stateMutability:"nonpayable",type:"function"}];Vg.from(2).pow(256).sub(1);var XPs=({provider:e,contractAddress:i,spenderAddress:A,fromAddress:c,amount:f})=>WPs(void 0,void 0,void 0,function*(){var l;let g=Vg.from((l=f==null?void 0:f.amount().toFixed())!==null&&l!==void 0?l:1),N=yield new r3n(i,ZPs,e).allowance(c,A);return g.lte(N)}),i3n=class{constructor(i){if(this.clients=i,this.network=eo.Mainnet,Object.values(i).length){let A=Object.values(i)[0].getNetwork();if(!Object.values(i).every(c=>c.getNetwork()===A))throw Error("Clients not working on the same network");this.network=A}}getNetwork(){return this.network}setNetwork(i){Object.values(this.clients).forEach(A=>A.setNetwork(i)),this.network=i}addClient(i,A){if(i in this.clients)return!1;let c=A.getNetwork();if(!Object.values(this.clients).length)this.network=c;else if(this.network!==c)throw Error(`Trying to add client in different network. Expected ${this.network} but got ${c}`);return this.clients[i]=A,!0}purgeClient(i){try{return this.getClient(i).purgeClient(),delete this.clients[i],!0}catch(A){return!1}}purgeWallet(){try{return Object.values(this.clients).map(i=>{i.purgeClient()}),this.clients={},!0}catch(i){return!1}}getAddress(i){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getAddressAsync()})}getAddresses(i){return Vm(this,void 0,void 0,function*(){let A=i||Object.keys(this.clients),c=A.map(g=>this.getAddress(g)),f={};return(yield Promise.all(c)).map((g,w)=>{f[A[w]]=g}),f})}validateAddress(i,A){return this.getClient(i).validateAddress(A)}getBalance(i,A){return Vm(this,void 0,void 0,function*(){let c=this.getClient(i);return c.getBalance(yield c.getAddressAsync(),A)})}getBalances(i){return Vm(this,void 0,void 0,function*(){let A=i?Array.from(new Set(i.map(g=>g.chain))):Object.keys(this.clients),c=A.map(g=>Vm(this,void 0,void 0,function*(){return yield this.getBalance(g,i==null?void 0:i.filter(w=>w.chain===g))})),f={};return(yield Promise.all(c)).map((g,w)=>{f[A[w]]=g}),f})}getTransactionData(i,A){return Vm(this,void 0,void 0,function*(){return yield this.getClient(i).getTransactionData(A)})}getTransactionsHistory(i){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getTransactions()})}getTransactionsHistories(i){return Vm(this,void 0,void 0,function*(){let A=i||Object.keys(this.clients),c=A.map(g=>Vm(this,void 0,void 0,function*(){return this.getTransactionsHistory(g)})),f={};return(yield Promise.all(c)).map((g,w)=>{f[A[w]]=g}),f})}getExplorerUrl(i){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getExplorerUrl()})}getExplorerAddressUrl(i,A){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getExplorerAddressUrl(A)})}getExplorerTxUrl(i,A){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getExplorerTxUrl(A)})}getGasFeeRates(i){return Vm(this,void 0,void 0,function*(){let A=this.getClient(i);if(!this.isEvmClient(A))throw Error(`Can not get gas with ${i} client`);return A.estimateGasPrices()})}getFeeRates(i,A){return Vm(this,void 0,void 0,function*(){let c=this.getClient(i);if(this.isEvmClient(c))return c.estimateGasPrices(A);if(this.isUtxoClient(c)){let f=yield c.getFeeRates(A),l=c.getAssetInfo().decimal;return{[sd.Average]:nle(f[sd.Average],l),[sd.Fast]:nle(f[sd.Fast],l),[sd.Fastest]:nle(f[sd.Fastest],l)}}throw Error(`getFeeRates method not supported in ${i} chain`)})}estimateTransferFees(i){return Vm(this,void 0,void 0,function*(){let A=this.getClient(i.asset.chain);if(this.isEvmClient(A)){if(!this.isEvmTxParams(i))throw Error(`Invalid params for estimating ${i.asset.chain} transfer`);return A.getFees(i)}if(this.isUtxoClient(A)){if(!this.isUtxoTxParams(i))throw Error(`Invalid params for estimating ${i.asset.chain} transfer`);let c;try{c=yield this.getAddress(i.asset.chain)}catch(f){}return A.getFees({sender:c,memo:i.memo})}return A.getFees()})}transfer(i){return Vm(this,void 0,void 0,function*(){let A=this.getClient(i.asset.chain);if(this.isEvmClient(A)){if(!this.isEvmTxParams(i))throw Error(`Invalid params for ${i.asset.chain} transfer`);return A.transfer({walletIndex:i.walletIndex,asset:i.asset,amount:i.amount,recipient:i.recipient,memo:i.memo,gasPrice:i.gasPrice})}if(this.isUtxoClient(A)){if(!this.isUtxoTxParams(i))throw Error(`Invalid params for ${i.asset.chain} transfer`);return A.transfer({walletIndex:i.walletIndex,asset:i.asset,amount:i.amount,recipient:i.recipient,memo:i.memo,feeRate:i.feeRate?i.feeRate.amount().toNumber():void 0})}return A.transfer({walletIndex:i.walletIndex,asset:i.asset,amount:i.amount,recipient:i.recipient,memo:i.memo})})}deposit({asset:i,amount:A,memo:c,walletIndex:f,sequence:l,gasLimit:g,chain:w}){return Vm(this,void 0,void 0,function*(){let N=this.getClient(w);if(!("deposit"in N))throw Error(`Can not deposit with ${w} client`);return N.deposit({asset:i,amount:A,memo:c,walletIndex:f,sequence:l,gasLimit:g})})}approve(i,A,c){return Vm(this,void 0,void 0,function*(){let f=this.getClient(i.chain);if(!this.isEvmClient(f))throw Error("Can not make approve over non EVM client");if(i.chain===i.ticker)throw Error("Can not make approve over native asset");let l=mti(i);return yield f.approve({contractAddress:l,amount:A,spenderAddress:c})})}isApproved(i,A,c,f){return Vm(this,void 0,void 0,function*(){let l=this.getClient(i.chain);if(!this.isEvmClient(l))throw Error("Can not validate approve over non EVM client");if(i.chain===i.ticker)throw Error("Can not validate approve over native asset");let g=mti(i);return XPs({provider:l.getProvider(),amount:A,spenderAddress:f,contractAddress:g,fromAddress:c})})}broadcast(i,A){return Vm(this,void 0,void 0,function*(){return this.getClient(i).broadcastTx(A)})}getChainWallet(i){let A=this.getClient(i);if(!this.isEvmClient(A))throw Error(`Can not get wallet of ${i} client`);return A.getWallet()}getClient(i){let A=this.clients[i];if(!A)throw Error(`Client not found for ${i} chain`);return A}isEvmTxParams(i){return!("feeRate"in i)}isUtxoTxParams(i){return!("gasPrice"in i)}isEvmClient(i){return"estimateGasPrices"in i}isUtxoClient(i){return"getFeeRates"in i}},tni=e=>[rV.chain,_6e.chain,kre.chain].includes(e),nni=e=>tni(e.chain)?[rV,kre,_6e].findIndex(i=>Fy(i,e))===-1&&!e.synth:!1,$Ps=e=>[WJe.chain,Xue.chain].includes(e),xw=class{static makeAction(i){return pm(this,void 0,void 0,function*(){return this.isNonProtocolParams(i)?this.makeNonProtocolAction(i):this.makeProtocolAction(i)})}static makeProtocolAction({wallet:i,assetAmount:A,memo:c}){return pm(this,void 0,void 0,function*(){let f=yield i.deposit({chain:vU,asset:A.asset,amount:A.baseAmount,memo:c});return{hash:f,url:yield i.getExplorerTxUrl(vU,f)}})}static makeNonProtocolAction({wallet:i,assetAmount:A,recipient:c,memo:f}){return pm(this,void 0,void 0,function*(){if(!nni(A.asset)){if($Ps(A.asset.chain)){let E=yield i.transfer({asset:A.asset,amount:A.baseAmount,recipient:c,memo:f});return{hash:E,url:yield i.getExplorerTxUrl(A.asset.chain,E)}}let M=yield i.getFeeRates(A.asset.chain,gX.THORCHAIN),U=yield i.transfer(tni(A.asset.chain)?{asset:A.asset,amount:A.baseAmount,recipient:c,memo:f,gasPrice:M.fast}:{asset:A.asset,amount:A.baseAmount,recipient:c,memo:f,feeRate:M.fast});return{hash:U,url:yield i.getExplorerTxUrl(A.asset.chain,U)}}let g=yield new tle(new Iqe(new mqe(i.getNetwork()))).getChainInboundDetails(A.asset.chain);if(!g.router)throw Error(`Unknown router for ${A.asset.chain} chain`);let w=Nqe(A.asset),N=hti.utils.getAddress(w),F=Math.floor(new Date(new Date().getTime()+15*6e4).getTime()/1e3),j=[c,N,A.baseAmount.amount().toFixed(),f,F],te=new hti.Contract(g.router,ant.router),v=i.getChainWallet(A.asset.chain),ne=yield i.getFeeRates(A.asset.chain),Z=yield te.populateTransaction.depositWithExpiry(...j,{from:i.getAddress(A.asset.chain),value:0,gasPrice:ne.fast.amount().toFixed(),gasLimit:"160000"}),{hash:R}=yield v.sendTransaction(Z);return{hash:R,url:yield i.getExplorerTxUrl(A.asset.chain,R)}})}static isNonProtocolParams(i){if((i.assetAmount.asset.chain===vU||i.assetAmount.asset.synth)&&"address"in i&&i.address)throw Error("Inconsistent params. Native actions do not support recipient");return i.assetAmount.asset.chain!==vU&&!i.assetAmount.asset.synth}},W6t=class{constructor(i=new tle,A=new i3n({BTC:new Vge(Object.assign(Object.assign({},bDe),{network:eo.Mainnet})),BCH:new pCt(Object.assign(Object.assign({},Dfn),{network:eo.Mainnet})),LTC:new f6t(Object.assign(Object.assign({},nCn),{network:eo.Mainnet})),DOGE:new d6t(Object.assign(Object.assign({},eCn),{network:eo.Mainnet})),ETH:new Ppe(Object.assign(Object.assign({},i9e),{network:eo.Mainnet})),AVAX:new jIt(Object.assign(Object.assign({},sfn),{network:eo.Mainnet})),BSC:new mCt(Object.assign(Object.assign({},Ofn),{network:eo.Mainnet})),GAIA:new NEt({network:eo.Mainnet}),BNB:new aCt({network:eo.Mainnet}),THOR:new UIe(Object.assign(Object.assign({},Kot),{network:eo.Mainnet}))})){this.thorchainQuery=i,this.wallet=A}estimateSwap({fromAddress:i,fromAsset:A,amount:c,destinationAsset:f,destinationAddress:l,affiliateAddress:g="",affiliateBps:w=0,toleranceBps:N}){return pm(this,void 0,void 0,function*(){let F=yield this.validateSwap({fromAddress:i,fromAsset:A,amount:c,destinationAsset:f,destinationAddress:l}),j=yield this.thorchainQuery.quoteSwap({fromAsset:A,amount:c,destinationAsset:f,destinationAddress:l,affiliateAddress:g,affiliateBps:w,toleranceBps:N});return j.txEstimate.errors.push(...F),j.txEstimate.canSwap=j.txEstimate.errors.length===0,j})}validateSwap({fromAsset:i,fromAddress:A,destinationAsset:c,destinationAddress:f,amount:l,affiliateAddress:g,affiliateBps:w}){return pm(this,void 0,void 0,function*(){let N=[];if(f&&!this.wallet.validateAddress(c.synth?vU:c.chain,f)&&N.push(`destinationAddress ${f} is not a valid address`),g){let F=this.wallet.validateAddress(vU,g),j=!!(yield this.thorchainQuery.thorchainCache.midgardQuery.midgardCache.midgard.getTHORNameDetails(g));F||j||N.push(`affiliateAddress ${g} is not a valid THOR address`)}if(w&&(w<0||w>1e4)&&N.push(`affiliateBps ${w} out of range [0 - 10000]`),nni(i)&&A){let F=yield this.isRouterApprovedToSpend({asset:i,address:A,amount:l});N.push(...F)}return N})}doSwap({fromAsset:i,fromAddress:A,amount:c,destinationAsset:f,destinationAddress:l,affiliateAddress:g,affiliateBps:w,toleranceBps:N}){return pm(this,void 0,void 0,function*(){let F=yield this.thorchainQuery.quoteSwap({fromAsset:i,fromAddress:A,amount:c,destinationAsset:f,destinationAddress:l,affiliateAddress:g,affiliateBps:w,toleranceBps:N});if(!F.txEstimate.canSwap)throw Error(F.txEstimate.errors.join(`
265
- `));return xw.makeAction({wallet:this.wallet,assetAmount:c,memo:F.memo,recipient:F.toAddress})})}approveRouterToSpend({asset:i,amount:A}){return pm(this,void 0,void 0,function*(){let c=yield this.thorchainQuery.getChainInboundDetails(i.chain);if(!c.router)throw Error(`Unknown router address for ${i.chain}`);let f=yield this.wallet.approve(i,(A==null?void 0:A.baseAmount)||wo(qRe.toString(),yield this.thorchainQuery.thorchainCache.midgardQuery.getDecimalForAsset(i)),c.router);return{hash:f.hash,url:yield this.wallet.getExplorerTxUrl(i.chain,f.hash)}})}isRouterApprovedToSpend({asset:i,amount:A,address:c}){return pm(this,void 0,void 0,function*(){let f=[],l=yield this.thorchainQuery.getChainInboundDetails(i.chain);if(!l.router)throw Error(`Unknown router address for ${i.chain}`);return(yield this.wallet.isApproved(i,A.baseAmount,c,l.router))||f.push("Thorchain router has not been approved to spend this amount"),f})}estimateAddLiquidity(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.estimateAddLP(i)})}estimateWithdrawLiquidity(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.estimateWithdrawLP(i)})}addLiquidityPosition(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.estimateAddLP(i);if(!A.canAdd)throw Error(`${A.errors}`);let c=(yield this.thorchainQuery.thorchainCache.getInboundDetails())[i.asset.asset.chain].address,f=yield this.wallet.getAddress(vU),l=yield this.wallet.getAddress(i.asset.asset.chain),g=[],w={asset:i.asset,rune:i.rune,waitTimeSeconds:A.estimatedWaitSeconds,assetPool:A.assetPool};return i.asset.assetAmount.gt(0)&&i.rune.assetAmount.gt(0)?(g.push(yield xw.makeAction({wallet:this.wallet,memo:`+:${A.assetPool}:${f}`,assetAmount:w.asset,recipient:c})),g.push(yield xw.makeAction({wallet:this.wallet,memo:`+:${A.assetPool}:${l}`,assetAmount:w.rune})),g):i.asset.assetAmount.gt(0)&&i.rune.assetAmount.eq(0)?(g.push(yield xw.makeAction({wallet:this.wallet,memo:`+:${A.assetPool}`,assetAmount:w.asset,recipient:c})),g):(g.push(yield xw.makeAction({wallet:this.wallet,memo:`+:${A.assetPool}`,assetAmount:w.asset})),g)})}withdrawLiquidityPosition(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.estimateWithdrawLP(i),c={assetFee:A.inbound.fees.asset,runeFee:A.inbound.fees.rune,waitTimeSeconds:A.estimatedWaitSeconds,percentage:i.percentage,assetPool:A.assetPool,assetAddress:A.assetAddress,runeAddress:A.runeAddress},f=(yield this.thorchainQuery.thorchainCache.getInboundDetails())[c.assetFee.asset.chain].address,l=(c.percentage*100).toFixed(),g=[];return c.assetAddress&&c.runeAddress?(g.push(yield xw.makeAction({wallet:this.wallet,memo:`-:${c.assetPool}:${l}`,assetAmount:c.assetFee,recipient:f})),g.push(yield xw.makeAction({wallet:this.wallet,memo:`-:${c.assetPool}:${l}`,assetAmount:c.runeFee})),g):c.assetAddress&&!c.runeAddress?(g.push(yield xw.makeAction({wallet:this.wallet,memo:`-:${c.assetPool}:${l}`,assetAmount:c.assetFee,recipient:f})),g):(g.push(yield xw.makeAction({wallet:this.wallet,memo:`-:${c.assetPool}:${l}`,assetAmount:c.runeFee})),g)})}estimateAddSaver(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.estimateAddSaver(i)})}estimateWithdrawSaver(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.estimateWithdrawSaver(i)})}getSaverPosition(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.getSaverPosition(i)})}addSaver(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.estimateAddSaver(i);if(!A.canAddSaver)throw Error("Cannot add to savers");return xw.makeAction({wallet:this.wallet,recipient:A.toAddress,assetAmount:i,memo:A.memo})})}withdrawSaver(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.estimateWithdrawSaver(i);if(A.errors.length>0)throw Error(`${A.errors}`);return xw.makeAction({wallet:this.wallet,recipient:A.toAddress,assetAmount:A.dustAmount,memo:A.memo})})}getLoanQuoteOpen(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.getLoanQuoteOpen(i)})}getLoanQuoteClose(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.getLoanQuoteClose(i)})}addLoan(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.getLoanQuoteOpen(i);if(A.errors.length>0)throw Error(`${A.errors}`);return xw.makeAction({wallet:this.wallet,memo:`${A.memo}`,recipient:`${A.inboundAddress}`,assetAmount:i.amount})})}withdrawLoan(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.getLoanQuoteClose(i);if(A.errors.length>0)throw Error(`${A.errors}`);return xw.makeAction({wallet:this.wallet,memo:`${A.memo}`,recipient:`${A.inboundAddress}`,assetAmount:i.amount})})}getThornamesByAddress(i){return pm(this,void 0,void 0,function*(){return this.thorchainQuery.thorchainCache.midgardQuery.midgardCache.midgard.getTHORNameReverseLookup(i)})}};var cwe=class{constructor(i){this.name="Thorchain";this.thorchainQuery=new tle,this.thorchainAmm=new W6t(this.thorchainQuery,i)}isAssetSupported(i){return Jt(this,null,function*(){if(Fy(i,ij))return!0;let A=yield this.thorchainQuery.thorchainCache.getPools();return Object.values(A).findIndex(c=>c.isAvailable()&&ec(i)===c.assetString)!==-1})}getSupportedChains(){return Jt(this,null,function*(){let i=yield this.thorchainQuery.thorchainCache.getInboundDetails();return[vU,...Object.values(i).map(A=>A.chain)]})}estimateSwap(i){return Jt(this,null,function*(){let A=yield this.thorchainAmm.estimateSwap(i);return{protocol:this.name,toAddress:A.toAddress,memo:A.memo,expectedAmount:A.txEstimate.netOutput,dustThreshold:A.dustThreshold,fees:A.txEstimate.totalFees,totalSwapSeconds:A.txEstimate.inboundConfirmationSeconds||0+A.txEstimate.outboundDelaySeconds,slipBasisPoints:A.txEstimate.slipBasisPoints,canSwap:A.txEstimate.canSwap,errors:A.txEstimate.errors,warning:A.txEstimate.warning}})}doSwap(i){return Jt(this,null,function*(){return this.thorchainAmm.doSwap(i)})}getSwapHistory(A){return Jt(this,arguments,function*({chainAddresses:i}){let c=yield this.thorchainQuery.getSwapHistory({addresses:Array.from(new Set(i.map(f=>f.address)))});return{count:c.count,swaps:c.swaps.map(f=>Di({protocol:this.name},f))}})}};var c3n=class{constructor(i){this.protocols=[new cwe(i),new p6e(i)]}estimateSwap(i){return Jt(this,null,function*(){let A=(l,g)=>Jt(this,null,function*(){let[w,N]=yield Promise.all([l.isAssetSupported(g.fromAsset),l.isAssetSupported(g.destinationAsset)]);if(!w)throw Error(`${ec(g.fromAsset)} not supported in ${l.name}`);if(!N)throw Error(`${ec(g.destinationAsset)} not supported in ${l.name}`);return l.estimateSwap(g)}),c=yield Promise.allSettled(this.protocols.map(l=>A(l,i))),f;if(c.forEach(l=>{l.status==="fulfilled"&&(!f||l.value.expectedAmount.assetAmount.gte(f.expectedAmount.assetAmount))&&(f=l.value)}),!f)throw Error(`Can not estimate swap from ${ec(i.fromAsset)} to ${ec(i.fromAsset)}`);return f})}doSwap(i){return Jt(this,null,function*(){let A=i.protocol?i.protocol:(yield this.estimateSwap(i)).protocol,c=this.protocols.find(f=>f.name===A);if(!c)throw Error(`${A} protocol is not supported`);return c.doSwap(i)})}getSwapHistory(i){return Jt(this,null,function*(){let A=(l,g)=>Jt(this,null,function*(){let w=yield l.getSupportedChains(),N=g.chainAddresses.filter(F=>w.findIndex(j=>j===F.chain)!==-1);return N.length===0?{swaps:[],count:0}:l.getSwapHistory({chainAddresses:N})}),c=yield Promise.allSettled(this.protocols.map(l=>A(l,i))),f=[];return c.forEach(l=>{l.status==="fulfilled"&&f.push(...l.value.swaps)}),{count:f.length,swaps:f.sort((l,g)=>g.date.getTime()-l.date.getTime())}})}};export{c3n as Aggregator};
264
+ `,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},VGr=2147483648,rRs=Math.pow(2,31)-1;function iRs(e){return pE.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)!==null}function oRs(e){return pE.UInt32(e)&&e<=rRs}var REt=class{constructor(i,A,c,f,l=0,g=0,w=0){this.__D=i,this.__Q=A,this.chainCode=c,this.network=f,this.__DEPTH=l,this.__INDEX=g,this.__PARENT_FINGERPRINT=w,pE(nRs,f),this.lowR=!1}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get publicKey(){return this.__Q===void 0&&(this.__Q=jq.pointFromScalar(this.__D,!0)),this.__Q}get privateKey(){return this.__D}get identifier(){return jpn.hash160(this.publicKey)}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return this.__D===void 0}neutered(){return PEt(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){let i=this.network,A=this.isNeutered()?i.bip32.public:i.bip32.private,c=Buffer.allocUnsafe(78);return c.writeUInt32BE(A,0),c.writeUInt8(this.depth,4),c.writeUInt32BE(this.parentFingerprint,5),c.writeUInt32BE(this.index,9),this.chainCode.copy(c,13),this.isNeutered()?this.publicKey.copy(c,45):(c.writeUInt8(0,45),this.privateKey.copy(c,46)),Mei.encode(c)}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return tRs.encode(this.network.wif,this.privateKey,!0)}derive(i){pE(pE.UInt32,i);let A=i>=VGr,c=Buffer.allocUnsafe(37);if(A){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");c[0]=0,this.privateKey.copy(c,1),c.writeUInt32BE(i,33)}else this.publicKey.copy(c,0),c.writeUInt32BE(i,33);let f=jpn.hmacSHA512(this.chainCode,c),l=f.slice(0,32),g=f.slice(32);if(!jq.isPrivate(l))return this.derive(i+1);let w;if(this.isNeutered()){let N=jq.pointAddScalar(this.publicKey,l,!0);if(N===null)return this.derive(i+1);w=PEt(N,g,this.network,this.depth+1,i,this.fingerprint.readUInt32BE(0))}else{let N=jq.privateAdd(this.privateKey,l);if(N==null)return this.derive(i+1);w=WIn(N,g,this.network,this.depth+1,i,this.fingerprint.readUInt32BE(0))}return w}deriveHardened(i){return pE(oRs,i),this.derive(i+VGr)}derivePath(i){pE(iRs,i);let A=i.split("/");if(A[0]==="m"){if(this.parentFingerprint)throw new TypeError("Expected master, got child");A=A.slice(1)}return A.reduce((c,f)=>{let l;return f.slice(-1)==="'"?(l=parseInt(f.slice(0,-1),10),c.deriveHardened(l)):(l=parseInt(f,10),c.derive(l))},this)}sign(i,A){if(!this.privateKey)throw new Error("Missing private key");if(A===void 0&&(A=this.lowR),A===!1)return jq.sign(i,this.privateKey);{let c=jq.sign(i,this.privateKey),f=Buffer.alloc(32,0),l=0;for(;c[0]>127;)l++,f.writeUIntLE(l,0,6),c=jq.signWithEntropy(i,this.privateKey,f);return c}}verify(i,A){return jq.verify(i,this.publicKey,A)}};function aRs(e,i){let A=Mei.decode(e);if(A.length!==78)throw new TypeError("Invalid buffer length");i=i||o6t;let c=A.readUInt32BE(0);if(c!==i.bip32.private&&c!==i.bip32.public)throw new TypeError("Invalid network version");let f=A[4],l=A.readUInt32BE(5);if(f===0&&l!==0)throw new TypeError("Invalid parent fingerprint");let g=A.readUInt32BE(9);if(f===0&&g!==0)throw new TypeError("Invalid index");let w=A.slice(13,45),N;if(c===i.bip32.private){if(A.readUInt8(45)!==0)throw new TypeError("Invalid private key");let F=A.slice(46,78);N=WIn(F,w,i,f,g,l)}else{let F=A.slice(45,78);N=PEt(F,w,i,f,g,l)}return N}YSe.fromBase58=aRs;function Tei(e,i,A){return WIn(e,i,A)}YSe.fromPrivateKey=Tei;function WIn(e,i,A,c,f,l){if(pE({privateKey:eyn,chainCode:eyn},{privateKey:e,chainCode:i}),A=A||o6t,!jq.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return new REt(e,void 0,i,A,c,f,l)}function sRs(e,i,A){return PEt(e,i,A)}YSe.fromPublicKey=sRs;function PEt(e,i,A,c,f,l){if(pE({publicKey:pE.BufferN(33),chainCode:eyn},{publicKey:e,chainCode:i}),A=A||o6t,!jq.isPoint(e))throw new TypeError("Point is not on the curve");return new REt(void 0,e,i,A,c,f,l)}function ARs(e,i){if(pE(pE.Buffer,e),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");i=i||o6t;let A=jpn.hmacSHA512(Buffer.from("Bitcoin seed","utf8"),e),c=A.slice(0,32),f=A.slice(32);return Tei(c,f,i)}YSe.fromSeed=ARs;Object.defineProperty(iqe,"__esModule",{value:!0});var a6t=YSe,dRs=iqe.fromSeed=a6t.fromSeed;iqe.fromBase58=a6t.fromBase58;iqe.fromPublicKey=a6t.fromPublicKey;iqe.fromPrivateKey=a6t.fromPrivateKey;var Ph={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function nM(e,i){if(!e)throw new Error(i)}function H2(e,i,A){if(nM(i instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),A!==void 0)if(Array.isArray(A)){let c=A.join(", "),f=`Expected ${e} to be an Uint8Array with length [${c}]`;nM(A.includes(i.length),f)}else{let c=`Expected ${e} to be an Uint8Array with length ${A}`;nM(i.length===A,c)}}function Tue(e){nM(K6e(e)==="Boolean","Expected compressed to be a Boolean")}function kF(e=A=>new Uint8Array(A),i){return typeof e=="function"&&(e=e(i)),H2("output",e,i),e}function K6e(e){return Object.prototype.toString.call(e).slice(8,-1)}var cRs=e=>({contextRandomize(i){switch(nM(i===null||i instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),i!==null&&H2("seed",i,32),e.contextRandomize(i)){case 1:throw new Error(Ph.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(i){return H2("private key",i,32),e.privateKeyVerify(i)===0},privateKeyNegate(i){switch(H2("private key",i,32),e.privateKeyNegate(i)){case 0:return i;case 1:throw new Error(Ph.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(i,A){switch(H2("private key",i,32),H2("tweak",A,32),e.privateKeyTweakAdd(i,A)){case 0:return i;case 1:throw new Error(Ph.TWEAK_ADD)}},privateKeyTweakMul(i,A){switch(H2("private key",i,32),H2("tweak",A,32),e.privateKeyTweakMul(i,A)){case 0:return i;case 1:throw new Error(Ph.TWEAK_MUL)}},publicKeyVerify(i){return H2("public key",i,[33,65]),e.publicKeyVerify(i)===0},publicKeyCreate(i,A=!0,c){switch(H2("private key",i,32),Tue(A),c=kF(c,A?33:65),e.publicKeyCreate(c,i)){case 0:return c;case 1:throw new Error(Ph.SECKEY_INVALID);case 2:throw new Error(Ph.PUBKEY_SERIALIZE)}},publicKeyConvert(i,A=!0,c){switch(H2("public key",i,[33,65]),Tue(A),c=kF(c,A?33:65),e.publicKeyConvert(c,i)){case 0:return c;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.PUBKEY_SERIALIZE)}},publicKeyNegate(i,A=!0,c){switch(H2("public key",i,[33,65]),Tue(A),c=kF(c,A?33:65),e.publicKeyNegate(c,i)){case 0:return c;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.IMPOSSIBLE_CASE);case 3:throw new Error(Ph.PUBKEY_SERIALIZE)}},publicKeyCombine(i,A=!0,c){nM(Array.isArray(i),"Expected public keys to be an Array"),nM(i.length>0,"Expected public keys array will have more than zero items");for(let f of i)H2("public key",f,[33,65]);switch(Tue(A),c=kF(c,A?33:65),e.publicKeyCombine(c,i)){case 0:return c;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.PUBKEY_COMBINE);case 3:throw new Error(Ph.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(i,A,c=!0,f){switch(H2("public key",i,[33,65]),H2("tweak",A,32),Tue(c),f=kF(f,c?33:65),e.publicKeyTweakAdd(f,i,A)){case 0:return f;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.TWEAK_ADD)}},publicKeyTweakMul(i,A,c=!0,f){switch(H2("public key",i,[33,65]),H2("tweak",A,32),Tue(c),f=kF(f,c?33:65),e.publicKeyTweakMul(f,i,A)){case 0:return f;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.TWEAK_MUL)}},signatureNormalize(i){switch(H2("signature",i,64),e.signatureNormalize(i)){case 0:return i;case 1:throw new Error(Ph.SIG_PARSE)}},signatureExport(i,A){H2("signature",i,64),A=kF(A,72);let c={output:A,outputlen:72};switch(e.signatureExport(c,i)){case 0:return A.slice(0,c.outputlen);case 1:throw new Error(Ph.SIG_PARSE);case 2:throw new Error(Ph.IMPOSSIBLE_CASE)}},signatureImport(i,A){switch(H2("signature",i),A=kF(A,64),e.signatureImport(A,i)){case 0:return A;case 1:throw new Error(Ph.SIG_PARSE);case 2:throw new Error(Ph.IMPOSSIBLE_CASE)}},ecdsaSign(i,A,c={},f){H2("message",i,32),H2("private key",A,32),nM(K6e(c)==="Object","Expected options to be an Object"),c.data!==void 0&&H2("options.data",c.data),c.noncefn!==void 0&&nM(K6e(c.noncefn)==="Function","Expected options.noncefn to be a Function"),f=kF(f,64);let l={signature:f,recid:null};switch(e.ecdsaSign(l,i,A,c.data,c.noncefn)){case 0:return l;case 1:throw new Error(Ph.SIGN);case 2:throw new Error(Ph.IMPOSSIBLE_CASE)}},ecdsaVerify(i,A,c){switch(H2("signature",i,64),H2("message",A,32),H2("public key",c,[33,65]),e.ecdsaVerify(i,A,c)){case 0:return!0;case 3:return!1;case 1:throw new Error(Ph.SIG_PARSE);case 2:throw new Error(Ph.PUBKEY_PARSE)}},ecdsaRecover(i,A,c,f=!0,l){switch(H2("signature",i,64),nM(K6e(A)==="Number"&&A>=0&&A<=3,"Expected recovery id to be a Number within interval [0, 3]"),H2("message",c,32),Tue(f),l=kF(l,f?33:65),e.ecdsaRecover(l,i,A,c)){case 0:return l;case 1:throw new Error(Ph.SIG_PARSE);case 2:throw new Error(Ph.RECOVER);case 3:throw new Error(Ph.IMPOSSIBLE_CASE)}},ecdh(i,A,c={},f){switch(H2("public key",i,[33,65]),H2("private key",A,32),nM(K6e(c)==="Object","Expected options to be an Object"),c.data!==void 0&&H2("options.data",c.data),c.hashfn!==void 0?(nM(K6e(c.hashfn)==="Function","Expected options.hashfn to be a Function"),c.xbuf!==void 0&&H2("options.xbuf",c.xbuf,32),c.ybuf!==void 0&&H2("options.ybuf",c.ybuf,32),H2("output",f)):f=kF(f,32),e.ecdh(f,i,A,c.data,c.hashfn,c.xbuf,c.ybuf)){case 0:return f;case 1:throw new Error(Ph.PUBKEY_PARSE);case 2:throw new Error(Ph.ECDH)}}}),uRs=GGe.ec,eK=new uRs("secp256k1"),y2=eK.curve,Yg=y2.n.constructor;function fRs(e,i){let A=new Yg(i);if(A.cmp(y2.p)>=0)return null;A=A.toRed(y2.red);let c=A.redSqr().redIMul(A).redIAdd(y2.b).redSqrt();return e===3!==c.isOdd()&&(c=c.redNeg()),eK.keyPair({pub:{x:A,y:c}})}function lRs(e,i,A){let c=new Yg(i),f=new Yg(A);if(c.cmp(y2.p)>=0||f.cmp(y2.p)>=0||(c=c.toRed(y2.red),f=f.toRed(y2.red),(e===6||e===7)&&f.isOdd()!==(e===7)))return null;let l=c.redSqr().redIMul(c);return f.redSqr().redISub(l.redIAdd(y2.b)).isZero()?eK.keyPair({pub:{x:c,y:f}}):null}function die(e){let i=e[0];switch(i){case 2:case 3:return e.length!==33?null:fRs(i,e.subarray(1,33));case 4:case 6:case 7:return e.length!==65?null:lRs(i,e.subarray(1,33),e.subarray(33,65));default:return null}}function Uue(e,i){let A=i.encode(null,e.length===33);for(let c=0;c<e.length;++c)e[c]=A[c]}var hRs={contextRandomize(){return 0},privateKeyVerify(e){let i=new Yg(e);return i.cmp(y2.n)<0&&!i.isZero()?0:1},privateKeyNegate(e){let i=new Yg(e),A=y2.n.sub(i).umod(y2.n).toArrayLike(Uint8Array,"be",32);return e.set(A),0},privateKeyTweakAdd(e,i){let A=new Yg(i);if(A.cmp(y2.n)>=0||(A.iadd(new Yg(e)),A.cmp(y2.n)>=0&&A.isub(y2.n),A.isZero()))return 1;let c=A.toArrayLike(Uint8Array,"be",32);return e.set(c),0},privateKeyTweakMul(e,i){let A=new Yg(i);if(A.cmp(y2.n)>=0||A.isZero())return 1;A.imul(new Yg(e)),A.cmp(y2.n)>=0&&(A=A.umod(y2.n));let c=A.toArrayLike(Uint8Array,"be",32);return e.set(c),0},publicKeyVerify(e){return die(e)===null?1:0},publicKeyCreate(e,i){let A=new Yg(i);if(A.cmp(y2.n)>=0||A.isZero())return 1;let c=eK.keyFromPrivate(i).getPublic();return Uue(e,c),0},publicKeyConvert(e,i){let A=die(i);if(A===null)return 1;let c=A.getPublic();return Uue(e,c),0},publicKeyNegate(e,i){let A=die(i);if(A===null)return 1;let c=A.getPublic();return c.y=c.y.redNeg(),Uue(e,c),0},publicKeyCombine(e,i){let A=new Array(i.length);for(let f=0;f<i.length;++f)if(A[f]=die(i[f]),A[f]===null)return 1;let c=A[0].getPublic();for(let f=1;f<A.length;++f)c=c.add(A[f].pub);return c.isInfinity()?2:(Uue(e,c),0)},publicKeyTweakAdd(e,i,A){let c=die(i);if(c===null)return 1;if(A=new Yg(A),A.cmp(y2.n)>=0)return 2;let f=c.getPublic().add(y2.g.mul(A));return f.isInfinity()?2:(Uue(e,f),0)},publicKeyTweakMul(e,i,A){let c=die(i);if(c===null)return 1;if(A=new Yg(A),A.cmp(y2.n)>=0||A.isZero())return 2;let f=c.getPublic().mul(A);return Uue(e,f),0},signatureNormalize(e){let i=new Yg(e.subarray(0,32)),A=new Yg(e.subarray(32,64));return i.cmp(y2.n)>=0||A.cmp(y2.n)>=0?1:(A.cmp(eK.nh)===1&&e.set(y2.n.sub(A).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,i){let A=i.subarray(0,32),c=i.subarray(32,64);if(new Yg(A).cmp(y2.n)>=0||new Yg(c).cmp(y2.n)>=0)return 1;let{output:f}=e,l=f.subarray(4,37);l[0]=0,l.set(A,1);let g=33,w=0;for(;g>1&&l[w]===0&&!(l[w+1]&128);--g,++w);if(l=l.subarray(w),l[0]&128||g>1&&l[0]===0&&!(l[1]&128))return 1;let N=f.subarray(39,72);N[0]=0,N.set(c,1);let F=33,j=0;for(;F>1&&N[j]===0&&!(N[j+1]&128);--F,++j);return N=N.subarray(j),N[0]&128||F>1&&N[0]===0&&!(N[1]&128)?1:(e.outputlen=6+g+F,f[0]=48,f[1]=e.outputlen-2,f[2]=2,f[3]=l.length,f.set(l,4),f[4+g]=2,f[5+g]=N.length,f.set(N,6+g),0)},signatureImport(e,i){if(i.length<8||i.length>72||i[0]!==48||i[1]!==i.length-2||i[2]!==2)return 1;let A=i[3];if(A===0||5+A>=i.length||i[4+A]!==2)return 1;let c=i[5+A];if(c===0||6+A+c!==i.length||i[4]&128||A>1&&i[4]===0&&!(i[5]&128)||i[A+6]&128||c>1&&i[A+6]===0&&!(i[A+7]&128))return 1;let f=i.subarray(4,4+A);if(f.length===33&&f[0]===0&&(f=f.subarray(1)),f.length>32)return 1;let l=i.subarray(6+A);if(l.length===33&&l[0]===0&&(l=l.slice(1)),l.length>32)throw new Error("S length is too long");let g=new Yg(f);g.cmp(y2.n)>=0&&(g=new Yg(0));let w=new Yg(i.subarray(6+A));return w.cmp(y2.n)>=0&&(w=new Yg(0)),e.set(g.toArrayLike(Uint8Array,"be",32),0),e.set(w.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,i,A,c,f){if(f){let w=f;f=N=>{let F=w(i,A,null,c,N);if(!(F instanceof Uint8Array&&F.length===32))throw new Error("This is the way");return new Yg(F)}}let l=new Yg(A);if(l.cmp(y2.n)>=0||l.isZero())return 1;let g;try{g=eK.sign(i,A,{canonical:!0,k:f,pers:c})}catch(w){return 1}return e.signature.set(g.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(g.s.toArrayLike(Uint8Array,"be",32),32),e.recid=g.recoveryParam,0},ecdsaVerify(e,i,A){let c={r:e.subarray(0,32),s:e.subarray(32,64)},f=new Yg(c.r),l=new Yg(c.s);if(f.cmp(y2.n)>=0||l.cmp(y2.n)>=0)return 1;if(l.cmp(eK.nh)===1||f.isZero()||l.isZero())return 3;let g=die(A);if(g===null)return 2;let w=g.getPublic();return eK.verify(i,c,w)?0:3},ecdsaRecover(e,i,A,c){let f={r:i.slice(0,32),s:i.slice(32,64)},l=new Yg(f.r),g=new Yg(f.s);if(l.cmp(y2.n)>=0||g.cmp(y2.n)>=0)return 1;if(l.isZero()||g.isZero())return 2;let w;try{w=eK.recoverPubKey(c,f,A)}catch(N){return 2}return Uue(e,w),0},ecdh(e,i,A,c,f,l,g){let w=die(i);if(w===null)return 1;let N=new Yg(A);if(N.cmp(y2.n)>=0||N.isZero())return 2;let F=w.getPublic().mul(N);if(f===void 0){let j=F.encode(null,!0),te=eK.hash().update(j).digest();for(let v=0;v<32;++v)e[v]=te[v]}else{l||(l=new Uint8Array(32));let j=F.getX().toArray("be",32);for(let Z=0;Z<32;++Z)l[Z]=j[Z];g||(g=new Uint8Array(32));let te=F.getY().toArray("be",32);for(let Z=0;Z<32;++Z)g[Z]=te[Z];let v=f(l,g,c);if(!(v instanceof Uint8Array&&v.length===e.length))return 2;e.set(v)}return 0}},gRs=cRs(hRs);function s6t(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function pRs(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function hMs(...e){let i=l=>l,A=(l,g)=>w=>l(g(w)),c=e.map(l=>l.encode).reduceRight(A,i),f=e.map(l=>l.decode).reduce(A,i);return{encode:c,decode:f}}function gMs(e){return{encode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return i.map(A=>{if(A<0||A>=e.length)throw new Error(`Digit index outside alphabet: ${A} (alphabet: ${e.length})`);return e[A]})},decode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="string")throw new Error("alphabet.decode input should be array of strings");return i.map(A=>{if(typeof A!="string")throw new Error(`alphabet.decode: not string element=${A}`);let c=e.indexOf(A);if(c===-1)throw new Error(`Unknown letter: "${A}". Allowed: ${e}`);return c})}}}function pMs(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="string")throw new Error("join.encode input should be array of strings");for(let A of i)if(typeof A!="string")throw new Error(`join.encode: non-string input=${A}`);return i.join(e)},decode:i=>{if(typeof i!="string")throw new Error("join.decode input should be string");return i.split(e)}}}function yMs(e,i="="){if(typeof i!="string")throw new Error("padding chr should be string");return{encode(A){if(!Array.isArray(A)||A.length&&typeof A[0]!="string")throw new Error("padding.encode input should be array of strings");for(let c of A)if(typeof c!="string")throw new Error(`padding.encode: non-string input=${c}`);for(;A.length*e%8;)A.push(i);return A},decode(A){if(!Array.isArray(A)||A.length&&typeof A[0]!="string")throw new Error("padding.encode input should be array of strings");for(let f of A)if(typeof f!="string")throw new Error(`padding.decode: non-string input=${f}`);let c=A.length;if(c*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;c>0&&A[c-1]===i;c--)if(!((c-1)*e%8))throw new Error("Invalid padding: string has too much padding");return A.slice(0,c)}}}function mMs(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:i=>i,decode:i=>e(i)}}var Uei=(e,i)=>i?Uei(i,e%i):e,OEt=(e,i)=>e+(i-Uei(e,i));function zGr(e,i,A,c){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(i<=0||i>32)throw new Error(`convertRadix2: wrong from=${i}`);if(A<=0||A>32)throw new Error(`convertRadix2: wrong to=${A}`);if(OEt(i,A)>32)throw new Error(`convertRadix2: carry overflow from=${i} to=${A} carryBits=${OEt(i,A)}`);let f=0,l=0,g=hi(2,A)-1,w=[];for(let N of e){if(N>=hi(2,i))throw new Error(`convertRadix2: invalid data word=${N} from=${i}`);if(f=f<<i|N,l+i>32)throw new Error(`convertRadix2: carry overflow pos=${l} from=${i}`);for(l+=i;l>=A;l-=A)w.push((f>>l-A&g)>>>0);f&=hi(2,l)-1}if(f=f<<A-l&g,!c&&l>=i)throw new Error("Excess padding");if(!c&&f)throw new Error(`Non-zero padding: ${f}`);return c&&l>0&&w.push(f>>>0),w}function IMs(e,i=!1){if(e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(OEt(8,e)>32||OEt(e,8)>32)throw new Error("radix2: carry overflow");return{encode:A=>{if(!pRs(A))throw new Error("radix2.encode input should be Uint8Array");return zGr(Array.from(A),8,e,!i)},decode:A=>{if(!Array.isArray(A)||A.length&&typeof A[0]!="number")throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(zGr(A,e,8,i))}}}function Fei(e){let i=e.startsWith("m/")?e:`m/${e}`;return bD.stringToPath(i)}var F8e;(function(e){e.TRANSFER="transfer"})(F8e||(F8e={}));var tyn=class extends f1n{constructor(i){super(i.chain,i),this.clientUrls=i.clientUrls,this.prefix=this.getPrefix(this.getNetwork()),this.defaultDecimals=i.defaultDecimals,this.defaultFee=i.defaultFee,this.baseDenom=i.baseDenom,this.registry=new MF.Registry([...$3t.defaultRegistryTypes,...i.registryTypes]),this.startgateClient=new V_t(()=>this.connectClient(this.clientUrls[i.network||E3.Mainnet]))}connectClient(i){return Zre(this,void 0,void 0,function*(){return $3t.StargateClient.connect(i)})}setNetwork(i){super.setNetwork(i),this.startgateClient=new V_t(()=>this.connectClient(this.clientUrls[i])),this.prefix=this.getPrefix(i)}splitAmountAndDenom(i){let A=[];return i.forEach(c=>{let f=/^(\d+)(.*)$/,l=c.match(f);if(l){let g=l[1],w=l[2];A.push({amount:g,denom:w})}}),A}mapIndexedTxToTx(i){return Zre(this,void 0,void 0,function*(){let A=new Map,c=new Map;i.events.slice(7).forEach(N=>{if(N.type==="transfer"){let F=N.attributes.find(v=>v.key==="amount"),j=N.attributes.find(v=>v.key==="sender"),te=N.attributes.find(v=>v.key==="recipient");try{let v=F.value.split(","),ne=this.splitAmountAndDenom(v),Z={};ne.forEach(R=>{R.denom in Z?Z[R.denom]=Z[R.denom].plus(Yz(R.amount,this.defaultDecimals)):Z[R.denom]=Yz(R.amount,this.defaultDecimals)}),Object.entries(Z).forEach(([R,M])=>{let U=this.assetFromDenom(R);if(U){let E=`${te.value}${SJr(U)}`;if(A.has(E)){let H=A.get(te.value);H.amount=H.amount.plus(M),A.set(E,H)}else A.set(E,{amount:M,asset:U,address:te.value});let Q=`${j.value}${SJr(U)}`;if(c.has(Q)){let H=c.get(Q);H.amount=H.amount.plus(M),c.set(Q,H)}else c.set(Q,{amount:M,asset:U,address:j.value})}})}catch(v){console.error("Error:",v)}}});let f=[];for(let N of A.values()){let F={to:N.address,amount:N.amount,asset:N.asset};f.push(F)}let l=[];for(let N of c.values()){let F={from:N.address,amount:N.amount,asset:N.asset};l.push(F)}let w=yield(yield this.startgateClient.getValue()).getBlock(i.height);return{asset:l[0].asset,from:l,to:f,date:new Date(w.header.time),type:c1n.Transfer,hash:i.hash}})}getFees(){return Promise.resolve(l1n(cGe.FlatFee,this.defaultFee))}hash160(i){let A=O3t.createHash("sha256").update(i).digest();try{return O3t.createHash("rmd160").update(A).digest()}catch(c){return O3t.createHash("ripemd160").update(A).digest()}}getAddress(i){let A=fWr(this.phrase),f=dRs(A).derivePath(this.getFullDerivationPath(i||0));if(!f.privateKey)throw new Error("child does not have a privateKey");let l=gRs.publicKeyCreate(f.privateKey),g=this.hash160(Uint8Array.from(l)),w=p1n.toWords(Buffer.from(g));return p1n.encode(this.prefix,w)}getAddressAsync(i=0){return Zre(this,void 0,void 0,function*(){return this.getAddress(i)})}validateAddress(i){try{let{prefix:A}=K2.fromBech32(i);return A===this.prefix}catch(A){return!1}}getBalance(i,A){return Zre(this,void 0,void 0,function*(){let f=yield(yield this.startgateClient.getValue()).getAllBalances(i),l=[];return f.forEach(g=>{let w=this.assetFromDenom(g.denom);w&&l.push({asset:w,amount:Yz(g.amount,this.getAssetDecimals(w))})}),l})}getTransactions(i){return Zre(this,void 0,void 0,function*(){if(i!=null&&i.startTime||i!=null&&i.limit||i!=null&&i.offset)throw Error("Not supported param limit for this client");let A=yield this.startgateClient.getValue(),c=yield A.searchTx([{key:"message.sender",value:i==null?void 0:i.address}]),l=[...yield A.searchTx([{key:"transfer.recipient",value:i==null?void 0:i.address}]),...c],g=l.map(N=>this.mapIndexedTxToTx(N)),w=yield Promise.all(g);return{total:l.length,txs:w}})}getTransactionData(i,A){return Zre(this,void 0,void 0,function*(){let f=yield(yield this.startgateClient.getValue()).getTx(i);if(!f)throw Error(`Can not find transaction ${i}`);return this.mapIndexedTxToTx(f)})}transfer(i){return Zre(this,void 0,void 0,function*(){let A=yield this.getAddressAsync(i.walletIndex||0),{rawUnsignedTx:c}=yield this.prepareTx({sender:A,recipient:i.recipient,asset:i.asset,amount:i.amount,memo:i.memo}),f=MF.decodeTxRaw(K2.fromBase64(c)),l=yield MF.DirectSecp256k1HdWallet.fromMnemonic(this.phrase,{prefix:this.prefix,hdPaths:[Fei(this.getFullDerivationPath(i.walletIndex||0))]}),g=yield $3t.SigningStargateClient.connectWithSigner(this.clientUrls[this.network],l,{registry:this.registry}),w=f.body.messages.map(F=>({typeUrl:this.getMsgTypeUrlByType(F8e.TRANSFER),value:g.registry.decode(F)}));return(yield g.signAndBroadcast(A,w,this.getStandardFee(this.getAssetInfo().asset),f.body.memo)).transactionHash})}broadcastTx(i){return Zre(this,void 0,void 0,function*(){return(yield(yield this.startgateClient.getValue()).broadcastTx(K2.fromBase64(i))).transactionHash})}},ZIn={exports:{}};ZIn.exports;(function(e){(function(i){var A,c=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,f=Math.ceil,l=Math.floor,g="[BigNumber Error] ",w=g+"Number primitive has more than 15 significant digits: ",N=1e14,F=14,j=9007199254740991,te=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],v=1e7,ne=1e9;function Z(ee){var T,se,p,L=D.prototype={constructor:D,toString:null,valueOf:null},V=new D(1),K=20,m=4,h=-7,_=21,b=-1e7,O=1e7,J=!1,ie=1,G=0,I={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},C="0123456789abcdefghijklmnopqrstuvwxyz";function D(Ke,It){var rt,ut,Rt,Ee,Pt,_e,we,xe,Ye=this;if(!(Ye instanceof D))return new D(Ke,It);if(It==null){if(Ke&&Ke._isBigNumber===!0){Ye.s=Ke.s,!Ke.c||Ke.e>O?Ye.c=Ye.e=null:Ke.e<b?Ye.c=[Ye.e=0]:(Ye.e=Ke.e,Ye.c=Ke.c.slice());return}if((_e=typeof Ke=="number")&&Ke*0==0){if(Ye.s=1/Ke<0?(Ke=-Ke,-1):1,Ke===~~Ke){for(Ee=0,Pt=Ke;Pt>=10;Pt/=10,Ee++);Ee>O?Ye.c=Ye.e=null:(Ye.e=Ee,Ye.c=[Ke]);return}xe=String(Ke)}else{if(!c.test(xe=String(Ke)))return p(Ye,xe,_e);Ye.s=xe.charCodeAt(0)==45?(xe=xe.slice(1),-1):1}(Ee=xe.indexOf("."))>-1&&(xe=xe.replace(".","")),(Pt=xe.search(/e/i))>0?(Ee<0&&(Ee=Pt),Ee+=+xe.slice(Pt+1),xe=xe.substring(0,Pt)):Ee<0&&(Ee=xe.length)}else{if(E(It,2,C.length,"Base"),It==10)return Ye=new D(Ke),Xe(Ye,K+Ye.e+1,m);if(xe=String(Ke),_e=typeof Ke=="number"){if(Ke*0!=0)return p(Ye,xe,_e,It);if(Ye.s=1/Ke<0?(xe=xe.slice(1),-1):1,D.DEBUG&&xe.replace(/^0\.0*|\./,"").length>15)throw Error(w+Ke)}else Ye.s=xe.charCodeAt(0)===45?(xe=xe.slice(1),-1):1;for(rt=C.slice(0,It),Ee=Pt=0,we=xe.length;Pt<we;Pt++)if(rt.indexOf(ut=xe.charAt(Pt))<0){if(ut=="."){if(Pt>Ee){Ee=we;continue}}else if(!Rt&&(xe==xe.toUpperCase()&&(xe=xe.toLowerCase())||xe==xe.toLowerCase()&&(xe=xe.toUpperCase()))){Rt=!0,Pt=-1,Ee=0;continue}return p(Ye,String(Ke),_e,It)}_e=!1,xe=se(xe,It,10,Ye.s),(Ee=xe.indexOf("."))>-1?xe=xe.replace(".",""):Ee=xe.length}for(Pt=0;xe.charCodeAt(Pt)===48;Pt++);for(we=xe.length;xe.charCodeAt(--we)===48;);if(xe=xe.slice(Pt,++we)){if(we-=Pt,_e&&D.DEBUG&&we>15&&(Ke>j||Ke!==l(Ke)))throw Error(w+Ye.s*Ke);if((Ee=Ee-Pt-1)>O)Ye.c=Ye.e=null;else if(Ee<b)Ye.c=[Ye.e=0];else{if(Ye.e=Ee,Ye.c=[],Pt=(Ee+1)%F,Ee<0&&(Pt+=F),Pt<we){for(Pt&&Ye.c.push(+xe.slice(0,Pt)),we-=F;Pt<we;)Ye.c.push(+xe.slice(Pt,Pt+=F));Pt=F-(xe=xe.slice(Pt)).length}else Pt-=we;for(;Pt--;xe+="0");Ye.c.push(+xe)}}else Ye.c=[Ye.e=0]}D.clone=Z,D.ROUND_UP=0,D.ROUND_DOWN=1,D.ROUND_CEIL=2,D.ROUND_FLOOR=3,D.ROUND_HALF_UP=4,D.ROUND_HALF_DOWN=5,D.ROUND_HALF_EVEN=6,D.ROUND_HALF_CEIL=7,D.ROUND_HALF_FLOOR=8,D.EUCLID=9,D.config=D.set=function(Ke){var It,rt;if(Ke!=null)if(typeof Ke=="object"){if(Ke.hasOwnProperty(It="DECIMAL_PLACES")&&(rt=Ke[It],E(rt,0,ne,It),K=rt),Ke.hasOwnProperty(It="ROUNDING_MODE")&&(rt=Ke[It],E(rt,0,8,It),m=rt),Ke.hasOwnProperty(It="EXPONENTIAL_AT")&&(rt=Ke[It],rt&&rt.pop?(E(rt[0],-ne,0,It),E(rt[1],0,ne,It),h=rt[0],_=rt[1]):(E(rt,-ne,ne,It),h=-(_=rt<0?-rt:rt))),Ke.hasOwnProperty(It="RANGE"))if(rt=Ke[It],rt&&rt.pop)E(rt[0],-ne,-1,It),E(rt[1],1,ne,It),b=rt[0],O=rt[1];else if(E(rt,-ne,ne,It),rt)b=-(O=rt<0?-rt:rt);else throw Error(g+It+" cannot be zero: "+rt);if(Ke.hasOwnProperty(It="CRYPTO"))if(rt=Ke[It],rt===!!rt)if(rt)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))J=rt;else throw J=!rt,Error(g+"crypto unavailable");else J=rt;else throw Error(g+It+" not true or false: "+rt);if(Ke.hasOwnProperty(It="MODULO_MODE")&&(rt=Ke[It],E(rt,0,9,It),ie=rt),Ke.hasOwnProperty(It="POW_PRECISION")&&(rt=Ke[It],E(rt,0,ne,It),G=rt),Ke.hasOwnProperty(It="FORMAT"))if(rt=Ke[It],typeof rt=="object")I=rt;else throw Error(g+It+" not an object: "+rt);if(Ke.hasOwnProperty(It="ALPHABET"))if(rt=Ke[It],typeof rt=="string"&&!/^.$|[+-.\s]|(.).*\1/.test(rt))C=rt;else throw Error(g+It+" invalid: "+rt)}else throw Error(g+"Object expected: "+Ke);return{DECIMAL_PLACES:K,ROUNDING_MODE:m,EXPONENTIAL_AT:[h,_],RANGE:[b,O],CRYPTO:J,MODULO_MODE:ie,POW_PRECISION:G,FORMAT:I,ALPHABET:C}},D.isBigNumber=function(Ke){if(!Ke||Ke._isBigNumber!==!0)return!1;if(!D.DEBUG)return!0;var It,rt,ut=Ke.c,Rt=Ke.e,Ee=Ke.s;e:if({}.toString.call(ut)=="[object Array]"){if((Ee===1||Ee===-1)&&Rt>=-ne&&Rt<=ne&&Rt===l(Rt)){if(ut[0]===0){if(Rt===0&&ut.length===1)return!0;break e}if(It=(Rt+1)%F,It<1&&(It+=F),String(ut[0]).length==It){for(It=0;It<ut.length;It++)if(rt=ut[It],rt<0||rt>=N||rt!==l(rt))break e;if(rt!==0)return!0}}}else if(ut===null&&Rt===null&&(Ee===null||Ee===1||Ee===-1))return!0;throw Error(g+"Invalid BigNumber: "+Ke)},D.maximum=D.max=function(){return ae(arguments,L.lt)},D.minimum=D.min=function(){return ae(arguments,L.gt)},D.random=function(){var Ke=9007199254740992,It=Math.random()*Ke&2097151?function(){return l(Math.random()*Ke)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(rt){var ut,Rt,Ee,Pt,_e,we=0,xe=[],Ye=new D(V);if(rt==null?rt=K:E(rt,0,ne),Pt=f(rt/F),J)if(crypto.getRandomValues){for(ut=crypto.getRandomValues(new Uint32Array(Pt*=2));we<Pt;)_e=ut[we]*131072+(ut[we+1]>>>11),_e>=9e15?(Rt=crypto.getRandomValues(new Uint32Array(2)),ut[we]=Rt[0],ut[we+1]=Rt[1]):(xe.push(_e%1e14),we+=2);we=Pt/2}else if(crypto.randomBytes){for(ut=crypto.randomBytes(Pt*=7);we<Pt;)_e=(ut[we]&31)*281474976710656+ut[we+1]*1099511627776+ut[we+2]*4294967296+ut[we+3]*16777216+(ut[we+4]<<16)+(ut[we+5]<<8)+ut[we+6],_e>=9e15?crypto.randomBytes(7).copy(ut,we):(xe.push(_e%1e14),we+=7);we=Pt/7}else throw J=!1,Error(g+"crypto unavailable");if(!J)for(;we<Pt;)_e=It(),_e<9e15&&(xe[we++]=_e%1e14);for(Pt=xe[--we],rt%=F,Pt&&rt&&(_e=te[F-rt],xe[we]=l(Pt/_e)*_e);xe[we]===0;xe.pop(),we--);if(we<0)xe=[Ee=0];else{for(Ee=-1;xe[0]===0;xe.splice(0,1),Ee-=F);for(we=1,_e=xe[0];_e>=10;_e/=10,we++);we<F&&(Ee-=F-we)}return Ye.e=Ee,Ye.c=xe,Ye}}(),D.sum=function(){for(var Ke=1,It=arguments,rt=new D(It[0]);Ke<It.length;)rt=rt.plus(It[Ke++]);return rt},se=function(){var Ke="0123456789";function It(rt,ut,Rt,Ee){for(var Pt,_e=[0],we,xe=0,Ye=rt.length;xe<Ye;){for(we=_e.length;we--;_e[we]*=ut);for(_e[0]+=Ee.indexOf(rt.charAt(xe++)),Pt=0;Pt<_e.length;Pt++)_e[Pt]>Rt-1&&(_e[Pt+1]==null&&(_e[Pt+1]=0),_e[Pt+1]+=_e[Pt]/Rt|0,_e[Pt]%=Rt)}return _e.reverse()}return function(rt,ut,Rt,Ee,Pt){var _e,we,xe,Ye,X,ht,Ut,zt,Wt=rt.indexOf("."),yn=K,rn=m;for(Wt>=0&&(Ye=G,G=0,rt=rt.replace(".",""),zt=new D(ut),ht=zt.pow(rt.length-Wt),G=Ye,zt.c=It(re(M(ht.c),ht.e,"0"),10,Rt,Ke),zt.e=zt.c.length),Ut=It(rt,ut,Rt,Pt?(_e=C,Ke):(_e=Ke,C)),xe=Ye=Ut.length;Ut[--Ye]==0;Ut.pop());if(!Ut[0])return _e.charAt(0);if(Wt<0?--xe:(ht.c=Ut,ht.e=xe,ht.s=Ee,ht=T(ht,zt,yn,rn,Rt),Ut=ht.c,X=ht.r,xe=ht.e),we=xe+yn+1,Wt=Ut[we],Ye=Rt/2,X=X||we<0||Ut[we+1]!=null,X=rn<4?(Wt!=null||X)&&(rn==0||rn==(ht.s<0?3:2)):Wt>Ye||Wt==Ye&&(rn==4||X||rn==6&&Ut[we-1]&1||rn==(ht.s<0?8:7)),we<1||!Ut[0])rt=X?re(_e.charAt(1),-yn,_e.charAt(0)):_e.charAt(0);else{if(Ut.length=we,X)for(--Rt;++Ut[--we]>Rt;)Ut[we]=0,we||(++xe,Ut=[1].concat(Ut));for(Ye=Ut.length;!Ut[--Ye];);for(Wt=0,rt="";Wt<=Ye;rt+=_e.charAt(Ut[Wt++]));rt=re(rt,xe,_e.charAt(0))}return rt}}(),T=function(){function Ke(ut,Rt,Ee){var Pt,_e,we,xe,Ye=0,X=ut.length,ht=Rt%v,Ut=Rt/v|0;for(ut=ut.slice();X--;)we=ut[X]%v,xe=ut[X]/v|0,Pt=Ut*we+xe*ht,_e=ht*we+Pt%v*v+Ye,Ye=(_e/Ee|0)+(Pt/v|0)+Ut*xe,ut[X]=_e%Ee;return Ye&&(ut=[Ye].concat(ut)),ut}function It(ut,Rt,Ee,Pt){var _e,we;if(Ee!=Pt)we=Ee>Pt?1:-1;else for(_e=we=0;_e<Ee;_e++)if(ut[_e]!=Rt[_e]){we=ut[_e]>Rt[_e]?1:-1;break}return we}function rt(ut,Rt,Ee,Pt){for(var _e=0;Ee--;)ut[Ee]-=_e,_e=ut[Ee]<Rt[Ee]?1:0,ut[Ee]=_e*Pt+ut[Ee]-Rt[Ee];for(;!ut[0]&&ut.length>1;ut.splice(0,1));}return function(ut,Rt,Ee,Pt,_e){var we,xe,Ye,X,ht,Ut,zt,Wt,yn,rn,un,fr,ir,Ln,Br,Zn,Jn,_r=ut.s==Rt.s?1:-1,Yn=ut.c,kn=Rt.c;if(!Yn||!Yn[0]||!kn||!kn[0])return new D(!ut.s||!Rt.s||(Yn?kn&&Yn[0]==kn[0]:!kn)?NaN:Yn&&Yn[0]==0||!kn?_r*0:_r/0);for(Wt=new D(_r),yn=Wt.c=[],xe=ut.e-Rt.e,_r=Ee+xe+1,_e||(_e=N,xe=R(ut.e/F)-R(Rt.e/F),_r=_r/F|0),Ye=0;kn[Ye]==(Yn[Ye]||0);Ye++);if(kn[Ye]>(Yn[Ye]||0)&&xe--,_r<0)yn.push(1),X=!0;else{for(Ln=Yn.length,Zn=kn.length,Ye=0,_r+=2,ht=l(_e/(kn[0]+1)),ht>1&&(kn=Ke(kn,ht,_e),Yn=Ke(Yn,ht,_e),Zn=kn.length,Ln=Yn.length),ir=Zn,rn=Yn.slice(0,Zn),un=rn.length;un<Zn;rn[un++]=0);Jn=kn.slice(),Jn=[0].concat(Jn),Br=kn[0],kn[1]>=_e/2&&Br++;do{if(ht=0,we=It(kn,rn,Zn,un),we<0){if(fr=rn[0],Zn!=un&&(fr=fr*_e+(rn[1]||0)),ht=l(fr/Br),ht>1)for(ht>=_e&&(ht=_e-1),Ut=Ke(kn,ht,_e),zt=Ut.length,un=rn.length;It(Ut,rn,zt,un)==1;)ht--,rt(Ut,Zn<zt?Jn:kn,zt,_e),zt=Ut.length,we=1;else ht==0&&(we=ht=1),Ut=kn.slice(),zt=Ut.length;if(zt<un&&(Ut=[0].concat(Ut)),rt(rn,Ut,un,_e),un=rn.length,we==-1)for(;It(kn,rn,Zn,un)<1;)ht++,rt(rn,Zn<un?Jn:kn,un,_e),un=rn.length}else we===0&&(ht++,rn=[0]);yn[Ye++]=ht,rn[0]?rn[un++]=Yn[ir]||0:(rn=[Yn[ir]],un=1)}while((ir++<Ln||rn[0]!=null)&&_r--);X=rn[0]!=null,yn[0]||yn.splice(0,1)}if(_e==N){for(Ye=1,_r=yn[0];_r>=10;_r/=10,Ye++);Xe(Wt,Ee+(Wt.e=Ye+xe*F-1)+1,Pt,X)}else Wt.e=xe,Wt.r=+X;return Wt}}();function W(Ke,It,rt,ut){var Rt,Ee,Pt,_e,we;if(rt==null?rt=m:E(rt,0,8),!Ke.c)return Ke.toString();if(Rt=Ke.c[0],Pt=Ke.e,It==null)we=M(Ke.c),we=ut==1||ut==2&&(Pt<=h||Pt>=_)?H(we,Pt):re(we,Pt,"0");else if(Ke=Xe(new D(Ke),It,rt),Ee=Ke.e,we=M(Ke.c),_e=we.length,ut==1||ut==2&&(It<=Ee||Ee<=h)){for(;_e<It;we+="0",_e++);we=H(we,Ee)}else if(It-=Pt,we=re(we,Ee,"0"),Ee+1>_e){if(--It>0)for(we+=".";It--;we+="0");}else if(It+=Ee-_e,It>0)for(Ee+1==_e&&(we+=".");It--;we+="0");return Ke.s<0&&Rt?"-"+we:we}function ae(Ke,It){for(var rt,ut=1,Rt=new D(Ke[0]);ut<Ke.length;ut++)if(rt=new D(Ke[ut]),rt.s)It.call(Rt,rt)&&(Rt=rt);else{Rt=rt;break}return Rt}function ye(Ke,It,rt){for(var ut=1,Rt=It.length;!It[--Rt];It.pop());for(Rt=It[0];Rt>=10;Rt/=10,ut++);return(rt=ut+rt*F-1)>O?Ke.c=Ke.e=null:rt<b?Ke.c=[Ke.e=0]:(Ke.e=rt,Ke.c=It),Ke}p=function(){var Ke=/^(-?)0([xbo])(?=\w[\w.]*$)/i,It=/^([^.]+)\.$/,rt=/^\.([^.]+)$/,ut=/^-?(Infinity|NaN)$/,Rt=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(Ee,Pt,_e,we){var xe,Ye=_e?Pt:Pt.replace(Rt,"");if(ut.test(Ye))Ee.s=isNaN(Ye)?null:Ye<0?-1:1;else{if(!_e&&(Ye=Ye.replace(Ke,function(X,ht,Ut){return xe=(Ut=Ut.toLowerCase())=="x"?16:Ut=="b"?2:8,!we||we==xe?ht:X}),we&&(xe=we,Ye=Ye.replace(It,"$1").replace(rt,"0.$1")),Pt!=Ye))return new D(Ye,xe);if(D.DEBUG)throw Error(g+"Not a"+(we?" base "+we:"")+" number: "+Pt);Ee.s=null}Ee.c=Ee.e=null}}();function Xe(Ke,It,rt,ut){var Rt,Ee,Pt,_e,we,xe,Ye,X=Ke.c,ht=te;if(X){e:{for(Rt=1,_e=X[0];_e>=10;_e/=10,Rt++);if(Ee=It-Rt,Ee<0)Ee+=F,Pt=It,we=X[xe=0],Ye=we/ht[Rt-Pt-1]%10|0;else if(xe=f((Ee+1)/F),xe>=X.length)if(ut){for(;X.length<=xe;X.push(0));we=Ye=0,Rt=1,Ee%=F,Pt=Ee-F+1}else break e;else{for(we=_e=X[xe],Rt=1;_e>=10;_e/=10,Rt++);Ee%=F,Pt=Ee-F+Rt,Ye=Pt<0?0:we/ht[Rt-Pt-1]%10|0}if(ut=ut||It<0||X[xe+1]!=null||(Pt<0?we:we%ht[Rt-Pt-1]),ut=rt<4?(Ye||ut)&&(rt==0||rt==(Ke.s<0?3:2)):Ye>5||Ye==5&&(rt==4||ut||rt==6&&(Ee>0?Pt>0?we/ht[Rt-Pt]:0:X[xe-1])%10&1||rt==(Ke.s<0?8:7)),It<1||!X[0])return X.length=0,ut?(It-=Ke.e+1,X[0]=ht[(F-It%F)%F],Ke.e=-It||0):X[0]=Ke.e=0,Ke;if(Ee==0?(X.length=xe,_e=1,xe--):(X.length=xe+1,_e=ht[F-Ee],X[xe]=Pt>0?l(we/ht[Rt-Pt]%ht[Pt])*_e:0),ut)for(;;)if(xe==0){for(Ee=1,Pt=X[0];Pt>=10;Pt/=10,Ee++);for(Pt=X[0]+=_e,_e=1;Pt>=10;Pt/=10,_e++);Ee!=_e&&(Ke.e++,X[0]==N&&(X[0]=1));break}else{if(X[xe]+=_e,X[xe]!=N)break;X[xe--]=0,_e=1}for(Ee=X.length;X[--Ee]===0;X.pop());}Ke.e>O?Ke.c=Ke.e=null:Ke.e<b&&(Ke.c=[Ke.e=0])}return Ke}function nt(Ke){var It,rt=Ke.e;return rt===null?Ke.toString():(It=M(Ke.c),It=rt<=h||rt>=_?H(It,rt):re(It,rt,"0"),Ke.s<0?"-"+It:It)}return L.absoluteValue=L.abs=function(){var Ke=new D(this);return Ke.s<0&&(Ke.s=1),Ke},L.comparedTo=function(Ke,It){return U(this,new D(Ke,It))},L.decimalPlaces=L.dp=function(Ke,It){var rt,ut,Rt,Ee=this;if(Ke!=null)return E(Ke,0,ne),It==null?It=m:E(It,0,8),Xe(new D(Ee),Ke+Ee.e+1,It);if(!(rt=Ee.c))return null;if(ut=((Rt=rt.length-1)-R(this.e/F))*F,Rt=rt[Rt])for(;Rt%10==0;Rt/=10,ut--);return ut<0&&(ut=0),ut},L.dividedBy=L.div=function(Ke,It){return T(this,new D(Ke,It),K,m)},L.dividedToIntegerBy=L.idiv=function(Ke,It){return T(this,new D(Ke,It),0,1)},L.exponentiatedBy=L.pow=function(Ke,It){var rt,ut,Rt,Ee,Pt,_e,we,xe,Ye,X=this;if(Ke=new D(Ke),Ke.c&&!Ke.isInteger())throw Error(g+"Exponent not an integer: "+nt(Ke));if(It!=null&&(It=new D(It)),_e=Ke.e>14,!X.c||!X.c[0]||X.c[0]==1&&!X.e&&X.c.length==1||!Ke.c||!Ke.c[0])return Ye=new D(Math.pow(+nt(X),_e?2-Q(Ke):+nt(Ke))),It?Ye.mod(It):Ye;if(we=Ke.s<0,It){if(It.c?!It.c[0]:!It.s)return new D(NaN);ut=!we&&X.isInteger()&&It.isInteger(),ut&&(X=X.mod(It))}else{if(Ke.e>9&&(X.e>0||X.e<-1||(X.e==0?X.c[0]>1||_e&&X.c[1]>=24e7:X.c[0]<8e13||_e&&X.c[0]<=9999975e7)))return Ee=X.s<0&&Q(Ke)?-0:0,X.e>-1&&(Ee=1/Ee),new D(we?1/Ee:Ee);G&&(Ee=f(G/F+2))}for(_e?(rt=new D(.5),we&&(Ke.s=1),xe=Q(Ke)):(Rt=Math.abs(+nt(Ke)),xe=Rt%2),Ye=new D(V);;){if(xe){if(Ye=Ye.times(X),!Ye.c)break;Ee?Ye.c.length>Ee&&(Ye.c.length=Ee):ut&&(Ye=Ye.mod(It))}if(Rt){if(Rt=l(Rt/2),Rt===0)break;xe=Rt%2}else if(Ke=Ke.times(rt),Xe(Ke,Ke.e+1,1),Ke.e>14)xe=Q(Ke);else{if(Rt=+nt(Ke),Rt===0)break;xe=Rt%2}X=X.times(X),Ee?X.c&&X.c.length>Ee&&(X.c.length=Ee):ut&&(X=X.mod(It))}return ut?Ye:(we&&(Ye=V.div(Ye)),It?Ye.mod(It):Ee?Xe(Ye,G,m,Pt):Ye)},L.integerValue=function(Ke){var It=new D(this);return Ke==null?Ke=m:E(Ke,0,8),Xe(It,It.e+1,Ke)},L.isEqualTo=L.eq=function(Ke,It){return U(this,new D(Ke,It))===0},L.isFinite=function(){return!!this.c},L.isGreaterThan=L.gt=function(Ke,It){return U(this,new D(Ke,It))>0},L.isGreaterThanOrEqualTo=L.gte=function(Ke,It){return(It=U(this,new D(Ke,It)))===1||It===0},L.isInteger=function(){return!!this.c&&R(this.e/F)>this.c.length-2},L.isLessThan=L.lt=function(Ke,It){return U(this,new D(Ke,It))<0},L.isLessThanOrEqualTo=L.lte=function(Ke,It){return(It=U(this,new D(Ke,It)))===-1||It===0},L.isNaN=function(){return!this.s},L.isNegative=function(){return this.s<0},L.isPositive=function(){return this.s>0},L.isZero=function(){return!!this.c&&this.c[0]==0},L.minus=function(Ke,It){var rt,ut,Rt,Ee,Pt=this,_e=Pt.s;if(Ke=new D(Ke,It),It=Ke.s,!_e||!It)return new D(NaN);if(_e!=It)return Ke.s=-It,Pt.plus(Ke);var we=Pt.e/F,xe=Ke.e/F,Ye=Pt.c,X=Ke.c;if(!we||!xe){if(!Ye||!X)return Ye?(Ke.s=-It,Ke):new D(X?Pt:NaN);if(!Ye[0]||!X[0])return X[0]?(Ke.s=-It,Ke):new D(Ye[0]?Pt:m==3?-0:0)}if(we=R(we),xe=R(xe),Ye=Ye.slice(),_e=we-xe){for((Ee=_e<0)?(_e=-_e,Rt=Ye):(xe=we,Rt=X),Rt.reverse(),It=_e;It--;Rt.push(0));Rt.reverse()}else for(ut=(Ee=(_e=Ye.length)<(It=X.length))?_e:It,_e=It=0;It<ut;It++)if(Ye[It]!=X[It]){Ee=Ye[It]<X[It];break}if(Ee&&(Rt=Ye,Ye=X,X=Rt,Ke.s=-Ke.s),It=(ut=X.length)-(rt=Ye.length),It>0)for(;It--;Ye[rt++]=0);for(It=N-1;ut>_e;){if(Ye[--ut]<X[ut]){for(rt=ut;rt&&!Ye[--rt];Ye[rt]=It);--Ye[rt],Ye[ut]+=N}Ye[ut]-=X[ut]}for(;Ye[0]==0;Ye.splice(0,1),--xe);return Ye[0]?ye(Ke,Ye,xe):(Ke.s=m==3?-1:1,Ke.c=[Ke.e=0],Ke)},L.modulo=L.mod=function(Ke,It){var rt,ut,Rt=this;return Ke=new D(Ke,It),!Rt.c||!Ke.s||Ke.c&&!Ke.c[0]?new D(NaN):!Ke.c||Rt.c&&!Rt.c[0]?new D(Rt):(ie==9?(ut=Ke.s,Ke.s=1,rt=T(Rt,Ke,0,3),Ke.s=ut,rt.s*=ut):rt=T(Rt,Ke,0,ie),Ke=Rt.minus(rt.times(Ke)),!Ke.c[0]&&ie==1&&(Ke.s=Rt.s),Ke)},L.multipliedBy=L.times=function(Ke,It){var rt,ut,Rt,Ee,Pt,_e,we,xe,Ye,X,ht,Ut,zt,Wt,yn,rn=this,un=rn.c,fr=(Ke=new D(Ke,It)).c;if(!un||!fr||!un[0]||!fr[0])return!rn.s||!Ke.s||un&&!un[0]&&!fr||fr&&!fr[0]&&!un?Ke.c=Ke.e=Ke.s=null:(Ke.s*=rn.s,!un||!fr?Ke.c=Ke.e=null:(Ke.c=[0],Ke.e=0)),Ke;for(ut=R(rn.e/F)+R(Ke.e/F),Ke.s*=rn.s,we=un.length,X=fr.length,we<X&&(zt=un,un=fr,fr=zt,Rt=we,we=X,X=Rt),Rt=we+X,zt=[];Rt--;zt.push(0));for(Wt=N,yn=v,Rt=X;--Rt>=0;){for(rt=0,ht=fr[Rt]%yn,Ut=fr[Rt]/yn|0,Pt=we,Ee=Rt+Pt;Ee>Rt;)xe=un[--Pt]%yn,Ye=un[Pt]/yn|0,_e=Ut*xe+Ye*ht,xe=ht*xe+_e%yn*yn+zt[Ee]+rt,rt=(xe/Wt|0)+(_e/yn|0)+Ut*Ye,zt[Ee--]=xe%Wt;zt[Ee]=rt}return rt?++ut:zt.splice(0,1),ye(Ke,zt,ut)},L.negated=function(){var Ke=new D(this);return Ke.s=-Ke.s||null,Ke},L.plus=function(Ke,It){var rt,ut=this,Rt=ut.s;if(Ke=new D(Ke,It),It=Ke.s,!Rt||!It)return new D(NaN);if(Rt!=It)return Ke.s=-It,ut.minus(Ke);var Ee=ut.e/F,Pt=Ke.e/F,_e=ut.c,we=Ke.c;if(!Ee||!Pt){if(!_e||!we)return new D(Rt/0);if(!_e[0]||!we[0])return we[0]?Ke:new D(_e[0]?ut:Rt*0)}if(Ee=R(Ee),Pt=R(Pt),_e=_e.slice(),Rt=Ee-Pt){for(Rt>0?(Pt=Ee,rt=we):(Rt=-Rt,rt=_e),rt.reverse();Rt--;rt.push(0));rt.reverse()}for(Rt=_e.length,It=we.length,Rt-It<0&&(rt=we,we=_e,_e=rt,It=Rt),Rt=0;It;)Rt=(_e[--It]=_e[It]+we[It]+Rt)/N|0,_e[It]=N===_e[It]?0:_e[It]%N;return Rt&&(_e=[Rt].concat(_e),++Pt),ye(Ke,_e,Pt)},L.precision=L.sd=function(Ke,It){var rt,ut,Rt,Ee=this;if(Ke!=null&&Ke!==!!Ke)return E(Ke,1,ne),It==null?It=m:E(It,0,8),Xe(new D(Ee),Ke,It);if(!(rt=Ee.c))return null;if(Rt=rt.length-1,ut=Rt*F+1,Rt=rt[Rt]){for(;Rt%10==0;Rt/=10,ut--);for(Rt=rt[0];Rt>=10;Rt/=10,ut++);}return Ke&&Ee.e+1>ut&&(ut=Ee.e+1),ut},L.shiftedBy=function(Ke){return E(Ke,-j,j),this.times("1e"+Ke)},L.squareRoot=L.sqrt=function(){var Ke,It,rt,ut,Rt,Ee=this,Pt=Ee.c,_e=Ee.s,we=Ee.e,xe=K+4,Ye=new D("0.5");if(_e!==1||!Pt||!Pt[0])return new D(!_e||_e<0&&(!Pt||Pt[0])?NaN:Pt?Ee:1/0);if(_e=Math.sqrt(+nt(Ee)),_e==0||_e==1/0?(It=M(Pt),(It.length+we)%2==0&&(It+="0"),_e=Math.sqrt(+It),we=R((we+1)/2)-(we<0||we%2),_e==1/0?It="1e"+we:(It=_e.toExponential(),It=It.slice(0,It.indexOf("e")+1)+we),rt=new D(It)):rt=new D(_e+""),rt.c[0]){for(we=rt.e,_e=we+xe,_e<3&&(_e=0);;)if(Rt=rt,rt=Ye.times(Rt.plus(T(Ee,Rt,xe,1))),M(Rt.c).slice(0,_e)===(It=M(rt.c)).slice(0,_e))if(rt.e<we&&--_e,It=It.slice(_e-3,_e+1),It=="9999"||!ut&&It=="4999"){if(!ut&&(Xe(Rt,Rt.e+K+2,0),Rt.times(Rt).eq(Ee))){rt=Rt;break}xe+=4,_e+=4,ut=1}else{(!+It||!+It.slice(1)&&It.charAt(0)=="5")&&(Xe(rt,rt.e+K+2,1),Ke=!rt.times(rt).eq(Ee));break}}return Xe(rt,rt.e+K+1,m,Ke)},L.toExponential=function(Ke,It){return Ke!=null&&(E(Ke,0,ne),Ke++),W(this,Ke,It,1)},L.toFixed=function(Ke,It){return Ke!=null&&(E(Ke,0,ne),Ke=Ke+this.e+1),W(this,Ke,It)},L.toFormat=function(Ke,It,rt){var ut,Rt=this;if(rt==null)Ke!=null&&It&&typeof It=="object"?(rt=It,It=null):Ke&&typeof Ke=="object"?(rt=Ke,Ke=It=null):rt=I;else if(typeof rt!="object")throw Error(g+"Argument not an object: "+rt);if(ut=Rt.toFixed(Ke,It),Rt.c){var Ee,Pt=ut.split("."),_e=+rt.groupSize,we=+rt.secondaryGroupSize,xe=rt.groupSeparator||"",Ye=Pt[0],X=Pt[1],ht=Rt.s<0,Ut=ht?Ye.slice(1):Ye,zt=Ut.length;if(we&&(Ee=_e,_e=we,we=Ee,zt-=Ee),_e>0&&zt>0){for(Ee=zt%_e||_e,Ye=Ut.substr(0,Ee);Ee<zt;Ee+=_e)Ye+=xe+Ut.substr(Ee,_e);we>0&&(Ye+=xe+Ut.slice(Ee)),ht&&(Ye="-"+Ye)}ut=X?Ye+(rt.decimalSeparator||"")+((we=+rt.fractionGroupSize)?X.replace(new RegExp("\\d{"+we+"}\\B","g"),"$&"+(rt.fractionGroupSeparator||"")):X):Ye}return(rt.prefix||"")+ut+(rt.suffix||"")},L.toFraction=function(Ke){var It,rt,ut,Rt,Ee,Pt,_e,we,xe,Ye,X,ht,Ut=this,zt=Ut.c;if(Ke!=null&&(_e=new D(Ke),!_e.isInteger()&&(_e.c||_e.s!==1)||_e.lt(V)))throw Error(g+"Argument "+(_e.isInteger()?"out of range: ":"not an integer: ")+nt(_e));if(!zt)return new D(Ut);for(It=new D(V),xe=rt=new D(V),ut=we=new D(V),ht=M(zt),Ee=It.e=ht.length-Ut.e-1,It.c[0]=te[(Pt=Ee%F)<0?F+Pt:Pt],Ke=!Ke||_e.comparedTo(It)>0?Ee>0?It:xe:_e,Pt=O,O=1/0,_e=new D(ht),we.c[0]=0;Ye=T(_e,It,0,1),Rt=rt.plus(Ye.times(ut)),Rt.comparedTo(Ke)!=1;)rt=ut,ut=Rt,xe=we.plus(Ye.times(Rt=xe)),we=Rt,It=_e.minus(Ye.times(Rt=It)),_e=Rt;return Rt=T(Ke.minus(rt),ut,0,1),we=we.plus(Rt.times(xe)),rt=rt.plus(Rt.times(ut)),we.s=xe.s=Ut.s,Ee=Ee*2,X=T(xe,ut,Ee,m).minus(Ut).abs().comparedTo(T(we,rt,Ee,m).minus(Ut).abs())<1?[xe,ut]:[we,rt],O=Pt,X},L.toNumber=function(){return+nt(this)},L.toPrecision=function(Ke,It){return Ke!=null&&E(Ke,1,ne),W(this,Ke,It,2)},L.toString=function(Ke){var It,rt=this,ut=rt.s,Rt=rt.e;return Rt===null?ut?(It="Infinity",ut<0&&(It="-"+It)):It="NaN":(Ke==null?It=Rt<=h||Rt>=_?H(M(rt.c),Rt):re(M(rt.c),Rt,"0"):Ke===10?(rt=Xe(new D(rt),K+Rt+1,m),It=re(M(rt.c),rt.e,"0")):(E(Ke,2,C.length,"Base"),It=se(re(M(rt.c),Rt,"0"),10,Ke,ut,!0)),ut<0&&rt.c[0]&&(It="-"+It)),It},L.valueOf=L.toJSON=function(){return nt(this)},L._isBigNumber=!0,ee!=null&&D.set(ee),D}function R(ee){var T=ee|0;return ee>0||ee===T?T:T-1}function M(ee){for(var T,se,p=1,L=ee.length,V=ee[0]+"";p<L;){for(T=ee[p++]+"",se=F-T.length;se--;T="0"+T);V+=T}for(L=V.length;V.charCodeAt(--L)===48;);return V.slice(0,L+1||1)}function U(ee,T){var se,p,L=ee.c,V=T.c,K=ee.s,m=T.s,h=ee.e,_=T.e;if(!K||!m)return null;if(se=L&&!L[0],p=V&&!V[0],se||p)return se?p?0:-m:K;if(K!=m)return K;if(se=K<0,p=h==_,!L||!V)return p?0:!L^se?1:-1;if(!p)return h>_^se?1:-1;for(m=(h=L.length)<(_=V.length)?h:_,K=0;K<m;K++)if(L[K]!=V[K])return L[K]>V[K]^se?1:-1;return h==_?0:h>_^se?1:-1}function E(ee,T,se,p){if(ee<T||ee>se||ee!==l(ee))throw Error(g+(p||"Argument")+(typeof ee=="number"?ee<T||ee>se?" out of range: ":" not an integer: ":" not a primitive number: ")+String(ee))}function Q(ee){var T=ee.c.length-1;return R(ee.e/F)==T&&ee.c[T]%2!=0}function H(ee,T){return(ee.length>1?ee.charAt(0)+"."+ee.slice(1):ee)+(T<0?"e":"e+")+T}function re(ee,T,se){var p,L;if(T<0){for(L=se+".";++T;L+=se);ee=L+ee}else if(p=ee.length,++T>p){for(L=se,T-=p;--T;L+=se);ee+=L}else T<p&&(ee=ee.slice(0,T)+"."+ee.slice(T));return ee}A=Z(),A.default=A.BigNumber=A,e.exports?e.exports=A:(i||(i=typeof self!="undefined"&&self?self:window),i.BigNumber=A)})(Gr)})(ZIn);var yRs=ZIn.exports,mRs=krs(yRs),Jei={},IRs=$Gr(Vys);(function(e){Object.defineProperty(e,"__esModule",{value:!0});var i=IRs,A=xEt;function c(M){return M&&typeof M=="object"&&"default"in M?M:{default:M}}var f=c(A);function l(M,U,E,Q){function H(re){return re instanceof E?re:new E(function(ee){ee(re)})}return new(E||(E=Promise))(function(re,ee){function T(L){try{p(Q.next(L))}catch(V){ee(V)}}function se(L){try{p(Q.throw(L))}catch(V){ee(V)}}function p(L){L.done?re(L.value):H(L.value).then(T,se)}p((Q=Q.apply(M,U||[])).next())})}e.Network=void 0,function(M){M.Mainnet="mainnet",M.Stagenet="stagenet",M.Testnet="testnet"}(e.Network||(e.Network={})),e.TxType=void 0,function(M){M.Transfer="transfer",M.Unknown="unknown"}(e.TxType||(e.TxType={})),e.FeeOption=void 0,function(M){M.Average="average",M.Fast="fast",M.Fastest="fastest"}(e.FeeOption||(e.FeeOption={})),e.FeeType=void 0,function(M){M.FlatFee="base",M.PerByte="byte"}(e.FeeType||(e.FeeType={}));let g="https://thornode.ninerealms.com/thorchain",w="https://stagenet-thornode.ninerealms.com/thorchain",N="https://testnet.thornode.thorchain.info/thorchain";class F{constructor(U,E){if(this.phrase="",this.chain=U,this.network=E.network||e.Network.Testnet,this.feeBounds=E.feeBounds||{lower:1,upper:1/0},this.network===e.Network.Stagenet&&console.warn("WARNING: This is using stagenet! Real assets are being used!"),E.rootDerivationPaths&&(this.rootDerivationPaths=E.rootDerivationPaths),E.phrase){if(!i.validatePhrase(E.phrase))throw new Error("Invalid phrase");this.phrase=E.phrase}}setNetwork(U){if(!U)throw new Error("Network must be provided");this.network=U,this.network===e.Network.Stagenet&&console.warn("WARNING: This is using stagenet! Real assets are being used!")}getNetwork(){return this.network}getFeeRateFromThorchain(){return l(this,void 0,void 0,function*(){let U=yield this.thornodeAPIGet("/inbound_addresses");if(!Array.isArray(U))throw new Error("bad response from Thornode API");let E=U.find(Q=>Q.chain===this.chain&&typeof Q.gas_rate=="string");if(!E)throw new Error(`Thornode API /inbound_addresses does not contain fees for ${this.chain}`);return Number(E.gas_rate)})}thornodeAPIGet(U){return l(this,void 0,void 0,function*(){let E=(()=>{switch(this.network){case e.Network.Mainnet:return g;case e.Network.Stagenet:return w;case e.Network.Testnet:return N}})();return(yield f.default.get(E+U)).data})}setPhrase(U,E=0){if(this.phrase!==U){if(!i.validatePhrase(U))throw new Error("Invalid phrase");this.phrase=U}return this.getAddress(E)}getFullDerivationPath(U){return this.rootDerivationPaths?`${this.rootDerivationPaths[this.network]}${U}`:""}purgeClient(){this.phrase=""}}function j(M){return Object.values(e.FeeOption).reduce((U,E)=>(U[E]=M,U),{})}function te(M){return Object.assign(Object.assign({},j(M)),{[e.FeeOption.Average]:M*.5,[e.FeeOption.Fastest]:M*5})}function v(M,U){if(U<M.lower||U>M.upper)throw Error(`Fee outside of predetermined bounds: ${U.toString()}`)}function ne(M,U){return Object.values(e.FeeOption).reduce((E,Q)=>(E[Q]=U,E),{type:M})}function Z(M,U){return Object.assign(Object.assign({},ne(M,U)),{[e.FeeOption.Average]:U.times(.5),[e.FeeOption.Fastest]:U.times(5)})}class R{constructor(U,E,Q){this.explorerUrl=U,this.explorerAddressUrlTemplate=E,this.explorerTxUrlTemplate=Q}getExplorerUrl(){return this.explorerUrl}getExplorerAddressUrl(U){return this.explorerAddressUrlTemplate.replace("%%ADDRESS%%",U)}getExplorerTxUrl(U){return this.explorerTxUrlTemplate.replace("%%TX_ID%%",U)}}e.Protocol=void 0,function(M){M[M.THORCHAIN=1]="THORCHAIN"}(e.Protocol||(e.Protocol={})),e.BaseXChainClient=F,e.ExplorerProvider=R,e.checkFeeBounds=v,e.singleFee=ne,e.singleFeeRate=j,e.standardFeeRates=te,e.standardFees=Z})(Jei);var WGr="https://bigdipper.live/cosmos",CRs="https://explorer.theta-testnet.polypore.xyz",_Rs=()=>({[E3.Testnet]:"https://rpc.sentry-02.theta-testnet.polypore.xyz",[E3.Stagenet]:"https://rpc.cosmos.directory/cosmoshub",[E3.Mainnet]:"https://rpc.cosmos.directory/cosmoshub"}),ERs=()=>({[E3.Mainnet]:"m/44'/118'/0'/0/",[E3.Testnet]:"m/44'/118'/0'/0/",[E3.Stagenet]:"m/44'/118'/0'/0/"}),BRs=()=>({[E3.Mainnet]:WGr,[E3.Testnet]:CRs,[E3.Stagenet]:WGr}),vRs=e=>hWr(e,Xue)?wRs:null,CMs=e=>N3t(void 0,void 0,void 0,function*(){var i;let{data:A}=yield xEt.get(`${e}/node_info`);return((i=A==null?void 0:A.node_info)===null||i===void 0?void 0:i.network)||Promise.reject("Could not parse chain id")}),bRs=()=>"cosmos",LLe=6,SRs="200000",Hei=Yz(5e3,LLe),XIn="GAIA",Xue={chain:XIn,symbol:"ATOM",ticker:"ATOM",synth:!1},wRs="uatom",QRs="/cosmos.bank.v1beta1.MsgSend",ZGr={chain:XIn,network:Jei.Network.Mainnet,clientUrls:_Rs(),rootDerivationPaths:ERs(),prefix:"cosmos",defaultDecimals:6,defaultFee:Hei,baseDenom:"uatom",registryTypes:[]},NEt=class extends tyn{constructor(i=ZGr){super(Object.assign(Object.assign({},ZGr),i))}getAssetInfo(){return{asset:Xue,decimal:LLe}}getAssetDecimals(i){return hWr(i,Xue)?LLe:this.defaultDecimals}getExplorerUrl(){return BRs()[this.network]}getExplorerAddressUrl(i){return`${this.getExplorerUrl()}/accounts/${i}`}getExplorerTxUrl(i){return`${this.getExplorerUrl()}/transactions/${i}`}assetFromDenom(i){return i===this.getDenom(Xue)?Xue:i.startsWith("ibc/")?{chain:XIn,symbol:i,ticker:"",synth:!1}:null}getDenom(i){return vRs(i)}getFees(){return N3t(this,void 0,void 0,function*(){try{let i=yield this.getFeeRateFromThorchain(),A=LLe-8,c=i*Math.pow(10,A),f=Yz(c,LLe);return l1n(cGe.FlatFee,f)}catch(i){return l1n(cGe.FlatFee,Hei)}})}prepareTx({sender:i,recipient:A,asset:c,amount:f,memo:l}){return N3t(this,void 0,void 0,function*(){if(!this.validateAddress(i))throw Error("Invalid sender address");if(!this.validateAddress(A))throw Error("Invalid recipient address");let g=this.getDenom(c||this.getAssetInfo().asset);if(!g)throw Error(`Invalid asset ${c==null?void 0:c.symbol} - Only ${this.baseDenom} asset is currently supported to transfer`);let w={amount:f.amount().toString(),denom:g},N={typeUrl:"/cosmos.tx.v1beta1.TxBody",value:{messages:[{typeUrl:this.getMsgTypeUrlByType(F8e.TRANSFER),value:{fromAddress:i,toAddress:A,amount:[w]}}],memo:l}},F=DM.TxRaw.fromPartial({bodyBytes:this.registry.encode(N)});return{rawUnsignedTx:q2.toBase64(DM.TxRaw.encode(F).finish())}})}transferOffline({walletIndex:i=0,recipient:A,asset:c,amount:f,memo:l,gasLimit:g=new mRs(SRs)}){return N3t(this,void 0,void 0,function*(){let w=yield this.getAddressAsync(i),{rawUnsignedTx:N}=yield this.prepareTx({sender:w,recipient:A,asset:c,amount:f,memo:l}),F=PK.decodeTxRaw(q2.fromBase64(N)),j=yield PK.DirectSecp256k1HdWallet.fromMnemonic(this.phrase,{prefix:this.prefix,hdPaths:[Fei(this.getFullDerivationPath(i))]}),te=yield U3t.SigningStargateClient.connectWithSigner(this.clientUrls[this.network],j,{registry:this.registry}),v=F.body.messages.map(Z=>({typeUrl:this.getMsgTypeUrlByType(F8e.TRANSFER),value:te.registry.decode(Z)})),ne=yield te.sign(w,v,{amount:[],gas:g.toString()},F.body.memo);return q2.toBase64(DM.TxRaw.encode(ne).finish())})}getPrefix(){return bRs()}getMsgTypeUrlByType(i){return{[F8e.TRANSFER]:QRs}[i]}getStandardFee(i){let A=this.getDenom(i),c=U3t.GasPrice.fromString(`0.006${A}`);return U3t.calculateFee(9e4,c)}};import*as Ow from"bitcoinjs-lib";import kRs from"coinselect/accumulative";import $In from"coininfo";function uqe(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var Lei=1e5,DRs=8,RRs=100,PRs=2e7,zSe="DOGE",c6t={chain:zSe,symbol:"DOGE",ticker:"DOGE",synth:!1},Gei=new By("https://blockchair.com/dogecoin","https://blockchair.com/dogecoin/address/%%ADDRESS%%","https://blockchair.com/dogecoin/transaction/%%TX_ID%%"),ORs=new By("https://blockexplorer.one/dogecoin/testnet","https://blockexplorer.one/dogecoin/testnet/address/%%ADDRESS%%","https://blockexplorer.one/dogecoin/testnet/tx/%%TX_ID%%"),NRs={[eo.Testnet]:ORs,[eo.Stagenet]:Gei,[eo.Mainnet]:Gei},xRs=new QT("https://sochain.com/api/v3",process.env.SOCHAIN_API_KEY||"",zSe,c6t,8,wT.DOGETEST),qei=new QT("https://sochain.com/api/v3",process.env.SOCHAIN_API_KEY||"",zSe,c6t,8,wT.DOGE),kMs={[eo.Testnet]:xRs,[eo.Stagenet]:qei,[eo.Mainnet]:qei},Kei=new vY("https://api.blockcypher.com/v1",zSe,c6t,8,bY.DOGE,process.env.BLOCKCYPHER_API_KEY||""),MRs={[eo.Testnet]:void 0,[eo.Stagenet]:Kei,[eo.Mainnet]:Kei},Yei=new AH({baseUrl:"https://app.bitgo.com",chain:zSe}),TRs={[eo.Testnet]:void 0,[eo.Stagenet]:Yei,[eo.Mainnet]:Yei},URs=10,FRs=41,JRs=107,jIn=9,Vei=25;function HRs(){return FRs+JRs}var A6t=e=>{switch(e){case eo.Mainnet:return $In.dogecoin.main.toBitcoinJS();case eo.Stagenet:return $In.dogecoin.main.toBitcoinJS();case eo.Testnet:{let i={private:70615956,public:70617039},A=$In.dogecoin.test;return A.versions.bip32=i,A.toBitcoinJS()}}},LRs=(e,i)=>{try{return Ow.address.toOutputScript(e,A6t(i)),!0}catch(A){return!1}};var eCn={network:eo.Mainnet,phrase:"",explorerProviders:NRs,dataProviders:[TRs,MRs],rootDerivationPaths:{[eo.Mainnet]:"m/44'/3'/0'/0/",[eo.Stagenet]:"m/44'/3'/0'/0/",[eo.Testnet]:"m/44'/1'/0'/0/"},feeBounds:{lower:RRs,upper:PRs}},d6t=class extends sH{constructor(i=eCn){super(zSe,{network:i.network,rootDerivationPaths:i.rootDerivationPaths,phrase:i.phrase,feeBounds:i.feeBounds,explorerProviders:i.explorerProviders,dataProviders:i.dataProviders}),this.buildTx=({amount:A,recipient:c,memo:f,feeRate:l,sender:g})=>uqe(this,void 0,void 0,function*(){if(!this.validateAddress(c))throw new Error("Invalid address");let w=yield this.scanUTXOs(g,!1);if(w.length===0)throw new Error("No UTXOs to send");let N=Number(l.toFixed(0)),F=f?this.compileMemo(f):null,j=[];j.push({address:c,value:A.amount().toNumber()}),F&&j.push({script:F,value:0});let{inputs:te,outputs:v}=kRs(w,j,N);if(!te||!v)throw new Error("Balance insufficient for transaction");let ne=new Ow.Psbt({network:A6t(this.network)});ne.setMaximumFeeRate(75e5);for(let Z of te)ne.addInput({hash:Z.hash,index:Z.index,nonWitnessUtxo:Buffer.from(Z.txHex,"hex")});return v.forEach(Z=>{Z.address||(Z.address=g),Z.script?F&&ne.addOutput({script:F,value:0}):ne.addOutput(Z)}),{psbt:ne,utxos:w}})}getAddress(i=0){if(i<0)throw new Error("index must be greater than zero");if(this.phrase){let A=A6t(this.network),c=this.getDogeKeys(this.phrase,i),{address:f}=Ow.payments.p2pkh({pubkey:c.publicKey,network:A});if(!f)throw new Error("Address not defined");return f}throw new Error("Phrase must be provided")}getAddressAsync(i=0){return uqe(this,void 0,void 0,function*(){return this.getAddress(i)})}getAssetInfo(){return{asset:c6t,decimal:DRs}}getDogeKeys(i,A=0){let c=A6t(this.network),f=hX(i),l=Ow.bip32.fromSeed(f,c).derivePath(this.getFullDerivationPath(A));if(!l.privateKey)throw new Error("Could not get private key from phrase");return Ow.ECPair.fromPrivateKey(l.privateKey,{network:c})}validateAddress(i){return LRs(i,this.network)}transfer(i){return uqe(this,void 0,void 0,function*(){let A=i.feeRate||(yield this.getFeeRates())[sd.Fast];ST(this.feeBounds,A);let c=(i==null?void 0:i.walletIndex)||0,{rawUnsignedTx:f}=yield this.prepareTx(Object.assign(Object.assign({},i),{feeRate:A,sender:yield this.getAddressAsync(c)})),l=this.getDogeKeys(this.phrase,c),g=Ow.Psbt.fromBase64(f,{maximumFeeRate:75e5});g.signAllInputs(l),g.finalizeAllInputs();let w=g.extractTransaction().toHex();return yield this.roundRobinBroadcastTx(w)})}createTxInfo(i){return uqe(this,void 0,void 0,function*(){let{psbt:A,utxos:c}=yield this.buildTx(i);return{utxos:c,newTxHex:A.data.globalMap.unsignedTx.toBuffer().toString("hex")}})}prepareTx({sender:i,memo:A,amount:c,recipient:f,feeRate:l}){return uqe(this,void 0,void 0,function*(){let{psbt:g}=yield this.buildTx({sender:i,recipient:f,amount:c,feeRate:l,memo:A});return{rawUnsignedTx:g.toBase64()}})}compileMemo(i){let A=Buffer.from(i,"utf8");return Ow.script.compile([Ow.opcodes.OP_RETURN,A])}getFeeFromUtxos(i,A,c=null){let f=i.length>0?i.reduce(w=>w+HRs(),0)+i.length:0,l=URs+f+jIn+Vei+jIn+Vei;c&&(l+=jIn+c.length);let g=l*A;return g>Lei?g:Lei}};import*as Nw from"bitcoinjs-lib";import GRs from"coinselect/accumulative";import zei from"coininfo";import Wei from"axios";function WSe(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var Zei=1e3,qRs=.5,KRs=500,YRs=8,ZSe="LTC",l6t={chain:ZSe,symbol:"LTC",ticker:"LTC",synth:!1},Xei=new By("https://blockchair.com/litecoin/","https://blockchair.com/litecoin/address/%%ADDRESS%%","https://blockchair.com/litecoin/transaction/%%TX_ID%%"),VRs=new By("https://blockexplorer.one/litecoin/testnet/","https://blockexplorer.one/litecoin/testnet/address/%%ADDRESS%%","https://blockexplorer.one/litecoin/testnet/blockHash/%%TX_ID%%"),zRs={[eo.Testnet]:VRs,[eo.Stagenet]:Xei,[eo.Mainnet]:Xei},WRs=new QT("https://sochain.com/api/v3",process.env.SOCHAIN_API_KEY||"",ZSe,l6t,8,wT.LTCTEST),$ei=new QT("https://sochain.com/api/v3",process.env.SOCHAIN_API_KEY||"",ZSe,l6t,8,wT.LTC),FMs={[eo.Testnet]:WRs,[eo.Stagenet]:$ei,[eo.Mainnet]:$ei},jei=new vY("https://api.blockcypher.com/v1",ZSe,l6t,8,bY.LTC,process.env.BLOCKCYPHER_API_KEY||""),ZRs={[eo.Testnet]:void 0,[eo.Stagenet]:jei,[eo.Mainnet]:jei},eti=new AH({baseUrl:"https://app.bitgo.com",chain:ZSe}),XRs={[eo.Testnet]:void 0,[eo.Stagenet]:eti,[eo.Mainnet]:eti},$Rs=({txHex:e,auth:i,nodeUrl:A})=>WSe(void 0,void 0,void 0,function*(){let c=new Date().getTime().toString(),f={jsonrpc:"2.0",method:"sendrawtransaction",params:[e],id:c},l;if(i?l=(yield Wei.post(A,f,{auth:i})).data:l=(yield Wei.post(A,f)).data,l.error)throw new Error(`Failed to broadcast the transaction: ${l.error}`);return l.result}),jRs=10,e9s=41,t9s=107,tCn=9,tti=25;function n9s(e){var i;return e9s+(!((i=e.witnessUtxo)===null||i===void 0)&&i.script?e.witnessUtxo.script.length:t9s)}var u6t=e=>{switch(e){case eo.Mainnet:case eo.Stagenet:return zei.litecoin.main.toBitcoinJS();case eo.Testnet:return zei.litecoin.test.toBitcoinJS()}},r9s=(e,i)=>{try{return Nw.address.toOutputScript(e,u6t(i)),!0}catch(A){return!1}},i9s=e=>WSe(void 0,void 0,void 0,function*(){return yield $Rs(e)});var nCn={network:eo.Mainnet,phrase:"",explorerProviders:zRs,dataProviders:[XRs,ZRs],rootDerivationPaths:{[eo.Mainnet]:"m/84'/2'/0'/0/",[eo.Testnet]:"m/84'/1'/0'/0/",[eo.Stagenet]:"m/84'/2'/0'/0/"},feeBounds:{lower:qRs,upper:KRs},nodeUrls:{[eo.Mainnet]:"https://litecoin.ninerealms.com",[eo.Stagenet]:"https://litecoin.ninerealms.com",[eo.Testnet]:"https://testnet.ltc.thorchain.info"}},f6t=class extends sH{constructor(i=nCn){super(ZSe,{network:i.network,rootDerivationPaths:i.rootDerivationPaths,phrase:i.phrase,feeBounds:i.feeBounds,explorerProviders:i.explorerProviders,dataProviders:i.dataProviders}),this.nodeUrls=i.nodeUrls,this.nodeAuth=i.nodeAuth}getAddress(i=0){if(i<0)throw new Error("index must be greater than zero");if(this.phrase){let A=u6t(this.network),c=this.getLtcKeys(this.phrase,i),{address:f}=Nw.payments.p2wpkh({pubkey:c.publicKey,network:A});if(!f)throw new Error("Address not defined");return f}throw new Error("Phrase must be provided")}getAddressAsync(i=0){return WSe(this,void 0,void 0,function*(){return this.getAddress(i)})}getAssetInfo(){return{asset:l6t,decimal:YRs}}getLtcKeys(i,A=0){let c=u6t(this.network),f=hX(i),l=Nw.bip32.fromSeed(f,c).derivePath(this.getFullDerivationPath(A));if(!l.privateKey)throw new Error("Could not get private key from phrase");return Nw.ECPair.fromPrivateKey(l.privateKey,{network:c})}validateAddress(i){return r9s(i,this.network)}transfer(i){return WSe(this,void 0,void 0,function*(){let A=i.feeRate||(yield this.getFeeRates())[sd.Fast];ST(this.feeBounds,A);let c=i.walletIndex||0,{rawUnsignedTx:f}=yield this.prepareTx(Object.assign(Object.assign({},i),{feeRate:A,sender:yield this.getAddressAsync(c)})),l=Nw.Psbt.fromBase64(f),g=this.getLtcKeys(this.phrase,c);l.signAllInputs(g),l.finalizeAllInputs();let w=l.extractTransaction().toHex();return yield i9s({txHex:w,nodeUrl:this.nodeUrls[this.network],auth:this.nodeAuth})})}buildTx({amount:i,recipient:A,memo:c,feeRate:f,sender:l}){return WSe(this,void 0,void 0,function*(){if(!this.validateAddress(A))throw new Error("Invalid address");let g=yield this.scanUTXOs(l,!1);if(g.length===0)throw new Error("No utxos to send");let w=Number(f.toFixed(0)),N=c?this.compileMemo(c):null,F=[];F.push({address:A,value:i.amount().toNumber()}),N&&F.push({script:N,value:0});let{inputs:j,outputs:te}=GRs(g,F,w);if(!j||!te)throw new Error("Insufficient Balance for transaction");let v=new Nw.Psbt({network:u6t(this.network)});return j.forEach(ne=>v.addInput({hash:ne.hash,index:ne.index,witnessUtxo:ne.witnessUtxo})),te.forEach(ne=>{ne.address||(ne.address=l),ne.script?N&&v.addOutput({script:N,value:0}):v.addOutput(ne)}),{psbt:v,utxos:g}})}prepareTx({sender:i,memo:A,amount:c,recipient:f,feeRate:l}){return WSe(this,void 0,void 0,function*(){let{psbt:g}=yield this.buildTx({sender:i,recipient:f,amount:c,feeRate:l,memo:A});return{rawUnsignedTx:g.toBase64()}})}compileMemo(i){let A=Buffer.from(i,"utf8");return Nw.script.compile([Nw.opcodes.OP_RETURN,A])}getFeeFromUtxos(i,A,c=null){let f=i.length>0?i.reduce((w,N)=>w+n9s(N),0)+i.length:0,l=jRs+f+i.length+tCn+tti+tCn+tti;c&&(l+=tCn+c.length);let g=l*A;return g>Zei?g:Zei}};import{BigNumber as SD}from"bignumber.js";import J1 from"axios";var o9s="https://midgard.ninerealms.com/";function rc(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var H1="http://localhost".replace(/\/+$/,""),rCn=class{constructor(i,A=H1,c=J1){this.basePath=A,this.axios=c,i&&(this.configuration=i,this.basePath=i.basePath||this.basePath)}},iCn=class extends Error{constructor(i,A){super(A),this.field=i,this.name="RequiredError"}},$1="https://example.com",zF=function(e,i,A){if(A==null)throw new iCn(i,`Required parameter ${i} was null or undefined when calling ${e}.`)};function oCn(e,i,A=""){typeof i=="object"?Array.isArray(i)?i.forEach(c=>oCn(e,c,A)):Object.keys(i).forEach(c=>oCn(e,i[c],`${A}${A!==""?".":""}${c}`)):e.has(A)?e.append(A,i):e.set(A,i)}var j1=function(e,...i){let A=new URLSearchParams(e.search);oCn(A,i),e.search=A.toString()},ep=function(e){return e.pathname+e.search+e.hash},tp=function(e,i,A,c){return(f=i,l=A)=>{let g=Object.assign(Object.assign({},e.options),{url:((c==null?void 0:c.basePath)||l)+e.url});return f.request(g)}};var a9s=function(e){return{getActions:(i,A,c,f,l,g,w,N,F,j,te,v,ne,Z={})=>rc(this,void 0,void 0,function*(){let R="/v2/actions",M=new URL(R,$1),U;e&&(U=e.baseOptions);let E=Object.assign(Object.assign({method:"GET"},U),Z),Q={},H={};i!==void 0&&(H.address=i),A!==void 0&&(H.txid=A),c!==void 0&&(H.asset=c),f!==void 0&&(H.type=f),l!==void 0&&(H.affiliate=l),g!==void 0&&(H.limit=g),w!==void 0&&(H.offset=w),N!==void 0&&(H.nextPageToken=N),F!==void 0&&(H.timestamp=F),j!==void 0&&(H.height=j),te!==void 0&&(H.prevPageToken=te),v!==void 0&&(H.fromTimestamp=v),ne!==void 0&&(H.fromHeight=ne),j1(M,H);let re=U&&U.headers?U.headers:{};return E.headers=Object.assign(Object.assign(Object.assign({},Q),re),Z.headers),{url:ep(M),options:E}}),getBalance:(i,A,c,f={})=>rc(this,void 0,void 0,function*(){zF("getBalance","address",i);let l="/v2/balance/{address}".replace("{address}",encodeURIComponent(String(i))),g=new URL(l,$1),w;e&&(w=e.baseOptions);let N=Object.assign(Object.assign({method:"GET"},w),f),F={},j={};A!==void 0&&(j.timestamp=A),c!==void 0&&(j.height=c),j1(g,j);let te=w&&w.headers?w.headers:{};return N.headers=Object.assign(Object.assign(Object.assign({},F),te),f.headers),{url:ep(g),options:N}}),getBorrowerDetail:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getBorrowerDetail","address",i);let c="/v2/borrower/{address}".replace("{address}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getBorrowersAddresses:(i,A={})=>rc(this,void 0,void 0,function*(){let c="/v2/borrowers",f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.asset=i),j1(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getChurns:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/churns",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getDepthHistory:(i,A,c,f,l,g={})=>rc(this,void 0,void 0,function*(){zF("getDepthHistory","pool",i);let w="/v2/history/depths/{pool}".replace("{pool}",encodeURIComponent(String(i))),N=new URL(w,$1),F;e&&(F=e.baseOptions);let j=Object.assign(Object.assign({method:"GET"},F),g),te={},v={};A!==void 0&&(v.interval=A),c!==void 0&&(v.count=c),f!==void 0&&(v.to=f),l!==void 0&&(v.from=l),j1(N,v);let ne=F&&F.headers?F.headers:{};return j.headers=Object.assign(Object.assign(Object.assign({},te),ne),g.headers),{url:ep(N),options:j}}),getEarningsHistory:(i,A,c,f,l={})=>rc(this,void 0,void 0,function*(){let g="/v2/history/earnings",w=new URL(g,$1),N;e&&(N=e.baseOptions);let F=Object.assign(Object.assign({method:"GET"},N),l),j={},te={};i!==void 0&&(te.interval=i),A!==void 0&&(te.count=A),c!==void 0&&(te.to=c),f!==void 0&&(te.from=f),j1(w,te);let v=N&&N.headers?N.headers:{};return F.headers=Object.assign(Object.assign(Object.assign({},j),v),l.headers),{url:ep(w),options:F}}),getHealth:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/health",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getKnownPools:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/knownpools",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getLiquidityHistory:(i,A,c,f,l,g={})=>rc(this,void 0,void 0,function*(){let w="/v2/history/liquidity_changes",N=new URL(w,$1),F;e&&(F=e.baseOptions);let j=Object.assign(Object.assign({method:"GET"},F),g),te={},v={};i!==void 0&&(v.pool=i),A!==void 0&&(v.interval=A),c!==void 0&&(v.count=c),f!==void 0&&(v.to=f),l!==void 0&&(v.from=l),j1(N,v);let ne=F&&F.headers?F.headers:{};return j.headers=Object.assign(Object.assign(Object.assign({},te),ne),g.headers),{url:ep(N),options:j}}),getMemberDetail:(i,A,c={})=>rc(this,void 0,void 0,function*(){zF("getMemberDetail","address",i);let f="/v2/member/{address}".replace("{address}",encodeURIComponent(String(i))),l=new URL(f,$1),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.showSavers=A),j1(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:ep(l),options:w}}),getMembersAdresses:(i,A={})=>rc(this,void 0,void 0,function*(){let c="/v2/members",f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.pool=i),j1(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getNetworkData:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/network",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getNodes:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/nodes",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getPool:(i,A,c={})=>rc(this,void 0,void 0,function*(){zF("getPool","asset",i);let f="/v2/pool/{asset}".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,$1),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.period=A),j1(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:ep(l),options:w}}),getPoolStats:(i,A,c={})=>rc(this,void 0,void 0,function*(){zF("getPoolStats","asset",i);let f="/v2/pool/{asset}/stats".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,$1),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.period=A),j1(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:ep(l),options:w}}),getPools:(i,A,c={})=>rc(this,void 0,void 0,function*(){let f="/v2/pools",l=new URL(f,$1),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};i!==void 0&&(F.status=i),A!==void 0&&(F.period=A),j1(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:ep(l),options:w}}),getSaverDetail:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getSaverDetail","address",i);let c="/v2/saver/{address}".replace("{address}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getSaversHistory:(i,A,c,f,l,g={})=>rc(this,void 0,void 0,function*(){zF("getSaversHistory","pool",i);let w="/v2/history/savers/{pool}".replace("{pool}",encodeURIComponent(String(i))),N=new URL(w,$1),F;e&&(F=e.baseOptions);let j=Object.assign(Object.assign({method:"GET"},F),g),te={},v={};A!==void 0&&(v.interval=A),c!==void 0&&(v.count=c),f!==void 0&&(v.to=f),l!==void 0&&(v.from=l),j1(N,v);let ne=F&&F.headers?F.headers:{};return j.headers=Object.assign(Object.assign(Object.assign({},te),ne),g.headers),{url:ep(N),options:j}}),getStats:(i={})=>rc(this,void 0,void 0,function*(){let A="/v2/stats",c=new URL(A,$1),f;e&&(f=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},f),i),g={};j1(c,{});let N=f&&f.headers?f.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},g),N),i.headers),{url:ep(c),options:l}}),getSwapHistory:(i,A,c,f,l,g={})=>rc(this,void 0,void 0,function*(){let w="/v2/history/swaps",N=new URL(w,$1),F;e&&(F=e.baseOptions);let j=Object.assign(Object.assign({method:"GET"},F),g),te={},v={};i!==void 0&&(v.pool=i),A!==void 0&&(v.interval=A),c!==void 0&&(v.count=c),f!==void 0&&(v.to=f),l!==void 0&&(v.from=l),j1(N,v);let ne=F&&F.headers?F.headers:{};return j.headers=Object.assign(Object.assign(Object.assign({},te),ne),g.headers),{url:ep(N),options:j}}),getTHORNameDetail:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getTHORNameDetail","name",i);let c="/v2/thorname/lookup/{name}".replace("{name}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getTHORNamesByAddress:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getTHORNamesByAddress","address",i);let c="/v2/thorname/rlookup/{address}".replace("{address}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getTHORNamesOwnerByAddress:(i,A={})=>rc(this,void 0,void 0,function*(){zF("getTHORNamesOwnerByAddress","address",i);let c="/v2/thorname/owner/{address}".replace("{address}",encodeURIComponent(String(i))),f=new URL(c,$1),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={};j1(f,{});let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:ep(f),options:g}}),getTVLHistory:(i,A,c,f,l={})=>rc(this,void 0,void 0,function*(){let g="/v2/history/tvl",w=new URL(g,$1),N;e&&(N=e.baseOptions);let F=Object.assign(Object.assign({method:"GET"},N),l),j={},te={};i!==void 0&&(te.interval=i),A!==void 0&&(te.count=A),c!==void 0&&(te.to=c),f!==void 0&&(te.from=f),j1(w,te);let v=N&&N.headers?N.headers:{};return F.headers=Object.assign(Object.assign(Object.assign({},j),v),l.headers),{url:ep(w),options:F}})}},np=function(e){let i=a9s(e);return{getActions(A,c,f,l,g,w,N,F,j,te,v,ne,Z,R){return rc(this,void 0,void 0,function*(){let M=yield i.getActions(A,c,f,l,g,w,N,F,j,te,v,ne,Z,R);return tp(M,J1,H1,e)})},getBalance(A,c,f,l){return rc(this,void 0,void 0,function*(){let g=yield i.getBalance(A,c,f,l);return tp(g,J1,H1,e)})},getBorrowerDetail(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getBorrowerDetail(A,c);return tp(f,J1,H1,e)})},getBorrowersAddresses(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getBorrowersAddresses(A,c);return tp(f,J1,H1,e)})},getChurns(A){return rc(this,void 0,void 0,function*(){let c=yield i.getChurns(A);return tp(c,J1,H1,e)})},getDepthHistory(A,c,f,l,g,w){return rc(this,void 0,void 0,function*(){let N=yield i.getDepthHistory(A,c,f,l,g,w);return tp(N,J1,H1,e)})},getEarningsHistory(A,c,f,l,g){return rc(this,void 0,void 0,function*(){let w=yield i.getEarningsHistory(A,c,f,l,g);return tp(w,J1,H1,e)})},getHealth(A){return rc(this,void 0,void 0,function*(){let c=yield i.getHealth(A);return tp(c,J1,H1,e)})},getKnownPools(A){return rc(this,void 0,void 0,function*(){let c=yield i.getKnownPools(A);return tp(c,J1,H1,e)})},getLiquidityHistory(A,c,f,l,g,w){return rc(this,void 0,void 0,function*(){let N=yield i.getLiquidityHistory(A,c,f,l,g,w);return tp(N,J1,H1,e)})},getMemberDetail(A,c,f){return rc(this,void 0,void 0,function*(){let l=yield i.getMemberDetail(A,c,f);return tp(l,J1,H1,e)})},getMembersAdresses(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getMembersAdresses(A,c);return tp(f,J1,H1,e)})},getNetworkData(A){return rc(this,void 0,void 0,function*(){let c=yield i.getNetworkData(A);return tp(c,J1,H1,e)})},getNodes(A){return rc(this,void 0,void 0,function*(){let c=yield i.getNodes(A);return tp(c,J1,H1,e)})},getPool(A,c,f){return rc(this,void 0,void 0,function*(){let l=yield i.getPool(A,c,f);return tp(l,J1,H1,e)})},getPoolStats(A,c,f){return rc(this,void 0,void 0,function*(){let l=yield i.getPoolStats(A,c,f);return tp(l,J1,H1,e)})},getPools(A,c,f){return rc(this,void 0,void 0,function*(){let l=yield i.getPools(A,c,f);return tp(l,J1,H1,e)})},getSaverDetail(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getSaverDetail(A,c);return tp(f,J1,H1,e)})},getSaversHistory(A,c,f,l,g,w){return rc(this,void 0,void 0,function*(){let N=yield i.getSaversHistory(A,c,f,l,g,w);return tp(N,J1,H1,e)})},getStats(A){return rc(this,void 0,void 0,function*(){let c=yield i.getStats(A);return tp(c,J1,H1,e)})},getSwapHistory(A,c,f,l,g,w){return rc(this,void 0,void 0,function*(){let N=yield i.getSwapHistory(A,c,f,l,g,w);return tp(N,J1,H1,e)})},getTHORNameDetail(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getTHORNameDetail(A,c);return tp(f,J1,H1,e)})},getTHORNamesByAddress(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getTHORNamesByAddress(A,c);return tp(f,J1,H1,e)})},getTHORNamesOwnerByAddress(A,c){return rc(this,void 0,void 0,function*(){let f=yield i.getTHORNamesOwnerByAddress(A,c);return tp(f,J1,H1,e)})},getTVLHistory(A,c,f,l,g){return rc(this,void 0,void 0,function*(){let w=yield i.getTVLHistory(A,c,f,l,g);return tp(w,J1,H1,e)})}}};var aCn=class extends rCn{getActions(i,A,c,f,l,g,w,N,F,j,te,v,ne,Z){return np(this.configuration).getActions(i,A,c,f,l,g,w,N,F,j,te,v,ne,Z).then(R=>R(this.axios,this.basePath))}getBalance(i,A,c,f){return np(this.configuration).getBalance(i,A,c,f).then(l=>l(this.axios,this.basePath))}getBorrowerDetail(i,A){return np(this.configuration).getBorrowerDetail(i,A).then(c=>c(this.axios,this.basePath))}getBorrowersAddresses(i,A){return np(this.configuration).getBorrowersAddresses(i,A).then(c=>c(this.axios,this.basePath))}getChurns(i){return np(this.configuration).getChurns(i).then(A=>A(this.axios,this.basePath))}getDepthHistory(i,A,c,f,l,g){return np(this.configuration).getDepthHistory(i,A,c,f,l,g).then(w=>w(this.axios,this.basePath))}getEarningsHistory(i,A,c,f,l){return np(this.configuration).getEarningsHistory(i,A,c,f,l).then(g=>g(this.axios,this.basePath))}getHealth(i){return np(this.configuration).getHealth(i).then(A=>A(this.axios,this.basePath))}getKnownPools(i){return np(this.configuration).getKnownPools(i).then(A=>A(this.axios,this.basePath))}getLiquidityHistory(i,A,c,f,l,g){return np(this.configuration).getLiquidityHistory(i,A,c,f,l,g).then(w=>w(this.axios,this.basePath))}getMemberDetail(i,A,c){return np(this.configuration).getMemberDetail(i,A,c).then(f=>f(this.axios,this.basePath))}getMembersAdresses(i,A){return np(this.configuration).getMembersAdresses(i,A).then(c=>c(this.axios,this.basePath))}getNetworkData(i){return np(this.configuration).getNetworkData(i).then(A=>A(this.axios,this.basePath))}getNodes(i){return np(this.configuration).getNodes(i).then(A=>A(this.axios,this.basePath))}getPool(i,A,c){return np(this.configuration).getPool(i,A,c).then(f=>f(this.axios,this.basePath))}getPoolStats(i,A,c){return np(this.configuration).getPoolStats(i,A,c).then(f=>f(this.axios,this.basePath))}getPools(i,A,c){return np(this.configuration).getPools(i,A,c).then(f=>f(this.axios,this.basePath))}getSaverDetail(i,A){return np(this.configuration).getSaverDetail(i,A).then(c=>c(this.axios,this.basePath))}getSaversHistory(i,A,c,f,l,g){return np(this.configuration).getSaversHistory(i,A,c,f,l,g).then(w=>w(this.axios,this.basePath))}getStats(i){return np(this.configuration).getStats(i).then(A=>A(this.axios,this.basePath))}getSwapHistory(i,A,c,f,l,g){return np(this.configuration).getSwapHistory(i,A,c,f,l,g).then(w=>w(this.axios,this.basePath))}getTHORNameDetail(i,A){return np(this.configuration).getTHORNameDetail(i,A).then(c=>c(this.axios,this.basePath))}getTHORNamesByAddress(i,A){return np(this.configuration).getTHORNamesByAddress(i,A).then(c=>c(this.axios,this.basePath))}getTHORNamesOwnerByAddress(i,A){return np(this.configuration).getTHORNamesOwnerByAddress(i,A).then(c=>c(this.axios,this.basePath))}getTVLHistory(i,A,c,f,l){return np(this.configuration).getTVLHistory(i,A,c,f,l).then(g=>g(this.axios,this.basePath))}};var fqe=class{constructor(i={}){this.apiKey=i.apiKey,this.username=i.username,this.password=i.password,this.accessToken=i.accessToken,this.basePath=i.basePath,this.baseOptions=i.baseOptions,this.formDataCtor=i.formDataCtor}isJsonMime(i){let A=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return i!==null&&(A.test(i)||i.toLowerCase()==="application/json-patch+json")}},s9s=o9s,A9s=new fqe({basePath:s9s}),h6t=class extends aCn{constructor(i=A9s){super(i)}};import d9s from"axios";import nti from"axios-retry";function zM(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var c9s={mainnet:{apiRetries:3,midgardBaseUrls:["https://midgard.ninerealms.com"]},stagenet:{apiRetries:3,midgardBaseUrls:["https://stagenet-midgard.ninerealms.com"]},testnet:{apiRetries:3,midgardBaseUrls:["https://testnet.midgard.thorchain.info"]}},sCn=class{constructor(i=eo.Mainnet,A){this.network=i,this.config=A!=null?A:c9s[this.network],nti(d9s,{retries:this.config.apiRetries,retryDelay:nti.exponentialDelay}),this.midgardApis=this.config.midgardBaseUrls.map(c=>new h6t(new fqe({basePath:c})))}getSavers(i){return zM(this,void 0,void 0,function*(){for(let A of this.midgardApis)try{return(yield A.getSaverDetail(i)).data}catch(c){}throw Error("Midgard not responding")})}getPools(){return zM(this,void 0,void 0,function*(){for(let i of this.midgardApis)try{return(yield i.getPools()).data}catch(A){}throw new Error("Midgard not responding")})}getTHORNameDetails(i){return zM(this,void 0,void 0,function*(){for(let A of this.midgardApis)try{let c=yield A.getTHORNameDetail(i);if(c.status==404)return;if(c.status==200)return c.data}catch(c){if(c.response.status==404)return}throw Error("Midgard not responding")})}getTHORNameReverseLookup(i){return zM(this,void 0,void 0,function*(){for(let A of this.midgardApis)try{let c=yield A.getTHORNamesByAddress(i);if(c.status==404)return[];if(c.status==200)return c.data}catch(c){if(c.response.status==404)return[]}throw Error("Midgard not responding")})}getActions({address:i,txid:A,asset:c,type:f,affiliate:l,limit:g,offset:w,nextPageToken:N,timestamp:F,height:j,prevPageToken:te,fromTimestamp:v,fromHeight:ne}){return zM(this,void 0,void 0,function*(){for(let Z of this.midgardApis)try{return(yield Z.getActions(i,A,c,f,l,g,w,N,F,j,te,v,ne)).data}catch(R){}throw new Error("Midgard not responding")})}},u9s=5e3,f9s=5e3,l9s=new sCn,ACn=class{constructor(i=l9s){this.midgard=i,this.cachedPools=new bI(()=>this.midgard.getPools(),u9s),this.cachedSavers=new bI(()=>this.midgard.getSavers(""),f9s)}getPools(){return zM(this,void 0,void 0,function*(){return this.cachedPools.getValue()})}getSavers(i){return zM(this,void 0,void 0,function*(){return this.cachedSavers.getValue(i)})}};yl("AVAX.AVAX");yl("BTC.BTC");yl("GAIA.ATOM");var h9s=yl("THOR.RUNE"),g9s=e=>ec(e)===ec(h9s),p9s=8,y9s=new ACn,g6t=class{constructor(i=y9s){this.midgardCache=i}getPool(i){return zM(this,void 0,void 0,function*(){let c=(yield this.midgardCache.getPools()).find(f=>f.asset===i);if(!c)throw new Error(`Can't find pool for asset: ${i}`);return c})}getSaverPositions(i){return zM(this,void 0,void 0,function*(){let A=new Set;i.forEach(N=>A.add(N.address));let c=Array.from(A).join(","),f=yield this.midgardCache.getSavers(c),l=[],g=[],w=f.pools.map(N=>zM(this,void 0,void 0,function*(){let F=tJ(N.pool);if(F){let j=yield this.getPool(N.pool),te=new ia(wo(N.assetAdded).minus(N.assetWithdrawn),F),v=Number(N==null?void 0:N.saverUnits),ne=Number(j.saversUnits),Z=Number(j.saversDepth),R=v/ne*Z,M=new ia(wo(R),F),U=M.minus(te).div(te).times(100),E=(Date.now()/1e3-Number(N.dateLastAdded))/(365*86400);g.push({depositValue:te,redeemableValue:M,lastAddHeight:-1,percentageGrowth:U.assetAmount.amount().toNumber(),ageInYears:E,ageInDays:E*365,asset:F,errors:l})}}));return yield Promise.all(w),g})}getDecimalForAsset(i){return zM(this,void 0,void 0,function*(){if(g9s(i)||i.synth)return p9s;let A=yield this.getPool(ec(i));return Number(A.nativeDecimal)})}getActions({address:i,txid:A,asset:c,type:f,affiliate:l,limit:g,offset:w,nextPageToken:N,timestamp:F,height:j,prevPageToken:te,fromTimestamp:v,fromHeight:ne}){return zM(this,void 0,void 0,function*(){return this.midgardCache.midgard.getActions({address:i,txid:A,asset:c,type:f,affiliate:l,limit:g,offset:w,nextPageToken:N,timestamp:F,height:j,prevPageToken:te,fromTimestamp:v,fromHeight:ne})})}};import gl from"axios";function Y0(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var pl="http://localhost".replace(/\/+$/,""),WF=class{constructor(i,A=pl,c=gl){this.basePath=A,this.axios=c,i&&(this.configuration=i,this.basePath=i.basePath||this.basePath)}},dCn=class extends Error{constructor(i,A){super(A),this.field=i,this.name="RequiredError"}},ml="https://example.com",x3=function(e,i,A){if(A==null)throw new dCn(i,`Required parameter ${i} was null or undefined when calling ${e}.`)};function cCn(e,i,A=""){typeof i=="object"?Array.isArray(i)?i.forEach(c=>cCn(e,c,A)):Object.keys(i).forEach(c=>cCn(e,i[c],`${A}${A!==""?".":""}${c}`)):e.has(A)?e.append(A,i):e.set(A,i)}var Il=function(e,...i){let A=new URLSearchParams(e.search);cCn(A,i),e.search=A.toString()},Cl=function(e){return e.pathname+e.search+e.hash},_l=function(e,i,A,c){return(f=i,l=A)=>{let g=Object.assign(Object.assign({},e.options),{url:((c==null?void 0:c.basePath)||l)+e.url});return f.request(g)}};var m9s=function(e){return{liquidityProvider:(i,A,c,f={})=>Y0(this,void 0,void 0,function*(){x3("liquidityProvider","asset",i),x3("liquidityProvider","address",A);let l="/thorchain/pool/{asset}/liquidity_provider/{address}".replace("{asset}",encodeURIComponent(String(i))).replace("{address}",encodeURIComponent(String(A))),g=new URL(l,ml),w;e&&(w=e.baseOptions);let N=Object.assign(Object.assign({method:"GET"},w),f),F={},j={};c!==void 0&&(j.height=c),Il(g,j);let te=w&&w.headers?w.headers:{};return N.headers=Object.assign(Object.assign(Object.assign({},F),te),f.headers),{url:Cl(g),options:N}}),liquidityProviders:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("liquidityProviders","asset",i);let f="/thorchain/pool/{asset}/liquidity_providers".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}})}},rti=function(e){let i=m9s(e);return{liquidityProvider(A,c,f,l){return Y0(this,void 0,void 0,function*(){let g=yield i.liquidityProvider(A,c,f,l);return _l(g,gl,pl,e)})},liquidityProviders(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.liquidityProviders(A,c,f);return _l(l,gl,pl,e)})}}};var m6t=class extends WF{liquidityProvider(i,A,c,f){return rti(this.configuration).liquidityProvider(i,A,c,f).then(l=>l(this.axios,this.basePath))}liquidityProviders(i,A,c){return rti(this.configuration).liquidityProviders(i,A,c).then(f=>f(this.axios,this.basePath))}},I9s=function(e){return{mimir:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimir",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),mimirAdmin:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimir/admin",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),mimirKey:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("mimirKey","key",i);let f="/thorchain/mimir/key/{key}".replace("{key}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),mimirNode:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("mimirNode","address",i);let f="/thorchain/mimir/node/{address}".replace("{address}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),mimirNodes:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimir/nodes_all",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),mimirV2:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimirV2",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),mimirV2IDs:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/mimirV2/ids",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}})}},jfe=function(e){let i=I9s(e);return{mimir(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimir(A,c);return _l(f,gl,pl,e)})},mimirAdmin(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimirAdmin(A,c);return _l(f,gl,pl,e)})},mimirKey(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.mimirKey(A,c,f);return _l(l,gl,pl,e)})},mimirNode(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.mimirNode(A,c,f);return _l(l,gl,pl,e)})},mimirNodes(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimirNodes(A,c);return _l(f,gl,pl,e)})},mimirV2(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimirV2(A,c);return _l(f,gl,pl,e)})},mimirV2IDs(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.mimirV2IDs(A,c);return _l(f,gl,pl,e)})}}};var I6t=class extends WF{mimir(i,A){return jfe(this.configuration).mimir(i,A).then(c=>c(this.axios,this.basePath))}mimirAdmin(i,A){return jfe(this.configuration).mimirAdmin(i,A).then(c=>c(this.axios,this.basePath))}mimirKey(i,A,c){return jfe(this.configuration).mimirKey(i,A,c).then(f=>f(this.axios,this.basePath))}mimirNode(i,A,c){return jfe(this.configuration).mimirNode(i,A,c).then(f=>f(this.axios,this.basePath))}mimirNodes(i,A){return jfe(this.configuration).mimirNodes(i,A).then(c=>c(this.axios,this.basePath))}mimirV2(i,A){return jfe(this.configuration).mimirV2(i,A).then(c=>c(this.axios,this.basePath))}mimirV2IDs(i,A){return jfe(this.configuration).mimirV2IDs(i,A).then(c=>c(this.axios,this.basePath))}},C9s=function(e){return{ban:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("ban","address",i);let f="/thorchain/ban/{address}".replace("{address}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),constants:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/constants",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),inboundAddresses:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/inbound_addresses",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),lastblock:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/lastblock",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),lastblockChain:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("lastblockChain","chain",i);let f="/thorchain/lastblock/{chain}".replace("{chain}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),network:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/network",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),ragnarok:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/ragnarok",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),version:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/version",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}})}},poe=function(e){let i=C9s(e);return{ban(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.ban(A,c,f);return _l(l,gl,pl,e)})},constants(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.constants(A,c);return _l(f,gl,pl,e)})},inboundAddresses(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.inboundAddresses(A,c);return _l(f,gl,pl,e)})},lastblock(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.lastblock(A,c);return _l(f,gl,pl,e)})},lastblockChain(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.lastblockChain(A,c,f);return _l(l,gl,pl,e)})},network(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.network(A,c);return _l(f,gl,pl,e)})},ragnarok(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.ragnarok(A,c);return _l(f,gl,pl,e)})},version(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.version(A,c);return _l(f,gl,pl,e)})}}};var C6t=class extends WF{ban(i,A,c){return poe(this.configuration).ban(i,A,c).then(f=>f(this.axios,this.basePath))}constants(i,A){return poe(this.configuration).constants(i,A).then(c=>c(this.axios,this.basePath))}inboundAddresses(i,A){return poe(this.configuration).inboundAddresses(i,A).then(c=>c(this.axios,this.basePath))}lastblock(i,A){return poe(this.configuration).lastblock(i,A).then(c=>c(this.axios,this.basePath))}lastblockChain(i,A,c){return poe(this.configuration).lastblockChain(i,A,c).then(f=>f(this.axios,this.basePath))}network(i,A){return poe(this.configuration).network(i,A).then(c=>c(this.axios,this.basePath))}ragnarok(i,A){return poe(this.configuration).ragnarok(i,A).then(c=>c(this.axios,this.basePath))}version(i,A){return poe(this.configuration).version(i,A).then(c=>c(this.axios,this.basePath))}};var _9s=function(e){return{dpool:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("dpool","asset",i);let f="/thorchain/dpool/{asset}".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),dpools:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/dpools",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),pool:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("pool","asset",i);let f="/thorchain/pool/{asset}".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),pools:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/pools",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}})}},p6t=function(e){let i=_9s(e);return{dpool(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.dpool(A,c,f);return _l(l,gl,pl,e)})},dpools(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.dpools(A,c);return _l(f,gl,pl,e)})},pool(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.pool(A,c,f);return _l(l,gl,pl,e)})},pools(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.pools(A,c);return _l(f,gl,pl,e)})}}};var _6t=class extends WF{dpool(i,A,c){return p6t(this.configuration).dpool(i,A,c).then(f=>f(this.axios,this.basePath))}dpools(i,A){return p6t(this.configuration).dpools(i,A).then(c=>c(this.axios,this.basePath))}pool(i,A,c){return p6t(this.configuration).pool(i,A,c).then(f=>f(this.axios,this.basePath))}pools(i,A){return p6t(this.configuration).pools(i,A).then(c=>c(this.axios,this.basePath))}},E9s=function(e){return{queue:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/queue",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),queueOutbound:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/queue/outbound",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),queueScheduled:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/queue/scheduled",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}}),queueSwap:(i,A={})=>Y0(this,void 0,void 0,function*(){let c="/thorchain/queue/swap",f=new URL(c,ml),l;e&&(l=e.baseOptions);let g=Object.assign(Object.assign({method:"GET"},l),A),w={},N={};i!==void 0&&(N.height=i),Il(f,N);let F=l&&l.headers?l.headers:{};return g.headers=Object.assign(Object.assign(Object.assign({},w),F),A.headers),{url:Cl(f),options:g}})}},y6t=function(e){let i=E9s(e);return{queue(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.queue(A,c);return _l(f,gl,pl,e)})},queueOutbound(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.queueOutbound(A,c);return _l(f,gl,pl,e)})},queueScheduled(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.queueScheduled(A,c);return _l(f,gl,pl,e)})},queueSwap(A,c){return Y0(this,void 0,void 0,function*(){let f=yield i.queueSwap(A,c);return _l(f,gl,pl,e)})}}};var E6t=class extends WF{queue(i,A){return y6t(this.configuration).queue(i,A).then(c=>c(this.axios,this.basePath))}queueOutbound(i,A){return y6t(this.configuration).queueOutbound(i,A).then(c=>c(this.axios,this.basePath))}queueScheduled(i,A){return y6t(this.configuration).queueScheduled(i,A).then(c=>c(this.axios,this.basePath))}queueSwap(i,A){return y6t(this.configuration).queueSwap(i,A).then(c=>c(this.axios,this.basePath))}},B9s=function(e){return{quoteloanclose:(i,A,c,f,l,g,w={})=>Y0(this,void 0,void 0,function*(){let N="/thorchain/quote/loan/close",F=new URL(N,ml),j;e&&(j=e.baseOptions);let te=Object.assign(Object.assign({method:"GET"},j),w),v={},ne={};i!==void 0&&(ne.height=i),A!==void 0&&(ne.from_asset=A),c!==void 0&&(ne.repay_bps=c),f!==void 0&&(ne.to_asset=f),l!==void 0&&(ne.loan_owner=l),g!==void 0&&(ne.min_out=g),Il(F,ne);let Z=j&&j.headers?j.headers:{};return te.headers=Object.assign(Object.assign(Object.assign({},v),Z),w.headers),{url:Cl(F),options:te}}),quoteloanopen:(i,A,c,f,l,g,w,N,F={})=>Y0(this,void 0,void 0,function*(){let j="/thorchain/quote/loan/open",te=new URL(j,ml),v;e&&(v=e.baseOptions);let ne=Object.assign(Object.assign({method:"GET"},v),F),Z={},R={};i!==void 0&&(R.height=i),A!==void 0&&(R.from_asset=A),c!==void 0&&(R.amount=c),f!==void 0&&(R.to_asset=f),l!==void 0&&(R.destination=l),g!==void 0&&(R.min_out=g),w!==void 0&&(R.affiliate_bps=w),N!==void 0&&(R.affiliate=N),Il(te,R);let M=v&&v.headers?v.headers:{};return ne.headers=Object.assign(Object.assign(Object.assign({},Z),M),F.headers),{url:Cl(te),options:ne}}),quotesaverdeposit:(i,A,c,f={})=>Y0(this,void 0,void 0,function*(){let l="/thorchain/quote/saver/deposit",g=new URL(l,ml),w;e&&(w=e.baseOptions);let N=Object.assign(Object.assign({method:"GET"},w),f),F={},j={};i!==void 0&&(j.height=i),A!==void 0&&(j.asset=A),c!==void 0&&(j.amount=c),Il(g,j);let te=w&&w.headers?w.headers:{};return N.headers=Object.assign(Object.assign(Object.assign({},F),te),f.headers),{url:Cl(g),options:N}}),quotesaverwithdraw:(i,A,c,f,l={})=>Y0(this,void 0,void 0,function*(){let g="/thorchain/quote/saver/withdraw",w=new URL(g,ml),N;e&&(N=e.baseOptions);let F=Object.assign(Object.assign({method:"GET"},N),l),j={},te={};i!==void 0&&(te.height=i),A!==void 0&&(te.asset=A),c!==void 0&&(te.address=c),f!==void 0&&(te.withdraw_bps=f),Il(w,te);let v=N&&N.headers?N.headers:{};return F.headers=Object.assign(Object.assign(Object.assign({},j),v),l.headers),{url:Cl(w),options:F}}),quoteswap:(i,A,c,f,l,g,w,N,F,j,te,v={})=>Y0(this,void 0,void 0,function*(){let ne="/thorchain/quote/swap",Z=new URL(ne,ml),R;e&&(R=e.baseOptions);let M=Object.assign(Object.assign({method:"GET"},R),v),U={},E={};i!==void 0&&(E.height=i),A!==void 0&&(E.from_asset=A),c!==void 0&&(E.to_asset=c),f!==void 0&&(E.amount=f),l!==void 0&&(E.destination=l),g!==void 0&&(E.refund_address=g),w!==void 0&&(E.streaming_interval=w),N!==void 0&&(E.streaming_quantity=N),F!==void 0&&(E.tolerance_bps=F),j!==void 0&&(E.affiliate_bps=j),te!==void 0&&(E.affiliate=te),Il(Z,E);let Q=R&&R.headers?R.headers:{};return M.headers=Object.assign(Object.assign(Object.assign({},U),Q),v.headers),{url:Cl(Z),options:M}})}},lqe=function(e){let i=B9s(e);return{quoteloanclose(A,c,f,l,g,w,N){return Y0(this,void 0,void 0,function*(){let F=yield i.quoteloanclose(A,c,f,l,g,w,N);return _l(F,gl,pl,e)})},quoteloanopen(A,c,f,l,g,w,N,F,j){return Y0(this,void 0,void 0,function*(){let te=yield i.quoteloanopen(A,c,f,l,g,w,N,F,j);return _l(te,gl,pl,e)})},quotesaverdeposit(A,c,f,l){return Y0(this,void 0,void 0,function*(){let g=yield i.quotesaverdeposit(A,c,f,l);return _l(g,gl,pl,e)})},quotesaverwithdraw(A,c,f,l,g){return Y0(this,void 0,void 0,function*(){let w=yield i.quotesaverwithdraw(A,c,f,l,g);return _l(w,gl,pl,e)})},quoteswap(A,c,f,l,g,w,N,F,j,te,v,ne){return Y0(this,void 0,void 0,function*(){let Z=yield i.quoteswap(A,c,f,l,g,w,N,F,j,te,v,ne);return _l(Z,gl,pl,e)})}}};var B6t=class extends WF{quoteloanclose(i,A,c,f,l,g,w){return lqe(this.configuration).quoteloanclose(i,A,c,f,l,g,w).then(N=>N(this.axios,this.basePath))}quoteloanopen(i,A,c,f,l,g,w,N,F){return lqe(this.configuration).quoteloanopen(i,A,c,f,l,g,w,N,F).then(j=>j(this.axios,this.basePath))}quotesaverdeposit(i,A,c,f){return lqe(this.configuration).quotesaverdeposit(i,A,c,f).then(l=>l(this.axios,this.basePath))}quotesaverwithdraw(i,A,c,f,l){return lqe(this.configuration).quotesaverwithdraw(i,A,c,f,l).then(g=>g(this.axios,this.basePath))}quoteswap(i,A,c,f,l,g,w,N,F,j,te,v){return lqe(this.configuration).quoteswap(i,A,c,f,l,g,w,N,F,j,te,v).then(ne=>ne(this.axios,this.basePath))}},v9s=function(e){return{saver:(i,A,c,f={})=>Y0(this,void 0,void 0,function*(){x3("saver","asset",i),x3("saver","address",A);let l="/thorchain/pool/{asset}/saver/{address}".replace("{asset}",encodeURIComponent(String(i))).replace("{address}",encodeURIComponent(String(A))),g=new URL(l,ml),w;e&&(w=e.baseOptions);let N=Object.assign(Object.assign({method:"GET"},w),f),F={},j={};c!==void 0&&(j.height=c),Il(g,j);let te=w&&w.headers?w.headers:{};return N.headers=Object.assign(Object.assign(Object.assign({},F),te),f.headers),{url:Cl(g),options:N}}),savers:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("savers","asset",i);let f="/thorchain/pool/{asset}/savers".replace("{asset}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}})}},iti=function(e){let i=v9s(e);return{saver(A,c,f,l){return Y0(this,void 0,void 0,function*(){let g=yield i.saver(A,c,f,l);return _l(g,gl,pl,e)})},savers(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.savers(A,c,f);return _l(l,gl,pl,e)})}}};var v6t=class extends WF{saver(i,A,c,f){return iti(this.configuration).saver(i,A,c,f).then(l=>l(this.axios,this.basePath))}savers(i,A,c){return iti(this.configuration).savers(i,A,c).then(f=>f(this.axios,this.basePath))}};var b9s=function(e){return{thorname:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("thorname","name",i);let f="/thorchain/thorname/{name}".replace("{name}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}})}},S9s=function(e){let i=b9s(e);return{thorname(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.thorname(A,c,f);return _l(l,gl,pl,e)})}}};var b6t=class extends WF{thorname(i,A,c){return S9s(this.configuration).thorname(i,A,c).then(f=>f(this.axios,this.basePath))}};var w9s=function(e){return{tx:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("tx","hash",i);let f="/thorchain/tx/{hash}".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),txSigners:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("txSigners","hash",i);let f="/thorchain/tx/details/{hash}".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),txSignersOld:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("txSignersOld","hash",i);let f="/thorchain/tx/{hash}/signers".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),txStages:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("txStages","hash",i);let f="/thorchain/tx/stages/{hash}".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}}),txStatus:(i,A,c={})=>Y0(this,void 0,void 0,function*(){x3("txStatus","hash",i);let f="/thorchain/tx/status/{hash}".replace("{hash}",encodeURIComponent(String(i))),l=new URL(f,ml),g;e&&(g=e.baseOptions);let w=Object.assign(Object.assign({method:"GET"},g),c),N={},F={};A!==void 0&&(F.height=A),Il(l,F);let j=g&&g.headers?g.headers:{};return w.headers=Object.assign(Object.assign(Object.assign({},N),j),c.headers),{url:Cl(l),options:w}})}},hqe=function(e){let i=w9s(e);return{tx(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.tx(A,c,f);return _l(l,gl,pl,e)})},txSigners(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.txSigners(A,c,f);return _l(l,gl,pl,e)})},txSignersOld(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.txSignersOld(A,c,f);return _l(l,gl,pl,e)})},txStages(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.txStages(A,c,f);return _l(l,gl,pl,e)})},txStatus(A,c,f){return Y0(this,void 0,void 0,function*(){let l=yield i.txStatus(A,c,f);return _l(l,gl,pl,e)})}}};var S6t=class extends WF{tx(i,A,c){return hqe(this.configuration).tx(i,A,c).then(f=>f(this.axios,this.basePath))}txSigners(i,A,c){return hqe(this.configuration).txSigners(i,A,c).then(f=>f(this.axios,this.basePath))}txSignersOld(i,A,c){return hqe(this.configuration).txSignersOld(i,A,c).then(f=>f(this.axios,this.basePath))}txStages(i,A,c){return hqe(this.configuration).txStages(i,A,c).then(f=>f(this.axios,this.basePath))}txStatus(i,A,c){return hqe(this.configuration).txStatus(i,A,c).then(f=>f(this.axios,this.basePath))}};var WM=class{constructor(i={}){this.apiKey=i.apiKey,this.username=i.username,this.password=i.password,this.accessToken=i.accessToken,this.basePath=i.basePath,this.baseOptions=i.baseOptions,this.formDataCtor=i.formDataCtor}isJsonMime(i){let A=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return i!==null&&(A.test(i)||i.toLowerCase()==="application/json-patch+json")}};import Q9s from"axios";import oti from"axios-retry";function jd(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var k9s={BCH:{blockReward:6.25,avgBlockTimeInSecs:600},BTC:{blockReward:6.25,avgBlockTimeInSecs:600},ETH:{blockReward:2,avgBlockTimeInSecs:13},AVAX:{blockReward:2,avgBlockTimeInSecs:3},LTC:{blockReward:12.5,avgBlockTimeInSecs:150},DOGE:{blockReward:1e4,avgBlockTimeInSecs:60},GAIA:{blockReward:0,avgBlockTimeInSecs:6},BNB:{blockReward:0,avgBlockTimeInSecs:6},THOR:{blockReward:0,avgBlockTimeInSecs:6},BSC:{blockReward:0,avgBlockTimeInSecs:3},MAYA:{blockReward:0,avgBlockTimeInSecs:6}},lCn=class{constructor(i){this.thornodeDetails=i;let A=tJ(this.thornodeDetails.asset);if(!A)throw new Error(`could not parse ${this.thornodeDetails.asset}`);this.asset=A,this.assetString=this.thornodeDetails.asset,this.assetBalance=wo(this.thornodeDetails.balance_asset),this.runeBalance=wo(this.thornodeDetails.balance_rune),this.runeToAssetRatio=this.runeBalance.amount().div(this.assetBalance.amount()),this.assetToRuneRatio=this.assetBalance.amount().div(this.runeBalance.amount())}isAvailable(){return this.thornodeDetails.status.toLowerCase()==="available"}},k6t=yl("BNB.BNB"),gqe=yl("AVAX.AVAX"),hCn=yl("BTC.BTC"),gCn=yl("BCH.BCH"),pqe=yl("ETH.ETH"),pCn=yl("DOGE.DOGE"),yCn=yl("LTC.LTC"),mCn=yl("GAIA.ATOM"),ICn=yl("MAYA.CACAO"),CCn=yl("BSC.BNB"),hh=yl("THOR.RUNE"),iTs=yl("ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48"),D6t="BNB",_Cn="BTC",ECn="BCH",BCn="ETH",R6t="GAIA",vCn="DOGE",bCn="LTC",SCn="AVAX",wCn="MAYA",QCn="BSC",ele="THOR",uCn=8,$Se=e=>ec(e)===ec(hh),yqe=(e,i)=>{let A=e.baseAmount.decimal,c=e.baseAmount.amount(),f=i-A;return c=c.times(Math.pow(10,f)),wo(c,i).amount()},BI=(e,i)=>{let A=e.baseAmount.amount(),c=i-e.baseAmount.decimal;return new ia(wo(A.times(Math.pow(10,c)),i),e.asset)},XSe=e=>{switch(e){case D6t:return k6t;case _Cn:return hCn;case BCn:return pqe;case ele:return hh;case R6t:return mCn;case ECn:return gCn;case bCn:return yCn;case vCn:return pCn;case SCn:return gqe;case QCn:return CCn;case wCn:return ICn;default:throw Error("Unknown chain")}},w6t=(e,i)=>{if(e.synth)return new ia(wo(2e6),hh);switch(e.chain){case _Cn:return new ia(wo(i.gasRate.multipliedBy(i.outboundTxSize)),hCn);case ECn:return new ia(wo(i.gasRate.multipliedBy(i.outboundTxSize)),gCn);case bCn:return new ia(wo(i.gasRate.multipliedBy(i.outboundTxSize)),yCn);case vCn:return new ia(wo(i.gasRate.multipliedBy(i.outboundTxSize)),pCn);case D6t:return new ia(wo(i.gasRate),k6t);case BCn:let A=i.gasRate,c=wo(A.multipliedBy(Math.pow(10,9)),18);return Fy(e,pqe)?new ia(c.times(21e3),pqe):new ia(c.times(7e4),pqe);case SCn:let f=i.gasRate,l=wo(f.multipliedBy(Math.pow(10,9)),18);return Fy(e,gqe)?new ia(l.times(21e3),gqe):new ia(l.times(7e4),gqe);case R6t:return new ia(wo(i.gasRate),mCn);case ele:return new ia(wo(2e6),hh);case QCn:return new ia(wo(i.gasRate),CCn);case wCn:return new ia(wo(i.gasRate),ICn)}throw new Error(`could not calculate inbound fee for ${e.chain}`)},Q6t=(e,i)=>{if(e.synth)return new ia(wo(2e6),hh);switch(e.chain){case _Cn:return new ia(wo(i.outboundFee),hCn);case ECn:return new ia(wo(i.outboundFee),gCn);case bCn:return new ia(wo(i.outboundFee),yCn);case vCn:return new ia(wo(i.outboundFee),pCn);case D6t:return new ia(wo(i.outboundFee),k6t);case BCn:return new ia(wo(i.outboundFee.multipliedBy(Math.pow(10,9)),18),pqe);case SCn:return new ia(wo(i.outboundFee.multipliedBy(Math.pow(10,9)),18),gqe);case R6t:return new ia(wo(i.outboundFee),mCn);case QCn:return new ia(wo(i.outboundFee),CCn);case ele:return new ia(wo(2e6),hh);case wCn:return new ia(wo(2e6),ICn)}throw new Error(`could not calculate outbound fee for ${e.chain}`)},D9s=(e,i)=>{let A=yqe(e.asset,8),c=new SD(i.thornodeDetails.LP_units),f=e.rune.baseAmount.amount(),l=A,g=i.runeBalance.amount(),w=i.assetBalance.amount(),N=g.times(l),F=f.times(w),j=c.times(N.plus(F)),te=g.times(w).times(2);return j.div(te)},fCn=(e,i)=>{let A=e.liquidityUnits,c=e.totalUnits,f=i.runeBalance.amount(),g=i.assetBalance.amount().times(A).div(c),w=f.times(A).div(c);return{assetShare:new ia(wo(g),i.asset),runeShare:new ia(wo(w),hh)}},ati=(e,i)=>{let A=yqe(e.asset,8),c=e.rune.baseAmount.amount(),f=A,l=i.runeBalance.amount(),g=i.assetBalance.amount(),w=f.times(l).minus(g.times(c)),N=g.times(c).plus(l.times(g));return w.div(N).abs()},R9s=(e,i,A)=>{let c=e.rune.amount(),f=e.asset.amount(),l=i.runeShare.baseAmount.amount(),g=i.assetShare.baseAmount.amount(),w=l.div(g),N=f.times(w).plus(c).minus(g.times(w).plus(l)),F=f.times(l.div(g)).plus(c).minus(l.plus(l)),j=N>=F?N:F,te=A.current,v=A.lastAdded||0,ne=A.fullProtection,Z=(te-v)/ne,R=Math.min(Z,1),M=j.times(R),U=M.lt(0)?new SD(0):M;return{ILProtection:new ia(wo(U),hh),totalDays:(Z*100).toFixed(2)}},P9s={mainnet:{apiRetries:3,thornodeBaseUrls:["https://thornode.ninerealms.com"]},stagenet:{apiRetries:3,thornodeBaseUrls:["https://stagenet-thornode.ninerealms.com"]},testnet:{apiRetries:3,thornodeBaseUrls:["https://testnet.thornode.thorchain.info"]}},mqe=class{constructor(i=eo.Mainnet,A){this.network=i,this.config=A!=null?A:P9s[this.network],oti(Q9s,{retries:this.config.apiRetries,retryDelay:oti.exponentialDelay}),this.transactionsApi=this.config.thornodeBaseUrls.map(c=>new S6t(new WM({basePath:c}))),this.queueApi=this.config.thornodeBaseUrls.map(c=>new E6t(new WM({basePath:c}))),this.networkApi=this.config.thornodeBaseUrls.map(c=>new C6t(new WM({basePath:c}))),this.poolsApi=this.config.thornodeBaseUrls.map(c=>new _6t(new WM({basePath:c}))),this.liquidityProvidersApi=this.config.thornodeBaseUrls.map(c=>new m6t(new WM({basePath:c}))),this.saversApi=this.config.thornodeBaseUrls.map(c=>new v6t(new WM({basePath:c}))),this.quoteApi=this.config.thornodeBaseUrls.map(c=>new B6t(new WM({basePath:c}))),this.mimirApi=this.config.thornodeBaseUrls.map(c=>new I6t(new WM({basePath:c}))),this.thornamesApi=this.config.thornodeBaseUrls.map(c=>new b6t(new WM({basePath:c})))}getscheduledQueue(){return jd(this,void 0,void 0,function*(){for(let i of this.queueApi)try{return(yield i.queueScheduled()).data}catch(A){throw new Error("THORNode not responding")}throw Error("THORNode not responding")})}getQueue(){return jd(this,void 0,void 0,function*(){for(let i of this.queueApi)try{return(yield i.queue()).data}catch(A){throw new Error("THORNode not responding")}throw Error("THORNode not responding")})}getMimir(){return jd(this,void 0,void 0,function*(){for(let i of this.mimirApi)try{return(yield i.mimir()).data}catch(A){throw new Error("THORNode not responding")}throw Error("THORNode not responding")})}getTxData(i){return jd(this,void 0,void 0,function*(){for(let A of this.transactionsApi)try{return(yield A.tx(i)).data}catch(c){return{observed_tx:void 0,keysign_metric:void 0}}throw new Error("THORNode not responding")})}getTxDetail(i){return jd(this,void 0,void 0,function*(){for(let A of this.transactionsApi)try{return(yield A.txSigners(i)).data}catch(c){throw new Error("THORNode not responding")}throw new Error("THORNode not responding")})}getLastBlock(i){return jd(this,void 0,void 0,function*(){for(let A of this.networkApi)try{return(yield A.lastblock(i)).data}catch(c){}throw new Error("THORNode not responding")})}getPools(){return jd(this,void 0,void 0,function*(){for(let i of this.poolsApi)try{return(yield i.pools()).data}catch(A){}throw new Error("THORNode not responding")})}getPool(i){return jd(this,void 0,void 0,function*(){for(let A of this.poolsApi)try{return(yield A.pool(i)).data}catch(c){}throw new Error("THORNode not responding")})}getTcConstants(){return jd(this,void 0,void 0,function*(){for(let i of this.networkApi)try{let A=yield i.constants();if(A.data.int_64_values)return A.data.int_64_values}catch(A){}throw new Error("THORNode not responding")})}getNetworkValues(){return jd(this,void 0,void 0,function*(){let[i,A]=yield Promise.all([this.getMimir(),this.getTcConstants()]),c={};for(let[f,l]of Object.entries(A))c[f.toUpperCase()]=parseInt(l);for(let[f,l]of Object.entries(i))c[f]=parseInt(l);return c})}getLiquidityProvider(i,A,c){return jd(this,void 0,void 0,function*(){for(let f of this.liquidityProvidersApi)try{return(yield f.liquidityProviders(i,c)).data.find(g=>g.asset_address===A||g.rune_address===A)}catch(l){}throw new Error("THORNode not responding")})}getInboundAddresses(){return jd(this,void 0,void 0,function*(){for(let i of this.networkApi)try{return(yield i.inboundAddresses()).data}catch(A){}throw new Error("THORNode not responding")})}getSavers(i,A){return jd(this,void 0,void 0,function*(){for(let c of this.saversApi)try{return(yield c.savers(i,A)).data}catch(f){}throw new Error("THORNode not responding")})}getSaver(i,A,c){return jd(this,void 0,void 0,function*(){for(let f of this.saversApi)try{return(yield f.saver(i,A,c)).data}catch(l){}throw new Error("THORNode not responding")})}getSaversDepositQuote(i,A,c){return jd(this,void 0,void 0,function*(){for(let f of this.quoteApi)try{return(yield f.quotesaverdeposit(c,i,A)).data}catch(l){}throw new Error("THORNode not responding")})}getSaversWithdrawQuote(i){return jd(this,void 0,void 0,function*(){for(let A of this.quoteApi)try{return(yield A.quotesaverwithdraw(i.height,`${i.asset.chain}.${i.asset.symbol}`,i.address,i.withdrawBps)).data}catch(c){}throw new Error("THORNode not responding")})}getSwapQuote(i,A,c,f,l,g,w,N,F,j,te){return jd(this,void 0,void 0,function*(){for(let v of this.quoteApi)try{return(yield v.quoteswap(j,i,A,c,f,te,l,g,w,N,F)).data}catch(ne){}throw new Error("THORNode not responding")})}getLoanQuoteOpen(i,A,c,f,l,g,w,N){return jd(this,void 0,void 0,function*(){for(let F of this.quoteApi)try{return(yield F.quoteloanopen(N,i,A,c,f,l,g,w)).data}catch(j){}throw new Error("THORNode is not responding")})}getLoanQuoteClose(i,A,c,f,l,g){return jd(this,void 0,void 0,function*(){for(let w of this.quoteApi)try{return(yield w.quoteloanclose(g,i,A,c,f,l)).data}catch(N){}throw new Error("THORNode is not responding")})}getThornameDetails(i,A){return jd(this,void 0,void 0,function*(){for(let c of this.thornamesApi)try{return(yield c.thorname(i,A)).data}catch(f){}throw new Error("THORNode is not responding")})}},O9s=new SD(1),N9s=10*60*1e3,x9s=new mqe,M9s=new g6t,Iqe=class{constructor(i=x9s,A=M9s,c=6e3,f=6e3,l=N9s){this.thornode=i,this.midgardQuery=A,this.poolCache=new bI(()=>this.refreshPoolCache(),c),this.inboundDetailCache=new bI(()=>this.refreshInboundDetailCache(),f),this.networkValuesCache=new bI(()=>i.getNetworkValues(),l)}getExchangeRate(i,A){return jd(this,void 0,void 0,function*(){let c;if(Fy(i,A))c=O9s;else if($Se(i))c=(yield this.getPoolForAsset(A)).assetToRuneRatio;else if($Se(A))c=(yield this.getPoolForAsset(i)).runeToAssetRatio;else{let f=yield this.getPoolForAsset(i),l=yield this.getPoolForAsset(A);c=f.runeToAssetRatio.times(l.assetToRuneRatio)}return c})}getPoolForAsset(i){return jd(this,void 0,void 0,function*(){if($Se(i))throw Error("AssetRuneNative doesn't have a pool");let c=(yield this.getPools())[`${i.chain}.${i.ticker}`];if(c)return c;throw Error(`Pool for ${ec(i)} not found`)})}getPools(){return jd(this,void 0,void 0,function*(){let i=yield this.poolCache.getValue();if(i)return i;throw Error("Could not refresh pools")})}refreshPoolCache(){return jd(this,void 0,void 0,function*(){try{let i=yield this.thornode.getPools(),A={};if(i){for(let c of i)try{let f=i.find(g=>g.asset===c.asset);if(!f)throw Error(`Could not find thornode pool ${c.asset}`);let l=new lCn(f);A[`${l.asset.chain}.${l.asset.ticker}`]=l}catch(f){console.log(f)}return A}}catch(i){console.error("Error refreshing pool cache:",i)}})}refreshInboundDetailCache(){return jd(this,void 0,void 0,function*(){let[i,A]=yield Promise.all([this.thornode.getMimir(),this.thornode.getInboundAddresses()]),c={};for(let l of A){let g=l.chain;if(!g||!l.gas_rate||!l.address||!l.gas_rate_units||!l.outbound_tx_size||!l.outbound_fee||!l.gas_rate_units)throw new Error("Missing required inbound info");let w={chain:g,address:l.address,router:l.router,gasRate:new SD(l.gas_rate),gasRateUnits:l.gas_rate_units,outboundTxSize:new SD(l.outbound_tx_size),outboundFee:new SD(l.outbound_fee),haltedChain:(l==null?void 0:l.halted)||!!i[`HALT${g}CHAIN`]||!!i.HALTCHAINGLOBAL,haltedTrading:!!i.HALTTRADING||!!i[`HALT${g}TRADING`],haltedLP:!!i.PAUSELP||!!i[`PAUSELP${g}`]};c[g]=w}let f={chain:ele,address:"",router:"",gasRate:new SD(0),gasRateUnits:"",outboundTxSize:new SD(0),outboundFee:new SD(0),haltedChain:!1,haltedTrading:!!i.HALTTRADING,haltedLP:!1};return c[ele]=f,c})}convert(i,A){return jd(this,void 0,void 0,function*(){let c=yield this.getExchangeRate(i.asset,A),f=yield this.midgardQuery.getDecimalForAsset(A),l=i.baseAmount.decimal,g=i.baseAmount.times(c).amount(),w=f-l;g=g.times(Math.pow(10,w));let N=wo(g,f);return new ia(N,A)})}getRouterAddressForChain(i){return jd(this,void 0,void 0,function*(){let A=(yield this.getInboundDetails())[i];if(!(A!=null&&A.router))throw new Error("router address is not defined");return A==null?void 0:A.router})}getInboundDetails(){return jd(this,void 0,void 0,function*(){if(this.inboundDetailCache)return yield this.inboundDetailCache.getValue();throw Error("Could not refresh inbound details ")})}getNetworkValues(){return jd(this,void 0,void 0,function*(){if(this.networkValuesCache)return yield this.networkValuesCache.getValue();throw Error("Could not refresh network values ")})}},T9s=new Iqe,tle=class{constructor(i=T9s,A=k9s){this.thorchainCache=i,this.chainAttributes=A}quoteSwap({fromAsset:i,destinationAsset:A,amount:c,destinationAddress:f,streamingInterval:l,streamingQuantity:g,toleranceBps:w,affiliateBps:N,affiliateAddress:F,height:j}){return jd(this,void 0,void 0,function*(){let te=[],v=yield this.validateAmount(c);v&&te.push(v.message);let ne=ec(i),Z=ec(A),R=yqe(c,8),M=yield this.thorchainCache.thornode.getSwapQuote(ne,Z,R.toNumber(),f,l,g,w,N,F,j),U;typeof M=="string"?U={error:M}:U=M;let E=JSON.parse(JSON.stringify(U));if(E.error&&te.push(`Thornode request quote: ${E.error}`),te.length>0)return{memo:"",toAddress:"",dustThreshold:new ia(wo(0),hh),expiry:new Date,txEstimate:{totalFees:{asset:A,affiliateFee:new ia(wo(0),hh),outboundFee:new ia(wo(0),hh)},slipBasisPoints:0,netOutput:new ia(wo(0),A),outboundDelaySeconds:0,inboundConfirmationSeconds:0,canSwap:!1,errors:te,netOutputStreaming:new ia(wo(0),hh),maxStreamingQuantity:0,outboundDelayBlocks:0,streamingSlipBasisPoints:0,streamingSwapBlocks:0,streamingSwapSeconds:0,totalSwapSeconds:0,warning:""}};let Q=yl(M.fees.asset),H=yield this.thorchainCache.midgardQuery.getDecimalForAsset(Q),re=yield this.thorchainCache.midgardQuery.getDecimalForAsset(A);return M.recommended_min_amount_in&&R.toNumber()<Number(M.recommended_min_amount_in)&&te.push(`Error amount in: ${R.toNumber()} is less than reccommended Min Amount: ${M.recommended_min_amount_in}`),M.memo===void 0&&te.push(`Error parsing swap quote: Memo is ${M.memo}`),{memo:M.memo?M.memo:"",dustThreshold:BI(new ia(wo(M.dust_threshold),i),c.baseAmount.decimal),toAddress:M.inbound_address?M.inbound_address:"",expiry:new Date(M.expiry*1e3),txEstimate:{totalFees:{asset:i,affiliateFee:BI(new ia(wo(M.fees.affiliate),Q),H),outboundFee:BI(new ia(wo(M.fees.outbound),Q),H)},slipBasisPoints:M.slippage_bps,netOutput:BI(new ia(wo(M.expected_amount_out),A),re),netOutputStreaming:BI(new ia(wo(M.expected_amount_out_streaming),A),re),outboundDelaySeconds:M.outbound_delay_seconds,inboundConfirmationSeconds:M.inbound_confirmation_seconds,recommendedMinAmountIn:M.recommended_min_amount_in,maxStreamingQuantity:M.max_streaming_quantity?M.max_streaming_quantity:0,outboundDelayBlocks:M.outbound_delay_blocks,streamingSlipBasisPoints:M.streaming_slippage_bps,streamingSwapBlocks:M.streaming_swap_blocks?M.streaming_swap_blocks:0,streamingSwapSeconds:M.streaming_swap_seconds?M.streaming_swap_seconds:0,totalSwapSeconds:M.total_swap_seconds?M.total_swap_seconds:0,canSwap:!(!M.memo||te.length>0),errors:te,warning:M.warning}}})}validateAmount(i){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i.asset);if(i.baseAmount.decimal!==A)return new Error(`Invalid number of decimals: ${ec(i.asset)} must have ${A} decimals`)})}outboundDelay(i){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.getNetworkValues(),c=new ia(wo(A.MINTXOUTVOLUMETHRESHOLD),hh),f=A.MAXTXOUTOFFSET,l=new ia(wo(A.TXOUTDELAYRATE),hh).assetAmount.amount().toNumber(),g=yield this.thorchainCache.thornode.getQueue(),w=new ia(wo(g.scheduled_outbound_value),hh),N=this.chainAttributes[ele].avgBlockTimeInSecs,F=yield this.thorchainCache.convert(i,hh);if(F.lt(c))return N;if(w==null)throw new Error("Could not return Scheduled Outbound Value");let te=F.plus(w).div(c);l=l-te.assetAmount.amount().toNumber()<=1?1:l;let v=F.assetAmount.amount().toNumber()/l;return v=v>f?f:v,v*N})}getFeesIn(i,A){return jd(this,void 0,void 0,function*(){return{asset:i.asset,outboundFee:yield this.convert(i.outboundFee,A),affiliateFee:yield this.convert(i.affiliateFee,A)}})}convert(i,A){return jd(this,void 0,void 0,function*(){return yield this.thorchainCache.convert(i,A)})}confCounting(i){return jd(this,void 0,void 0,function*(){if($Se(i.asset)||i.asset.chain==D6t||i.asset.chain==R6t||i.asset.synth)return this.chainAttributes[ele].avgBlockTimeInSecs;let A=XSe(i.asset.chain),f=(yield this.thorchainCache.convert(i,A)).assetAmount,l=this.chainAttributes[i.asset.chain];return Math.ceil(f.amount().div(l.blockReward).toNumber())*l.avgBlockTimeInSecs})}estimateAddLP(i){return jd(this,void 0,void 0,function*(){let A=[];(i.asset.asset.synth||i.rune.asset.synth)&&A.push("you cannot add liquidity with a synth"),$Se(i.rune.asset)||A.push("params.rune must be THOR.RUNE");let c=yield this.thorchainCache.getPoolForAsset(i.asset.asset),f=D9s({asset:i.asset,rune:i.rune},c),l=yield this.thorchainCache.getInboundDetails(),g={liquidityUnits:f,totalUnits:new SD(c.thornodeDetails.LP_units)},w=fCn(g,c),N=yield this.confCounting(i.asset),F=yield this.confCounting(i.rune),j=N>F?N:F,te=new ia(wo(0),i.asset.asset),v=new ia(wo(0),hh);i.asset.assetAmount.eq(0)||(te=w6t(i.asset.asset,l[i.asset.asset.chain]),te.assetAmount.amount().times(3).gt(i.asset.assetAmount.amount())&&A.push("Asset amount is less than fees")),i.rune.assetAmount.eq(0)||(v=w6t(i.rune.asset,l[i.rune.asset.chain]),v.assetAmount.amount().times(3).gt(i.rune.assetAmount.amount())&&A.push("Rune amount is less than fees"));let ne=(yield this.convert(te,hh)).plus(v),Z=ati({asset:i.asset,rune:i.rune},c);return{assetPool:c.thornodeDetails.asset,slipPercent:Z.times(100),poolShare:w,lpUnits:wo(f),runeToAssetRatio:c.runeToAssetRatio,inbound:{fees:{asset:te,rune:v,total:ne}},estimatedWaitSeconds:j,errors:A,canAdd:!(A.length>0)}})}checkLiquidityPosition(i,A){return jd(this,void 0,void 0,function*(){let c=yield this.thorchainCache.getPoolForAsset(i);if(!c)throw Error(`Could not find pool for ${i}`);if(!A)throw Error(`No address provided ${A}`);let f=yield this.thorchainCache.thornode.getLiquidityProvider(c.assetString,A);if(!f)throw Error(`Could not find LP for ${A}`);let l=(yield this.thorchainCache.thornode.getLastBlock()).find(E=>E.chain===i.chain);if(!l)throw Error("Could not get block data");let g={totalUnits:new SD(c.thornodeDetails.LP_units),liquidityUnits:new SD(f.units)},w=yield this.thorchainCache.thornode.getNetworkValues(),N={current:l.thorchain,lastAdded:f.last_add_height,fullProtection:w.FULLIMPLOSSPROTECTIONBLOCKS},F=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i),j={asset:wo(f.asset_deposit_value,F),rune:wo(f.rune_deposit_value)},te=fCn(g,c),v=Math.sqrt(j.asset.times(j.rune).div(g.liquidityUnits).amount().toNumber()),Z=Math.sqrt(te.assetShare.baseAmount.times(te.runeShare.baseAmount).div(g.liquidityUnits).amount().toNumber())-v,R=Z>0?Z/v:0,M=R9s(j,te,N);return{poolShare:te,lpGrowth:`${(R*100).toFixed(2)} %`,position:f,impermanentLossProtection:M}})}getPoolRatios(i){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.getPoolForAsset(i);return{assetToRune:A.assetToRuneRatio,runeToAsset:A.runeToAssetRatio}})}estimateWithdrawLP(i){return jd(this,void 0,void 0,function*(){let A=i.assetAddress?i.assetAddress:i.runeAddress,c=yield this.checkLiquidityPosition(i.asset,A),f=yield this.getDustValues(i.asset),l=yield this.thorchainCache.getPoolForAsset(i.asset),g=fCn({liquidityUnits:new SD(c.position.units),totalUnits:new SD(l.thornodeDetails.LP_units)},l),w=ati({asset:g.assetShare,rune:g.runeShare},l),N=yield this.confCounting(g.assetShare.div(i.percentage/100)),F=yield this.confCounting(g.runeShare.div(i.percentage/100)),j=0;c.position.asset_address&&c.position.rune_address?j=N>F?N:F:c.position.asset_address?j=N:j=F;let v=(yield this.thorchainCache.getInboundDetails())[i.asset.chain],ne=w6t(hh,v),Z=w6t(i.asset,v),R=Q6t(hh,v),M=Q6t(i.asset,v);return{assetAddress:c.position.asset_address,runeAddress:c.position.rune_address,slipPercent:w.times(100),inbound:{minToSend:{rune:f.rune,asset:f.asset,total:(yield this.convert(f.asset,hh)).plus(f.rune)},fees:{rune:ne,asset:Z,total:(yield this.convert(Z,hh)).plus(ne)}},outboundFee:{asset:M,rune:R,total:(yield this.convert(M,hh)).plus(R)},assetAmount:g.assetShare,runeAmount:g.runeShare,lpGrowth:c.lpGrowth,estimatedWaitSeconds:j,impermanentLossProtection:c.impermanentLossProtection,assetPool:l.thornodeDetails.asset}})}getDustValues(i){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i);switch(i.chain){case"BNB":return{asset:new ia(mf(fl(1e-6,A)),k6t),rune:new ia(mf(fl(0)),hh)};case"BTC":case"BCH":case"LTC":return{asset:new ia(mf(fl(1e-4,A)),i),rune:new ia(mf(fl(0)),hh)};case"ETH":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"THOR":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"GAIA":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"DOGE":return{asset:new ia(mf(fl(.01,A)),i),rune:new ia(mf(fl(0)),hh)};case"AVAX":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"BSC":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};case"MAYA":return{asset:new ia(mf(fl(0,A)),i),rune:new ia(mf(fl(0)),hh)};default:throw Error("Unknown chain")}})}estimateAddSaver(i){return jd(this,void 0,void 0,function*(){let A=[];A=yield this.getAddSaversEstimateErrors(i);let c=i.baseAmount.decimal!=8?yqe(i,8):i.baseAmount.amount(),f=yield this.thorchainCache.thornode.getSaversDepositQuote(ec(i.asset),c.toNumber()),l=JSON.parse(JSON.stringify(f));if(l.error&&A.push(`Thornode request quote failed: ${l.error}`),f.recommended_min_amount_in&&i.baseAmount.amount().toNumber()<Number(f.recommended_min_amount_in)&&A.push(`Error amount in: ${i.baseAmount.amount().toNumber()} is less than recommended Min Amount: ${f.recommended_min_amount_in}`),A.length>0)return{assetAmount:i,estimatedDepositValue:new ia(wo(0),i.asset),fee:{affiliate:new ia(wo(0),i.asset),asset:i.asset,outbound:new ia(wo(0),i.asset),liquidity:new ia(wo(0),i.asset),totalBps:f.fees.total_bps||0},expiry:new Date(0),toAddress:"",memo:"",saverCapFilledPercent:-1,estimatedWaitTime:-1,slipBasisPoints:-1,recommendedMinAmountIn:f.recommended_min_amount_in,canAddSaver:!1,errors:A};let g=(yield this.thorchainCache.getPoolForAsset(i.asset)).thornodeDetails,w=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i.asset),N=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i.asset),F={affiliate:BI(new ia(wo(f.fees.affiliate),i.asset),w),asset:yl(f.fees.asset),outbound:BI(new ia(wo(f.fees.outbound),yl(f.fees.asset)),N),liquidity:BI(new ia(wo(f.fees.liquidity),yl(f.fees.asset)),N),totalBps:f.fees.total_bps||0},j=Number(g.synth_supply)/Number(g.balance_asset)*100;return{assetAmount:BI(new ia(wo(f.expected_amount_out),i.asset),w),estimatedDepositValue:BI(new ia(wo(f.expected_amount_deposit),i.asset),w),fee:F,expiry:new Date(f.expiry),toAddress:f.inbound_address,memo:f.memo,estimatedWaitTime:f.inbound_confirmation_seconds||0,canAddSaver:A.length===0,slipBasisPoints:f.slippage_bps,saverCapFilledPercent:j,recommendedMinAmountIn:f.recommended_min_amount_in,errors:A}})}estimateWithdrawSaver(i){return jd(this,void 0,void 0,function*(){let A=[];($Se(i.asset)||i.asset.synth)&&A.push("Native Rune and synth assets are not supported only L1's");let c=yield this.thorchainCache.getInboundDetails(),f=yield this.getSaverPosition(i);if(f.errors.length>0){for(let v=0;v<f.errors.length;v++)A.push(f.errors[v]);return{dustAmount:new ia(wo(0),XSe(i.asset.chain)),dustThreshold:new ia(wo(0),XSe(i.asset.chain)),expectedAssetAmount:new ia(mf(fl(f.redeemableValue.assetAmount.amount())),i.asset),fee:{affiliate:new ia(mf(fl(0)),i.asset),asset:i.asset,liquidity:new ia(wo(0),i.asset),outbound:new ia(mf(fl(Q6t(i.asset,c[i.asset.chain]).assetAmount.amount())),i.asset),totalBps:0},expiry:new Date(0),toAddress:"",memo:"",inboundDelayBlocks:0,inboundDelaySeconds:0,outBoundDelayBlocks:0,outBoundDelaySeconds:0,slipBasisPoints:-1,errors:A}}let l=yield this.thorchainCache.thornode.getSaversWithdrawQuote(i),g=JSON.parse(JSON.stringify(l));if(g.error&&A.push(`Thornode request quote failed: ${g.error}`),A.length>0)return{dustAmount:new ia(wo(0),XSe(i.asset.chain)),dustThreshold:new ia(wo(0),XSe(i.asset.chain)),expectedAssetAmount:new ia(mf(fl(0)),i.asset),fee:{affiliate:new ia(wo(0),i.asset),asset:i.asset,liquidity:new ia(wo(0),i.asset),outbound:new ia(wo(0),i.asset),totalBps:0},expiry:new Date(0),toAddress:"",memo:"",inboundDelayBlocks:0,inboundDelaySeconds:0,outBoundDelayBlocks:0,outBoundDelaySeconds:0,slipBasisPoints:-1,errors:A};let w=yl(l.fees.asset),N=XSe(i.asset.chain),F=yield this.thorchainCache.midgardQuery.getDecimalForAsset(w),j=yield this.thorchainCache.midgardQuery.getDecimalForAsset(N);return{dustAmount:BI(new ia(wo(l.dust_amount),N),j),dustThreshold:BI(new ia(wo(l.dust_threshold),N),j),expectedAssetAmount:BI(new ia(wo(l.expected_amount_out),i.asset),F),fee:{affiliate:BI(new ia(wo(l.fees.affiliate),w),F),asset:w,liquidity:BI(new ia(wo(l.fees.liquidity),w),F),outbound:BI(new ia(wo(l.fees.outbound),w),F),totalBps:l.fees.total_bps||0},expiry:new Date(l.expiry),toAddress:l.inbound_address,memo:l.memo,inboundDelayBlocks:l.inbound_confirmation_blocks||0,inboundDelaySeconds:l.inbound_confirmation_seconds||0,outBoundDelayBlocks:l.outbound_delay_blocks||0,outBoundDelaySeconds:l.outbound_delay_seconds||0,slipBasisPoints:l.slippage_bps,errors:A}})}getSaverPosition(i){return jd(this,void 0,void 0,function*(){let A=[],c=yield this.thorchainCache.getInboundDetails(),f=yield this.thorchainCache.midgardQuery.getDecimalForAsset(i.asset),l=(yield this.thorchainCache.thornode.getLastBlock()).find(H=>H.chain===i.asset.chain),g=(yield this.thorchainCache.thornode.getSavers(`${i.asset.chain}.${i.asset.symbol}`)).find(H=>H.asset_address.toLowerCase()===i.address.toLowerCase()),w=(yield this.thorchainCache.getPoolForAsset(i.asset)).thornodeDetails;g||A.push(`Could not find position for ${i.address}`),g!=null&&g.last_add_height||A.push(`Could not find position for ${i.address}`),l!=null&&l.thorchain||A.push("Could not get thorchain block height");let N=Q6t(i.asset,c[i.asset.chain]),F=yqe(N,8);Number(g==null?void 0:g.asset_redeem_value)<F.toNumber()&&A.push("Unlikely to withdraw balance as outbound fee is greater than redeemable amount");let j=Number(g==null?void 0:g.units),te=Number(g==null?void 0:g.last_add_height),v=Number(w.savers_units),ne=Number(w.savers_depth),Z=j/v*ne,R=BI(new ia(wo(g==null?void 0:g.asset_deposit_value),i.asset),f),M=BI(new ia(wo(Z),i.asset),f),U=(Number(l==null?void 0:l.thorchain)-te)/(365*86400/6),E=M.minus(R).div(R).times(100);return{depositValue:R,redeemableValue:M,lastAddHeight:Number(g==null?void 0:g.last_add_height),percentageGrowth:E.assetAmount.amount().toNumber(),ageInYears:U,ageInDays:U*365,asset:i.asset,errors:A}})}getAddSaversEstimateErrors(i){return jd(this,void 0,void 0,function*(){let A=[],c=yield this.thorchainCache.getPools(),f=Object.values(c).filter(j=>j.thornodeDetails.savers_depth!=="0"),l=yield this.thorchainCache.getInboundDetails();f.find(j=>ec(j.asset)===ec(i.asset))||A.push(` ${ec(i.asset)} does not have a saver's pool`),l[i.asset.chain].haltedChain&&A.push(`${i.asset.chain} is halted, cannot add`),(yield this.thorchainCache.getPoolForAsset(i.asset)).thornodeDetails.status.toLowerCase()!=="available"&&A.push(`Pool is not available for this asset ${ec(i.asset)}`);let N=new ia(wo(l[i.asset.chain].gasRate),i.asset),F=yield this.convert(N,i.asset);return i.lte(F)&&A.push("Add amount does not cover fees"),A})}getLoanQuoteOpen({asset:i,amount:A,targetAsset:c,destination:f,minOut:l,affiliateBps:g,affiliate:w,height:N}){return jd(this,void 0,void 0,function*(){let F=[],j=yield this.thorchainCache.thornode.getLoanQuoteOpen(`${i.chain}.${i.symbol}`,A.baseAmount.amount().toNumber(),`${c.chain}.${c.symbol}`,f,l,g,w,N),te=JSON.parse(JSON.stringify(j));return te.error&&F.push(`Thornode request quote failed: ${te.error}`),j.recommended_min_amount_in&&A.baseAmount.amount().toNumber()<Number(j.recommended_min_amount_in)&&F.push(`Error amount in: ${A.baseAmount.amount().toNumber()} is less than reccommended Min Amount: ${j.recommended_min_amount_in}`),F.length>0?{inboundAddress:"",expectedWaitTime:{outboundDelayBlocks:void 0,outbondDelaySeconds:void 0},fees:{asset:"",liquidity:void 0,outbound:void 0,total_bps:void 0},slippageBps:void 0,router:void 0,expiry:0,warning:"",notes:"",dustThreshold:void 0,recommendedMinAmountIn:j.recommended_min_amount_in,memo:void 0,expectedAmountOut:"",expectedCollateralizationRatio:"",expectedCollateralDeposited:"",expectedDebtIssued:"",errors:F}:{inboundAddress:j.inbound_address,expectedWaitTime:{outboundDelayBlocks:j.outbound_delay_blocks,outbondDelaySeconds:j.outbound_delay_seconds},fees:{asset:j.fees.asset,liquidity:j.fees.liquidity,outbound:j.fees.outbound,total_bps:j.fees.total_bps},slippageBps:j.slippage_bps,router:j.router,expiry:j.expiry,warning:j.warning,notes:j.notes,dustThreshold:j.dust_threshold,recommendedMinAmountIn:j.recommended_min_amount_in,memo:j.memo,expectedAmountOut:j.expected_amount_out,expectedCollateralizationRatio:j.expected_collateralization_ratio,expectedCollateralDeposited:j.expected_collateral_deposited,expectedDebtIssued:j.expected_debt_issued,errors:F}})}getLoanQuoteClose({asset:i,amount:A,loanAsset:c,loanOwner:f,minOut:l,height:g}){return jd(this,void 0,void 0,function*(){let w=[],N=yield this.thorchainCache.thornode.getLoanQuoteClose(`${i.chain}.${i.symbol}`,A.baseAmount.amount().toNumber(),`${c.chain}.${c.symbol}`,f,l,g),F=JSON.parse(JSON.stringify(N));return F.error&&w.push(`Thornode request quote failed: ${F.error}`),w.length>0?{inboundAddress:"",expectedWaitTime:{outboundDelayBlocks:void 0,outbondDelaySeconds:void 0},fees:{asset:"",liquidity:void 0,outbound:void 0,total_bps:void 0},slippageBps:void 0,router:void 0,expiry:0,warning:"",notes:"",dustThreshold:void 0,recommendedMinAmountIn:N.recommended_min_amount_in,memo:void 0,expectedAmountOut:"",expectedCollateralWithdrawn:"",expectedDebtRepaid:"",errors:w}:{inboundAddress:N.inbound_address,expectedWaitTime:{outboundDelayBlocks:N.outbound_delay_blocks,outbondDelaySeconds:N.outbound_delay_seconds},fees:{asset:N.fees.asset,liquidity:N.fees.liquidity,outbound:N.fees.outbound,total_bps:N.fees.total_bps},slippageBps:N.slippage_bps,router:N.router,expiry:N.expiry,warning:N.warning,notes:N.notes,dustThreshold:N.dust_threshold,recommendedMinAmountIn:N.recommended_min_amount_in,memo:N.memo,expectedAmountOut:N.expected_amount_out,expectedCollateralWithdrawn:N.expected_collateral_withdrawn,expectedDebtRepaid:N.expected_debt_repaid,errors:w}})}getThornameDetails(i,A){return jd(this,void 0,void 0,function*(){let c=[];try{let f=yield this.thorchainCache.thornode.getThornameDetails(i,A),l=JSON.parse(JSON.stringify(f));if(l.error&&c.push(`Thornode request quote failed: ${l.error}`),c.length>0)return{name:"",expireBlockHeight:0,owner:"",preferredAsset:"",affiliateCollectorRune:"",aliases:[],error:c};let g=f.aliases.map(N=>({chain:N.chain,address:N.address}));return{name:f.name||"",expireBlockHeight:f.expire_block_height||0,owner:f.owner||"",preferredAsset:f.preferred_asset||"",affiliateCollectorRune:f.affiliate_collector_rune||"",aliases:g||[]}}catch(f){return{name:"",expireBlockHeight:0,owner:"",preferredAsset:"",affiliateCollectorRune:"",aliases:[],error:c}}})}estimateThorname(i){return jd(this,void 0,void 0,function*(){let A=yield this.getThornameDetails(i.thorname);if(A.owner!==""&&!i.isUpdate)throw Error("Thorname already registered");let f=(yield this.thorchainCache.thornode.getLastBlock())[0].thorchain,l=i.isUpdate?A==null?void 0:A.expireBlockHeight:f,g=i.isUpdate?0:5259600;if(i.expirity){let v=Math.floor(Date.now()/1e3),Z=Math.floor(i.expirity.getTime()/1e3)-v,R=Math.round(Z/6),M=f+R;g=A!=null&&A.expireBlockHeight?M-(A==null?void 0:A.expireBlockHeight):R}let w=yield this.thorchainCache.thornode.getTcConstants(),N=i.isUpdate?wo(0):wo(w.TNSRegisterFee),F=wo(w.TNSFeePerBlock).times(g>0?g:0),j=new ia(N.plus(F),hh);return{memo:`~:${i.thorname}:${i.chain}:${i.chainAddress}:${i.owner?i.owner:""}:${i.preferredAsset?ec(i.preferredAsset):""}:${i.isUpdate?"":l+g}`.replace(/^:+|:+$/g,""),value:j}})}getInboundDetails(){return jd(this,void 0,void 0,function*(){return this.thorchainCache.getInboundDetails()})}getChainInboundDetails(i){return jd(this,void 0,void 0,function*(){let A=yield this.getInboundDetails();if(!A[i])throw Error(`No inbound details known for ${i} chain`);return A[i]})}getSwapHistory({addresses:i}){return jd(this,void 0,void 0,function*(){let A=yield this.thorchainCache.midgardQuery.midgardCache.midgard.getActions({address:i.join(","),type:"swap"}),c=yield this.thorchainCache.getPools(),f=(l,g,w)=>{let N=g in l&&l[g].thornodeDetails.decimals||uCn;return N===uCn?new ia(wo(w),yl(g)):BI(new ia(wo(w),yl(g)),N)};return{count:A.count?Number(A.count):0,swaps:A.actions.map(l=>({date:new Date(Number(l.date)/Math.pow(10,6)),status:l.status,inboundTx:{hash:l.in[0].txID,address:l.in[0].address,amount:f(c,l.in[0].coins[0].asset,l.in[0].coins[0].amount)},outboundTx:{hash:l.out[0].txID,address:l.out[0].address,amount:f(c,l.out[0].coins[0].asset,l.out[0].coins[0].amount)}}))}})}},sti;(function(e){e.Swap="Swap",e.AddLP="AddLP",e.WithdrawLP="WithdrawLP",e.AddSaver="AddSaver",e.WithdrawSaver="WithdrawSaver",e.Refund="Refund",e.Other="Other",e.Unknown="Unknown"})(sti||(sti={}));var Ati;(function(e){e.Observed_Consensus="Observed_Consensus",e.Observed_Incomplete="Observed_Incomplete",e.Unknown="Unknown"})(Ati||(Ati={}));var dti;(function(e){e.Complete="Complete",e.Complete_Refunded="Complete_Refunded",e.Complete_Below_Dust="Complete_Below_Dust",e.Incomplete="Incomplete"})(dti||(dti={}));var cti;(function(e){e.Complete="Complete",e.Complete_Refunded="Complete_Refunded",e.Complete_Below_Dust="Complete_Below_Dust",e.Incomplete="Incomplete"})(cti||(cti={}));var uti;(function(e){e.Complete="Complete",e.Incomplete="Incomplete",e.Complete_Refunded="Complete_Refunded"})(uti||(uti={}));var fti;(function(e){e.Complete="Complete",e.Incomplete="Incomplete",e.Complete_Refunded="Complete_Refunded"})(fti||(fti={}));var lti;(function(e){e.Complete="Complete",e.Complete_Refunded="Complete_Refunded",e.Complete_Below_Dust="Complete_Below_Dust",e.Incomplete="Incomplete"})(lti||(lti={}));import{ethers as hti}from"ethers";function pm(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}function Vm(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var U9s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,kCn=Math.ceil,zK=Math.floor,QD="[BigNumber Error] ",gti=QD+"Number primitive has more than 15 significant digits: ",ZF=1e14,ku=14,DCn=9007199254740991,RCn=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],yoe=1e7,M3=1e9;function xti(e){var i,A,c,f=E.prototype={constructor:E,toString:null,valueOf:null},l=new E(1),g=20,w=4,N=-7,F=21,j=-1e7,te=1e7,v=!1,ne=1,Z=0,R={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",U=!0;function E(se,p){var L,V,K,m,h,_,b,O,J=this;if(!(J instanceof E))return new E(se,p);if(p==null){if(se&&se._isBigNumber===!0){J.s=se.s,!se.c||se.e>te?J.c=J.e=null:se.e<j?J.c=[J.e=0]:(J.e=se.e,J.c=se.c.slice());return}if((_=typeof se=="number")&&se*0==0){if(J.s=1/se<0?(se=-se,-1):1,se===~~se){for(m=0,h=se;h>=10;h/=10,m++);m>te?J.c=J.e=null:(J.e=m,J.c=[se]);return}O=String(se)}else{if(!U9s.test(O=String(se)))return c(J,O,_);J.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(m=O.indexOf("."))>-1&&(O=O.replace(".","")),(h=O.search(/e/i))>0?(m<0&&(m=h),m+=+O.slice(h+1),O=O.substring(0,h)):m<0&&(m=O.length)}else{if(Ty(p,2,M.length,"Base"),p==10&&U)return J=new E(se),ee(J,g+J.e+1,w);if(O=String(se),_=typeof se=="number"){if(se*0!=0)return c(J,O,_,p);if(J.s=1/se<0?(O=O.slice(1),-1):1,E.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(gti+se)}else J.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(L=M.slice(0,p),m=h=0,b=O.length;h<b;h++)if(L.indexOf(V=O.charAt(h))<0){if(V=="."){if(h>m){m=b;continue}}else if(!K&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){K=!0,h=-1,m=0;continue}return c(J,String(se),_,p)}_=!1,O=A(O,p,10,J.s),(m=O.indexOf("."))>-1?O=O.replace(".",""):m=O.length}for(h=0;O.charCodeAt(h)===48;h++);for(b=O.length;O.charCodeAt(--b)===48;);if(O=O.slice(h,++b)){if(b-=h,_&&E.DEBUG&&b>15&&(se>DCn||se!==zK(se)))throw Error(gti+J.s*se);if((m=m-h-1)>te)J.c=J.e=null;else if(m<j)J.c=[J.e=0];else{if(J.e=m,J.c=[],h=(m+1)%ku,m<0&&(h+=ku),h<b){for(h&&J.c.push(+O.slice(0,h)),b-=ku;h<b;)J.c.push(+O.slice(h,h+=ku));h=ku-(O=O.slice(h)).length}else h-=b;for(;h--;O+="0");J.c.push(+O)}}else J.c=[J.e=0]}E.clone=xti,E.ROUND_UP=0,E.ROUND_DOWN=1,E.ROUND_CEIL=2,E.ROUND_FLOOR=3,E.ROUND_HALF_UP=4,E.ROUND_HALF_DOWN=5,E.ROUND_HALF_EVEN=6,E.ROUND_HALF_CEIL=7,E.ROUND_HALF_FLOOR=8,E.EUCLID=9,E.config=E.set=function(se){var p,L;if(se!=null)if(typeof se=="object"){if(se.hasOwnProperty(p="DECIMAL_PLACES")&&(L=se[p],Ty(L,0,M3,p),g=L),se.hasOwnProperty(p="ROUNDING_MODE")&&(L=se[p],Ty(L,0,8,p),w=L),se.hasOwnProperty(p="EXPONENTIAL_AT")&&(L=se[p],L&&L.pop?(Ty(L[0],-M3,0,p),Ty(L[1],0,M3,p),N=L[0],F=L[1]):(Ty(L,-M3,M3,p),N=-(F=L<0?-L:L))),se.hasOwnProperty(p="RANGE"))if(L=se[p],L&&L.pop)Ty(L[0],-M3,-1,p),Ty(L[1],1,M3,p),j=L[0],te=L[1];else if(Ty(L,-M3,M3,p),L)j=-(te=L<0?-L:L);else throw Error(QD+p+" cannot be zero: "+L);if(se.hasOwnProperty(p="CRYPTO"))if(L=se[p],L===!!L)if(L)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))v=L;else throw v=!L,Error(QD+"crypto unavailable");else v=L;else throw Error(QD+p+" not true or false: "+L);if(se.hasOwnProperty(p="MODULO_MODE")&&(L=se[p],Ty(L,0,9,p),ne=L),se.hasOwnProperty(p="POW_PRECISION")&&(L=se[p],Ty(L,0,M3,p),Z=L),se.hasOwnProperty(p="FORMAT"))if(L=se[p],typeof L=="object")R=L;else throw Error(QD+p+" not an object: "+L);if(se.hasOwnProperty(p="ALPHABET"))if(L=se[p],typeof L=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(L))U=L.slice(0,10)=="0123456789",M=L;else throw Error(QD+p+" invalid: "+L)}else throw Error(QD+"Object expected: "+se);return{DECIMAL_PLACES:g,ROUNDING_MODE:w,EXPONENTIAL_AT:[N,F],RANGE:[j,te],CRYPTO:v,MODULO_MODE:ne,POW_PRECISION:Z,FORMAT:R,ALPHABET:M}},E.isBigNumber=function(se){if(!se||se._isBigNumber!==!0)return!1;if(!E.DEBUG)return!0;var p,L,V=se.c,K=se.e,m=se.s;e:if({}.toString.call(V)=="[object Array]"){if((m===1||m===-1)&&K>=-M3&&K<=M3&&K===zK(K)){if(V[0]===0){if(K===0&&V.length===1)return!0;break e}if(p=(K+1)%ku,p<1&&(p+=ku),String(V[0]).length==p){for(p=0;p<V.length;p++)if(L=V[p],L<0||L>=ZF||L!==zK(L))break e;if(L!==0)return!0}}}else if(V===null&&K===null&&(m===null||m===1||m===-1))return!0;throw Error(QD+"Invalid BigNumber: "+se)},E.maximum=E.max=function(){return H(arguments,f.lt)},E.minimum=E.min=function(){return H(arguments,f.gt)},E.random=function(){var se=9007199254740992,p=Math.random()*se&2097151?function(){return zK(Math.random()*se)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(L){var V,K,m,h,_,b=0,O=[],J=new E(l);if(L==null?L=g:Ty(L,0,M3),h=kCn(L/ku),v)if(crypto.getRandomValues){for(V=crypto.getRandomValues(new Uint32Array(h*=2));b<h;)_=V[b]*131072+(V[b+1]>>>11),_>=9e15?(K=crypto.getRandomValues(new Uint32Array(2)),V[b]=K[0],V[b+1]=K[1]):(O.push(_%1e14),b+=2);b=h/2}else if(crypto.randomBytes){for(V=crypto.randomBytes(h*=7);b<h;)_=(V[b]&31)*281474976710656+V[b+1]*1099511627776+V[b+2]*4294967296+V[b+3]*16777216+(V[b+4]<<16)+(V[b+5]<<8)+V[b+6],_>=9e15?crypto.randomBytes(7).copy(V,b):(O.push(_%1e14),b+=7);b=h/7}else throw v=!1,Error(QD+"crypto unavailable");if(!v)for(;b<h;)_=p(),_<9e15&&(O[b++]=_%1e14);for(h=O[--b],L%=ku,h&&L&&(_=RCn[ku-L],O[b]=zK(h/_)*_);O[b]===0;O.pop(),b--);if(b<0)O=[m=0];else{for(m=-1;O[0]===0;O.splice(0,1),m-=ku);for(b=1,_=O[0];_>=10;_/=10,b++);b<ku&&(m-=ku-b)}return J.e=m,J.c=O,J}}(),E.sum=function(){for(var se=1,p=arguments,L=new E(p[0]);se<p.length;)L=L.plus(p[se++]);return L},A=function(){var se="0123456789";function p(L,V,K,m){for(var h,_=[0],b,O=0,J=L.length;O<J;){for(b=_.length;b--;_[b]*=V);for(_[0]+=m.indexOf(L.charAt(O++)),h=0;h<_.length;h++)_[h]>K-1&&(_[h+1]==null&&(_[h+1]=0),_[h+1]+=_[h]/K|0,_[h]%=K)}return _.reverse()}return function(L,V,K,m,h){var _,b,O,J,ie,G,I,C,D=L.indexOf("."),W=g,ae=w;for(D>=0&&(J=Z,Z=0,L=L.replace(".",""),C=new E(V),G=C.pow(L.length-D),Z=J,C.c=p(hW(ZM(G.c),G.e,"0"),10,K,se),C.e=C.c.length),I=p(L,V,K,h?(_=M,se):(_=se,M)),O=J=I.length;I[--J]==0;I.pop());if(!I[0])return _.charAt(0);if(D<0?--O:(G.c=I,G.e=O,G.s=m,G=i(G,C,W,ae,K),I=G.c,ie=G.r,O=G.e),b=O+W+1,D=I[b],J=K/2,ie=ie||b<0||I[b+1]!=null,ie=ae<4?(D!=null||ie)&&(ae==0||ae==(G.s<0?3:2)):D>J||D==J&&(ae==4||ie||ae==6&&I[b-1]&1||ae==(G.s<0?8:7)),b<1||!I[0])L=ie?hW(_.charAt(1),-W,_.charAt(0)):_.charAt(0);else{if(I.length=b,ie)for(--K;++I[--b]>K;)I[b]=0,b||(++O,I=[1].concat(I));for(J=I.length;!I[--J];);for(D=0,L="";D<=J;L+=_.charAt(I[D++]));L=hW(L,O,_.charAt(0))}return L}}(),i=function(){function se(V,K,m){var h,_,b,O,J=0,ie=V.length,G=K%yoe,I=K/yoe|0;for(V=V.slice();ie--;)b=V[ie]%yoe,O=V[ie]/yoe|0,h=I*b+O*G,_=G*b+h%yoe*yoe+J,J=(_/m|0)+(h/yoe|0)+I*O,V[ie]=_%m;return J&&(V=[J].concat(V)),V}function p(V,K,m,h){var _,b;if(m!=h)b=m>h?1:-1;else for(_=b=0;_<m;_++)if(V[_]!=K[_]){b=V[_]>K[_]?1:-1;break}return b}function L(V,K,m,h){for(var _=0;m--;)V[m]-=_,_=V[m]<K[m]?1:0,V[m]=_*h+V[m]-K[m];for(;!V[0]&&V.length>1;V.splice(0,1));}return function(V,K,m,h,_){var b,O,J,ie,G,I,C,D,W,ae,ye,Xe,nt,Ke,It,rt,ut,Rt=V.s==K.s?1:-1,Ee=V.c,Pt=K.c;if(!Ee||!Ee[0]||!Pt||!Pt[0])return new E(!V.s||!K.s||(Ee?Pt&&Ee[0]==Pt[0]:!Pt)?NaN:Ee&&Ee[0]==0||!Pt?Rt*0:Rt/0);for(D=new E(Rt),W=D.c=[],O=V.e-K.e,Rt=m+O+1,_||(_=ZF,O=$M(V.e/ku)-$M(K.e/ku),Rt=Rt/ku|0),J=0;Pt[J]==(Ee[J]||0);J++);if(Pt[J]>(Ee[J]||0)&&O--,Rt<0)W.push(1),ie=!0;else{for(Ke=Ee.length,rt=Pt.length,J=0,Rt+=2,G=zK(_/(Pt[0]+1)),G>1&&(Pt=se(Pt,G,_),Ee=se(Ee,G,_),rt=Pt.length,Ke=Ee.length),nt=rt,ae=Ee.slice(0,rt),ye=ae.length;ye<rt;ae[ye++]=0);ut=Pt.slice(),ut=[0].concat(ut),It=Pt[0],Pt[1]>=_/2&&It++;do{if(G=0,b=p(Pt,ae,rt,ye),b<0){if(Xe=ae[0],rt!=ye&&(Xe=Xe*_+(ae[1]||0)),G=zK(Xe/It),G>1)for(G>=_&&(G=_-1),I=se(Pt,G,_),C=I.length,ye=ae.length;p(I,ae,C,ye)==1;)G--,L(I,rt<C?ut:Pt,C,_),C=I.length,b=1;else G==0&&(b=G=1),I=Pt.slice(),C=I.length;if(C<ye&&(I=[0].concat(I)),L(ae,I,ye,_),ye=ae.length,b==-1)for(;p(Pt,ae,rt,ye)<1;)G++,L(ae,rt<ye?ut:Pt,ye,_),ye=ae.length}else b===0&&(G++,ae=[0]);W[J++]=G,ae[0]?ae[ye++]=Ee[nt]||0:(ae=[Ee[nt]],ye=1)}while((nt++<Ke||ae[0]!=null)&&Rt--);ie=ae[0]!=null,W[0]||W.splice(0,1)}if(_==ZF){for(J=1,Rt=W[0];Rt>=10;Rt/=10,J++);ee(D,m+(D.e=J+O*ku-1)+1,h,ie)}else D.e=O,D.r=+ie;return D}}();function Q(se,p,L,V){var K,m,h,_,b;if(L==null?L=w:Ty(L,0,8),!se.c)return se.toString();if(K=se.c[0],h=se.e,p==null)b=ZM(se.c),b=V==1||V==2&&(h<=N||h>=F)?O6t(b,h):hW(b,h,"0");else if(se=ee(new E(se),p,L),m=se.e,b=ZM(se.c),_=b.length,V==1||V==2&&(p<=m||m<=N)){for(;_<p;b+="0",_++);b=O6t(b,m)}else if(p-=h,b=hW(b,m,"0"),m+1>_){if(--p>0)for(b+=".";p--;b+="0");}else if(p+=m-_,p>0)for(m+1==_&&(b+=".");p--;b+="0");return se.s<0&&K?"-"+b:b}function H(se,p){for(var L,V=1,K=new E(se[0]);V<se.length;V++)if(L=new E(se[V]),L.s)p.call(K,L)&&(K=L);else{K=L;break}return K}function re(se,p,L){for(var V=1,K=p.length;!p[--K];p.pop());for(K=p[0];K>=10;K/=10,V++);return(L=V+L*ku-1)>te?se.c=se.e=null:L<j?se.c=[se.e=0]:(se.e=L,se.c=p),se}c=function(){var se=/^(-?)0([xbo])(?=\w[\w.]*$)/i,p=/^([^.]+)\.$/,L=/^\.([^.]+)$/,V=/^-?(Infinity|NaN)$/,K=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(m,h,_,b){var O,J=_?h:h.replace(K,"");if(V.test(J))m.s=isNaN(J)?null:J<0?-1:1;else{if(!_&&(J=J.replace(se,function(ie,G,I){return O=(I=I.toLowerCase())=="x"?16:I=="b"?2:8,!b||b==O?G:ie}),b&&(O=b,J=J.replace(p,"$1").replace(L,"0.$1")),h!=J))return new E(J,O);if(E.DEBUG)throw Error(QD+"Not a"+(b?" base "+b:"")+" number: "+h);m.s=null}m.c=m.e=null}}();function ee(se,p,L,V){var K,m,h,_,b,O,J,ie=se.c,G=RCn;if(ie){e:{for(K=1,_=ie[0];_>=10;_/=10,K++);if(m=p-K,m<0)m+=ku,h=p,b=ie[O=0],J=b/G[K-h-1]%10|0;else if(O=kCn((m+1)/ku),O>=ie.length)if(V){for(;ie.length<=O;ie.push(0));b=J=0,K=1,m%=ku,h=m-ku+1}else break e;else{for(b=_=ie[O],K=1;_>=10;_/=10,K++);m%=ku,h=m-ku+K,J=h<0?0:b/G[K-h-1]%10|0}if(V=V||p<0||ie[O+1]!=null||(h<0?b:b%G[K-h-1]),V=L<4?(J||V)&&(L==0||L==(se.s<0?3:2)):J>5||J==5&&(L==4||V||L==6&&(m>0?h>0?b/G[K-h]:0:ie[O-1])%10&1||L==(se.s<0?8:7)),p<1||!ie[0])return ie.length=0,V?(p-=se.e+1,ie[0]=G[(ku-p%ku)%ku],se.e=-p||0):ie[0]=se.e=0,se;if(m==0?(ie.length=O,_=1,O--):(ie.length=O+1,_=G[ku-m],ie[O]=h>0?zK(b/G[K-h]%G[h])*_:0),V)for(;;)if(O==0){for(m=1,h=ie[0];h>=10;h/=10,m++);for(h=ie[0]+=_,_=1;h>=10;h/=10,_++);m!=_&&(se.e++,ie[0]==ZF&&(ie[0]=1));break}else{if(ie[O]+=_,ie[O]!=ZF)break;ie[O--]=0,_=1}for(m=ie.length;ie[--m]===0;ie.pop());}se.e>te?se.c=se.e=null:se.e<j&&(se.c=[se.e=0])}return se}function T(se){var p,L=se.e;return L===null?se.toString():(p=ZM(se.c),p=L<=N||L>=F?O6t(p,L):hW(p,L,"0"),se.s<0?"-"+p:p)}return f.absoluteValue=f.abs=function(){var se=new E(this);return se.s<0&&(se.s=1),se},f.comparedTo=function(se,p){return jSe(this,new E(se,p))},f.decimalPlaces=f.dp=function(se,p){var L,V,K,m=this;if(se!=null)return Ty(se,0,M3),p==null?p=w:Ty(p,0,8),ee(new E(m),se+m.e+1,p);if(!(L=m.c))return null;if(V=((K=L.length-1)-$M(this.e/ku))*ku,K=L[K])for(;K%10==0;K/=10,V--);return V<0&&(V=0),V},f.dividedBy=f.div=function(se,p){return i(this,new E(se,p),g,w)},f.dividedToIntegerBy=f.idiv=function(se,p){return i(this,new E(se,p),0,1)},f.exponentiatedBy=f.pow=function(se,p){var L,V,K,m,h,_,b,O,J,ie=this;if(se=new E(se),se.c&&!se.isInteger())throw Error(QD+"Exponent not an integer: "+T(se));if(p!=null&&(p=new E(p)),_=se.e>14,!ie.c||!ie.c[0]||ie.c[0]==1&&!ie.e&&ie.c.length==1||!se.c||!se.c[0])return J=new E(Math.pow(+T(ie),_?se.s*(2-P6t(se)):+T(se))),p?J.mod(p):J;if(b=se.s<0,p){if(p.c?!p.c[0]:!p.s)return new E(NaN);V=!b&&ie.isInteger()&&p.isInteger(),V&&(ie=ie.mod(p))}else{if(se.e>9&&(ie.e>0||ie.e<-1||(ie.e==0?ie.c[0]>1||_&&ie.c[1]>=24e7:ie.c[0]<8e13||_&&ie.c[0]<=9999975e7)))return m=ie.s<0&&P6t(se)?-0:0,ie.e>-1&&(m=1/m),new E(b?1/m:m);Z&&(m=kCn(Z/ku+2))}for(_?(L=new E(.5),b&&(se.s=1),O=P6t(se)):(K=Math.abs(+T(se)),O=K%2),J=new E(l);;){if(O){if(J=J.times(ie),!J.c)break;m?J.c.length>m&&(J.c.length=m):V&&(J=J.mod(p))}if(K){if(K=zK(K/2),K===0)break;O=K%2}else if(se=se.times(L),ee(se,se.e+1,1),se.e>14)O=P6t(se);else{if(K=+T(se),K===0)break;O=K%2}ie=ie.times(ie),m?ie.c&&ie.c.length>m&&(ie.c.length=m):V&&(ie=ie.mod(p))}return V?J:(b&&(J=l.div(J)),p?J.mod(p):m?ee(J,Z,w,h):J)},f.integerValue=function(se){var p=new E(this);return se==null?se=w:Ty(se,0,8),ee(p,p.e+1,se)},f.isEqualTo=f.eq=function(se,p){return jSe(this,new E(se,p))===0},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(se,p){return jSe(this,new E(se,p))>0},f.isGreaterThanOrEqualTo=f.gte=function(se,p){return(p=jSe(this,new E(se,p)))===1||p===0},f.isInteger=function(){return!!this.c&&$M(this.e/ku)>this.c.length-2},f.isLessThan=f.lt=function(se,p){return jSe(this,new E(se,p))<0},f.isLessThanOrEqualTo=f.lte=function(se,p){return(p=jSe(this,new E(se,p)))===-1||p===0},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&this.c[0]==0},f.minus=function(se,p){var L,V,K,m,h=this,_=h.s;if(se=new E(se,p),p=se.s,!_||!p)return new E(NaN);if(_!=p)return se.s=-p,h.plus(se);var b=h.e/ku,O=se.e/ku,J=h.c,ie=se.c;if(!b||!O){if(!J||!ie)return J?(se.s=-p,se):new E(ie?h:NaN);if(!J[0]||!ie[0])return ie[0]?(se.s=-p,se):new E(J[0]?h:w==3?-0:0)}if(b=$M(b),O=$M(O),J=J.slice(),_=b-O){for((m=_<0)?(_=-_,K=J):(O=b,K=ie),K.reverse(),p=_;p--;K.push(0));K.reverse()}else for(V=(m=(_=J.length)<(p=ie.length))?_:p,_=p=0;p<V;p++)if(J[p]!=ie[p]){m=J[p]<ie[p];break}if(m&&(K=J,J=ie,ie=K,se.s=-se.s),p=(V=ie.length)-(L=J.length),p>0)for(;p--;J[L++]=0);for(p=ZF-1;V>_;){if(J[--V]<ie[V]){for(L=V;L&&!J[--L];J[L]=p);--J[L],J[V]+=ZF}J[V]-=ie[V]}for(;J[0]==0;J.splice(0,1),--O);return J[0]?re(se,J,O):(se.s=w==3?-1:1,se.c=[se.e=0],se)},f.modulo=f.mod=function(se,p){var L,V,K=this;return se=new E(se,p),!K.c||!se.s||se.c&&!se.c[0]?new E(NaN):!se.c||K.c&&!K.c[0]?new E(K):(ne==9?(V=se.s,se.s=1,L=i(K,se,0,3),se.s=V,L.s*=V):L=i(K,se,0,ne),se=K.minus(L.times(se)),!se.c[0]&&ne==1&&(se.s=K.s),se)},f.multipliedBy=f.times=function(se,p){var L,V,K,m,h,_,b,O,J,ie,G,I,C,D,W,ae=this,ye=ae.c,Xe=(se=new E(se,p)).c;if(!ye||!Xe||!ye[0]||!Xe[0])return!ae.s||!se.s||ye&&!ye[0]&&!Xe||Xe&&!Xe[0]&&!ye?se.c=se.e=se.s=null:(se.s*=ae.s,!ye||!Xe?se.c=se.e=null:(se.c=[0],se.e=0)),se;for(V=$M(ae.e/ku)+$M(se.e/ku),se.s*=ae.s,b=ye.length,ie=Xe.length,b<ie&&(C=ye,ye=Xe,Xe=C,K=b,b=ie,ie=K),K=b+ie,C=[];K--;C.push(0));for(D=ZF,W=yoe,K=ie;--K>=0;){for(L=0,G=Xe[K]%W,I=Xe[K]/W|0,h=b,m=K+h;m>K;)O=ye[--h]%W,J=ye[h]/W|0,_=I*O+J*G,O=G*O+_%W*W+C[m]+L,L=(O/D|0)+(_/W|0)+I*J,C[m--]=O%D;C[m]=L}return L?++V:C.splice(0,1),re(se,C,V)},f.negated=function(){var se=new E(this);return se.s=-se.s||null,se},f.plus=function(se,p){var L,V=this,K=V.s;if(se=new E(se,p),p=se.s,!K||!p)return new E(NaN);if(K!=p)return se.s=-p,V.minus(se);var m=V.e/ku,h=se.e/ku,_=V.c,b=se.c;if(!m||!h){if(!_||!b)return new E(K/0);if(!_[0]||!b[0])return b[0]?se:new E(_[0]?V:K*0)}if(m=$M(m),h=$M(h),_=_.slice(),K=m-h){for(K>0?(h=m,L=b):(K=-K,L=_),L.reverse();K--;L.push(0));L.reverse()}for(K=_.length,p=b.length,K-p<0&&(L=b,b=_,_=L,p=K),K=0;p;)K=(_[--p]=_[p]+b[p]+K)/ZF|0,_[p]=ZF===_[p]?0:_[p]%ZF;return K&&(_=[K].concat(_),++h),re(se,_,h)},f.precision=f.sd=function(se,p){var L,V,K,m=this;if(se!=null&&se!==!!se)return Ty(se,1,M3),p==null?p=w:Ty(p,0,8),ee(new E(m),se,p);if(!(L=m.c))return null;if(K=L.length-1,V=K*ku+1,K=L[K]){for(;K%10==0;K/=10,V--);for(K=L[0];K>=10;K/=10,V++);}return se&&m.e+1>V&&(V=m.e+1),V},f.shiftedBy=function(se){return Ty(se,-DCn,DCn),this.times("1e"+se)},f.squareRoot=f.sqrt=function(){var se,p,L,V,K,m=this,h=m.c,_=m.s,b=m.e,O=g+4,J=new E("0.5");if(_!==1||!h||!h[0])return new E(!_||_<0&&(!h||h[0])?NaN:h?m:1/0);if(_=Math.sqrt(+T(m)),_==0||_==1/0?(p=ZM(h),(p.length+b)%2==0&&(p+="0"),_=Math.sqrt(+p),b=$M((b+1)/2)-(b<0||b%2),_==1/0?p="5e"+b:(p=_.toExponential(),p=p.slice(0,p.indexOf("e")+1)+b),L=new E(p)):L=new E(_+""),L.c[0]){for(b=L.e,_=b+O,_<3&&(_=0);;)if(K=L,L=J.times(K.plus(i(m,K,O,1))),ZM(K.c).slice(0,_)===(p=ZM(L.c)).slice(0,_))if(L.e<b&&--_,p=p.slice(_-3,_+1),p=="9999"||!V&&p=="4999"){if(!V&&(ee(K,K.e+g+2,0),K.times(K).eq(m))){L=K;break}O+=4,_+=4,V=1}else{(!+p||!+p.slice(1)&&p.charAt(0)=="5")&&(ee(L,L.e+g+2,1),se=!L.times(L).eq(m));break}}return ee(L,L.e+g+1,w,se)},f.toExponential=function(se,p){return se!=null&&(Ty(se,0,M3),se++),Q(this,se,p,1)},f.toFixed=function(se,p){return se!=null&&(Ty(se,0,M3),se=se+this.e+1),Q(this,se,p)},f.toFormat=function(se,p,L){var V,K=this;if(L==null)se!=null&&p&&typeof p=="object"?(L=p,p=null):se&&typeof se=="object"?(L=se,se=p=null):L=R;else if(typeof L!="object")throw Error(QD+"Argument not an object: "+L);if(V=K.toFixed(se,p),K.c){var m,h=V.split("."),_=+L.groupSize,b=+L.secondaryGroupSize,O=L.groupSeparator||"",J=h[0],ie=h[1],G=K.s<0,I=G?J.slice(1):J,C=I.length;if(b&&(m=_,_=b,b=m,C-=m),_>0&&C>0){for(m=C%_||_,J=I.substr(0,m);m<C;m+=_)J+=O+I.substr(m,_);b>0&&(J+=O+I.slice(m)),G&&(J="-"+J)}V=ie?J+(L.decimalSeparator||"")+((b=+L.fractionGroupSize)?ie.replace(new RegExp("\\d{"+b+"}\\B","g"),"$&"+(L.fractionGroupSeparator||"")):ie):J}return(L.prefix||"")+V+(L.suffix||"")},f.toFraction=function(se){var p,L,V,K,m,h,_,b,O,J,ie,G,I=this,C=I.c;if(se!=null&&(_=new E(se),!_.isInteger()&&(_.c||_.s!==1)||_.lt(l)))throw Error(QD+"Argument "+(_.isInteger()?"out of range: ":"not an integer: ")+T(_));if(!C)return new E(I);for(p=new E(l),O=L=new E(l),V=b=new E(l),G=ZM(C),m=p.e=G.length-I.e-1,p.c[0]=RCn[(h=m%ku)<0?ku+h:h],se=!se||_.comparedTo(p)>0?m>0?p:O:_,h=te,te=1/0,_=new E(G),b.c[0]=0;J=i(_,p,0,1),K=L.plus(J.times(V)),K.comparedTo(se)!=1;)L=V,V=K,O=b.plus(J.times(K=O)),b=K,p=_.minus(J.times(K=p)),_=K;return K=i(se.minus(L),V,0,1),b=b.plus(K.times(O)),L=L.plus(K.times(V)),b.s=O.s=I.s,m=m*2,ie=i(O,V,m,w).minus(I).abs().comparedTo(i(b,L,m,w).minus(I).abs())<1?[O,V]:[b,L],te=h,ie},f.toNumber=function(){return+T(this)},f.toPrecision=function(se,p){return se!=null&&Ty(se,1,M3),Q(this,se,p,2)},f.toString=function(se){var p,L=this,V=L.s,K=L.e;return K===null?V?(p="Infinity",V<0&&(p="-"+p)):p="NaN":(se==null?p=K<=N||K>=F?O6t(ZM(L.c),K):hW(ZM(L.c),K,"0"):se===10&&U?(L=ee(new E(L),g+K+1,w),p=hW(ZM(L.c),L.e,"0")):(Ty(se,2,M.length,"Base"),p=A(hW(ZM(L.c),K,"0"),10,se,V,!0)),V<0&&L.c[0]&&(p="-"+p)),p},f.valueOf=f.toJSON=function(){return T(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,e!=null&&E.set(e),E}function $M(e){var i=e|0;return e>0||e===i?i:i-1}function ZM(e){for(var i,A,c=1,f=e.length,l=e[0]+"";c<f;){for(i=e[c++]+"",A=ku-i.length;A--;i="0"+i);l+=i}for(f=l.length;l.charCodeAt(--f)===48;);return l.slice(0,f+1||1)}function jSe(e,i){var A,c,f=e.c,l=i.c,g=e.s,w=i.s,N=e.e,F=i.e;if(!g||!w)return null;if(A=f&&!f[0],c=l&&!l[0],A||c)return A?c?0:-w:g;if(g!=w)return g;if(A=g<0,c=N==F,!f||!l)return c?0:!f^A?1:-1;if(!c)return N>F^A?1:-1;for(w=(N=f.length)<(F=l.length)?N:F,g=0;g<w;g++)if(f[g]!=l[g])return f[g]>l[g]^A?1:-1;return N==F?0:N>F^A?1:-1}function Ty(e,i,A,c){if(e<i||e>A||e!==zK(e))throw Error(QD+(c||"Argument")+(typeof e=="number"?e<i||e>A?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function P6t(e){var i=e.c.length-1;return $M(e.e/ku)==i&&e.c[i]%2!=0}function O6t(e,i){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(i<0?"e":"e+")+i}function hW(e,i,A){var c,f;if(i<0){for(f=A+".";++i;f+=A);e=f+e}else if(c=e.length,++i>c){for(f=A,i-=c;--i;f+=A);e+=f}else i<c&&(e=e.slice(0,i)+"."+e.slice(i));return e}var o3n=xti(),PCn=e=>new o3n(e),F9s=e=>!e.isNaN(),pti;(function(e){e.BEFORE="before",e.AFTER="after"})(pti||(pti={}));var J9s=(e,i=2)=>{let A=PCn(e||0),c=F9s(A)?A.toFixed(i):PCn(0).toFixed(i);return PCn(c)},TCn;(function(e){e.Base="BASE",e.Asset="ASSET"})(TCn||(TCn={}));var gW=e=>typeof e=="string"||typeof e=="number"||e instanceof o3n,H9s=8,nle=(e,i=H9s)=>{let A=J9s(e,0);return{type:TCn.Base,amount:()=>A,plus:(c,f=i)=>nle(A.plus(gW(c)?c:c.amount()),f),minus:(c,f=i)=>nle(A.minus(gW(c)?c:c.amount()),f),times:(c,f=i)=>nle(A.times(gW(c)?c:c.amount()),f),div:(c,f=i)=>nle(A.div(gW(c)?c:c.amount()).decimalPlaces(0,o3n.ROUND_DOWN),f),lt:c=>A.lt(gW(c)?c:c.amount()),lte:c=>A.lte(gW(c)?c:c.amount()),gt:c=>A.gt(gW(c)?c:c.amount()),gte:c=>A.gte(gW(c)?c:c.amount()),eq:c=>A.eq(gW(c)?c:c.amount()),decimal:i}},yti;(function(e){e.RUNE="\u16B1",e.BTC="\u20BF",e.SATOSHI="\u26A1",e.ETH="\u039E",e.USD="$",e.DASH="\u0110",e.LTC="\u0141",e.DOGE="\xD0"})(yti||(yti={}));var L9s=e=>e.replace(/^0(x|X)/,""),mti=e=>{let i=e.symbol.slice(e.ticker.length+1);return L9s(i)},Mti=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Tti(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a3n={exports:{}};a3n.exports;(function(e){(function(i,A){function c(m,h){if(!m)throw new Error(h||"Assertion failed")}function f(m,h){m.super_=h;var _=function(){};_.prototype=h.prototype,m.prototype=new _,m.prototype.constructor=m}function l(m,h,_){if(l.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((h==="le"||h==="be")&&(_=h,h=10),this._init(m||0,h||10,_||"be"))}typeof i=="object"?i.exports=l:A.BN=l,l.BN=l,l.wordSize=26;var g;try{typeof window!="undefined"&&typeof window.Buffer!="undefined"?g=window.Buffer:g=gs("buffer").Buffer}catch(m){}l.isBN=function(h){return h instanceof l?!0:h!==null&&typeof h=="object"&&h.constructor.wordSize===l.wordSize&&Array.isArray(h.words)},l.max=function(h,_){return h.cmp(_)>0?h:_},l.min=function(h,_){return h.cmp(_)<0?h:_},l.prototype._init=function(h,_,b){if(typeof h=="number")return this._initNumber(h,_,b);if(typeof h=="object")return this._initArray(h,_,b);_==="hex"&&(_=16),c(_===(_|0)&&_>=2&&_<=36),h=h.toString().replace(/\s+/g,"");var O=0;h[0]==="-"&&(O++,this.negative=1),O<h.length&&(_===16?this._parseHex(h,O,b):(this._parseBase(h,_,O),b==="le"&&this._initArray(this.toArray(),_,b)))},l.prototype._initNumber=function(h,_,b){h<0&&(this.negative=1,h=-h),h<67108864?(this.words=[h&67108863],this.length=1):h<4503599627370496?(this.words=[h&67108863,h/67108864&67108863],this.length=2):(c(h<9007199254740992),this.words=[h&67108863,h/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),_,b)},l.prototype._initArray=function(h,_,b){if(c(typeof h.length=="number"),h.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(h.length/3),this.words=new Array(this.length);for(var O=0;O<this.length;O++)this.words[O]=0;var J,ie,G=0;if(b==="be")for(O=h.length-1,J=0;O>=0;O-=3)ie=h[O]|h[O-1]<<8|h[O-2]<<16,this.words[J]|=ie<<G&67108863,this.words[J+1]=ie>>>26-G&67108863,G+=24,G>=26&&(G-=26,J++);else if(b==="le")for(O=0,J=0;O<h.length;O+=3)ie=h[O]|h[O+1]<<8|h[O+2]<<16,this.words[J]|=ie<<G&67108863,this.words[J+1]=ie>>>26-G&67108863,G+=24,G>=26&&(G-=26,J++);return this._strip()};function w(m,h){var _=m.charCodeAt(h);if(_>=48&&_<=57)return _-48;if(_>=65&&_<=70)return _-55;if(_>=97&&_<=102)return _-87;c(!1,"Invalid character in "+m)}function N(m,h,_){var b=w(m,_);return _-1>=h&&(b|=w(m,_-1)<<4),b}l.prototype._parseHex=function(h,_,b){this.length=Math.ceil((h.length-_)/6),this.words=new Array(this.length);for(var O=0;O<this.length;O++)this.words[O]=0;var J=0,ie=0,G;if(b==="be")for(O=h.length-1;O>=_;O-=2)G=N(h,_,O)<<J,this.words[ie]|=G&67108863,J>=18?(J-=18,ie+=1,this.words[ie]|=G>>>26):J+=8;else{var I=h.length-_;for(O=I%2===0?_+1:_;O<h.length;O+=2)G=N(h,_,O)<<J,this.words[ie]|=G&67108863,J>=18?(J-=18,ie+=1,this.words[ie]|=G>>>26):J+=8}this._strip()};function F(m,h,_,b){for(var O=0,J=0,ie=Math.min(m.length,_),G=h;G<ie;G++){var I=m.charCodeAt(G)-48;O*=b,I>=49?J=I-49+10:I>=17?J=I-17+10:J=I,c(I>=0&&J<b,"Invalid character"),O+=J}return O}l.prototype._parseBase=function(h,_,b){this.words=[0],this.length=1;for(var O=0,J=1;J<=67108863;J*=_)O++;O--,J=J/_|0;for(var ie=h.length-b,G=ie%O,I=Math.min(ie,ie-G)+b,C=0,D=b;D<I;D+=O)C=F(h,D,D+O,_),this.imuln(J),this.words[0]+C<67108864?this.words[0]+=C:this._iaddn(C);if(G!==0){var W=1;for(C=F(h,D,h.length,_),D=0;D<G;D++)W*=_;this.imuln(W),this.words[0]+C<67108864?this.words[0]+=C:this._iaddn(C)}this._strip()},l.prototype.copy=function(h){h.words=new Array(this.length);for(var _=0;_<this.length;_++)h.words[_]=this.words[_];h.length=this.length,h.negative=this.negative,h.red=this.red};function j(m,h){m.words=h.words,m.length=h.length,m.negative=h.negative,m.red=h.red}if(l.prototype._move=function(h){j(h,this)},l.prototype.clone=function(){var h=new l(null);return this.copy(h),h},l.prototype._expand=function(h){for(;this.length<h;)this.words[this.length++]=0;return this},l.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},l.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol!="undefined"&&typeof Symbol.for=="function")try{l.prototype[Symbol.for("nodejs.util.inspect.custom")]=te}catch(m){l.prototype.inspect=te}else l.prototype.inspect=te;function te(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var v=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],ne=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Z=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];l.prototype.toString=function(h,_){h=h||10,_=_|0||1;var b;if(h===16||h==="hex"){b="";for(var O=0,J=0,ie=0;ie<this.length;ie++){var G=this.words[ie],I=((G<<O|J)&16777215).toString(16);J=G>>>24-O&16777215,O+=2,O>=26&&(O-=26,ie--),J!==0||ie!==this.length-1?b=v[6-I.length]+I+b:b=I+b}for(J!==0&&(b=J.toString(16)+b);b.length%_!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(h===(h|0)&&h>=2&&h<=36){var C=ne[h],D=Z[h];b="";var W=this.clone();for(W.negative=0;!W.isZero();){var ae=W.modrn(D).toString(h);W=W.idivn(D),W.isZero()?b=ae+b:b=v[C-ae.length]+ae+b}for(this.isZero()&&(b="0"+b);b.length%_!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}c(!1,"Base should be between 2 and 36")},l.prototype.toNumber=function(){var h=this.words[0];return this.length===2?h+=this.words[1]*67108864:this.length===3&&this.words[2]===1?h+=4503599627370496+this.words[1]*67108864:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-h:h},l.prototype.toJSON=function(){return this.toString(16,2)},g&&(l.prototype.toBuffer=function(h,_){return this.toArrayLike(g,h,_)}),l.prototype.toArray=function(h,_){return this.toArrayLike(Array,h,_)};var R=function(h,_){return h.allocUnsafe?h.allocUnsafe(_):new h(_)};l.prototype.toArrayLike=function(h,_,b){this._strip();var O=this.byteLength(),J=b||Math.max(1,O);c(O<=J,"byte array longer than desired length"),c(J>0,"Requested array length <= 0");var ie=R(h,J),G=_==="le"?"LE":"BE";return this["_toArrayLike"+G](ie,O),ie},l.prototype._toArrayLikeLE=function(h,_){for(var b=0,O=0,J=0,ie=0;J<this.length;J++){var G=this.words[J]<<ie|O;h[b++]=G&255,b<h.length&&(h[b++]=G>>8&255),b<h.length&&(h[b++]=G>>16&255),ie===6?(b<h.length&&(h[b++]=G>>24&255),O=0,ie=0):(O=G>>>24,ie+=2)}if(b<h.length)for(h[b++]=O;b<h.length;)h[b++]=0},l.prototype._toArrayLikeBE=function(h,_){for(var b=h.length-1,O=0,J=0,ie=0;J<this.length;J++){var G=this.words[J]<<ie|O;h[b--]=G&255,b>=0&&(h[b--]=G>>8&255),b>=0&&(h[b--]=G>>16&255),ie===6?(b>=0&&(h[b--]=G>>24&255),O=0,ie=0):(O=G>>>24,ie+=2)}if(b>=0)for(h[b--]=O;b>=0;)h[b--]=0},Math.clz32?l.prototype._countBits=function(h){return 32-Math.clz32(h)}:l.prototype._countBits=function(h){var _=h,b=0;return _>=4096&&(b+=13,_>>>=13),_>=64&&(b+=7,_>>>=7),_>=8&&(b+=4,_>>>=4),_>=2&&(b+=2,_>>>=2),b+_},l.prototype._zeroBits=function(h){if(h===0)return 26;var _=h,b=0;return _&8191||(b+=13,_>>>=13),_&127||(b+=7,_>>>=7),_&15||(b+=4,_>>>=4),_&3||(b+=2,_>>>=2),_&1||b++,b},l.prototype.bitLength=function(){var h=this.words[this.length-1],_=this._countBits(h);return(this.length-1)*26+_};function M(m){for(var h=new Array(m.bitLength()),_=0;_<h.length;_++){var b=_/26|0,O=_%26;h[_]=m.words[b]>>>O&1}return h}l.prototype.zeroBits=function(){if(this.isZero())return 0;for(var h=0,_=0;_<this.length;_++){var b=this._zeroBits(this.words[_]);if(h+=b,b!==26)break}return h},l.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},l.prototype.toTwos=function(h){return this.negative!==0?this.abs().inotn(h).iaddn(1):this.clone()},l.prototype.fromTwos=function(h){return this.testn(h-1)?this.notn(h).iaddn(1).ineg():this.clone()},l.prototype.isNeg=function(){return this.negative!==0},l.prototype.neg=function(){return this.clone().ineg()},l.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},l.prototype.iuor=function(h){for(;this.length<h.length;)this.words[this.length++]=0;for(var _=0;_<h.length;_++)this.words[_]=this.words[_]|h.words[_];return this._strip()},l.prototype.ior=function(h){return c((this.negative|h.negative)===0),this.iuor(h)},l.prototype.or=function(h){return this.length>h.length?this.clone().ior(h):h.clone().ior(this)},l.prototype.uor=function(h){return this.length>h.length?this.clone().iuor(h):h.clone().iuor(this)},l.prototype.iuand=function(h){var _;this.length>h.length?_=h:_=this;for(var b=0;b<_.length;b++)this.words[b]=this.words[b]&h.words[b];return this.length=_.length,this._strip()},l.prototype.iand=function(h){return c((this.negative|h.negative)===0),this.iuand(h)},l.prototype.and=function(h){return this.length>h.length?this.clone().iand(h):h.clone().iand(this)},l.prototype.uand=function(h){return this.length>h.length?this.clone().iuand(h):h.clone().iuand(this)},l.prototype.iuxor=function(h){var _,b;this.length>h.length?(_=this,b=h):(_=h,b=this);for(var O=0;O<b.length;O++)this.words[O]=_.words[O]^b.words[O];if(this!==_)for(;O<_.length;O++)this.words[O]=_.words[O];return this.length=_.length,this._strip()},l.prototype.ixor=function(h){return c((this.negative|h.negative)===0),this.iuxor(h)},l.prototype.xor=function(h){return this.length>h.length?this.clone().ixor(h):h.clone().ixor(this)},l.prototype.uxor=function(h){return this.length>h.length?this.clone().iuxor(h):h.clone().iuxor(this)},l.prototype.inotn=function(h){c(typeof h=="number"&&h>=0);var _=Math.ceil(h/26)|0,b=h%26;this._expand(_),b>0&&_--;for(var O=0;O<_;O++)this.words[O]=~this.words[O]&67108863;return b>0&&(this.words[O]=~this.words[O]&67108863>>26-b),this._strip()},l.prototype.notn=function(h){return this.clone().inotn(h)},l.prototype.setn=function(h,_){c(typeof h=="number"&&h>=0);var b=h/26|0,O=h%26;return this._expand(b+1),_?this.words[b]=this.words[b]|1<<O:this.words[b]=this.words[b]&~(1<<O),this._strip()},l.prototype.iadd=function(h){var _;if(this.negative!==0&&h.negative===0)return this.negative=0,_=this.isub(h),this.negative^=1,this._normSign();if(this.negative===0&&h.negative!==0)return h.negative=0,_=this.isub(h),h.negative=1,_._normSign();var b,O;this.length>h.length?(b=this,O=h):(b=h,O=this);for(var J=0,ie=0;ie<O.length;ie++)_=(b.words[ie]|0)+(O.words[ie]|0)+J,this.words[ie]=_&67108863,J=_>>>26;for(;J!==0&&ie<b.length;ie++)_=(b.words[ie]|0)+J,this.words[ie]=_&67108863,J=_>>>26;if(this.length=b.length,J!==0)this.words[this.length]=J,this.length++;else if(b!==this)for(;ie<b.length;ie++)this.words[ie]=b.words[ie];return this},l.prototype.add=function(h){var _;return h.negative!==0&&this.negative===0?(h.negative=0,_=this.sub(h),h.negative^=1,_):h.negative===0&&this.negative!==0?(this.negative=0,_=h.sub(this),this.negative=1,_):this.length>h.length?this.clone().iadd(h):h.clone().iadd(this)},l.prototype.isub=function(h){if(h.negative!==0){h.negative=0;var _=this.iadd(h);return h.negative=1,_._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(h),this.negative=1,this._normSign();var b=this.cmp(h);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var O,J;b>0?(O=this,J=h):(O=h,J=this);for(var ie=0,G=0;G<J.length;G++)_=(O.words[G]|0)-(J.words[G]|0)+ie,ie=_>>26,this.words[G]=_&67108863;for(;ie!==0&&G<O.length;G++)_=(O.words[G]|0)+ie,ie=_>>26,this.words[G]=_&67108863;if(ie===0&&G<O.length&&O!==this)for(;G<O.length;G++)this.words[G]=O.words[G];return this.length=Math.max(this.length,G),O!==this&&(this.negative=1),this._strip()},l.prototype.sub=function(h){return this.clone().isub(h)};function U(m,h,_){_.negative=h.negative^m.negative;var b=m.length+h.length|0;_.length=b,b=b-1|0;var O=m.words[0]|0,J=h.words[0]|0,ie=O*J,G=ie&67108863,I=ie/67108864|0;_.words[0]=G;for(var C=1;C<b;C++){for(var D=I>>>26,W=I&67108863,ae=Math.min(C,h.length-1),ye=Math.max(0,C-m.length+1);ye<=ae;ye++){var Xe=C-ye|0;O=m.words[Xe]|0,J=h.words[ye]|0,ie=O*J+W,D+=ie/67108864|0,W=ie&67108863}_.words[C]=W|0,I=D|0}return I!==0?_.words[C]=I|0:_.length--,_._strip()}var E=function(h,_,b){var O=h.words,J=_.words,ie=b.words,G=0,I,C,D,W=O[0]|0,ae=W&8191,ye=W>>>13,Xe=O[1]|0,nt=Xe&8191,Ke=Xe>>>13,It=O[2]|0,rt=It&8191,ut=It>>>13,Rt=O[3]|0,Ee=Rt&8191,Pt=Rt>>>13,_e=O[4]|0,we=_e&8191,xe=_e>>>13,Ye=O[5]|0,X=Ye&8191,ht=Ye>>>13,Ut=O[6]|0,zt=Ut&8191,Wt=Ut>>>13,yn=O[7]|0,rn=yn&8191,un=yn>>>13,fr=O[8]|0,ir=fr&8191,Ln=fr>>>13,Br=O[9]|0,Zn=Br&8191,Jn=Br>>>13,_r=J[0]|0,Yn=_r&8191,kn=_r>>>13,Y=J[1]|0,fe=Y&8191,be=Y>>>13,qt=J[2]|0,ct=qt&8191,Ft=qt>>>13,vr=J[3]|0,$n=vr&8191,Hn=vr>>>13,kr=J[4]|0,sr=kr&8191,Wn=kr>>>13,Xr=J[5]|0,pr=Xr&8191,Gn=Xr>>>13,Or=J[6]|0,lt=Or&8191,Bt=Or>>>13,Ot=J[7]|0,We=Ot&8191,Qt=Ot>>>13,fn=J[8]|0,tn=fn&8191,Re=fn>>>13,Vn=J[9]|0,De=Vn&8191,Je=Vn>>>13;b.negative=h.negative^_.negative,b.length=19,I=Math.imul(ae,Yn),C=Math.imul(ae,kn),C=C+Math.imul(ye,Yn)|0,D=Math.imul(ye,kn);var je=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(je>>>26)|0,je&=67108863,I=Math.imul(nt,Yn),C=Math.imul(nt,kn),C=C+Math.imul(Ke,Yn)|0,D=Math.imul(Ke,kn),I=I+Math.imul(ae,fe)|0,C=C+Math.imul(ae,be)|0,C=C+Math.imul(ye,fe)|0,D=D+Math.imul(ye,be)|0;var st=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(st>>>26)|0,st&=67108863,I=Math.imul(rt,Yn),C=Math.imul(rt,kn),C=C+Math.imul(ut,Yn)|0,D=Math.imul(ut,kn),I=I+Math.imul(nt,fe)|0,C=C+Math.imul(nt,be)|0,C=C+Math.imul(Ke,fe)|0,D=D+Math.imul(Ke,be)|0,I=I+Math.imul(ae,ct)|0,C=C+Math.imul(ae,Ft)|0,C=C+Math.imul(ye,ct)|0,D=D+Math.imul(ye,Ft)|0;var Et=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Et>>>26)|0,Et&=67108863,I=Math.imul(Ee,Yn),C=Math.imul(Ee,kn),C=C+Math.imul(Pt,Yn)|0,D=Math.imul(Pt,kn),I=I+Math.imul(rt,fe)|0,C=C+Math.imul(rt,be)|0,C=C+Math.imul(ut,fe)|0,D=D+Math.imul(ut,be)|0,I=I+Math.imul(nt,ct)|0,C=C+Math.imul(nt,Ft)|0,C=C+Math.imul(Ke,ct)|0,D=D+Math.imul(Ke,Ft)|0,I=I+Math.imul(ae,$n)|0,C=C+Math.imul(ae,Hn)|0,C=C+Math.imul(ye,$n)|0,D=D+Math.imul(ye,Hn)|0;var Mt=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,I=Math.imul(we,Yn),C=Math.imul(we,kn),C=C+Math.imul(xe,Yn)|0,D=Math.imul(xe,kn),I=I+Math.imul(Ee,fe)|0,C=C+Math.imul(Ee,be)|0,C=C+Math.imul(Pt,fe)|0,D=D+Math.imul(Pt,be)|0,I=I+Math.imul(rt,ct)|0,C=C+Math.imul(rt,Ft)|0,C=C+Math.imul(ut,ct)|0,D=D+Math.imul(ut,Ft)|0,I=I+Math.imul(nt,$n)|0,C=C+Math.imul(nt,Hn)|0,C=C+Math.imul(Ke,$n)|0,D=D+Math.imul(Ke,Hn)|0,I=I+Math.imul(ae,sr)|0,C=C+Math.imul(ae,Wn)|0,C=C+Math.imul(ye,sr)|0,D=D+Math.imul(ye,Wn)|0;var Vt=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,I=Math.imul(X,Yn),C=Math.imul(X,kn),C=C+Math.imul(ht,Yn)|0,D=Math.imul(ht,kn),I=I+Math.imul(we,fe)|0,C=C+Math.imul(we,be)|0,C=C+Math.imul(xe,fe)|0,D=D+Math.imul(xe,be)|0,I=I+Math.imul(Ee,ct)|0,C=C+Math.imul(Ee,Ft)|0,C=C+Math.imul(Pt,ct)|0,D=D+Math.imul(Pt,Ft)|0,I=I+Math.imul(rt,$n)|0,C=C+Math.imul(rt,Hn)|0,C=C+Math.imul(ut,$n)|0,D=D+Math.imul(ut,Hn)|0,I=I+Math.imul(nt,sr)|0,C=C+Math.imul(nt,Wn)|0,C=C+Math.imul(Ke,sr)|0,D=D+Math.imul(Ke,Wn)|0,I=I+Math.imul(ae,pr)|0,C=C+Math.imul(ae,Gn)|0,C=C+Math.imul(ye,pr)|0,D=D+Math.imul(ye,Gn)|0;var nn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(nn>>>26)|0,nn&=67108863,I=Math.imul(zt,Yn),C=Math.imul(zt,kn),C=C+Math.imul(Wt,Yn)|0,D=Math.imul(Wt,kn),I=I+Math.imul(X,fe)|0,C=C+Math.imul(X,be)|0,C=C+Math.imul(ht,fe)|0,D=D+Math.imul(ht,be)|0,I=I+Math.imul(we,ct)|0,C=C+Math.imul(we,Ft)|0,C=C+Math.imul(xe,ct)|0,D=D+Math.imul(xe,Ft)|0,I=I+Math.imul(Ee,$n)|0,C=C+Math.imul(Ee,Hn)|0,C=C+Math.imul(Pt,$n)|0,D=D+Math.imul(Pt,Hn)|0,I=I+Math.imul(rt,sr)|0,C=C+Math.imul(rt,Wn)|0,C=C+Math.imul(ut,sr)|0,D=D+Math.imul(ut,Wn)|0,I=I+Math.imul(nt,pr)|0,C=C+Math.imul(nt,Gn)|0,C=C+Math.imul(Ke,pr)|0,D=D+Math.imul(Ke,Gn)|0,I=I+Math.imul(ae,lt)|0,C=C+Math.imul(ae,Bt)|0,C=C+Math.imul(ye,lt)|0,D=D+Math.imul(ye,Bt)|0;var wn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(wn>>>26)|0,wn&=67108863,I=Math.imul(rn,Yn),C=Math.imul(rn,kn),C=C+Math.imul(un,Yn)|0,D=Math.imul(un,kn),I=I+Math.imul(zt,fe)|0,C=C+Math.imul(zt,be)|0,C=C+Math.imul(Wt,fe)|0,D=D+Math.imul(Wt,be)|0,I=I+Math.imul(X,ct)|0,C=C+Math.imul(X,Ft)|0,C=C+Math.imul(ht,ct)|0,D=D+Math.imul(ht,Ft)|0,I=I+Math.imul(we,$n)|0,C=C+Math.imul(we,Hn)|0,C=C+Math.imul(xe,$n)|0,D=D+Math.imul(xe,Hn)|0,I=I+Math.imul(Ee,sr)|0,C=C+Math.imul(Ee,Wn)|0,C=C+Math.imul(Pt,sr)|0,D=D+Math.imul(Pt,Wn)|0,I=I+Math.imul(rt,pr)|0,C=C+Math.imul(rt,Gn)|0,C=C+Math.imul(ut,pr)|0,D=D+Math.imul(ut,Gn)|0,I=I+Math.imul(nt,lt)|0,C=C+Math.imul(nt,Bt)|0,C=C+Math.imul(Ke,lt)|0,D=D+Math.imul(Ke,Bt)|0,I=I+Math.imul(ae,We)|0,C=C+Math.imul(ae,Qt)|0,C=C+Math.imul(ye,We)|0,D=D+Math.imul(ye,Qt)|0;var Qn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,I=Math.imul(ir,Yn),C=Math.imul(ir,kn),C=C+Math.imul(Ln,Yn)|0,D=Math.imul(Ln,kn),I=I+Math.imul(rn,fe)|0,C=C+Math.imul(rn,be)|0,C=C+Math.imul(un,fe)|0,D=D+Math.imul(un,be)|0,I=I+Math.imul(zt,ct)|0,C=C+Math.imul(zt,Ft)|0,C=C+Math.imul(Wt,ct)|0,D=D+Math.imul(Wt,Ft)|0,I=I+Math.imul(X,$n)|0,C=C+Math.imul(X,Hn)|0,C=C+Math.imul(ht,$n)|0,D=D+Math.imul(ht,Hn)|0,I=I+Math.imul(we,sr)|0,C=C+Math.imul(we,Wn)|0,C=C+Math.imul(xe,sr)|0,D=D+Math.imul(xe,Wn)|0,I=I+Math.imul(Ee,pr)|0,C=C+Math.imul(Ee,Gn)|0,C=C+Math.imul(Pt,pr)|0,D=D+Math.imul(Pt,Gn)|0,I=I+Math.imul(rt,lt)|0,C=C+Math.imul(rt,Bt)|0,C=C+Math.imul(ut,lt)|0,D=D+Math.imul(ut,Bt)|0,I=I+Math.imul(nt,We)|0,C=C+Math.imul(nt,Qt)|0,C=C+Math.imul(Ke,We)|0,D=D+Math.imul(Ke,Qt)|0,I=I+Math.imul(ae,tn)|0,C=C+Math.imul(ae,Re)|0,C=C+Math.imul(ye,tn)|0,D=D+Math.imul(ye,Re)|0;var Tn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,I=Math.imul(Zn,Yn),C=Math.imul(Zn,kn),C=C+Math.imul(Jn,Yn)|0,D=Math.imul(Jn,kn),I=I+Math.imul(ir,fe)|0,C=C+Math.imul(ir,be)|0,C=C+Math.imul(Ln,fe)|0,D=D+Math.imul(Ln,be)|0,I=I+Math.imul(rn,ct)|0,C=C+Math.imul(rn,Ft)|0,C=C+Math.imul(un,ct)|0,D=D+Math.imul(un,Ft)|0,I=I+Math.imul(zt,$n)|0,C=C+Math.imul(zt,Hn)|0,C=C+Math.imul(Wt,$n)|0,D=D+Math.imul(Wt,Hn)|0,I=I+Math.imul(X,sr)|0,C=C+Math.imul(X,Wn)|0,C=C+Math.imul(ht,sr)|0,D=D+Math.imul(ht,Wn)|0,I=I+Math.imul(we,pr)|0,C=C+Math.imul(we,Gn)|0,C=C+Math.imul(xe,pr)|0,D=D+Math.imul(xe,Gn)|0,I=I+Math.imul(Ee,lt)|0,C=C+Math.imul(Ee,Bt)|0,C=C+Math.imul(Pt,lt)|0,D=D+Math.imul(Pt,Bt)|0,I=I+Math.imul(rt,We)|0,C=C+Math.imul(rt,Qt)|0,C=C+Math.imul(ut,We)|0,D=D+Math.imul(ut,Qt)|0,I=I+Math.imul(nt,tn)|0,C=C+Math.imul(nt,Re)|0,C=C+Math.imul(Ke,tn)|0,D=D+Math.imul(Ke,Re)|0,I=I+Math.imul(ae,De)|0,C=C+Math.imul(ae,Je)|0,C=C+Math.imul(ye,De)|0,D=D+Math.imul(ye,Je)|0;var er=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(er>>>26)|0,er&=67108863,I=Math.imul(Zn,fe),C=Math.imul(Zn,be),C=C+Math.imul(Jn,fe)|0,D=Math.imul(Jn,be),I=I+Math.imul(ir,ct)|0,C=C+Math.imul(ir,Ft)|0,C=C+Math.imul(Ln,ct)|0,D=D+Math.imul(Ln,Ft)|0,I=I+Math.imul(rn,$n)|0,C=C+Math.imul(rn,Hn)|0,C=C+Math.imul(un,$n)|0,D=D+Math.imul(un,Hn)|0,I=I+Math.imul(zt,sr)|0,C=C+Math.imul(zt,Wn)|0,C=C+Math.imul(Wt,sr)|0,D=D+Math.imul(Wt,Wn)|0,I=I+Math.imul(X,pr)|0,C=C+Math.imul(X,Gn)|0,C=C+Math.imul(ht,pr)|0,D=D+Math.imul(ht,Gn)|0,I=I+Math.imul(we,lt)|0,C=C+Math.imul(we,Bt)|0,C=C+Math.imul(xe,lt)|0,D=D+Math.imul(xe,Bt)|0,I=I+Math.imul(Ee,We)|0,C=C+Math.imul(Ee,Qt)|0,C=C+Math.imul(Pt,We)|0,D=D+Math.imul(Pt,Qt)|0,I=I+Math.imul(rt,tn)|0,C=C+Math.imul(rt,Re)|0,C=C+Math.imul(ut,tn)|0,D=D+Math.imul(ut,Re)|0,I=I+Math.imul(nt,De)|0,C=C+Math.imul(nt,Je)|0,C=C+Math.imul(Ke,De)|0,D=D+Math.imul(Ke,Je)|0;var S=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(S>>>26)|0,S&=67108863,I=Math.imul(Zn,ct),C=Math.imul(Zn,Ft),C=C+Math.imul(Jn,ct)|0,D=Math.imul(Jn,Ft),I=I+Math.imul(ir,$n)|0,C=C+Math.imul(ir,Hn)|0,C=C+Math.imul(Ln,$n)|0,D=D+Math.imul(Ln,Hn)|0,I=I+Math.imul(rn,sr)|0,C=C+Math.imul(rn,Wn)|0,C=C+Math.imul(un,sr)|0,D=D+Math.imul(un,Wn)|0,I=I+Math.imul(zt,pr)|0,C=C+Math.imul(zt,Gn)|0,C=C+Math.imul(Wt,pr)|0,D=D+Math.imul(Wt,Gn)|0,I=I+Math.imul(X,lt)|0,C=C+Math.imul(X,Bt)|0,C=C+Math.imul(ht,lt)|0,D=D+Math.imul(ht,Bt)|0,I=I+Math.imul(we,We)|0,C=C+Math.imul(we,Qt)|0,C=C+Math.imul(xe,We)|0,D=D+Math.imul(xe,Qt)|0,I=I+Math.imul(Ee,tn)|0,C=C+Math.imul(Ee,Re)|0,C=C+Math.imul(Pt,tn)|0,D=D+Math.imul(Pt,Re)|0,I=I+Math.imul(rt,De)|0,C=C+Math.imul(rt,Je)|0,C=C+Math.imul(ut,De)|0,D=D+Math.imul(ut,Je)|0;var t=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(t>>>26)|0,t&=67108863,I=Math.imul(Zn,$n),C=Math.imul(Zn,Hn),C=C+Math.imul(Jn,$n)|0,D=Math.imul(Jn,Hn),I=I+Math.imul(ir,sr)|0,C=C+Math.imul(ir,Wn)|0,C=C+Math.imul(Ln,sr)|0,D=D+Math.imul(Ln,Wn)|0,I=I+Math.imul(rn,pr)|0,C=C+Math.imul(rn,Gn)|0,C=C+Math.imul(un,pr)|0,D=D+Math.imul(un,Gn)|0,I=I+Math.imul(zt,lt)|0,C=C+Math.imul(zt,Bt)|0,C=C+Math.imul(Wt,lt)|0,D=D+Math.imul(Wt,Bt)|0,I=I+Math.imul(X,We)|0,C=C+Math.imul(X,Qt)|0,C=C+Math.imul(ht,We)|0,D=D+Math.imul(ht,Qt)|0,I=I+Math.imul(we,tn)|0,C=C+Math.imul(we,Re)|0,C=C+Math.imul(xe,tn)|0,D=D+Math.imul(xe,Re)|0,I=I+Math.imul(Ee,De)|0,C=C+Math.imul(Ee,Je)|0,C=C+Math.imul(Pt,De)|0,D=D+Math.imul(Pt,Je)|0;var u=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(u>>>26)|0,u&=67108863,I=Math.imul(Zn,sr),C=Math.imul(Zn,Wn),C=C+Math.imul(Jn,sr)|0,D=Math.imul(Jn,Wn),I=I+Math.imul(ir,pr)|0,C=C+Math.imul(ir,Gn)|0,C=C+Math.imul(Ln,pr)|0,D=D+Math.imul(Ln,Gn)|0,I=I+Math.imul(rn,lt)|0,C=C+Math.imul(rn,Bt)|0,C=C+Math.imul(un,lt)|0,D=D+Math.imul(un,Bt)|0,I=I+Math.imul(zt,We)|0,C=C+Math.imul(zt,Qt)|0,C=C+Math.imul(Wt,We)|0,D=D+Math.imul(Wt,Qt)|0,I=I+Math.imul(X,tn)|0,C=C+Math.imul(X,Re)|0,C=C+Math.imul(ht,tn)|0,D=D+Math.imul(ht,Re)|0,I=I+Math.imul(we,De)|0,C=C+Math.imul(we,Je)|0,C=C+Math.imul(xe,De)|0,D=D+Math.imul(xe,Je)|0;var lr=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(lr>>>26)|0,lr&=67108863,I=Math.imul(Zn,pr),C=Math.imul(Zn,Gn),C=C+Math.imul(Jn,pr)|0,D=Math.imul(Jn,Gn),I=I+Math.imul(ir,lt)|0,C=C+Math.imul(ir,Bt)|0,C=C+Math.imul(Ln,lt)|0,D=D+Math.imul(Ln,Bt)|0,I=I+Math.imul(rn,We)|0,C=C+Math.imul(rn,Qt)|0,C=C+Math.imul(un,We)|0,D=D+Math.imul(un,Qt)|0,I=I+Math.imul(zt,tn)|0,C=C+Math.imul(zt,Re)|0,C=C+Math.imul(Wt,tn)|0,D=D+Math.imul(Wt,Re)|0,I=I+Math.imul(X,De)|0,C=C+Math.imul(X,Je)|0,C=C+Math.imul(ht,De)|0,D=D+Math.imul(ht,Je)|0;var mn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(mn>>>26)|0,mn&=67108863,I=Math.imul(Zn,lt),C=Math.imul(Zn,Bt),C=C+Math.imul(Jn,lt)|0,D=Math.imul(Jn,Bt),I=I+Math.imul(ir,We)|0,C=C+Math.imul(ir,Qt)|0,C=C+Math.imul(Ln,We)|0,D=D+Math.imul(Ln,Qt)|0,I=I+Math.imul(rn,tn)|0,C=C+Math.imul(rn,Re)|0,C=C+Math.imul(un,tn)|0,D=D+Math.imul(un,Re)|0,I=I+Math.imul(zt,De)|0,C=C+Math.imul(zt,Je)|0,C=C+Math.imul(Wt,De)|0,D=D+Math.imul(Wt,Je)|0;var Rn=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,I=Math.imul(Zn,We),C=Math.imul(Zn,Qt),C=C+Math.imul(Jn,We)|0,D=Math.imul(Jn,Qt),I=I+Math.imul(ir,tn)|0,C=C+Math.imul(ir,Re)|0,C=C+Math.imul(Ln,tn)|0,D=D+Math.imul(Ln,Re)|0,I=I+Math.imul(rn,De)|0,C=C+Math.imul(rn,Je)|0,C=C+Math.imul(un,De)|0,D=D+Math.imul(un,Je)|0;var On=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(On>>>26)|0,On&=67108863,I=Math.imul(Zn,tn),C=Math.imul(Zn,Re),C=C+Math.imul(Jn,tn)|0,D=Math.imul(Jn,Re),I=I+Math.imul(ir,De)|0,C=C+Math.imul(ir,Je)|0,C=C+Math.imul(Ln,De)|0,D=D+Math.imul(Ln,Je)|0;var tr=(G+I|0)+((C&8191)<<13)|0;G=(D+(C>>>13)|0)+(tr>>>26)|0,tr&=67108863,I=Math.imul(Zn,De),C=Math.imul(Zn,Je),C=C+Math.imul(Jn,De)|0,D=Math.imul(Jn,Je);var Xn=(G+I|0)+((C&8191)<<13)|0;return G=(D+(C>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,ie[0]=je,ie[1]=st,ie[2]=Et,ie[3]=Mt,ie[4]=Vt,ie[5]=nn,ie[6]=wn,ie[7]=Qn,ie[8]=Tn,ie[9]=er,ie[10]=S,ie[11]=t,ie[12]=u,ie[13]=lr,ie[14]=mn,ie[15]=Rn,ie[16]=On,ie[17]=tr,ie[18]=Xn,G!==0&&(ie[19]=G,b.length++),b};Math.imul||(E=U);function Q(m,h,_){_.negative=h.negative^m.negative,_.length=m.length+h.length;for(var b=0,O=0,J=0;J<_.length-1;J++){var ie=O;O=0;for(var G=b&67108863,I=Math.min(J,h.length-1),C=Math.max(0,J-m.length+1);C<=I;C++){var D=J-C,W=m.words[D]|0,ae=h.words[C]|0,ye=W*ae,Xe=ye&67108863;ie=ie+(ye/67108864|0)|0,Xe=Xe+G|0,G=Xe&67108863,ie=ie+(Xe>>>26)|0,O+=ie>>>26,ie&=67108863}_.words[J]=G,b=ie,ie=O}return b!==0?_.words[J]=b:_.length--,_._strip()}function H(m,h,_){return Q(m,h,_)}l.prototype.mulTo=function(h,_){var b,O=this.length+h.length;return this.length===10&&h.length===10?b=E(this,h,_):O<63?b=U(this,h,_):O<1024?b=Q(this,h,_):b=H(this,h,_),b},l.prototype.mul=function(h){var _=new l(null);return _.words=new Array(this.length+h.length),this.mulTo(h,_)},l.prototype.mulf=function(h){var _=new l(null);return _.words=new Array(this.length+h.length),H(this,h,_)},l.prototype.imul=function(h){return this.clone().mulTo(h,this)},l.prototype.imuln=function(h){var _=h<0;_&&(h=-h),c(typeof h=="number"),c(h<67108864);for(var b=0,O=0;O<this.length;O++){var J=(this.words[O]|0)*h,ie=(J&67108863)+(b&67108863);b>>=26,b+=J/67108864|0,b+=ie>>>26,this.words[O]=ie&67108863}return b!==0&&(this.words[O]=b,this.length++),_?this.ineg():this},l.prototype.muln=function(h){return this.clone().imuln(h)},l.prototype.sqr=function(){return this.mul(this)},l.prototype.isqr=function(){return this.imul(this.clone())},l.prototype.pow=function(h){var _=M(h);if(_.length===0)return new l(1);for(var b=this,O=0;O<_.length&&_[O]===0;O++,b=b.sqr());if(++O<_.length)for(var J=b.sqr();O<_.length;O++,J=J.sqr())_[O]!==0&&(b=b.mul(J));return b},l.prototype.iushln=function(h){c(typeof h=="number"&&h>=0);var _=h%26,b=(h-_)/26,O=67108863>>>26-_<<26-_,J;if(_!==0){var ie=0;for(J=0;J<this.length;J++){var G=this.words[J]&O,I=(this.words[J]|0)-G<<_;this.words[J]=I|ie,ie=G>>>26-_}ie&&(this.words[J]=ie,this.length++)}if(b!==0){for(J=this.length-1;J>=0;J--)this.words[J+b]=this.words[J];for(J=0;J<b;J++)this.words[J]=0;this.length+=b}return this._strip()},l.prototype.ishln=function(h){return c(this.negative===0),this.iushln(h)},l.prototype.iushrn=function(h,_,b){c(typeof h=="number"&&h>=0);var O;_?O=(_-_%26)/26:O=0;var J=h%26,ie=Math.min((h-J)/26,this.length),G=67108863^67108863>>>J<<J,I=b;if(O-=ie,O=Math.max(0,O),I){for(var C=0;C<ie;C++)I.words[C]=this.words[C];I.length=ie}if(ie!==0)if(this.length>ie)for(this.length-=ie,C=0;C<this.length;C++)this.words[C]=this.words[C+ie];else this.words[0]=0,this.length=1;var D=0;for(C=this.length-1;C>=0&&(D!==0||C>=O);C--){var W=this.words[C]|0;this.words[C]=D<<26-J|W>>>J,D=W&G}return I&&D!==0&&(I.words[I.length++]=D),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},l.prototype.ishrn=function(h,_,b){return c(this.negative===0),this.iushrn(h,_,b)},l.prototype.shln=function(h){return this.clone().ishln(h)},l.prototype.ushln=function(h){return this.clone().iushln(h)},l.prototype.shrn=function(h){return this.clone().ishrn(h)},l.prototype.ushrn=function(h){return this.clone().iushrn(h)},l.prototype.testn=function(h){c(typeof h=="number"&&h>=0);var _=h%26,b=(h-_)/26,O=1<<_;if(this.length<=b)return!1;var J=this.words[b];return!!(J&O)},l.prototype.imaskn=function(h){c(typeof h=="number"&&h>=0);var _=h%26,b=(h-_)/26;if(c(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(_!==0&&b++,this.length=Math.min(b,this.length),_!==0){var O=67108863^67108863>>>_<<_;this.words[this.length-1]&=O}return this._strip()},l.prototype.maskn=function(h){return this.clone().imaskn(h)},l.prototype.iaddn=function(h){return c(typeof h=="number"),c(h<67108864),h<0?this.isubn(-h):this.negative!==0?this.length===1&&(this.words[0]|0)<=h?(this.words[0]=h-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(h),this.negative=1,this):this._iaddn(h)},l.prototype._iaddn=function(h){this.words[0]+=h;for(var _=0;_<this.length&&this.words[_]>=67108864;_++)this.words[_]-=67108864,_===this.length-1?this.words[_+1]=1:this.words[_+1]++;return this.length=Math.max(this.length,_+1),this},l.prototype.isubn=function(h){if(c(typeof h=="number"),c(h<67108864),h<0)return this.iaddn(-h);if(this.negative!==0)return this.negative=0,this.iaddn(h),this.negative=1,this;if(this.words[0]-=h,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var _=0;_<this.length&&this.words[_]<0;_++)this.words[_]+=67108864,this.words[_+1]-=1;return this._strip()},l.prototype.addn=function(h){return this.clone().iaddn(h)},l.prototype.subn=function(h){return this.clone().isubn(h)},l.prototype.iabs=function(){return this.negative=0,this},l.prototype.abs=function(){return this.clone().iabs()},l.prototype._ishlnsubmul=function(h,_,b){var O=h.length+b,J;this._expand(O);var ie,G=0;for(J=0;J<h.length;J++){ie=(this.words[J+b]|0)+G;var I=(h.words[J]|0)*_;ie-=I&67108863,G=(ie>>26)-(I/67108864|0),this.words[J+b]=ie&67108863}for(;J<this.length-b;J++)ie=(this.words[J+b]|0)+G,G=ie>>26,this.words[J+b]=ie&67108863;if(G===0)return this._strip();for(c(G===-1),G=0,J=0;J<this.length;J++)ie=-(this.words[J]|0)+G,G=ie>>26,this.words[J]=ie&67108863;return this.negative=1,this._strip()},l.prototype._wordDiv=function(h,_){var b=this.length-h.length,O=this.clone(),J=h,ie=J.words[J.length-1]|0,G=this._countBits(ie);b=26-G,b!==0&&(J=J.ushln(b),O.iushln(b),ie=J.words[J.length-1]|0);var I=O.length-J.length,C;if(_!=="mod"){C=new l(null),C.length=I+1,C.words=new Array(C.length);for(var D=0;D<C.length;D++)C.words[D]=0}var W=O.clone()._ishlnsubmul(J,1,I);W.negative===0&&(O=W,C&&(C.words[I]=1));for(var ae=I-1;ae>=0;ae--){var ye=(O.words[J.length+ae]|0)*67108864+(O.words[J.length+ae-1]|0);for(ye=Math.min(ye/ie|0,67108863),O._ishlnsubmul(J,ye,ae);O.negative!==0;)ye--,O.negative=0,O._ishlnsubmul(J,1,ae),O.isZero()||(O.negative^=1);C&&(C.words[ae]=ye)}return C&&C._strip(),O._strip(),_!=="div"&&b!==0&&O.iushrn(b),{div:C||null,mod:O}},l.prototype.divmod=function(h,_,b){if(c(!h.isZero()),this.isZero())return{div:new l(0),mod:new l(0)};var O,J,ie;return this.negative!==0&&h.negative===0?(ie=this.neg().divmod(h,_),_!=="mod"&&(O=ie.div.neg()),_!=="div"&&(J=ie.mod.neg(),b&&J.negative!==0&&J.iadd(h)),{div:O,mod:J}):this.negative===0&&h.negative!==0?(ie=this.divmod(h.neg(),_),_!=="mod"&&(O=ie.div.neg()),{div:O,mod:ie.mod}):this.negative&h.negative?(ie=this.neg().divmod(h.neg(),_),_!=="div"&&(J=ie.mod.neg(),b&&J.negative!==0&&J.isub(h)),{div:ie.div,mod:J}):h.length>this.length||this.cmp(h)<0?{div:new l(0),mod:this}:h.length===1?_==="div"?{div:this.divn(h.words[0]),mod:null}:_==="mod"?{div:null,mod:new l(this.modrn(h.words[0]))}:{div:this.divn(h.words[0]),mod:new l(this.modrn(h.words[0]))}:this._wordDiv(h,_)},l.prototype.div=function(h){return this.divmod(h,"div",!1).div},l.prototype.mod=function(h){return this.divmod(h,"mod",!1).mod},l.prototype.umod=function(h){return this.divmod(h,"mod",!0).mod},l.prototype.divRound=function(h){var _=this.divmod(h);if(_.mod.isZero())return _.div;var b=_.div.negative!==0?_.mod.isub(h):_.mod,O=h.ushrn(1),J=h.andln(1),ie=b.cmp(O);return ie<0||J===1&&ie===0?_.div:_.div.negative!==0?_.div.isubn(1):_.div.iaddn(1)},l.prototype.modrn=function(h){var _=h<0;_&&(h=-h),c(h<=67108863);for(var b=(1<<26)%h,O=0,J=this.length-1;J>=0;J--)O=(b*O+(this.words[J]|0))%h;return _?-O:O},l.prototype.modn=function(h){return this.modrn(h)},l.prototype.idivn=function(h){var _=h<0;_&&(h=-h),c(h<=67108863);for(var b=0,O=this.length-1;O>=0;O--){var J=(this.words[O]|0)+b*67108864;this.words[O]=J/h|0,b=J%h}return this._strip(),_?this.ineg():this},l.prototype.divn=function(h){return this.clone().idivn(h)},l.prototype.egcd=function(h){c(h.negative===0),c(!h.isZero());var _=this,b=h.clone();_.negative!==0?_=_.umod(h):_=_.clone();for(var O=new l(1),J=new l(0),ie=new l(0),G=new l(1),I=0;_.isEven()&&b.isEven();)_.iushrn(1),b.iushrn(1),++I;for(var C=b.clone(),D=_.clone();!_.isZero();){for(var W=0,ae=1;!(_.words[0]&ae)&&W<26;++W,ae<<=1);if(W>0)for(_.iushrn(W);W-- >0;)(O.isOdd()||J.isOdd())&&(O.iadd(C),J.isub(D)),O.iushrn(1),J.iushrn(1);for(var ye=0,Xe=1;!(b.words[0]&Xe)&&ye<26;++ye,Xe<<=1);if(ye>0)for(b.iushrn(ye);ye-- >0;)(ie.isOdd()||G.isOdd())&&(ie.iadd(C),G.isub(D)),ie.iushrn(1),G.iushrn(1);_.cmp(b)>=0?(_.isub(b),O.isub(ie),J.isub(G)):(b.isub(_),ie.isub(O),G.isub(J))}return{a:ie,b:G,gcd:b.iushln(I)}},l.prototype._invmp=function(h){c(h.negative===0),c(!h.isZero());var _=this,b=h.clone();_.negative!==0?_=_.umod(h):_=_.clone();for(var O=new l(1),J=new l(0),ie=b.clone();_.cmpn(1)>0&&b.cmpn(1)>0;){for(var G=0,I=1;!(_.words[0]&I)&&G<26;++G,I<<=1);if(G>0)for(_.iushrn(G);G-- >0;)O.isOdd()&&O.iadd(ie),O.iushrn(1);for(var C=0,D=1;!(b.words[0]&D)&&C<26;++C,D<<=1);if(C>0)for(b.iushrn(C);C-- >0;)J.isOdd()&&J.iadd(ie),J.iushrn(1);_.cmp(b)>=0?(_.isub(b),O.isub(J)):(b.isub(_),J.isub(O))}var W;return _.cmpn(1)===0?W=O:W=J,W.cmpn(0)<0&&W.iadd(h),W},l.prototype.gcd=function(h){if(this.isZero())return h.abs();if(h.isZero())return this.abs();var _=this.clone(),b=h.clone();_.negative=0,b.negative=0;for(var O=0;_.isEven()&&b.isEven();O++)_.iushrn(1),b.iushrn(1);do{for(;_.isEven();)_.iushrn(1);for(;b.isEven();)b.iushrn(1);var J=_.cmp(b);if(J<0){var ie=_;_=b,b=ie}else if(J===0||b.cmpn(1)===0)break;_.isub(b)}while(!0);return b.iushln(O)},l.prototype.invm=function(h){return this.egcd(h).a.umod(h)},l.prototype.isEven=function(){return(this.words[0]&1)===0},l.prototype.isOdd=function(){return(this.words[0]&1)===1},l.prototype.andln=function(h){return this.words[0]&h},l.prototype.bincn=function(h){c(typeof h=="number");var _=h%26,b=(h-_)/26,O=1<<_;if(this.length<=b)return this._expand(b+1),this.words[b]|=O,this;for(var J=O,ie=b;J!==0&&ie<this.length;ie++){var G=this.words[ie]|0;G+=J,J=G>>>26,G&=67108863,this.words[ie]=G}return J!==0&&(this.words[ie]=J,this.length++),this},l.prototype.isZero=function(){return this.length===1&&this.words[0]===0},l.prototype.cmpn=function(h){var _=h<0;if(this.negative!==0&&!_)return-1;if(this.negative===0&&_)return 1;this._strip();var b;if(this.length>1)b=1;else{_&&(h=-h),c(h<=67108863,"Number is too big");var O=this.words[0]|0;b=O===h?0:O<h?-1:1}return this.negative!==0?-b|0:b},l.prototype.cmp=function(h){if(this.negative!==0&&h.negative===0)return-1;if(this.negative===0&&h.negative!==0)return 1;var _=this.ucmp(h);return this.negative!==0?-_|0:_},l.prototype.ucmp=function(h){if(this.length>h.length)return 1;if(this.length<h.length)return-1;for(var _=0,b=this.length-1;b>=0;b--){var O=this.words[b]|0,J=h.words[b]|0;if(O!==J){O<J?_=-1:O>J&&(_=1);break}}return _},l.prototype.gtn=function(h){return this.cmpn(h)===1},l.prototype.gt=function(h){return this.cmp(h)===1},l.prototype.gten=function(h){return this.cmpn(h)>=0},l.prototype.gte=function(h){return this.cmp(h)>=0},l.prototype.ltn=function(h){return this.cmpn(h)===-1},l.prototype.lt=function(h){return this.cmp(h)===-1},l.prototype.lten=function(h){return this.cmpn(h)<=0},l.prototype.lte=function(h){return this.cmp(h)<=0},l.prototype.eqn=function(h){return this.cmpn(h)===0},l.prototype.eq=function(h){return this.cmp(h)===0},l.red=function(h){return new V(h)},l.prototype.toRed=function(h){return c(!this.red,"Already a number in reduction context"),c(this.negative===0,"red works only with positives"),h.convertTo(this)._forceRed(h)},l.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},l.prototype._forceRed=function(h){return this.red=h,this},l.prototype.forceRed=function(h){return c(!this.red,"Already a number in reduction context"),this._forceRed(h)},l.prototype.redAdd=function(h){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,h)},l.prototype.redIAdd=function(h){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,h)},l.prototype.redSub=function(h){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,h)},l.prototype.redISub=function(h){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,h)},l.prototype.redShl=function(h){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,h)},l.prototype.redMul=function(h){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.mul(this,h)},l.prototype.redIMul=function(h){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.imul(this,h)},l.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},l.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},l.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},l.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},l.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},l.prototype.redPow=function(h){return c(this.red&&!h.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,h)};var re={k256:null,p224:null,p192:null,p25519:null};function ee(m,h){this.name=m,this.p=new l(h,16),this.n=this.p.bitLength(),this.k=new l(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ee.prototype._tmp=function(){var h=new l(null);return h.words=new Array(Math.ceil(this.n/13)),h},ee.prototype.ireduce=function(h){var _=h,b;do this.split(_,this.tmp),_=this.imulK(_),_=_.iadd(this.tmp),b=_.bitLength();while(b>this.n);var O=b<this.n?-1:_.ucmp(this.p);return O===0?(_.words[0]=0,_.length=1):O>0?_.isub(this.p):_.strip!==void 0?_.strip():_._strip(),_},ee.prototype.split=function(h,_){h.iushrn(this.n,0,_)},ee.prototype.imulK=function(h){return h.imul(this.k)};function T(){ee.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}f(T,ee),T.prototype.split=function(h,_){for(var b=4194303,O=Math.min(h.length,9),J=0;J<O;J++)_.words[J]=h.words[J];if(_.length=O,h.length<=9){h.words[0]=0,h.length=1;return}var ie=h.words[9];for(_.words[_.length++]=ie&b,J=10;J<h.length;J++){var G=h.words[J]|0;h.words[J-10]=(G&b)<<4|ie>>>22,ie=G}ie>>>=22,h.words[J-10]=ie,ie===0&&h.length>10?h.length-=10:h.length-=9},T.prototype.imulK=function(h){h.words[h.length]=0,h.words[h.length+1]=0,h.length+=2;for(var _=0,b=0;b<h.length;b++){var O=h.words[b]|0;_+=O*977,h.words[b]=_&67108863,_=O*64+(_/67108864|0)}return h.words[h.length-1]===0&&(h.length--,h.words[h.length-1]===0&&h.length--),h};function se(){ee.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}f(se,ee);function p(){ee.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}f(p,ee);function L(){ee.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}f(L,ee),L.prototype.imulK=function(h){for(var _=0,b=0;b<h.length;b++){var O=(h.words[b]|0)*19+_,J=O&67108863;O>>>=26,h.words[b]=J,_=O}return _!==0&&(h.words[h.length++]=_),h},l._prime=function(h){if(re[h])return re[h];var _;if(h==="k256")_=new T;else if(h==="p224")_=new se;else if(h==="p192")_=new p;else if(h==="p25519")_=new L;else throw new Error("Unknown prime "+h);return re[h]=_,_};function V(m){if(typeof m=="string"){var h=l._prime(m);this.m=h.p,this.prime=h}else c(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}V.prototype._verify1=function(h){c(h.negative===0,"red works only with positives"),c(h.red,"red works only with red numbers")},V.prototype._verify2=function(h,_){c((h.negative|_.negative)===0,"red works only with positives"),c(h.red&&h.red===_.red,"red works only with red numbers")},V.prototype.imod=function(h){return this.prime?this.prime.ireduce(h)._forceRed(this):(j(h,h.umod(this.m)._forceRed(this)),h)},V.prototype.neg=function(h){return h.isZero()?h.clone():this.m.sub(h)._forceRed(this)},V.prototype.add=function(h,_){this._verify2(h,_);var b=h.add(_);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},V.prototype.iadd=function(h,_){this._verify2(h,_);var b=h.iadd(_);return b.cmp(this.m)>=0&&b.isub(this.m),b},V.prototype.sub=function(h,_){this._verify2(h,_);var b=h.sub(_);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},V.prototype.isub=function(h,_){this._verify2(h,_);var b=h.isub(_);return b.cmpn(0)<0&&b.iadd(this.m),b},V.prototype.shl=function(h,_){return this._verify1(h),this.imod(h.ushln(_))},V.prototype.imul=function(h,_){return this._verify2(h,_),this.imod(h.imul(_))},V.prototype.mul=function(h,_){return this._verify2(h,_),this.imod(h.mul(_))},V.prototype.isqr=function(h){return this.imul(h,h.clone())},V.prototype.sqr=function(h){return this.mul(h,h)},V.prototype.sqrt=function(h){if(h.isZero())return h.clone();var _=this.m.andln(3);if(c(_%2===1),_===3){var b=this.m.add(new l(1)).iushrn(2);return this.pow(h,b)}for(var O=this.m.subn(1),J=0;!O.isZero()&&O.andln(1)===0;)J++,O.iushrn(1);c(!O.isZero());var ie=new l(1).toRed(this),G=ie.redNeg(),I=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new l(2*C*C).toRed(this);this.pow(C,I).cmp(G)!==0;)C.redIAdd(G);for(var D=this.pow(C,O),W=this.pow(h,O.addn(1).iushrn(1)),ae=this.pow(h,O),ye=J;ae.cmp(ie)!==0;){for(var Xe=ae,nt=0;Xe.cmp(ie)!==0;nt++)Xe=Xe.redSqr();c(nt<ye);var Ke=this.pow(D,new l(1).iushln(ye-nt-1));W=W.redMul(Ke),D=Ke.redSqr(),ae=ae.redMul(D),ye=nt}return W},V.prototype.invm=function(h){var _=h._invmp(this.m);return _.negative!==0?(_.negative=0,this.imod(_).redNeg()):this.imod(_)},V.prototype.pow=function(h,_){if(_.isZero())return new l(1).toRed(this);if(_.cmpn(1)===0)return h.clone();var b=4,O=new Array(1<<b);O[0]=new l(1).toRed(this),O[1]=h;for(var J=2;J<O.length;J++)O[J]=this.mul(O[J-1],h);var ie=O[0],G=0,I=0,C=_.bitLength()%26;for(C===0&&(C=26),J=_.length-1;J>=0;J--){for(var D=_.words[J],W=C-1;W>=0;W--){var ae=D>>W&1;if(ie!==O[0]&&(ie=this.sqr(ie)),ae===0&&G===0){I=0;continue}G<<=1,G|=ae,I++,!(I!==b&&(J!==0||W!==0))&&(ie=this.mul(ie,O[G]),I=0,G=0)}C=26}return ie},V.prototype.convertTo=function(h){var _=h.umod(this.m);return _===h?_.clone():_},V.prototype.convertFrom=function(h){var _=h.clone();return _.red=null,_},l.mont=function(h){return new K(h)};function K(m){V.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new l(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}f(K,V),K.prototype.convertTo=function(h){return this.imod(h.ushln(this.shift))},K.prototype.convertFrom=function(h){var _=this.imod(h.mul(this.rinv));return _.red=null,_},K.prototype.imul=function(h,_){if(h.isZero()||_.isZero())return h.words[0]=0,h.length=1,h;var b=h.imul(_),O=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),J=b.isub(O).iushrn(this.shift),ie=J;return J.cmp(this.m)>=0?ie=J.isub(this.m):J.cmpn(0)<0&&(ie=J.iadd(this.m)),ie._forceRed(this)},K.prototype.mul=function(h,_){if(h.isZero()||_.isZero())return new l(0)._forceRed(this);var b=h.mul(_),O=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),J=b.isub(O).iushrn(this.shift),ie=J;return J.cmp(this.m)>=0?ie=J.isub(this.m):J.cmpn(0)<0&&(ie=J.iadd(this.m)),ie._forceRed(this)},K.prototype.invm=function(h){var _=this.imod(h._invmp(this.m).mul(this.r2));return _._forceRed(this)}})(e,Mti)})(a3n);var G9s=a3n.exports,q9s=Tti(G9s),K9s="logger/5.7.0",Iti=!1,Cti=!1,T6t={debug:1,default:2,info:2,warning:3,error:4,off:5},_ti=T6t.default,OCn=null;function Y9s(){try{let e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(i=>{try{if("test".normalize(i)!=="test")throw new Error("bad normalize")}catch(A){e.push(i)}}),e.length)throw new Error("missing "+e.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(e){return e.message}return null}var Eti=Y9s(),UCn;(function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"})(UCn||(UCn={}));var $F;(function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"})($F||($F={}));var Bti="0123456789abcdef",dd=class e{constructor(i){Object.defineProperty(this,"version",{enumerable:!0,value:i,writable:!1})}_log(i,A){let c=i.toLowerCase();T6t[c]==null&&this.throwArgumentError("invalid log level name","logLevel",i),!(_ti>T6t[c])&&console.log.apply(console,A)}debug(...i){this._log(e.levels.DEBUG,i)}info(...i){this._log(e.levels.INFO,i)}warn(...i){this._log(e.levels.WARNING,i)}makeError(i,A,c){if(Cti)return this.makeError("censored error",A,{});A||(A=e.errors.UNKNOWN_ERROR),c||(c={});let f=[];Object.keys(c).forEach(N=>{let F=c[N];try{if(F instanceof Uint8Array){let j="";for(let te=0;te<F.length;te++)j+=Bti[F[te]>>4],j+=Bti[F[te]&15];f.push(N+"=Uint8Array(0x"+j+")")}else f.push(N+"="+JSON.stringify(F))}catch(j){f.push(N+"="+JSON.stringify(c[N].toString()))}}),f.push(`code=${A}`),f.push(`version=${this.version}`);let l=i,g="";switch(A){case $F.NUMERIC_FAULT:{g="NUMERIC_FAULT";let N=i;switch(N){case"overflow":case"underflow":case"division-by-zero":g+="-"+N;break;case"negative-power":case"negative-width":g+="-unsupported";break;case"unbound-bitwise-result":g+="-unbound-result";break}break}case $F.CALL_EXCEPTION:case $F.INSUFFICIENT_FUNDS:case $F.MISSING_NEW:case $F.NONCE_EXPIRED:case $F.REPLACEMENT_UNDERPRICED:case $F.TRANSACTION_REPLACED:case $F.UNPREDICTABLE_GAS_LIMIT:g=A;break}g&&(i+=" [ See: https://links.ethers.org/v5-errors-"+g+" ]"),f.length&&(i+=" ("+f.join(", ")+")");let w=new Error(i);return w.reason=l,w.code=A,Object.keys(c).forEach(function(N){w[N]=c[N]}),w}throwError(i,A,c){throw this.makeError(i,A,c)}throwArgumentError(i,A,c){return this.throwError(i,e.errors.INVALID_ARGUMENT,{argument:A,value:c})}assert(i,A,c,f){i||this.throwError(A,c,f)}assertArgument(i,A,c,f){i||this.throwArgumentError(A,c,f)}checkNormalize(i){Eti&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Eti})}checkSafeUint53(i,A){typeof i=="number"&&(A==null&&(A="value not safe"),(i<0||i>=9007199254740991)&&this.throwError(A,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:i}),i%1&&this.throwError(A,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:i}))}checkArgumentCount(i,A,c){c?c=": "+c:c="",i<A&&this.throwError("missing argument"+c,e.errors.MISSING_ARGUMENT,{count:i,expectedCount:A}),i>A&&this.throwError("too many arguments"+c,e.errors.UNEXPECTED_ARGUMENT,{count:i,expectedCount:A})}checkNew(i,A){(i===Object||i==null)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:A.name})}checkAbstract(i,A){i===A?this.throwError("cannot instantiate abstract class "+JSON.stringify(A.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:i.name,operation:"new"}):(i===Object||i==null)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:A.name})}static globalLogger(){return OCn||(OCn=new e(K9s)),OCn}static setCensorship(i,A){if(!i&&A&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Iti){if(!i)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Cti=!!i,Iti=!!A}static setLogLevel(i){let A=T6t[i.toLowerCase()];if(A==null){e.globalLogger().warn("invalid log level - "+i);return}_ti=A}static from(i){return new e(i)}};dd.errors=$F;dd.levels=UCn;var V9s="bytes/5.7.0",yW=new dd(V9s);function Uti(e){return!!e.toHexString}function _qe(e){return e.slice||(e.slice=function(){let i=Array.prototype.slice.call(arguments);return _qe(new Uint8Array(Array.prototype.slice.apply(e,i)))}),e}function z9s(e){return kD(e)&&!(e.length%2)||Z6t(e)}function vti(e){return typeof e=="number"&&e==e&&e%1===0}function Z6t(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!vti(e.length)||e.length<0)return!1;for(let i=0;i<e.length;i++){let A=e[i];if(!vti(A)||A<0||A>=256)return!1}return!0}function T3(e,i){if(i||(i={}),typeof e=="number"){yW.checkSafeUint53(e,"invalid arrayify value");let A=[];for(;e;)A.unshift(e&255),e=parseInt(String(e/256));return A.length===0&&A.push(0),_qe(new Uint8Array(A))}if(i.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),Uti(e)&&(e=e.toHexString()),kD(e)){let A=e.substring(2);A.length%2&&(i.hexPad==="left"?A="0"+A:i.hexPad==="right"?A+="0":yW.throwArgumentError("hex data is odd-length","value",e));let c=[];for(let f=0;f<A.length;f+=2)c.push(parseInt(A.substring(f,f+2),16));return _qe(new Uint8Array(c))}return Z6t(e)?_qe(new Uint8Array(e)):yW.throwArgumentError("invalid arrayify value","value",e)}function iwe(e){let i=e.map(f=>T3(f)),A=i.reduce((f,l)=>f+l.length,0),c=new Uint8Array(A);return i.reduce((f,l)=>(c.set(l,f),f+l.length),0),_qe(c)}function W9s(e){let i=T3(e);if(i.length===0)return i;let A=0;for(;A<i.length&&i[A]===0;)A++;return A&&(i=i.slice(A)),i}function kD(e,i){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||i&&e.length!==2+2*i)}var NCn="0123456789abcdef";function Lm(e,i){if(i||(i={}),typeof e=="number"){yW.checkSafeUint53(e,"invalid hexlify value");let A="";for(;e;)A=NCn[e&15]+A,e=Math.floor(e/16);return A.length?(A.length%2&&(A="0"+A),"0x"+A):"0x00"}if(typeof e=="bigint")return e=e.toString(16),e.length%2?"0x0"+e:"0x"+e;if(i.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),Uti(e))return e.toHexString();if(kD(e))return e.length%2&&(i.hexPad==="left"?e="0x0"+e.substring(2):i.hexPad==="right"?e+="0":yW.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Z6t(e)){let A="0x";for(let c=0;c<e.length;c++){let f=e[c];A+=NCn[(f&240)>>4]+NCn[f&15]}return A}return yW.throwArgumentError("invalid hexlify value","value",e)}function Z9s(e){if(typeof e!="string")e=Lm(e);else if(!kD(e)||e.length%2)return null;return(e.length-2)/2}function Fti(e,i,A){return typeof e!="string"?e=Lm(e):(!kD(e)||e.length%2)&&yW.throwArgumentError("invalid hexData","value",e),i=2+2*i,A!=null?"0x"+e.substring(i,2+2*A):"0x"+e.substring(i)}function X9s(e){let i="0x";return e.forEach(A=>{i+=Lm(A).substring(2)}),i}function Jti(e,i){for(typeof e!="string"?e=Lm(e):kD(e)||yW.throwArgumentError("invalid hex string","value",e),e.length>2*i+2&&yW.throwArgumentError("value out of range","value",arguments[1]);e.length<2*i+2;)e="0x0"+e.substring(2);return e}var $9s="bignumber/5.7.0",J6t=q9s.BN,pW=new dd($9s),xCn={},bti=9007199254740991,Sti=!1,Vg=class e{constructor(i,A){i!==xCn&&pW.throwError("cannot call constructor directly; use BigNumber.from",dd.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=A,this._isBigNumber=!0,Object.freeze(this)}fromTwos(i){return wD(n2(this).fromTwos(i))}toTwos(i){return wD(n2(this).toTwos(i))}abs(){return this._hex[0]==="-"?e.from(this._hex.substring(1)):this}add(i){return wD(n2(this).add(n2(i)))}sub(i){return wD(n2(this).sub(n2(i)))}div(i){return e.from(i).isZero()&&XM("division-by-zero","div"),wD(n2(this).div(n2(i)))}mul(i){return wD(n2(this).mul(n2(i)))}mod(i){let A=n2(i);return A.isNeg()&&XM("division-by-zero","mod"),wD(n2(this).umod(A))}pow(i){let A=n2(i);return A.isNeg()&&XM("negative-power","pow"),wD(n2(this).pow(A))}and(i){let A=n2(i);return(this.isNegative()||A.isNeg())&&XM("unbound-bitwise-result","and"),wD(n2(this).and(A))}or(i){let A=n2(i);return(this.isNegative()||A.isNeg())&&XM("unbound-bitwise-result","or"),wD(n2(this).or(A))}xor(i){let A=n2(i);return(this.isNegative()||A.isNeg())&&XM("unbound-bitwise-result","xor"),wD(n2(this).xor(A))}mask(i){return(this.isNegative()||i<0)&&XM("negative-width","mask"),wD(n2(this).maskn(i))}shl(i){return(this.isNegative()||i<0)&&XM("negative-width","shl"),wD(n2(this).shln(i))}shr(i){return(this.isNegative()||i<0)&&XM("negative-width","shr"),wD(n2(this).shrn(i))}eq(i){return n2(this).eq(n2(i))}lt(i){return n2(this).lt(n2(i))}lte(i){return n2(this).lte(n2(i))}gt(i){return n2(this).gt(n2(i))}gte(i){return n2(this).gte(n2(i))}isNegative(){return this._hex[0]==="-"}isZero(){return n2(this).isZero()}toNumber(){try{return n2(this).toNumber()}catch(i){XM("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(i){}return pW.throwError("this platform does not support BigInt",dd.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Sti||(Sti=!0,pW.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?pW.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",dd.errors.UNEXPECTED_ARGUMENT,{}):pW.throwError("BigNumber.toString does not accept parameters",dd.errors.UNEXPECTED_ARGUMENT,{})),n2(this).toString(10)}toHexString(){return this._hex}toJSON(i){return{type:"BigNumber",hex:this.toHexString()}}static from(i){if(i instanceof e)return i;if(typeof i=="string")return i.match(/^-?0x[0-9a-f]+$/i)?new e(xCn,Eqe(i)):i.match(/^-?[0-9]+$/)?new e(xCn,Eqe(new J6t(i))):pW.throwArgumentError("invalid BigNumber string","value",i);if(typeof i=="number")return i%1&&XM("underflow","BigNumber.from",i),(i>=bti||i<=-bti)&&XM("overflow","BigNumber.from",i),e.from(String(i));let A=i;if(typeof A=="bigint")return e.from(A.toString());if(Z6t(A))return e.from(Lm(A));if(A)if(A.toHexString){let c=A.toHexString();if(typeof c=="string")return e.from(c)}else{let c=A._hex;if(c==null&&A.type==="BigNumber"&&(c=A.hex),typeof c=="string"&&(kD(c)||c[0]==="-"&&kD(c.substring(1))))return e.from(c)}return pW.throwArgumentError("invalid BigNumber value","value",i)}static isBigNumber(i){return!!(i&&i._isBigNumber)}};function Eqe(e){if(typeof e!="string")return Eqe(e.toString(16));if(e[0]==="-")return e=e.substring(1),e[0]==="-"&&pW.throwArgumentError("invalid hex","value",e),e=Eqe(e),e==="0x00"?e:"-"+e;if(e.substring(0,2)!=="0x"&&(e="0x"+e),e==="0x")return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&e.substring(0,4)==="0x00";)e="0x"+e.substring(4);return e}function wD(e){return Vg.from(Eqe(e))}function n2(e){let i=Vg.from(e).toHexString();return i[0]==="-"?new J6t("-"+i.substring(3),16):new J6t(i.substring(2),16)}function XM(e,i,A){let c={fault:e,operation:i};return A!=null&&(c.value=A),pW.throwError(e,dd.errors.NUMERIC_FAULT,c)}function j9s(e){return new J6t(e,36).toString(16)}var ePs="properties/5.7.0",tPs=function(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})},Hti=new dd(ePs);function yd(e,i,A){Object.defineProperty(e,i,{enumerable:!0,value:A,writable:!1})}function Cqe(e,i){for(let A=0;A<32;A++){if(e[i])return e[i];if(!e.prototype||typeof e.prototype!="object")break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function moe(e){return tPs(this,void 0,void 0,function*(){let i=Object.keys(e).map(c=>{let f=e[c];return Promise.resolve(f).then(l=>({key:c,value:l}))});return(yield Promise.all(i)).reduce((c,f)=>(c[f.key]=f.value,c),{})})}function owe(e){let i={};for(let A in e)i[A]=e[A];return i}var nPs={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Lti(e){if(e==null||nPs[typeof e])return!0;if(Array.isArray(e)||typeof e=="object"){if(!Object.isFrozen(e))return!1;let i=Object.keys(e);for(let A=0;A<i.length;A++){let c=null;try{c=e[i[A]]}catch(f){continue}if(!Lti(c))return!1}return!0}return Hti.throwArgumentError(`Cannot deepCopy ${typeof e}`,"object",e)}function rPs(e){if(Lti(e))return e;if(Array.isArray(e))return Object.freeze(e.map(i=>Bqe(i)));if(typeof e=="object"){let i={};for(let A in e){let c=e[A];c!==void 0&&yd(i,A,Bqe(c))}return i}return Hti.throwArgumentError(`Cannot deepCopy ${typeof e}`,"object",e)}function Bqe(e){return rPs(e)}var awe=class{constructor(i){for(let A in i)this[A]=Bqe(i[A])}},Rqe="abi/5.7.0",C2=new dd(Rqe),rle={},wti={calldata:!0,memory:!0,storage:!0},iPs={calldata:!0,memory:!0};function N6t(e,i){if(e==="bytes"||e==="string"){if(wti[i])return!0}else if(e==="address"){if(i==="payable")return!0}else if((e.indexOf("[")>=0||e==="tuple")&&iPs[i])return!0;return(wti[i]||i==="payable")&&C2.throwArgumentError("invalid modifier","name",i),!1}function oPs(e,i){let A=e;function c(w){C2.throwArgumentError(`unexpected character at position ${w}`,"param",e)}e=e.replace(/\s/g," ");function f(w){let N={type:"",name:"",parent:w,state:{allowType:!0}};return i&&(N.indexed=!1),N}let l={type:"",name:"",state:{allowType:!0}},g=l;for(let w=0;w<e.length;w++){let N=e[w];switch(N){case"(":g.state.allowType&&g.type===""?g.type="tuple":g.state.allowParams||c(w),g.state.allowType=!1,g.type=ewe(g.type),g.components=[f(g)],g=g.components[0];break;case")":delete g.state,g.name==="indexed"&&(i||c(w),g.indexed=!0,g.name=""),N6t(g.type,g.name)&&(g.name=""),g.type=ewe(g.type);let F=g;g=g.parent,g||c(w),delete F.parent,g.state.allowParams=!1,g.state.allowName=!0,g.state.allowArray=!0;break;case",":delete g.state,g.name==="indexed"&&(i||c(w),g.indexed=!0,g.name=""),N6t(g.type,g.name)&&(g.name=""),g.type=ewe(g.type);let j=f(g.parent);g.parent.components.push(j),delete g.parent,g=j;break;case" ":g.state.allowType&&g.type!==""&&(g.type=ewe(g.type),delete g.state.allowType,g.state.allowName=!0,g.state.allowParams=!0),g.state.allowName&&g.name!==""&&(g.name==="indexed"?(i||c(w),g.indexed&&c(w),g.indexed=!0,g.name=""):N6t(g.type,g.name)?g.name="":g.state.allowName=!1);break;case"[":g.state.allowArray||c(w),g.type+=N,g.state.allowArray=!1,g.state.allowName=!1,g.state.readArray=!0;break;case"]":g.state.readArray||c(w),g.type+=N,g.state.readArray=!1,g.state.allowArray=!0,g.state.allowName=!0;break;default:g.state.allowType?(g.type+=N,g.state.allowParams=!0,g.state.allowArray=!0):g.state.allowName?(g.name+=N,delete g.state.allowArray):g.state.readArray?g.type+=N:c(w)}}return g.parent&&C2.throwArgumentError("unexpected eof","param",e),delete l.state,g.name==="indexed"?(i||c(A.length-7),g.indexed&&c(A.length-7),g.indexed=!0,g.name=""):N6t(g.type,g.name)&&(g.name=""),l.type=ewe(l.type),l}function U6t(e,i){for(let A in i)yd(e,A,i[A])}var Nh=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),aPs=new RegExp(/^(.*)\[([0-9]*)\]$/),eT=class e{constructor(i,A){i!==rle&&C2.throwError("use fromString",dd.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),U6t(this,A);let c=this.type.match(aPs);c?U6t(this,{arrayLength:parseInt(c[2]||"-1"),arrayChildren:e.fromObject({type:c[1],components:this.components}),baseType:"array"}):U6t(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json){let c={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(c.indexed=this.indexed),this.components&&(c.components=this.components.map(f=>JSON.parse(f.format(i)))),JSON.stringify(c)}let A="";return this.baseType==="array"?(A+=this.arrayChildren.format(i),A+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(i!==Nh.sighash&&(A+=this.type),A+="("+this.components.map(c=>c.format(i)).join(i===Nh.full?", ":",")+")"):A+=this.type,i!==Nh.sighash&&(this.indexed===!0&&(A+=" indexed"),i===Nh.full&&this.name&&(A+=" "+this.name)),A}static from(i,A){return typeof i=="string"?e.fromString(i,A):e.fromObject(i)}static fromObject(i){return e.isParamType(i)?i:new e(rle,{name:i.name||null,type:ewe(i.type),indexed:i.indexed==null?null:!!i.indexed,components:i.components?i.components.map(e.fromObject):null})}static fromString(i,A){function c(f){return e.fromObject({name:f.name,type:f.type,indexed:f.indexed,components:f.components})}return c(oPs(i,!!A))}static isParamType(i){return!!(i!=null&&i._isParamType)}};function vqe(e,i){return APs(e).map(A=>eT.fromString(A,i))}var swe=class e{constructor(i,A){i!==rle&&C2.throwError("use a static from method",dd.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),U6t(this,A),this._isFragment=!0,Object.freeze(this)}static from(i){return e.isFragment(i)?i:typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isFragment(i))return i;switch(i.type){case"function":return dwe.fromObject(i);case"event":return bqe.fromObject(i);case"constructor":return Awe.fromObject(i);case"error":return H6t.fromObject(i);case"fallback":case"receive":return null}return C2.throwArgumentError("invalid fragment object","value",i)}static fromString(i){return i=i.replace(/\s/g," "),i=i.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),i=i.trim(),i.split(" ")[0]==="event"?bqe.fromString(i.substring(5).trim()):i.split(" ")[0]==="function"?dwe.fromString(i.substring(8).trim()):i.split("(")[0].trim()==="constructor"?Awe.fromString(i.trim()):i.split(" ")[0]==="error"?H6t.fromString(i.substring(5).trim()):C2.throwArgumentError("unsupported fragment","value",i)}static isFragment(i){return!!(i&&i._isFragment)}},bqe=class e extends swe{format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(c=>JSON.parse(c.format(i)))});let A="";return i!==Nh.sighash&&(A+="event "),A+=this.name+"("+this.inputs.map(c=>c.format(i)).join(i===Nh.full?", ":",")+") ",i!==Nh.sighash&&this.anonymous&&(A+="anonymous "),A.trim()}static from(i){return typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isEventFragment(i))return i;i.type!=="event"&&C2.throwArgumentError("invalid event object","value",i);let A={name:Sqe(i.name),anonymous:i.anonymous,inputs:i.inputs?i.inputs.map(eT.fromObject):[],type:"event"};return new e(rle,A)}static fromString(i){let A=i.match(wqe);A||C2.throwArgumentError("invalid event string","value",i);let c=!1;return A[3].split(" ").forEach(f=>{switch(f.trim()){case"anonymous":c=!0;break;case"":break;default:C2.warn("unknown modifier: "+f)}}),e.fromObject({name:A[1].trim(),anonymous:c,inputs:vqe(A[2],!0),type:"event"})}static isEventFragment(i){return i&&i._isFragment&&i.type==="event"}};function Gti(e,i){i.gas=null;let A=e.split("@");return A.length!==1?(A.length>2&&C2.throwArgumentError("invalid human-readable ABI signature","value",e),A[1].match(/^[0-9]+$/)||C2.throwArgumentError("invalid human-readable ABI signature gas","value",e),i.gas=Vg.from(A[1]),A[0]):e}function qti(e,i){i.constant=!1,i.payable=!1,i.stateMutability="nonpayable",e.split(" ").forEach(A=>{switch(A.trim()){case"constant":i.constant=!0;break;case"payable":i.payable=!0,i.stateMutability="payable";break;case"nonpayable":i.payable=!1,i.stateMutability="nonpayable";break;case"pure":i.constant=!0,i.stateMutability="pure";break;case"view":i.constant=!0,i.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+A)}})}function Kti(e){let i={constant:!1,payable:!0,stateMutability:"payable"};return e.stateMutability!=null?(i.stateMutability=e.stateMutability,i.constant=i.stateMutability==="view"||i.stateMutability==="pure",e.constant!=null&&!!e.constant!==i.constant&&C2.throwArgumentError("cannot have constant function with mutability "+i.stateMutability,"value",e),i.payable=i.stateMutability==="payable",e.payable!=null&&!!e.payable!==i.payable&&C2.throwArgumentError("cannot have payable function with mutability "+i.stateMutability,"value",e)):e.payable!=null?(i.payable=!!e.payable,e.constant==null&&!i.payable&&e.type!=="constructor"&&C2.throwArgumentError("unable to determine stateMutability","value",e),i.constant=!!e.constant,i.constant?i.stateMutability="view":i.stateMutability=i.payable?"payable":"nonpayable",i.payable&&i.constant&&C2.throwArgumentError("cannot have constant payable function","value",e)):e.constant!=null?(i.constant=!!e.constant,i.payable=!i.constant,i.stateMutability=i.constant?"view":"payable"):e.type!=="constructor"&&C2.throwArgumentError("unable to determine stateMutability","value",e),i}var Awe=class e extends swe{format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(c=>JSON.parse(c.format(i)))});i===Nh.sighash&&C2.throwError("cannot format a constructor for sighash",dd.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let A="constructor("+this.inputs.map(c=>c.format(i)).join(i===Nh.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(A+=this.stateMutability+" "),A.trim()}static from(i){return typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isConstructorFragment(i))return i;i.type!=="constructor"&&C2.throwArgumentError("invalid constructor object","value",i);let A=Kti(i);A.constant&&C2.throwArgumentError("constructor cannot be constant","value",i);let c={name:null,type:i.type,inputs:i.inputs?i.inputs.map(eT.fromObject):[],payable:A.payable,stateMutability:A.stateMutability,gas:i.gas?Vg.from(i.gas):null};return new e(rle,c)}static fromString(i){let A={type:"constructor"};i=Gti(i,A);let c=i.match(wqe);return(!c||c[1].trim()!=="constructor")&&C2.throwArgumentError("invalid constructor string","value",i),A.inputs=vqe(c[2].trim(),!1),qti(c[3].trim(),A),e.fromObject(A)}static isConstructorFragment(i){return i&&i._isFragment&&i.type==="constructor"}},dwe=class e extends Awe{format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(c=>JSON.parse(c.format(i))),outputs:this.outputs.map(c=>JSON.parse(c.format(i)))});let A="";return i!==Nh.sighash&&(A+="function "),A+=this.name+"("+this.inputs.map(c=>c.format(i)).join(i===Nh.full?", ":",")+") ",i!==Nh.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(A+=this.stateMutability+" "):this.constant&&(A+="view "),this.outputs&&this.outputs.length&&(A+="returns ("+this.outputs.map(c=>c.format(i)).join(", ")+") "),this.gas!=null&&(A+="@"+this.gas.toString()+" ")),A.trim()}static from(i){return typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isFunctionFragment(i))return i;i.type!=="function"&&C2.throwArgumentError("invalid function object","value",i);let A=Kti(i),c={type:i.type,name:Sqe(i.name),constant:A.constant,inputs:i.inputs?i.inputs.map(eT.fromObject):[],outputs:i.outputs?i.outputs.map(eT.fromObject):[],payable:A.payable,stateMutability:A.stateMutability,gas:i.gas?Vg.from(i.gas):null};return new e(rle,c)}static fromString(i){let A={type:"function"};i=Gti(i,A);let c=i.split(" returns ");c.length>2&&C2.throwArgumentError("invalid function string","value",i);let f=c[0].match(wqe);if(f||C2.throwArgumentError("invalid function signature","value",i),A.name=f[1].trim(),A.name&&Sqe(A.name),A.inputs=vqe(f[2],!1),qti(f[3].trim(),A),c.length>1){let l=c[1].match(wqe);(l[1].trim()!=""||l[3].trim()!="")&&C2.throwArgumentError("unexpected tokens","value",i),A.outputs=vqe(l[2],!1)}else A.outputs=[];return e.fromObject(A)}static isFunctionFragment(i){return i&&i._isFragment&&i.type==="function"}};function Qti(e){let i=e.format();return(i==="Error(string)"||i==="Panic(uint256)")&&C2.throwArgumentError(`cannot specify user defined ${i} error`,"fragment",e),e}var H6t=class e extends swe{format(i){if(i||(i=Nh.sighash),Nh[i]||C2.throwArgumentError("invalid format type","format",i),i===Nh.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(c=>JSON.parse(c.format(i)))});let A="";return i!==Nh.sighash&&(A+="error "),A+=this.name+"("+this.inputs.map(c=>c.format(i)).join(i===Nh.full?", ":",")+") ",A.trim()}static from(i){return typeof i=="string"?e.fromString(i):e.fromObject(i)}static fromObject(i){if(e.isErrorFragment(i))return i;i.type!=="error"&&C2.throwArgumentError("invalid error object","value",i);let A={type:i.type,name:Sqe(i.name),inputs:i.inputs?i.inputs.map(eT.fromObject):[]};return Qti(new e(rle,A))}static fromString(i){let A={type:"error"},c=i.match(wqe);return c||C2.throwArgumentError("invalid error signature","value",i),A.name=c[1].trim(),A.name&&Sqe(A.name),A.inputs=vqe(c[2],!1),Qti(e.fromObject(A))}static isErrorFragment(i){return i&&i._isFragment&&i.type==="error"}};function ewe(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var sPs=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Sqe(e){return(!e||!e.match(sPs))&&C2.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}var wqe=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function APs(e){e=e.trim();let i=[],A="",c=0;for(let f=0;f<e.length;f++){let l=e[f];l===","&&c===0?(i.push(A),A=""):(A+=l,l==="("?c++:l===")"&&(c--,c===-1&&C2.throwArgumentError("unbalanced parenthesis","value",e)))}return A&&i.push(A),i}var s3n=new dd(Rqe);function dPs(e){let i=[],A=function(c,f){if(Array.isArray(f))for(let l in f){let g=c.slice();g.push(l);try{A(g,f[l])}catch(w){i.push({path:g,error:w})}}};return A([],e),i}var jF=class{constructor(i,A,c,f){this.name=i,this.type=A,this.localName=c,this.dynamic=f}_throwError(i,A){s3n.throwArgumentError(i,this.localName,A)}},Qqe=class{constructor(i){yd(this,"wordSize",i||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(i)}get data(){return X9s(this._data)}get length(){return this._dataLength}_writeData(i){return this._data.push(i),this._dataLength+=i.length,i.length}appendWriter(i){return this._writeData(iwe(i._data))}writeBytes(i){let A=T3(i),c=A.length%this.wordSize;return c&&(A=iwe([A,this._padding.slice(c)])),this._writeData(A)}_getValue(i){let A=T3(Vg.from(i));return A.length>this.wordSize&&s3n.throwError("value out-of-bounds",dd.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:A.length}),A.length%this.wordSize&&(A=iwe([this._padding.slice(A.length%this.wordSize),A])),A}writeValue(i){return this._writeData(this._getValue(i))}writeUpdatableValue(){let i=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,A=>{this._data[i]=this._getValue(A)}}},FCn=class e{constructor(i,A,c,f){yd(this,"_data",T3(i)),yd(this,"wordSize",A||32),yd(this,"_coerceFunc",c),yd(this,"allowLoose",f),this._offset=0}get data(){return Lm(this._data)}get consumed(){return this._offset}static coerce(i,A){let c=i.match("^u?int([0-9]+)$");return c&&parseInt(c[1])<=48&&(A=A.toNumber()),A}coerce(i,A){return this._coerceFunc?this._coerceFunc(i,A):e.coerce(i,A)}_peekBytes(i,A,c){let f=Math.ceil(A/this.wordSize)*this.wordSize;return this._offset+f>this._data.length&&(this.allowLoose&&c&&this._offset+A<=this._data.length?f=A:s3n.throwError("data out-of-bounds",dd.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+f})),this._data.slice(this._offset,this._offset+f)}subReader(i){return new e(this._data.slice(this._offset+i),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(i,A){let c=this._peekBytes(0,i,!!A);return this._offset+=c.length,c.slice(0,i)}readValue(){return Vg.from(this.readBytes(this.wordSize))}},A3n={exports:{}};A3n.exports;(function(e){(function(){var i="input is invalid type",A="finalize already called",c=typeof window=="object",f=c?window:{};f.JS_SHA3_NO_WINDOW&&(c=!1);var l=!c&&typeof self=="object",g=!f.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;g?f=Mti:l&&(f=self);var w=!f.JS_SHA3_NO_COMMON_JS&&!0&&e.exports,N=!f.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",F="0123456789abcdef".split(""),j=[31,7936,2031616,520093696],te=[4,1024,262144,67108864],v=[1,256,65536,16777216],ne=[6,1536,393216,100663296],Z=[0,8,16,24],R=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],M=[224,256,384,512],U=[128,256],E=["hex","buffer","arrayBuffer","array","digest"],Q={128:168,256:136};(f.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(ae){return Object.prototype.toString.call(ae)==="[object Array]"}),N&&(f.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(ae){return typeof ae=="object"&&ae.buffer&&ae.buffer.constructor===ArrayBuffer});for(var H=function(ae,ye,Xe){return function(nt){return new C(ae,ye,ae).update(nt)[Xe]()}},re=function(ae,ye,Xe){return function(nt,Ke){return new C(ae,ye,Ke).update(nt)[Xe]()}},ee=function(ae,ye,Xe){return function(nt,Ke,It,rt){return h["cshake"+ae].update(nt,Ke,It,rt)[Xe]()}},T=function(ae,ye,Xe){return function(nt,Ke,It,rt){return h["kmac"+ae].update(nt,Ke,It,rt)[Xe]()}},se=function(ae,ye,Xe,nt){for(var Ke=0;Ke<E.length;++Ke){var It=E[Ke];ae[It]=ye(Xe,nt,It)}return ae},p=function(ae,ye){var Xe=H(ae,ye,"hex");return Xe.create=function(){return new C(ae,ye,ae)},Xe.update=function(nt){return Xe.create().update(nt)},se(Xe,H,ae,ye)},L=function(ae,ye){var Xe=re(ae,ye,"hex");return Xe.create=function(nt){return new C(ae,ye,nt)},Xe.update=function(nt,Ke){return Xe.create(Ke).update(nt)},se(Xe,re,ae,ye)},V=function(ae,ye){var Xe=Q[ae],nt=ee(ae,ye,"hex");return nt.create=function(Ke,It,rt){return!It&&!rt?h["shake"+ae].create(Ke):new C(ae,ye,Ke).bytepad([It,rt],Xe)},nt.update=function(Ke,It,rt,ut){return nt.create(It,rt,ut).update(Ke)},se(nt,ee,ae,ye)},K=function(ae,ye){var Xe=Q[ae],nt=T(ae,ye,"hex");return nt.create=function(Ke,It,rt){return new D(ae,ye,It).bytepad(["KMAC",rt],Xe).bytepad([Ke],Xe)},nt.update=function(Ke,It,rt,ut){return nt.create(Ke,rt,ut).update(It)},se(nt,T,ae,ye)},m=[{name:"keccak",padding:v,bits:M,createMethod:p},{name:"sha3",padding:ne,bits:M,createMethod:p},{name:"shake",padding:j,bits:U,createMethod:L},{name:"cshake",padding:te,bits:U,createMethod:V},{name:"kmac",padding:te,bits:U,createMethod:K}],h={},_=[],b=0;b<m.length;++b)for(var O=m[b],J=O.bits,ie=0;ie<J.length;++ie){var G=O.name+"_"+J[ie];if(_.push(G),h[G]=O.createMethod(J[ie],O.padding),O.name!=="sha3"){var I=O.name+J[ie];_.push(I),h[I]=h[G]}}function C(ae,ye,Xe){this.blocks=[],this.s=[],this.padding=ye,this.outputBits=Xe,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(ae<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Xe>>5,this.extraBytes=(Xe&31)>>3;for(var nt=0;nt<50;++nt)this.s[nt]=0}C.prototype.update=function(ae){if(this.finalized)throw new Error(A);var ye,Xe=typeof ae;if(Xe!=="string"){if(Xe==="object"){if(ae===null)throw new Error(i);if(N&&ae.constructor===ArrayBuffer)ae=new Uint8Array(ae);else if(!Array.isArray(ae)&&(!N||!ArrayBuffer.isView(ae)))throw new Error(i)}else throw new Error(i);ye=!0}for(var nt=this.blocks,Ke=this.byteCount,It=ae.length,rt=this.blockCount,ut=0,Rt=this.s,Ee,Pt;ut<It;){if(this.reset)for(this.reset=!1,nt[0]=this.block,Ee=1;Ee<rt+1;++Ee)nt[Ee]=0;if(ye)for(Ee=this.start;ut<It&&Ee<Ke;++ut)nt[Ee>>2]|=ae[ut]<<Z[Ee++&3];else for(Ee=this.start;ut<It&&Ee<Ke;++ut)Pt=ae.charCodeAt(ut),Pt<128?nt[Ee>>2]|=Pt<<Z[Ee++&3]:Pt<2048?(nt[Ee>>2]|=(192|Pt>>6)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt&63)<<Z[Ee++&3]):Pt<55296||Pt>=57344?(nt[Ee>>2]|=(224|Pt>>12)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt>>6&63)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt&63)<<Z[Ee++&3]):(Pt=65536+((Pt&1023)<<10|ae.charCodeAt(++ut)&1023),nt[Ee>>2]|=(240|Pt>>18)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt>>12&63)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt>>6&63)<<Z[Ee++&3],nt[Ee>>2]|=(128|Pt&63)<<Z[Ee++&3]);if(this.lastByteIndex=Ee,Ee>=Ke){for(this.start=Ee-Ke,this.block=nt[rt],Ee=0;Ee<rt;++Ee)Rt[Ee]^=nt[Ee];W(Rt),this.reset=!0}else this.start=Ee}return this},C.prototype.encode=function(ae,ye){var Xe=ae&255,nt=1,Ke=[Xe];for(ae=ae>>8,Xe=ae&255;Xe>0;)Ke.unshift(Xe),ae=ae>>8,Xe=ae&255,++nt;return ye?Ke.push(nt):Ke.unshift(nt),this.update(Ke),Ke.length},C.prototype.encodeString=function(ae){var ye,Xe=typeof ae;if(Xe!=="string"){if(Xe==="object"){if(ae===null)throw new Error(i);if(N&&ae.constructor===ArrayBuffer)ae=new Uint8Array(ae);else if(!Array.isArray(ae)&&(!N||!ArrayBuffer.isView(ae)))throw new Error(i)}else throw new Error(i);ye=!0}var nt=0,Ke=ae.length;if(ye)nt=Ke;else for(var It=0;It<ae.length;++It){var rt=ae.charCodeAt(It);rt<128?nt+=1:rt<2048?nt+=2:rt<55296||rt>=57344?nt+=3:(rt=65536+((rt&1023)<<10|ae.charCodeAt(++It)&1023),nt+=4)}return nt+=this.encode(nt*8),this.update(ae),nt},C.prototype.bytepad=function(ae,ye){for(var Xe=this.encode(ye),nt=0;nt<ae.length;++nt)Xe+=this.encodeString(ae[nt]);var Ke=ye-Xe%ye,It=[];return It.length=Ke,this.update(It),this},C.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var ae=this.blocks,ye=this.lastByteIndex,Xe=this.blockCount,nt=this.s;if(ae[ye>>2]|=this.padding[ye&3],this.lastByteIndex===this.byteCount)for(ae[0]=ae[Xe],ye=1;ye<Xe+1;++ye)ae[ye]=0;for(ae[Xe-1]|=2147483648,ye=0;ye<Xe;++ye)nt[ye]^=ae[ye];W(nt)}},C.prototype.toString=C.prototype.hex=function(){this.finalize();for(var ae=this.blockCount,ye=this.s,Xe=this.outputBlocks,nt=this.extraBytes,Ke=0,It=0,rt="",ut;It<Xe;){for(Ke=0;Ke<ae&&It<Xe;++Ke,++It)ut=ye[Ke],rt+=F[ut>>4&15]+F[ut&15]+F[ut>>12&15]+F[ut>>8&15]+F[ut>>20&15]+F[ut>>16&15]+F[ut>>28&15]+F[ut>>24&15];It%ae===0&&(W(ye),Ke=0)}return nt&&(ut=ye[Ke],rt+=F[ut>>4&15]+F[ut&15],nt>1&&(rt+=F[ut>>12&15]+F[ut>>8&15]),nt>2&&(rt+=F[ut>>20&15]+F[ut>>16&15])),rt},C.prototype.arrayBuffer=function(){this.finalize();var ae=this.blockCount,ye=this.s,Xe=this.outputBlocks,nt=this.extraBytes,Ke=0,It=0,rt=this.outputBits>>3,ut;nt?ut=new ArrayBuffer(Xe+1<<2):ut=new ArrayBuffer(rt);for(var Rt=new Uint32Array(ut);It<Xe;){for(Ke=0;Ke<ae&&It<Xe;++Ke,++It)Rt[It]=ye[Ke];It%ae===0&&W(ye)}return nt&&(Rt[Ke]=ye[Ke],ut=ut.slice(0,rt)),ut},C.prototype.buffer=C.prototype.arrayBuffer,C.prototype.digest=C.prototype.array=function(){this.finalize();for(var ae=this.blockCount,ye=this.s,Xe=this.outputBlocks,nt=this.extraBytes,Ke=0,It=0,rt=[],ut,Rt;It<Xe;){for(Ke=0;Ke<ae&&It<Xe;++Ke,++It)ut=It<<2,Rt=ye[Ke],rt[ut]=Rt&255,rt[ut+1]=Rt>>8&255,rt[ut+2]=Rt>>16&255,rt[ut+3]=Rt>>24&255;It%ae===0&&W(ye)}return nt&&(ut=It<<2,Rt=ye[Ke],rt[ut]=Rt&255,nt>1&&(rt[ut+1]=Rt>>8&255),nt>2&&(rt[ut+2]=Rt>>16&255)),rt};function D(ae,ye,Xe){C.call(this,ae,ye,Xe)}D.prototype=new C,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var W=function(ae){var ye,Xe,nt,Ke,It,rt,ut,Rt,Ee,Pt,_e,we,xe,Ye,X,ht,Ut,zt,Wt,yn,rn,un,fr,ir,Ln,Br,Zn,Jn,_r,Yn,kn,Y,fe,be,qt,ct,Ft,vr,$n,Hn,kr,sr,Wn,Xr,pr,Gn,Or,lt,Bt,Ot,We,Qt,fn,tn,Re,Vn,De,Je,je,st,Et,Mt,Vt;for(nt=0;nt<48;nt+=2)Ke=ae[0]^ae[10]^ae[20]^ae[30]^ae[40],It=ae[1]^ae[11]^ae[21]^ae[31]^ae[41],rt=ae[2]^ae[12]^ae[22]^ae[32]^ae[42],ut=ae[3]^ae[13]^ae[23]^ae[33]^ae[43],Rt=ae[4]^ae[14]^ae[24]^ae[34]^ae[44],Ee=ae[5]^ae[15]^ae[25]^ae[35]^ae[45],Pt=ae[6]^ae[16]^ae[26]^ae[36]^ae[46],_e=ae[7]^ae[17]^ae[27]^ae[37]^ae[47],we=ae[8]^ae[18]^ae[28]^ae[38]^ae[48],xe=ae[9]^ae[19]^ae[29]^ae[39]^ae[49],ye=we^(rt<<1|ut>>>31),Xe=xe^(ut<<1|rt>>>31),ae[0]^=ye,ae[1]^=Xe,ae[10]^=ye,ae[11]^=Xe,ae[20]^=ye,ae[21]^=Xe,ae[30]^=ye,ae[31]^=Xe,ae[40]^=ye,ae[41]^=Xe,ye=Ke^(Rt<<1|Ee>>>31),Xe=It^(Ee<<1|Rt>>>31),ae[2]^=ye,ae[3]^=Xe,ae[12]^=ye,ae[13]^=Xe,ae[22]^=ye,ae[23]^=Xe,ae[32]^=ye,ae[33]^=Xe,ae[42]^=ye,ae[43]^=Xe,ye=rt^(Pt<<1|_e>>>31),Xe=ut^(_e<<1|Pt>>>31),ae[4]^=ye,ae[5]^=Xe,ae[14]^=ye,ae[15]^=Xe,ae[24]^=ye,ae[25]^=Xe,ae[34]^=ye,ae[35]^=Xe,ae[44]^=ye,ae[45]^=Xe,ye=Rt^(we<<1|xe>>>31),Xe=Ee^(xe<<1|we>>>31),ae[6]^=ye,ae[7]^=Xe,ae[16]^=ye,ae[17]^=Xe,ae[26]^=ye,ae[27]^=Xe,ae[36]^=ye,ae[37]^=Xe,ae[46]^=ye,ae[47]^=Xe,ye=Pt^(Ke<<1|It>>>31),Xe=_e^(It<<1|Ke>>>31),ae[8]^=ye,ae[9]^=Xe,ae[18]^=ye,ae[19]^=Xe,ae[28]^=ye,ae[29]^=Xe,ae[38]^=ye,ae[39]^=Xe,ae[48]^=ye,ae[49]^=Xe,Ye=ae[0],X=ae[1],Gn=ae[11]<<4|ae[10]>>>28,Or=ae[10]<<4|ae[11]>>>28,Jn=ae[20]<<3|ae[21]>>>29,_r=ae[21]<<3|ae[20]>>>29,st=ae[31]<<9|ae[30]>>>23,Et=ae[30]<<9|ae[31]>>>23,sr=ae[40]<<18|ae[41]>>>14,Wn=ae[41]<<18|ae[40]>>>14,be=ae[2]<<1|ae[3]>>>31,qt=ae[3]<<1|ae[2]>>>31,ht=ae[13]<<12|ae[12]>>>20,Ut=ae[12]<<12|ae[13]>>>20,lt=ae[22]<<10|ae[23]>>>22,Bt=ae[23]<<10|ae[22]>>>22,Yn=ae[33]<<13|ae[32]>>>19,kn=ae[32]<<13|ae[33]>>>19,Mt=ae[42]<<2|ae[43]>>>30,Vt=ae[43]<<2|ae[42]>>>30,tn=ae[5]<<30|ae[4]>>>2,Re=ae[4]<<30|ae[5]>>>2,ct=ae[14]<<6|ae[15]>>>26,Ft=ae[15]<<6|ae[14]>>>26,zt=ae[25]<<11|ae[24]>>>21,Wt=ae[24]<<11|ae[25]>>>21,Ot=ae[34]<<15|ae[35]>>>17,We=ae[35]<<15|ae[34]>>>17,Y=ae[45]<<29|ae[44]>>>3,fe=ae[44]<<29|ae[45]>>>3,ir=ae[6]<<28|ae[7]>>>4,Ln=ae[7]<<28|ae[6]>>>4,Vn=ae[17]<<23|ae[16]>>>9,De=ae[16]<<23|ae[17]>>>9,vr=ae[26]<<25|ae[27]>>>7,$n=ae[27]<<25|ae[26]>>>7,yn=ae[36]<<21|ae[37]>>>11,rn=ae[37]<<21|ae[36]>>>11,Qt=ae[47]<<24|ae[46]>>>8,fn=ae[46]<<24|ae[47]>>>8,Xr=ae[8]<<27|ae[9]>>>5,pr=ae[9]<<27|ae[8]>>>5,Br=ae[18]<<20|ae[19]>>>12,Zn=ae[19]<<20|ae[18]>>>12,Je=ae[29]<<7|ae[28]>>>25,je=ae[28]<<7|ae[29]>>>25,Hn=ae[38]<<8|ae[39]>>>24,kr=ae[39]<<8|ae[38]>>>24,un=ae[48]<<14|ae[49]>>>18,fr=ae[49]<<14|ae[48]>>>18,ae[0]=Ye^~ht&zt,ae[1]=X^~Ut&Wt,ae[10]=ir^~Br&Jn,ae[11]=Ln^~Zn&_r,ae[20]=be^~ct&vr,ae[21]=qt^~Ft&$n,ae[30]=Xr^~Gn&lt,ae[31]=pr^~Or&Bt,ae[40]=tn^~Vn&Je,ae[41]=Re^~De&je,ae[2]=ht^~zt&yn,ae[3]=Ut^~Wt&rn,ae[12]=Br^~Jn&Yn,ae[13]=Zn^~_r&kn,ae[22]=ct^~vr&Hn,ae[23]=Ft^~$n&kr,ae[32]=Gn^~lt&Ot,ae[33]=Or^~Bt&We,ae[42]=Vn^~Je&st,ae[43]=De^~je&Et,ae[4]=zt^~yn&un,ae[5]=Wt^~rn&fr,ae[14]=Jn^~Yn&Y,ae[15]=_r^~kn&fe,ae[24]=vr^~Hn&sr,ae[25]=$n^~kr&Wn,ae[34]=lt^~Ot&Qt,ae[35]=Bt^~We&fn,ae[44]=Je^~st&Mt,ae[45]=je^~Et&Vt,ae[6]=yn^~un&Ye,ae[7]=rn^~fr&X,ae[16]=Yn^~Y&ir,ae[17]=kn^~fe&Ln,ae[26]=Hn^~sr&be,ae[27]=kr^~Wn&qt,ae[36]=Ot^~Qt&Xr,ae[37]=We^~fn&pr,ae[46]=st^~Mt&tn,ae[47]=Et^~Vt&Re,ae[8]=un^~Ye&ht,ae[9]=fr^~X&Ut,ae[18]=Y^~ir&Br,ae[19]=fe^~Ln&Zn,ae[28]=sr^~be&ct,ae[29]=Wn^~qt&Ft,ae[38]=Qt^~Xr&Gn,ae[39]=fn^~pr&Or,ae[48]=Mt^~tn&Vn,ae[49]=Vt^~Re&De,ae[0]^=R[nt],ae[1]^=R[nt+1]};if(w)e.exports=h;else for(b=0;b<_.length;++b)f[_[b]]=h[_[b]]})()})(A3n);var cPs=A3n.exports,uPs=Tti(cPs);function kqe(e){return"0x"+uPs.keccak_256(T3(e))}var fPs="rlp/5.7.0",lPs=new dd(fPs);function kti(e){let i=[];for(;e;)i.unshift(e&255),e>>=8;return i}function Yti(e){if(Array.isArray(e)){let c=[];if(e.forEach(function(l){c=c.concat(Yti(l))}),c.length<=55)return c.unshift(192+c.length),c;let f=kti(c.length);return f.unshift(247+f.length),f.concat(c)}z9s(e)||lPs.throwArgumentError("RLP object must be BytesLike","object",e);let i=Array.prototype.slice.call(T3(e));if(i.length===1&&i[0]<=127)return i;if(i.length<=55)return i.unshift(128+i.length),i;let A=kti(i.length);return A.unshift(183+A.length),A.concat(i)}function hPs(e){return Lm(Yti(e))}var gPs="address/5.7.0",twe=new dd(gPs);function Dti(e){kD(e,20)||twe.throwArgumentError("invalid address","address",e),e=e.toLowerCase();let i=e.substring(2).split(""),A=new Uint8Array(40);for(let f=0;f<40;f++)A[f]=i[f].charCodeAt(0);let c=T3(kqe(A));for(let f=0;f<40;f+=2)c[f>>1]>>4>=8&&(i[f]=i[f].toUpperCase()),(c[f>>1]&15)>=8&&(i[f+1]=i[f+1].toUpperCase());return"0x"+i.join("")}var pPs=9007199254740991;function yPs(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}var d3n={};for(let e=0;e<10;e++)d3n[String(e)]=String(e);for(let e=0;e<26;e++)d3n[String.fromCharCode(65+e)]=String(10+e);var Rti=Math.floor(yPs(pPs));function mPs(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let i=e.split("").map(c=>d3n[c]).join("");for(;i.length>=Rti;){let c=i.substring(0,Rti);i=parseInt(c,10)%97+i.substring(c.length)}let A=String(98-parseInt(i,10)%97);for(;A.length<2;)A="0"+A;return A}function mW(e){let i=null;if(typeof e!="string"&&twe.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))e.substring(0,2)!=="0x"&&(e="0x"+e),i=Dti(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&i!==e&&twe.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==mPs(e)&&twe.throwArgumentError("bad icap checksum","address",e),i=j9s(e.substring(4));i.length<40;)i="0"+i;i=Dti("0x"+i)}else twe.throwArgumentError("invalid address","address",e);return i}function IPs(e){let i=null;try{i=mW(e.from)}catch(c){twe.throwArgumentError("missing from address","transaction",e)}let A=W9s(T3(Vg.from(e.nonce).toHexString()));return mW(Fti(kqe(hPs([i,A])),12))}var JCn=class extends jF{constructor(i){super("address","address",i,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(i,A){try{A=mW(A)}catch(c){this._throwError(c.message,A)}return i.writeValue(A)}decode(i){return mW(Jti(i.readValue().toHexString(),20))}},HCn=class extends jF{constructor(i){super(i.name,i.type,void 0,i.dynamic),this.coder=i}defaultValue(){return this.coder.defaultValue()}encode(i,A){return this.coder.encode(i,A)}decode(i){return this.coder.decode(i)}},nwe=new dd(Rqe);function Vti(e,i,A){let c=null;if(Array.isArray(A))c=A;else if(A&&typeof A=="object"){let N={};c=i.map(F=>{let j=F.localName;return j||nwe.throwError("cannot encode object for signature with missing names",dd.errors.INVALID_ARGUMENT,{argument:"values",coder:F,value:A}),N[j]&&nwe.throwError("cannot encode object for signature with duplicate names",dd.errors.INVALID_ARGUMENT,{argument:"values",coder:F,value:A}),N[j]=!0,A[j]})}else nwe.throwArgumentError("invalid tuple value","tuple",A);i.length!==c.length&&nwe.throwArgumentError("types/value length mismatch","tuple",A);let f=new Qqe(e.wordSize),l=new Qqe(e.wordSize),g=[];i.forEach((N,F)=>{let j=c[F];if(N.dynamic){let te=l.length;N.encode(l,j);let v=f.writeUpdatableValue();g.push(ne=>{v(ne+te)})}else N.encode(f,j)}),g.forEach(N=>{N(f.length)});let w=e.appendWriter(f);return w+=e.appendWriter(l),w}function zti(e,i){let A=[],c=e.subReader(0);i.forEach(l=>{let g=null;if(l.dynamic){let w=e.readValue(),N=c.subReader(w.toNumber());try{g=l.decode(N)}catch(F){if(F.code===dd.errors.BUFFER_OVERRUN)throw F;g=F,g.baseType=l.name,g.name=l.localName,g.type=l.type}}else try{g=l.decode(e)}catch(w){if(w.code===dd.errors.BUFFER_OVERRUN)throw w;g=w,g.baseType=l.name,g.name=l.localName,g.type=l.type}g!=null&&A.push(g)});let f=i.reduce((l,g)=>{let w=g.localName;return w&&(l[w]||(l[w]=0),l[w]++),l},{});i.forEach((l,g)=>{let w=l.localName;if(!w||f[w]!==1||(w==="length"&&(w="_length"),A[w]!=null))return;let N=A[g];N instanceof Error?Object.defineProperty(A,w,{enumerable:!0,get:()=>{throw N}}):A[w]=N});for(let l=0;l<A.length;l++){let g=A[l];g instanceof Error&&Object.defineProperty(A,l,{enumerable:!0,get:()=>{throw g}})}return Object.freeze(A)}var LCn=class extends jF{constructor(i,A,c){let f=i.type+"["+(A>=0?A:"")+"]",l=A===-1||i.dynamic;super("array",f,c,l),this.coder=i,this.length=A}defaultValue(){let i=this.coder.defaultValue(),A=[];for(let c=0;c<this.length;c++)A.push(i);return A}encode(i,A){Array.isArray(A)||this._throwError("expected array value",A);let c=this.length;c===-1&&(c=A.length,i.writeValue(A.length)),nwe.checkArgumentCount(A.length,c,"coder array"+(this.localName?" "+this.localName:""));let f=[];for(let l=0;l<A.length;l++)f.push(this.coder);return Vti(i,f,A)}decode(i){let A=this.length;A===-1&&(A=i.readValue().toNumber(),A*32>i._data.length&&nwe.throwError("insufficient data length",dd.errors.BUFFER_OVERRUN,{length:i._data.length,count:A}));let c=[];for(let f=0;f<A;f++)c.push(new HCn(this.coder));return i.coerce(this.name,zti(i,c))}},GCn=class extends jF{constructor(i){super("bool","bool",i,!1)}defaultValue(){return!1}encode(i,A){return i.writeValue(A?1:0)}decode(i){return i.coerce(this.type,!i.readValue().isZero())}},L6t=class extends jF{constructor(i,A){super(i,i,A,!0)}defaultValue(){return"0x"}encode(i,A){A=T3(A);let c=i.writeValue(A.length);return c+=i.writeBytes(A),c}decode(i){return i.readBytes(i.readValue().toNumber(),!0)}},qCn=class extends L6t{constructor(i){super("bytes",i)}decode(i){return i.coerce(this.name,Lm(super.decode(i)))}},KCn=class extends jF{constructor(i,A){let c="bytes"+String(i);super(c,c,A,!1),this.size=i}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(i,A){let c=T3(A);return c.length!==this.size&&this._throwError("incorrect data length",A),i.writeBytes(c)}decode(i){return i.coerce(this.name,Lm(i.readBytes(this.size)))}},YCn=class extends jF{constructor(i){super("null","",i,!1)}defaultValue(){return null}encode(i,A){return A!=null&&this._throwError("not null",A),i.writeBytes([])}decode(i){return i.readBytes(0),i.coerce(this.name,null)}},CPs=Vg.from(-1),_Ps=Vg.from(0),EPs=Vg.from(1),BPs=Vg.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),VCn=class extends jF{constructor(i,A,c){let f=(A?"int":"uint")+i*8;super(f,f,c,!1),this.size=i,this.signed=A}defaultValue(){return 0}encode(i,A){let c=Vg.from(A),f=BPs.mask(i.wordSize*8);if(this.signed){let l=f.mask(this.size*8-1);(c.gt(l)||c.lt(l.add(EPs).mul(CPs)))&&this._throwError("value out-of-bounds",A)}else(c.lt(_Ps)||c.gt(f.mask(this.size*8)))&&this._throwError("value out-of-bounds",A);return c=c.toTwos(this.size*8).mask(this.size*8),this.signed&&(c=c.fromTwos(this.size*8).toTwos(8*i.wordSize)),i.writeValue(c)}decode(i){let A=i.readValue().mask(this.size*8);return this.signed&&(A=A.fromTwos(this.size*8)),i.coerce(this.name,A)}},vPs="strings/5.7.0",Wti=new dd(vPs),G6t;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(G6t||(G6t={}));var HR;(function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"})(HR||(HR={}));function bPs(e,i,A,c,f){return Wti.throwArgumentError(`invalid codepoint at offset ${i}; ${e}`,"bytes",A)}function Zti(e,i,A,c,f){if(e===HR.BAD_PREFIX||e===HR.UNEXPECTED_CONTINUE){let l=0;for(let g=i+1;g<A.length&&A[g]>>6===2;g++)l++;return l}return e===HR.OVERRUN?A.length-i-1:0}function SPs(e,i,A,c,f){return e===HR.OVERLONG?(c.push(f),0):(c.push(65533),Zti(e,i,A))}var wPs=Object.freeze({error:bPs,ignore:Zti,replace:SPs});function QPs(e,i){i==null&&(i=wPs.error),e=T3(e);let A=[],c=0;for(;c<e.length;){let f=e[c++];if(!(f>>7)){A.push(f);continue}let l=null,g=null;if((f&224)===192)l=1,g=127;else if((f&240)===224)l=2,g=2047;else if((f&248)===240)l=3,g=65535;else{(f&192)===128?c+=i(HR.UNEXPECTED_CONTINUE,c-1,e,A):c+=i(HR.BAD_PREFIX,c-1,e,A);continue}if(c-1+l>=e.length){c+=i(HR.OVERRUN,c-1,e,A);continue}let w=f&(1<<8-l-1)-1;for(let N=0;N<l;N++){let F=e[c];if((F&192)!=128){c+=i(HR.MISSING_CONTINUE,c,e,A),w=null;break}w=w<<6|F&63,c++}if(w!==null){if(w>1114111){c+=i(HR.OUT_OF_RANGE,c-1-l,e,A,w);continue}if(w>=55296&&w<=57343){c+=i(HR.UTF16_SURROGATE,c-1-l,e,A,w);continue}if(w<=g){c+=i(HR.OVERLONG,c-1-l,e,A,w);continue}A.push(w)}}return A}function Xti(e,i=G6t.current){i!=G6t.current&&(Wti.checkNormalize(),e=e.normalize(i));let A=[];for(let c=0;c<e.length;c++){let f=e.charCodeAt(c);if(f<128)A.push(f);else if(f<2048)A.push(f>>6|192),A.push(f&63|128);else if((f&64512)==55296){c++;let l=e.charCodeAt(c);if(c>=e.length||(l&64512)!==56320)throw new Error("invalid utf-8 string");let g=65536+((f&1023)<<10)+(l&1023);A.push(g>>18|240),A.push(g>>12&63|128),A.push(g>>6&63|128),A.push(g&63|128)}else A.push(f>>12|224),A.push(f>>6&63|128),A.push(f&63|128)}return T3(A)}function kPs(e){return e.map(i=>i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10&1023)+55296,(i&1023)+56320))).join("")}function DPs(e,i){return kPs(QPs(e,i))}var zCn=class extends L6t{constructor(i){super("string",i)}defaultValue(){return""}encode(i,A){return super.encode(i,Xti(A))}decode(i){return DPs(super.decode(i))}},rwe=class extends jF{constructor(i,A){let c=!1,f=[];i.forEach(g=>{g.dynamic&&(c=!0),f.push(g.type)});let l="tuple("+f.join(",")+")";super("tuple",l,A,c),this.coders=i}defaultValue(){let i=[];this.coders.forEach(c=>{i.push(c.defaultValue())});let A=this.coders.reduce((c,f)=>{let l=f.localName;return l&&(c[l]||(c[l]=0),c[l]++),c},{});return this.coders.forEach((c,f)=>{let l=c.localName;!l||A[l]!==1||(l==="length"&&(l="_length"),i[l]==null&&(i[l]=i[f]))}),Object.freeze(i)}encode(i,A){return Vti(i,this.coders,A)}decode(i){return i.coerce(this.name,zti(i,this.coders))}},x6t=new dd(Rqe),RPs=new RegExp(/^bytes([0-9]*)$/),PPs=new RegExp(/^(u?int)([0-9]*)$/),WCn=class{constructor(i){yd(this,"coerceFunc",i||null)}_getCoder(i){switch(i.baseType){case"address":return new JCn(i.name);case"bool":return new GCn(i.name);case"string":return new zCn(i.name);case"bytes":return new qCn(i.name);case"array":return new LCn(this._getCoder(i.arrayChildren),i.arrayLength,i.name);case"tuple":return new rwe((i.components||[]).map(c=>this._getCoder(c)),i.name);case"":return new YCn(i.name)}let A=i.type.match(PPs);if(A){let c=parseInt(A[2]||"256");return(c===0||c>256||c%8!==0)&&x6t.throwArgumentError("invalid "+A[1]+" bit length","param",i),new VCn(c/8,A[1]==="int",i.name)}if(A=i.type.match(RPs),A){let c=parseInt(A[1]);return(c===0||c>32)&&x6t.throwArgumentError("invalid bytes length","param",i),new KCn(c,i.name)}return x6t.throwArgumentError("invalid type","type",i.type)}_getWordSize(){return 32}_getReader(i,A){return new FCn(i,this._getWordSize(),this.coerceFunc,A)}_getWriter(){return new Qqe(this._getWordSize())}getDefaultValue(i){let A=i.map(f=>this._getCoder(eT.from(f)));return new rwe(A,"_").defaultValue()}encode(i,A){i.length!==A.length&&x6t.throwError("types/values length mismatch",dd.errors.INVALID_ARGUMENT,{count:{types:i.length,values:A.length},value:{types:i,values:A}});let c=i.map(g=>this._getCoder(eT.from(g))),f=new rwe(c,"_"),l=this._getWriter();return f.encode(l,A),l.data}decode(i,A,c){let f=i.map(g=>this._getCoder(eT.from(g)));return new rwe(f,"_").decode(this._getReader(T3(A),c))}},OPs=new WCn;function M6t(e){return kqe(Xti(e))}var Uy=new dd(Rqe),ZCn=class extends awe{},XCn=class extends awe{},$Cn=class extends awe{},Dqe=class extends awe{static isIndexed(i){return!!(i&&i._isIndexed)}},NPs={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Pti(e,i){let A=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return A.error=i,A}var q6t=class{constructor(i){let A=[];typeof i=="string"?A=JSON.parse(i):A=i,yd(this,"fragments",A.map(c=>swe.from(c)).filter(c=>c!=null)),yd(this,"_abiCoder",Cqe(new.target,"getAbiCoder")()),yd(this,"functions",{}),yd(this,"errors",{}),yd(this,"events",{}),yd(this,"structs",{}),this.fragments.forEach(c=>{let f=null;switch(c.type){case"constructor":if(this.deploy){Uy.warn("duplicate definition - constructor");return}yd(this,"deploy",c);return;case"function":f=this.functions;break;case"event":f=this.events;break;case"error":f=this.errors;break;default:return}let l=c.format();if(f[l]){Uy.warn("duplicate definition - "+l);return}f[l]=c}),this.deploy||yd(this,"deploy",Awe.from({payable:!1,type:"constructor"})),yd(this,"_isInterface",!0)}format(i){i||(i=Nh.full),i===Nh.sighash&&Uy.throwArgumentError("interface does not support formatting sighash","format",i);let A=this.fragments.map(c=>c.format(i));return i===Nh.json?JSON.stringify(A.map(c=>JSON.parse(c))):A}static getAbiCoder(){return OPs}static getAddress(i){return mW(i)}static getSighash(i){return Fti(M6t(i.format()),0,4)}static getEventTopic(i){return M6t(i.format())}getFunction(i){if(kD(i)){for(let c in this.functions)if(i===this.getSighash(c))return this.functions[c];Uy.throwArgumentError("no matching function","sighash",i)}if(i.indexOf("(")===-1){let c=i.trim(),f=Object.keys(this.functions).filter(l=>l.split("(")[0]===c);return f.length===0?Uy.throwArgumentError("no matching function","name",c):f.length>1&&Uy.throwArgumentError("multiple matching functions","name",c),this.functions[f[0]]}let A=this.functions[dwe.fromString(i).format()];return A||Uy.throwArgumentError("no matching function","signature",i),A}getEvent(i){if(kD(i)){let c=i.toLowerCase();for(let f in this.events)if(c===this.getEventTopic(f))return this.events[f];Uy.throwArgumentError("no matching event","topichash",c)}if(i.indexOf("(")===-1){let c=i.trim(),f=Object.keys(this.events).filter(l=>l.split("(")[0]===c);return f.length===0?Uy.throwArgumentError("no matching event","name",c):f.length>1&&Uy.throwArgumentError("multiple matching events","name",c),this.events[f[0]]}let A=this.events[bqe.fromString(i).format()];return A||Uy.throwArgumentError("no matching event","signature",i),A}getError(i){if(kD(i)){let c=Cqe(this.constructor,"getSighash");for(let f in this.errors){let l=this.errors[f];if(i===c(l))return this.errors[f]}Uy.throwArgumentError("no matching error","sighash",i)}if(i.indexOf("(")===-1){let c=i.trim(),f=Object.keys(this.errors).filter(l=>l.split("(")[0]===c);return f.length===0?Uy.throwArgumentError("no matching error","name",c):f.length>1&&Uy.throwArgumentError("multiple matching errors","name",c),this.errors[f[0]]}let A=this.errors[dwe.fromString(i).format()];return A||Uy.throwArgumentError("no matching error","signature",i),A}getSighash(i){if(typeof i=="string")try{i=this.getFunction(i)}catch(A){try{i=this.getError(i)}catch(c){throw A}}return Cqe(this.constructor,"getSighash")(i)}getEventTopic(i){return typeof i=="string"&&(i=this.getEvent(i)),Cqe(this.constructor,"getEventTopic")(i)}_decodeParams(i,A){return this._abiCoder.decode(i,A)}_encodeParams(i,A){return this._abiCoder.encode(i,A)}encodeDeploy(i){return this._encodeParams(this.deploy.inputs,i||[])}decodeErrorResult(i,A){typeof i=="string"&&(i=this.getError(i));let c=T3(A);return Lm(c.slice(0,4))!==this.getSighash(i)&&Uy.throwArgumentError(`data signature does not match error ${i.name}.`,"data",Lm(c)),this._decodeParams(i.inputs,c.slice(4))}encodeErrorResult(i,A){return typeof i=="string"&&(i=this.getError(i)),Lm(iwe([this.getSighash(i),this._encodeParams(i.inputs,A||[])]))}decodeFunctionData(i,A){typeof i=="string"&&(i=this.getFunction(i));let c=T3(A);return Lm(c.slice(0,4))!==this.getSighash(i)&&Uy.throwArgumentError(`data signature does not match function ${i.name}.`,"data",Lm(c)),this._decodeParams(i.inputs,c.slice(4))}encodeFunctionData(i,A){return typeof i=="string"&&(i=this.getFunction(i)),Lm(iwe([this.getSighash(i),this._encodeParams(i.inputs,A||[])]))}decodeFunctionResult(i,A){typeof i=="string"&&(i=this.getFunction(i));let c=T3(A),f=null,l="",g=null,w=null,N=null;switch(c.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(i.outputs,c)}catch(F){}break;case 4:{let F=Lm(c.slice(0,4)),j=NPs[F];if(j)g=this._abiCoder.decode(j.inputs,c.slice(4)),w=j.name,N=j.signature,j.reason&&(f=g[0]),w==="Error"?l=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(g[0])}`:w==="Panic"&&(l=`; VM Exception while processing transaction: reverted with panic code ${g[0]}`);else try{let te=this.getError(F);g=this._abiCoder.decode(te.inputs,c.slice(4)),w=te.name,N=te.format()}catch(te){}break}}return Uy.throwError("call revert exception"+l,dd.errors.CALL_EXCEPTION,{method:i.format(),data:Lm(A),errorArgs:g,errorName:w,errorSignature:N,reason:f})}encodeFunctionResult(i,A){return typeof i=="string"&&(i=this.getFunction(i)),Lm(this._abiCoder.encode(i.outputs,A||[]))}encodeFilterTopics(i,A){typeof i=="string"&&(i=this.getEvent(i)),A.length>i.inputs.length&&Uy.throwError("too many arguments for "+i.format(),dd.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:A});let c=[];i.anonymous||c.push(this.getEventTopic(i));let f=(l,g)=>l.type==="string"?M6t(g):l.type==="bytes"?kqe(Lm(g)):(l.type==="bool"&&typeof g=="boolean"&&(g=g?"0x01":"0x00"),l.type.match(/^u?int/)&&(g=Vg.from(g).toHexString()),l.type==="address"&&this._abiCoder.encode(["address"],[g]),Jti(Lm(g),32));for(A.forEach((l,g)=>{let w=i.inputs[g];if(!w.indexed){l!=null&&Uy.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+w.name,l);return}l==null?c.push(null):w.baseType==="array"||w.baseType==="tuple"?Uy.throwArgumentError("filtering with tuples or arrays not supported","contract."+w.name,l):Array.isArray(l)?c.push(l.map(N=>f(w,N))):c.push(f(w,l))});c.length&&c[c.length-1]===null;)c.pop();return c}encodeEventLog(i,A){typeof i=="string"&&(i=this.getEvent(i));let c=[],f=[],l=[];return i.anonymous||c.push(this.getEventTopic(i)),A.length!==i.inputs.length&&Uy.throwArgumentError("event arguments/values mismatch","values",A),i.inputs.forEach((g,w)=>{let N=A[w];if(g.indexed)if(g.type==="string")c.push(M6t(N));else if(g.type==="bytes")c.push(kqe(N));else{if(g.baseType==="tuple"||g.baseType==="array")throw new Error("not implemented");c.push(this._abiCoder.encode([g.type],[N]))}else f.push(g),l.push(N)}),{data:this._abiCoder.encode(f,l),topics:c}}decodeEventLog(i,A,c){if(typeof i=="string"&&(i=this.getEvent(i)),c!=null&&!i.anonymous){let v=this.getEventTopic(i);(!kD(c[0],32)||c[0].toLowerCase()!==v)&&Uy.throwError("fragment/topic mismatch",dd.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:v,value:c[0]}),c=c.slice(1)}let f=[],l=[],g=[];i.inputs.forEach((v,ne)=>{v.indexed?v.type==="string"||v.type==="bytes"||v.baseType==="tuple"||v.baseType==="array"?(f.push(eT.fromObject({type:"bytes32",name:v.name})),g.push(!0)):(f.push(v),g.push(!1)):(l.push(v),g.push(!1))});let w=c!=null?this._abiCoder.decode(f,iwe(c)):null,N=this._abiCoder.decode(l,A,!0),F=[],j=0,te=0;i.inputs.forEach((v,ne)=>{if(v.indexed)if(w==null)F[ne]=new Dqe({_isIndexed:!0,hash:null});else if(g[ne])F[ne]=new Dqe({_isIndexed:!0,hash:w[te++]});else try{F[ne]=w[te++]}catch(Z){F[ne]=Z}else try{F[ne]=N[j++]}catch(Z){F[ne]=Z}if(v.name&&F[v.name]==null){let Z=F[ne];Z instanceof Error?Object.defineProperty(F,v.name,{enumerable:!0,get:()=>{throw Pti(`property ${JSON.stringify(v.name)}`,Z)}}):F[v.name]=Z}});for(let v=0;v<F.length;v++){let ne=F[v];ne instanceof Error&&Object.defineProperty(F,v,{enumerable:!0,get:()=>{throw Pti(`index ${v}`,ne)}})}return Object.freeze(F)}parseTransaction(i){let A=this.getFunction(i.data.substring(0,10).toLowerCase());return A?new XCn({args:this._abiCoder.decode(A.inputs,"0x"+i.data.substring(10)),functionFragment:A,name:A.name,signature:A.format(),sighash:this.getSighash(A),value:Vg.from(i.value||"0")}):null}parseLog(i){let A=this.getEvent(i.topics[0]);return!A||A.anonymous?null:new ZCn({eventFragment:A,name:A.name,signature:A.format(),topic:this.getEventTopic(A),args:this.decodeEventLog(A,i.data,i.topics)})}parseError(i){let A=Lm(i),c=this.getError(A.substring(0,10).toLowerCase());return c?new $Cn({args:this._abiCoder.decode(c.inputs,"0x"+A.substring(10)),errorFragment:c,name:c.name,signature:c.format(),sighash:this.getSighash(c)}):null}static isInterface(i){return!!(i&&i._isInterface)}},xPs="abstract-provider/5.7.0",MPs=function(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})},TPs=new dd(xPs),jCn=class e{constructor(){TPs.checkAbstract(new.target,e),yd(this,"_isProvider",!0)}getFeeData(){return MPs(this,void 0,void 0,function*(){let{block:i,gasPrice:A}=yield moe({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(g=>null)}),c=null,f=null,l=null;return i&&i.baseFeePerGas&&(c=i.baseFeePerGas,l=Vg.from("1500000000"),f=i.baseFeePerGas.mul(2).add(l)),{lastBaseFeePerGas:c,maxFeePerGas:f,maxPriorityFeePerGas:l,gasPrice:A}})}addListener(i,A){return this.on(i,A)}removeListener(i,A){return this.off(i,A)}static isProvider(i){return!!(i&&i._isProvider)}},UPs="abstract-signer/5.7.0",XF=function(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})},jM=new dd(UPs),FPs=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],JPs=[dd.errors.INSUFFICIENT_FUNDS,dd.errors.NONCE_EXPIRED,dd.errors.REPLACEMENT_UNDERPRICED],K6t=class e{constructor(){jM.checkAbstract(new.target,e),yd(this,"_isSigner",!0)}getBalance(i){return XF(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),i)})}getTransactionCount(i){return XF(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),i)})}estimateGas(i){return XF(this,void 0,void 0,function*(){this._checkProvider("estimateGas");let A=yield moe(this.checkTransaction(i));return yield this.provider.estimateGas(A)})}call(i,A){return XF(this,void 0,void 0,function*(){this._checkProvider("call");let c=yield moe(this.checkTransaction(i));return yield this.provider.call(c,A)})}sendTransaction(i){return XF(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");let A=yield this.populateTransaction(i),c=yield this.signTransaction(A);return yield this.provider.sendTransaction(c)})}getChainId(){return XF(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return XF(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return XF(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(i){return XF(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(i)})}checkTransaction(i){for(let c in i)FPs.indexOf(c)===-1&&jM.throwArgumentError("invalid transaction key: "+c,"transaction",i);let A=owe(i);return A.from==null?A.from=this.getAddress():A.from=Promise.all([Promise.resolve(A.from),this.getAddress()]).then(c=>(c[0].toLowerCase()!==c[1].toLowerCase()&&jM.throwArgumentError("from address mismatch","transaction",i),c[0])),A}populateTransaction(i){return XF(this,void 0,void 0,function*(){let A=yield moe(this.checkTransaction(i));A.to!=null&&(A.to=Promise.resolve(A.to).then(f=>XF(this,void 0,void 0,function*(){if(f==null)return null;let l=yield this.resolveName(f);return l==null&&jM.throwArgumentError("provided ENS name resolves to null","tx.to",f),l})),A.to.catch(f=>{}));let c=A.maxFeePerGas!=null||A.maxPriorityFeePerGas!=null;if(A.gasPrice!=null&&(A.type===2||c)?jM.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",i):(A.type===0||A.type===1)&&c&&jM.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",i),(A.type===2||A.type==null)&&A.maxFeePerGas!=null&&A.maxPriorityFeePerGas!=null)A.type=2;else if(A.type===0||A.type===1)A.gasPrice==null&&(A.gasPrice=this.getGasPrice());else{let f=yield this.getFeeData();if(A.type==null)if(f.maxFeePerGas!=null&&f.maxPriorityFeePerGas!=null)if(A.type=2,A.gasPrice!=null){let l=A.gasPrice;delete A.gasPrice,A.maxFeePerGas=l,A.maxPriorityFeePerGas=l}else A.maxFeePerGas==null&&(A.maxFeePerGas=f.maxFeePerGas),A.maxPriorityFeePerGas==null&&(A.maxPriorityFeePerGas=f.maxPriorityFeePerGas);else f.gasPrice!=null?(c&&jM.throwError("network does not support EIP-1559",dd.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),A.gasPrice==null&&(A.gasPrice=f.gasPrice),A.type=0):jM.throwError("failed to get consistent fee data",dd.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else A.type===2&&(A.maxFeePerGas==null&&(A.maxFeePerGas=f.maxFeePerGas),A.maxPriorityFeePerGas==null&&(A.maxPriorityFeePerGas=f.maxPriorityFeePerGas))}return A.nonce==null&&(A.nonce=this.getTransactionCount("pending")),A.gasLimit==null&&(A.gasLimit=this.estimateGas(A).catch(f=>{if(JPs.indexOf(f.code)>=0)throw f;return jM.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",dd.errors.UNPREDICTABLE_GAS_LIMIT,{error:f,tx:A})})),A.chainId==null?A.chainId=this.getChainId():A.chainId=Promise.all([Promise.resolve(A.chainId),this.getChainId()]).then(f=>(f[1]!==0&&f[0]!==f[1]&&jM.throwArgumentError("chainId address mismatch","transaction",i),f[0])),yield moe(A)})}_checkProvider(i){this.provider||jM.throwError("missing provider",dd.errors.UNSUPPORTED_OPERATION,{operation:i||"_checkProvider"})}static isSigner(i){return!!(i&&i._isSigner)}},e3n=class e extends K6t{constructor(i,A){super(),yd(this,"address",i),yd(this,"provider",A||null)}getAddress(){return Promise.resolve(this.address)}_fail(i,A){return Promise.resolve().then(()=>{jM.throwError(i,dd.errors.UNSUPPORTED_OPERATION,{operation:A})})}signMessage(i){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(i){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(i,A,c){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(i){return new e(this.address,i)}},HPs="transactions/5.7.0",$ti=new dd(HPs),Oti;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(Oti||(Oti={}));function MCn(e,i){return{address:mW(e),storageKeys:(i||[]).map((A,c)=>(Z9s(A)!==32&&$ti.throwArgumentError("invalid access list storageKey",`accessList[${e}:${c}]`,A),A.toLowerCase()))}}function LPs(e){if(Array.isArray(e))return e.map((A,c)=>Array.isArray(A)?(A.length>2&&$ti.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${c}]`,A),MCn(A[0],A[1])):MCn(A.address,A.storageKeys));let i=Object.keys(e).map(A=>{let c=e[A].reduce((f,l)=>(f[l]=!0,f),{});return MCn(A,Object.keys(c).sort())});return i.sort((A,c)=>A.address.localeCompare(c.address)),i}var GPs="contracts/5.7.0",ile=function(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})},Gm=new dd(GPs);function Y6t(e,i){return ile(this,void 0,void 0,function*(){let A=yield i;typeof A!="string"&&Gm.throwArgumentError("invalid address or ENS name","name",A);try{return mW(A)}catch(f){}e||Gm.throwError("a provider or signer is needed to resolve ENS names",dd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});let c=yield e.resolveName(A);return c==null&&Gm.throwArgumentError("resolver or addr is not configured for ENS name","name",A),c})}function F6t(e,i,A){return ile(this,void 0,void 0,function*(){return Array.isArray(A)?yield Promise.all(A.map((c,f)=>F6t(e,Array.isArray(i)?i[f]:i[c.name],c))):A.type==="address"?yield Y6t(e,i):A.type==="tuple"?yield F6t(e,i,A.components):A.baseType==="array"?Array.isArray(i)?yield Promise.all(i.map(c=>F6t(e,c,A.arrayChildren))):Promise.reject(Gm.makeError("invalid value for array",dd.errors.INVALID_ARGUMENT,{argument:"value",value:i})):i})}function X6t(e,i,A){return ile(this,void 0,void 0,function*(){let c={};A.length===i.inputs.length+1&&typeof A[A.length-1]=="object"&&(c=owe(A.pop())),Gm.checkArgumentCount(A.length,i.inputs.length,"passed to contract"),e.signer?c.from?c.from=moe({override:Y6t(e.signer,c.from),signer:e.signer.getAddress()}).then(F=>ile(this,void 0,void 0,function*(){return mW(F.signer)!==F.override&&Gm.throwError("Contract with a Signer cannot override from",dd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),F.override})):c.from=e.signer.getAddress():c.from&&(c.from=Y6t(e.provider,c.from));let f=yield moe({args:F6t(e.signer||e.provider,A,i.inputs),address:e.resolvedAddress,overrides:moe(c)||{}}),l=e.interface.encodeFunctionData(i,f.args),g={data:l,to:f.address},w=f.overrides;if(w.nonce!=null&&(g.nonce=Vg.from(w.nonce).toNumber()),w.gasLimit!=null&&(g.gasLimit=Vg.from(w.gasLimit)),w.gasPrice!=null&&(g.gasPrice=Vg.from(w.gasPrice)),w.maxFeePerGas!=null&&(g.maxFeePerGas=Vg.from(w.maxFeePerGas)),w.maxPriorityFeePerGas!=null&&(g.maxPriorityFeePerGas=Vg.from(w.maxPriorityFeePerGas)),w.from!=null&&(g.from=w.from),w.type!=null&&(g.type=w.type),w.accessList!=null&&(g.accessList=LPs(w.accessList)),g.gasLimit==null&&i.gas!=null){let F=21e3,j=T3(l);for(let te=0;te<j.length;te++)F+=4,j[te]&&(F+=64);g.gasLimit=Vg.from(i.gas).add(F)}if(w.value){let F=Vg.from(w.value);!F.isZero()&&!i.payable&&Gm.throwError("non-payable method cannot override value",dd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:c.value}),g.value=F}w.customData&&(g.customData=owe(w.customData)),w.ccipReadEnabled&&(g.ccipReadEnabled=!!w.ccipReadEnabled),delete c.nonce,delete c.gasLimit,delete c.gasPrice,delete c.from,delete c.value,delete c.type,delete c.accessList,delete c.maxFeePerGas,delete c.maxPriorityFeePerGas,delete c.customData,delete c.ccipReadEnabled;let N=Object.keys(c).filter(F=>c[F]!=null);return N.length&&Gm.throwError(`cannot override ${N.map(F=>JSON.stringify(F)).join(",")}`,dd.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:N}),g})}function qPs(e,i){return function(...A){return X6t(e,i,A)}}function KPs(e,i){let A=e.signer||e.provider;return function(...c){return ile(this,void 0,void 0,function*(){A||Gm.throwError("estimate require a provider or signer",dd.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});let f=yield X6t(e,i,c);return yield A.estimateGas(f)})}}function YPs(e,i){let A=i.wait.bind(i);i.wait=c=>A(c).then(f=>(f.events=f.logs.map(l=>{let g=Bqe(l),w=null;try{w=e.interface.parseLog(l)}catch(N){}return w&&(g.args=w.args,g.decode=(N,F)=>e.interface.decodeEventLog(w.eventFragment,N,F),g.event=w.name,g.eventSignature=w.signature),g.removeListener=()=>e.provider,g.getBlock=()=>e.provider.getBlock(f.blockHash),g.getTransaction=()=>e.provider.getTransaction(f.transactionHash),g.getTransactionReceipt=()=>Promise.resolve(f),g}),f))}function jti(e,i,A){let c=e.signer||e.provider;return function(...f){return ile(this,void 0,void 0,function*(){let l;if(f.length===i.inputs.length+1&&typeof f[f.length-1]=="object"){let N=owe(f.pop());N.blockTag!=null&&(l=yield N.blockTag),delete N.blockTag,f.push(N)}e.deployTransaction!=null&&(yield e._deployed(l));let g=yield X6t(e,i,f),w=yield c.call(g,l);try{let N=e.interface.decodeFunctionResult(i,w);return A&&i.outputs.length===1&&(N=N[0]),N}catch(N){throw N.code===dd.errors.CALL_EXCEPTION&&(N.address=e.address,N.args=f,N.transaction=g),N}})}}function VPs(e,i){return function(...A){return ile(this,void 0,void 0,function*(){e.signer||Gm.throwError("sending a transaction requires a signer",dd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),e.deployTransaction!=null&&(yield e._deployed());let c=yield X6t(e,i,A),f=yield e.signer.sendTransaction(c);return YPs(e,f),f})}}function Nti(e,i,A){return i.constant?jti(e,i,A):VPs(e,i)}function eni(e){return e.address&&(e.topics==null||e.topics.length===0)?"*":(e.address||"*")+"@"+(e.topics?e.topics.map(i=>Array.isArray(i)?i.join("|"):i).join(":"):"")}var ole=class{constructor(i,A){yd(this,"tag",i),yd(this,"filter",A),this._listeners=[]}addListener(i,A){this._listeners.push({listener:i,once:A})}removeListener(i){let A=!1;this._listeners=this._listeners.filter(c=>A||c.listener!==i?!0:(A=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(i=>i.listener)}listenerCount(){return this._listeners.length}run(i){let A=this.listenerCount();return this._listeners=this._listeners.filter(c=>{let f=i.slice();return setTimeout(()=>{c.listener.apply(this,f)},0),!c.once}),A}prepareEvent(i){}getEmit(i){return[i]}},t3n=class extends ole{constructor(){super("error",null)}},V6t=class extends ole{constructor(i,A,c,f){let l={address:i},g=A.getEventTopic(c);f?(g!==f[0]&&Gm.throwArgumentError("topic mismatch","topics",f),l.topics=f.slice()):l.topics=[g],super(eni(l),l),yd(this,"address",i),yd(this,"interface",A),yd(this,"fragment",c)}prepareEvent(i){super.prepareEvent(i),i.event=this.fragment.name,i.eventSignature=this.fragment.format(),i.decode=(A,c)=>this.interface.decodeEventLog(this.fragment,A,c);try{i.args=this.interface.decodeEventLog(this.fragment,i.data,i.topics)}catch(A){i.args=null,i.decodeError=A}}getEmit(i){let A=dPs(i.args);if(A.length)throw A[0].error;let c=(i.args||[]).slice();return c.push(i),c}},z6t=class extends ole{constructor(i,A){super("*",{address:i}),yd(this,"address",i),yd(this,"interface",A)}prepareEvent(i){super.prepareEvent(i);try{let A=this.interface.parseLog(i);i.event=A.name,i.eventSignature=A.signature,i.decode=(c,f)=>this.interface.decodeEventLog(A.eventFragment,c,f),i.args=A.args}catch(A){}}},n3n=class{constructor(i,A,c){yd(this,"interface",Cqe(new.target,"getInterface")(A)),c==null?(yd(this,"provider",null),yd(this,"signer",null)):K6t.isSigner(c)?(yd(this,"provider",c.provider||null),yd(this,"signer",c)):jCn.isProvider(c)?(yd(this,"provider",c),yd(this,"signer",null)):Gm.throwArgumentError("invalid signer or provider","signerOrProvider",c),yd(this,"callStatic",{}),yd(this,"estimateGas",{}),yd(this,"functions",{}),yd(this,"populateTransaction",{}),yd(this,"filters",{});{let g={};Object.keys(this.interface.events).forEach(w=>{let N=this.interface.events[w];yd(this.filters,w,(...F)=>({address:this.address,topics:this.interface.encodeFilterTopics(N,F)})),g[N.name]||(g[N.name]=[]),g[N.name].push(w)}),Object.keys(g).forEach(w=>{let N=g[w];N.length===1?yd(this.filters,w,this.filters[N[0]]):Gm.warn(`Duplicate definition of ${w} (${N.join(", ")})`)})}if(yd(this,"_runningEvents",{}),yd(this,"_wrappedEmits",{}),i==null&&Gm.throwArgumentError("invalid contract address or ENS name","addressOrName",i),yd(this,"address",i),this.provider)yd(this,"resolvedAddress",Y6t(this.provider,i));else try{yd(this,"resolvedAddress",Promise.resolve(mW(i)))}catch(g){Gm.throwError("provider is required to use ENS name as contract address",dd.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(g=>{});let f={},l={};Object.keys(this.interface.functions).forEach(g=>{let w=this.interface.functions[g];if(l[g]){Gm.warn(`Duplicate ABI entry for ${JSON.stringify(g)}`);return}l[g]=!0;{let N=w.name;f[`%${N}`]||(f[`%${N}`]=[]),f[`%${N}`].push(g)}this[g]==null&&yd(this,g,Nti(this,w,!0)),this.functions[g]==null&&yd(this.functions,g,Nti(this,w,!1)),this.callStatic[g]==null&&yd(this.callStatic,g,jti(this,w,!0)),this.populateTransaction[g]==null&&yd(this.populateTransaction,g,qPs(this,w)),this.estimateGas[g]==null&&yd(this.estimateGas,g,KPs(this,w))}),Object.keys(f).forEach(g=>{let w=f[g];if(w.length>1)return;g=g.substring(1);let N=w[0];try{this[g]==null&&yd(this,g,this[N])}catch(F){}this.functions[g]==null&&yd(this.functions,g,this.functions[N]),this.callStatic[g]==null&&yd(this.callStatic,g,this.callStatic[N]),this.populateTransaction[g]==null&&yd(this.populateTransaction,g,this.populateTransaction[N]),this.estimateGas[g]==null&&yd(this.estimateGas,g,this.estimateGas[N])})}static getContractAddress(i){return IPs(i)}static getInterface(i){return q6t.isInterface(i)?i:new q6t(i)}deployed(){return this._deployed()}_deployed(i){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,i).then(A=>(A==="0x"&&Gm.throwError("contract not deployed",dd.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(i){this.signer||Gm.throwError("sending a transactions require a signer",dd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});let A=owe(i||{});return["from","to"].forEach(function(c){A[c]!=null&&Gm.throwError("cannot override "+c,dd.errors.UNSUPPORTED_OPERATION,{operation:c})}),A.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(A))}connect(i){typeof i=="string"&&(i=new e3n(i,this.provider));let A=new this.constructor(this.address,this.interface,i);return this.deployTransaction&&yd(A,"deployTransaction",this.deployTransaction),A}attach(i){return new this.constructor(i,this.interface,this.signer||this.provider)}static isIndexed(i){return Dqe.isIndexed(i)}_normalizeRunningEvent(i){return this._runningEvents[i.tag]?this._runningEvents[i.tag]:i}_getRunningEvent(i){if(typeof i=="string"){if(i==="error")return this._normalizeRunningEvent(new t3n);if(i==="event")return this._normalizeRunningEvent(new ole("event",null));if(i==="*")return this._normalizeRunningEvent(new z6t(this.address,this.interface));let A=this.interface.getEvent(i);return this._normalizeRunningEvent(new V6t(this.address,this.interface,A))}if(i.topics&&i.topics.length>0){try{let c=i.topics[0];if(typeof c!="string")throw new Error("invalid topic");let f=this.interface.getEvent(c);return this._normalizeRunningEvent(new V6t(this.address,this.interface,f,i.topics))}catch(c){}let A={address:this.address,topics:i.topics};return this._normalizeRunningEvent(new ole(eni(A),A))}return this._normalizeRunningEvent(new z6t(this.address,this.interface))}_checkRunningEvents(i){if(i.listenerCount()===0){delete this._runningEvents[i.tag];let A=this._wrappedEmits[i.tag];A&&i.filter&&(this.provider.off(i.filter,A),delete this._wrappedEmits[i.tag])}}_wrapEvent(i,A,c){let f=Bqe(A);return f.removeListener=()=>{c&&(i.removeListener(c),this._checkRunningEvents(i))},f.getBlock=()=>this.provider.getBlock(A.blockHash),f.getTransaction=()=>this.provider.getTransaction(A.transactionHash),f.getTransactionReceipt=()=>this.provider.getTransactionReceipt(A.transactionHash),i.prepareEvent(f),f}_addEventListener(i,A,c){if(this.provider||Gm.throwError("events require a provider or a signer with a provider",dd.errors.UNSUPPORTED_OPERATION,{operation:"once"}),i.addListener(A,c),this._runningEvents[i.tag]=i,!this._wrappedEmits[i.tag]){let f=l=>{let g=this._wrapEvent(i,l,A);if(g.decodeError==null)try{let w=i.getEmit(g);this.emit(i.filter,...w)}catch(w){g.decodeError=w.error}i.filter!=null&&this.emit("event",g),g.decodeError!=null&&this.emit("error",g.decodeError,g)};this._wrappedEmits[i.tag]=f,i.filter!=null&&this.provider.on(i.filter,f)}}queryFilter(i,A,c){let f=this._getRunningEvent(i),l=owe(f.filter);return typeof A=="string"&&kD(A,32)?(c!=null&&Gm.throwArgumentError("cannot specify toBlock with blockhash","toBlock",c),l.blockHash=A):(l.fromBlock=A!=null?A:0,l.toBlock=c!=null?c:"latest"),this.provider.getLogs(l).then(g=>g.map(w=>this._wrapEvent(f,w,null)))}on(i,A){return this._addEventListener(this._getRunningEvent(i),A,!1),this}once(i,A){return this._addEventListener(this._getRunningEvent(i),A,!0),this}emit(i,...A){if(!this.provider)return!1;let c=this._getRunningEvent(i),f=c.run(A)>0;return this._checkRunningEvents(c),f}listenerCount(i){return this.provider?i==null?Object.keys(this._runningEvents).reduce((A,c)=>A+this._runningEvents[c].listenerCount(),0):this._getRunningEvent(i).listenerCount():0}listeners(i){if(!this.provider)return[];if(i==null){let A=[];for(let c in this._runningEvents)this._runningEvents[c].listeners().forEach(f=>{A.push(f)});return A}return this._getRunningEvent(i).listeners()}removeAllListeners(i){if(!this.provider)return this;if(i==null){for(let c in this._runningEvents){let f=this._runningEvents[c];f.removeAllListeners(),this._checkRunningEvents(f)}return this}let A=this._getRunningEvent(i);return A.removeAllListeners(),this._checkRunningEvents(A),this}off(i,A){if(!this.provider)return this;let c=this._getRunningEvent(i);return c.removeListener(A),this._checkRunningEvents(c),this}removeListener(i,A){return this.off(i,A)}},r3n=class extends n3n{},zPs="ethers/5.7.2";new dd(zPs);function WPs(e,i,A,c){function f(l){return l instanceof A?l:new A(function(g){g(l)})}return new(A||(A=Promise))(function(l,g){function w(j){try{F(c.next(j))}catch(te){g(te)}}function N(j){try{F(c.throw(j))}catch(te){g(te)}}function F(j){j.done?l(j.value):f(j.value).then(w,N)}F((c=c.apply(e,i||[])).next())})}var ZPs=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"success",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"success",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"success",type:"bool"}],stateMutability:"nonpayable",type:"function"}];Vg.from(2).pow(256).sub(1);var XPs=({provider:e,contractAddress:i,spenderAddress:A,fromAddress:c,amount:f})=>WPs(void 0,void 0,void 0,function*(){var l;let g=Vg.from((l=f==null?void 0:f.amount().toFixed())!==null&&l!==void 0?l:1),N=yield new r3n(i,ZPs,e).allowance(c,A);return g.lte(N)}),i3n=class{constructor(i){if(this.clients=i,this.network=eo.Mainnet,Object.values(i).length){let A=Object.values(i)[0].getNetwork();if(!Object.values(i).every(c=>c.getNetwork()===A))throw Error("Clients not working on the same network");this.network=A}}getNetwork(){return this.network}setNetwork(i){Object.values(this.clients).forEach(A=>A.setNetwork(i)),this.network=i}addClient(i,A){if(i in this.clients)return!1;let c=A.getNetwork();if(!Object.values(this.clients).length)this.network=c;else if(this.network!==c)throw Error(`Trying to add client in different network. Expected ${this.network} but got ${c}`);return this.clients[i]=A,!0}purgeClient(i){try{return this.getClient(i).purgeClient(),delete this.clients[i],!0}catch(A){return!1}}purgeWallet(){try{return Object.values(this.clients).map(i=>{i.purgeClient()}),this.clients={},!0}catch(i){return!1}}getAddress(i){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getAddressAsync()})}getAddresses(i){return Vm(this,void 0,void 0,function*(){let A=i||Object.keys(this.clients),c=A.map(g=>this.getAddress(g)),f={};return(yield Promise.all(c)).map((g,w)=>{f[A[w]]=g}),f})}validateAddress(i,A){return this.getClient(i).validateAddress(A)}getBalance(i,A){return Vm(this,void 0,void 0,function*(){let c=this.getClient(i);return c.getBalance(yield c.getAddressAsync(),A)})}getBalances(i){return Vm(this,void 0,void 0,function*(){let A=i?Array.from(new Set(i.map(g=>g.chain))):Object.keys(this.clients),c=A.map(g=>Vm(this,void 0,void 0,function*(){return yield this.getBalance(g,i==null?void 0:i.filter(w=>w.chain===g))})),f={};return(yield Promise.all(c)).map((g,w)=>{f[A[w]]=g}),f})}getTransactionData(i,A){return Vm(this,void 0,void 0,function*(){return yield this.getClient(i).getTransactionData(A)})}getTransactionsHistory(i){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getTransactions()})}getTransactionsHistories(i){return Vm(this,void 0,void 0,function*(){let A=i||Object.keys(this.clients),c=A.map(g=>Vm(this,void 0,void 0,function*(){return this.getTransactionsHistory(g)})),f={};return(yield Promise.all(c)).map((g,w)=>{f[A[w]]=g}),f})}getExplorerUrl(i){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getExplorerUrl()})}getExplorerAddressUrl(i,A){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getExplorerAddressUrl(A)})}getExplorerTxUrl(i,A){return Vm(this,void 0,void 0,function*(){return this.getClient(i).getExplorerTxUrl(A)})}getGasFeeRates(i){return Vm(this,void 0,void 0,function*(){let A=this.getClient(i);if(!this.isEvmClient(A))throw Error(`Can not get gas with ${i} client`);return A.estimateGasPrices()})}getFeeRates(i,A){return Vm(this,void 0,void 0,function*(){let c=this.getClient(i);if(this.isEvmClient(c))return c.estimateGasPrices(A);if(this.isUtxoClient(c)){let f=yield c.getFeeRates(A),l=c.getAssetInfo().decimal;return{[sd.Average]:nle(f[sd.Average],l),[sd.Fast]:nle(f[sd.Fast],l),[sd.Fastest]:nle(f[sd.Fastest],l)}}throw Error(`getFeeRates method not supported in ${i} chain`)})}estimateTransferFees(i){return Vm(this,void 0,void 0,function*(){let A=this.getClient(i.asset.chain);if(this.isEvmClient(A)){if(!this.isEvmTxParams(i))throw Error(`Invalid params for estimating ${i.asset.chain} transfer`);return A.getFees(i)}if(this.isUtxoClient(A)){if(!this.isUtxoTxParams(i))throw Error(`Invalid params for estimating ${i.asset.chain} transfer`);let c;try{c=yield this.getAddress(i.asset.chain)}catch(f){}return A.getFees({sender:c,memo:i.memo})}return A.getFees()})}transfer(i){return Vm(this,void 0,void 0,function*(){let A=this.getClient(i.asset.chain);if(this.isEvmClient(A)){if(!this.isEvmTxParams(i))throw Error(`Invalid params for ${i.asset.chain} transfer`);return A.transfer({walletIndex:i.walletIndex,asset:i.asset,amount:i.amount,recipient:i.recipient,memo:i.memo,gasPrice:i.gasPrice})}if(this.isUtxoClient(A)){if(!this.isUtxoTxParams(i))throw Error(`Invalid params for ${i.asset.chain} transfer`);return A.transfer({walletIndex:i.walletIndex,asset:i.asset,amount:i.amount,recipient:i.recipient,memo:i.memo,feeRate:i.feeRate?i.feeRate.amount().toNumber():void 0})}return A.transfer({walletIndex:i.walletIndex,asset:i.asset,amount:i.amount,recipient:i.recipient,memo:i.memo})})}deposit({asset:i,amount:A,memo:c,walletIndex:f,sequence:l,gasLimit:g,chain:w}){return Vm(this,void 0,void 0,function*(){let N=this.getClient(w);if(!("deposit"in N))throw Error(`Can not deposit with ${w} client`);return N.deposit({asset:i,amount:A,memo:c,walletIndex:f,sequence:l,gasLimit:g})})}approve(i,A,c){return Vm(this,void 0,void 0,function*(){let f=this.getClient(i.chain);if(!this.isEvmClient(f))throw Error("Can not make approve over non EVM client");if(i.chain===i.ticker)throw Error("Can not make approve over native asset");let l=mti(i);return yield f.approve({contractAddress:l,amount:A,spenderAddress:c})})}isApproved(i,A,c,f){return Vm(this,void 0,void 0,function*(){let l=this.getClient(i.chain);if(!this.isEvmClient(l))throw Error("Can not validate approve over non EVM client");if(i.chain===i.ticker)throw Error("Can not validate approve over native asset");let g=mti(i);return XPs({provider:l.getProvider(),amount:A,spenderAddress:f,contractAddress:g,fromAddress:c})})}broadcast(i,A){return Vm(this,void 0,void 0,function*(){return this.getClient(i).broadcastTx(A)})}getChainWallet(i){let A=this.getClient(i);if(!this.isEvmClient(A))throw Error(`Can not get wallet of ${i} client`);return A.getWallet()}getClient(i){let A=this.clients[i];if(!A)throw Error(`Client not found for ${i} chain`);return A}isEvmTxParams(i){return!("feeRate"in i)}isUtxoTxParams(i){return!("gasPrice"in i)}isEvmClient(i){return"estimateGasPrices"in i}isUtxoClient(i){return"getFeeRates"in i}},tni=e=>[rV.chain,_6e.chain,kre.chain].includes(e),nni=e=>tni(e.chain)?[rV,kre,_6e].findIndex(i=>Fy(i,e))===-1&&!e.synth:!1,$Ps=e=>[WJe.chain,Xue.chain].includes(e),xw=class{static makeAction(i){return pm(this,void 0,void 0,function*(){return this.isNonProtocolParams(i)?this.makeNonProtocolAction(i):this.makeProtocolAction(i)})}static makeProtocolAction({wallet:i,assetAmount:A,memo:c}){return pm(this,void 0,void 0,function*(){let f=yield i.deposit({chain:vU,asset:A.asset,amount:A.baseAmount,memo:c});return{hash:f,url:yield i.getExplorerTxUrl(vU,f)}})}static makeNonProtocolAction({wallet:i,assetAmount:A,recipient:c,memo:f}){return pm(this,void 0,void 0,function*(){if(!nni(A.asset)){if($Ps(A.asset.chain)){let E=yield i.transfer({asset:A.asset,amount:A.baseAmount,recipient:c,memo:f});return{hash:E,url:yield i.getExplorerTxUrl(A.asset.chain,E)}}let M=yield i.getFeeRates(A.asset.chain,gX.THORCHAIN),U=yield i.transfer(tni(A.asset.chain)?{asset:A.asset,amount:A.baseAmount,recipient:c,memo:f,gasPrice:M.fast}:{asset:A.asset,amount:A.baseAmount,recipient:c,memo:f,feeRate:M.fast});return{hash:U,url:yield i.getExplorerTxUrl(A.asset.chain,U)}}let g=yield new tle(new Iqe(new mqe(i.getNetwork()))).getChainInboundDetails(A.asset.chain);if(!g.router)throw Error(`Unknown router for ${A.asset.chain} chain`);let w=Nqe(A.asset),N=hti.utils.getAddress(w),F=Math.floor(new Date(new Date().getTime()+15*6e4).getTime()/1e3),j=[c,N,A.baseAmount.amount().toFixed(),f,F],te=new hti.Contract(g.router,ant.router),v=i.getChainWallet(A.asset.chain),ne=yield i.getFeeRates(A.asset.chain),Z=yield te.populateTransaction.depositWithExpiry(...j,{from:i.getAddress(A.asset.chain),value:0,gasPrice:ne.fast.amount().toFixed(),gasLimit:"160000"}),{hash:R}=yield v.sendTransaction(Z);return{hash:R,url:yield i.getExplorerTxUrl(A.asset.chain,R)}})}static isNonProtocolParams(i){if((i.assetAmount.asset.chain===vU||i.assetAmount.asset.synth)&&"address"in i&&i.address)throw Error("Inconsistent params. Native actions do not support recipient");return i.assetAmount.asset.chain!==vU&&!i.assetAmount.asset.synth}},W6t=class{constructor(i=new tle,A=new i3n({BTC:new Vge(Object.assign(Object.assign({},bDe),{network:eo.Mainnet})),BCH:new pCt(Object.assign(Object.assign({},Dfn),{network:eo.Mainnet})),LTC:new f6t(Object.assign(Object.assign({},nCn),{network:eo.Mainnet})),DOGE:new d6t(Object.assign(Object.assign({},eCn),{network:eo.Mainnet})),ETH:new Ppe(Object.assign(Object.assign({},i9e),{network:eo.Mainnet})),AVAX:new jIt(Object.assign(Object.assign({},sfn),{network:eo.Mainnet})),BSC:new mCt(Object.assign(Object.assign({},Ofn),{network:eo.Mainnet})),GAIA:new NEt({network:eo.Mainnet}),BNB:new aCt({network:eo.Mainnet}),THOR:new UIe(Object.assign(Object.assign({},Kot),{network:eo.Mainnet}))})){this.thorchainQuery=i,this.wallet=A}estimateSwap({fromAddress:i,fromAsset:A,amount:c,destinationAsset:f,destinationAddress:l,affiliateAddress:g="",affiliateBps:w=0,toleranceBps:N,streamingInterval:F,streamingQuantity:j}){return pm(this,void 0,void 0,function*(){let te=yield this.validateSwap({fromAddress:i,fromAsset:A,amount:c,destinationAsset:f,destinationAddress:l}),v=yield this.thorchainQuery.quoteSwap({fromAsset:A,amount:c,destinationAsset:f,destinationAddress:l,affiliateAddress:g,affiliateBps:w,toleranceBps:N,streamingInterval:F,streamingQuantity:j});return v.txEstimate.errors.push(...te),v.txEstimate.canSwap=v.txEstimate.errors.length===0,v})}validateSwap({fromAsset:i,fromAddress:A,destinationAsset:c,destinationAddress:f,amount:l,affiliateAddress:g,affiliateBps:w,streamingInterval:N,streamingQuantity:F}){return pm(this,void 0,void 0,function*(){let j=[];if(f&&!this.wallet.validateAddress(c.synth?vU:c.chain,f)&&j.push(`destinationAddress ${f} is not a valid address`),g){let te=this.wallet.validateAddress(vU,g),v=!!(yield this.thorchainQuery.thorchainCache.midgardQuery.midgardCache.midgard.getTHORNameDetails(g));te||v||j.push(`affiliateAddress ${g} is not a valid THOR address`)}if(w&&(w<0||w>1e4)&&j.push(`affiliateBps ${w} out of range [0 - 10000]`),N&&N<0&&j.push(`streamingInterval ${N} can not be lower than zero`),F&&F<0&&j.push(`streamingQuantity ${F} can not be lower than zero`),nni(i)&&A){let te=yield this.isRouterApprovedToSpend({asset:i,address:A,amount:l});j.push(...te)}return j})}doSwap({fromAsset:i,fromAddress:A,amount:c,destinationAsset:f,destinationAddress:l,affiliateAddress:g,affiliateBps:w,toleranceBps:N,streamingInterval:F,streamingQuantity:j}){return pm(this,void 0,void 0,function*(){let te=yield this.thorchainQuery.quoteSwap({fromAsset:i,fromAddress:A,amount:c,destinationAsset:f,destinationAddress:l,affiliateAddress:g,affiliateBps:w,toleranceBps:N,streamingInterval:F,streamingQuantity:j});if(!te.txEstimate.canSwap)throw Error(te.txEstimate.errors.join(`
265
+ `));return xw.makeAction({wallet:this.wallet,assetAmount:c,memo:te.memo,recipient:te.toAddress})})}approveRouterToSpend({asset:i,amount:A}){return pm(this,void 0,void 0,function*(){let c=yield this.thorchainQuery.getChainInboundDetails(i.chain);if(!c.router)throw Error(`Unknown router address for ${i.chain}`);let f=yield this.wallet.approve(i,(A==null?void 0:A.baseAmount)||wo(qRe.toString(),yield this.thorchainQuery.thorchainCache.midgardQuery.getDecimalForAsset(i)),c.router);return{hash:f.hash,url:yield this.wallet.getExplorerTxUrl(i.chain,f.hash)}})}isRouterApprovedToSpend({asset:i,amount:A,address:c}){return pm(this,void 0,void 0,function*(){let f=[],l=yield this.thorchainQuery.getChainInboundDetails(i.chain);if(!l.router)throw Error(`Unknown router address for ${i.chain}`);return(yield this.wallet.isApproved(i,A.baseAmount,c,l.router))||f.push("Thorchain router has not been approved to spend this amount"),f})}estimateAddLiquidity(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.estimateAddLP(i)})}estimateWithdrawLiquidity(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.estimateWithdrawLP(i)})}addLiquidityPosition(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.estimateAddLP(i);if(!A.canAdd)throw Error(`${A.errors}`);let c=(yield this.thorchainQuery.thorchainCache.getInboundDetails())[i.asset.asset.chain].address,f=yield this.wallet.getAddress(vU),l=yield this.wallet.getAddress(i.asset.asset.chain),g=[],w={asset:i.asset,rune:i.rune,waitTimeSeconds:A.estimatedWaitSeconds,assetPool:A.assetPool};return i.asset.assetAmount.gt(0)&&i.rune.assetAmount.gt(0)?(g.push(yield xw.makeAction({wallet:this.wallet,memo:`+:${A.assetPool}:${f}`,assetAmount:w.asset,recipient:c})),g.push(yield xw.makeAction({wallet:this.wallet,memo:`+:${A.assetPool}:${l}`,assetAmount:w.rune})),g):i.asset.assetAmount.gt(0)&&i.rune.assetAmount.eq(0)?(g.push(yield xw.makeAction({wallet:this.wallet,memo:`+:${A.assetPool}`,assetAmount:w.asset,recipient:c})),g):(g.push(yield xw.makeAction({wallet:this.wallet,memo:`+:${A.assetPool}`,assetAmount:w.asset})),g)})}withdrawLiquidityPosition(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.estimateWithdrawLP(i),c={assetFee:A.inbound.fees.asset,runeFee:A.inbound.fees.rune,waitTimeSeconds:A.estimatedWaitSeconds,percentage:i.percentage,assetPool:A.assetPool,assetAddress:A.assetAddress,runeAddress:A.runeAddress},f=(yield this.thorchainQuery.thorchainCache.getInboundDetails())[c.assetFee.asset.chain].address,l=(c.percentage*100).toFixed(),g=[];return c.assetAddress&&c.runeAddress?(g.push(yield xw.makeAction({wallet:this.wallet,memo:`-:${c.assetPool}:${l}`,assetAmount:c.assetFee,recipient:f})),g.push(yield xw.makeAction({wallet:this.wallet,memo:`-:${c.assetPool}:${l}`,assetAmount:c.runeFee})),g):c.assetAddress&&!c.runeAddress?(g.push(yield xw.makeAction({wallet:this.wallet,memo:`-:${c.assetPool}:${l}`,assetAmount:c.assetFee,recipient:f})),g):(g.push(yield xw.makeAction({wallet:this.wallet,memo:`-:${c.assetPool}:${l}`,assetAmount:c.runeFee})),g)})}estimateAddSaver(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.estimateAddSaver(i)})}estimateWithdrawSaver(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.estimateWithdrawSaver(i)})}getSaverPosition(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.getSaverPosition(i)})}addSaver(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.estimateAddSaver(i);if(!A.canAddSaver)throw Error("Cannot add to savers");return xw.makeAction({wallet:this.wallet,recipient:A.toAddress,assetAmount:i,memo:A.memo})})}withdrawSaver(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.estimateWithdrawSaver(i);if(A.errors.length>0)throw Error(`${A.errors}`);return xw.makeAction({wallet:this.wallet,recipient:A.toAddress,assetAmount:A.dustAmount,memo:A.memo})})}getLoanQuoteOpen(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.getLoanQuoteOpen(i)})}getLoanQuoteClose(i){return pm(this,void 0,void 0,function*(){return yield this.thorchainQuery.getLoanQuoteClose(i)})}addLoan(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.getLoanQuoteOpen(i);if(A.errors.length>0)throw Error(`${A.errors}`);return xw.makeAction({wallet:this.wallet,memo:`${A.memo}`,recipient:`${A.inboundAddress}`,assetAmount:i.amount})})}withdrawLoan(i){return pm(this,void 0,void 0,function*(){let A=yield this.thorchainQuery.getLoanQuoteClose(i);if(A.errors.length>0)throw Error(`${A.errors}`);return xw.makeAction({wallet:this.wallet,memo:`${A.memo}`,recipient:`${A.inboundAddress}`,assetAmount:i.amount})})}getThornamesByAddress(i){return pm(this,void 0,void 0,function*(){return this.thorchainQuery.thorchainCache.midgardQuery.midgardCache.midgard.getTHORNameReverseLookup(i)})}};var cwe=class{constructor(i){this.name="Thorchain";this.thorchainQuery=new tle,this.thorchainAmm=new W6t(this.thorchainQuery,i)}isAssetSupported(i){return Jt(this,null,function*(){if(Fy(i,ij))return!0;let A=yield this.thorchainQuery.thorchainCache.getPools();return Object.values(A).findIndex(c=>c.isAvailable()&&ec(i)===c.assetString)!==-1})}getSupportedChains(){return Jt(this,null,function*(){let i=yield this.thorchainQuery.thorchainCache.getInboundDetails();return[vU,...Object.values(i).map(A=>A.chain)]})}estimateSwap(i){return Jt(this,null,function*(){let A=yield this.thorchainAmm.estimateSwap(i);return{protocol:this.name,toAddress:A.toAddress,memo:A.memo,expectedAmount:A.txEstimate.netOutput,dustThreshold:A.dustThreshold,fees:A.txEstimate.totalFees,totalSwapSeconds:A.txEstimate.inboundConfirmationSeconds||0+A.txEstimate.outboundDelaySeconds,slipBasisPoints:A.txEstimate.slipBasisPoints,canSwap:A.txEstimate.canSwap,errors:A.txEstimate.errors,warning:A.txEstimate.warning}})}doSwap(i){return Jt(this,null,function*(){return this.thorchainAmm.doSwap(i)})}getSwapHistory(A){return Jt(this,arguments,function*({chainAddresses:i}){let c=yield this.thorchainQuery.getSwapHistory({addresses:Array.from(new Set(i.map(f=>f.address)))});return{count:c.count,swaps:c.swaps.map(f=>Di({protocol:this.name},f))}})}};var c3n=class{constructor(i){this.protocols=[new cwe(i),new p6e(i)]}estimateSwap(i){return Jt(this,null,function*(){let A=(l,g)=>Jt(this,null,function*(){let[w,N]=yield Promise.all([l.isAssetSupported(g.fromAsset),l.isAssetSupported(g.destinationAsset)]);if(!w)throw Error(`${ec(g.fromAsset)} not supported in ${l.name}`);if(!N)throw Error(`${ec(g.destinationAsset)} not supported in ${l.name}`);return l.estimateSwap(g)}),c=yield Promise.allSettled(this.protocols.map(l=>A(l,i))),f;if(c.forEach(l=>{l.status==="fulfilled"&&(!f||l.value.expectedAmount.assetAmount.gte(f.expectedAmount.assetAmount))&&(f=l.value)}),!f)throw Error(`Can not estimate swap from ${ec(i.fromAsset)} to ${ec(i.fromAsset)}`);return f})}doSwap(i){return Jt(this,null,function*(){let A=i.protocol?i.protocol:(yield this.estimateSwap(i)).protocol,c=this.protocols.find(f=>f.name===A);if(!c)throw Error(`${A} protocol is not supported`);return c.doSwap(i)})}getSwapHistory(i){return Jt(this,null,function*(){let A=(l,g)=>Jt(this,null,function*(){let w=yield l.getSupportedChains(),N=g.chainAddresses.filter(F=>w.findIndex(j=>j===F.chain)!==-1);return N.length===0?{swaps:[],count:0}:l.getSwapHistory({chainAddresses:N})}),c=yield Promise.allSettled(this.protocols.map(l=>A(l,i))),f=[];return c.forEach(l=>{l.status==="fulfilled"&&f.push(...l.value.swaps)}),{count:f.length,swaps:f.sort((l,g)=>g.date.getTime()-l.date.getTime())}})}};export{c3n as Aggregator};
266
266
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
267
267
  /**
268
268
  * @license