graz 0.0.25 → 0.0.27

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/cosmjs.mjs CHANGED
@@ -1 +1 @@
1
- import{c as o}from"./chunk-6M3A6KFX.mjs";o();export*from"@cosmjs/cosmwasm-stargate";export*from"@cosmjs/proto-signing";export*from"@cosmjs/stargate";
1
+ export*from"@cosmjs/cosmwasm-stargate";export*from"@cosmjs/proto-signing";export*from"@cosmjs/stargate";
package/dist/index.d.ts CHANGED
@@ -238,7 +238,7 @@ interface ConfigureGrazArgs {
238
238
  declare function configureGraz(args?: ConfigureGrazArgs): ConfigureGrazArgs;
239
239
 
240
240
  declare function getBalances(bech32Address: string): Promise<Coin[]>;
241
- declare function getStakedBalances(bech32Address: string): Promise<Coin | null>;
241
+ declare function getBalanceStaked(bech32Address: string): Promise<Coin | null>;
242
242
  interface SendTokensArgs {
243
243
  senderAddress?: string;
244
244
  recipientAddress: string;
@@ -503,16 +503,16 @@ declare function useSigners(): {
503
503
  *
504
504
  * @example
505
505
  * ```ts
506
- * import { useStakedBalances } from "graz";
506
+ * import { useBalanceStaked } from "graz";
507
507
  *
508
508
  * // basic example
509
- * const { data, isFetching, refetch, ... } = useStakedBalances();
509
+ * const { data, isFetching, refetch, ... } = useBalanceStaked();
510
510
  *
511
511
  * // with custom bech32 address
512
- * useStakedBalances("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
512
+ * useBalanceStaked("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
513
513
  * ```
514
514
  */
515
- declare function useStakedBalances(bech32Address?: string): UseQueryResult<Coin | null>;
515
+ declare function useBalanceStaked(bech32Address?: string): UseQueryResult<Coin | null>;
516
516
 
517
517
  /**
518
518
  * graz hook to retrieve connected account's active chain
@@ -558,11 +558,11 @@ declare function useActiveChainValidators<T extends QueryClient & StakingExtensi
558
558
  * @example
559
559
  * ```ts
560
560
  * import { useRecentChain, connect, mainnetChains } from "graz";
561
- * const recentChain = useRecentChain();
561
+ * const { data: recentChain, clear } = useRecentChain();
562
562
  * try {
563
- * connect();
564
- * } catch {
565
563
  * connect(mainnetChains.cosmos);
564
+ * } catch {
565
+ * connect(recentChain);
566
566
  * }
567
567
  * ```
568
568
  *
@@ -574,7 +574,7 @@ declare function useRecentChain(): {
574
574
  };
575
575
  declare type UseSuggestChainArgs = MutationEventArgs<ChainInfo>;
576
576
  /**
577
- * graz mutation hook to suggest chain to Keplr Wallet
577
+ * graz mutation hook to suggest chain to a Wallet
578
578
  *
579
579
  * @example
580
580
  * ```ts
@@ -602,7 +602,7 @@ declare type UseSuggestChainAndConnectArgs = MutationEventArgs<SuggestChainAndCo
602
602
  account: Key;
603
603
  }>;
604
604
  /**
605
- * graz mutation hook to suggest chain to Keplr Wallet and connect account
605
+ * graz mutation hook to suggest chain to a Wallet and connect account
606
606
  * afterwards
607
607
  *
608
608
  * @example
@@ -681,7 +681,7 @@ declare function useQueryClient<A extends object, B extends object, C extends ob
681
681
  declare function useQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object, H extends object, I extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>, setupH: ExtensionSetup<H>, setupI: ExtensionSetup<I>): UseQueryResult<QueryClient & A & B & C & D & E & F & G & H & I>;
682
682
 
683
683
  /**
684
- * graz query hook to retrieve a CosmWasmClient. If there's no given arguments it will be using the current connected client
684
+ * graz query hook to retrieve a CosmWasmClient, StargateClient and Tendermint34Client. If there's no given arguments it will be using the current connected client
685
685
  *
686
686
  * @example
687
687
  * ```ts
@@ -831,4 +831,4 @@ declare function useGrazEvents(): null;
831
831
  */
832
832
  declare function GrazEvents(): null;
833
833
 
834
- export { ChainInfoWithPath, ConfigureGrazArgs, ConnectArgs, CreateClientArgs, CreateSigningClientArgs, Dictionary, GrazAdapter, GrazChain, GrazEvents, GrazProvider, GrazProviderProps, Maybe, SendIbcTokensArgs, SendTokensArgs, SuggestChainAndConnectArgs, UseAccountArgs, UseConnectChainArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WALLET_TYPES, WalletType, checkWallet, clearRecentChain, configureGraz, connect, createClients, createQueryClient, createSigningClients, defineChain, defineChainInfo, defineChains, disconnect, getActiveChainCurrency, getAvailableWallets, getBalances, getKeplr, getLeap, getRecentChain, getStakedBalances, getWallet, mainnetChains, mainnetChainsArray, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChain, useActiveChainCurrency, useActiveChainValidators, useBalance, useBalances, useCheckKeplr, useCheckWallet, useClients, useConnect, useDisconnect, useGrazEvents, useOfflineSigners, useQueryClient, useRecentChain, useSendIbcTokens, useSendTokens, useSigners, useSigningClients, useStakedBalances, useSuggestChain, useSuggestChainAndConnect };
834
+ export { ChainInfoWithPath, ConfigureGrazArgs, ConnectArgs, CreateClientArgs, CreateSigningClientArgs, Dictionary, GrazAdapter, GrazChain, GrazEvents, GrazProvider, GrazProviderProps, Maybe, SendIbcTokensArgs, SendTokensArgs, SuggestChainAndConnectArgs, UseAccountArgs, UseConnectChainArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WALLET_TYPES, WalletType, checkWallet, clearRecentChain, configureGraz, connect, createClients, createQueryClient, createSigningClients, defineChain, defineChainInfo, defineChains, disconnect, getActiveChainCurrency, getAvailableWallets, getBalanceStaked, getBalances, getKeplr, getLeap, getRecentChain, getWallet, mainnetChains, mainnetChainsArray, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChain, useActiveChainCurrency, useActiveChainValidators, useBalance, useBalanceStaked, useBalances, useCheckKeplr, useCheckWallet, useClients, useConnect, useDisconnect, useGrazEvents, useOfflineSigners, useQueryClient, useRecentChain, useSendIbcTokens, useSendTokens, useSigners, useSigningClients, useSuggestChain, useSuggestChainAndConnect };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var it=Object.create;var I=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var at=Object.getPrototypeOf,pt=Object.prototype.hasOwnProperty;var mt=(e,t)=>()=>(e&&(t=e(e=0)),t);var w=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),lt=(e,t)=>{for(var n in t)I(e,n,{get:t[n],enumerable:!0})},fe=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ut(t))!pt.call(e,o)&&o!==n&&I(e,o,{get:()=>t[o],enumerable:!(c=ct(t,o))||c.enumerable});return e};var T=(e,t,n)=>(n=e!=null?it(at(e)):{},fe(t||!e||!e.__esModule?I(n,"default",{value:e,enumerable:!0}):n,e)),ft=e=>fe(I({},"__esModule",{value:!0}),e);var a,r=mt(()=>{"use strict";a=T(require("react"))});var de=w(C=>{"use strict";r();Object.defineProperty(C,"__esModule",{value:!0});C.arrayContentStartsWith=C.arrayContentEquals=void 0;function dt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}C.arrayContentEquals=dt;function gt(e,t){if(e.length<t.length)return!1;for(let n=0;n<t.length;++n)if(e[n]!==t[n])return!1;return!0}C.arrayContentStartsWith=gt});var ge=w(f=>{"use strict";r();Object.defineProperty(f,"__esModule",{value:!0});f.assertDefinedAndNotNull=f.assertDefined=f.assert=void 0;function Ct(e,t){if(!e)throw new Error(t||"condition is not truthy")}f.assert=Ct;function ht(e,t){if(e===void 0)throw new Error(t??"value is undefined")}f.assertDefined=ht;function xt(e,t){if(e==null)throw new Error(t??"value is undefined or null")}f.assertDefinedAndNotNull=xt});var Ce=w(v=>{"use strict";r();Object.defineProperty(v,"__esModule",{value:!0});v.sleep=void 0;async function St(e){return new Promise(t=>setTimeout(t,e))}v.sleep=St});var xe=w(h=>{"use strict";r();Object.defineProperty(h,"__esModule",{value:!0});h.isUint8Array=h.isNonNullObject=void 0;function he(e){return typeof e=="object"&&e!==null}h.isNonNullObject=he;function At(e){return!(!he(e)||Object.prototype.toString.call(e)!=="[object Uint8Array]"||typeof Buffer<"u"&&typeof Buffer.isBuffer<"u"&&Buffer.isBuffer(e))}h.isUint8Array=At});var be=w(m=>{"use strict";r();Object.defineProperty(m,"__esModule",{value:!0});m.isUint8Array=m.isNonNullObject=m.sleep=m.assertDefinedAndNotNull=m.assertDefined=m.assert=m.arrayContentStartsWith=m.arrayContentEquals=void 0;var Se=de();Object.defineProperty(m,"arrayContentEquals",{enumerable:!0,get:function(){return Se.arrayContentEquals}});Object.defineProperty(m,"arrayContentStartsWith",{enumerable:!0,get:function(){return Se.arrayContentStartsWith}});var K=ge();Object.defineProperty(m,"assert",{enumerable:!0,get:function(){return K.assert}});Object.defineProperty(m,"assertDefined",{enumerable:!0,get:function(){return K.assertDefined}});Object.defineProperty(m,"assertDefinedAndNotNull",{enumerable:!0,get:function(){return K.assertDefinedAndNotNull}});var bt=Ce();Object.defineProperty(m,"sleep",{enumerable:!0,get:function(){return bt.sleep}});var Ae=xe();Object.defineProperty(m,"isNonNullObject",{enumerable:!0,get:function(){return Ae.isNonNullObject}});Object.defineProperty(m,"isUint8Array",{enumerable:!0,get:function(){return Ae.isUint8Array}})});var gn={};lt(gn,{GrazEvents:()=>pe,GrazProvider:()=>dn,WALLET_TYPES:()=>P,WalletType:()=>z,checkWallet:()=>G,clearRecentChain:()=>_,configureGraz:()=>V,connect:()=>A,createClients:()=>D,createQueryClient:()=>W,createSigningClients:()=>k,defineChain:()=>Ft,defineChainInfo:()=>_t,defineChains:()=>Rt,disconnect:()=>F,getActiveChainCurrency:()=>H,getAvailableWallets:()=>Et,getBalances:()=>J,getKeplr:()=>we,getLeap:()=>De,getRecentChain:()=>jt,getStakedBalances:()=>Y,getWallet:()=>S,mainnetChains:()=>Ht,mainnetChainsArray:()=>Lt,reconnect:()=>d,sendIbcTokens:()=>X,sendTokens:()=>$,suggestChain:()=>q,suggestChainAndConnect:()=>L,testnetChains:()=>Vt,testnetChainsArray:()=>Jt,useAccount:()=>E,useActiveChain:()=>nn,useActiveChainCurrency:()=>on,useActiveChainValidators:()=>rn,useBalance:()=>$t,useBalances:()=>$e,useCheckKeplr:()=>Yt,useCheckWallet:()=>b,useClients:()=>pn,useConnect:()=>Xt,useDisconnect:()=>Zt,useGrazEvents:()=>tt,useOfflineSigners:()=>Xe,useQueryClient:()=>an,useRecentChain:()=>sn,useSendIbcTokens:()=>fn,useSendTokens:()=>ln,useSigners:()=>en,useSigningClients:()=>mn,useStakedBalances:()=>tn,useSuggestChain:()=>cn,useSuggestChainAndConnect:()=>un});module.exports=ft(gn);r();r();var ke=require("@cosmjs/stargate");r();var ye=T(require("zustand")),B=require("zustand/middleware");r();var z=(n=>(n.KEPLR="keplr",n.LEAP="leap",n))(z||{}),P=["keplr","leap"];var N={account:null,activeChain:null,balances:null,clients:null,defaultChain:null,defaultSigningClient:"stargate",offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClients:null,status:"disconnected",walletType:"keplr",_notFoundFn:()=>null,_reconnect:!1},yt={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},u=(0,ye.default)((0,B.subscribeWithSelector)((0,B.persist)(()=>N,yt)));r();var M=require("@cosmjs/cosmwasm-stargate"),R=require("@cosmjs/stargate"),je=require("@cosmjs/tendermint-rpc");r();var Ee=require("@cosmjs/stargate"),x=T(be());function W(...e){let{tendermint:t}=u.getState().clients,n=new Ee.QueryClient(t),c=e.map(o=>o(n));for(let o of c){(0,x.assert)((0,x.isNonNullObject)(o),"Extension must be a non-null object");for(let[i,s]of Object.entries(o)){(0,x.assert)((0,x.isNonNullObject)(s),`Module must be a non-null object. Found type ${typeof s} for module "${i}".`);let p=n[i]||{};n[i]={...p,...s}}}return n}async function D({rpc:e,rpcHeaders:t}){let n={url:e,headers:{...t||{}}},[c,o,i]=await Promise.all([M.SigningCosmWasmClient.connect(n),R.SigningStargateClient.connect(n),je.Tendermint34Client.connect(e)]);return{cosmWasm:c,stargate:o,tendermint:i}}async function k(e){let{rpc:t,rpcHeaders:n,offlineSignerAuto:c,cosmWasmSignerOptions:o={},stargateSignerOptions:i={}}=e,s={url:t,headers:{...n||{}}},[p,l]=await Promise.all([M.SigningCosmWasmClient.connectWithSigner(s,c,o),R.SigningStargateClient.connectWithSigner(s,c,i)]);return{cosmWasm:p,stargate:l}}r();function G(e=u.getState().walletType){try{return S(e),!0}catch(t){return console.error(t),!1}}function we(){if(typeof window.keplr<"u")return window.keplr;throw u.getState()._notFoundFn(),new Error("window.keplr is not defined")}function De(){if(typeof window.leap<"u")return window.leap;throw u.getState()._notFoundFn(),new Error("window.leap is not defined")}function S(e=u.getState().walletType){switch(e){case"keplr":return we();case"leap":return De();default:throw new Error("Unknown wallet type")}}function Et(){return Object.fromEntries(P.map(e=>[e,G(e)]))}async function A(e){try{let{defaultChain:t,recentChain:n,walletType:c}=u.getState(),o=(e==null?void 0:e.walletType)||c,i=S(o),s=e||n||t;if(!s)throw new Error("No last known connected chain, connect action requires chain info");u.setState(Q=>{let st=Q._reconnect;return Q.activeChain&&Q.activeChain.chainId!==s.chainId?{status:"connecting"}:st?{status:"reconnecting"}:{status:"connecting"}}),await i.enable(s.chainId);let p=i.getOfflineSigner(s.chainId),l=i.getOfflineSignerOnlyAmino(s.chainId),y=await i.getOfflineSignerAuto(s.chainId),nt=s.gas?ke.GasPrice.fromString(`${s.gas.price}${s.gas.denom}`):void 0,[le,ot,rt]=await Promise.all([i.getKey(s.chainId),D(s),k({...s,offlineSignerAuto:y,cosmWasmSignerOptions:{gasPrice:nt,...(e==null?void 0:e.signerOpts)||{}}})]);return u.setState({account:le,activeChain:s,clients:ot,offlineSigner:p,offlineSignerAmino:l,offlineSignerAuto:y,recentChain:s,signingClients:rt,status:"connected",walletType:o,_reconnect:!0}),le}catch(t){throw u.getState().account===null&&u.setState({status:"disconnected"}),t}}async function F(e=!1){return u.setState(t=>({...N,recentChain:e?null:t.recentChain})),Promise.resolve()}function d(){let{activeChain:e}=u.getState();e&&A(e)}r();function _(){u.setState({recentChain:null})}function H(e){let{activeChain:t}=u.getState();return t==null?void 0:t.currencies.find(n=>n.coinMinimalDenom===e)}function jt(){return u.getState().recentChain}async function q(e){return await S().experimentalSuggestChain(e),e}async function L({chainInfo:e,...t}){let n=await q(e);return{account:await A({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:n}}r();function V(e={}){return u.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}r();async function J(e){let{activeChain:t,signingClients:n}=u.getState();if(!t||!n)throw new Error("No connected account detected");let{defaultSigningClient:c}=u.getState();return await Promise.all(t.currencies.map(async i=>n[c].getBalance(e,i.coinMinimalDenom)))}async function Y(e){let{clients:t}=u.getState();if(!(t!=null&&t.stargate))throw new Error("Stargate client is not ready");return t.stargate.getBalanceStaked(e)}async function $({senderAddress:e,recipientAddress:t,amount:n,fee:c,memo:o}){let{signingClients:i,defaultSigningClient:s}=u.getState();if(!i)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return i[s].sendTokens(e,t,n,c,o)}async function X({senderAddress:e,recipientAddress:t,transferAmount:n,sourcePort:c,sourceChannel:o,timeoutHeight:i,timeoutTimestamp:s,fee:p,memo:l}){let{signingClients:y}=u.getState();if(!(y!=null&&y.stargate))throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return y.stargate.sendIbcTokens(e,t,n,c,o,i,s,p,l)}r();r();var Te=require("@keplr-wallet/cosmos"),Be={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},wt={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Dt={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},kt={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},It={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Tt={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},Ie=[Be,wt,Dt,kt,It,Tt],Z={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:Be,bip44:{coinType:118},bech32Config:Te.Bech32Address.defaultBech32Config("axelar"),currencies:Ie,feeCurrencies:Ie};r();var Ge=require("@keplr-wallet/cosmos"),qe={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},ve=[qe],U={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:qe,bip44:{coinType:118},bech32Config:Ge.Bech32Address.defaultBech32Config("cosmos"),currencies:ve,feeCurrencies:ve};r();var Oe=require("@keplr-wallet/cosmos"),Qe={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Bt={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},vt={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Gt={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},qt={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Ut={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Ot={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Qt={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},zt={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},Pt={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Nt={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},Ue=[Qe,Bt,vt,Gt,qt,Ut,Ot,Qt,zt,Pt,Nt],ee={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:Qe,bip44:{coinType:118},bech32Config:Oe.Bech32Address.defaultBech32Config("juno"),currencies:Ue,feeCurrencies:Ue};r();var Pe=require("@keplr-wallet/cosmos"),Ne={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Kt={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},ze=[Ne,Kt],te={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Ne,bip44:{coinType:118},bech32Config:Pe.Bech32Address.defaultBech32Config("osmo"),currencies:ze,feeCurrencies:ze};r();var We=require("@keplr-wallet/cosmos"),Me={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},Ke=[Me],ne={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:Me,bip44:{coinType:118},bech32Config:We.Bech32Address.defaultBech32Config("somm"),currencies:Ke,feeCurrencies:Ke};r();var Fe=require("@keplr-wallet/cosmos"),_e={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},Re=[_e],oe={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:Fe.Bech32Address.defaultBech32Config("CRE"),currencies:Re,feeCurrencies:Re,stakeCurrency:_e,coinType:118};r();var He=require("@keplr-wallet/cosmos"),re={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Wt=[re],se={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:re,bip44:{coinType:118},bech32Config:He.Bech32Address.defaultBech32Config("juno"),currencies:Wt,feeCurrencies:[re],coinType:118};r();var Le=require("@keplr-wallet/cosmos"),ie={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Mt=[ie],ce={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:ie,bip44:{coinType:118},bech32Config:Le.Bech32Address.defaultBech32Config("osmo"),currencies:Mt,feeCurrencies:[ie],coinType:118};function Rt(e){return e}function Ft(e){return e}function _t(e){return e}var Ht={axelar:Z,cosmos:U,cosmoshub:U,juno:ee,osmosis:te,sommelier:ne},Lt=[Z,U,ee,te,ne],Vt={crescent:oe,juno:se,osmosis:ce},Jt=[oe,se,ce];r();var g=require("@tanstack/react-query"),Je=require("react"),Ye=T(require("zustand/shallow"));r();var Ve=require("@tanstack/react-query");function Yt(){return b("keplr")}function b(e){let t=u(o=>e||o.walletType);return(0,Ve.useQuery)(["USE_CHECK_WALLET",t],({queryKey:[,o]})=>G(o))}function E({onConnect:e,onDisconnect:t}={}){let n=u(o=>o.account),c=u(o=>o.status);return(0,Je.useEffect)(()=>u.subscribe(o=>o.status,(o,i)=>{if(o==="connected"){let s=u.getState();e==null||e({account:s.account,isReconnect:i==="reconnecting"})}o==="disconnected"&&(t==null||t())}),[e,t]),{data:n,isConnected:Boolean(n),isConnecting:c==="connecting",isDisconnected:c==="disconnected",isReconnecting:c==="reconnecting",reconnect:d,status:c}}function $e(e){let{data:t}=E(),n=e||(t==null?void 0:t.bech32Address);return(0,g.useQuery)(["USE_BALANCES",n],({queryKey:[,i]})=>J(i),{enabled:Boolean(n)})}function $t(e,t){let{data:n}=$e(t);return(0,g.useQuery)(["USE_BALANCE",n,e,t],({queryKey:[,i]})=>i==null?void 0:i.find(s=>s.denom===e),{enabled:Boolean(n)})}function Xt({onError:e,onLoading:t,onSuccess:n}={}){let o=(0,g.useMutation)(["USE_CONNECT",e,t,n],A,{onError:(s,p)=>Promise.resolve(e==null?void 0:e(s,p)),onMutate:t,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=b();return{connect:s=>o.mutate(s),connectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:Boolean(i),status:o.status}}function Zt({onError:e,onLoading:t,onSuccess:n}={}){let o=(0,g.useMutation)(["USE_DISCONNECT",e,t,n],F,{onError:i=>Promise.resolve(e==null?void 0:e(i,void 0)),onMutate:t,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}}function Xe(){return u(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Ye.default)}function en(){return Xe()}function tn(e){let{data:t}=E(),n=e||(t==null?void 0:t.bech32Address);return(0,g.useQuery)(["USE_STAKED_BALANCES",n],({queryKey:[,i]})=>Y(n),{enabled:Boolean(n)})}r();var j=require("@tanstack/react-query");function nn(){return u(e=>e.activeChain)}function on(e){return(0,j.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,c]})=>H(c))}function rn(e,t="BOND_STATUS_BONDED"){return(0,j.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,o,i]})=>o.staking.validators(i),{enabled:typeof e<"u"})}function sn(){return{data:u(t=>t.recentChain),clear:_}}function cn({onError:e,onLoading:t,onSuccess:n}={}){let o=(0,j.useMutation)(["USE_SUGGEST_CHAIN",e,t,n],q,{onError:(i,s)=>Promise.resolve(e==null?void 0:e(i,s)),onMutate:t,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}}function un({onError:e,onLoading:t,onSuccess:n}={}){let o=(0,j.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,n],L,{onError:(s,p)=>Promise.resolve(e==null?void 0:e(s,p)),onMutate:s=>t==null?void 0:t(s),onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=b();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:Boolean(i),status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}}r();var ue=require("@tanstack/react-query");r();var Ze=require("@tanstack/react-query");function an(...e){let t=["USE_QUERY_CLIENT",...e];return(0,Ze.useQuery)(t,({queryKey:[,...c]})=>W(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})}function pn(e){let t=u(o=>o.clients);return(0,ue.useQuery)(["USE_CLIENTS",e,t],({queryKey:[,o,i]})=>o!=null&&o.rpc?D(o):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})}function mn(e){let t=u(o=>o.signingClients);return(0,ue.useQuery)(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,o,i]})=>o!=null&&o.rpc?k(o):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})}r();var ae=require("@tanstack/react-query");function ln({onError:e,onLoading:t,onSuccess:n}={}){let{data:c}=E(),o=c==null?void 0:c.bech32Address,s=(0,ae.useMutation)(["USE_SEND_TOKENS",e,t,n,o],p=>$({senderAddress:o,...p}),{onError:(p,l)=>Promise.resolve(e==null?void 0:e(p,l)),onMutate:t,onSuccess:p=>Promise.resolve(n==null?void 0:n(p))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,sendTokens:s.mutate,sendTokensAsync:s.mutateAsync,status:s.status}}function fn({onError:e,onLoading:t,onSuccess:n}={}){let{data:c}=E(),o=c==null?void 0:c.bech32Address,s=(0,ae.useMutation)(["USE_SEND_IBC_TOKENS",e,t,n,o],p=>X({senderAddress:o,...p}),{onError:(p,l)=>Promise.resolve(e==null?void 0:e(p,l)),onMutate:t,onSuccess:p=>Promise.resolve(n==null?void 0:n(p))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,sendIbcTokens:s.mutate,sendIbcTokensAsync:s.mutateAsync,status:s.status}}r();var O=require("@tanstack/react-query");r();var et=require("react");function tt(){return(0,et.useEffect)(()=>{let{_reconnect:e}=u.getState();return e&&d(),window.addEventListener("keplr_keystorechange",d),()=>{window.removeEventListener("keplr_keystorechange",d)}},[]),null}function pe(){return tt(),null}var me=require("react/jsx-runtime"),yn=new O.QueryClient({});function dn({children:e,grazOptions:t,...n}){return t&&V(t),(0,me.jsxs)(O.QueryClientProvider,{client:yn,...n,children:[(0,me.jsx)(pe,{}),e]})}0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineChain,defineChainInfo,defineChains,disconnect,getActiveChainCurrency,getAvailableWallets,getBalances,getKeplr,getLeap,getRecentChain,getStakedBalances,getWallet,mainnetChains,mainnetChainsArray,reconnect,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useBalance,useBalances,useCheckKeplr,useCheckWallet,useClients,useConnect,useDisconnect,useGrazEvents,useOfflineSigners,useQueryClient,useRecentChain,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useStakedBalances,useSuggestChain,useSuggestChainAndConnect});
1
+ "use strict";var Ne=Object.create;var E=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Le=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var Je=(e,t)=>{for(var o in t)E(e,o,{get:t[o],enumerable:!0})},re=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of He(t))!Ve.call(e,n)&&n!==o&&E(e,n,{get:()=>t[n],enumerable:!(i=_e(t,n))||i.enumerable});return e};var se=(e,t,o)=>(o=e!=null?Ne(Le(e)):{},re(t||!e||!e.__esModule?E(o,"default",{value:e,enumerable:!0}):o,e)),Ye=e=>re(E({},"__esModule",{value:!0}),e);var Nt={};Je(Nt,{GrazEvents:()=>te,GrazProvider:()=>Ft,WALLET_TYPES:()=>B,WalletType:()=>T,checkWallet:()=>j,clearRecentChain:()=>z,configureGraz:()=>P,connect:()=>C,createClients:()=>S,createQueryClient:()=>v,createSigningClients:()=>A,defineChain:()=>xt,defineChainInfo:()=>St,defineChains:()=>ht,disconnect:()=>U,getActiveChainCurrency:()=>K,getAvailableWallets:()=>Xe,getBalanceStaked:()=>M,getBalances:()=>W,getKeplr:()=>ue,getLeap:()=>pe,getRecentChain:()=>Ze,getWallet:()=>f,mainnetChains:()=>At,mainnetChainsArray:()=>Et,reconnect:()=>l,sendIbcTokens:()=>F,sendTokens:()=>R,suggestChain:()=>w,suggestChainAndConnect:()=>O,testnetChains:()=>bt,testnetChainsArray:()=>jt,useAccount:()=>h,useActiveChain:()=>Gt,useActiveChainCurrency:()=>vt,useActiveChainValidators:()=>qt,useBalance:()=>Dt,useBalanceStaked:()=>Bt,useBalances:()=>Ue,useCheckKeplr:()=>wt,useCheckWallet:()=>d,useClients:()=>Ot,useConnect:()=>kt,useDisconnect:()=>It,useGrazEvents:()=>Pe,useOfflineSigners:()=>ze,useQueryClient:()=>Kt,useRecentChain:()=>Qt,useSendIbcTokens:()=>Mt,useSendTokens:()=>Wt,useSigners:()=>Tt,useSigningClients:()=>Pt,useSuggestChain:()=>Ut,useSuggestChainAndConnect:()=>zt});module.exports=Ye(Nt);var me=require("@cosmjs/stargate");var ie=se(require("zustand")),b=require("zustand/middleware");var T=(o=>(o.KEPLR="keplr",o.LEAP="leap",o))(T||{}),B=["keplr","leap"];var G={account:null,activeChain:null,balances:null,clients:null,defaultChain:null,defaultSigningClient:"stargate",offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClients:null,status:"disconnected",walletType:"keplr",_notFoundFn:()=>null,_reconnect:!1},$e={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},c=(0,ie.default)((0,b.subscribeWithSelector)((0,b.persist)(()=>G,$e)));var q=require("@cosmjs/cosmwasm-stargate"),Q=require("@cosmjs/stargate"),ae=require("@cosmjs/tendermint-rpc");var ce=require("@cosmjs/stargate"),g=require("@cosmjs/utils");function v(...e){let{tendermint:t}=c.getState().clients,o=new ce.QueryClient(t),i=e.map(n=>n(o));for(let n of i){(0,g.assert)((0,g.isNonNullObject)(n),"Extension must be a non-null object");for(let[s,r]of Object.entries(n)){(0,g.assert)((0,g.isNonNullObject)(r),`Module must be a non-null object. Found type ${typeof r} for module "${s}".`);let u=o[s]||{};o[s]={...u,...r}}}return o}async function S({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}},[i,n,s]=await Promise.all([q.SigningCosmWasmClient.connect(o),Q.SigningStargateClient.connect(o),ae.Tendermint34Client.connect(e)]);return{cosmWasm:i,stargate:n,tendermint:s}}async function A(e){let{rpc:t,rpcHeaders:o,offlineSignerAuto:i,cosmWasmSignerOptions:n={},stargateSignerOptions:s={}}=e,r={url:t,headers:{...o||{}}},[u,p]=await Promise.all([q.SigningCosmWasmClient.connectWithSigner(r,i,n),Q.SigningStargateClient.connectWithSigner(r,i,s)]);return{cosmWasm:u,stargate:p}}function j(e=c.getState().walletType){try{return f(e),!0}catch(t){return console.error(t),!1}}function ue(){if(typeof window.keplr<"u")return window.keplr;throw c.getState()._notFoundFn(),new Error("window.keplr is not defined")}function pe(){if(typeof window.leap<"u")return window.leap;throw c.getState()._notFoundFn(),new Error("window.leap is not defined")}function f(e=c.getState().walletType){switch(e){case"keplr":return ue();case"leap":return pe();default:throw new Error("Unknown wallet type")}}function Xe(){return Object.fromEntries(B.map(e=>[e,j(e)]))}async function C(e){try{let{defaultChain:t,recentChain:o,walletType:i}=c.getState(),n=(e==null?void 0:e.walletType)||i,s=f(n),r=e||o||t;if(!r)throw new Error("No last known connected chain, connect action requires chain info");c.setState(I=>{let Fe=I._reconnect;return I.activeChain&&I.activeChain.chainId!==r.chainId?{status:"connecting"}:Fe?{status:"reconnecting"}:{status:"connecting"}}),await s.enable(r.chainId);let u=s.getOfflineSigner(r.chainId),p=s.getOfflineSignerOnlyAmino(r.chainId),m=await s.getOfflineSignerAuto(r.chainId),We=r.gas?me.GasPrice.fromString(`${r.gas.price}${r.gas.denom}`):void 0,[oe,Me,Re]=await Promise.all([s.getKey(r.chainId),S(r),A({...r,offlineSignerAuto:m,cosmWasmSignerOptions:{gasPrice:We,...(e==null?void 0:e.signerOpts)||{}}})]);return c.setState({account:oe,activeChain:r,clients:Me,offlineSigner:u,offlineSignerAmino:p,offlineSignerAuto:m,recentChain:r,signingClients:Re,status:"connected",walletType:n,_reconnect:!0}),oe}catch(t){throw c.getState().account===null&&c.setState({status:"disconnected"}),t}}async function U(e=!1){return c.setState(t=>({...G,recentChain:e?null:t.recentChain})),Promise.resolve()}function l(){let{activeChain:e}=c.getState();e&&C(e)}function z(){c.setState({recentChain:null})}function K(e){let{activeChain:t}=c.getState();return t==null?void 0:t.currencies.find(o=>o.coinMinimalDenom===e)}function Ze(){return c.getState().recentChain}async function w(e){return await f().experimentalSuggestChain(e),e}async function O({chainInfo:e,...t}){let o=await w(e);return{account:await C({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:o}}function P(e={}){return c.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}async function W(e){let{activeChain:t,signingClients:o}=c.getState();if(!t||!o)throw new Error("No connected account detected");let{defaultSigningClient:i}=c.getState();return await Promise.all(t.currencies.map(async s=>o[i].getBalance(e,s.coinMinimalDenom)))}async function M(e){let{clients:t}=c.getState();if(!(t!=null&&t.stargate))throw new Error("Stargate client is not ready");return t.stargate.getBalanceStaked(e)}async function R({senderAddress:e,recipientAddress:t,amount:o,fee:i,memo:n}){let{signingClients:s,defaultSigningClient:r}=c.getState();if(!s)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return s[r].sendTokens(e,t,o,i,n)}async function F({senderAddress:e,recipientAddress:t,transferAmount:o,sourcePort:i,sourceChannel:n,timeoutHeight:s,timeoutTimestamp:r,fee:u,memo:p}){let{signingClients:m}=c.getState();if(!(m!=null&&m.stargate))throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return m.stargate.sendIbcTokens(e,t,o,i,n,s,r,u,p)}var ye=require("@keplr-wallet/cosmos"),ge={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},et={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},tt={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},nt={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},ot={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},rt={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},le=[ge,et,tt,nt,ot,rt],N={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:ge,bip44:{coinType:118},bech32Config:ye.Bech32Address.defaultBech32Config("axelar"),currencies:le,feeCurrencies:le};var Ce=require("@keplr-wallet/cosmos"),de={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},fe=[de],D={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:de,bip44:{coinType:118},bech32Config:Ce.Bech32Address.defaultBech32Config("cosmos"),currencies:fe,feeCurrencies:fe};var xe=require("@keplr-wallet/cosmos"),Se={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},st={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},it={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},ct={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},at={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},ut={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},pt={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},mt={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},lt={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},yt={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},gt={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},he=[Se,st,it,ct,at,ut,pt,mt,lt,yt,gt],_={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:Se,bip44:{coinType:118},bech32Config:xe.Bech32Address.defaultBech32Config("juno"),currencies:he,feeCurrencies:he};var Ee=require("@keplr-wallet/cosmos"),be={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},ft={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Ae=[be,ft],H={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:be,bip44:{coinType:118},bech32Config:Ee.Bech32Address.defaultBech32Config("osmo"),currencies:Ae,feeCurrencies:Ae};var we=require("@keplr-wallet/cosmos"),De={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},je=[De],L={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:De,bip44:{coinType:118},bech32Config:we.Bech32Address.defaultBech32Config("somm"),currencies:je,feeCurrencies:je};var Ie=require("@keplr-wallet/cosmos"),Te={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},ke=[Te],V={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:Ie.Bech32Address.defaultBech32Config("CRE"),currencies:ke,feeCurrencies:ke,stakeCurrency:Te,coinType:118};var Be=require("@keplr-wallet/cosmos"),J={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Ct=[J],Y={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:J,bip44:{coinType:118},bech32Config:Be.Bech32Address.defaultBech32Config("juno"),currencies:Ct,feeCurrencies:[J],coinType:118};var Ge=require("@keplr-wallet/cosmos"),$={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},dt=[$],X={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:$,bip44:{coinType:118},bech32Config:Ge.Bech32Address.defaultBech32Config("osmo"),currencies:dt,feeCurrencies:[$],coinType:118};function ht(e){return e}function xt(e){return e}function St(e){return e}var At={axelar:N,cosmos:D,cosmoshub:D,juno:_,osmosis:H,sommelier:L},Et=[N,D,_,H,L],bt={crescent:V,juno:Y,osmosis:X},jt=[V,Y,X];var y=require("@tanstack/react-query"),qe=require("react"),Qe=se(require("zustand/shallow"));var ve=require("@tanstack/react-query");function wt(){return d("keplr")}function d(e){let t=c(n=>e||n.walletType);return(0,ve.useQuery)(["USE_CHECK_WALLET",t],({queryKey:[,n]})=>j(n))}function h({onConnect:e,onDisconnect:t}={}){let o=c(n=>n.account),i=c(n=>n.status);return(0,qe.useEffect)(()=>c.subscribe(n=>n.status,(n,s)=>{if(n==="connected"){let r=c.getState();e==null||e({account:r.account,isReconnect:s==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:i==="connecting",isDisconnected:i==="disconnected",isReconnecting:i==="reconnecting",reconnect:l,status:i}}function Ue(e){let{data:t}=h(),o=e||(t==null?void 0:t.bech32Address);return(0,y.useQuery)(["USE_BALANCES",o],({queryKey:[,s]})=>W(s),{enabled:Boolean(o)})}function Dt(e,t){let{data:o}=Ue(t);return(0,y.useQuery)(["USE_BALANCE",o,e,t],({queryKey:[,s]})=>s==null?void 0:s.find(r=>r.denom===e),{enabled:Boolean(o)})}function kt({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,y.useMutation)(["USE_CONNECT",e,t,o],C,{onError:(r,u)=>Promise.resolve(e==null?void 0:e(r,u)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))}),{data:s}=d();return{connect:r=>n.mutate(r),connectAsync:r=>n.mutateAsync(r),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(s),status:n.status}}function It({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,y.useMutation)(["USE_DISCONNECT",e,t,o],U,{onError:s=>Promise.resolve(e==null?void 0:e(s,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:s=>n.mutate(s),disconnectAsync:s=>n.mutateAsync(s),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function ze(){return c(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Qe.default)}function Tt(){return ze()}function Bt(e){let{data:t}=h(),o=e||(t==null?void 0:t.bech32Address);return(0,y.useQuery)(["USE_BALANCE_STAKED",o],({queryKey:[,s]})=>M(o),{enabled:Boolean(o)})}var x=require("@tanstack/react-query");function Gt(){return c(e=>e.activeChain)}function vt(e){return(0,x.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,i]})=>K(i))}function qt(e,t="BOND_STATUS_BONDED"){return(0,x.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,n,s]})=>n.staking.validators(s),{enabled:typeof e<"u"})}function Qt(){return{data:c(t=>t.recentChain),clear:z}}function Ut({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,x.useMutation)(["USE_SUGGEST_CHAIN",e,t,o],w,{onError:(s,r)=>Promise.resolve(e==null?void 0:e(s,r)),onMutate:t,onSuccess:s=>Promise.resolve(o==null?void 0:o(s))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function zt({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,x.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],O,{onError:(r,u)=>Promise.resolve(e==null?void 0:e(r,u)),onMutate:r=>t==null?void 0:t(r),onSuccess:r=>Promise.resolve(o==null?void 0:o(r))}),{data:s}=d();return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(s),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}var Z=require("@tanstack/react-query");var Ke=require("@tanstack/react-query");function Kt(...e){let t=["USE_QUERY_CLIENT",...e];return(0,Ke.useQuery)(t,({queryKey:[,...i]})=>v(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})}function Ot(e){let t=c(n=>n.clients);return(0,Z.useQuery)(["USE_CLIENTS",e,t],({queryKey:[,n,s]})=>n!=null&&n.rpc?S(n):s,{refetchOnMount:!1,refetchOnWindowFocus:!1})}function Pt(e){let t=c(n=>n.signingClients);return(0,Z.useQuery)(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,n,s]})=>n!=null&&n.rpc?A(n):s,{refetchOnMount:!1,refetchOnWindowFocus:!1})}var ee=require("@tanstack/react-query");function Wt({onError:e,onLoading:t,onSuccess:o}={}){let{data:i}=h(),n=i==null?void 0:i.bech32Address,r=(0,ee.useMutation)(["USE_SEND_TOKENS",e,t,o,n],u=>R({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(o==null?void 0:o(u))});return{error:r.error,isLoading:r.isLoading,isSuccess:r.isSuccess,sendTokens:r.mutate,sendTokensAsync:r.mutateAsync,status:r.status}}function Mt({onError:e,onLoading:t,onSuccess:o}={}){let{data:i}=h(),n=i==null?void 0:i.bech32Address,r=(0,ee.useMutation)(["USE_SEND_IBC_TOKENS",e,t,o,n],u=>F({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(o==null?void 0:o(u))});return{error:r.error,isLoading:r.isLoading,isSuccess:r.isSuccess,sendIbcTokens:r.mutate,sendIbcTokensAsync:r.mutateAsync,status:r.status}}var k=require("@tanstack/react-query");var Oe=require("react");function Pe(){return(0,Oe.useEffect)(()=>{let{_reconnect:e}=c.getState();return e&&l(),window.addEventListener("keplr_keystorechange",l),()=>{window.removeEventListener("keplr_keystorechange",l)}},[]),null}function te(){return Pe(),null}var ne=require("react/jsx-runtime"),Rt=new k.QueryClient({});function Ft({children:e,grazOptions:t,...o}){return t&&P(t),(0,ne.jsxs)(k.QueryClientProvider,{client:Rt,...o,children:[(0,ne.jsx)(te,{}),e]})}0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineChain,defineChainInfo,defineChains,disconnect,getActiveChainCurrency,getAvailableWallets,getBalanceStaked,getBalances,getKeplr,getLeap,getRecentChain,getWallet,mainnetChains,mainnetChainsArray,reconnect,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useBalance,useBalanceStaked,useBalances,useCheckKeplr,useCheckWallet,useClients,useConnect,useDisconnect,useGrazEvents,useOfflineSigners,useQueryClient,useRecentChain,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useSuggestChain,useSuggestChainAndConnect});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as x,b as Ue,c as r}from"./chunk-6M3A6KFX.mjs";var H=x(d=>{"use strict";r();Object.defineProperty(d,"__esModule",{value:!0});d.arrayContentStartsWith=d.arrayContentEquals=void 0;function Ne(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}d.arrayContentEquals=Ne;function Ke(e,t){if(e.length<t.length)return!1;for(let n=0;n<t.length;++n)if(e[n]!==t[n])return!1;return!0}d.arrayContentStartsWith=Ke});var L=x(f=>{"use strict";r();Object.defineProperty(f,"__esModule",{value:!0});f.assertDefinedAndNotNull=f.assertDefined=f.assert=void 0;function We(e,t){if(!e)throw new Error(t||"condition is not truthy")}f.assert=We;function Me(e,t){if(e===void 0)throw new Error(t??"value is undefined")}f.assertDefined=Me;function Re(e,t){if(e==null)throw new Error(t??"value is undefined or null")}f.assertDefinedAndNotNull=Re});var V=x(j=>{"use strict";r();Object.defineProperty(j,"__esModule",{value:!0});j.sleep=void 0;async function Fe(e){return new Promise(t=>setTimeout(t,e))}j.sleep=Fe});var Y=x(g=>{"use strict";r();Object.defineProperty(g,"__esModule",{value:!0});g.isUint8Array=g.isNonNullObject=void 0;function J(e){return typeof e=="object"&&e!==null}g.isNonNullObject=J;function _e(e){return!(!J(e)||Object.prototype.toString.call(e)!=="[object Uint8Array]"||typeof Buffer<"u"&&typeof Buffer.isBuffer<"u"&&Buffer.isBuffer(e))}g.isUint8Array=_e});var Z=x(m=>{"use strict";r();Object.defineProperty(m,"__esModule",{value:!0});m.isUint8Array=m.isNonNullObject=m.sleep=m.assertDefinedAndNotNull=m.assertDefined=m.assert=m.arrayContentStartsWith=m.arrayContentEquals=void 0;var $=H();Object.defineProperty(m,"arrayContentEquals",{enumerable:!0,get:function(){return $.arrayContentEquals}});Object.defineProperty(m,"arrayContentStartsWith",{enumerable:!0,get:function(){return $.arrayContentStartsWith}});var B=L();Object.defineProperty(m,"assert",{enumerable:!0,get:function(){return B.assert}});Object.defineProperty(m,"assertDefined",{enumerable:!0,get:function(){return B.assertDefined}});Object.defineProperty(m,"assertDefinedAndNotNull",{enumerable:!0,get:function(){return B.assertDefinedAndNotNull}});var He=V();Object.defineProperty(m,"sleep",{enumerable:!0,get:function(){return He.sleep}});var X=Y();Object.defineProperty(m,"isNonNullObject",{enumerable:!0,get:function(){return X.isNonNullObject}});Object.defineProperty(m,"isUint8Array",{enumerable:!0,get:function(){return X.isUint8Array}})});r();r();import{GasPrice as $e}from"@cosmjs/stargate";r();import Oe from"zustand";import{persist as Qe,subscribeWithSelector as ze}from"zustand/middleware";r();var F=(n=>(n.KEPLR="keplr",n.LEAP="leap",n))(F||{}),_=["keplr","leap"];var T={account:null,activeChain:null,balances:null,clients:null,defaultChain:null,defaultSigningClient:"stargate",offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClients:null,status:"disconnected",walletType:"keplr",_notFoundFn:()=>null,_reconnect:!1},Pe={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},c=Oe(ze(Qe(()=>T,Pe)));r();import{SigningCosmWasmClient as te}from"@cosmjs/cosmwasm-stargate";import{SigningStargateClient as ne}from"@cosmjs/stargate";import{Tendermint34Client as Ve}from"@cosmjs/tendermint-rpc";r();var C=Ue(Z());import{QueryClient as Le}from"@cosmjs/stargate";function ee(...e){let{tendermint:t}=c.getState().clients,n=new Le(t),u=e.map(o=>o(n));for(let o of u){(0,C.assert)((0,C.isNonNullObject)(o),"Extension must be a non-null object");for(let[i,s]of Object.entries(o)){(0,C.assert)((0,C.isNonNullObject)(s),`Module must be a non-null object. Found type ${typeof s} for module "${i}".`);let p=n[i]||{};n[i]={...p,...s}}}return n}async function w({rpc:e,rpcHeaders:t}){let n={url:e,headers:{...t||{}}},[u,o,i]=await Promise.all([te.connect(n),ne.connect(n),Ve.connect(e)]);return{cosmWasm:u,stargate:o,tendermint:i}}async function D(e){let{rpc:t,rpcHeaders:n,offlineSignerAuto:u,cosmWasmSignerOptions:o={},stargateSignerOptions:i={}}=e,s={url:t,headers:{...n||{}}},[p,l]=await Promise.all([te.connectWithSigner(s,u,o),ne.connectWithSigner(s,u,i)]);return{cosmWasm:p,stargate:l}}r();function v(e=c.getState().walletType){try{return S(e),!0}catch(t){return console.error(t),!1}}function Je(){if(typeof window.keplr<"u")return window.keplr;throw c.getState()._notFoundFn(),new Error("window.keplr is not defined")}function Ye(){if(typeof window.leap<"u")return window.leap;throw c.getState()._notFoundFn(),new Error("window.leap is not defined")}function S(e=c.getState().walletType){switch(e){case"keplr":return Je();case"leap":return Ye();default:throw new Error("Unknown wallet type")}}function on(){return Object.fromEntries(_.map(e=>[e,v(e)]))}async function A(e){try{let{defaultChain:t,recentChain:n,walletType:u}=c.getState(),o=(e==null?void 0:e.walletType)||u,i=S(o),s=e||n||t;if(!s)throw new Error("No last known connected chain, connect action requires chain info");c.setState(I=>{let qe=I._reconnect;return I.activeChain&&I.activeChain.chainId!==s.chainId?{status:"connecting"}:qe?{status:"reconnecting"}:{status:"connecting"}}),await i.enable(s.chainId);let p=i.getOfflineSigner(s.chainId),l=i.getOfflineSignerOnlyAmino(s.chainId),y=await i.getOfflineSignerAuto(s.chainId),Be=s.gas?$e.fromString(`${s.gas.price}${s.gas.denom}`):void 0,[R,ve,Ge]=await Promise.all([i.getKey(s.chainId),w(s),D({...s,offlineSignerAuto:y,cosmWasmSignerOptions:{gasPrice:Be,...(e==null?void 0:e.signerOpts)||{}}})]);return c.setState({account:R,activeChain:s,clients:ve,offlineSigner:p,offlineSignerAmino:l,offlineSignerAuto:y,recentChain:s,signingClients:Ge,status:"connected",walletType:o,_reconnect:!0}),R}catch(t){throw c.getState().account===null&&c.setState({status:"disconnected"}),t}}async function oe(e=!1){return c.setState(t=>({...T,recentChain:e?null:t.recentChain})),Promise.resolve()}function h(){let{activeChain:e}=c.getState();e&&A(e)}r();function re(){c.setState({recentChain:null})}function se(e){let{activeChain:t}=c.getState();return t==null?void 0:t.currencies.find(n=>n.coinMinimalDenom===e)}function yn(){return c.getState().recentChain}async function G(e){return await S().experimentalSuggestChain(e),e}async function ie({chainInfo:e,...t}){let n=await G(e);return{account:await A({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:n}}r();function ce(e={}){return c.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}r();async function ue(e){let{activeChain:t,signingClients:n}=c.getState();if(!t||!n)throw new Error("No connected account detected");let{defaultSigningClient:u}=c.getState();return await Promise.all(t.currencies.map(async i=>n[u].getBalance(e,i.coinMinimalDenom)))}async function ae(e){let{clients:t}=c.getState();if(!(t!=null&&t.stargate))throw new Error("Stargate client is not ready");return t.stargate.getBalanceStaked(e)}async function pe({senderAddress:e,recipientAddress:t,amount:n,fee:u,memo:o}){let{signingClients:i,defaultSigningClient:s}=c.getState();if(!i)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return i[s].sendTokens(e,t,n,u,o)}async function me({senderAddress:e,recipientAddress:t,transferAmount:n,sourcePort:u,sourceChannel:o,timeoutHeight:i,timeoutTimestamp:s,fee:p,memo:l}){let{signingClients:y}=c.getState();if(!(y!=null&&y.stargate))throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return y.stargate.sendIbcTokens(e,t,n,u,o,i,s,p,l)}r();r();import{Bech32Address as Xe}from"@keplr-wallet/cosmos";var fe={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Ze={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},et={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},tt={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},nt={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},ot={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},le=[fe,Ze,et,tt,nt,ot],q={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:fe,bip44:{coinType:118},bech32Config:Xe.defaultBech32Config("axelar"),currencies:le,feeCurrencies:le};r();import{Bech32Address as rt}from"@keplr-wallet/cosmos";var de={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},ye=[de],k={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:de,bip44:{coinType:118},bech32Config:rt.defaultBech32Config("cosmos"),currencies:ye,feeCurrencies:ye};r();import{Bech32Address as st}from"@keplr-wallet/cosmos";var Ce={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},it={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},ct={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},ut={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},at={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},pt={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},mt={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},lt={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},ft={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},yt={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},dt={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},ge=[Ce,it,ct,ut,at,pt,mt,lt,ft,yt,dt],U={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:Ce,bip44:{coinType:118},bech32Config:st.defaultBech32Config("juno"),currencies:ge,feeCurrencies:ge};r();import{Bech32Address as gt}from"@keplr-wallet/cosmos";var xe={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Ct={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},he=[xe,Ct],O={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:xe,bip44:{coinType:118},bech32Config:gt.defaultBech32Config("osmo"),currencies:he,feeCurrencies:he};r();import{Bech32Address as ht}from"@keplr-wallet/cosmos";var Ae={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},Se=[Ae],Q={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:Ae,bip44:{coinType:118},bech32Config:ht.defaultBech32Config("somm"),currencies:Se,feeCurrencies:Se};r();import{Bech32Address as xt}from"@keplr-wallet/cosmos";var Ee={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},be=[Ee],z={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:xt.defaultBech32Config("CRE"),currencies:be,feeCurrencies:be,stakeCurrency:Ee,coinType:118};r();import{Bech32Address as St}from"@keplr-wallet/cosmos";var P={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},At=[P],N={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:P,bip44:{coinType:118},bech32Config:St.defaultBech32Config("juno"),currencies:At,feeCurrencies:[P],coinType:118};r();import{Bech32Address as bt}from"@keplr-wallet/cosmos";var K={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Et=[K],W={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:K,bip44:{coinType:118},bech32Config:bt.defaultBech32Config("osmo"),currencies:Et,feeCurrencies:[K],coinType:118};function _n(e){return e}function Hn(e){return e}function Ln(e){return e}var Vn={axelar:q,cosmos:k,cosmoshub:k,juno:U,osmosis:O,sommelier:Q},Jn=[q,k,U,O,Q],Yn={crescent:z,juno:N,osmosis:W},$n=[z,N,W];r();import{useMutation as je,useQuery as M}from"@tanstack/react-query";import{useEffect as wt}from"react";import Dt from"zustand/shallow";r();import{useQuery as jt}from"@tanstack/react-query";function no(){return b("keplr")}function b(e){let t=c(o=>e||o.walletType);return jt(["USE_CHECK_WALLET",t],({queryKey:[,o]})=>v(o))}function E({onConnect:e,onDisconnect:t}={}){let n=c(o=>o.account),u=c(o=>o.status);return wt(()=>c.subscribe(o=>o.status,(o,i)=>{if(o==="connected"){let s=c.getState();e==null||e({account:s.account,isReconnect:i==="reconnecting"})}o==="disconnected"&&(t==null||t())}),[e,t]),{data:n,isConnected:Boolean(n),isConnecting:u==="connecting",isDisconnected:u==="disconnected",isReconnecting:u==="reconnecting",reconnect:h,status:u}}function kt(e){let{data:t}=E(),n=e||(t==null?void 0:t.bech32Address);return M(["USE_BALANCES",n],({queryKey:[,i]})=>ue(i),{enabled:Boolean(n)})}function mo(e,t){let{data:n}=kt(t);return M(["USE_BALANCE",n,e,t],({queryKey:[,i]})=>i==null?void 0:i.find(s=>s.denom===e),{enabled:Boolean(n)})}function lo({onError:e,onLoading:t,onSuccess:n}={}){let o=je(["USE_CONNECT",e,t,n],A,{onError:(s,p)=>Promise.resolve(e==null?void 0:e(s,p)),onMutate:t,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=b();return{connect:s=>o.mutate(s),connectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:Boolean(i),status:o.status}}function fo({onError:e,onLoading:t,onSuccess:n}={}){let o=je(["USE_DISCONNECT",e,t,n],oe,{onError:i=>Promise.resolve(e==null?void 0:e(i,void 0)),onMutate:t,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}}function It(){return c(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Dt)}function yo(){return It()}function go(e){let{data:t}=E(),n=e||(t==null?void 0:t.bech32Address);return M(["USE_STAKED_BALANCES",n],({queryKey:[,i]})=>ae(n),{enabled:Boolean(n)})}r();import{useMutation as we,useQuery as De}from"@tanstack/react-query";function bo(){return c(e=>e.activeChain)}function Eo(e){return De(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,u]})=>se(u))}function jo(e,t="BOND_STATUS_BONDED"){return De(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,o,i]})=>o.staking.validators(i),{enabled:typeof e<"u"})}function wo(){return{data:c(t=>t.recentChain),clear:re}}function Do({onError:e,onLoading:t,onSuccess:n}={}){let o=we(["USE_SUGGEST_CHAIN",e,t,n],G,{onError:(i,s)=>Promise.resolve(e==null?void 0:e(i,s)),onMutate:t,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}}function ko({onError:e,onLoading:t,onSuccess:n}={}){let o=we(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,n],ie,{onError:(s,p)=>Promise.resolve(e==null?void 0:e(s,p)),onMutate:s=>t==null?void 0:t(s),onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=b();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:Boolean(i),status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}}r();import{useQuery as ke}from"@tanstack/react-query";r();import{useQuery as Tt}from"@tanstack/react-query";function vo(...e){let t=["USE_QUERY_CLIENT",...e];return Tt(t,({queryKey:[,...u]})=>ee(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})}function Qo(e){let t=c(o=>o.clients);return ke(["USE_CLIENTS",e,t],({queryKey:[,o,i]})=>o!=null&&o.rpc?w(o):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})}function zo(e){let t=c(o=>o.signingClients);return ke(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,o,i]})=>o!=null&&o.rpc?D(o):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})}r();import{useMutation as Ie}from"@tanstack/react-query";function Ro({onError:e,onLoading:t,onSuccess:n}={}){let{data:u}=E(),o=u==null?void 0:u.bech32Address,s=Ie(["USE_SEND_TOKENS",e,t,n,o],p=>pe({senderAddress:o,...p}),{onError:(p,l)=>Promise.resolve(e==null?void 0:e(p,l)),onMutate:t,onSuccess:p=>Promise.resolve(n==null?void 0:n(p))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,sendTokens:s.mutate,sendTokensAsync:s.mutateAsync,status:s.status}}function Fo({onError:e,onLoading:t,onSuccess:n}={}){let{data:u}=E(),o=u==null?void 0:u.bech32Address,s=Ie(["USE_SEND_IBC_TOKENS",e,t,n,o],p=>me({senderAddress:o,...p}),{onError:(p,l)=>Promise.resolve(e==null?void 0:e(p,l)),onMutate:t,onSuccess:p=>Promise.resolve(n==null?void 0:n(p))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,sendIbcTokens:s.mutate,sendIbcTokensAsync:s.mutateAsync,status:s.status}}r();import{QueryClient as Gt,QueryClientProvider as qt}from"@tanstack/react-query";r();import{useEffect as Bt}from"react";function vt(){return Bt(()=>{let{_reconnect:e}=c.getState();return e&&h(),window.addEventListener("keplr_keystorechange",h),()=>{window.removeEventListener("keplr_keystorechange",h)}},[]),null}function Te(){return vt(),null}import{jsx as Ot,jsxs as Qt}from"react/jsx-runtime";var Ut=new Gt({});function Zo({children:e,grazOptions:t,...n}){return t&&ce(t),Qt(qt,{client:Ut,...n,children:[Ot(Te,{}),e]})}export{Te as GrazEvents,Zo as GrazProvider,_ as WALLET_TYPES,F as WalletType,v as checkWallet,re as clearRecentChain,ce as configureGraz,A as connect,w as createClients,ee as createQueryClient,D as createSigningClients,Hn as defineChain,Ln as defineChainInfo,_n as defineChains,oe as disconnect,se as getActiveChainCurrency,on as getAvailableWallets,ue as getBalances,Je as getKeplr,Ye as getLeap,yn as getRecentChain,ae as getStakedBalances,S as getWallet,Vn as mainnetChains,Jn as mainnetChainsArray,h as reconnect,me as sendIbcTokens,pe as sendTokens,G as suggestChain,ie as suggestChainAndConnect,Yn as testnetChains,$n as testnetChainsArray,E as useAccount,bo as useActiveChain,Eo as useActiveChainCurrency,jo as useActiveChainValidators,mo as useBalance,kt as useBalances,no as useCheckKeplr,b as useCheckWallet,Qo as useClients,lo as useConnect,fo as useDisconnect,vt as useGrazEvents,It as useOfflineSigners,vo as useQueryClient,wo as useRecentChain,Fo as useSendIbcTokens,Ro as useSendTokens,yo as useSigners,zo as useSigningClients,go as useStakedBalances,Do as useSuggestChain,ko as useSuggestChainAndConnect};
1
+ import{GasPrice as ke}from"@cosmjs/stargate";import xe from"zustand";import{persist as Se,subscribeWithSelector as Ae}from"zustand/middleware";var U=(o=>(o.KEPLR="keplr",o.LEAP="leap",o))(U||{}),z=["keplr","leap"];var A={account:null,activeChain:null,balances:null,clients:null,defaultChain:null,defaultSigningClient:"stargate",offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClients:null,status:"disconnected",walletType:"keplr",_notFoundFn:()=>null,_reconnect:!1},Ee={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},i=xe(Ae(Se(()=>A,Ee)));import{SigningCosmWasmClient as W}from"@cosmjs/cosmwasm-stargate";import{SigningStargateClient as M}from"@cosmjs/stargate";import{Tendermint34Client as je}from"@cosmjs/tendermint-rpc";import{QueryClient as be}from"@cosmjs/stargate";import{assert as K,isNonNullObject as O}from"@cosmjs/utils";function P(...e){let{tendermint:t}=i.getState().clients,o=new be(t),c=e.map(n=>n(o));for(let n of c){K(O(n),"Extension must be a non-null object");for(let[s,r]of Object.entries(n)){K(O(r),`Module must be a non-null object. Found type ${typeof r} for module "${s}".`);let u=o[s]||{};o[s]={...u,...r}}}return o}async function d({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}},[c,n,s]=await Promise.all([W.connect(o),M.connect(o),je.connect(e)]);return{cosmWasm:c,stargate:n,tendermint:s}}async function h(e){let{rpc:t,rpcHeaders:o,offlineSignerAuto:c,cosmWasmSignerOptions:n={},stargateSignerOptions:s={}}=e,r={url:t,headers:{...o||{}}},[u,p]=await Promise.all([W.connectWithSigner(r,c,n),M.connectWithSigner(r,c,s)]);return{cosmWasm:u,stargate:p}}function E(e=i.getState().walletType){try{return y(e),!0}catch(t){return console.error(t),!1}}function we(){if(typeof window.keplr<"u")return window.keplr;throw i.getState()._notFoundFn(),new Error("window.keplr is not defined")}function De(){if(typeof window.leap<"u")return window.leap;throw i.getState()._notFoundFn(),new Error("window.leap is not defined")}function y(e=i.getState().walletType){switch(e){case"keplr":return we();case"leap":return De();default:throw new Error("Unknown wallet type")}}function Tt(){return Object.fromEntries(z.map(e=>[e,E(e)]))}async function g(e){try{let{defaultChain:t,recentChain:o,walletType:c}=i.getState(),n=(e==null?void 0:e.walletType)||c,s=y(n),r=e||o||t;if(!r)throw new Error("No last known connected chain, connect action requires chain info");i.setState(S=>{let he=S._reconnect;return S.activeChain&&S.activeChain.chainId!==r.chainId?{status:"connecting"}:he?{status:"reconnecting"}:{status:"connecting"}}),await s.enable(r.chainId);let u=s.getOfflineSigner(r.chainId),p=s.getOfflineSignerOnlyAmino(r.chainId),m=await s.getOfflineSignerAuto(r.chainId),fe=r.gas?ke.fromString(`${r.gas.price}${r.gas.denom}`):void 0,[Q,Ce,de]=await Promise.all([s.getKey(r.chainId),d(r),h({...r,offlineSignerAuto:m,cosmWasmSignerOptions:{gasPrice:fe,...(e==null?void 0:e.signerOpts)||{}}})]);return i.setState({account:Q,activeChain:r,clients:Ce,offlineSigner:u,offlineSignerAmino:p,offlineSignerAuto:m,recentChain:r,signingClients:de,status:"connected",walletType:n,_reconnect:!0}),Q}catch(t){throw i.getState().account===null&&i.setState({status:"disconnected"}),t}}async function R(e=!1){return i.setState(t=>({...A,recentChain:e?null:t.recentChain})),Promise.resolve()}function l(){let{activeChain:e}=i.getState();e&&g(e)}function F(){i.setState({recentChain:null})}function N(e){let{activeChain:t}=i.getState();return t==null?void 0:t.currencies.find(o=>o.coinMinimalDenom===e)}function Pt(){return i.getState().recentChain}async function b(e){return await y().experimentalSuggestChain(e),e}async function _({chainInfo:e,...t}){let o=await b(e);return{account:await g({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:o}}function H(e={}){return i.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}async function L(e){let{activeChain:t,signingClients:o}=i.getState();if(!t||!o)throw new Error("No connected account detected");let{defaultSigningClient:c}=i.getState();return await Promise.all(t.currencies.map(async s=>o[c].getBalance(e,s.coinMinimalDenom)))}async function V(e){let{clients:t}=i.getState();if(!(t!=null&&t.stargate))throw new Error("Stargate client is not ready");return t.stargate.getBalanceStaked(e)}async function J({senderAddress:e,recipientAddress:t,amount:o,fee:c,memo:n}){let{signingClients:s,defaultSigningClient:r}=i.getState();if(!s)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return s[r].sendTokens(e,t,o,c,n)}async function Y({senderAddress:e,recipientAddress:t,transferAmount:o,sourcePort:c,sourceChannel:n,timeoutHeight:s,timeoutTimestamp:r,fee:u,memo:p}){let{signingClients:m}=i.getState();if(!(m!=null&&m.stargate))throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return m.stargate.sendIbcTokens(e,t,o,c,n,s,r,u,p)}import{Bech32Address as Ie}from"@keplr-wallet/cosmos";var X={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Te={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Be={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Ge={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},ve={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},qe={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},$=[X,Te,Be,Ge,ve,qe],j={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:X,bip44:{coinType:118},bech32Config:Ie.defaultBech32Config("axelar"),currencies:$,feeCurrencies:$};import{Bech32Address as Qe}from"@keplr-wallet/cosmos";var ee={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Z=[ee],x={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:ee,bip44:{coinType:118},bech32Config:Qe.defaultBech32Config("cosmos"),currencies:Z,feeCurrencies:Z};import{Bech32Address as Ue}from"@keplr-wallet/cosmos";var ne={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},ze={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Ke={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Oe={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Pe={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},We={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Me={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Re={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Fe={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},Ne={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},_e={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},te=[ne,ze,Ke,Oe,Pe,We,Me,Re,Fe,Ne,_e],w={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:ne,bip44:{coinType:118},bech32Config:Ue.defaultBech32Config("juno"),currencies:te,feeCurrencies:te};import{Bech32Address as He}from"@keplr-wallet/cosmos";var re={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Le={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},oe=[re,Le],D={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:re,bip44:{coinType:118},bech32Config:He.defaultBech32Config("osmo"),currencies:oe,feeCurrencies:oe};import{Bech32Address as Ve}from"@keplr-wallet/cosmos";var ie={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},se=[ie],k={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:ie,bip44:{coinType:118},bech32Config:Ve.defaultBech32Config("somm"),currencies:se,feeCurrencies:se};import{Bech32Address as Je}from"@keplr-wallet/cosmos";var ae={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},ce=[ae],I={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:Je.defaultBech32Config("CRE"),currencies:ce,feeCurrencies:ce,stakeCurrency:ae,coinType:118};import{Bech32Address as Ye}from"@keplr-wallet/cosmos";var T={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},$e=[T],B={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:T,bip44:{coinType:118},bech32Config:Ye.defaultBech32Config("juno"),currencies:$e,feeCurrencies:[T],coinType:118};import{Bech32Address as Xe}from"@keplr-wallet/cosmos";var G={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Ze=[G],v={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:G,bip44:{coinType:118},bech32Config:Xe.defaultBech32Config("osmo"),currencies:Ze,feeCurrencies:[G],coinType:118};function dn(e){return e}function hn(e){return e}function xn(e){return e}var Sn={axelar:j,cosmos:x,cosmoshub:x,juno:w,osmosis:D,sommelier:k},An=[j,x,w,D,k],En={crescent:I,juno:B,osmosis:v},bn=[I,B,v];import{useMutation as ue,useQuery as q}from"@tanstack/react-query";import{useEffect as tt}from"react";import nt from"zustand/shallow";import{useQuery as et}from"@tanstack/react-query";function In(){return f("keplr")}function f(e){let t=i(n=>e||n.walletType);return et(["USE_CHECK_WALLET",t],({queryKey:[,n]})=>E(n))}function C({onConnect:e,onDisconnect:t}={}){let o=i(n=>n.account),c=i(n=>n.status);return tt(()=>i.subscribe(n=>n.status,(n,s)=>{if(n==="connected"){let r=i.getState();e==null||e({account:r.account,isReconnect:s==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:c==="connecting",isDisconnected:c==="disconnected",isReconnecting:c==="reconnecting",reconnect:l,status:c}}function ot(e){let{data:t}=C(),o=e||(t==null?void 0:t.bech32Address);return q(["USE_BALANCES",o],({queryKey:[,s]})=>L(s),{enabled:Boolean(o)})}function Kn(e,t){let{data:o}=ot(t);return q(["USE_BALANCE",o,e,t],({queryKey:[,s]})=>s==null?void 0:s.find(r=>r.denom===e),{enabled:Boolean(o)})}function On({onError:e,onLoading:t,onSuccess:o}={}){let n=ue(["USE_CONNECT",e,t,o],g,{onError:(r,u)=>Promise.resolve(e==null?void 0:e(r,u)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))}),{data:s}=f();return{connect:r=>n.mutate(r),connectAsync:r=>n.mutateAsync(r),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(s),status:n.status}}function Pn({onError:e,onLoading:t,onSuccess:o}={}){let n=ue(["USE_DISCONNECT",e,t,o],R,{onError:s=>Promise.resolve(e==null?void 0:e(s,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:s=>n.mutate(s),disconnectAsync:s=>n.mutateAsync(s),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function rt(){return i(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),nt)}function Wn(){return rt()}function Mn(e){let{data:t}=C(),o=e||(t==null?void 0:t.bech32Address);return q(["USE_BALANCE_STAKED",o],({queryKey:[,s]})=>V(o),{enabled:Boolean(o)})}import{useMutation as pe,useQuery as me}from"@tanstack/react-query";function Ln(){return i(e=>e.activeChain)}function Vn(e){return me(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,c]})=>N(c))}function Jn(e,t="BOND_STATUS_BONDED"){return me(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,n,s]})=>n.staking.validators(s),{enabled:typeof e<"u"})}function Yn(){return{data:i(t=>t.recentChain),clear:F}}function $n({onError:e,onLoading:t,onSuccess:o}={}){let n=pe(["USE_SUGGEST_CHAIN",e,t,o],b,{onError:(s,r)=>Promise.resolve(e==null?void 0:e(s,r)),onMutate:t,onSuccess:s=>Promise.resolve(o==null?void 0:o(s))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function Xn({onError:e,onLoading:t,onSuccess:o}={}){let n=pe(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],_,{onError:(r,u)=>Promise.resolve(e==null?void 0:e(r,u)),onMutate:r=>t==null?void 0:t(r),onSuccess:r=>Promise.resolve(o==null?void 0:o(r))}),{data:s}=f();return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(s),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}import{useQuery as le}from"@tanstack/react-query";import{useQuery as st}from"@tanstack/react-query";function no(...e){let t=["USE_QUERY_CLIENT",...e];return st(t,({queryKey:[,...c]})=>P(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})}function co(e){let t=i(n=>n.clients);return le(["USE_CLIENTS",e,t],({queryKey:[,n,s]})=>n!=null&&n.rpc?d(n):s,{refetchOnMount:!1,refetchOnWindowFocus:!1})}function ao(e){let t=i(n=>n.signingClients);return le(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,n,s]})=>n!=null&&n.rpc?h(n):s,{refetchOnMount:!1,refetchOnWindowFocus:!1})}import{useMutation as ye}from"@tanstack/react-query";function go({onError:e,onLoading:t,onSuccess:o}={}){let{data:c}=C(),n=c==null?void 0:c.bech32Address,r=ye(["USE_SEND_TOKENS",e,t,o,n],u=>J({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(o==null?void 0:o(u))});return{error:r.error,isLoading:r.isLoading,isSuccess:r.isSuccess,sendTokens:r.mutate,sendTokensAsync:r.mutateAsync,status:r.status}}function fo({onError:e,onLoading:t,onSuccess:o}={}){let{data:c}=C(),n=c==null?void 0:c.bech32Address,r=ye(["USE_SEND_IBC_TOKENS",e,t,o,n],u=>Y({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(o==null?void 0:o(u))});return{error:r.error,isLoading:r.isLoading,isSuccess:r.isSuccess,sendIbcTokens:r.mutate,sendIbcTokensAsync:r.mutateAsync,status:r.status}}import{QueryClient as at,QueryClientProvider as ut}from"@tanstack/react-query";import{useEffect as it}from"react";function ct(){return it(()=>{let{_reconnect:e}=i.getState();return e&&l(),window.addEventListener("keplr_keystorechange",l),()=>{window.removeEventListener("keplr_keystorechange",l)}},[]),null}function ge(){return ct(),null}import{jsx as mt,jsxs as lt}from"react/jsx-runtime";var pt=new at({});function wo({children:e,grazOptions:t,...o}){return t&&H(t),lt(ut,{client:pt,...o,children:[mt(ge,{}),e]})}export{ge as GrazEvents,wo as GrazProvider,z as WALLET_TYPES,U as WalletType,E as checkWallet,F as clearRecentChain,H as configureGraz,g as connect,d as createClients,P as createQueryClient,h as createSigningClients,hn as defineChain,xn as defineChainInfo,dn as defineChains,R as disconnect,N as getActiveChainCurrency,Tt as getAvailableWallets,V as getBalanceStaked,L as getBalances,we as getKeplr,De as getLeap,Pt as getRecentChain,y as getWallet,Sn as mainnetChains,An as mainnetChainsArray,l as reconnect,Y as sendIbcTokens,J as sendTokens,b as suggestChain,_ as suggestChainAndConnect,En as testnetChains,bn as testnetChainsArray,C as useAccount,Ln as useActiveChain,Vn as useActiveChainCurrency,Jn as useActiveChainValidators,Kn as useBalance,Mn as useBalanceStaked,ot as useBalances,In as useCheckKeplr,f as useCheckWallet,co as useClients,On as useConnect,Pn as useDisconnect,ct as useGrazEvents,rt as useOfflineSigners,no as useQueryClient,Yn as useRecentChain,fo as useSendIbcTokens,go as useSendTokens,Wn as useSigners,ao as useSigningClients,$n as useSuggestChain,Xn as useSuggestChainAndConnect};
package/dist/keplr.mjs CHANGED
@@ -1 +1 @@
1
- import{c as o}from"./chunk-6M3A6KFX.mjs";o();export*from"@keplr-wallet/cosmos";export*from"@keplr-wallet/types";
1
+ export*from"@keplr-wallet/cosmos";export*from"@keplr-wallet/types";
@@ -1 +1 @@
1
- import{c as o}from"./chunk-6M3A6KFX.mjs";o();export*from"@cosmjs/tendermint-rpc";
1
+ export*from"@cosmjs/tendermint-rpc";
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.25",
4
+ "version": "0.0.27",
5
5
  "author": "Griko Nibras <griko@strangelove.ventures>",
6
6
  "repository": "https://github.com/strangelove-ventures/graz.git",
7
7
  "homepage": "https://github.com/strangelove-ventures/graz",
@@ -1 +0,0 @@
1
- var f=Object.create;var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var R=(a,e)=>()=>(a&&(e=a(a=0)),e);var g=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var b=(a,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!x.call(a,r)&&r!==o&&c(a,r,{get:()=>e[r],enumerable:!(t=m(e,r))||t.enumerable});return a};var h=(a,e,o)=>(o=a!=null?f(s(a)):{},b(e||!a||!a.__esModule?c(o,"default",{value:a,enumerable:!0}):o,a));import*as k from"react";var d=R(()=>{"use strict"});export{g as a,h as b,d as c};