graz 0.0.26 → 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/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 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,getBalances:()=>W,getKeplr:()=>ue,getLeap:()=>pe,getRecentChain:()=>Ze,getStakedBalances:()=>M,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,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,useStakedBalances:()=>Bt,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_STAKED_BALANCES",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,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{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_STAKED_BALANCES",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,L as getBalances,we as getKeplr,De as getLeap,Pt as getRecentChain,V as getStakedBalances,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,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,Mn as useStakedBalances,$n as useSuggestChain,Xn 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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "graz",
3
3
  "description": "React hooks for Cosmos",
4
- "version": "0.0.26",
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",