graz 0.0.49-alpha.0 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +10 -11
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var wn=Object.create;var Ae=Object.defineProperty;var Cn=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var An=Object.getPrototypeOf,En=Object.prototype.hasOwnProperty;var In=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),bn=(t,e)=>{for(var n in e)Ae(t,n,{get:e[n],enumerable:!0})},Ct=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Sn(e))!En.call(t,o)&&o!==n&&Ae(t,o,{get:()=>e[o],enumerable:!(r=Cn(e,o))||r.enumerable});return t};var Ee=(t,e,n)=>(n=t!=null?wn(An(t)):{},Ct(e||!t||!t.__esModule?Ae(n,"default",{value:t,enumerable:!0}):n,t)),Tn=t=>Ct(Ae({},"__esModule",{value:!0}),t);var be=In((Bo,Wt)=>{"use strict";Wt.exports=E;var P=null;try{P=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function E(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}E.prototype.__isLong__;Object.defineProperty(E.prototype,"__isLong__",{value:!0});function _(t){return(t&&t.__isLong__)===!0}E.isLong=_;var At={},Et={};function J(t,e){var n,r,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(r=Et[t],r)?r:(n=I(t,(t|0)<0?-1:0,!0),o&&(Et[t]=n),n)):(t|=0,(o=-128<=t&&t<128)&&(r=At[t],r)?r:(n=I(t,t<0?-1:0,!1),o&&(At[t]=n),n))}E.fromInt=J;function R(t,e){if(isNaN(t))return e?X:q;if(e){if(t<0)return X;if(t>=xt)return kt}else{if(t<=-bt)return F;if(t+1>=bt)return Ot}return t<0?R(-t,e).neg():I(t%ne|0,t/ne|0,e)}E.fromNumber=R;function I(t,e,n){return new E(t,e,n)}E.fromBits=I;var Ie=Math.pow;function Be(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return q;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return Be(t.substring(1),e,n).neg();for(var o=R(Ie(n,8)),i=q,s=0;s<t.length;s+=8){var a=Math.min(8,t.length-s),c=parseInt(t.substring(s,s+a),n);if(a<8){var u=R(Ie(n,a));i=i.mul(u).add(R(c))}else i=i.mul(o),i=i.add(R(c))}return i.unsigned=e,i}E.fromString=Be;function L(t,e){return typeof t=="number"?R(t,e):typeof t=="string"?Be(t,e):I(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}E.fromValue=L;var It=65536,kn=1<<24,ne=It*It,xt=ne*ne,bt=xt/2,Tt=J(kn),q=J(0);E.ZERO=q;var X=J(0,!0);E.UZERO=X;var te=J(1);E.ONE=te;var vt=J(1,!0);E.UONE=vt;var Ue=J(-1);E.NEG_ONE=Ue;var Ot=I(-1,2147483647,!1);E.MAX_VALUE=Ot;var kt=I(-1,-1,!0);E.MAX_UNSIGNED_VALUE=kt;var F=I(0,-2147483648,!1);E.MIN_VALUE=F;var l=E.prototype;l.toInt=function(){return this.unsigned?this.low>>>0:this.low};l.toNumber=function(){return this.unsigned?(this.high>>>0)*ne+(this.low>>>0):this.high*ne+(this.low>>>0)};l.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var n=R(e),r=this.div(n),o=r.mul(n).sub(this);return r.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=R(Ie(e,6),this.unsigned),s=this,a="";;){var c=s.div(i),u=s.sub(c.mul(i)).toInt()>>>0,h=u.toString(e);if(s=c,s.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}};l.getHighBits=function(){return this.high};l.getHighBitsUnsigned=function(){return this.high>>>0};l.getLowBits=function(){return this.low};l.getLowBitsUnsigned=function(){return this.low>>>0};l.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};l.isZero=function(){return this.high===0&&this.low===0};l.eqz=l.isZero;l.isNegative=function(){return!this.unsigned&&this.high<0};l.isPositive=function(){return this.unsigned||this.high>=0};l.isOdd=function(){return(this.low&1)===1};l.isEven=function(){return(this.low&1)===0};l.equals=function(e){return _(e)||(e=L(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};l.eq=l.equals;l.notEquals=function(e){return!this.eq(e)};l.neq=l.notEquals;l.ne=l.notEquals;l.lessThan=function(e){return this.comp(e)<0};l.lt=l.lessThan;l.lessThanOrEqual=function(e){return this.comp(e)<=0};l.lte=l.lessThanOrEqual;l.le=l.lessThanOrEqual;l.greaterThan=function(e){return this.comp(e)>0};l.gt=l.greaterThan;l.greaterThanOrEqual=function(e){return this.comp(e)>=0};l.gte=l.greaterThanOrEqual;l.ge=l.greaterThanOrEqual;l.compare=function(e){if(_(e)||(e=L(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};l.comp=l.compare;l.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(te)};l.neg=l.negate;l.add=function(e){_(e)||(e=L(e));var n=this.high>>>16,r=this.high&65535,o=this.low>>>16,i=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,u=e.low&65535,h=0,A=0,C=0,x=0;return x+=i+u,C+=x>>>16,x&=65535,C+=o+c,A+=C>>>16,C&=65535,A+=r+a,h+=A>>>16,A&=65535,h+=n+s,h&=65535,I(C<<16|x,h<<16|A,this.unsigned)};l.subtract=function(e){return _(e)||(e=L(e)),this.add(e.neg())};l.sub=l.subtract;l.multiply=function(e){if(this.isZero())return q;if(_(e)||(e=L(e)),P){var n=P.mul(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}if(e.isZero())return q;if(this.eq(F))return e.isOdd()?F:q;if(e.eq(F))return this.isOdd()?F:q;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Tt)&&e.lt(Tt))return R(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=this.high&65535,i=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,u=e.low>>>16,h=e.low&65535,A=0,C=0,x=0,N=0;return N+=s*h,x+=N>>>16,N&=65535,x+=i*h,C+=x>>>16,x&=65535,x+=s*u,C+=x>>>16,x&=65535,C+=o*h,A+=C>>>16,C&=65535,C+=i*u,A+=C>>>16,C&=65535,C+=s*c,A+=C>>>16,C&=65535,A+=r*h+o*u+i*c+s*a,A&=65535,I(x<<16|N,A<<16|C,this.unsigned)};l.mul=l.multiply;l.divide=function(e){if(_(e)||(e=L(e)),e.isZero())throw Error("division by zero");if(P){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?P.div_u:P.div_s)(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?X:q;var r,o,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return X;if(e.gt(this.shru(1)))return vt;i=X}else{if(this.eq(F)){if(e.eq(te)||e.eq(Ue))return F;if(e.eq(F))return te;var s=this.shr(1);return r=s.div(e).shl(1),r.eq(q)?e.isNegative()?te:Ue:(o=this.sub(e.mul(r)),i=r.add(o.div(e)),i)}else if(e.eq(F))return this.unsigned?X:q;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=q}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:Ie(2,a-48),u=R(r),h=u.mul(e);h.isNegative()||h.gt(o);)r-=c,u=R(r,this.unsigned),h=u.mul(e);u.isZero()&&(u=te),i=i.add(u),o=o.sub(h)}return i};l.div=l.divide;l.modulo=function(e){if(_(e)||(e=L(e)),P){var n=(this.unsigned?P.rem_u:P.rem_s)(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};l.mod=l.modulo;l.rem=l.modulo;l.not=function(){return I(~this.low,~this.high,this.unsigned)};l.and=function(e){return _(e)||(e=L(e)),I(this.low&e.low,this.high&e.high,this.unsigned)};l.or=function(e){return _(e)||(e=L(e)),I(this.low|e.low,this.high|e.high,this.unsigned)};l.xor=function(e){return _(e)||(e=L(e)),I(this.low^e.low,this.high^e.high,this.unsigned)};l.shiftLeft=function(e){return _(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?I(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):I(0,this.low<<e-32,this.unsigned)};l.shl=l.shiftLeft;l.shiftRight=function(e){return _(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?I(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):I(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};l.shr=l.shiftRight;l.shiftRightUnsigned=function(e){if(_(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return I(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?I(n,0,this.unsigned):I(n>>>e-32,0,this.unsigned)};l.shru=l.shiftRightUnsigned;l.shr_u=l.shiftRightUnsigned;l.toSigned=function(){return this.unsigned?I(this.low,this.high,!1):this};l.toUnsigned=function(){return this.unsigned?this:I(this.low,this.high,!0)};l.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};l.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};l.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};E.fromBytes=function(e,n,r){return r?E.fromBytesLE(e,n):E.fromBytesBE(e,n)};E.fromBytesLE=function(e,n){return new E(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};E.fromBytesBE=function(e,n){return new E(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)}});var vo={};bn(vo,{GrazEvents:()=>ht,GrazProvider:()=>xo,WALLET_TYPES:()=>qe,WalletType:()=>Re,checkWallet:()=>W,clearRecentChain:()=>He,clearSession:()=>M,configureGraz:()=>Ze,connect:()=>oe,defineChain:()=>Zn,defineChainInfo:()=>Yn,defineChains:()=>gt,disconnect:()=>Te,executeContract:()=>et,getActiveChainCurrency:()=>Ve,getAvailableWallets:()=>Wn,getCosmostation:()=>me,getKeplr:()=>pe,getLeap:()=>ge,getMetamaskSnapLeap:()=>Ge,getOfflineSigners:()=>Qe,getQueryRaw:()=>nt,getQuerySmart:()=>tt,getRecentChain:()=>Nn,getVectis:()=>fe,getWCCosmostation:()=>je,getWCKeplr:()=>Ke,getWCLeap:()=>ze,getWallet:()=>T,getWalletConnect:()=>U,instantiateContract:()=>Je,mainnetChains:()=>Xn,mainnetChainsArray:()=>Jn,reconnect:()=>B,sendIbcTokens:()=>Xe,sendTokens:()=>Ye,suggestChain:()=>xe,suggestChainAndConnect:()=>$e,testnetChains:()=>eo,testnetChainsArray:()=>to,useAccount:()=>z,useActiveChain:()=>co,useActiveChainCurrency:()=>lo,useActiveChainValidators:()=>uo,useActiveWalletType:()=>no,useBalance:()=>oo,useBalanceStaked:()=>ao,useBalances:()=>gn,useCheckWallet:()=>de,useConnect:()=>ro,useCosmWasmClient:()=>Ne,useCosmWasmSigningClient:()=>Eo,useCosmWasmTmSigningClient:()=>bo,useDisconnect:()=>io,useExecuteContract:()=>wo,useGrazEvents:()=>dn,useInstantiateContract:()=>yo,useOfflineSigners:()=>so,useQueryRaw:()=>So,useQuerySmart:()=>Co,useRecentChain:()=>mo,useSendIbcTokens:()=>ho,useSendTokens:()=>fo,useStargateClient:()=>We,useStargateSigningClient:()=>Ao,useStargateTmSigningClient:()=>Io,useSuggestChain:()=>po,useSuggestChainAndConnect:()=>go,useTendermintClient:()=>Me});module.exports=Tn(vo);var Y="graz-reconnect-session";var Le=require("zustand"),St=require("zustand/middleware"),ee=require("zustand/middleware");var Re=(u=>(u.KEPLR="keplr",u.LEAP="leap",u.VECTIS="vectis",u.COSMOSTATION="cosmostation",u.WALLETCONNECT="walletconnect",u.WC_KEPLR_MOBILE="wc_keplr_mobile",u.WC_LEAP_MOBILE="wc_leap_mobile",u.WC_COSMOSTATION_MOBILE="wc_cosmostation_mobile",u.METAMASK_SNAP_LEAP="metamask_snap_leap",u))(Re||{}),qe=["keplr","leap","vectis","cosmostation","walletconnect","wc_keplr_mobile","wc_leap_mobile","wc_cosmostation_mobile","metamask_snap_leap"];var xn={recentChain:null,defaultChain:null,defaultSigningClient:"stargate",walletType:"keplr",walletConnect:{options:null,web3Modal:null},_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},ue={account:null,activeChain:null,balances:null,status:"disconnected",wcSignClient:null},vn={name:"graz-session",version:1,partialize:t=>({account:t.account,activeChain:t.activeChain}),storage:(0,St.createJSONStorage)(()=>sessionStorage)},On={name:"graz-internal",partialize:t=>({recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:1},g=(0,Le.create)((0,ee.subscribeWithSelector)((0,ee.persist)(()=>ue,vn))),f=(0,Le.create)((0,ee.subscribeWithSelector)((0,ee.persist)(()=>xn,On)));var me=()=>{if(typeof window.cosmostation.providers.keplr<"u"){let t=window.cosmostation.providers.keplr;return Object.assign(t,{subscription:r=>(window.cosmostation.cosmos.on("accountChanged",()=>{M(),r()}),()=>{window.cosmostation.cosmos.off("accountChanged",()=>{M(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")};var pe=()=>{if(typeof window.keplr<"u"){let t=window.keplr;return Object.assign(t,{subscription:r=>(window.addEventListener("keplr_keystorechange",()=>{M(),r()}),()=>{window.removeEventListener("keplr_keystorechange",()=>{M(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.keplr is not defined")};var ge=()=>{if(typeof window.leap<"u"){let t=window.leap;return Object.assign(t,{subscription:r=>(window.addEventListener("leap_keystorechange",()=>{M(),r()}),()=>{window.removeEventListener("leap_keystorechange",()=>{M(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.leap is not defined")};var Nt=Ee(be());var Mt=t=>{let e=window.ethereum;if(e&&t){let n=async()=>await e.request({method:"wallet_getSnaps"}),r=async w=>{try{let S=await n();return Object.values(S).find(O=>O.id===t.id&&(!w||O.version===w))}catch{return}},o=async()=>{await e.request({method:"wallet_requestSnaps",params:{[t.id]:t.params||{}}})},i=async()=>{let w=await e.request({method:"web3_clientVersion"});if(!(w==null?void 0:w.includes("flask")))throw new Error("Metamask Flask is not detected");return!0},s=async w=>{await r()||await o()},a=async(w,S,O)=>{let G=await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"signDirect",params:{chainId:w,signerAddress:S,signDoc:O}}}}),Q=O.accountNumber,le=new Nt.default(Q.low,Q.high,Q.unsigned);return{signature:G.signature,signed:{...G.signed,accountNumber:`${le.toString()}`,authInfoBytes:new Uint8Array(Object.values(G.signed.authInfoBytes)),bodyBytes:new Uint8Array(Object.values(G.signed.bodyBytes))}}},c=async(w,S,O)=>await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"signAmino",params:{chainId:w,signerAddress:S,signDoc:O}}}}),u=async w=>{let S=await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"getKey",params:{chainId:w}}}});if(!S)throw new Error("No response from Metamask");return S.pubKey=Uint8Array.from(Object.values(S.pubkey)),delete S.pubkey,{...S}},h=async w=>{let S=await u(w);return{address:S.bech32Address,algo:S.algo,pubkey:S.pubKey}},A=async(...w)=>{let[S,O,G,Q]=w;return await c(S,O,G)},C=async(...w)=>{let[S,O,G]=w;return await a(S,O,G)},x=w=>({getAccounts:async()=>[await h(w)],signDirect:(S,O)=>C(w,S,O)}),N=w=>({getAccounts:async()=>[await h(w)],signAmino:(S,O)=>A(w,S,O)});return{getKey:u,getOfflineSigner:w=>({getAccounts:async()=>[await h(w)],signDirect:(S,O)=>C(w,S,O),signAmino:(S,O)=>A(w,S,O)}),getOfflineSignerAuto:async w=>(await u(w)).isNanoLedger?N(w):x(w),getOfflineSignerOnlyAmino:N,signDirect:C,signAmino:A,enable:s,experimentalSuggestChain:async(...w)=>{await Promise.reject(new Error("Metamask does not support experimentalSuggestChain"))},init:i}}throw f.getState()._notFoundFn(),new Error("window.ethereum is not defined")};var Ge=()=>Mt({id:"npm:@leapwallet/metamask-cosmos-snap"});var Dt=require("@cosmjs/encoding"),Ft=Ee(be());var fe=()=>{if(typeof window.vectis<"u"){let t=window.vectis.cosmos;return{enable:a=>t.enable(a),getOfflineSigner:a=>t.getOfflineSigner(a),getOfflineSignerAuto:a=>t.getOfflineSignerAuto(a),getKey:async a=>{let c=await t.getKey(a);return{address:(0,Dt.fromBech32)(c.address).data,algo:c.algo,bech32Address:c.address,name:c.name,pubKey:c.pubKey,isKeystone:!1,isNanoLedger:c.isNanoLedger}},subscription:a=>(window.addEventListener("vectis_accountChanged",()=>{M(),a()}),()=>{window.removeEventListener("vectis_accountChanged",()=>{M(),a()})}),getOfflineSignerOnlyAmino:(...a)=>t.getOfflineSignerAmino(...a),experimentalSuggestChain:async(...a)=>{let[c]=a,u={...c,rpcUrl:c.rpc,restUrl:c.rest,prettyName:c.chainName.replace(" ",""),bech32Prefix:c.bech32Config.bech32PrefixAccAddr};return t.suggestChains([u])},signDirect:async(...a)=>{var h;let{1:c,2:u}=a;return t.signDirect(c,{bodyBytes:u.bodyBytes||Uint8Array.from([]),authInfoBytes:u.authInfoBytes||Uint8Array.from([]),accountNumber:Ft.default.fromString(((h=u.accountNumber)==null?void 0:h.toString())||"",!1),chainId:u.chainId||""})},signAmino:async(...a)=>{let{1:c,2:u}=a;return t.signAmino(c,u)}}}throw f.getState()._notFoundFn(),new Error("window.vectis is not defined")};var qt=require("@cosmjs/encoding"),Lt=require("@walletconnect/sign-client"),Ut=require("@walletconnect/utils"),Bt=Ee(be());var j=()=>typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1,_t=()=>j()&&navigator.userAgent.toLowerCase().includes("android"),Pt=()=>j()&&(navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad"));var Rt=(t,e,n=new Error("Promise timed out"))=>{let r=new Promise((o,i)=>{setTimeout(()=>{i(n)},e)});return Promise.race([t,r])};var U=t=>{var Q,le,wt;if(!((wt=(le=(Q=f.getState().walletConnect)==null?void 0:Q.options)==null?void 0:le.projectId)!=null&&wt.trim()))throw new Error("walletConnect.options.projectId is not defined");let e=(t==null?void 0:t.encoding)||"base64",n=p=>{if(!t)return;let{appUrl:m,formatNativeUrl:d}=t;if(j()){if(_t())if(!p)window.open(m.mobile.android,"_self","noreferrer noopener");else{let y=d(m.mobile.android,p,"android");window.open(y,"_self","noreferrer noopener")}if(Pt())if(!p)window.open(m.mobile.ios,"_self","noreferrer noopener");else{let y=d(m.mobile.ios,p,"ios");window.open(y,"_self","noreferrer noopener")}}},r=()=>{let{wcSignClient:p}=g.getState();if(!p)throw new Error("walletConnect.signClient is not defined");M(),f.setState({_reconnect:!1,_reconnectConnector:null,recentChain:null})},o=async p=>{let{wcSignClient:m}=g.getState();if(!m)throw new Error("walletConnect.signClient is not defined");if(!p)throw new Error("No wallet connect session");await m.disconnect({topic:p,reason:(0,Ut.getSdkError)("USER_DISCONNECTED")}),await a(m),r()},i=p=>{var m,d;try{let{wcSignClient:y}=g.getState();if(!y)throw new Error("walletConnect.signClient is not defined");let b=y.session.getAll().at(-1);if(!b)return;let v=(d=(m=y.session.getAll().at(-1))==null?void 0:m.namespaces.cosmos)==null?void 0:d.accounts.find(k=>k.startsWith(`cosmos:${p}`));if(!(b.expiry*1e3>Date.now()+1e3))throw o(b.topic),new Error("invalid session");if(!v)try{let k=y.find({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!k.length)throw new Error("no session");return k.at(-1)}catch(k){if(!k.message.toLowerCase().includes("no matching key"))throw k}return b}catch(y){if(!y.message.toLowerCase().includes("no matching key"))throw y}},s=p=>{try{return i(p)}catch{return}},a=async p=>{try{let m=p.core.pairing.pairings.getAll({active:!1});if(!m.length)return;await Promise.all(m.map(async d=>{await p.core.pairing.pairings.delete(d.topic,{code:7001,message:"clear pairing"})}))}catch(m){if(!m.message.toLowerCase().includes("no matching key"))throw m}},c=async()=>{let{walletConnect:p}=f.getState();if(!(p!=null&&p.options))throw new Error("walletConnect.options is not defined");let{wcSignClient:m}=g.getState();if(m)return g.setState({wcSignClient:m}),m;let d=await Lt.SignClient.init(p.options);return g.setState({wcSignClient:d}),d},u=p=>{let{wcSignClient:m}=g.getState();if(m)return m.events.on("session_delete",d=>{r()}),m.events.on("session_expire",d=>{r()}),m.events.on("session_event",d=>{var y,b;if(d.params.event.name==="accountsChanged"&&((y=d.params.event.data)==null?void 0:y[0])!==((b=g.getState().account)==null?void 0:b.bech32Address)){let v=d.params.chainId.split(":")[1];v&&h(v)}else p()}),()=>{m.events.off("session_delete",d=>{r()}),m.events.off("session_expire",d=>{r()}),m.events.off("session_event",d=>{var y,b;if(d.params.event.name==="accountsChanged"&&((y=d.params.event.data)==null?void 0:y[0])!==((b=g.getState().account)==null?void 0:b.bech32Address)){let v=d.params.chainId.split(":")[1];v&&h(v)}else p()})}},h=async p=>{var we;let{wcSignClient:m}=g.getState();if(!m)throw new Error("enable walletConnect.signClient is not defined");let{walletConnect:d}=f.getState();if(!((we=d==null?void 0:d.options)!=null&&we.projectId))throw new Error("walletConnect.options.projectId is not defined");let{Web3Modal:y}=await import("@web3modal/standalone"),b=new y({projectId:d.options.projectId,walletConnectVersion:2,enableExplorer:!1,explorerRecommendedWalletIds:"NONE",...d.web3Modal}),{account:v,activeChain:K}=g.getState(),k=s(p);if((K==null?void 0:K.chainId)!==p&&!k||!v){let{uri:D,approval:Ce}=await m.connect({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!D)throw new Error("No wallet connect uri");t?n(D):await b.openModal({uri:D});let yn=async H=>H.aborted?Promise.reject(new Error("User closed wallet connect")):new Promise((Pe,Se)=>{Ce().then(Pe).catch(Se),H.addEventListener("abort",()=>{Se(new Error("User closed wallet connect"))})});try{let H=new AbortController,Pe=H.signal;b.subscribeModal(Se=>{Se.open||H.abort()}),await yn(Pe)}catch(H){if(b.closeModal(),!H.message.toLowerCase().includes("no matching key"))return Promise.reject(H)}return t||b.closeModal(),Promise.resolve()}try{await Rt((async()=>{let D=await C(p);g.setState({account:D})})(),15e3,new Error("Connection timeout"))}catch(D){if(o(k==null?void 0:k.topic),!D.message.toLowerCase().includes("no matching key"))throw D}},A=async p=>{var b;let{wcSignClient:m}=g.getState();if(!m)throw new Error("walletConnect.signClient is not defined");let d=(b=i(p))==null?void 0:b.topic;if(!d)throw new Error("No wallet connect session");n();let y=await m.request({topic:d,chainId:`cosmos:${p}`,request:{method:"cosmos_getAccounts",params:{}}});if(!y[0])throw new Error("No wallet connect account");return{address:y[0].address,algo:y[0].algo,pubkey:new Uint8Array(Buffer.from(y[0].pubkey,e))}},C=async p=>{let{address:m,algo:d,pubkey:y}=await A(p);return{address:(0,qt.fromBech32)(m).data,algo:d,bech32Address:m,name:"",pubKey:y,isKeystone:!1,isNanoLedger:!1}},x=async(...p)=>{var D,Ce;let[m,d,y]=p,{account:b,wcSignClient:v}=g.getState();if(!v)throw new Error("walletConnect.signClient is not defined");if(!b)throw new Error("account is not defined");let K=(D=i(m))==null?void 0:D.topic;if(!K)throw new Error("No wallet connect session");if(!y.bodyBytes)throw new Error("No bodyBytes");if(!y.authInfoBytes)throw new Error("No authInfoBytes");let k={topic:K,chainId:`cosmos:${m}`,request:{method:"cosmos_signDirect",params:{signerAddress:d,signDoc:{...y,bodyBytes:Buffer.from(y.bodyBytes).toString(e),authInfoBytes:Buffer.from(y.authInfoBytes).toString(e),accountNumber:(Ce=y.accountNumber)==null?void 0:Ce.toString()}}}};return n(),await v.request(k)},N=async(...p)=>{let[m,d,y]=p,{signature:b,signed:v}=await x(m,d,y);return{signed:{chainId:v.chainId,accountNumber:Bt.default.fromString(v.accountNumber,!1),authInfoBytes:new Uint8Array(Buffer.from(v.authInfoBytes,e)),bodyBytes:new Uint8Array(Buffer.from(v.bodyBytes,e))},signature:b}},ce=async(...p)=>{var D;let[m,d,y,b]=p,{wcSignClient:v}=g.getState(),{account:K}=g.getState();if(!v)throw new Error("walletConnect.signClient is not defined");if(!K)throw new Error("account is not defined");let k=(D=i(m))==null?void 0:D.topic;if(!k)throw new Error("No wallet connect session");return n(),await v.request({topic:k,chainId:`cosmos:${m}`,request:{method:"cosmos_signDirect",params:{signerAddress:d,signDoc:y}}})},Z=async(...p)=>{let[m,d,y,b]=p;return await ce(m,d,y)},yt=p=>({getAccounts:async()=>[await A(p)],signDirect:(m,d)=>N(p,m,d)}),w=p=>({getAccounts:async()=>[await A(p)],signAmino:(m,d)=>Z(p,m,d)});return{enable:h,experimentalSuggestChain:async(...p)=>{await Promise.reject(new Error("WalletConnect does not support experimentalSuggestChain"))},getKey:C,getOfflineSigner:p=>({getAccounts:async()=>[await A(p)],signDirect:(m,d)=>N(p,m,d),signAmino:(m,d)=>Z(p,m,d)}),getOfflineSignerAuto:async p=>(await C(p)).isNanoLedger?w(p):yt(p),getOfflineSignerOnlyAmino:w,signAmino:Z,signDirect:N,subscription:u,init:c}};var je=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!j())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"hex",appUrl:{mobile:{ios:"cosmostation://",android:"cosmostation://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,i,s)=>`${o.replaceAll("/","").replaceAll(":","")}://wc?${i}`};return U(t)};var Ke=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!j())throw new Error("WalletConnect Keplr mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"keplrwallet://",android:"intent://"}},walletType:"wc_keplr_mobile",formatNativeUrl:(o,i,s)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(i);switch(s){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return U(t)};var ze=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!j())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"leapcosmos://",android:"intent://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,i,s)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(i);switch(s){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return U(t)};var W=(t=f.getState().walletType)=>{try{return T(t),!0}catch{return!1}},M=()=>{window.sessionStorage.removeItem(Y),g.setState(ue)},T=(t=f.getState().walletType)=>{switch(t){case"keplr":return pe();case"leap":return ge();case"cosmostation":return me();case"vectis":return fe();case"walletconnect":return U();case"wc_keplr_mobile":return Ke();case"wc_leap_mobile":return ze();case"wc_cosmostation_mobile":return je();case"metamask_snap_leap":return Ge();default:throw new Error("Unknown wallet type")}},Wn=()=>Object.fromEntries(qe.map(t=>[t,W(t)]));var oe=async t=>{var e;try{let{defaultChain:n,recentChain:r,walletType:o}=f.getState(),i=(t==null?void 0:t.walletType)||o;if(!W(i))throw new Error(`${i} is not available`);let a=T(i),c=(t==null?void 0:t.chain)||r||n;if(!c)throw new Error("No last known connected chain, connect action requires chain info");g.setState(C=>{let x=f.getState()._reconnect||!!f.getState()._reconnectConnector||!!c;return C.activeChain&&C.activeChain.chainId!==c.chainId?{status:"connecting"}:x?{status:"reconnecting"}:{status:"connecting"}});let{account:u,activeChain:h}=g.getState();if(await((e=a.init)==null?void 0:e.call(a)),!u||(h==null?void 0:h.chainId)!==c.chainId){await a.enable(c.chainId);let C=await a.getKey(c.chainId);g.setState({account:C})}f.setState({recentChain:c,walletType:i,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:i}),g.setState({activeChain:c,status:"connected"}),typeof window<"u"&&window.sessionStorage.setItem(Y,"Active");let{account:A}=g.getState();return{account:A,walletType:i,chain:c}}catch(n){throw console.error("connect ",n),g.getState().account===null&&g.setState({status:"disconnected"}),g.getState().account&&g.getState().activeChain&&g.setState({status:"connected"}),n}},Te=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem(Y),g.setState(ue),f.setState(e=>({_reconnect:!1,_reconnectConnector:null,recentChain:t?null:e.recentChain})),Promise.resolve()),B=async t=>{var o;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=f.getState();try{let i=W(n||void 0);if(e&&i&&n)return await oe({chain:e,walletType:n,autoReconnect:r})}catch(i){(o=t==null?void 0:t.onError)==null||o.call(t,i),Te()}},Qe=async t=>{if(!(t!=null&&t.chainId))throw new Error("chainId is required");let{walletType:e}=f.getState(),n=t.walletType||e;if(!W(n))throw new Error(`${n} is not available`);let o=T(n),i=o.getOfflineSigner(t.chainId),s=o.getOfflineSignerOnlyAmino(t.chainId),a=await o.getOfflineSignerAuto(t.chainId);return{offlineSigner:i,offlineSignerAmino:s,offlineSignerAuto:a}};var He=()=>{f.setState({recentChain:null})},Ve=t=>{let{activeChain:e}=g.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},Nn=()=>f.getState().recentChain,xe=async t=>(await T().experimentalSuggestChain(t),t),$e=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...o})=>{let i=await xe(t);return{...await oe({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...o}),chain:i}};var Ze=(t={})=>(f.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletConnect:t.walletConnect||e.walletConnect,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var Ye=async({signingClient:t,senderAddress:e,recipientAddress:n,amount:r,fee:o,memo:i})=>{if(!t)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return t.sendTokens(e,n,r,o,i)},Xe=async({signingClient:t,senderAddress:e,recipientAddress:n,transferAmount:r,sourcePort:o,sourceChannel:i,timeoutHeight:s,timeoutTimestamp:a,fee:c,memo:u})=>{if(!t)throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return t.sendIbcTokens(e,n,r,o,i,s,a,c,u)},Je=async({signingClient:t,senderAddress:e,msg:n,fee:r,options:o,label:i,codeId:s})=>{if(!t)throw new Error("CosmWasm signing client is not ready");return t.instantiate(e,s,n,i,r,o)},et=async({signingClient:t,senderAddress:e,msg:n,fee:r,contractAddress:o,funds:i,memo:s})=>{if(!t)throw new Error("CosmWasm signing client is not ready");return t.execute(e,o,n,r,s,i)},tt=async(t,e,n)=>{if(!n)throw new Error("CosmWasm client is not ready");return await n.queryContractSmart(t,e)},nt=(t,e,n)=>{if(!n)throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.queryContractRaw(t,r)};var jt=require("@keplr-wallet/cosmos"),Kt={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Mn={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Dn={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Fn={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},_n={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Pn={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},Gt=[Kt,Mn,Dn,Fn,_n,Pn],ot={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:Kt,bip44:{coinType:118},bech32Config:jt.Bech32Address.defaultBech32Config("axelar"),currencies:Gt,feeCurrencies:Gt};var Qt=require("@keplr-wallet/cosmos"),Ht={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},zt=[Ht],rt={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:Ht,bip44:{coinType:118},bech32Config:Qt.Bech32Address.defaultBech32Config("cosmos"),currencies:zt,feeCurrencies:zt};var $t=require("@keplr-wallet/cosmos"),Zt={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Rn={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},qn={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Ln={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Un={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Bn={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Gn={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},jn={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Kn={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},zn={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Qn={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},Vt=[Zt,Rn,qn,Ln,Un,Bn,Gn,jn,Kn,zn,Qn],it={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:Zt,bip44:{coinType:118},bech32Config:$t.Bech32Address.defaultBech32Config("juno"),currencies:Vt,feeCurrencies:Vt};var Xt=require("@keplr-wallet/cosmos"),Jt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Hn={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Yt=[Jt,Hn],st={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Jt,bip44:{coinType:118},bech32Config:Xt.Bech32Address.defaultBech32Config("osmo"),currencies:Yt,feeCurrencies:Yt};var tn=require("@keplr-wallet/cosmos"),nn={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},en=[nn],at={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:nn,bip44:{coinType:118},bech32Config:tn.Bech32Address.defaultBech32Config("somm"),currencies:en,feeCurrencies:en};var rn=require("@keplr-wallet/cosmos"),sn={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},on=[sn],ct={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:rn.Bech32Address.defaultBech32Config("CRE"),currencies:on,feeCurrencies:on,stakeCurrency:sn,coinType:118};var an=require("@keplr-wallet/cosmos"),lt={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Vn=[lt],ut={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:lt,bip44:{coinType:118},bech32Config:an.Bech32Address.defaultBech32Config("juno"),currencies:Vn,feeCurrencies:[lt],coinType:118};var cn=require("@keplr-wallet/cosmos"),mt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},$n=[mt],pt={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:mt,bip44:{coinType:118},bech32Config:cn.Bech32Address.defaultBech32Config("osmo"),currencies:$n,feeCurrencies:[mt],coinType:118};var gt=t=>t,Zn=t=>t,Yn=t=>t,Xn=gt({axelar:ot,cosmoshub:rt,juno:it,osmosis:st,sommelier:at}),Jn=[ot,rt,it,st,at],eo=gt({crescent:ct,juno:ut,osmosis:pt}),to=[ct,ut,pt];var V=require("@tanstack/react-query"),re=require("react");var ln=require("@cosmjs/cosmwasm-stargate"),un=require("@cosmjs/stargate"),ve=require("@cosmjs/tendermint-rpc"),Oe=require("@tanstack/react-query"),ke=require("react");var We=()=>{let t=g(n=>n.activeChain),e=(0,ke.useMemo)(()=>["USE_STARGATE_CLIENT",t],[t]);return(0,Oe.useQuery)({queryKey:e,queryFn:async({queryKey:[,n]})=>{if(!n)throw new Error("No chain found");let r={url:n.rpc,headers:{...n.rpcHeaders||{}}};return await un.StargateClient.connect(r)},enabled:!!t,refetchOnWindowFocus:!1})},Ne=()=>{let t=g(n=>n.activeChain),e=(0,ke.useMemo)(()=>["USE_COSMWASM_CLIENT",t],[t]);return(0,Oe.useQuery)({queryKey:e,queryFn:async({queryKey:[,n]})=>{if(!n)throw new Error("No chain found");let r={url:n.rpc,headers:{...n.rpcHeaders||{}}};return await ln.CosmWasmClient.connect(r)},enabled:!!t,refetchOnWindowFocus:!1})},Me=t=>{let e=g(r=>r.activeChain),n=(0,ke.useMemo)(()=>["USE_TENDERMINT_CLIENT",t,e],[t,e]);return(0,Oe.useQuery)({queryKey:n,queryFn:async({queryKey:[,r,o]})=>{if(!o)throw new Error("No chain found");let i={url:o.rpc,headers:{...o.rpcHeaders||{}}};return await(r==="tm37"?ve.Tendermint37Client:ve.Tendermint34Client).connect(i)},enabled:!!e,refetchOnWindowFocus:!1})};var mn=require("@tanstack/react-query"),pn=require("zustand/shallow");var no=()=>f(t=>({walletType:t.walletType,isCosmostation:t.walletType==="cosmostation",isCosmostationMobile:t.walletType==="wc_cosmostation_mobile",isKeplr:t.walletType==="keplr",isKeplrMobile:t.walletType==="wc_keplr_mobile",isLeap:t.walletType==="leap",isLeapMobile:t.walletType==="wc_leap_mobile",isVectis:t.walletType==="vectis",isWalletConnect:t.walletType==="walletconnect"}),pn.shallow),de=t=>{let n=["USE_CHECK_WALLET",f(o=>t||o.walletType)];return(0,mn.useQuery)(n,({queryKey:[,o]})=>W(o))};var z=({onConnect:t,onDisconnect:e}={})=>{let n=g(o=>o.account),r=g(o=>o.status);return(0,re.useEffect)(()=>g.subscribe(o=>o.status,(o,i)=>{if(o==="connected"){let{account:s,activeChain:a}=g.getState(),{walletType:c}=f.getState();t==null||t({account:s,chain:a,walletType:c,isReconnect:i==="reconnecting"})}o==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:B,status:r}},gn=t=>{let{data:e}=z(),{data:n}=We(),{activeChain:r}=g.getState(),o=t||(e==null?void 0:e.bech32Address),i=(0,re.useMemo)(()=>["USE_ALL_BALANCES",n,r,o],[r,o,n]);return(0,V.useQuery)(i,async({queryKey:[,a,c,u]})=>{if(!c||!a)throw new Error("No connected account detected");if(!u)throw new Error("address is not defined");return await a.getAllBalances(u)},{enabled:!!o&&!!r&&!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})},oo=(t,e)=>{let{data:n}=z(),r=e||(n==null?void 0:n.bech32Address),{data:o,refetch:i}=gn(r),a=(0,V.useQuery)(["USE_BALANCE",o,t,e],({queryKey:[,c]})=>c==null?void 0:c.find(u=>u.denom===t),{enabled:!!o});return{...a,refetch:async()=>(await i(),a.refetch())}},ro=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,V.useMutation)(["USE_CONNECT",t,e,n],oe,{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=de();return{connect:s=>o.mutate(s),connectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!i,status:o.status}},io=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,V.useMutation)(["USE_DISCONNECT",t,e,n],Te,{onError:i=>Promise.resolve(t==null?void 0:t(i,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:i=>o.mutate(i),disconnectAsync:i=>o.mutateAsync(i),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,status:o.status}},so=()=>{let t=g(r=>r.activeChain),e=f(r=>r.walletType),n=(0,re.useMemo)(()=>["USE_OFFLINE_SIGNERS",t,e],[t,e]);return(0,V.useQuery)({queryKey:n,queryFn:async({queryKey:[,r,o]})=>{if(!r)throw new Error("No chain found");if(!W(o))throw new Error(`${o} is not available`);return await Qe({chainId:r.chainId,walletType:o})},enabled:!!t&&!!e,refetchOnWindowFocus:!1})},ao=t=>{let{data:e}=z(),{data:n}=We(),{activeChain:r}=g.getState(),o=t||(e==null?void 0:e.bech32Address),i=(0,re.useMemo)(()=>["USE_BALANCE_STAKED",n,r,o],[r,o,n]);return(0,V.useQuery)(i,async({queryKey:[,a,c,u]})=>{if(!c||!a)throw new Error("No connected account detected");if(!u)throw new Error("address is not defined");return await a.getBalanceStaked(u)},{enabled:!!o&&!!r&&!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})};var ie=require("@tanstack/react-query");var co=()=>g(t=>t.activeChain),lo=t=>(0,ie.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>Ve(r)),uo=(t,e="BOND_STATUS_BONDED")=>(0,ie.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],async({queryKey:[,o,i]})=>{if(!o)throw new Error("Query client is not defined");return await o.staking.validators(i)},{enabled:typeof t<"u"}),mo=()=>({data:f(e=>e.recentChain),clear:He}),po=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,ie.useMutation)(["USE_SUGGEST_CHAIN",t,e,n],xe,{onError:(i,s)=>Promise.resolve(t==null?void 0:t(i,s)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,suggest:o.mutate,suggestAsync:o.mutateAsync,status:o.status}},go=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,ie.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],$e,{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:s=>e==null?void 0:e(s),onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=de();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!i,status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}};var $=require("@tanstack/react-query");var fo=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=z(),o=r==null?void 0:r.bech32Address,i=(0,$.useMutation)(["USE_SEND_TOKENS",t,e,n,o],s=>Ye({senderAddress:o,...s}),{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},ho=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=z(),o=r==null?void 0:r.bech32Address,i=(0,$.useMutation)(["USE_SEND_IBC_TOKENS",t,e,n,o],s=>Xe({senderAddress:o,...s}),{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},yo=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=z(),i=o==null?void 0:o.bech32Address,a=(0,$.useMutation)(["USE_INSTANTIATE_CONTRACT",e,n,r,t,i],c=>{if(!i)throw new Error("senderAddress is undefined");let u={...c,fee:c.fee??"auto",senderAddress:i,codeId:t};return Je(u)},{onError:(c,u)=>Promise.resolve(e==null?void 0:e(c,u)),onMutate:n,onSuccess:c=>Promise.resolve(r==null?void 0:r(c))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,instantiateContract:a.mutate,instantiateContractAsync:a.mutateAsync,status:a.status}},wo=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=z(),i=o==null?void 0:o.bech32Address,a=(0,$.useMutation)(["USE_EXECUTE_CONTRACT",e,n,r,t,i],c=>{if(!i)throw new Error("senderAddress is undefined");let u={...c,fee:c.fee??"auto",senderAddress:i,contractAddress:t,memo:c.memo??"",funds:c.funds??[]};return et(u)},{onError:(c,u)=>Promise.resolve(e==null?void 0:e(c,u)),onMutate:n,onSuccess:c=>Promise.resolve(r==null?void 0:r(c))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,executeContract:a.mutate,executeContractAsync:a.mutateAsync,status:a.status}},Co=(t,e)=>{let{data:n}=Ne();return(0,$.useQuery)(["USE_QUERY_SMART",t,e,n],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return tt(t,e,n)},{enabled:!!t&&!!e&&!!n})},So=(t,e)=>{let{data:n}=Ne();return(0,$.useQuery)(["USE_QUERY_RAW",e,t,n],({queryKey:[,i]})=>{if(!t||!e)throw new Error("address or key undefined");return nt(t,e,n)},{enabled:!!t&&!!e&&!!n})};var ft=require("@cosmjs/cosmwasm-stargate"),se=require("@cosmjs/stargate"),he=require("@tanstack/react-query"),ye=require("react");var Ao=t=>{let e=g(o=>o.activeChain),n=f(o=>o.walletType),r=(0,ye.useMemo)(()=>["USE_STARGATE_SIGNING_CLIENT",e,n,t],[t,e,n]);return(0,he.useQuery)({queryKey:r,queryFn:async({queryKey:[,o,i,s]})=>{if(!o)throw new Error("No chain found");if(!W(i))throw new Error(`${i} is not available`);let c=await(async()=>{switch(t==null?void 0:t.offlineSigner){case"offlineSigner":return T(i).getOfflineSigner(o.chainId);case"offlineSignerAuto":return T(i).getOfflineSignerAuto(o.chainId);case"offlineSignerOnlyAmino":return T(i).getOfflineSignerOnlyAmino(o.chainId);default:return T(i).getOfflineSignerAuto(o.chainId)}})(),u={url:o.rpc,headers:{...o.rpcHeaders||{}}};return await se.SigningStargateClient.connectWithSigner(u,c,s==null?void 0:s.opts)},enabled:!!e&&!!n,refetchOnWindowFocus:!1})},Eo=t=>{let e=g(o=>o.activeChain),n=f(o=>o.walletType),r=(0,ye.useMemo)(()=>["USE_COSMWASM_SIGNING_CLIENT",e,n,t],[t,e,n]);return(0,he.useQuery)({queryKey:r,queryFn:async({queryKey:[,o,i,s]})=>{if(!o)throw new Error("No chain found");if(!W(i))throw new Error(`${i} is not available`);let c=await(async()=>{switch(t==null?void 0:t.offlineSigner){case"offlineSigner":return T(i).getOfflineSigner(o.chainId);case"offlineSignerAuto":return T(i).getOfflineSignerAuto(o.chainId);case"offlineSignerOnlyAmino":return T(i).getOfflineSignerOnlyAmino(o.chainId);default:return T(i).getOfflineSignerAuto(o.chainId)}})(),u={url:o.rpc,headers:{...o.rpcHeaders||{}}},h=o.gas?se.GasPrice.fromString(`${o.gas.price}${o.gas.denom}`):void 0;return await ft.SigningCosmWasmClient.connectWithSigner(u,c,{gasPrice:h,...(s==null?void 0:s.opts)||{}})},enabled:!!e&&!!n,refetchOnWindowFocus:!1})},Io=t=>{let e=g(i=>i.activeChain),n=f(i=>i.walletType),r=(0,ye.useMemo)(()=>["USE_STARGATE_TM_SIGNING_CLIENT",e,n,t],[t,e,n]),{data:o}=Me(t.type);return(0,he.useQuery)({queryKey:r,queryFn:async({queryKey:[,i,s,a]})=>{if(!i)throw new Error("No chain found");if(!W(s))throw new Error(`${s} is not available`);if(!o)throw new Error("No tendermint client found");let u=await(async()=>{switch(t.offlineSigner){case"offlineSigner":return T(s).getOfflineSigner(i.chainId);case"offlineSignerAuto":return T(s).getOfflineSignerAuto(i.chainId);case"offlineSignerOnlyAmino":return T(s).getOfflineSignerOnlyAmino(i.chainId);default:return T(s).getOfflineSignerAuto(i.chainId)}})();return se.SigningStargateClient.createWithSigner(o,u,a.opts)},enabled:!!e&&!!n&&!!o,refetchOnWindowFocus:!1})},bo=t=>{let e=g(i=>i.activeChain),n=f(i=>i.walletType),r=(0,ye.useMemo)(()=>["USE_COSMWASM_TM_SIGNING_CLIENT",e,n,t],[t,e,n]),{data:o}=Me(t.type);return(0,he.useQuery)({queryKey:r,queryFn:async({queryKey:[,i,s,a]})=>{if(!i)throw new Error("No chain found");if(!W(s))throw new Error(`${s} is not available`);if(!o)throw new Error("No tendermint client found");let u=await(async()=>{switch(t.offlineSigner){case"offlineSigner":return T(s).getOfflineSigner(i.chainId);case"offlineSignerAuto":return T(s).getOfflineSignerAuto(i.chainId);case"offlineSignerOnlyAmino":return T(s).getOfflineSignerOnlyAmino(i.chainId);default:return T(s).getOfflineSignerAuto(i.chainId)}})(),h=i.gas?se.GasPrice.fromString(`${i.gas.price}${i.gas.denom}`):void 0;return ft.SigningCosmWasmClient.createWithSigner(o,u,{gasPrice:h,...(a==null?void 0:a.opts)||{}})},enabled:!!e&&!!n&&!!o,refetchOnWindowFocus:!1})};var _e=require("@tanstack/react-query"),hn=require("@tanstack/react-query-devtools");var De=require("react"),Fe=require("react/jsx-runtime"),fn=({children:t})=>{let[e,n]=(0,De.useState)(!1);return(0,De.useEffect)(()=>{n(!0)},[]),(0,Fe.jsx)(Fe.Fragment,{children:e?t:null})};var dt=require("react");var dn=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem(Y)==="Active",{_reconnect:e,_onReconnectFailed:n,_reconnectConnector:r}=f(),{activeChain:o,wcSignClient:i}=g(),s=W(r||void 0);return(0,dt.useEffect)(()=>{if(r){if(!s)return;t&&o?B({onError:n}):!t&&e&&B({onError:n})}},[s]),(0,dt.useEffect)(()=>{var a,c,u,h,A,C,x,N,ce,Z;if(r){if(!s)return;r==="cosmostation"&&((c=(a=me()).subscription)==null||c.call(a,()=>{B({onError:n})})),r==="keplr"&&((h=(u=pe()).subscription)==null||h.call(u,()=>{B({onError:n})})),r==="leap"&&((C=(A=ge()).subscription)==null||C.call(A,()=>{B({onError:n})})),r==="vectis"&&((N=(x=fe()).subscription)==null||N.call(x,()=>{B({onError:n})})),r==="walletconnect"&&i&&((Z=(ce=U()).subscription)==null||Z.call(ce,()=>{B({onError:n})}))}},[r,i,s]),null},ht=()=>(dn(),null);var ae=require("react/jsx-runtime"),To=new _e.QueryClient({}),xo=({children:t,grazOptions:e,debug:n,...r})=>(e&&Ze(e),(0,ae.jsxs)(_e.QueryClientProvider,{client:To,...r,children:[(0,ae.jsxs)(fn,{children:[t,(0,ae.jsx)(ht,{})]}),n?(0,ae.jsx)(hn.ReactQueryDevtools,{initialIsOpen:!1,position:"bottom-right"}):null]},"graz-provider"));0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,clearSession,configureGraz,connect,defineChain,defineChainInfo,defineChains,disconnect,executeContract,getActiveChainCurrency,getAvailableWallets,getCosmostation,getKeplr,getLeap,getMetamaskSnapLeap,getOfflineSigners,getQueryRaw,getQuerySmart,getRecentChain,getVectis,getWCCosmostation,getWCKeplr,getWCLeap,getWallet,getWalletConnect,instantiateContract,mainnetChains,mainnetChainsArray,reconnect,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useActiveWalletType,useBalance,useBalanceStaked,useBalances,useCheckWallet,useConnect,useCosmWasmClient,useCosmWasmSigningClient,useCosmWasmTmSigningClient,useDisconnect,useExecuteContract,useGrazEvents,useInstantiateContract,useOfflineSigners,useQueryRaw,useQuerySmart,useRecentChain,useSendIbcTokens,useSendTokens,useStargateClient,useStargateSigningClient,useStargateTmSigningClient,useSuggestChain,useSuggestChainAndConnect,useTendermintClient});
|
|
1
|
+
"use strict";var wn=Object.create;var Ae=Object.defineProperty;var Cn=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var An=Object.getPrototypeOf,En=Object.prototype.hasOwnProperty;var In=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),bn=(t,e)=>{for(var n in e)Ae(t,n,{get:e[n],enumerable:!0})},Ct=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Sn(e))!En.call(t,o)&&o!==n&&Ae(t,o,{get:()=>e[o],enumerable:!(r=Cn(e,o))||r.enumerable});return t};var Ee=(t,e,n)=>(n=t!=null?wn(An(t)):{},Ct(e||!t||!t.__esModule?Ae(n,"default",{value:t,enumerable:!0}):n,t)),Tn=t=>Ct(Ae({},"__esModule",{value:!0}),t);var be=In((Bo,Wt)=>{"use strict";Wt.exports=E;var P=null;try{P=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function E(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}E.prototype.__isLong__;Object.defineProperty(E.prototype,"__isLong__",{value:!0});function _(t){return(t&&t.__isLong__)===!0}E.isLong=_;var At={},Et={};function J(t,e){var n,r,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(r=Et[t],r)?r:(n=I(t,(t|0)<0?-1:0,!0),o&&(Et[t]=n),n)):(t|=0,(o=-128<=t&&t<128)&&(r=At[t],r)?r:(n=I(t,t<0?-1:0,!1),o&&(At[t]=n),n))}E.fromInt=J;function R(t,e){if(isNaN(t))return e?X:q;if(e){if(t<0)return X;if(t>=xt)return kt}else{if(t<=-bt)return F;if(t+1>=bt)return Ot}return t<0?R(-t,e).neg():I(t%ne|0,t/ne|0,e)}E.fromNumber=R;function I(t,e,n){return new E(t,e,n)}E.fromBits=I;var Ie=Math.pow;function Be(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return q;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return Be(t.substring(1),e,n).neg();for(var o=R(Ie(n,8)),i=q,s=0;s<t.length;s+=8){var a=Math.min(8,t.length-s),c=parseInt(t.substring(s,s+a),n);if(a<8){var u=R(Ie(n,a));i=i.mul(u).add(R(c))}else i=i.mul(o),i=i.add(R(c))}return i.unsigned=e,i}E.fromString=Be;function L(t,e){return typeof t=="number"?R(t,e):typeof t=="string"?Be(t,e):I(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}E.fromValue=L;var It=65536,kn=1<<24,ne=It*It,xt=ne*ne,bt=xt/2,Tt=J(kn),q=J(0);E.ZERO=q;var X=J(0,!0);E.UZERO=X;var te=J(1);E.ONE=te;var vt=J(1,!0);E.UONE=vt;var Ue=J(-1);E.NEG_ONE=Ue;var Ot=I(-1,2147483647,!1);E.MAX_VALUE=Ot;var kt=I(-1,-1,!0);E.MAX_UNSIGNED_VALUE=kt;var F=I(0,-2147483648,!1);E.MIN_VALUE=F;var l=E.prototype;l.toInt=function(){return this.unsigned?this.low>>>0:this.low};l.toNumber=function(){return this.unsigned?(this.high>>>0)*ne+(this.low>>>0):this.high*ne+(this.low>>>0)};l.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var n=R(e),r=this.div(n),o=r.mul(n).sub(this);return r.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=R(Ie(e,6),this.unsigned),s=this,a="";;){var c=s.div(i),u=s.sub(c.mul(i)).toInt()>>>0,h=u.toString(e);if(s=c,s.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}};l.getHighBits=function(){return this.high};l.getHighBitsUnsigned=function(){return this.high>>>0};l.getLowBits=function(){return this.low};l.getLowBitsUnsigned=function(){return this.low>>>0};l.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};l.isZero=function(){return this.high===0&&this.low===0};l.eqz=l.isZero;l.isNegative=function(){return!this.unsigned&&this.high<0};l.isPositive=function(){return this.unsigned||this.high>=0};l.isOdd=function(){return(this.low&1)===1};l.isEven=function(){return(this.low&1)===0};l.equals=function(e){return _(e)||(e=L(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};l.eq=l.equals;l.notEquals=function(e){return!this.eq(e)};l.neq=l.notEquals;l.ne=l.notEquals;l.lessThan=function(e){return this.comp(e)<0};l.lt=l.lessThan;l.lessThanOrEqual=function(e){return this.comp(e)<=0};l.lte=l.lessThanOrEqual;l.le=l.lessThanOrEqual;l.greaterThan=function(e){return this.comp(e)>0};l.gt=l.greaterThan;l.greaterThanOrEqual=function(e){return this.comp(e)>=0};l.gte=l.greaterThanOrEqual;l.ge=l.greaterThanOrEqual;l.compare=function(e){if(_(e)||(e=L(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};l.comp=l.compare;l.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(te)};l.neg=l.negate;l.add=function(e){_(e)||(e=L(e));var n=this.high>>>16,r=this.high&65535,o=this.low>>>16,i=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,u=e.low&65535,h=0,A=0,C=0,x=0;return x+=i+u,C+=x>>>16,x&=65535,C+=o+c,A+=C>>>16,C&=65535,A+=r+a,h+=A>>>16,A&=65535,h+=n+s,h&=65535,I(C<<16|x,h<<16|A,this.unsigned)};l.subtract=function(e){return _(e)||(e=L(e)),this.add(e.neg())};l.sub=l.subtract;l.multiply=function(e){if(this.isZero())return q;if(_(e)||(e=L(e)),P){var n=P.mul(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}if(e.isZero())return q;if(this.eq(F))return e.isOdd()?F:q;if(e.eq(F))return this.isOdd()?F:q;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Tt)&&e.lt(Tt))return R(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=this.high&65535,i=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,u=e.low>>>16,h=e.low&65535,A=0,C=0,x=0,N=0;return N+=s*h,x+=N>>>16,N&=65535,x+=i*h,C+=x>>>16,x&=65535,x+=s*u,C+=x>>>16,x&=65535,C+=o*h,A+=C>>>16,C&=65535,C+=i*u,A+=C>>>16,C&=65535,C+=s*c,A+=C>>>16,C&=65535,A+=r*h+o*u+i*c+s*a,A&=65535,I(x<<16|N,A<<16|C,this.unsigned)};l.mul=l.multiply;l.divide=function(e){if(_(e)||(e=L(e)),e.isZero())throw Error("division by zero");if(P){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?P.div_u:P.div_s)(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?X:q;var r,o,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return X;if(e.gt(this.shru(1)))return vt;i=X}else{if(this.eq(F)){if(e.eq(te)||e.eq(Ue))return F;if(e.eq(F))return te;var s=this.shr(1);return r=s.div(e).shl(1),r.eq(q)?e.isNegative()?te:Ue:(o=this.sub(e.mul(r)),i=r.add(o.div(e)),i)}else if(e.eq(F))return this.unsigned?X:q;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=q}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:Ie(2,a-48),u=R(r),h=u.mul(e);h.isNegative()||h.gt(o);)r-=c,u=R(r,this.unsigned),h=u.mul(e);u.isZero()&&(u=te),i=i.add(u),o=o.sub(h)}return i};l.div=l.divide;l.modulo=function(e){if(_(e)||(e=L(e)),P){var n=(this.unsigned?P.rem_u:P.rem_s)(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};l.mod=l.modulo;l.rem=l.modulo;l.not=function(){return I(~this.low,~this.high,this.unsigned)};l.and=function(e){return _(e)||(e=L(e)),I(this.low&e.low,this.high&e.high,this.unsigned)};l.or=function(e){return _(e)||(e=L(e)),I(this.low|e.low,this.high|e.high,this.unsigned)};l.xor=function(e){return _(e)||(e=L(e)),I(this.low^e.low,this.high^e.high,this.unsigned)};l.shiftLeft=function(e){return _(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?I(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):I(0,this.low<<e-32,this.unsigned)};l.shl=l.shiftLeft;l.shiftRight=function(e){return _(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?I(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):I(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};l.shr=l.shiftRight;l.shiftRightUnsigned=function(e){if(_(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return I(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?I(n,0,this.unsigned):I(n>>>e-32,0,this.unsigned)};l.shru=l.shiftRightUnsigned;l.shr_u=l.shiftRightUnsigned;l.toSigned=function(){return this.unsigned?I(this.low,this.high,!1):this};l.toUnsigned=function(){return this.unsigned?this:I(this.low,this.high,!0)};l.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};l.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};l.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};E.fromBytes=function(e,n,r){return r?E.fromBytesLE(e,n):E.fromBytesBE(e,n)};E.fromBytesLE=function(e,n){return new E(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};E.fromBytesBE=function(e,n){return new E(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)}});var vo={};bn(vo,{GrazEvents:()=>ht,GrazProvider:()=>xo,WALLET_TYPES:()=>qe,WalletType:()=>Re,checkWallet:()=>W,clearRecentChain:()=>He,clearSession:()=>M,configureGraz:()=>Ze,connect:()=>oe,defineChain:()=>Zn,defineChainInfo:()=>Yn,defineChains:()=>gt,disconnect:()=>Te,executeContract:()=>et,getActiveChainCurrency:()=>Ve,getAvailableWallets:()=>Wn,getCosmostation:()=>me,getKeplr:()=>pe,getLeap:()=>ge,getMetamaskSnapLeap:()=>Ge,getOfflineSigners:()=>Qe,getQueryRaw:()=>nt,getQuerySmart:()=>tt,getRecentChain:()=>Nn,getVectis:()=>fe,getWCCosmostation:()=>je,getWCKeplr:()=>Ke,getWCLeap:()=>ze,getWallet:()=>T,getWalletConnect:()=>U,instantiateContract:()=>Je,mainnetChains:()=>Xn,mainnetChainsArray:()=>Jn,reconnect:()=>B,sendIbcTokens:()=>Xe,sendTokens:()=>Ye,suggestChain:()=>xe,suggestChainAndConnect:()=>$e,testnetChains:()=>eo,testnetChainsArray:()=>to,useAccount:()=>z,useActiveChain:()=>co,useActiveChainCurrency:()=>lo,useActiveChainValidators:()=>uo,useActiveWalletType:()=>no,useBalance:()=>oo,useBalanceStaked:()=>ao,useBalances:()=>gn,useCheckWallet:()=>de,useConnect:()=>ro,useCosmWasmClient:()=>Ne,useCosmWasmSigningClient:()=>Eo,useCosmWasmTmSigningClient:()=>bo,useDisconnect:()=>io,useExecuteContract:()=>wo,useGrazEvents:()=>dn,useInstantiateContract:()=>yo,useOfflineSigners:()=>so,useQueryRaw:()=>So,useQuerySmart:()=>Co,useRecentChain:()=>mo,useSendIbcTokens:()=>ho,useSendTokens:()=>fo,useStargateClient:()=>We,useStargateSigningClient:()=>Ao,useStargateTmSigningClient:()=>Io,useSuggestChain:()=>po,useSuggestChainAndConnect:()=>go,useTendermintClient:()=>Me});module.exports=Tn(vo);var Y="graz-reconnect-session";var Le=require("zustand"),St=require("zustand/middleware"),ee=require("zustand/middleware");var Re=(u=>(u.KEPLR="keplr",u.LEAP="leap",u.VECTIS="vectis",u.COSMOSTATION="cosmostation",u.WALLETCONNECT="walletconnect",u.WC_KEPLR_MOBILE="wc_keplr_mobile",u.WC_LEAP_MOBILE="wc_leap_mobile",u.WC_COSMOSTATION_MOBILE="wc_cosmostation_mobile",u.METAMASK_SNAP_LEAP="metamask_snap_leap",u))(Re||{}),qe=["keplr","leap","vectis","cosmostation","walletconnect","wc_keplr_mobile","wc_leap_mobile","wc_cosmostation_mobile","metamask_snap_leap"];var xn={recentChain:null,defaultChain:null,defaultSigningClient:"stargate",walletType:"keplr",walletConnect:{options:null,web3Modal:null},_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},ue={account:null,activeChain:null,balances:null,status:"disconnected",wcSignClient:null},vn={name:"graz-session",version:1,partialize:t=>({account:t.account,activeChain:t.activeChain}),storage:(0,St.createJSONStorage)(()=>sessionStorage)},On={name:"graz-internal",partialize:t=>({recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:1},g=(0,Le.create)((0,ee.subscribeWithSelector)((0,ee.persist)(()=>ue,vn))),f=(0,Le.create)((0,ee.subscribeWithSelector)((0,ee.persist)(()=>xn,On)));var me=()=>{if(typeof window.cosmostation.providers.keplr<"u"){let t=window.cosmostation.providers.keplr;return Object.assign(t,{subscription:r=>(window.cosmostation.cosmos.on("accountChanged",()=>{M(),r()}),()=>{window.cosmostation.cosmos.off("accountChanged",()=>{M(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")};var pe=()=>{if(typeof window.keplr<"u"){let t=window.keplr;return Object.assign(t,{subscription:r=>(window.addEventListener("keplr_keystorechange",()=>{M(),r()}),()=>{window.removeEventListener("keplr_keystorechange",()=>{M(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.keplr is not defined")};var ge=()=>{if(typeof window.leap<"u"){let t=window.leap;return Object.assign(t,{subscription:r=>(window.addEventListener("leap_keystorechange",()=>{M(),r()}),()=>{window.removeEventListener("leap_keystorechange",()=>{M(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.leap is not defined")};var Nt=Ee(be());var Mt=t=>{let e=window.ethereum;if(e&&t){let n=async()=>await e.request({method:"wallet_getSnaps"}),r=async y=>{try{let S=await n();return Object.values(S).find(O=>O.id===t.id&&(!y||O.version===y))}catch{return}},o=async()=>{await e.request({method:"wallet_requestSnaps",params:{[t.id]:t.params||{}}})},i=async()=>{let y=await e.request({method:"web3_clientVersion"});if(!(y==null?void 0:y.includes("flask")))throw new Error("Metamask Flask is not detected");return!0},s=async y=>{await r()||await o()},a=async(y,S,O)=>{let G=await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"signDirect",params:{chainId:y,signerAddress:S,signDoc:O}}}}),Q=O.accountNumber,le=new Nt.default(Q.low,Q.high,Q.unsigned);return{signature:G.signature,signed:{...G.signed,accountNumber:`${le.toString()}`,authInfoBytes:new Uint8Array(Object.values(G.signed.authInfoBytes)),bodyBytes:new Uint8Array(Object.values(G.signed.bodyBytes))}}},c=async(y,S,O)=>await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"signAmino",params:{chainId:y,signerAddress:S,signDoc:O}}}}),u=async y=>{let S=await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"getKey",params:{chainId:y}}}});if(!S)throw new Error("No response from Metamask");return S.pubKey=Uint8Array.from(Object.values(S.pubkey)),delete S.pubkey,{...S}},h=async y=>{let S=await u(y);return{address:S.bech32Address,algo:S.algo,pubkey:S.pubKey}},A=async(...y)=>{let[S,O,G,Q]=y;return await c(S,O,G)},C=async(...y)=>{let[S,O,G]=y;return await a(S,O,G)},x=y=>({getAccounts:async()=>[await h(y)],signDirect:(S,O)=>C(y,S,O)}),N=y=>({getAccounts:async()=>[await h(y)],signAmino:(S,O)=>A(y,S,O)});return{getKey:u,getOfflineSigner:y=>({getAccounts:async()=>[await h(y)],signDirect:(S,O)=>C(y,S,O),signAmino:(S,O)=>A(y,S,O)}),getOfflineSignerAuto:async y=>(await u(y)).isNanoLedger?N(y):x(y),getOfflineSignerOnlyAmino:N,signDirect:C,signAmino:A,enable:s,experimentalSuggestChain:async(...y)=>{await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"suggestChain",params:{chainInfo:y[0]}}}})},init:i}}throw f.getState()._notFoundFn(),new Error("window.ethereum is not defined")};var Ge=()=>Mt({id:"npm:@leapwallet/metamask-cosmos-snap"});var Dt=require("@cosmjs/encoding"),Ft=Ee(be());var fe=()=>{if(typeof window.vectis<"u"){let t=window.vectis.cosmos;return{enable:a=>t.enable(a),getOfflineSigner:a=>t.getOfflineSigner(a),getOfflineSignerAuto:a=>t.getOfflineSignerAuto(a),getKey:async a=>{let c=await t.getKey(a);return{address:(0,Dt.fromBech32)(c.address).data,algo:c.algo,bech32Address:c.address,name:c.name,pubKey:c.pubKey,isKeystone:!1,isNanoLedger:c.isNanoLedger}},subscription:a=>(window.addEventListener("vectis_accountChanged",()=>{M(),a()}),()=>{window.removeEventListener("vectis_accountChanged",()=>{M(),a()})}),getOfflineSignerOnlyAmino:(...a)=>t.getOfflineSignerAmino(...a),experimentalSuggestChain:async(...a)=>{let[c]=a,u={...c,rpcUrl:c.rpc,restUrl:c.rest,prettyName:c.chainName.replace(" ",""),bech32Prefix:c.bech32Config.bech32PrefixAccAddr};return t.suggestChains([u])},signDirect:async(...a)=>{var h;let{1:c,2:u}=a;return t.signDirect(c,{bodyBytes:u.bodyBytes||Uint8Array.from([]),authInfoBytes:u.authInfoBytes||Uint8Array.from([]),accountNumber:Ft.default.fromString(((h=u.accountNumber)==null?void 0:h.toString())||"",!1),chainId:u.chainId||""})},signAmino:async(...a)=>{let{1:c,2:u}=a;return t.signAmino(c,u)}}}throw f.getState()._notFoundFn(),new Error("window.vectis is not defined")};var qt=require("@cosmjs/encoding"),Lt=require("@walletconnect/sign-client"),Ut=require("@walletconnect/utils"),Bt=Ee(be());var j=()=>typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1,_t=()=>j()&&navigator.userAgent.toLowerCase().includes("android"),Pt=()=>j()&&(navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad"));var Rt=(t,e,n=new Error("Promise timed out"))=>{let r=new Promise((o,i)=>{setTimeout(()=>{i(n)},e)});return Promise.race([t,r])};var U=t=>{var Q,le,wt;if(!((wt=(le=(Q=f.getState().walletConnect)==null?void 0:Q.options)==null?void 0:le.projectId)!=null&&wt.trim()))throw new Error("walletConnect.options.projectId is not defined");let e=(t==null?void 0:t.encoding)||"base64",n=p=>{if(!t)return;let{appUrl:m,formatNativeUrl:d}=t;if(j()){if(_t())if(!p)window.open(m.mobile.android,"_self","noreferrer noopener");else{let w=d(m.mobile.android,p,"android");window.open(w,"_self","noreferrer noopener")}if(Pt())if(!p)window.open(m.mobile.ios,"_self","noreferrer noopener");else{let w=d(m.mobile.ios,p,"ios");window.open(w,"_self","noreferrer noopener")}}},r=()=>{let{wcSignClient:p}=g.getState();if(!p)throw new Error("walletConnect.signClient is not defined");M(),f.setState({_reconnect:!1,_reconnectConnector:null,recentChain:null})},o=async p=>{let{wcSignClient:m}=g.getState();if(!m)throw new Error("walletConnect.signClient is not defined");if(!p)throw new Error("No wallet connect session");await m.disconnect({topic:p,reason:(0,Ut.getSdkError)("USER_DISCONNECTED")}),await a(m),r()},i=p=>{var m,d;try{let{wcSignClient:w}=g.getState();if(!w)throw new Error("walletConnect.signClient is not defined");let b=w.session.getAll().at(-1);if(!b)return;let v=(d=(m=w.session.getAll().at(-1))==null?void 0:m.namespaces.cosmos)==null?void 0:d.accounts.find(k=>k.startsWith(`cosmos:${p}`));if(!(b.expiry*1e3>Date.now()+1e3))throw o(b.topic),new Error("invalid session");if(!v)try{let k=w.find({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!k.length)throw new Error("no session");return k.at(-1)}catch(k){if(!k.message.toLowerCase().includes("no matching key"))throw k}return b}catch(w){if(!w.message.toLowerCase().includes("no matching key"))throw w}},s=p=>{try{return i(p)}catch{return}},a=async p=>{try{let m=p.core.pairing.pairings.getAll({active:!1});if(!m.length)return;await Promise.all(m.map(async d=>{await p.core.pairing.pairings.delete(d.topic,{code:7001,message:"clear pairing"})}))}catch(m){if(!m.message.toLowerCase().includes("no matching key"))throw m}},c=async()=>{let{walletConnect:p}=f.getState();if(!(p!=null&&p.options))throw new Error("walletConnect.options is not defined");let{wcSignClient:m}=g.getState();if(m)return g.setState({wcSignClient:m}),m;let d=await Lt.SignClient.init(p.options);return g.setState({wcSignClient:d}),d},u=p=>{let{wcSignClient:m}=g.getState();if(m)return m.events.on("session_delete",d=>{r()}),m.events.on("session_expire",d=>{r()}),m.events.on("session_event",d=>{var w,b;if(d.params.event.name==="accountsChanged"&&((w=d.params.event.data)==null?void 0:w[0])!==((b=g.getState().account)==null?void 0:b.bech32Address)){let v=d.params.chainId.split(":")[1];v&&h(v)}else p()}),()=>{m.events.off("session_delete",d=>{r()}),m.events.off("session_expire",d=>{r()}),m.events.off("session_event",d=>{var w,b;if(d.params.event.name==="accountsChanged"&&((w=d.params.event.data)==null?void 0:w[0])!==((b=g.getState().account)==null?void 0:b.bech32Address)){let v=d.params.chainId.split(":")[1];v&&h(v)}else p()})}},h=async p=>{var we;let{wcSignClient:m}=g.getState();if(!m)throw new Error("enable walletConnect.signClient is not defined");let{walletConnect:d}=f.getState();if(!((we=d==null?void 0:d.options)!=null&&we.projectId))throw new Error("walletConnect.options.projectId is not defined");let{Web3Modal:w}=await import("@web3modal/standalone"),b=new w({projectId:d.options.projectId,walletConnectVersion:2,enableExplorer:!1,explorerRecommendedWalletIds:"NONE",...d.web3Modal}),{account:v,activeChain:K}=g.getState(),k=s(p);if((K==null?void 0:K.chainId)!==p&&!k||!v){let{uri:D,approval:Ce}=await m.connect({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!D)throw new Error("No wallet connect uri");t?n(D):await b.openModal({uri:D});let yn=async H=>H.aborted?Promise.reject(new Error("User closed wallet connect")):new Promise((Pe,Se)=>{Ce().then(Pe).catch(Se),H.addEventListener("abort",()=>{Se(new Error("User closed wallet connect"))})});try{let H=new AbortController,Pe=H.signal;b.subscribeModal(Se=>{Se.open||H.abort()}),await yn(Pe)}catch(H){if(b.closeModal(),!H.message.toLowerCase().includes("no matching key"))return Promise.reject(H)}return t||b.closeModal(),Promise.resolve()}try{await Rt((async()=>{let D=await C(p);g.setState({account:D})})(),15e3,new Error("Connection timeout"))}catch(D){if(o(k==null?void 0:k.topic),!D.message.toLowerCase().includes("no matching key"))throw D}},A=async p=>{var b;let{wcSignClient:m}=g.getState();if(!m)throw new Error("walletConnect.signClient is not defined");let d=(b=i(p))==null?void 0:b.topic;if(!d)throw new Error("No wallet connect session");n();let w=await m.request({topic:d,chainId:`cosmos:${p}`,request:{method:"cosmos_getAccounts",params:{}}});if(!w[0])throw new Error("No wallet connect account");return{address:w[0].address,algo:w[0].algo,pubkey:new Uint8Array(Buffer.from(w[0].pubkey,e))}},C=async p=>{let{address:m,algo:d,pubkey:w}=await A(p);return{address:(0,qt.fromBech32)(m).data,algo:d,bech32Address:m,name:"",pubKey:w,isKeystone:!1,isNanoLedger:!1}},x=async(...p)=>{var D,Ce;let[m,d,w]=p,{account:b,wcSignClient:v}=g.getState();if(!v)throw new Error("walletConnect.signClient is not defined");if(!b)throw new Error("account is not defined");let K=(D=i(m))==null?void 0:D.topic;if(!K)throw new Error("No wallet connect session");if(!w.bodyBytes)throw new Error("No bodyBytes");if(!w.authInfoBytes)throw new Error("No authInfoBytes");let k={topic:K,chainId:`cosmos:${m}`,request:{method:"cosmos_signDirect",params:{signerAddress:d,signDoc:{...w,bodyBytes:Buffer.from(w.bodyBytes).toString(e),authInfoBytes:Buffer.from(w.authInfoBytes).toString(e),accountNumber:(Ce=w.accountNumber)==null?void 0:Ce.toString()}}}};return n(),await v.request(k)},N=async(...p)=>{let[m,d,w]=p,{signature:b,signed:v}=await x(m,d,w);return{signed:{chainId:v.chainId,accountNumber:Bt.default.fromString(v.accountNumber,!1),authInfoBytes:new Uint8Array(Buffer.from(v.authInfoBytes,e)),bodyBytes:new Uint8Array(Buffer.from(v.bodyBytes,e))},signature:b}},ce=async(...p)=>{var D;let[m,d,w,b]=p,{wcSignClient:v}=g.getState(),{account:K}=g.getState();if(!v)throw new Error("walletConnect.signClient is not defined");if(!K)throw new Error("account is not defined");let k=(D=i(m))==null?void 0:D.topic;if(!k)throw new Error("No wallet connect session");return n(),await v.request({topic:k,chainId:`cosmos:${m}`,request:{method:"cosmos_signDirect",params:{signerAddress:d,signDoc:w}}})},Z=async(...p)=>{let[m,d,w,b]=p;return await ce(m,d,w)},yt=p=>({getAccounts:async()=>[await A(p)],signDirect:(m,d)=>N(p,m,d)}),y=p=>({getAccounts:async()=>[await A(p)],signAmino:(m,d)=>Z(p,m,d)});return{enable:h,experimentalSuggestChain:async(...p)=>{await Promise.reject(new Error("WalletConnect does not support experimentalSuggestChain"))},getKey:C,getOfflineSigner:p=>({getAccounts:async()=>[await A(p)],signDirect:(m,d)=>N(p,m,d),signAmino:(m,d)=>Z(p,m,d)}),getOfflineSignerAuto:async p=>(await C(p)).isNanoLedger?y(p):yt(p),getOfflineSignerOnlyAmino:y,signAmino:Z,signDirect:N,subscription:u,init:c}};var je=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!j())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"hex",appUrl:{mobile:{ios:"cosmostation://",android:"cosmostation://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,i,s)=>`${o.replaceAll("/","").replaceAll(":","")}://wc?${i}`};return U(t)};var Ke=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!j())throw new Error("WalletConnect Keplr mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"keplrwallet://",android:"intent://"}},walletType:"wc_keplr_mobile",formatNativeUrl:(o,i,s)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(i);switch(s){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return U(t)};var ze=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!j())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"leapcosmos://",android:"intent://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,i,s)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(i);switch(s){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return U(t)};var W=(t=f.getState().walletType)=>{try{return T(t),!0}catch{return!1}},M=()=>{window.sessionStorage.removeItem(Y),g.setState(ue)},T=(t=f.getState().walletType)=>{switch(t){case"keplr":return pe();case"leap":return ge();case"cosmostation":return me();case"vectis":return fe();case"walletconnect":return U();case"wc_keplr_mobile":return Ke();case"wc_leap_mobile":return ze();case"wc_cosmostation_mobile":return je();case"metamask_snap_leap":return Ge();default:throw new Error("Unknown wallet type")}},Wn=()=>Object.fromEntries(qe.map(t=>[t,W(t)]));var oe=async t=>{var e;try{let{defaultChain:n,recentChain:r,walletType:o}=f.getState(),i=(t==null?void 0:t.walletType)||o;if(!W(i))throw new Error(`${i} is not available`);let a=T(i),c=(t==null?void 0:t.chain)||r||n;if(!c)throw new Error("No last known connected chain, connect action requires chain info");g.setState(C=>{let x=f.getState()._reconnect||!!f.getState()._reconnectConnector||!!c;return C.activeChain&&C.activeChain.chainId!==c.chainId?{status:"connecting"}:x?{status:"reconnecting"}:{status:"connecting"}});let{account:u,activeChain:h}=g.getState();if(await((e=a.init)==null?void 0:e.call(a)),!u||(h==null?void 0:h.chainId)!==c.chainId){await a.enable(c.chainId);let C=await a.getKey(c.chainId);g.setState({account:C})}f.setState({recentChain:c,walletType:i,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:i}),g.setState({activeChain:c,status:"connected"}),typeof window<"u"&&window.sessionStorage.setItem(Y,"Active");let{account:A}=g.getState();return{account:A,walletType:i,chain:c}}catch(n){throw console.error("connect ",n),g.getState().account===null&&g.setState({status:"disconnected"}),g.getState().account&&g.getState().activeChain&&g.setState({status:"connected"}),n}},Te=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem(Y),g.setState(ue),f.setState(e=>({_reconnect:!1,_reconnectConnector:null,recentChain:t?null:e.recentChain})),Promise.resolve()),B=async t=>{var o;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=f.getState();try{let i=W(n||void 0);if(e&&i&&n)return await oe({chain:e,walletType:n,autoReconnect:r})}catch(i){(o=t==null?void 0:t.onError)==null||o.call(t,i),Te()}},Qe=async t=>{if(!(t!=null&&t.chainId))throw new Error("chainId is required");let{walletType:e}=f.getState(),n=t.walletType||e;if(!W(n))throw new Error(`${n} is not available`);let o=T(n),i=o.getOfflineSigner(t.chainId),s=o.getOfflineSignerOnlyAmino(t.chainId),a=await o.getOfflineSignerAuto(t.chainId);return{offlineSigner:i,offlineSignerAmino:s,offlineSignerAuto:a}};var He=()=>{f.setState({recentChain:null})},Ve=t=>{let{activeChain:e}=g.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},Nn=()=>f.getState().recentChain,xe=async t=>(await T().experimentalSuggestChain(t),t),$e=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...o})=>{let i=await xe(t);return{...await oe({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...o}),chain:i}};var Ze=(t={})=>(f.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletConnect:t.walletConnect||e.walletConnect,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var Ye=async({signingClient:t,senderAddress:e,recipientAddress:n,amount:r,fee:o,memo:i})=>{if(!t)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return t.sendTokens(e,n,r,o,i)},Xe=async({signingClient:t,senderAddress:e,recipientAddress:n,transferAmount:r,sourcePort:o,sourceChannel:i,timeoutHeight:s,timeoutTimestamp:a,fee:c,memo:u})=>{if(!t)throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return t.sendIbcTokens(e,n,r,o,i,s,a,c,u)},Je=async({signingClient:t,senderAddress:e,msg:n,fee:r,options:o,label:i,codeId:s})=>{if(!t)throw new Error("CosmWasm signing client is not ready");return t.instantiate(e,s,n,i,r,o)},et=async({signingClient:t,senderAddress:e,msg:n,fee:r,contractAddress:o,funds:i,memo:s})=>{if(!t)throw new Error("CosmWasm signing client is not ready");return t.execute(e,o,n,r,s,i)},tt=async(t,e,n)=>{if(!n)throw new Error("CosmWasm client is not ready");return await n.queryContractSmart(t,e)},nt=(t,e,n)=>{if(!n)throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.queryContractRaw(t,r)};var jt=require("@keplr-wallet/cosmos"),Kt={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Mn={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Dn={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Fn={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},_n={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Pn={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},Gt=[Kt,Mn,Dn,Fn,_n,Pn],ot={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:Kt,bip44:{coinType:118},bech32Config:jt.Bech32Address.defaultBech32Config("axelar"),currencies:Gt,feeCurrencies:Gt};var Qt=require("@keplr-wallet/cosmos"),Ht={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},zt=[Ht],rt={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:Ht,bip44:{coinType:118},bech32Config:Qt.Bech32Address.defaultBech32Config("cosmos"),currencies:zt,feeCurrencies:zt};var $t=require("@keplr-wallet/cosmos"),Zt={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Rn={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},qn={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Ln={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Un={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Bn={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Gn={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},jn={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Kn={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},zn={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Qn={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},Vt=[Zt,Rn,qn,Ln,Un,Bn,Gn,jn,Kn,zn,Qn],it={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:Zt,bip44:{coinType:118},bech32Config:$t.Bech32Address.defaultBech32Config("juno"),currencies:Vt,feeCurrencies:Vt};var Xt=require("@keplr-wallet/cosmos"),Jt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Hn={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Yt=[Jt,Hn],st={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Jt,bip44:{coinType:118},bech32Config:Xt.Bech32Address.defaultBech32Config("osmo"),currencies:Yt,feeCurrencies:Yt};var tn=require("@keplr-wallet/cosmos"),nn={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},en=[nn],at={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:nn,bip44:{coinType:118},bech32Config:tn.Bech32Address.defaultBech32Config("somm"),currencies:en,feeCurrencies:en};var rn=require("@keplr-wallet/cosmos"),sn={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},on=[sn],ct={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:rn.Bech32Address.defaultBech32Config("CRE"),currencies:on,feeCurrencies:on,stakeCurrency:sn,coinType:118};var an=require("@keplr-wallet/cosmos"),lt={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Vn=[lt],ut={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:lt,bip44:{coinType:118},bech32Config:an.Bech32Address.defaultBech32Config("juno"),currencies:Vn,feeCurrencies:[lt],coinType:118};var cn=require("@keplr-wallet/cosmos"),mt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},$n=[mt],pt={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:mt,bip44:{coinType:118},bech32Config:cn.Bech32Address.defaultBech32Config("osmo"),currencies:$n,feeCurrencies:[mt],coinType:118};var gt=t=>t,Zn=t=>t,Yn=t=>t,Xn=gt({axelar:ot,cosmoshub:rt,juno:it,osmosis:st,sommelier:at}),Jn=[ot,rt,it,st,at],eo=gt({crescent:ct,juno:ut,osmosis:pt}),to=[ct,ut,pt];var V=require("@tanstack/react-query"),re=require("react");var ln=require("@cosmjs/cosmwasm-stargate"),un=require("@cosmjs/stargate"),ve=require("@cosmjs/tendermint-rpc"),Oe=require("@tanstack/react-query"),ke=require("react");var We=()=>{let t=g(n=>n.activeChain),e=(0,ke.useMemo)(()=>["USE_STARGATE_CLIENT",t],[t]);return(0,Oe.useQuery)({queryKey:e,queryFn:async({queryKey:[,n]})=>{if(!n)throw new Error("No chain found");let r={url:n.rpc,headers:{...n.rpcHeaders||{}}};return await un.StargateClient.connect(r)},enabled:!!t,refetchOnWindowFocus:!1})},Ne=()=>{let t=g(n=>n.activeChain),e=(0,ke.useMemo)(()=>["USE_COSMWASM_CLIENT",t],[t]);return(0,Oe.useQuery)({queryKey:e,queryFn:async({queryKey:[,n]})=>{if(!n)throw new Error("No chain found");let r={url:n.rpc,headers:{...n.rpcHeaders||{}}};return await ln.CosmWasmClient.connect(r)},enabled:!!t,refetchOnWindowFocus:!1})},Me=t=>{let e=g(r=>r.activeChain),n=(0,ke.useMemo)(()=>["USE_TENDERMINT_CLIENT",t,e],[t,e]);return(0,Oe.useQuery)({queryKey:n,queryFn:async({queryKey:[,r,o]})=>{if(!o)throw new Error("No chain found");let i={url:o.rpc,headers:{...o.rpcHeaders||{}}};return await(r==="tm37"?ve.Tendermint37Client:ve.Tendermint34Client).connect(i)},enabled:!!e,refetchOnWindowFocus:!1})};var mn=require("@tanstack/react-query"),pn=require("zustand/shallow");var no=()=>f(t=>({walletType:t.walletType,isCosmostation:t.walletType==="cosmostation",isCosmostationMobile:t.walletType==="wc_cosmostation_mobile",isKeplr:t.walletType==="keplr",isKeplrMobile:t.walletType==="wc_keplr_mobile",isLeap:t.walletType==="leap",isLeapMobile:t.walletType==="wc_leap_mobile",isVectis:t.walletType==="vectis",isWalletConnect:t.walletType==="walletconnect"}),pn.shallow),de=t=>{let n=["USE_CHECK_WALLET",f(o=>t||o.walletType)];return(0,mn.useQuery)(n,({queryKey:[,o]})=>W(o))};var z=({onConnect:t,onDisconnect:e}={})=>{let n=g(o=>o.account),r=g(o=>o.status);return(0,re.useEffect)(()=>g.subscribe(o=>o.status,(o,i)=>{if(o==="connected"){let{account:s,activeChain:a}=g.getState(),{walletType:c}=f.getState();t==null||t({account:s,chain:a,walletType:c,isReconnect:i==="reconnecting"})}o==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:B,status:r}},gn=t=>{let{data:e}=z(),{data:n}=We(),{activeChain:r}=g.getState(),o=t||(e==null?void 0:e.bech32Address),i=(0,re.useMemo)(()=>["USE_ALL_BALANCES",n,r,o],[r,o,n]);return(0,V.useQuery)(i,async({queryKey:[,a,c,u]})=>{if(!c||!a)throw new Error("No connected account detected");if(!u)throw new Error("address is not defined");return await a.getAllBalances(u)},{enabled:!!o&&!!r&&!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})},oo=(t,e)=>{let{data:n}=z(),r=e||(n==null?void 0:n.bech32Address),{data:o,refetch:i}=gn(r),a=(0,V.useQuery)(["USE_BALANCE",o,t,e],({queryKey:[,c]})=>c==null?void 0:c.find(u=>u.denom===t),{enabled:!!o});return{...a,refetch:async()=>(await i(),a.refetch())}},ro=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,V.useMutation)(["USE_CONNECT",t,e,n],oe,{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=de();return{connect:s=>o.mutate(s),connectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!i,status:o.status}},io=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,V.useMutation)(["USE_DISCONNECT",t,e,n],Te,{onError:i=>Promise.resolve(t==null?void 0:t(i,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:i=>o.mutate(i),disconnectAsync:i=>o.mutateAsync(i),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,status:o.status}},so=()=>{let t=g(r=>r.activeChain),e=f(r=>r.walletType),n=(0,re.useMemo)(()=>["USE_OFFLINE_SIGNERS",t,e],[t,e]);return(0,V.useQuery)({queryKey:n,queryFn:async({queryKey:[,r,o]})=>{if(!r)throw new Error("No chain found");if(!W(o))throw new Error(`${o} is not available`);return await Qe({chainId:r.chainId,walletType:o})},enabled:!!t&&!!e,refetchOnWindowFocus:!1})},ao=t=>{let{data:e}=z(),{data:n}=We(),{activeChain:r}=g.getState(),o=t||(e==null?void 0:e.bech32Address),i=(0,re.useMemo)(()=>["USE_BALANCE_STAKED",n,r,o],[r,o,n]);return(0,V.useQuery)(i,async({queryKey:[,a,c,u]})=>{if(!c||!a)throw new Error("No connected account detected");if(!u)throw new Error("address is not defined");return await a.getBalanceStaked(u)},{enabled:!!o&&!!r&&!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})};var ie=require("@tanstack/react-query");var co=()=>g(t=>t.activeChain),lo=t=>(0,ie.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>Ve(r)),uo=(t,e="BOND_STATUS_BONDED")=>(0,ie.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],async({queryKey:[,o,i]})=>{if(!o)throw new Error("Query client is not defined");return await o.staking.validators(i)},{enabled:typeof t<"u"}),mo=()=>({data:f(e=>e.recentChain),clear:He}),po=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,ie.useMutation)(["USE_SUGGEST_CHAIN",t,e,n],xe,{onError:(i,s)=>Promise.resolve(t==null?void 0:t(i,s)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,suggest:o.mutate,suggestAsync:o.mutateAsync,status:o.status}},go=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,ie.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],$e,{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:s=>e==null?void 0:e(s),onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=de();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!i,status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}};var $=require("@tanstack/react-query");var fo=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=z(),o=r==null?void 0:r.bech32Address,i=(0,$.useMutation)(["USE_SEND_TOKENS",t,e,n,o],s=>Ye({senderAddress:o,...s}),{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},ho=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=z(),o=r==null?void 0:r.bech32Address,i=(0,$.useMutation)(["USE_SEND_IBC_TOKENS",t,e,n,o],s=>Xe({senderAddress:o,...s}),{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},yo=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=z(),i=o==null?void 0:o.bech32Address,a=(0,$.useMutation)(["USE_INSTANTIATE_CONTRACT",e,n,r,t,i],c=>{if(!i)throw new Error("senderAddress is undefined");let u={...c,fee:c.fee??"auto",senderAddress:i,codeId:t};return Je(u)},{onError:(c,u)=>Promise.resolve(e==null?void 0:e(c,u)),onMutate:n,onSuccess:c=>Promise.resolve(r==null?void 0:r(c))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,instantiateContract:a.mutate,instantiateContractAsync:a.mutateAsync,status:a.status}},wo=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=z(),i=o==null?void 0:o.bech32Address,a=(0,$.useMutation)(["USE_EXECUTE_CONTRACT",e,n,r,t,i],c=>{if(!i)throw new Error("senderAddress is undefined");let u={...c,fee:c.fee??"auto",senderAddress:i,contractAddress:t,memo:c.memo??"",funds:c.funds??[]};return et(u)},{onError:(c,u)=>Promise.resolve(e==null?void 0:e(c,u)),onMutate:n,onSuccess:c=>Promise.resolve(r==null?void 0:r(c))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,executeContract:a.mutate,executeContractAsync:a.mutateAsync,status:a.status}},Co=(t,e)=>{let{data:n}=Ne();return(0,$.useQuery)(["USE_QUERY_SMART",t,e,n],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return tt(t,e,n)},{enabled:!!t&&!!e&&!!n})},So=(t,e)=>{let{data:n}=Ne();return(0,$.useQuery)(["USE_QUERY_RAW",e,t,n],({queryKey:[,i]})=>{if(!t||!e)throw new Error("address or key undefined");return nt(t,e,n)},{enabled:!!t&&!!e&&!!n})};var ft=require("@cosmjs/cosmwasm-stargate"),se=require("@cosmjs/stargate"),he=require("@tanstack/react-query"),ye=require("react");var Ao=t=>{let e=g(o=>o.activeChain),n=f(o=>o.walletType),r=(0,ye.useMemo)(()=>["USE_STARGATE_SIGNING_CLIENT",e,n,t],[t,e,n]);return(0,he.useQuery)({queryKey:r,queryFn:async({queryKey:[,o,i,s]})=>{if(!o)throw new Error("No chain found");if(!W(i))throw new Error(`${i} is not available`);let c=await(async()=>{switch(t==null?void 0:t.offlineSigner){case"offlineSigner":return T(i).getOfflineSigner(o.chainId);case"offlineSignerAuto":return T(i).getOfflineSignerAuto(o.chainId);case"offlineSignerOnlyAmino":return T(i).getOfflineSignerOnlyAmino(o.chainId);default:return T(i).getOfflineSignerAuto(o.chainId)}})(),u={url:o.rpc,headers:{...o.rpcHeaders||{}}};return await se.SigningStargateClient.connectWithSigner(u,c,s==null?void 0:s.opts)},enabled:!!e&&!!n,refetchOnWindowFocus:!1})},Eo=t=>{let e=g(o=>o.activeChain),n=f(o=>o.walletType),r=(0,ye.useMemo)(()=>["USE_COSMWASM_SIGNING_CLIENT",e,n,t],[t,e,n]);return(0,he.useQuery)({queryKey:r,queryFn:async({queryKey:[,o,i,s]})=>{if(!o)throw new Error("No chain found");if(!W(i))throw new Error(`${i} is not available`);let c=await(async()=>{switch(t==null?void 0:t.offlineSigner){case"offlineSigner":return T(i).getOfflineSigner(o.chainId);case"offlineSignerAuto":return T(i).getOfflineSignerAuto(o.chainId);case"offlineSignerOnlyAmino":return T(i).getOfflineSignerOnlyAmino(o.chainId);default:return T(i).getOfflineSignerAuto(o.chainId)}})(),u={url:o.rpc,headers:{...o.rpcHeaders||{}}},h=o.gas?se.GasPrice.fromString(`${o.gas.price}${o.gas.denom}`):void 0;return await ft.SigningCosmWasmClient.connectWithSigner(u,c,{gasPrice:h,...(s==null?void 0:s.opts)||{}})},enabled:!!e&&!!n,refetchOnWindowFocus:!1})},Io=t=>{let e=g(i=>i.activeChain),n=f(i=>i.walletType),r=(0,ye.useMemo)(()=>["USE_STARGATE_TM_SIGNING_CLIENT",e,n,t],[t,e,n]),{data:o}=Me(t.type);return(0,he.useQuery)({queryKey:r,queryFn:async({queryKey:[,i,s,a]})=>{if(!i)throw new Error("No chain found");if(!W(s))throw new Error(`${s} is not available`);if(!o)throw new Error("No tendermint client found");let u=await(async()=>{switch(t.offlineSigner){case"offlineSigner":return T(s).getOfflineSigner(i.chainId);case"offlineSignerAuto":return T(s).getOfflineSignerAuto(i.chainId);case"offlineSignerOnlyAmino":return T(s).getOfflineSignerOnlyAmino(i.chainId);default:return T(s).getOfflineSignerAuto(i.chainId)}})();return se.SigningStargateClient.createWithSigner(o,u,a.opts)},enabled:!!e&&!!n&&!!o,refetchOnWindowFocus:!1})},bo=t=>{let e=g(i=>i.activeChain),n=f(i=>i.walletType),r=(0,ye.useMemo)(()=>["USE_COSMWASM_TM_SIGNING_CLIENT",e,n,t],[t,e,n]),{data:o}=Me(t.type);return(0,he.useQuery)({queryKey:r,queryFn:async({queryKey:[,i,s,a]})=>{if(!i)throw new Error("No chain found");if(!W(s))throw new Error(`${s} is not available`);if(!o)throw new Error("No tendermint client found");let u=await(async()=>{switch(t.offlineSigner){case"offlineSigner":return T(s).getOfflineSigner(i.chainId);case"offlineSignerAuto":return T(s).getOfflineSignerAuto(i.chainId);case"offlineSignerOnlyAmino":return T(s).getOfflineSignerOnlyAmino(i.chainId);default:return T(s).getOfflineSignerAuto(i.chainId)}})(),h=i.gas?se.GasPrice.fromString(`${i.gas.price}${i.gas.denom}`):void 0;return ft.SigningCosmWasmClient.createWithSigner(o,u,{gasPrice:h,...(a==null?void 0:a.opts)||{}})},enabled:!!e&&!!n&&!!o,refetchOnWindowFocus:!1})};var _e=require("@tanstack/react-query"),hn=require("@tanstack/react-query-devtools");var De=require("react"),Fe=require("react/jsx-runtime"),fn=({children:t})=>{let[e,n]=(0,De.useState)(!1);return(0,De.useEffect)(()=>{n(!0)},[]),(0,Fe.jsx)(Fe.Fragment,{children:e?t:null})};var dt=require("react");var dn=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem(Y)==="Active",{_reconnect:e,_onReconnectFailed:n,_reconnectConnector:r}=f(),{activeChain:o,wcSignClient:i}=g(),s=W(r||void 0);return(0,dt.useEffect)(()=>{if(r){if(!s)return;t&&o?B({onError:n}):!t&&e&&B({onError:n})}},[s]),(0,dt.useEffect)(()=>{var a,c,u,h,A,C,x,N,ce,Z;if(r){if(!s)return;r==="cosmostation"&&((c=(a=me()).subscription)==null||c.call(a,()=>{B({onError:n})})),r==="keplr"&&((h=(u=pe()).subscription)==null||h.call(u,()=>{B({onError:n})})),r==="leap"&&((C=(A=ge()).subscription)==null||C.call(A,()=>{B({onError:n})})),r==="vectis"&&((N=(x=fe()).subscription)==null||N.call(x,()=>{B({onError:n})})),r==="walletconnect"&&i&&((Z=(ce=U()).subscription)==null||Z.call(ce,()=>{B({onError:n})}))}},[r,i,s]),null},ht=()=>(dn(),null);var ae=require("react/jsx-runtime"),To=new _e.QueryClient({}),xo=({children:t,grazOptions:e,debug:n,...r})=>(e&&Ze(e),(0,ae.jsxs)(_e.QueryClientProvider,{client:To,...r,children:[(0,ae.jsxs)(fn,{children:[t,(0,ae.jsx)(ht,{})]}),n?(0,ae.jsx)(hn.ReactQueryDevtools,{initialIsOpen:!1,position:"bottom-right"}):null]},"graz-provider"));0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,clearSession,configureGraz,connect,defineChain,defineChainInfo,defineChains,disconnect,executeContract,getActiveChainCurrency,getAvailableWallets,getCosmostation,getKeplr,getLeap,getMetamaskSnapLeap,getOfflineSigners,getQueryRaw,getQuerySmart,getRecentChain,getVectis,getWCCosmostation,getWCKeplr,getWCLeap,getWallet,getWalletConnect,instantiateContract,mainnetChains,mainnetChainsArray,reconnect,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useActiveWalletType,useBalance,useBalanceStaked,useBalances,useCheckWallet,useConnect,useCosmWasmClient,useCosmWasmSigningClient,useCosmWasmTmSigningClient,useDisconnect,useExecuteContract,useGrazEvents,useInstantiateContract,useOfflineSigners,useQueryRaw,useQuerySmart,useRecentChain,useSendIbcTokens,useSendTokens,useStargateClient,useStargateSigningClient,useStargateTmSigningClient,useSuggestChain,useSuggestChainAndConnect,useTendermintClient});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Yt,b as Ce,c as $}from"./chunk-HBC2VYPF.mjs";var me=Yt((mo,nt)=>{"use strict";nt.exports=E;var P=null;try{P=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function E(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}E.prototype.__isLong__;Object.defineProperty(E.prototype,"__isLong__",{value:!0});function _(t){return(t&&t.__isLong__)===!0}E.isLong=_;var He={},Ve={};function Y(t,e){var n,r,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(r=Ve[t],r)?r:(n=I(t,(t|0)<0?-1:0,!0),o&&(Ve[t]=n),n)):(t|=0,(o=-128<=t&&t<128)&&(r=He[t],r)?r:(n=I(t,t<0?-1:0,!1),o&&(He[t]=n),n))}E.fromInt=Y;function R(t,e){if(isNaN(t))return e?Z:q;if(e){if(t<0)return Z;if(t>=Xe)return tt}else{if(t<=-Ze)return F;if(t+1>=Ze)return et}return t<0?R(-t,e).neg():I(t%J|0,t/J|0,e)}E.fromNumber=R;function I(t,e,n){return new E(t,e,n)}E.fromBits=I;var ue=Math.pow;function Ae(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return q;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return Ae(t.substring(1),e,n).neg();for(var o=R(ue(n,8)),i=q,s=0;s<t.length;s+=8){var a=Math.min(8,t.length-s),c=parseInt(t.substring(s,s+a),n);if(a<8){var u=R(ue(n,a));i=i.mul(u).add(R(c))}else i=i.mul(o),i=i.add(R(c))}return i.unsigned=e,i}E.fromString=Ae;function L(t,e){return typeof t=="number"?R(t,e):typeof t=="string"?Ae(t,e):I(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}E.fromValue=L;var $e=65536,nn=1<<24,J=$e*$e,Xe=J*J,Ze=Xe/2,Ye=Y(nn),q=Y(0);E.ZERO=q;var Z=Y(0,!0);E.UZERO=Z;var X=Y(1);E.ONE=X;var Je=Y(1,!0);E.UONE=Je;var Se=Y(-1);E.NEG_ONE=Se;var et=I(-1,2147483647,!1);E.MAX_VALUE=et;var tt=I(-1,-1,!0);E.MAX_UNSIGNED_VALUE=tt;var F=I(0,-2147483648,!1);E.MIN_VALUE=F;var l=E.prototype;l.toInt=function(){return this.unsigned?this.low>>>0:this.low};l.toNumber=function(){return this.unsigned?(this.high>>>0)*J+(this.low>>>0):this.high*J+(this.low>>>0)};l.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var n=R(e),r=this.div(n),o=r.mul(n).sub(this);return r.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=R(ue(e,6),this.unsigned),s=this,a="";;){var c=s.div(i),u=s.sub(c.mul(i)).toInt()>>>0,h=u.toString(e);if(s=c,s.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}};l.getHighBits=function(){return this.high};l.getHighBitsUnsigned=function(){return this.high>>>0};l.getLowBits=function(){return this.low};l.getLowBitsUnsigned=function(){return this.low>>>0};l.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};l.isZero=function(){return this.high===0&&this.low===0};l.eqz=l.isZero;l.isNegative=function(){return!this.unsigned&&this.high<0};l.isPositive=function(){return this.unsigned||this.high>=0};l.isOdd=function(){return(this.low&1)===1};l.isEven=function(){return(this.low&1)===0};l.equals=function(e){return _(e)||(e=L(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};l.eq=l.equals;l.notEquals=function(e){return!this.eq(e)};l.neq=l.notEquals;l.ne=l.notEquals;l.lessThan=function(e){return this.comp(e)<0};l.lt=l.lessThan;l.lessThanOrEqual=function(e){return this.comp(e)<=0};l.lte=l.lessThanOrEqual;l.le=l.lessThanOrEqual;l.greaterThan=function(e){return this.comp(e)>0};l.gt=l.greaterThan;l.greaterThanOrEqual=function(e){return this.comp(e)>=0};l.gte=l.greaterThanOrEqual;l.ge=l.greaterThanOrEqual;l.compare=function(e){if(_(e)||(e=L(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};l.comp=l.compare;l.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(X)};l.neg=l.negate;l.add=function(e){_(e)||(e=L(e));var n=this.high>>>16,r=this.high&65535,o=this.low>>>16,i=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,u=e.low&65535,h=0,A=0,C=0,x=0;return x+=i+u,C+=x>>>16,x&=65535,C+=o+c,A+=C>>>16,C&=65535,A+=r+a,h+=A>>>16,A&=65535,h+=n+s,h&=65535,I(C<<16|x,h<<16|A,this.unsigned)};l.subtract=function(e){return _(e)||(e=L(e)),this.add(e.neg())};l.sub=l.subtract;l.multiply=function(e){if(this.isZero())return q;if(_(e)||(e=L(e)),P){var n=P.mul(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}if(e.isZero())return q;if(this.eq(F))return e.isOdd()?F:q;if(e.eq(F))return this.isOdd()?F:q;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Ye)&&e.lt(Ye))return R(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=this.high&65535,i=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,u=e.low>>>16,h=e.low&65535,A=0,C=0,x=0,N=0;return N+=s*h,x+=N>>>16,N&=65535,x+=i*h,C+=x>>>16,x&=65535,x+=s*u,C+=x>>>16,x&=65535,C+=o*h,A+=C>>>16,C&=65535,C+=i*u,A+=C>>>16,C&=65535,C+=s*c,A+=C>>>16,C&=65535,A+=r*h+o*u+i*c+s*a,A&=65535,I(x<<16|N,A<<16|C,this.unsigned)};l.mul=l.multiply;l.divide=function(e){if(_(e)||(e=L(e)),e.isZero())throw Error("division by zero");if(P){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?P.div_u:P.div_s)(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Z:q;var r,o,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Z;if(e.gt(this.shru(1)))return Je;i=Z}else{if(this.eq(F)){if(e.eq(X)||e.eq(Se))return F;if(e.eq(F))return X;var s=this.shr(1);return r=s.div(e).shl(1),r.eq(q)?e.isNegative()?X:Se:(o=this.sub(e.mul(r)),i=r.add(o.div(e)),i)}else if(e.eq(F))return this.unsigned?Z:q;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=q}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:ue(2,a-48),u=R(r),h=u.mul(e);h.isNegative()||h.gt(o);)r-=c,u=R(r,this.unsigned),h=u.mul(e);u.isZero()&&(u=X),i=i.add(u),o=o.sub(h)}return i};l.div=l.divide;l.modulo=function(e){if(_(e)||(e=L(e)),P){var n=(this.unsigned?P.rem_u:P.rem_s)(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};l.mod=l.modulo;l.rem=l.modulo;l.not=function(){return I(~this.low,~this.high,this.unsigned)};l.and=function(e){return _(e)||(e=L(e)),I(this.low&e.low,this.high&e.high,this.unsigned)};l.or=function(e){return _(e)||(e=L(e)),I(this.low|e.low,this.high|e.high,this.unsigned)};l.xor=function(e){return _(e)||(e=L(e)),I(this.low^e.low,this.high^e.high,this.unsigned)};l.shiftLeft=function(e){return _(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?I(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):I(0,this.low<<e-32,this.unsigned)};l.shl=l.shiftLeft;l.shiftRight=function(e){return _(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?I(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):I(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};l.shr=l.shiftRight;l.shiftRightUnsigned=function(e){if(_(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return I(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?I(n,0,this.unsigned):I(n>>>e-32,0,this.unsigned)};l.shru=l.shiftRightUnsigned;l.shr_u=l.shiftRightUnsigned;l.toSigned=function(){return this.unsigned?I(this.low,this.high,!1):this};l.toUnsigned=function(){return this.unsigned?this:I(this.low,this.high,!0)};l.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};l.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};l.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};E.fromBytes=function(e,n,r){return r?E.fromBytesLE(e,n):E.fromBytesBE(e,n)};E.fromBytesLE=function(e,n){return new E(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};E.fromBytesBE=function(e,n){return new E(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)}});import{create as Ke}from"zustand";import{createJSONStorage as Xt}from"zustand/middleware";import{persist as ze,subscribeWithSelector as Qe}from"zustand/middleware";var Ge=(u=>(u.KEPLR="keplr",u.LEAP="leap",u.VECTIS="vectis",u.COSMOSTATION="cosmostation",u.WALLETCONNECT="walletconnect",u.WC_KEPLR_MOBILE="wc_keplr_mobile",u.WC_LEAP_MOBILE="wc_leap_mobile",u.WC_COSMOSTATION_MOBILE="wc_cosmostation_mobile",u.METAMASK_SNAP_LEAP="metamask_snap_leap",u))(Ge||{}),je=["keplr","leap","vectis","cosmostation","walletconnect","wc_keplr_mobile","wc_leap_mobile","wc_cosmostation_mobile","metamask_snap_leap"];var Jt={recentChain:null,defaultChain:null,defaultSigningClient:"stargate",walletType:"keplr",walletConnect:{options:null,web3Modal:null},_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},ne={account:null,activeChain:null,balances:null,status:"disconnected",wcSignClient:null},en={name:"graz-session",version:1,partialize:t=>({account:t.account,activeChain:t.activeChain}),storage:Xt(()=>sessionStorage)},tn={name:"graz-internal",partialize:t=>({recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:1},g=Ke(Qe(ze(()=>ne,en))),f=Ke(Qe(ze(()=>Jt,tn)));var ae=()=>{if(typeof window.cosmostation.providers.keplr<"u"){let t=window.cosmostation.providers.keplr;return Object.assign(t,{subscription:r=>(window.cosmostation.cosmos.on("accountChanged",()=>{D(),r()}),()=>{window.cosmostation.cosmos.off("accountChanged",()=>{D(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")};var ce=()=>{if(typeof window.keplr<"u"){let t=window.keplr;return Object.assign(t,{subscription:r=>(window.addEventListener("keplr_keystorechange",()=>{D(),r()}),()=>{window.removeEventListener("keplr_keystorechange",()=>{D(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.keplr is not defined")};var le=()=>{if(typeof window.leap<"u"){let t=window.leap;return Object.assign(t,{subscription:r=>(window.addEventListener("leap_keystorechange",()=>{D(),r()}),()=>{window.removeEventListener("leap_keystorechange",()=>{D(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.leap is not defined")};var ot=Ce(me());var rt=t=>{let e=window.ethereum;if(e&&t){let n=async()=>await e.request({method:"wallet_getSnaps"}),r=async w=>{try{let S=await n();return Object.values(S).find(O=>O.id===t.id&&(!w||O.version===w))}catch{return}},o=async()=>{await e.request({method:"wallet_requestSnaps",params:{[t.id]:t.params||{}}})},i=async()=>{let w=await e.request({method:"web3_clientVersion"});if(!(w==null?void 0:w.includes("flask")))throw new Error("Metamask Flask is not detected");return!0},s=async w=>{await r()||await o()},a=async(w,S,O)=>{let U=await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"signDirect",params:{chainId:w,signerAddress:S,signDoc:O}}}}),z=O.accountNumber,te=new ot.default(z.low,z.high,z.unsigned);return{signature:U.signature,signed:{...U.signed,accountNumber:`${te.toString()}`,authInfoBytes:new Uint8Array(Object.values(U.signed.authInfoBytes)),bodyBytes:new Uint8Array(Object.values(U.signed.bodyBytes))}}},c=async(w,S,O)=>await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"signAmino",params:{chainId:w,signerAddress:S,signDoc:O}}}}),u=async w=>{let S=await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"getKey",params:{chainId:w}}}});if(!S)throw new Error("No response from Metamask");return S.pubKey=Uint8Array.from(Object.values(S.pubkey)),delete S.pubkey,{...S}},h=async w=>{let S=await u(w);return{address:S.bech32Address,algo:S.algo,pubkey:S.pubKey}},A=async(...w)=>{let[S,O,U,z]=w;return await c(S,O,U)},C=async(...w)=>{let[S,O,U]=w;return await a(S,O,U)},x=w=>({getAccounts:async()=>[await h(w)],signDirect:(S,O)=>C(w,S,O)}),N=w=>({getAccounts:async()=>[await h(w)],signAmino:(S,O)=>A(w,S,O)});return{getKey:u,getOfflineSigner:w=>({getAccounts:async()=>[await h(w)],signDirect:(S,O)=>C(w,S,O),signAmino:(S,O)=>A(w,S,O)}),getOfflineSignerAuto:async w=>(await u(w)).isNanoLedger?N(w):x(w),getOfflineSignerOnlyAmino:N,signDirect:C,signAmino:A,enable:s,experimentalSuggestChain:async(...w)=>{await Promise.reject(new Error("Metamask does not support experimentalSuggestChain"))},init:i}}throw f.getState()._notFoundFn(),new Error("window.ethereum is not defined")};var it=()=>rt({id:"npm:@leapwallet/metamask-cosmos-snap"});var st=Ce(me());import{fromBech32 as on}from"@cosmjs/encoding";var pe=()=>{if(typeof window.vectis<"u"){let t=window.vectis.cosmos;return{enable:a=>t.enable(a),getOfflineSigner:a=>t.getOfflineSigner(a),getOfflineSignerAuto:a=>t.getOfflineSignerAuto(a),getKey:async a=>{let c=await t.getKey(a);return{address:on(c.address).data,algo:c.algo,bech32Address:c.address,name:c.name,pubKey:c.pubKey,isKeystone:!1,isNanoLedger:c.isNanoLedger}},subscription:a=>(window.addEventListener("vectis_accountChanged",()=>{D(),a()}),()=>{window.removeEventListener("vectis_accountChanged",()=>{D(),a()})}),getOfflineSignerOnlyAmino:(...a)=>t.getOfflineSignerAmino(...a),experimentalSuggestChain:async(...a)=>{let[c]=a,u={...c,rpcUrl:c.rpc,restUrl:c.rest,prettyName:c.chainName.replace(" ",""),bech32Prefix:c.bech32Config.bech32PrefixAccAddr};return t.suggestChains([u])},signDirect:async(...a)=>{var h;let{1:c,2:u}=a;return t.signDirect(c,{bodyBytes:u.bodyBytes||Uint8Array.from([]),authInfoBytes:u.authInfoBytes||Uint8Array.from([]),accountNumber:st.default.fromString(((h=u.accountNumber)==null?void 0:h.toString())||"",!1),chainId:u.chainId||""})},signAmino:async(...a)=>{let{1:c,2:u}=a;return t.signAmino(c,u)}}}throw f.getState()._notFoundFn(),new Error("window.vectis is not defined")};var ut=Ce(me());import{fromBech32 as rn}from"@cosmjs/encoding";import{SignClient as sn}from"@walletconnect/sign-client";import{getSdkError as an}from"@walletconnect/utils";var B=()=>typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1,at=()=>B()&&navigator.userAgent.toLowerCase().includes("android"),ct=()=>B()&&(navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad"));var lt=(t,e,n=new Error("Promise timed out"))=>{let r=new Promise((o,i)=>{setTimeout(()=>{i(n)},e)});return Promise.race([t,r])};var G=t=>{var z,te,Be;if(!((Be=(te=(z=f.getState().walletConnect)==null?void 0:z.options)==null?void 0:te.projectId)!=null&&Be.trim()))throw new Error("walletConnect.options.projectId is not defined");let e=(t==null?void 0:t.encoding)||"base64",n=p=>{if(!t)return;let{appUrl:m,formatNativeUrl:d}=t;if(B()){if(at())if(!p)window.open(m.mobile.android,"_self","noreferrer noopener");else{let y=d(m.mobile.android,p,"android");window.open(y,"_self","noreferrer noopener")}if(ct())if(!p)window.open(m.mobile.ios,"_self","noreferrer noopener");else{let y=d(m.mobile.ios,p,"ios");window.open(y,"_self","noreferrer noopener")}}},r=()=>{let{wcSignClient:p}=g.getState();if(!p)throw new Error("walletConnect.signClient is not defined");D(),f.setState({_reconnect:!1,_reconnectConnector:null,recentChain:null})},o=async p=>{let{wcSignClient:m}=g.getState();if(!m)throw new Error("walletConnect.signClient is not defined");if(!p)throw new Error("No wallet connect session");await m.disconnect({topic:p,reason:an("USER_DISCONNECTED")}),await a(m),r()},i=p=>{var m,d;try{let{wcSignClient:y}=g.getState();if(!y)throw new Error("walletConnect.signClient is not defined");let b=y.session.getAll().at(-1);if(!b)return;let v=(d=(m=y.session.getAll().at(-1))==null?void 0:m.namespaces.cosmos)==null?void 0:d.accounts.find(k=>k.startsWith(`cosmos:${p}`));if(!(b.expiry*1e3>Date.now()+1e3))throw o(b.topic),new Error("invalid session");if(!v)try{let k=y.find({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!k.length)throw new Error("no session");return k.at(-1)}catch(k){if(!k.message.toLowerCase().includes("no matching key"))throw k}return b}catch(y){if(!y.message.toLowerCase().includes("no matching key"))throw y}},s=p=>{try{return i(p)}catch{return}},a=async p=>{try{let m=p.core.pairing.pairings.getAll({active:!1});if(!m.length)return;await Promise.all(m.map(async d=>{await p.core.pairing.pairings.delete(d.topic,{code:7001,message:"clear pairing"})}))}catch(m){if(!m.message.toLowerCase().includes("no matching key"))throw m}},c=async()=>{let{walletConnect:p}=f.getState();if(!(p!=null&&p.options))throw new Error("walletConnect.options is not defined");let{wcSignClient:m}=g.getState();if(m)return g.setState({wcSignClient:m}),m;let d=await sn.init(p.options);return g.setState({wcSignClient:d}),d},u=p=>{let{wcSignClient:m}=g.getState();if(m)return m.events.on("session_delete",d=>{r()}),m.events.on("session_expire",d=>{r()}),m.events.on("session_event",d=>{var y,b;if(d.params.event.name==="accountsChanged"&&((y=d.params.event.data)==null?void 0:y[0])!==((b=g.getState().account)==null?void 0:b.bech32Address)){let v=d.params.chainId.split(":")[1];v&&h(v)}else p()}),()=>{m.events.off("session_delete",d=>{r()}),m.events.off("session_expire",d=>{r()}),m.events.off("session_event",d=>{var y,b;if(d.params.event.name==="accountsChanged"&&((y=d.params.event.data)==null?void 0:y[0])!==((b=g.getState().account)==null?void 0:b.bech32Address)){let v=d.params.chainId.split(":")[1];v&&h(v)}else p()})}},h=async p=>{var re;let{wcSignClient:m}=g.getState();if(!m)throw new Error("enable walletConnect.signClient is not defined");let{walletConnect:d}=f.getState();if(!((re=d==null?void 0:d.options)!=null&&re.projectId))throw new Error("walletConnect.options.projectId is not defined");let{Web3Modal:y}=await import("@web3modal/standalone"),b=new y({projectId:d.options.projectId,walletConnectVersion:2,enableExplorer:!1,explorerRecommendedWalletIds:"NONE",...d.web3Modal}),{account:v,activeChain:K}=g.getState(),k=s(p);if((K==null?void 0:K.chainId)!==p&&!k||!v){let{uri:M,approval:ie}=await m.connect({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!M)throw new Error("No wallet connect uri");t?n(M):await b.openModal({uri:M});let Zt=async Q=>Q.aborted?Promise.reject(new Error("User closed wallet connect")):new Promise((we,se)=>{ie().then(we).catch(se),Q.addEventListener("abort",()=>{se(new Error("User closed wallet connect"))})});try{let Q=new AbortController,we=Q.signal;b.subscribeModal(se=>{se.open||Q.abort()}),await Zt(we)}catch(Q){if(b.closeModal(),!Q.message.toLowerCase().includes("no matching key"))return Promise.reject(Q)}return t||b.closeModal(),Promise.resolve()}try{await lt((async()=>{let M=await C(p);g.setState({account:M})})(),15e3,new Error("Connection timeout"))}catch(M){if(o(k==null?void 0:k.topic),!M.message.toLowerCase().includes("no matching key"))throw M}},A=async p=>{var b;let{wcSignClient:m}=g.getState();if(!m)throw new Error("walletConnect.signClient is not defined");let d=(b=i(p))==null?void 0:b.topic;if(!d)throw new Error("No wallet connect session");n();let y=await m.request({topic:d,chainId:`cosmos:${p}`,request:{method:"cosmos_getAccounts",params:{}}});if(!y[0])throw new Error("No wallet connect account");return{address:y[0].address,algo:y[0].algo,pubkey:new Uint8Array(Buffer.from(y[0].pubkey,e))}},C=async p=>{let{address:m,algo:d,pubkey:y}=await A(p);return{address:rn(m).data,algo:d,bech32Address:m,name:"",pubKey:y,isKeystone:!1,isNanoLedger:!1}},x=async(...p)=>{var M,ie;let[m,d,y]=p,{account:b,wcSignClient:v}=g.getState();if(!v)throw new Error("walletConnect.signClient is not defined");if(!b)throw new Error("account is not defined");let K=(M=i(m))==null?void 0:M.topic;if(!K)throw new Error("No wallet connect session");if(!y.bodyBytes)throw new Error("No bodyBytes");if(!y.authInfoBytes)throw new Error("No authInfoBytes");let k={topic:K,chainId:`cosmos:${m}`,request:{method:"cosmos_signDirect",params:{signerAddress:d,signDoc:{...y,bodyBytes:Buffer.from(y.bodyBytes).toString(e),authInfoBytes:Buffer.from(y.authInfoBytes).toString(e),accountNumber:(ie=y.accountNumber)==null?void 0:ie.toString()}}}};return n(),await v.request(k)},N=async(...p)=>{let[m,d,y]=p,{signature:b,signed:v}=await x(m,d,y);return{signed:{chainId:v.chainId,accountNumber:ut.default.fromString(v.accountNumber,!1),authInfoBytes:new Uint8Array(Buffer.from(v.authInfoBytes,e)),bodyBytes:new Uint8Array(Buffer.from(v.bodyBytes,e))},signature:b}},ee=async(...p)=>{var M;let[m,d,y,b]=p,{wcSignClient:v}=g.getState(),{account:K}=g.getState();if(!v)throw new Error("walletConnect.signClient is not defined");if(!K)throw new Error("account is not defined");let k=(M=i(m))==null?void 0:M.topic;if(!k)throw new Error("No wallet connect session");return n(),await v.request({topic:k,chainId:`cosmos:${m}`,request:{method:"cosmos_signDirect",params:{signerAddress:d,signDoc:y}}})},V=async(...p)=>{let[m,d,y,b]=p;return await ee(m,d,y)},Ue=p=>({getAccounts:async()=>[await A(p)],signDirect:(m,d)=>N(p,m,d)}),w=p=>({getAccounts:async()=>[await A(p)],signAmino:(m,d)=>V(p,m,d)});return{enable:h,experimentalSuggestChain:async(...p)=>{await Promise.reject(new Error("WalletConnect does not support experimentalSuggestChain"))},getKey:C,getOfflineSigner:p=>({getAccounts:async()=>[await A(p)],signDirect:(m,d)=>N(p,m,d),signAmino:(m,d)=>V(p,m,d)}),getOfflineSignerAuto:async p=>(await C(p)).isNanoLedger?w(p):Ue(p),getOfflineSignerOnlyAmino:w,signAmino:V,signDirect:N,subscription:u,init:c}};var mt=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!B())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"hex",appUrl:{mobile:{ios:"cosmostation://",android:"cosmostation://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,i,s)=>`${o.replaceAll("/","").replaceAll(":","")}://wc?${i}`};return G(t)};var pt=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!B())throw new Error("WalletConnect Keplr mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"keplrwallet://",android:"intent://"}},walletType:"wc_keplr_mobile",formatNativeUrl:(o,i,s)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(i);switch(s){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return G(t)};var gt=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!B())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"leapcosmos://",android:"intent://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,i,s)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(i);switch(s){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return G(t)};var W=(t=f.getState().walletType)=>{try{return T(t),!0}catch{return!1}},D=()=>{window.sessionStorage.removeItem($),g.setState(ne)},T=(t=f.getState().walletType)=>{switch(t){case"keplr":return ce();case"leap":return le();case"cosmostation":return ae();case"vectis":return pe();case"walletconnect":return G();case"wc_keplr_mobile":return pt();case"wc_leap_mobile":return gt();case"wc_cosmostation_mobile":return mt();case"metamask_snap_leap":return it();default:throw new Error("Unknown wallet type")}},tr=()=>Object.fromEntries(je.map(t=>[t,W(t)]));var oe=async t=>{var e;try{let{defaultChain:n,recentChain:r,walletType:o}=f.getState(),i=(t==null?void 0:t.walletType)||o;if(!W(i))throw new Error(`${i} is not available`);let a=T(i),c=(t==null?void 0:t.chain)||r||n;if(!c)throw new Error("No last known connected chain, connect action requires chain info");g.setState(C=>{let x=f.getState()._reconnect||!!f.getState()._reconnectConnector||!!c;return C.activeChain&&C.activeChain.chainId!==c.chainId?{status:"connecting"}:x?{status:"reconnecting"}:{status:"connecting"}});let{account:u,activeChain:h}=g.getState();if(await((e=a.init)==null?void 0:e.call(a)),!u||(h==null?void 0:h.chainId)!==c.chainId){await a.enable(c.chainId);let C=await a.getKey(c.chainId);g.setState({account:C})}f.setState({recentChain:c,walletType:i,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:i}),g.setState({activeChain:c,status:"connected"}),typeof window<"u"&&window.sessionStorage.setItem($,"Active");let{account:A}=g.getState();return{account:A,walletType:i,chain:c}}catch(n){throw console.error("connect ",n),g.getState().account===null&&g.setState({status:"disconnected"}),g.getState().account&&g.getState().activeChain&&g.setState({status:"connected"}),n}},Ee=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem($),g.setState(ne),f.setState(e=>({_reconnect:!1,_reconnectConnector:null,recentChain:t?null:e.recentChain})),Promise.resolve()),j=async t=>{var o;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=f.getState();try{let i=W(n||void 0);if(e&&i&&n)return await oe({chain:e,walletType:n,autoReconnect:r})}catch(i){(o=t==null?void 0:t.onError)==null||o.call(t,i),Ee()}},ft=async t=>{if(!(t!=null&&t.chainId))throw new Error("chainId is required");let{walletType:e}=f.getState(),n=t.walletType||e;if(!W(n))throw new Error(`${n} is not available`);let o=T(n),i=o.getOfflineSigner(t.chainId),s=o.getOfflineSignerOnlyAmino(t.chainId),a=await o.getOfflineSignerAuto(t.chainId);return{offlineSigner:i,offlineSignerAmino:s,offlineSignerAuto:a}};var dt=()=>{f.setState({recentChain:null})},ht=t=>{let{activeChain:e}=g.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},ur=()=>f.getState().recentChain,Ie=async t=>(await T().experimentalSuggestChain(t),t),yt=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...o})=>{let i=await Ie(t);return{...await oe({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...o}),chain:i}};var wt=(t={})=>(f.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletConnect:t.walletConnect||e.walletConnect,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var Ct=async({signingClient:t,senderAddress:e,recipientAddress:n,amount:r,fee:o,memo:i})=>{if(!t)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return t.sendTokens(e,n,r,o,i)},St=async({signingClient:t,senderAddress:e,recipientAddress:n,transferAmount:r,sourcePort:o,sourceChannel:i,timeoutHeight:s,timeoutTimestamp:a,fee:c,memo:u})=>{if(!t)throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return t.sendIbcTokens(e,n,r,o,i,s,a,c,u)},At=async({signingClient:t,senderAddress:e,msg:n,fee:r,options:o,label:i,codeId:s})=>{if(!t)throw new Error("CosmWasm signing client is not ready");return t.instantiate(e,s,n,i,r,o)},Et=async({signingClient:t,senderAddress:e,msg:n,fee:r,contractAddress:o,funds:i,memo:s})=>{if(!t)throw new Error("CosmWasm signing client is not ready");return t.execute(e,o,n,r,s,i)},It=async(t,e,n)=>{if(!n)throw new Error("CosmWasm client is not ready");return await n.queryContractSmart(t,e)},bt=(t,e,n)=>{if(!n)throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.queryContractRaw(t,r)};import{Bech32Address as cn}from"@keplr-wallet/cosmos";var xt={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},ln={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},un={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},mn={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},pn={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},gn={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},Tt=[xt,ln,un,mn,pn,gn],be={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:xt,bip44:{coinType:118},bech32Config:cn.defaultBech32Config("axelar"),currencies:Tt,feeCurrencies:Tt};import{Bech32Address as fn}from"@keplr-wallet/cosmos";var Ot={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},vt=[Ot],Te={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:Ot,bip44:{coinType:118},bech32Config:fn.defaultBech32Config("cosmos"),currencies:vt,feeCurrencies:vt};import{Bech32Address as dn}from"@keplr-wallet/cosmos";var Wt={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},hn={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},yn={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},wn={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Cn={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Sn={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},An={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},En={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},In={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},bn={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Tn={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},kt=[Wt,hn,yn,wn,Cn,Sn,An,En,In,bn,Tn],xe={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:Wt,bip44:{coinType:118},bech32Config:dn.defaultBech32Config("juno"),currencies:kt,feeCurrencies:kt};import{Bech32Address as xn}from"@keplr-wallet/cosmos";var Mt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},vn={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Nt=[Mt,vn],ve={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Mt,bip44:{coinType:118},bech32Config:xn.defaultBech32Config("osmo"),currencies:Nt,feeCurrencies:Nt};import{Bech32Address as On}from"@keplr-wallet/cosmos";var Ft={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},Dt=[Ft],Oe={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:Ft,bip44:{coinType:118},bech32Config:On.defaultBech32Config("somm"),currencies:Dt,feeCurrencies:Dt};import{Bech32Address as kn}from"@keplr-wallet/cosmos";var Pt={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},_t=[Pt],ke={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:kn.defaultBech32Config("CRE"),currencies:_t,feeCurrencies:_t,stakeCurrency:Pt,coinType:118};import{Bech32Address as Wn}from"@keplr-wallet/cosmos";var We={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Nn=[We],Ne={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:We,bip44:{coinType:118},bech32Config:Wn.defaultBech32Config("juno"),currencies:Nn,feeCurrencies:[We],coinType:118};import{Bech32Address as Mn}from"@keplr-wallet/cosmos";var Me={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Dn=[Me],De={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:Me,bip44:{coinType:118},bech32Config:Mn.defaultBech32Config("osmo"),currencies:Dn,feeCurrencies:[Me],coinType:118};var Rt=t=>t,Lr=t=>t,Ur=t=>t,Br=Rt({axelar:be,cosmoshub:Te,juno:xe,osmosis:ve,sommelier:Oe}),Gr=[be,Te,xe,ve,Oe],jr=Rt({crescent:ke,juno:Ne,osmosis:De}),Kr=[ke,Ne,De];import{useMutation as qt,useQuery as fe}from"@tanstack/react-query";import{useEffect as Un,useMemo as Le}from"react";import{CosmWasmClient as Fn}from"@cosmjs/cosmwasm-stargate";import{StargateClient as _n}from"@cosmjs/stargate";import{Tendermint34Client as Pn,Tendermint37Client as Rn}from"@cosmjs/tendermint-rpc";import{useQuery as Fe}from"@tanstack/react-query";import{useMemo as _e}from"react";var Pe=()=>{let t=g(n=>n.activeChain),e=_e(()=>["USE_STARGATE_CLIENT",t],[t]);return Fe({queryKey:e,queryFn:async({queryKey:[,n]})=>{if(!n)throw new Error("No chain found");let r={url:n.rpc,headers:{...n.rpcHeaders||{}}};return await _n.connect(r)},enabled:!!t,refetchOnWindowFocus:!1})},Re=()=>{let t=g(n=>n.activeChain),e=_e(()=>["USE_COSMWASM_CLIENT",t],[t]);return Fe({queryKey:e,queryFn:async({queryKey:[,n]})=>{if(!n)throw new Error("No chain found");let r={url:n.rpc,headers:{...n.rpcHeaders||{}}};return await Fn.connect(r)},enabled:!!t,refetchOnWindowFocus:!1})},qe=t=>{let e=g(r=>r.activeChain),n=_e(()=>["USE_TENDERMINT_CLIENT",t,e],[t,e]);return Fe({queryKey:n,queryFn:async({queryKey:[,r,o]})=>{if(!o)throw new Error("No chain found");let i={url:o.rpc,headers:{...o.rpcHeaders||{}}};return await(r==="tm37"?Rn:Pn).connect(i)},enabled:!!e,refetchOnWindowFocus:!1})};import{useQuery as qn}from"@tanstack/react-query";import{shallow as Ln}from"zustand/shallow";var oi=()=>f(t=>({walletType:t.walletType,isCosmostation:t.walletType==="cosmostation",isCosmostationMobile:t.walletType==="wc_cosmostation_mobile",isKeplr:t.walletType==="keplr",isKeplrMobile:t.walletType==="wc_keplr_mobile",isLeap:t.walletType==="leap",isLeapMobile:t.walletType==="wc_leap_mobile",isVectis:t.walletType==="vectis",isWalletConnect:t.walletType==="walletconnect"}),Ln),ge=t=>{let n=["USE_CHECK_WALLET",f(o=>t||o.walletType)];return qn(n,({queryKey:[,o]})=>W(o))};var H=({onConnect:t,onDisconnect:e}={})=>{let n=g(o=>o.account),r=g(o=>o.status);return Un(()=>g.subscribe(o=>o.status,(o,i)=>{if(o==="connected"){let{account:s,activeChain:a}=g.getState(),{walletType:c}=f.getState();t==null||t({account:s,chain:a,walletType:c,isReconnect:i==="reconnecting"})}o==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:j,status:r}},Bn=t=>{let{data:e}=H(),{data:n}=Pe(),{activeChain:r}=g.getState(),o=t||(e==null?void 0:e.bech32Address),i=Le(()=>["USE_ALL_BALANCES",n,r,o],[r,o,n]);return fe(i,async({queryKey:[,a,c,u]})=>{if(!c||!a)throw new Error("No connected account detected");if(!u)throw new Error("address is not defined");return await a.getAllBalances(u)},{enabled:!!o&&!!r&&!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})},pi=(t,e)=>{let{data:n}=H(),r=e||(n==null?void 0:n.bech32Address),{data:o,refetch:i}=Bn(r),a=fe(["USE_BALANCE",o,t,e],({queryKey:[,c]})=>c==null?void 0:c.find(u=>u.denom===t),{enabled:!!o});return{...a,refetch:async()=>(await i(),a.refetch())}},gi=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=qt(["USE_CONNECT",t,e,n],oe,{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=ge();return{connect:s=>o.mutate(s),connectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!i,status:o.status}},fi=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=qt(["USE_DISCONNECT",t,e,n],Ee,{onError:i=>Promise.resolve(t==null?void 0:t(i,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:i=>o.mutate(i),disconnectAsync:i=>o.mutateAsync(i),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,status:o.status}},di=()=>{let t=g(r=>r.activeChain),e=f(r=>r.walletType),n=Le(()=>["USE_OFFLINE_SIGNERS",t,e],[t,e]);return fe({queryKey:n,queryFn:async({queryKey:[,r,o]})=>{if(!r)throw new Error("No chain found");if(!W(o))throw new Error(`${o} is not available`);return await ft({chainId:r.chainId,walletType:o})},enabled:!!t&&!!e,refetchOnWindowFocus:!1})},hi=t=>{let{data:e}=H(),{data:n}=Pe(),{activeChain:r}=g.getState(),o=t||(e==null?void 0:e.bech32Address),i=Le(()=>["USE_BALANCE_STAKED",n,r,o],[r,o,n]);return fe(i,async({queryKey:[,a,c,u]})=>{if(!c||!a)throw new Error("No connected account detected");if(!u)throw new Error("address is not defined");return await a.getBalanceStaked(u)},{enabled:!!o&&!!r&&!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})};import{useMutation as Lt,useQuery as Ut}from"@tanstack/react-query";var Ei=()=>g(t=>t.activeChain),Ii=t=>Ut(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>ht(r)),bi=(t,e="BOND_STATUS_BONDED")=>Ut(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],async({queryKey:[,o,i]})=>{if(!o)throw new Error("Query client is not defined");return await o.staking.validators(i)},{enabled:typeof t<"u"}),Ti=()=>({data:f(e=>e.recentChain),clear:dt}),xi=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=Lt(["USE_SUGGEST_CHAIN",t,e,n],Ie,{onError:(i,s)=>Promise.resolve(t==null?void 0:t(i,s)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,suggest:o.mutate,suggestAsync:o.mutateAsync,status:o.status}},vi=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=Lt(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],yt,{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:s=>e==null?void 0:e(s),onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=ge();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!i,status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}};import{useMutation as de,useQuery as Bt}from"@tanstack/react-query";var Di=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=H(),o=r==null?void 0:r.bech32Address,i=de(["USE_SEND_TOKENS",t,e,n,o],s=>Ct({senderAddress:o,...s}),{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},Fi=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=H(),o=r==null?void 0:r.bech32Address,i=de(["USE_SEND_IBC_TOKENS",t,e,n,o],s=>St({senderAddress:o,...s}),{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},_i=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=H(),i=o==null?void 0:o.bech32Address,a=de(["USE_INSTANTIATE_CONTRACT",e,n,r,t,i],c=>{if(!i)throw new Error("senderAddress is undefined");let u={...c,fee:c.fee??"auto",senderAddress:i,codeId:t};return At(u)},{onError:(c,u)=>Promise.resolve(e==null?void 0:e(c,u)),onMutate:n,onSuccess:c=>Promise.resolve(r==null?void 0:r(c))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,instantiateContract:a.mutate,instantiateContractAsync:a.mutateAsync,status:a.status}},Pi=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=H(),i=o==null?void 0:o.bech32Address,a=de(["USE_EXECUTE_CONTRACT",e,n,r,t,i],c=>{if(!i)throw new Error("senderAddress is undefined");let u={...c,fee:c.fee??"auto",senderAddress:i,contractAddress:t,memo:c.memo??"",funds:c.funds??[]};return Et(u)},{onError:(c,u)=>Promise.resolve(e==null?void 0:e(c,u)),onMutate:n,onSuccess:c=>Promise.resolve(r==null?void 0:r(c))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,executeContract:a.mutate,executeContractAsync:a.mutateAsync,status:a.status}},Ri=(t,e)=>{let{data:n}=Re();return Bt(["USE_QUERY_SMART",t,e,n],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return It(t,e,n)},{enabled:!!t&&!!e&&!!n})},qi=(t,e)=>{let{data:n}=Re();return Bt(["USE_QUERY_RAW",e,t,n],({queryKey:[,i]})=>{if(!t||!e)throw new Error("address or key undefined");return bt(t,e,n)},{enabled:!!t&&!!e&&!!n})};import{SigningCosmWasmClient as Gt}from"@cosmjs/cosmwasm-stargate";import{GasPrice as jt,SigningStargateClient as Kt}from"@cosmjs/stargate";import{useQuery as he}from"@tanstack/react-query";import{useMemo as ye}from"react";var Hi=t=>{let e=g(o=>o.activeChain),n=f(o=>o.walletType),r=ye(()=>["USE_STARGATE_SIGNING_CLIENT",e,n,t],[t,e,n]);return he({queryKey:r,queryFn:async({queryKey:[,o,i,s]})=>{if(!o)throw new Error("No chain found");if(!W(i))throw new Error(`${i} is not available`);let c=await(async()=>{switch(t==null?void 0:t.offlineSigner){case"offlineSigner":return T(i).getOfflineSigner(o.chainId);case"offlineSignerAuto":return T(i).getOfflineSignerAuto(o.chainId);case"offlineSignerOnlyAmino":return T(i).getOfflineSignerOnlyAmino(o.chainId);default:return T(i).getOfflineSignerAuto(o.chainId)}})(),u={url:o.rpc,headers:{...o.rpcHeaders||{}}};return await Kt.connectWithSigner(u,c,s==null?void 0:s.opts)},enabled:!!e&&!!n,refetchOnWindowFocus:!1})},Vi=t=>{let e=g(o=>o.activeChain),n=f(o=>o.walletType),r=ye(()=>["USE_COSMWASM_SIGNING_CLIENT",e,n,t],[t,e,n]);return he({queryKey:r,queryFn:async({queryKey:[,o,i,s]})=>{if(!o)throw new Error("No chain found");if(!W(i))throw new Error(`${i} is not available`);let c=await(async()=>{switch(t==null?void 0:t.offlineSigner){case"offlineSigner":return T(i).getOfflineSigner(o.chainId);case"offlineSignerAuto":return T(i).getOfflineSignerAuto(o.chainId);case"offlineSignerOnlyAmino":return T(i).getOfflineSignerOnlyAmino(o.chainId);default:return T(i).getOfflineSignerAuto(o.chainId)}})(),u={url:o.rpc,headers:{...o.rpcHeaders||{}}},h=o.gas?jt.fromString(`${o.gas.price}${o.gas.denom}`):void 0;return await Gt.connectWithSigner(u,c,{gasPrice:h,...(s==null?void 0:s.opts)||{}})},enabled:!!e&&!!n,refetchOnWindowFocus:!1})},$i=t=>{let e=g(i=>i.activeChain),n=f(i=>i.walletType),r=ye(()=>["USE_STARGATE_TM_SIGNING_CLIENT",e,n,t],[t,e,n]),{data:o}=qe(t.type);return he({queryKey:r,queryFn:async({queryKey:[,i,s,a]})=>{if(!i)throw new Error("No chain found");if(!W(s))throw new Error(`${s} is not available`);if(!o)throw new Error("No tendermint client found");let u=await(async()=>{switch(t.offlineSigner){case"offlineSigner":return T(s).getOfflineSigner(i.chainId);case"offlineSignerAuto":return T(s).getOfflineSignerAuto(i.chainId);case"offlineSignerOnlyAmino":return T(s).getOfflineSignerOnlyAmino(i.chainId);default:return T(s).getOfflineSignerAuto(i.chainId)}})();return Kt.createWithSigner(o,u,a.opts)},enabled:!!e&&!!n&&!!o,refetchOnWindowFocus:!1})},Zi=t=>{let e=g(i=>i.activeChain),n=f(i=>i.walletType),r=ye(()=>["USE_COSMWASM_TM_SIGNING_CLIENT",e,n,t],[t,e,n]),{data:o}=qe(t.type);return he({queryKey:r,queryFn:async({queryKey:[,i,s,a]})=>{if(!i)throw new Error("No chain found");if(!W(s))throw new Error(`${s} is not available`);if(!o)throw new Error("No tendermint client found");let u=await(async()=>{switch(t.offlineSigner){case"offlineSigner":return T(s).getOfflineSigner(i.chainId);case"offlineSignerAuto":return T(s).getOfflineSignerAuto(i.chainId);case"offlineSignerOnlyAmino":return T(s).getOfflineSignerOnlyAmino(i.chainId);default:return T(s).getOfflineSignerAuto(i.chainId)}})(),h=i.gas?jt.fromString(`${i.gas.price}${i.gas.denom}`):void 0;return Gt.createWithSigner(o,u,{gasPrice:h,...(a==null?void 0:a.opts)||{}})},enabled:!!e&&!!n&&!!o,refetchOnWindowFocus:!1})};import{QueryClient as Hn,QueryClientProvider as Vn}from"@tanstack/react-query";import{ReactQueryDevtools as $n}from"@tanstack/react-query-devtools";import{useEffect as Gn,useState as jn}from"react";import{Fragment as Kn,jsx as zn}from"react/jsx-runtime";var zt=({children:t})=>{let[e,n]=jn(!1);return Gn(()=>{n(!0)},[]),zn(Kn,{children:e?t:null})};import{useEffect as Qt}from"react";var Qn=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem($)==="Active",{_reconnect:e,_onReconnectFailed:n,_reconnectConnector:r}=f(),{activeChain:o,wcSignClient:i}=g(),s=W(r||void 0);return Qt(()=>{if(r){if(!s)return;t&&o?j({onError:n}):!t&&e&&j({onError:n})}},[s]),Qt(()=>{var a,c,u,h,A,C,x,N,ee,V;if(r){if(!s)return;r==="cosmostation"&&((c=(a=ae()).subscription)==null||c.call(a,()=>{j({onError:n})})),r==="keplr"&&((h=(u=ce()).subscription)==null||h.call(u,()=>{j({onError:n})})),r==="leap"&&((C=(A=le()).subscription)==null||C.call(A,()=>{j({onError:n})})),r==="vectis"&&((N=(x=pe()).subscription)==null||N.call(x,()=>{j({onError:n})})),r==="walletconnect"&&i&&((V=(ee=G()).subscription)==null||V.call(ee,()=>{j({onError:n})}))}},[r,i,s]),null},Ht=()=>(Qn(),null);import{jsx as Vt,jsxs as $t}from"react/jsx-runtime";var Zn=new Hn({}),ys=({children:t,grazOptions:e,debug:n,...r})=>(e&&wt(e),$t(Vn,{client:Zn,...r,children:[$t(zt,{children:[t,Vt(Ht,{})]}),n?Vt($n,{initialIsOpen:!1,position:"bottom-right"}):null]},"graz-provider"));export{Ht as GrazEvents,ys as GrazProvider,je as WALLET_TYPES,Ge as WalletType,W as checkWallet,dt as clearRecentChain,D as clearSession,wt as configureGraz,oe as connect,Lr as defineChain,Ur as defineChainInfo,Rt as defineChains,Ee as disconnect,Et as executeContract,ht as getActiveChainCurrency,tr as getAvailableWallets,ae as getCosmostation,ce as getKeplr,le as getLeap,it as getMetamaskSnapLeap,ft as getOfflineSigners,bt as getQueryRaw,It as getQuerySmart,ur as getRecentChain,pe as getVectis,mt as getWCCosmostation,pt as getWCKeplr,gt as getWCLeap,T as getWallet,G as getWalletConnect,At as instantiateContract,Br as mainnetChains,Gr as mainnetChainsArray,j as reconnect,St as sendIbcTokens,Ct as sendTokens,Ie as suggestChain,yt as suggestChainAndConnect,jr as testnetChains,Kr as testnetChainsArray,H as useAccount,Ei as useActiveChain,Ii as useActiveChainCurrency,bi as useActiveChainValidators,oi as useActiveWalletType,pi as useBalance,hi as useBalanceStaked,Bn as useBalances,ge as useCheckWallet,gi as useConnect,Re as useCosmWasmClient,Vi as useCosmWasmSigningClient,Zi as useCosmWasmTmSigningClient,fi as useDisconnect,Pi as useExecuteContract,Qn as useGrazEvents,_i as useInstantiateContract,di as useOfflineSigners,qi as useQueryRaw,Ri as useQuerySmart,Ti as useRecentChain,Fi as useSendIbcTokens,Di as useSendTokens,Pe as useStargateClient,Hi as useStargateSigningClient,$i as useStargateTmSigningClient,xi as useSuggestChain,vi as useSuggestChainAndConnect,qe as useTendermintClient};
|
|
1
|
+
import{a as Yt,b as Ce,c as $}from"./chunk-HBC2VYPF.mjs";var me=Yt((mo,nt)=>{"use strict";nt.exports=E;var P=null;try{P=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function E(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}E.prototype.__isLong__;Object.defineProperty(E.prototype,"__isLong__",{value:!0});function _(t){return(t&&t.__isLong__)===!0}E.isLong=_;var He={},Ve={};function Y(t,e){var n,r,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(r=Ve[t],r)?r:(n=I(t,(t|0)<0?-1:0,!0),o&&(Ve[t]=n),n)):(t|=0,(o=-128<=t&&t<128)&&(r=He[t],r)?r:(n=I(t,t<0?-1:0,!1),o&&(He[t]=n),n))}E.fromInt=Y;function R(t,e){if(isNaN(t))return e?Z:q;if(e){if(t<0)return Z;if(t>=Xe)return tt}else{if(t<=-Ze)return F;if(t+1>=Ze)return et}return t<0?R(-t,e).neg():I(t%J|0,t/J|0,e)}E.fromNumber=R;function I(t,e,n){return new E(t,e,n)}E.fromBits=I;var ue=Math.pow;function Ae(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return q;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return Ae(t.substring(1),e,n).neg();for(var o=R(ue(n,8)),i=q,s=0;s<t.length;s+=8){var a=Math.min(8,t.length-s),c=parseInt(t.substring(s,s+a),n);if(a<8){var u=R(ue(n,a));i=i.mul(u).add(R(c))}else i=i.mul(o),i=i.add(R(c))}return i.unsigned=e,i}E.fromString=Ae;function L(t,e){return typeof t=="number"?R(t,e):typeof t=="string"?Ae(t,e):I(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}E.fromValue=L;var $e=65536,nn=1<<24,J=$e*$e,Xe=J*J,Ze=Xe/2,Ye=Y(nn),q=Y(0);E.ZERO=q;var Z=Y(0,!0);E.UZERO=Z;var X=Y(1);E.ONE=X;var Je=Y(1,!0);E.UONE=Je;var Se=Y(-1);E.NEG_ONE=Se;var et=I(-1,2147483647,!1);E.MAX_VALUE=et;var tt=I(-1,-1,!0);E.MAX_UNSIGNED_VALUE=tt;var F=I(0,-2147483648,!1);E.MIN_VALUE=F;var l=E.prototype;l.toInt=function(){return this.unsigned?this.low>>>0:this.low};l.toNumber=function(){return this.unsigned?(this.high>>>0)*J+(this.low>>>0):this.high*J+(this.low>>>0)};l.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var n=R(e),r=this.div(n),o=r.mul(n).sub(this);return r.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=R(ue(e,6),this.unsigned),s=this,a="";;){var c=s.div(i),u=s.sub(c.mul(i)).toInt()>>>0,h=u.toString(e);if(s=c,s.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}};l.getHighBits=function(){return this.high};l.getHighBitsUnsigned=function(){return this.high>>>0};l.getLowBits=function(){return this.low};l.getLowBitsUnsigned=function(){return this.low>>>0};l.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};l.isZero=function(){return this.high===0&&this.low===0};l.eqz=l.isZero;l.isNegative=function(){return!this.unsigned&&this.high<0};l.isPositive=function(){return this.unsigned||this.high>=0};l.isOdd=function(){return(this.low&1)===1};l.isEven=function(){return(this.low&1)===0};l.equals=function(e){return _(e)||(e=L(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};l.eq=l.equals;l.notEquals=function(e){return!this.eq(e)};l.neq=l.notEquals;l.ne=l.notEquals;l.lessThan=function(e){return this.comp(e)<0};l.lt=l.lessThan;l.lessThanOrEqual=function(e){return this.comp(e)<=0};l.lte=l.lessThanOrEqual;l.le=l.lessThanOrEqual;l.greaterThan=function(e){return this.comp(e)>0};l.gt=l.greaterThan;l.greaterThanOrEqual=function(e){return this.comp(e)>=0};l.gte=l.greaterThanOrEqual;l.ge=l.greaterThanOrEqual;l.compare=function(e){if(_(e)||(e=L(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};l.comp=l.compare;l.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(X)};l.neg=l.negate;l.add=function(e){_(e)||(e=L(e));var n=this.high>>>16,r=this.high&65535,o=this.low>>>16,i=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,u=e.low&65535,h=0,A=0,C=0,x=0;return x+=i+u,C+=x>>>16,x&=65535,C+=o+c,A+=C>>>16,C&=65535,A+=r+a,h+=A>>>16,A&=65535,h+=n+s,h&=65535,I(C<<16|x,h<<16|A,this.unsigned)};l.subtract=function(e){return _(e)||(e=L(e)),this.add(e.neg())};l.sub=l.subtract;l.multiply=function(e){if(this.isZero())return q;if(_(e)||(e=L(e)),P){var n=P.mul(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}if(e.isZero())return q;if(this.eq(F))return e.isOdd()?F:q;if(e.eq(F))return this.isOdd()?F:q;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Ye)&&e.lt(Ye))return R(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=this.high&65535,i=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,u=e.low>>>16,h=e.low&65535,A=0,C=0,x=0,N=0;return N+=s*h,x+=N>>>16,N&=65535,x+=i*h,C+=x>>>16,x&=65535,x+=s*u,C+=x>>>16,x&=65535,C+=o*h,A+=C>>>16,C&=65535,C+=i*u,A+=C>>>16,C&=65535,C+=s*c,A+=C>>>16,C&=65535,A+=r*h+o*u+i*c+s*a,A&=65535,I(x<<16|N,A<<16|C,this.unsigned)};l.mul=l.multiply;l.divide=function(e){if(_(e)||(e=L(e)),e.isZero())throw Error("division by zero");if(P){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?P.div_u:P.div_s)(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Z:q;var r,o,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Z;if(e.gt(this.shru(1)))return Je;i=Z}else{if(this.eq(F)){if(e.eq(X)||e.eq(Se))return F;if(e.eq(F))return X;var s=this.shr(1);return r=s.div(e).shl(1),r.eq(q)?e.isNegative()?X:Se:(o=this.sub(e.mul(r)),i=r.add(o.div(e)),i)}else if(e.eq(F))return this.unsigned?Z:q;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=q}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:ue(2,a-48),u=R(r),h=u.mul(e);h.isNegative()||h.gt(o);)r-=c,u=R(r,this.unsigned),h=u.mul(e);u.isZero()&&(u=X),i=i.add(u),o=o.sub(h)}return i};l.div=l.divide;l.modulo=function(e){if(_(e)||(e=L(e)),P){var n=(this.unsigned?P.rem_u:P.rem_s)(this.low,this.high,e.low,e.high);return I(n,P.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};l.mod=l.modulo;l.rem=l.modulo;l.not=function(){return I(~this.low,~this.high,this.unsigned)};l.and=function(e){return _(e)||(e=L(e)),I(this.low&e.low,this.high&e.high,this.unsigned)};l.or=function(e){return _(e)||(e=L(e)),I(this.low|e.low,this.high|e.high,this.unsigned)};l.xor=function(e){return _(e)||(e=L(e)),I(this.low^e.low,this.high^e.high,this.unsigned)};l.shiftLeft=function(e){return _(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?I(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):I(0,this.low<<e-32,this.unsigned)};l.shl=l.shiftLeft;l.shiftRight=function(e){return _(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?I(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):I(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};l.shr=l.shiftRight;l.shiftRightUnsigned=function(e){if(_(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return I(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?I(n,0,this.unsigned):I(n>>>e-32,0,this.unsigned)};l.shru=l.shiftRightUnsigned;l.shr_u=l.shiftRightUnsigned;l.toSigned=function(){return this.unsigned?I(this.low,this.high,!1):this};l.toUnsigned=function(){return this.unsigned?this:I(this.low,this.high,!0)};l.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};l.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};l.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};E.fromBytes=function(e,n,r){return r?E.fromBytesLE(e,n):E.fromBytesBE(e,n)};E.fromBytesLE=function(e,n){return new E(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};E.fromBytesBE=function(e,n){return new E(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)}});import{create as Ke}from"zustand";import{createJSONStorage as Xt}from"zustand/middleware";import{persist as ze,subscribeWithSelector as Qe}from"zustand/middleware";var Ge=(u=>(u.KEPLR="keplr",u.LEAP="leap",u.VECTIS="vectis",u.COSMOSTATION="cosmostation",u.WALLETCONNECT="walletconnect",u.WC_KEPLR_MOBILE="wc_keplr_mobile",u.WC_LEAP_MOBILE="wc_leap_mobile",u.WC_COSMOSTATION_MOBILE="wc_cosmostation_mobile",u.METAMASK_SNAP_LEAP="metamask_snap_leap",u))(Ge||{}),je=["keplr","leap","vectis","cosmostation","walletconnect","wc_keplr_mobile","wc_leap_mobile","wc_cosmostation_mobile","metamask_snap_leap"];var Jt={recentChain:null,defaultChain:null,defaultSigningClient:"stargate",walletType:"keplr",walletConnect:{options:null,web3Modal:null},_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},ne={account:null,activeChain:null,balances:null,status:"disconnected",wcSignClient:null},en={name:"graz-session",version:1,partialize:t=>({account:t.account,activeChain:t.activeChain}),storage:Xt(()=>sessionStorage)},tn={name:"graz-internal",partialize:t=>({recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:1},g=Ke(Qe(ze(()=>ne,en))),f=Ke(Qe(ze(()=>Jt,tn)));var ae=()=>{if(typeof window.cosmostation.providers.keplr<"u"){let t=window.cosmostation.providers.keplr;return Object.assign(t,{subscription:r=>(window.cosmostation.cosmos.on("accountChanged",()=>{D(),r()}),()=>{window.cosmostation.cosmos.off("accountChanged",()=>{D(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")};var ce=()=>{if(typeof window.keplr<"u"){let t=window.keplr;return Object.assign(t,{subscription:r=>(window.addEventListener("keplr_keystorechange",()=>{D(),r()}),()=>{window.removeEventListener("keplr_keystorechange",()=>{D(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.keplr is not defined")};var le=()=>{if(typeof window.leap<"u"){let t=window.leap;return Object.assign(t,{subscription:r=>(window.addEventListener("leap_keystorechange",()=>{D(),r()}),()=>{window.removeEventListener("leap_keystorechange",()=>{D(),r()})})})}throw f.getState()._notFoundFn(),new Error("window.leap is not defined")};var ot=Ce(me());var rt=t=>{let e=window.ethereum;if(e&&t){let n=async()=>await e.request({method:"wallet_getSnaps"}),r=async y=>{try{let S=await n();return Object.values(S).find(O=>O.id===t.id&&(!y||O.version===y))}catch{return}},o=async()=>{await e.request({method:"wallet_requestSnaps",params:{[t.id]:t.params||{}}})},i=async()=>{let y=await e.request({method:"web3_clientVersion"});if(!(y==null?void 0:y.includes("flask")))throw new Error("Metamask Flask is not detected");return!0},s=async y=>{await r()||await o()},a=async(y,S,O)=>{let U=await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"signDirect",params:{chainId:y,signerAddress:S,signDoc:O}}}}),z=O.accountNumber,te=new ot.default(z.low,z.high,z.unsigned);return{signature:U.signature,signed:{...U.signed,accountNumber:`${te.toString()}`,authInfoBytes:new Uint8Array(Object.values(U.signed.authInfoBytes)),bodyBytes:new Uint8Array(Object.values(U.signed.bodyBytes))}}},c=async(y,S,O)=>await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"signAmino",params:{chainId:y,signerAddress:S,signDoc:O}}}}),u=async y=>{let S=await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"getKey",params:{chainId:y}}}});if(!S)throw new Error("No response from Metamask");return S.pubKey=Uint8Array.from(Object.values(S.pubkey)),delete S.pubkey,{...S}},h=async y=>{let S=await u(y);return{address:S.bech32Address,algo:S.algo,pubkey:S.pubKey}},A=async(...y)=>{let[S,O,U,z]=y;return await c(S,O,U)},C=async(...y)=>{let[S,O,U]=y;return await a(S,O,U)},x=y=>({getAccounts:async()=>[await h(y)],signDirect:(S,O)=>C(y,S,O)}),N=y=>({getAccounts:async()=>[await h(y)],signAmino:(S,O)=>A(y,S,O)});return{getKey:u,getOfflineSigner:y=>({getAccounts:async()=>[await h(y)],signDirect:(S,O)=>C(y,S,O),signAmino:(S,O)=>A(y,S,O)}),getOfflineSignerAuto:async y=>(await u(y)).isNanoLedger?N(y):x(y),getOfflineSignerOnlyAmino:N,signDirect:C,signAmino:A,enable:s,experimentalSuggestChain:async(...y)=>{await e.request({method:"wallet_invokeSnap",params:{snapId:t.id,request:{method:"suggestChain",params:{chainInfo:y[0]}}}})},init:i}}throw f.getState()._notFoundFn(),new Error("window.ethereum is not defined")};var it=()=>rt({id:"npm:@leapwallet/metamask-cosmos-snap"});var st=Ce(me());import{fromBech32 as on}from"@cosmjs/encoding";var pe=()=>{if(typeof window.vectis<"u"){let t=window.vectis.cosmos;return{enable:a=>t.enable(a),getOfflineSigner:a=>t.getOfflineSigner(a),getOfflineSignerAuto:a=>t.getOfflineSignerAuto(a),getKey:async a=>{let c=await t.getKey(a);return{address:on(c.address).data,algo:c.algo,bech32Address:c.address,name:c.name,pubKey:c.pubKey,isKeystone:!1,isNanoLedger:c.isNanoLedger}},subscription:a=>(window.addEventListener("vectis_accountChanged",()=>{D(),a()}),()=>{window.removeEventListener("vectis_accountChanged",()=>{D(),a()})}),getOfflineSignerOnlyAmino:(...a)=>t.getOfflineSignerAmino(...a),experimentalSuggestChain:async(...a)=>{let[c]=a,u={...c,rpcUrl:c.rpc,restUrl:c.rest,prettyName:c.chainName.replace(" ",""),bech32Prefix:c.bech32Config.bech32PrefixAccAddr};return t.suggestChains([u])},signDirect:async(...a)=>{var h;let{1:c,2:u}=a;return t.signDirect(c,{bodyBytes:u.bodyBytes||Uint8Array.from([]),authInfoBytes:u.authInfoBytes||Uint8Array.from([]),accountNumber:st.default.fromString(((h=u.accountNumber)==null?void 0:h.toString())||"",!1),chainId:u.chainId||""})},signAmino:async(...a)=>{let{1:c,2:u}=a;return t.signAmino(c,u)}}}throw f.getState()._notFoundFn(),new Error("window.vectis is not defined")};var ut=Ce(me());import{fromBech32 as rn}from"@cosmjs/encoding";import{SignClient as sn}from"@walletconnect/sign-client";import{getSdkError as an}from"@walletconnect/utils";var B=()=>typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1,at=()=>B()&&navigator.userAgent.toLowerCase().includes("android"),ct=()=>B()&&(navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad"));var lt=(t,e,n=new Error("Promise timed out"))=>{let r=new Promise((o,i)=>{setTimeout(()=>{i(n)},e)});return Promise.race([t,r])};var G=t=>{var z,te,Be;if(!((Be=(te=(z=f.getState().walletConnect)==null?void 0:z.options)==null?void 0:te.projectId)!=null&&Be.trim()))throw new Error("walletConnect.options.projectId is not defined");let e=(t==null?void 0:t.encoding)||"base64",n=p=>{if(!t)return;let{appUrl:m,formatNativeUrl:d}=t;if(B()){if(at())if(!p)window.open(m.mobile.android,"_self","noreferrer noopener");else{let w=d(m.mobile.android,p,"android");window.open(w,"_self","noreferrer noopener")}if(ct())if(!p)window.open(m.mobile.ios,"_self","noreferrer noopener");else{let w=d(m.mobile.ios,p,"ios");window.open(w,"_self","noreferrer noopener")}}},r=()=>{let{wcSignClient:p}=g.getState();if(!p)throw new Error("walletConnect.signClient is not defined");D(),f.setState({_reconnect:!1,_reconnectConnector:null,recentChain:null})},o=async p=>{let{wcSignClient:m}=g.getState();if(!m)throw new Error("walletConnect.signClient is not defined");if(!p)throw new Error("No wallet connect session");await m.disconnect({topic:p,reason:an("USER_DISCONNECTED")}),await a(m),r()},i=p=>{var m,d;try{let{wcSignClient:w}=g.getState();if(!w)throw new Error("walletConnect.signClient is not defined");let b=w.session.getAll().at(-1);if(!b)return;let v=(d=(m=w.session.getAll().at(-1))==null?void 0:m.namespaces.cosmos)==null?void 0:d.accounts.find(k=>k.startsWith(`cosmos:${p}`));if(!(b.expiry*1e3>Date.now()+1e3))throw o(b.topic),new Error("invalid session");if(!v)try{let k=w.find({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!k.length)throw new Error("no session");return k.at(-1)}catch(k){if(!k.message.toLowerCase().includes("no matching key"))throw k}return b}catch(w){if(!w.message.toLowerCase().includes("no matching key"))throw w}},s=p=>{try{return i(p)}catch{return}},a=async p=>{try{let m=p.core.pairing.pairings.getAll({active:!1});if(!m.length)return;await Promise.all(m.map(async d=>{await p.core.pairing.pairings.delete(d.topic,{code:7001,message:"clear pairing"})}))}catch(m){if(!m.message.toLowerCase().includes("no matching key"))throw m}},c=async()=>{let{walletConnect:p}=f.getState();if(!(p!=null&&p.options))throw new Error("walletConnect.options is not defined");let{wcSignClient:m}=g.getState();if(m)return g.setState({wcSignClient:m}),m;let d=await sn.init(p.options);return g.setState({wcSignClient:d}),d},u=p=>{let{wcSignClient:m}=g.getState();if(m)return m.events.on("session_delete",d=>{r()}),m.events.on("session_expire",d=>{r()}),m.events.on("session_event",d=>{var w,b;if(d.params.event.name==="accountsChanged"&&((w=d.params.event.data)==null?void 0:w[0])!==((b=g.getState().account)==null?void 0:b.bech32Address)){let v=d.params.chainId.split(":")[1];v&&h(v)}else p()}),()=>{m.events.off("session_delete",d=>{r()}),m.events.off("session_expire",d=>{r()}),m.events.off("session_event",d=>{var w,b;if(d.params.event.name==="accountsChanged"&&((w=d.params.event.data)==null?void 0:w[0])!==((b=g.getState().account)==null?void 0:b.bech32Address)){let v=d.params.chainId.split(":")[1];v&&h(v)}else p()})}},h=async p=>{var re;let{wcSignClient:m}=g.getState();if(!m)throw new Error("enable walletConnect.signClient is not defined");let{walletConnect:d}=f.getState();if(!((re=d==null?void 0:d.options)!=null&&re.projectId))throw new Error("walletConnect.options.projectId is not defined");let{Web3Modal:w}=await import("@web3modal/standalone"),b=new w({projectId:d.options.projectId,walletConnectVersion:2,enableExplorer:!1,explorerRecommendedWalletIds:"NONE",...d.web3Modal}),{account:v,activeChain:K}=g.getState(),k=s(p);if((K==null?void 0:K.chainId)!==p&&!k||!v){let{uri:M,approval:ie}=await m.connect({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!M)throw new Error("No wallet connect uri");t?n(M):await b.openModal({uri:M});let Zt=async Q=>Q.aborted?Promise.reject(new Error("User closed wallet connect")):new Promise((we,se)=>{ie().then(we).catch(se),Q.addEventListener("abort",()=>{se(new Error("User closed wallet connect"))})});try{let Q=new AbortController,we=Q.signal;b.subscribeModal(se=>{se.open||Q.abort()}),await Zt(we)}catch(Q){if(b.closeModal(),!Q.message.toLowerCase().includes("no matching key"))return Promise.reject(Q)}return t||b.closeModal(),Promise.resolve()}try{await lt((async()=>{let M=await C(p);g.setState({account:M})})(),15e3,new Error("Connection timeout"))}catch(M){if(o(k==null?void 0:k.topic),!M.message.toLowerCase().includes("no matching key"))throw M}},A=async p=>{var b;let{wcSignClient:m}=g.getState();if(!m)throw new Error("walletConnect.signClient is not defined");let d=(b=i(p))==null?void 0:b.topic;if(!d)throw new Error("No wallet connect session");n();let w=await m.request({topic:d,chainId:`cosmos:${p}`,request:{method:"cosmos_getAccounts",params:{}}});if(!w[0])throw new Error("No wallet connect account");return{address:w[0].address,algo:w[0].algo,pubkey:new Uint8Array(Buffer.from(w[0].pubkey,e))}},C=async p=>{let{address:m,algo:d,pubkey:w}=await A(p);return{address:rn(m).data,algo:d,bech32Address:m,name:"",pubKey:w,isKeystone:!1,isNanoLedger:!1}},x=async(...p)=>{var M,ie;let[m,d,w]=p,{account:b,wcSignClient:v}=g.getState();if(!v)throw new Error("walletConnect.signClient is not defined");if(!b)throw new Error("account is not defined");let K=(M=i(m))==null?void 0:M.topic;if(!K)throw new Error("No wallet connect session");if(!w.bodyBytes)throw new Error("No bodyBytes");if(!w.authInfoBytes)throw new Error("No authInfoBytes");let k={topic:K,chainId:`cosmos:${m}`,request:{method:"cosmos_signDirect",params:{signerAddress:d,signDoc:{...w,bodyBytes:Buffer.from(w.bodyBytes).toString(e),authInfoBytes:Buffer.from(w.authInfoBytes).toString(e),accountNumber:(ie=w.accountNumber)==null?void 0:ie.toString()}}}};return n(),await v.request(k)},N=async(...p)=>{let[m,d,w]=p,{signature:b,signed:v}=await x(m,d,w);return{signed:{chainId:v.chainId,accountNumber:ut.default.fromString(v.accountNumber,!1),authInfoBytes:new Uint8Array(Buffer.from(v.authInfoBytes,e)),bodyBytes:new Uint8Array(Buffer.from(v.bodyBytes,e))},signature:b}},ee=async(...p)=>{var M;let[m,d,w,b]=p,{wcSignClient:v}=g.getState(),{account:K}=g.getState();if(!v)throw new Error("walletConnect.signClient is not defined");if(!K)throw new Error("account is not defined");let k=(M=i(m))==null?void 0:M.topic;if(!k)throw new Error("No wallet connect session");return n(),await v.request({topic:k,chainId:`cosmos:${m}`,request:{method:"cosmos_signDirect",params:{signerAddress:d,signDoc:w}}})},V=async(...p)=>{let[m,d,w,b]=p;return await ee(m,d,w)},Ue=p=>({getAccounts:async()=>[await A(p)],signDirect:(m,d)=>N(p,m,d)}),y=p=>({getAccounts:async()=>[await A(p)],signAmino:(m,d)=>V(p,m,d)});return{enable:h,experimentalSuggestChain:async(...p)=>{await Promise.reject(new Error("WalletConnect does not support experimentalSuggestChain"))},getKey:C,getOfflineSigner:p=>({getAccounts:async()=>[await A(p)],signDirect:(m,d)=>N(p,m,d),signAmino:(m,d)=>V(p,m,d)}),getOfflineSignerAuto:async p=>(await C(p)).isNanoLedger?y(p):Ue(p),getOfflineSignerOnlyAmino:y,signAmino:V,signDirect:N,subscription:u,init:c}};var mt=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!B())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"hex",appUrl:{mobile:{ios:"cosmostation://",android:"cosmostation://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,i,s)=>`${o.replaceAll("/","").replaceAll(":","")}://wc?${i}`};return G(t)};var pt=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!B())throw new Error("WalletConnect Keplr mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"keplrwallet://",android:"intent://"}},walletType:"wc_keplr_mobile",formatNativeUrl:(o,i,s)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(i);switch(s){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return G(t)};var gt=()=>{var e,n,r;if(!((r=(n=(e=f.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!B())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"leapcosmos://",android:"intent://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,i,s)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(i);switch(s){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return G(t)};var W=(t=f.getState().walletType)=>{try{return T(t),!0}catch{return!1}},D=()=>{window.sessionStorage.removeItem($),g.setState(ne)},T=(t=f.getState().walletType)=>{switch(t){case"keplr":return ce();case"leap":return le();case"cosmostation":return ae();case"vectis":return pe();case"walletconnect":return G();case"wc_keplr_mobile":return pt();case"wc_leap_mobile":return gt();case"wc_cosmostation_mobile":return mt();case"metamask_snap_leap":return it();default:throw new Error("Unknown wallet type")}},tr=()=>Object.fromEntries(je.map(t=>[t,W(t)]));var oe=async t=>{var e;try{let{defaultChain:n,recentChain:r,walletType:o}=f.getState(),i=(t==null?void 0:t.walletType)||o;if(!W(i))throw new Error(`${i} is not available`);let a=T(i),c=(t==null?void 0:t.chain)||r||n;if(!c)throw new Error("No last known connected chain, connect action requires chain info");g.setState(C=>{let x=f.getState()._reconnect||!!f.getState()._reconnectConnector||!!c;return C.activeChain&&C.activeChain.chainId!==c.chainId?{status:"connecting"}:x?{status:"reconnecting"}:{status:"connecting"}});let{account:u,activeChain:h}=g.getState();if(await((e=a.init)==null?void 0:e.call(a)),!u||(h==null?void 0:h.chainId)!==c.chainId){await a.enable(c.chainId);let C=await a.getKey(c.chainId);g.setState({account:C})}f.setState({recentChain:c,walletType:i,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:i}),g.setState({activeChain:c,status:"connected"}),typeof window<"u"&&window.sessionStorage.setItem($,"Active");let{account:A}=g.getState();return{account:A,walletType:i,chain:c}}catch(n){throw console.error("connect ",n),g.getState().account===null&&g.setState({status:"disconnected"}),g.getState().account&&g.getState().activeChain&&g.setState({status:"connected"}),n}},Ee=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem($),g.setState(ne),f.setState(e=>({_reconnect:!1,_reconnectConnector:null,recentChain:t?null:e.recentChain})),Promise.resolve()),j=async t=>{var o;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=f.getState();try{let i=W(n||void 0);if(e&&i&&n)return await oe({chain:e,walletType:n,autoReconnect:r})}catch(i){(o=t==null?void 0:t.onError)==null||o.call(t,i),Ee()}},ft=async t=>{if(!(t!=null&&t.chainId))throw new Error("chainId is required");let{walletType:e}=f.getState(),n=t.walletType||e;if(!W(n))throw new Error(`${n} is not available`);let o=T(n),i=o.getOfflineSigner(t.chainId),s=o.getOfflineSignerOnlyAmino(t.chainId),a=await o.getOfflineSignerAuto(t.chainId);return{offlineSigner:i,offlineSignerAmino:s,offlineSignerAuto:a}};var dt=()=>{f.setState({recentChain:null})},ht=t=>{let{activeChain:e}=g.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},ur=()=>f.getState().recentChain,Ie=async t=>(await T().experimentalSuggestChain(t),t),yt=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...o})=>{let i=await Ie(t);return{...await oe({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...o}),chain:i}};var wt=(t={})=>(f.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletConnect:t.walletConnect||e.walletConnect,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var Ct=async({signingClient:t,senderAddress:e,recipientAddress:n,amount:r,fee:o,memo:i})=>{if(!t)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return t.sendTokens(e,n,r,o,i)},St=async({signingClient:t,senderAddress:e,recipientAddress:n,transferAmount:r,sourcePort:o,sourceChannel:i,timeoutHeight:s,timeoutTimestamp:a,fee:c,memo:u})=>{if(!t)throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return t.sendIbcTokens(e,n,r,o,i,s,a,c,u)},At=async({signingClient:t,senderAddress:e,msg:n,fee:r,options:o,label:i,codeId:s})=>{if(!t)throw new Error("CosmWasm signing client is not ready");return t.instantiate(e,s,n,i,r,o)},Et=async({signingClient:t,senderAddress:e,msg:n,fee:r,contractAddress:o,funds:i,memo:s})=>{if(!t)throw new Error("CosmWasm signing client is not ready");return t.execute(e,o,n,r,s,i)},It=async(t,e,n)=>{if(!n)throw new Error("CosmWasm client is not ready");return await n.queryContractSmart(t,e)},bt=(t,e,n)=>{if(!n)throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.queryContractRaw(t,r)};import{Bech32Address as cn}from"@keplr-wallet/cosmos";var xt={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},ln={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},un={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},mn={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},pn={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},gn={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},Tt=[xt,ln,un,mn,pn,gn],be={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:xt,bip44:{coinType:118},bech32Config:cn.defaultBech32Config("axelar"),currencies:Tt,feeCurrencies:Tt};import{Bech32Address as fn}from"@keplr-wallet/cosmos";var Ot={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},vt=[Ot],Te={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:Ot,bip44:{coinType:118},bech32Config:fn.defaultBech32Config("cosmos"),currencies:vt,feeCurrencies:vt};import{Bech32Address as dn}from"@keplr-wallet/cosmos";var Wt={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},hn={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},yn={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},wn={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Cn={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Sn={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},An={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},En={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},In={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},bn={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Tn={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},kt=[Wt,hn,yn,wn,Cn,Sn,An,En,In,bn,Tn],xe={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:Wt,bip44:{coinType:118},bech32Config:dn.defaultBech32Config("juno"),currencies:kt,feeCurrencies:kt};import{Bech32Address as xn}from"@keplr-wallet/cosmos";var Mt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},vn={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Nt=[Mt,vn],ve={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Mt,bip44:{coinType:118},bech32Config:xn.defaultBech32Config("osmo"),currencies:Nt,feeCurrencies:Nt};import{Bech32Address as On}from"@keplr-wallet/cosmos";var Ft={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},Dt=[Ft],Oe={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:Ft,bip44:{coinType:118},bech32Config:On.defaultBech32Config("somm"),currencies:Dt,feeCurrencies:Dt};import{Bech32Address as kn}from"@keplr-wallet/cosmos";var Pt={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},_t=[Pt],ke={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:kn.defaultBech32Config("CRE"),currencies:_t,feeCurrencies:_t,stakeCurrency:Pt,coinType:118};import{Bech32Address as Wn}from"@keplr-wallet/cosmos";var We={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Nn=[We],Ne={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:We,bip44:{coinType:118},bech32Config:Wn.defaultBech32Config("juno"),currencies:Nn,feeCurrencies:[We],coinType:118};import{Bech32Address as Mn}from"@keplr-wallet/cosmos";var Me={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Dn=[Me],De={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:Me,bip44:{coinType:118},bech32Config:Mn.defaultBech32Config("osmo"),currencies:Dn,feeCurrencies:[Me],coinType:118};var Rt=t=>t,Lr=t=>t,Ur=t=>t,Br=Rt({axelar:be,cosmoshub:Te,juno:xe,osmosis:ve,sommelier:Oe}),Gr=[be,Te,xe,ve,Oe],jr=Rt({crescent:ke,juno:Ne,osmosis:De}),Kr=[ke,Ne,De];import{useMutation as qt,useQuery as fe}from"@tanstack/react-query";import{useEffect as Un,useMemo as Le}from"react";import{CosmWasmClient as Fn}from"@cosmjs/cosmwasm-stargate";import{StargateClient as _n}from"@cosmjs/stargate";import{Tendermint34Client as Pn,Tendermint37Client as Rn}from"@cosmjs/tendermint-rpc";import{useQuery as Fe}from"@tanstack/react-query";import{useMemo as _e}from"react";var Pe=()=>{let t=g(n=>n.activeChain),e=_e(()=>["USE_STARGATE_CLIENT",t],[t]);return Fe({queryKey:e,queryFn:async({queryKey:[,n]})=>{if(!n)throw new Error("No chain found");let r={url:n.rpc,headers:{...n.rpcHeaders||{}}};return await _n.connect(r)},enabled:!!t,refetchOnWindowFocus:!1})},Re=()=>{let t=g(n=>n.activeChain),e=_e(()=>["USE_COSMWASM_CLIENT",t],[t]);return Fe({queryKey:e,queryFn:async({queryKey:[,n]})=>{if(!n)throw new Error("No chain found");let r={url:n.rpc,headers:{...n.rpcHeaders||{}}};return await Fn.connect(r)},enabled:!!t,refetchOnWindowFocus:!1})},qe=t=>{let e=g(r=>r.activeChain),n=_e(()=>["USE_TENDERMINT_CLIENT",t,e],[t,e]);return Fe({queryKey:n,queryFn:async({queryKey:[,r,o]})=>{if(!o)throw new Error("No chain found");let i={url:o.rpc,headers:{...o.rpcHeaders||{}}};return await(r==="tm37"?Rn:Pn).connect(i)},enabled:!!e,refetchOnWindowFocus:!1})};import{useQuery as qn}from"@tanstack/react-query";import{shallow as Ln}from"zustand/shallow";var oi=()=>f(t=>({walletType:t.walletType,isCosmostation:t.walletType==="cosmostation",isCosmostationMobile:t.walletType==="wc_cosmostation_mobile",isKeplr:t.walletType==="keplr",isKeplrMobile:t.walletType==="wc_keplr_mobile",isLeap:t.walletType==="leap",isLeapMobile:t.walletType==="wc_leap_mobile",isVectis:t.walletType==="vectis",isWalletConnect:t.walletType==="walletconnect"}),Ln),ge=t=>{let n=["USE_CHECK_WALLET",f(o=>t||o.walletType)];return qn(n,({queryKey:[,o]})=>W(o))};var H=({onConnect:t,onDisconnect:e}={})=>{let n=g(o=>o.account),r=g(o=>o.status);return Un(()=>g.subscribe(o=>o.status,(o,i)=>{if(o==="connected"){let{account:s,activeChain:a}=g.getState(),{walletType:c}=f.getState();t==null||t({account:s,chain:a,walletType:c,isReconnect:i==="reconnecting"})}o==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:j,status:r}},Bn=t=>{let{data:e}=H(),{data:n}=Pe(),{activeChain:r}=g.getState(),o=t||(e==null?void 0:e.bech32Address),i=Le(()=>["USE_ALL_BALANCES",n,r,o],[r,o,n]);return fe(i,async({queryKey:[,a,c,u]})=>{if(!c||!a)throw new Error("No connected account detected");if(!u)throw new Error("address is not defined");return await a.getAllBalances(u)},{enabled:!!o&&!!r&&!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})},pi=(t,e)=>{let{data:n}=H(),r=e||(n==null?void 0:n.bech32Address),{data:o,refetch:i}=Bn(r),a=fe(["USE_BALANCE",o,t,e],({queryKey:[,c]})=>c==null?void 0:c.find(u=>u.denom===t),{enabled:!!o});return{...a,refetch:async()=>(await i(),a.refetch())}},gi=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=qt(["USE_CONNECT",t,e,n],oe,{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=ge();return{connect:s=>o.mutate(s),connectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!i,status:o.status}},fi=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=qt(["USE_DISCONNECT",t,e,n],Ee,{onError:i=>Promise.resolve(t==null?void 0:t(i,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:i=>o.mutate(i),disconnectAsync:i=>o.mutateAsync(i),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,status:o.status}},di=()=>{let t=g(r=>r.activeChain),e=f(r=>r.walletType),n=Le(()=>["USE_OFFLINE_SIGNERS",t,e],[t,e]);return fe({queryKey:n,queryFn:async({queryKey:[,r,o]})=>{if(!r)throw new Error("No chain found");if(!W(o))throw new Error(`${o} is not available`);return await ft({chainId:r.chainId,walletType:o})},enabled:!!t&&!!e,refetchOnWindowFocus:!1})},hi=t=>{let{data:e}=H(),{data:n}=Pe(),{activeChain:r}=g.getState(),o=t||(e==null?void 0:e.bech32Address),i=Le(()=>["USE_BALANCE_STAKED",n,r,o],[r,o,n]);return fe(i,async({queryKey:[,a,c,u]})=>{if(!c||!a)throw new Error("No connected account detected");if(!u)throw new Error("address is not defined");return await a.getBalanceStaked(u)},{enabled:!!o&&!!r&&!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})};import{useMutation as Lt,useQuery as Ut}from"@tanstack/react-query";var Ei=()=>g(t=>t.activeChain),Ii=t=>Ut(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>ht(r)),bi=(t,e="BOND_STATUS_BONDED")=>Ut(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],async({queryKey:[,o,i]})=>{if(!o)throw new Error("Query client is not defined");return await o.staking.validators(i)},{enabled:typeof t<"u"}),Ti=()=>({data:f(e=>e.recentChain),clear:dt}),xi=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=Lt(["USE_SUGGEST_CHAIN",t,e,n],Ie,{onError:(i,s)=>Promise.resolve(t==null?void 0:t(i,s)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,suggest:o.mutate,suggestAsync:o.mutateAsync,status:o.status}},vi=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=Lt(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],yt,{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:s=>e==null?void 0:e(s),onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=ge();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!i,status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}};import{useMutation as de,useQuery as Bt}from"@tanstack/react-query";var Di=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=H(),o=r==null?void 0:r.bech32Address,i=de(["USE_SEND_TOKENS",t,e,n,o],s=>Ct({senderAddress:o,...s}),{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},Fi=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=H(),o=r==null?void 0:r.bech32Address,i=de(["USE_SEND_IBC_TOKENS",t,e,n,o],s=>St({senderAddress:o,...s}),{onError:(s,a)=>Promise.resolve(t==null?void 0:t(s,a)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},_i=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=H(),i=o==null?void 0:o.bech32Address,a=de(["USE_INSTANTIATE_CONTRACT",e,n,r,t,i],c=>{if(!i)throw new Error("senderAddress is undefined");let u={...c,fee:c.fee??"auto",senderAddress:i,codeId:t};return At(u)},{onError:(c,u)=>Promise.resolve(e==null?void 0:e(c,u)),onMutate:n,onSuccess:c=>Promise.resolve(r==null?void 0:r(c))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,instantiateContract:a.mutate,instantiateContractAsync:a.mutateAsync,status:a.status}},Pi=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=H(),i=o==null?void 0:o.bech32Address,a=de(["USE_EXECUTE_CONTRACT",e,n,r,t,i],c=>{if(!i)throw new Error("senderAddress is undefined");let u={...c,fee:c.fee??"auto",senderAddress:i,contractAddress:t,memo:c.memo??"",funds:c.funds??[]};return Et(u)},{onError:(c,u)=>Promise.resolve(e==null?void 0:e(c,u)),onMutate:n,onSuccess:c=>Promise.resolve(r==null?void 0:r(c))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,executeContract:a.mutate,executeContractAsync:a.mutateAsync,status:a.status}},Ri=(t,e)=>{let{data:n}=Re();return Bt(["USE_QUERY_SMART",t,e,n],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return It(t,e,n)},{enabled:!!t&&!!e&&!!n})},qi=(t,e)=>{let{data:n}=Re();return Bt(["USE_QUERY_RAW",e,t,n],({queryKey:[,i]})=>{if(!t||!e)throw new Error("address or key undefined");return bt(t,e,n)},{enabled:!!t&&!!e&&!!n})};import{SigningCosmWasmClient as Gt}from"@cosmjs/cosmwasm-stargate";import{GasPrice as jt,SigningStargateClient as Kt}from"@cosmjs/stargate";import{useQuery as he}from"@tanstack/react-query";import{useMemo as ye}from"react";var Hi=t=>{let e=g(o=>o.activeChain),n=f(o=>o.walletType),r=ye(()=>["USE_STARGATE_SIGNING_CLIENT",e,n,t],[t,e,n]);return he({queryKey:r,queryFn:async({queryKey:[,o,i,s]})=>{if(!o)throw new Error("No chain found");if(!W(i))throw new Error(`${i} is not available`);let c=await(async()=>{switch(t==null?void 0:t.offlineSigner){case"offlineSigner":return T(i).getOfflineSigner(o.chainId);case"offlineSignerAuto":return T(i).getOfflineSignerAuto(o.chainId);case"offlineSignerOnlyAmino":return T(i).getOfflineSignerOnlyAmino(o.chainId);default:return T(i).getOfflineSignerAuto(o.chainId)}})(),u={url:o.rpc,headers:{...o.rpcHeaders||{}}};return await Kt.connectWithSigner(u,c,s==null?void 0:s.opts)},enabled:!!e&&!!n,refetchOnWindowFocus:!1})},Vi=t=>{let e=g(o=>o.activeChain),n=f(o=>o.walletType),r=ye(()=>["USE_COSMWASM_SIGNING_CLIENT",e,n,t],[t,e,n]);return he({queryKey:r,queryFn:async({queryKey:[,o,i,s]})=>{if(!o)throw new Error("No chain found");if(!W(i))throw new Error(`${i} is not available`);let c=await(async()=>{switch(t==null?void 0:t.offlineSigner){case"offlineSigner":return T(i).getOfflineSigner(o.chainId);case"offlineSignerAuto":return T(i).getOfflineSignerAuto(o.chainId);case"offlineSignerOnlyAmino":return T(i).getOfflineSignerOnlyAmino(o.chainId);default:return T(i).getOfflineSignerAuto(o.chainId)}})(),u={url:o.rpc,headers:{...o.rpcHeaders||{}}},h=o.gas?jt.fromString(`${o.gas.price}${o.gas.denom}`):void 0;return await Gt.connectWithSigner(u,c,{gasPrice:h,...(s==null?void 0:s.opts)||{}})},enabled:!!e&&!!n,refetchOnWindowFocus:!1})},$i=t=>{let e=g(i=>i.activeChain),n=f(i=>i.walletType),r=ye(()=>["USE_STARGATE_TM_SIGNING_CLIENT",e,n,t],[t,e,n]),{data:o}=qe(t.type);return he({queryKey:r,queryFn:async({queryKey:[,i,s,a]})=>{if(!i)throw new Error("No chain found");if(!W(s))throw new Error(`${s} is not available`);if(!o)throw new Error("No tendermint client found");let u=await(async()=>{switch(t.offlineSigner){case"offlineSigner":return T(s).getOfflineSigner(i.chainId);case"offlineSignerAuto":return T(s).getOfflineSignerAuto(i.chainId);case"offlineSignerOnlyAmino":return T(s).getOfflineSignerOnlyAmino(i.chainId);default:return T(s).getOfflineSignerAuto(i.chainId)}})();return Kt.createWithSigner(o,u,a.opts)},enabled:!!e&&!!n&&!!o,refetchOnWindowFocus:!1})},Zi=t=>{let e=g(i=>i.activeChain),n=f(i=>i.walletType),r=ye(()=>["USE_COSMWASM_TM_SIGNING_CLIENT",e,n,t],[t,e,n]),{data:o}=qe(t.type);return he({queryKey:r,queryFn:async({queryKey:[,i,s,a]})=>{if(!i)throw new Error("No chain found");if(!W(s))throw new Error(`${s} is not available`);if(!o)throw new Error("No tendermint client found");let u=await(async()=>{switch(t.offlineSigner){case"offlineSigner":return T(s).getOfflineSigner(i.chainId);case"offlineSignerAuto":return T(s).getOfflineSignerAuto(i.chainId);case"offlineSignerOnlyAmino":return T(s).getOfflineSignerOnlyAmino(i.chainId);default:return T(s).getOfflineSignerAuto(i.chainId)}})(),h=i.gas?jt.fromString(`${i.gas.price}${i.gas.denom}`):void 0;return Gt.createWithSigner(o,u,{gasPrice:h,...(a==null?void 0:a.opts)||{}})},enabled:!!e&&!!n&&!!o,refetchOnWindowFocus:!1})};import{QueryClient as Hn,QueryClientProvider as Vn}from"@tanstack/react-query";import{ReactQueryDevtools as $n}from"@tanstack/react-query-devtools";import{useEffect as Gn,useState as jn}from"react";import{Fragment as Kn,jsx as zn}from"react/jsx-runtime";var zt=({children:t})=>{let[e,n]=jn(!1);return Gn(()=>{n(!0)},[]),zn(Kn,{children:e?t:null})};import{useEffect as Qt}from"react";var Qn=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem($)==="Active",{_reconnect:e,_onReconnectFailed:n,_reconnectConnector:r}=f(),{activeChain:o,wcSignClient:i}=g(),s=W(r||void 0);return Qt(()=>{if(r){if(!s)return;t&&o?j({onError:n}):!t&&e&&j({onError:n})}},[s]),Qt(()=>{var a,c,u,h,A,C,x,N,ee,V;if(r){if(!s)return;r==="cosmostation"&&((c=(a=ae()).subscription)==null||c.call(a,()=>{j({onError:n})})),r==="keplr"&&((h=(u=ce()).subscription)==null||h.call(u,()=>{j({onError:n})})),r==="leap"&&((C=(A=le()).subscription)==null||C.call(A,()=>{j({onError:n})})),r==="vectis"&&((N=(x=pe()).subscription)==null||N.call(x,()=>{j({onError:n})})),r==="walletconnect"&&i&&((V=(ee=G()).subscription)==null||V.call(ee,()=>{j({onError:n})}))}},[r,i,s]),null},Ht=()=>(Qn(),null);import{jsx as Vt,jsxs as $t}from"react/jsx-runtime";var Zn=new Hn({}),ys=({children:t,grazOptions:e,debug:n,...r})=>(e&&wt(e),$t(Vn,{client:Zn,...r,children:[$t(zt,{children:[t,Vt(Ht,{})]}),n?Vt($n,{initialIsOpen:!1,position:"bottom-right"}):null]},"graz-provider"));export{Ht as GrazEvents,ys as GrazProvider,je as WALLET_TYPES,Ge as WalletType,W as checkWallet,dt as clearRecentChain,D as clearSession,wt as configureGraz,oe as connect,Lr as defineChain,Ur as defineChainInfo,Rt as defineChains,Ee as disconnect,Et as executeContract,ht as getActiveChainCurrency,tr as getAvailableWallets,ae as getCosmostation,ce as getKeplr,le as getLeap,it as getMetamaskSnapLeap,ft as getOfflineSigners,bt as getQueryRaw,It as getQuerySmart,ur as getRecentChain,pe as getVectis,mt as getWCCosmostation,pt as getWCKeplr,gt as getWCLeap,T as getWallet,G as getWalletConnect,At as instantiateContract,Br as mainnetChains,Gr as mainnetChainsArray,j as reconnect,St as sendIbcTokens,Ct as sendTokens,Ie as suggestChain,yt as suggestChainAndConnect,jr as testnetChains,Kr as testnetChainsArray,H as useAccount,Ei as useActiveChain,Ii as useActiveChainCurrency,bi as useActiveChainValidators,oi as useActiveWalletType,pi as useBalance,hi as useBalanceStaked,Bn as useBalances,ge as useCheckWallet,gi as useConnect,Re as useCosmWasmClient,Vi as useCosmWasmSigningClient,Zi as useCosmWasmTmSigningClient,fi as useDisconnect,Pi as useExecuteContract,Qn as useGrazEvents,_i as useInstantiateContract,di as useOfflineSigners,qi as useQueryRaw,Ri as useQuerySmart,Ti as useRecentChain,Fi as useSendIbcTokens,Di as useSendTokens,Pe as useStargateClient,Hi as useStargateSigningClient,$i as useStargateTmSigningClient,xi as useSuggestChain,vi as useSuggestChainAndConnect,qe as useTendermintClient};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graz",
|
|
3
3
|
"description": "React hooks for Cosmos",
|
|
4
|
-
"version": "0.0.49
|
|
4
|
+
"version": "0.0.49",
|
|
5
5
|
"author": "Griko Nibras <griko@strange.love>",
|
|
6
6
|
"repository": "https://github.com/graz-sh/graz.git",
|
|
7
7
|
"homepage": "https://github.com/graz-sh/graz",
|
|
@@ -21,14 +21,6 @@
|
|
|
21
21
|
"dist/*.mjs"
|
|
22
22
|
],
|
|
23
23
|
"sideEffects": false,
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsup",
|
|
26
|
-
"clean": "rm -rf dist/*",
|
|
27
|
-
"cli": "node cli.mjs",
|
|
28
|
-
"dev": "tsup --watch",
|
|
29
|
-
"lint": "eslint --fix \"src/**/*.{ts,tsx}\"",
|
|
30
|
-
"prepublishOnly": "pnpm build"
|
|
31
|
-
},
|
|
32
24
|
"dependencies": {
|
|
33
25
|
"@cosmjs/cosmwasm-stargate": "^0.31.0",
|
|
34
26
|
"@cosmjs/launchpad": "^0.27.1",
|
|
@@ -66,5 +58,12 @@
|
|
|
66
58
|
"graz-sh",
|
|
67
59
|
"use-keplr"
|
|
68
60
|
],
|
|
69
|
-
"license": "MIT"
|
|
70
|
-
|
|
61
|
+
"license": "MIT",
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsup",
|
|
64
|
+
"clean": "rm -rf dist/*",
|
|
65
|
+
"cli": "node cli.mjs",
|
|
66
|
+
"dev": "tsup --watch",
|
|
67
|
+
"lint": "eslint --fix \"src/**/*.{ts,tsx}\""
|
|
68
|
+
}
|
|
69
|
+
}
|