graz 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -117,6 +117,12 @@ declare type CreateSigningClientArgs = CreateClientArgs & {
117
117
  };
118
118
  declare function createSigningClient(args: CreateSigningClientArgs): Promise<SigningCosmWasmClient>;
119
119
 
120
+ interface ConfigureGrazArgs {
121
+ defaultChain?: GrazChain;
122
+ onKeplrNotFound?: () => void;
123
+ }
124
+ declare function configureGraz(args?: ConfigureGrazArgs): ConfigureGrazArgs;
125
+
120
126
  /**
121
127
  * Function to return {@link Keplr} object and throws and error if it does not exist on `window`.
122
128
  *
@@ -508,4 +514,4 @@ interface GrazProviderProps {
508
514
  declare function GrazProvider({ children }: GrazProviderProps): JSX.Element;
509
515
  declare const GRAZ_PROVIDER_COMPONENT_KEY = "graz-query-client";
510
516
 
511
- export { ConnectArgs, CreateClientArgs, CreateSigningClientArgs, GRAZ_PROVIDER_COMPONENT_KEY, GrazChain, GrazProvider, GrazProviderProps, UseAccountArgs, UseConnectChainArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, clearRecentChain, configureDefaultChain, connect, createClient, createSigningClient, defineChains, disconnect, getBalances, getKeplr, getRecentChain, mainnetChains, mainnetChainsArray, reconnect, registerKeplrNotFound, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, unregisterKeplrNotFound, useAccount, useActiveChain, useBalances, useCheckKeplr, useClient, useConnect, useDisconnect, useRecentChain, useSigners, useSigningClient, useSuggestChain, useSuggestChainAndConnect };
517
+ export { ConfigureGrazArgs, ConnectArgs, CreateClientArgs, CreateSigningClientArgs, GRAZ_PROVIDER_COMPONENT_KEY, GrazChain, GrazProvider, GrazProviderProps, UseAccountArgs, UseConnectChainArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, clearRecentChain, configureDefaultChain, configureGraz, connect, createClient, createSigningClient, defineChains, disconnect, getBalances, getKeplr, getRecentChain, mainnetChains, mainnetChainsArray, reconnect, registerKeplrNotFound, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, unregisterKeplrNotFound, useAccount, useActiveChain, useBalances, useCheckKeplr, useClient, useConnect, useDisconnect, useRecentChain, useSigners, useSigningClient, useSuggestChain, useSuggestChainAndConnect };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Se=Object.create;var C=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var Ie=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var be=(e,t)=>{for(var o in t)C(e,o,{get:t[o],enumerable:!0})},E=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ke(t))!De.call(e,n)&&n!==o&&C(e,n,{get:()=>t[n],enumerable:!(i=xe(t,n))||i.enumerable});return e};var S=(e,t,o)=>(o=e!=null?Se(Ie(e)):{},E(t||!e||!e.__esModule?C(o,"default",{value:e,enumerable:!0}):o,e)),ve=e=>E(C({},"__esModule",{value:!0}),e);var fn={};be(fn,{GRAZ_PROVIDER_COMPONENT_KEY:()=>fe,GrazProvider:()=>hn,clearRecentChain:()=>b,configureDefaultChain:()=>Oe,connect:()=>p,createClient:()=>u,createSigningClient:()=>l,defineChains:()=>$e,disconnect:()=>I,getBalances:()=>D,getKeplr:()=>g,getRecentChain:()=>Me,mainnetChains:()=>Ye,mainnetChainsArray:()=>Ze,reconnect:()=>m,registerKeplrNotFound:()=>Ge,suggestChain:()=>d,suggestChainAndConnect:()=>v,testnetChains:()=>en,testnetChainsArray:()=>nn,unregisterKeplrNotFound:()=>ze,useAccount:()=>le,useActiveChain:()=>cn,useBalances:()=>tn,useCheckKeplr:()=>h,useClient:()=>un,useConnect:()=>on,useDisconnect:()=>rn,useRecentChain:()=>an,useSigners:()=>sn,useSigningClient:()=>ln,useSuggestChain:()=>mn,useSuggestChainAndConnect:()=>pn});module.exports=ve(fn);var c=S(require("react"));var W=require("@cosmjs/stargate");var _=S(require("zustand")),y=require("zustand/middleware"),x={account:null,activeChain:null,balances:null,client:null,defaultChain:null,offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClient:null,status:"disconnected",_notFoundFn:()=>null,_reconnect:!1,_supported:!1},je={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},s=(0,_.default)((0,y.subscribeWithSelector)((0,y.persist)(()=>x,je)));var k=require("@cosmjs/cosmwasm-stargate");async function u({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}};return await k.SigningCosmWasmClient.connect(o)}async function l(e){let{rpc:t,rpcHeaders:o,offlineSigner:i,signerOptions:n={}}=e,r={url:t,headers:{...o||{}}};return await k.SigningCosmWasmClient.connectWithSigner(r,i,n)}function g(){if(typeof window.keplr<"u")return window.keplr;throw s.getState()._notFoundFn(),new Error("Keplr is not defined")}function Ge(e){s.setState({_notFoundFn:e})}function ze(){s.setState({_notFoundFn:()=>null})}async function p(e){try{let t=g(),{defaultChain:o,recentChain:i}=s.getState(),n=e||i||o;if(!n)throw new Error("No last known connected chain, connect action requires chain info");s.setState(A=>{let Ae=A._reconnect;return A.activeChain&&A.activeChain.chainId!==n.chainId?{status:"connecting"}:Ae?{status:"reconnecting"}:{status:"connecting"}}),await t.enable(n.chainId);let r=t.getOfflineSigner(n.chainId),a=t.getOfflineSignerOnlyAmino(n.chainId),Ce=n.gas?W.GasPrice.fromString(`${n.gas.price}${n.gas.denom}`):void 0,[R,ye,de,we]=await Promise.all([t.getKey(n.chainId),u(n),t.getOfflineSignerAuto(n.chainId),l({...n,offlineSigner:r,signerOptions:{gasPrice:Ce,...(e==null?void 0:e.signerOpts)||{}}})]);return s.setState({account:R,activeChain:n,client:ye,offlineSigner:r,offlineSignerAmino:a,offlineSignerAuto:de,recentChain:n,signingClient:we,status:"connected",_reconnect:!0}),R}catch(t){throw s.getState().account===null&&s.setState({status:"disconnected"}),t}}async function I(e=!1){return s.setState(t=>({...x,recentChain:e?null:t.recentChain,_supported:t._supported})),Promise.resolve()}async function D(e){let{activeChain:t,signingClient:o}=s.getState();if(!t||!o)throw new Error("No connected account detected");return await Promise.all(t.currencies.map(async n=>o.getBalance(e,n.coinMinimalDenom)))}function m(){let{activeChain:e}=s.getState();e&&p(e)}function Oe(e){return s.setState({defaultChain:e}),e}function Me(){return s.getState().recentChain}function b(){s.setState({recentChain:null})}async function d(e){return await g().experimentalSuggestChain(e),e}async function v(e){let t=await d(e);return{account:await p(e),chain:t}}var L=require("@keplr-wallet/cosmos"),H={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Ue={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},qe={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Ke={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},Te={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Pe={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},F=[H,Ue,qe,Ke,Te,Pe],j={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:H,bip44:{coinType:118},bech32Config:L.Bech32Address.defaultBech32Config("axelar"),currencies:F,feeCurrencies:F};var Q=require("@keplr-wallet/cosmos"),V={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},J=[V],G={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:V,bip44:{coinType:118},bech32Config:Q.Bech32Address.defaultBech32Config("cosmos"),currencies:J,feeCurrencies:J};var $=require("@keplr-wallet/cosmos"),Y={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},X=[Y],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:$.Bech32Address.defaultBech32Config("CRE"),currencies:X,feeCurrencies:X,stakeCurrency:Y,coinType:118};var ee=require("@keplr-wallet/cosmos"),ne={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Be={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Ne={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Re={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Ee={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},_e={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},We={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Fe={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Le={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},He={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Je={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},Z=[ne,Be,Ne,Re,Ee,_e,We,Fe,Le,He,Je],O={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:ne,bip44:{coinType:118},bech32Config:ee.Bech32Address.defaultBech32Config("juno"),currencies:Z,feeCurrencies:Z};var te=require("@keplr-wallet/cosmos"),M={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Qe=[M],U={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:M,bip44:{coinType:118},bech32Config:te.Bech32Address.defaultBech32Config("juno"),currencies:Qe,feeCurrencies:[M],coinType:118};var ie=require("@keplr-wallet/cosmos"),re={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Ve={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},oe=[re,Ve],q={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:re,bip44:{coinType:118},bech32Config:ie.Bech32Address.defaultBech32Config("osmo"),currencies:oe,feeCurrencies:oe};var se=require("@keplr-wallet/cosmos"),K={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Xe=[K],T={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:se.Bech32Address.defaultBech32Config("osmo"),currencies:Xe,feeCurrencies:[K],coinType:118};var ae=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"},ce=[me],P={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:me,bip44:{coinType:118},bech32Config:ae.Bech32Address.defaultBech32Config("somm"),currencies:ce,feeCurrencies:ce};function $e(e){return e}var Ye={axelar:j,cosmos:G,juno:O,osmosis:q,sommelier:P},Ze=[j,G,O,q,P],en={crescent:z,juno:U,osmosis:T},nn=[z,U,T];var f=require("@tanstack/react-query"),pe=require("react"),ue=S(require("zustand/shallow"));function h(){return s(e=>e._supported)}function le({onConnect:e,onDisconnect:t}={}){let o=s(n=>n.account),i=s(n=>n.status);return(0,pe.useEffect)(()=>s.subscribe(n=>n.status,(n,r)=>{if(n==="connected"){let a=s.getState();e==null||e({account:a.account,isReconnect:r==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:i==="connecting",isDisconnected:i==="disconnected",isReconnecting:i==="reconnecting",reconnect:m,status:i}}function tn(e){let{data:t}=le(),o=e||(t==null?void 0:t.bech32Address),n=(0,f.useQuery)(["USE_BALANCES",o],({queryKey:[,r]})=>D(r),{enabled:Boolean(o)});return{data:n.data,error:n.error,isFetching:n.isFetching,isLoading:n.isLoading,isRefetching:n.isRefetching,isSuccess:n.isSuccess,refetch:n.refetch,status:n.status}}function on({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,f.useMutation)(["USE_CONNECT",e,t,o],p,{onError:(r,a)=>Promise.resolve(e==null?void 0:e(r,a)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))});return{connect:r=>n.mutate(r),connectAsync:r=>n.mutateAsync(r),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:h(),status:n.status}}function rn({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,f.useMutation)(["USE_DISCONNECT",e,t,o],I,{onError:r=>Promise.resolve(e==null?void 0:e(r,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:r=>n.mutate(r),disconnectAsync:r=>n.mutateAsync(r),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function sn(){return s(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),ue.default)}var B=require("@tanstack/react-query");function cn(){return s(e=>e.activeChain)}function an(){return{data:s(t=>t.recentChain),clear:b}}function mn({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,B.useMutation)(["USE_SUGGEST_CHAIN",e,t,o],d,{onError:(r,a)=>Promise.resolve(e==null?void 0:e(r,a)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function pn({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,B.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],v,{onError:(r,a)=>Promise.resolve(e==null?void 0:e(r,a)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:h(),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}var N=require("@tanstack/react-query");function un(e){let t=s(n=>n.client),i=(0,N.useQuery)(["USE_CLIENT",e,t],({queryKey:[,n,r]})=>n!=null&&n.rpc?u(n):r,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:i.data,error:i.error,isFetching:i.isFetching,isLoading:i.isLoading,isRefetching:i.isRefetching,isSuccess:i.isSuccess,refetch:i.refetch,status:i.status}}function ln(e){let t=s(n=>n.signingClient),i=(0,N.useQuery)(["USE_SIGNING_CLIENT",e,t],({queryKey:[,n,r]})=>n!=null&&n.rpc?l(n):r,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:i.data,error:i.error,isFetching:i.isFetching,isLoading:i.isLoading,isRefetching:i.isRefetching,isSuccess:i.isSuccess,refetch:i.refetch,status:i.status}}var w=require("@tanstack/react-query");var ge=require("react");function he(){return(0,ge.useEffect)(()=>{s.setState({_supported:typeof window.keplr<"u"});let{_reconnect:e}=s.getState();return e&&m(),window.addEventListener("keplr_keystorechange",m),()=>{window.removeEventListener("keplr_keystorechange",m)}},[]),null}var gn=new w.QueryClient({});function hn({children:e}){return c.createElement(w.QueryClientProvider,{key:fe,client:gn},c.createElement(he,null),e)}var fe="graz-query-client";0&&(module.exports={GRAZ_PROVIDER_COMPONENT_KEY,GrazProvider,clearRecentChain,configureDefaultChain,connect,createClient,createSigningClient,defineChains,disconnect,getBalances,getKeplr,getRecentChain,mainnetChains,mainnetChainsArray,reconnect,registerKeplrNotFound,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,unregisterKeplrNotFound,useAccount,useActiveChain,useBalances,useCheckKeplr,useClient,useConnect,useDisconnect,useRecentChain,useSigners,useSigningClient,useSuggestChain,useSuggestChainAndConnect});
1
+ "use strict";var ke=Object.create;var C=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty;var je=(e,t)=>{for(var o in t)C(e,o,{get:t[o],enumerable:!0})},F=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of De(t))!be.call(e,n)&&n!==o&&C(e,n,{get:()=>t[n],enumerable:!(i=Ie(t,n))||i.enumerable});return e};var S=(e,t,o)=>(o=e!=null?ke(ve(e)):{},F(t||!e||!e.__esModule?C(o,"default",{value:e,enumerable:!0}):o,e)),Ge=e=>F(C({},"__esModule",{value:!0}),e);var Cn={};je(Cn,{GRAZ_PROVIDER_COMPONENT_KEY:()=>ye,GrazProvider:()=>fn,clearRecentChain:()=>j,configureDefaultChain:()=>b,configureGraz:()=>Ke,connect:()=>p,createClient:()=>u,createSigningClient:()=>l,defineChains:()=>Ye,disconnect:()=>D,getBalances:()=>v,getKeplr:()=>g,getRecentChain:()=>Me,mainnetChains:()=>Ze,mainnetChainsArray:()=>en,reconnect:()=>m,registerKeplrNotFound:()=>I,suggestChain:()=>d,suggestChainAndConnect:()=>G,testnetChains:()=>nn,testnetChainsArray:()=>tn,unregisterKeplrNotFound:()=>Oe,useAccount:()=>he,useActiveChain:()=>an,useBalances:()=>on,useCheckKeplr:()=>h,useClient:()=>ln,useConnect:()=>rn,useDisconnect:()=>sn,useRecentChain:()=>mn,useSigners:()=>cn,useSigningClient:()=>gn,useSuggestChain:()=>pn,useSuggestChainAndConnect:()=>un});module.exports=Ge(Cn);var c=S(require("react"));var L=require("@cosmjs/stargate");var W=S(require("zustand")),y=require("zustand/middleware"),x={account:null,activeChain:null,balances:null,client:null,defaultChain:null,offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClient:null,status:"disconnected",_notFoundFn:()=>null,_reconnect:!1,_supported:!1},ze={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},s=(0,W.default)((0,y.subscribeWithSelector)((0,y.persist)(()=>x,ze)));var k=require("@cosmjs/cosmwasm-stargate");async function u({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}};return await k.SigningCosmWasmClient.connect(o)}async function l(e){let{rpc:t,rpcHeaders:o,offlineSigner:i,signerOptions:n={}}=e,r={url:t,headers:{...o||{}}};return await k.SigningCosmWasmClient.connectWithSigner(r,i,n)}function g(){if(typeof window.keplr<"u")return window.keplr;throw s.getState()._notFoundFn(),new Error("Keplr is not defined")}function I(e){s.setState({_notFoundFn:e})}function Oe(){s.setState({_notFoundFn:()=>null})}async function p(e){try{let t=g(),{defaultChain:o,recentChain:i}=s.getState(),n=e||i||o;if(!n)throw new Error("No last known connected chain, connect action requires chain info");s.setState(A=>{let xe=A._reconnect;return A.activeChain&&A.activeChain.chainId!==n.chainId?{status:"connecting"}:xe?{status:"reconnecting"}:{status:"connecting"}}),await t.enable(n.chainId);let r=t.getOfflineSigner(n.chainId),a=t.getOfflineSignerOnlyAmino(n.chainId),de=n.gas?L.GasPrice.fromString(`${n.gas.price}${n.gas.denom}`):void 0,[_,we,Ae,Se]=await Promise.all([t.getKey(n.chainId),u(n),t.getOfflineSignerAuto(n.chainId),l({...n,offlineSigner:r,signerOptions:{gasPrice:de,...(e==null?void 0:e.signerOpts)||{}}})]);return s.setState({account:_,activeChain:n,client:we,offlineSigner:r,offlineSignerAmino:a,offlineSignerAuto:Ae,recentChain:n,signingClient:Se,status:"connected",_reconnect:!0}),_}catch(t){throw s.getState().account===null&&s.setState({status:"disconnected"}),t}}async function D(e=!1){return s.setState(t=>({...x,recentChain:e?null:t.recentChain,_supported:t._supported})),Promise.resolve()}async function v(e){let{activeChain:t,signingClient:o}=s.getState();if(!t||!o)throw new Error("No connected account detected");return await Promise.all(t.currencies.map(async n=>o.getBalance(e,n.coinMinimalDenom)))}function m(){let{activeChain:e}=s.getState();e&&p(e)}function b(e){return s.setState({defaultChain:e}),e}function Me(){return s.getState().recentChain}function j(){s.setState({recentChain:null})}async function d(e){return await g().experimentalSuggestChain(e),e}async function G(e){let t=await d(e);return{account:await p(e),chain:t}}function Ke(e={}){let{defaultChain:t,onKeplrNotFound:o}=e;return t&&b(t),o&&I(o),e}var J=require("@keplr-wallet/cosmos"),Q={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Ue={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},qe={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Te={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},Ne={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Pe={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},H=[Q,Ue,qe,Te,Ne,Pe],z={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:Q,bip44:{coinType:118},bech32Config:J.Bech32Address.defaultBech32Config("axelar"),currencies:H,feeCurrencies:H};var X=require("@keplr-wallet/cosmos"),$={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},V=[$],O={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:$,bip44:{coinType:118},bech32Config:X.Bech32Address.defaultBech32Config("cosmos"),currencies:V,feeCurrencies:V};var Z=require("@keplr-wallet/cosmos"),ee={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},Y=[ee],M={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:Z.Bech32Address.defaultBech32Config("CRE"),currencies:Y,feeCurrencies:Y,stakeCurrency:ee,coinType:118};var te=require("@keplr-wallet/cosmos"),oe={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Be={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Re={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Ee={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},_e={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Fe={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},We={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Le={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},He={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},Je={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Qe={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},ne=[oe,Be,Re,Ee,_e,Fe,We,Le,He,Je,Qe],K={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:oe,bip44:{coinType:118},bech32Config:te.Bech32Address.defaultBech32Config("juno"),currencies:ne,feeCurrencies:ne};var ie=require("@keplr-wallet/cosmos"),U={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Ve=[U],q={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:U,bip44:{coinType:118},bech32Config:ie.Bech32Address.defaultBech32Config("juno"),currencies:Ve,feeCurrencies:[U],coinType:118};var se=require("@keplr-wallet/cosmos"),ce={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Xe={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},re=[ce,Xe],T={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:ce,bip44:{coinType:118},bech32Config:se.Bech32Address.defaultBech32Config("osmo"),currencies:re,feeCurrencies:re};var ae=require("@keplr-wallet/cosmos"),N={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},$e=[N],P={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:N,bip44:{coinType:118},bech32Config:ae.Bech32Address.defaultBech32Config("osmo"),currencies:$e,feeCurrencies:[N],coinType:118};var pe=require("@keplr-wallet/cosmos"),ue={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},me=[ue],B={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:ue,bip44:{coinType:118},bech32Config:pe.Bech32Address.defaultBech32Config("somm"),currencies:me,feeCurrencies:me};function Ye(e){return e}var Ze={axelar:z,cosmos:O,juno:K,osmosis:T,sommelier:B},en=[z,O,K,T,B],nn={crescent:M,juno:q,osmosis:P},tn=[M,q,P];var f=require("@tanstack/react-query"),le=require("react"),ge=S(require("zustand/shallow"));function h(){return s(e=>e._supported)}function he({onConnect:e,onDisconnect:t}={}){let o=s(n=>n.account),i=s(n=>n.status);return(0,le.useEffect)(()=>s.subscribe(n=>n.status,(n,r)=>{if(n==="connected"){let a=s.getState();e==null||e({account:a.account,isReconnect:r==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:i==="connecting",isDisconnected:i==="disconnected",isReconnecting:i==="reconnecting",reconnect:m,status:i}}function on(e){let{data:t}=he(),o=e||(t==null?void 0:t.bech32Address),n=(0,f.useQuery)(["USE_BALANCES",o],({queryKey:[,r]})=>v(r),{enabled:Boolean(o)});return{data:n.data,error:n.error,isFetching:n.isFetching,isLoading:n.isLoading,isRefetching:n.isRefetching,isSuccess:n.isSuccess,refetch:n.refetch,status:n.status}}function rn({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,f.useMutation)(["USE_CONNECT",e,t,o],p,{onError:(r,a)=>Promise.resolve(e==null?void 0:e(r,a)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))});return{connect:r=>n.mutate(r),connectAsync:r=>n.mutateAsync(r),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:h(),status:n.status}}function sn({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,f.useMutation)(["USE_DISCONNECT",e,t,o],D,{onError:r=>Promise.resolve(e==null?void 0:e(r,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:r=>n.mutate(r),disconnectAsync:r=>n.mutateAsync(r),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function cn(){return s(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),ge.default)}var R=require("@tanstack/react-query");function an(){return s(e=>e.activeChain)}function mn(){return{data:s(t=>t.recentChain),clear:j}}function pn({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,R.useMutation)(["USE_SUGGEST_CHAIN",e,t,o],d,{onError:(r,a)=>Promise.resolve(e==null?void 0:e(r,a)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function un({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,R.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],G,{onError:(r,a)=>Promise.resolve(e==null?void 0:e(r,a)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:h(),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}var E=require("@tanstack/react-query");function ln(e){let t=s(n=>n.client),i=(0,E.useQuery)(["USE_CLIENT",e,t],({queryKey:[,n,r]})=>n!=null&&n.rpc?u(n):r,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:i.data,error:i.error,isFetching:i.isFetching,isLoading:i.isLoading,isRefetching:i.isRefetching,isSuccess:i.isSuccess,refetch:i.refetch,status:i.status}}function gn(e){let t=s(n=>n.signingClient),i=(0,E.useQuery)(["USE_SIGNING_CLIENT",e,t],({queryKey:[,n,r]})=>n!=null&&n.rpc?l(n):r,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:i.data,error:i.error,isFetching:i.isFetching,isLoading:i.isLoading,isRefetching:i.isRefetching,isSuccess:i.isSuccess,refetch:i.refetch,status:i.status}}var w=require("@tanstack/react-query");var fe=require("react");function Ce(){return(0,fe.useEffect)(()=>{s.setState({_supported:typeof window.keplr<"u"});let{_reconnect:e}=s.getState();return e&&m(),window.addEventListener("keplr_keystorechange",m),()=>{window.removeEventListener("keplr_keystorechange",m)}},[]),null}var hn=new w.QueryClient({});function fn({children:e}){return c.createElement(w.QueryClientProvider,{key:ye,client:hn},c.createElement(Ce,null),e)}var ye="graz-query-client";0&&(module.exports={GRAZ_PROVIDER_COMPONENT_KEY,GrazProvider,clearRecentChain,configureDefaultChain,configureGraz,connect,createClient,createSigningClient,defineChains,disconnect,getBalances,getKeplr,getRecentChain,mainnetChains,mainnetChainsArray,reconnect,registerKeplrNotFound,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,unregisterKeplrNotFound,useAccount,useActiveChain,useBalances,useCheckKeplr,useClient,useConnect,useDisconnect,useRecentChain,useSigners,useSigningClient,useSuggestChain,useSuggestChainAndConnect});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as c}from"./chunk-L7O257ZE.mjs";import{GasPrice as re}from"@cosmjs/stargate";import ne from"zustand";import{persist as te,subscribeWithSelector as oe}from"zustand/middleware";var C={account:null,activeChain:null,balances:null,client:null,defaultChain:null,offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClient:null,status:"disconnected",_notFoundFn:()=>null,_reconnect:!1,_supported:!1},ie={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},r=ne(oe(te(()=>C,ie)));import{SigningCosmWasmClient as G}from"@cosmjs/cosmwasm-stargate";async function u({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}};return await G.connect(o)}async function l(e){let{rpc:t,rpcHeaders:o,offlineSigner:s,signerOptions:n={}}=e,i={url:t,headers:{...o||{}}};return await G.connectWithSigner(i,s,n)}function g(){if(typeof window.keplr<"u")return window.keplr;throw r.getState()._notFoundFn(),new Error("Keplr is not defined")}function Qe(e){r.setState({_notFoundFn:e})}function Ve(){r.setState({_notFoundFn:()=>null})}async function p(e){try{let t=g(),{defaultChain:o,recentChain:s}=r.getState(),n=e||s||o;if(!n)throw new Error("No last known connected chain, connect action requires chain info");r.setState(f=>{let ee=f._reconnect;return f.activeChain&&f.activeChain.chainId!==n.chainId?{status:"connecting"}:ee?{status:"reconnecting"}:{status:"connecting"}}),await t.enable(n.chainId);let i=t.getOfflineSigner(n.chainId),a=t.getOfflineSignerOnlyAmino(n.chainId),X=n.gas?re.fromString(`${n.gas.price}${n.gas.denom}`):void 0,[j,$,Y,Z]=await Promise.all([t.getKey(n.chainId),u(n),t.getOfflineSignerAuto(n.chainId),l({...n,offlineSigner:i,signerOptions:{gasPrice:X,...(e==null?void 0:e.signerOpts)||{}}})]);return r.setState({account:j,activeChain:n,client:$,offlineSigner:i,offlineSignerAmino:a,offlineSignerAuto:Y,recentChain:n,signingClient:Z,status:"connected",_reconnect:!0}),j}catch(t){throw r.getState().account===null&&r.setState({status:"disconnected"}),t}}async function z(e=!1){return r.setState(t=>({...C,recentChain:e?null:t.recentChain,_supported:t._supported})),Promise.resolve()}async function O(e){let{activeChain:t,signingClient:o}=r.getState();if(!t||!o)throw new Error("No connected account detected");return await Promise.all(t.currencies.map(async n=>o.getBalance(e,n.coinMinimalDenom)))}function m(){let{activeChain:e}=r.getState();e&&p(e)}function sn(e){return r.setState({defaultChain:e}),e}function cn(){return r.getState().recentChain}function M(){r.setState({recentChain:null})}async function y(e){return await g().experimentalSuggestChain(e),e}async function U(e){let t=await y(e);return{account:await p(e),chain:t}}import{Bech32Address as se}from"@keplr-wallet/cosmos";var K={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},ce={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},ae={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},me={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},pe={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},ue={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},q=[K,ce,ae,me,pe,ue],d={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:K,bip44:{coinType:118},bech32Config:se.defaultBech32Config("axelar"),currencies:q,feeCurrencies:q};import{Bech32Address as le}from"@keplr-wallet/cosmos";var P={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},T=[P],w={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:P,bip44:{coinType:118},bech32Config:le.defaultBech32Config("cosmos"),currencies:T,feeCurrencies:T};import{Bech32Address as ge}from"@keplr-wallet/cosmos";var N={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},B=[N],A={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:ge.defaultBech32Config("CRE"),currencies:B,feeCurrencies:B,stakeCurrency:N,coinType:118};import{Bech32Address as he}from"@keplr-wallet/cosmos";var E={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},fe={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Ce={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},ye={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},de={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"},Ae={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Se={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},xe={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},ke={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Ie={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},R=[E,fe,Ce,ye,de,we,Ae,Se,xe,ke,Ie],S={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:E,bip44:{coinType:118},bech32Config:he.defaultBech32Config("juno"),currencies:R,feeCurrencies:R};import{Bech32Address as De}from"@keplr-wallet/cosmos";var x={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},be=[x],k={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:x,bip44:{coinType:118},bech32Config:De.defaultBech32Config("juno"),currencies:be,feeCurrencies:[x],coinType:118};import{Bech32Address as ve}from"@keplr-wallet/cosmos";var W={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},je={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},_=[W,je],I={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:W,bip44:{coinType:118},bech32Config:ve.defaultBech32Config("osmo"),currencies:_,feeCurrencies:_};import{Bech32Address as Ge}from"@keplr-wallet/cosmos";var D={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},ze=[D],b={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:D,bip44:{coinType:118},bech32Config:Ge.defaultBech32Config("osmo"),currencies:ze,feeCurrencies:[D],coinType:118};import{Bech32Address as Oe}from"@keplr-wallet/cosmos";var L={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},F=[L],v={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:L,bip44:{coinType:118},bech32Config:Oe.defaultBech32Config("somm"),currencies:F,feeCurrencies:F};function Un(e){return e}var qn={axelar:d,cosmos:w,juno:S,osmosis:I,sommelier:v},Kn=[d,w,S,I,v],Tn={crescent:A,juno:k,osmosis:b},Pn=[A,k,b];import{useMutation as H,useQuery as Me}from"@tanstack/react-query";import{useEffect as Ue}from"react";import qe from"zustand/shallow";function h(){return r(e=>e._supported)}function Ke({onConnect:e,onDisconnect:t}={}){let o=r(n=>n.account),s=r(n=>n.status);return Ue(()=>r.subscribe(n=>n.status,(n,i)=>{if(n==="connected"){let a=r.getState();e==null||e({account:a.account,isReconnect:i==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:s==="connecting",isDisconnected:s==="disconnected",isReconnecting:s==="reconnecting",reconnect:m,status:s}}function Jn(e){let{data:t}=Ke(),o=e||(t==null?void 0:t.bech32Address),n=Me(["USE_BALANCES",o],({queryKey:[,i]})=>O(i),{enabled:Boolean(o)});return{data:n.data,error:n.error,isFetching:n.isFetching,isLoading:n.isLoading,isRefetching:n.isRefetching,isSuccess:n.isSuccess,refetch:n.refetch,status:n.status}}function Qn({onError:e,onLoading:t,onSuccess:o}={}){let n=H(["USE_CONNECT",e,t,o],p,{onError:(i,a)=>Promise.resolve(e==null?void 0:e(i,a)),onMutate:t,onSuccess:i=>Promise.resolve(o==null?void 0:o(i))});return{connect:i=>n.mutate(i),connectAsync:i=>n.mutateAsync(i),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:h(),status:n.status}}function Vn({onError:e,onLoading:t,onSuccess:o}={}){let n=H(["USE_DISCONNECT",e,t,o],z,{onError:i=>Promise.resolve(e==null?void 0:e(i,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:i=>n.mutate(i),disconnectAsync:i=>n.mutateAsync(i),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function Xn(){return r(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),qe)}import{useMutation as J}from"@tanstack/react-query";function tt(){return r(e=>e.activeChain)}function ot(){return{data:r(t=>t.recentChain),clear:M}}function it({onError:e,onLoading:t,onSuccess:o}={}){let n=J(["USE_SUGGEST_CHAIN",e,t,o],y,{onError:(i,a)=>Promise.resolve(e==null?void 0:e(i,a)),onMutate:t,onSuccess:i=>Promise.resolve(o==null?void 0:o(i))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function rt({onError:e,onLoading:t,onSuccess:o}={}){let n=J(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],U,{onError:(i,a)=>Promise.resolve(e==null?void 0:e(i,a)),onMutate:t,onSuccess:i=>Promise.resolve(o==null?void 0:o(i))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:h(),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}import{useQuery as Q}from"@tanstack/react-query";function pt(e){let t=r(n=>n.client),s=Q(["USE_CLIENT",e,t],({queryKey:[,n,i]})=>n!=null&&n.rpc?u(n):i,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:s.data,error:s.error,isFetching:s.isFetching,isLoading:s.isLoading,isRefetching:s.isRefetching,isSuccess:s.isSuccess,refetch:s.refetch,status:s.status}}function ut(e){let t=r(n=>n.signingClient),s=Q(["USE_SIGNING_CLIENT",e,t],({queryKey:[,n,i]})=>n!=null&&n.rpc?l(n):i,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:s.data,error:s.error,isFetching:s.isFetching,isLoading:s.isLoading,isRefetching:s.isRefetching,isSuccess:s.isSuccess,refetch:s.refetch,status:s.status}}import{QueryClient as Pe,QueryClientProvider as Be}from"@tanstack/react-query";import{useEffect as Te}from"react";function V(){return Te(()=>{r.setState({_supported:typeof window.keplr<"u"});let{_reconnect:e}=r.getState();return e&&m(),window.addEventListener("keplr_keystorechange",m),()=>{window.removeEventListener("keplr_keystorechange",m)}},[]),null}var Ne=new Pe({});function wt({children:e}){return c.createElement(Be,{key:Re,client:Ne},c.createElement(V,null),e)}var Re="graz-query-client";export{Re as GRAZ_PROVIDER_COMPONENT_KEY,wt as GrazProvider,M as clearRecentChain,sn as configureDefaultChain,p as connect,u as createClient,l as createSigningClient,Un as defineChains,z as disconnect,O as getBalances,g as getKeplr,cn as getRecentChain,qn as mainnetChains,Kn as mainnetChainsArray,m as reconnect,Qe as registerKeplrNotFound,y as suggestChain,U as suggestChainAndConnect,Tn as testnetChains,Pn as testnetChainsArray,Ve as unregisterKeplrNotFound,Ke as useAccount,tt as useActiveChain,Jn as useBalances,h as useCheckKeplr,pt as useClient,Qn as useConnect,Vn as useDisconnect,ot as useRecentChain,Xn as useSigners,ut as useSigningClient,it as useSuggestChain,rt as useSuggestChainAndConnect};
1
+ import{a as c}from"./chunk-L7O257ZE.mjs";import{GasPrice as ce}from"@cosmjs/stargate";import oe from"zustand";import{persist as ie,subscribeWithSelector as re}from"zustand/middleware";var C={account:null,activeChain:null,balances:null,client:null,defaultChain:null,offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClient:null,status:"disconnected",_notFoundFn:()=>null,_reconnect:!1,_supported:!1},se={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},r=oe(re(ie(()=>C,se)));import{SigningCosmWasmClient as G}from"@cosmjs/cosmwasm-stargate";async function u({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}};return await G.connect(o)}async function l(e){let{rpc:t,rpcHeaders:o,offlineSigner:s,signerOptions:n={}}=e,i={url:t,headers:{...o||{}}};return await G.connectWithSigner(i,s,n)}function g(){if(typeof window.keplr<"u")return window.keplr;throw r.getState()._notFoundFn(),new Error("Keplr is not defined")}function z(e){r.setState({_notFoundFn:e})}function Xe(){r.setState({_notFoundFn:()=>null})}async function p(e){try{let t=g(),{defaultChain:o,recentChain:s}=r.getState(),n=e||s||o;if(!n)throw new Error("No last known connected chain, connect action requires chain info");r.setState(f=>{let te=f._reconnect;return f.activeChain&&f.activeChain.chainId!==n.chainId?{status:"connecting"}:te?{status:"reconnecting"}:{status:"connecting"}}),await t.enable(n.chainId);let i=t.getOfflineSigner(n.chainId),a=t.getOfflineSignerOnlyAmino(n.chainId),Y=n.gas?ce.fromString(`${n.gas.price}${n.gas.denom}`):void 0,[j,Z,ee,ne]=await Promise.all([t.getKey(n.chainId),u(n),t.getOfflineSignerAuto(n.chainId),l({...n,offlineSigner:i,signerOptions:{gasPrice:Y,...(e==null?void 0:e.signerOpts)||{}}})]);return r.setState({account:j,activeChain:n,client:Z,offlineSigner:i,offlineSignerAmino:a,offlineSignerAuto:ee,recentChain:n,signingClient:ne,status:"connected",_reconnect:!0}),j}catch(t){throw r.getState().account===null&&r.setState({status:"disconnected"}),t}}async function O(e=!1){return r.setState(t=>({...C,recentChain:e?null:t.recentChain,_supported:t._supported})),Promise.resolve()}async function M(e){let{activeChain:t,signingClient:o}=r.getState();if(!t||!o)throw new Error("No connected account detected");return await Promise.all(t.currencies.map(async n=>o.getBalance(e,n.coinMinimalDenom)))}function m(){let{activeChain:e}=r.getState();e&&p(e)}function K(e){return r.setState({defaultChain:e}),e}function cn(){return r.getState().recentChain}function U(){r.setState({recentChain:null})}async function y(e){return await g().experimentalSuggestChain(e),e}async function q(e){let t=await y(e);return{account:await p(e),chain:t}}function un(e={}){let{defaultChain:t,onKeplrNotFound:o}=e;return t&&K(t),o&&z(o),e}import{Bech32Address as ae}from"@keplr-wallet/cosmos";var N={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},me={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},pe={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},ue={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},le={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},ge={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},T=[N,me,pe,ue,le,ge],d={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:N,bip44:{coinType:118},bech32Config:ae.defaultBech32Config("axelar"),currencies:T,feeCurrencies:T};import{Bech32Address as he}from"@keplr-wallet/cosmos";var B={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},P=[B],w={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:B,bip44:{coinType:118},bech32Config:he.defaultBech32Config("cosmos"),currencies:P,feeCurrencies:P};import{Bech32Address as fe}from"@keplr-wallet/cosmos";var E={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},R=[E],A={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.defaultBech32Config("CRE"),currencies:R,feeCurrencies:R,stakeCurrency:E,coinType:118};import{Bech32Address as Ce}from"@keplr-wallet/cosmos";var F={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},ye={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},de={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},we={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Ae={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Se={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},xe={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},ke={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Ie={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},De={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},ve={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},_=[F,ye,de,we,Ae,Se,xe,ke,Ie,De,ve],S={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:F,bip44:{coinType:118},bech32Config:Ce.defaultBech32Config("juno"),currencies:_,feeCurrencies:_};import{Bech32Address as be}from"@keplr-wallet/cosmos";var x={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},je=[x],k={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:x,bip44:{coinType:118},bech32Config:be.defaultBech32Config("juno"),currencies:je,feeCurrencies:[x],coinType:118};import{Bech32Address as Ge}from"@keplr-wallet/cosmos";var L={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},ze={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},W=[L,ze],I={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:L,bip44:{coinType:118},bech32Config:Ge.defaultBech32Config("osmo"),currencies:W,feeCurrencies:W};import{Bech32Address as Oe}from"@keplr-wallet/cosmos";var D={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Me=[D],v={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:D,bip44:{coinType:118},bech32Config:Oe.defaultBech32Config("osmo"),currencies:Me,feeCurrencies:[D],coinType:118};import{Bech32Address as Ke}from"@keplr-wallet/cosmos";var J={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},H=[J],b={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:J,bip44:{coinType:118},bech32Config:Ke.defaultBech32Config("somm"),currencies:H,feeCurrencies:H};function Nn(e){return e}var Pn={axelar:d,cosmos:w,juno:S,osmosis:I,sommelier:b},Bn=[d,w,S,I,b],Rn={crescent:A,juno:k,osmosis:v},En=[A,k,v];import{useMutation as Q,useQuery as Ue}from"@tanstack/react-query";import{useEffect as qe}from"react";import Te from"zustand/shallow";function h(){return r(e=>e._supported)}function Ne({onConnect:e,onDisconnect:t}={}){let o=r(n=>n.account),s=r(n=>n.status);return qe(()=>r.subscribe(n=>n.status,(n,i)=>{if(n==="connected"){let a=r.getState();e==null||e({account:a.account,isReconnect:i==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:s==="connecting",isDisconnected:s==="disconnected",isReconnecting:s==="reconnecting",reconnect:m,status:s}}function $n(e){let{data:t}=Ne(),o=e||(t==null?void 0:t.bech32Address),n=Ue(["USE_BALANCES",o],({queryKey:[,i]})=>M(i),{enabled:Boolean(o)});return{data:n.data,error:n.error,isFetching:n.isFetching,isLoading:n.isLoading,isRefetching:n.isRefetching,isSuccess:n.isSuccess,refetch:n.refetch,status:n.status}}function Yn({onError:e,onLoading:t,onSuccess:o}={}){let n=Q(["USE_CONNECT",e,t,o],p,{onError:(i,a)=>Promise.resolve(e==null?void 0:e(i,a)),onMutate:t,onSuccess:i=>Promise.resolve(o==null?void 0:o(i))});return{connect:i=>n.mutate(i),connectAsync:i=>n.mutateAsync(i),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:h(),status:n.status}}function Zn({onError:e,onLoading:t,onSuccess:o}={}){let n=Q(["USE_DISCONNECT",e,t,o],O,{onError:i=>Promise.resolve(e==null?void 0:e(i,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:i=>n.mutate(i),disconnectAsync:i=>n.mutateAsync(i),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function et(){return r(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Te)}import{useMutation as V}from"@tanstack/react-query";function st(){return r(e=>e.activeChain)}function ct(){return{data:r(t=>t.recentChain),clear:U}}function at({onError:e,onLoading:t,onSuccess:o}={}){let n=V(["USE_SUGGEST_CHAIN",e,t,o],y,{onError:(i,a)=>Promise.resolve(e==null?void 0:e(i,a)),onMutate:t,onSuccess:i=>Promise.resolve(o==null?void 0:o(i))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function mt({onError:e,onLoading:t,onSuccess:o}={}){let n=V(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],q,{onError:(i,a)=>Promise.resolve(e==null?void 0:e(i,a)),onMutate:t,onSuccess:i=>Promise.resolve(o==null?void 0:o(i))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:h(),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}import{useQuery as X}from"@tanstack/react-query";function ht(e){let t=r(n=>n.client),s=X(["USE_CLIENT",e,t],({queryKey:[,n,i]})=>n!=null&&n.rpc?u(n):i,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:s.data,error:s.error,isFetching:s.isFetching,isLoading:s.isLoading,isRefetching:s.isRefetching,isSuccess:s.isSuccess,refetch:s.refetch,status:s.status}}function ft(e){let t=r(n=>n.signingClient),s=X(["USE_SIGNING_CLIENT",e,t],({queryKey:[,n,i]})=>n!=null&&n.rpc?l(n):i,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:s.data,error:s.error,isFetching:s.isFetching,isLoading:s.isLoading,isRefetching:s.isRefetching,isSuccess:s.isSuccess,refetch:s.refetch,status:s.status}}import{QueryClient as Be,QueryClientProvider as Re}from"@tanstack/react-query";import{useEffect as Pe}from"react";function $(){return Pe(()=>{r.setState({_supported:typeof window.keplr<"u"});let{_reconnect:e}=r.getState();return e&&m(),window.addEventListener("keplr_keystorechange",m),()=>{window.removeEventListener("keplr_keystorechange",m)}},[]),null}var Ee=new Be({});function kt({children:e}){return c.createElement(Re,{key:_e,client:Ee},c.createElement($,null),e)}var _e="graz-query-client";export{_e as GRAZ_PROVIDER_COMPONENT_KEY,kt as GrazProvider,U as clearRecentChain,K as configureDefaultChain,un as configureGraz,p as connect,u as createClient,l as createSigningClient,Nn as defineChains,O as disconnect,M as getBalances,g as getKeplr,cn as getRecentChain,Pn as mainnetChains,Bn as mainnetChainsArray,m as reconnect,z as registerKeplrNotFound,y as suggestChain,q as suggestChainAndConnect,Rn as testnetChains,En as testnetChainsArray,Xe as unregisterKeplrNotFound,Ne as useAccount,st as useActiveChain,$n as useBalances,h as useCheckKeplr,ht as useClient,Yn as useConnect,Zn as useDisconnect,ct as useRecentChain,et as useSigners,ft as useSigningClient,at as useSuggestChain,mt as useSuggestChainAndConnect};
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.10",
4
+ "version": "0.0.11",
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",
@@ -21,11 +21,11 @@
21
21
  "dev": "tsup --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@cosmjs/cosmwasm-stargate": "^0.28.10",
25
- "@cosmjs/proto-signing": "^0.28.10",
26
- "@cosmjs/stargate": "^0.28.10",
27
- "@keplr-wallet/cosmos": "^0.10.10",
28
- "@keplr-wallet/types": "^0.10.10",
24
+ "@cosmjs/cosmwasm-stargate": "^0.28.11",
25
+ "@cosmjs/proto-signing": "^0.28.11",
26
+ "@cosmjs/stargate": "^0.28.11",
27
+ "@keplr-wallet/cosmos": "^0.10.13",
28
+ "@keplr-wallet/types": "^0.10.13",
29
29
  "@tanstack/react-query": "^4.0.10",
30
30
  "zustand": "^4.0.0-rc.4"
31
31
  },