graz 0.0.2 → 0.0.3
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 +12 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,14 @@ interface MutationEventArgs<TInitial = unknown, TSuccess = TInitial> {
|
|
|
27
27
|
onSuccess?: (data: TSuccess) => unknown;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
interface UseAccountArgs {
|
|
31
|
+
onConnect?: (args: {
|
|
32
|
+
account: Key;
|
|
33
|
+
isReconnect: boolean;
|
|
34
|
+
}) => void;
|
|
35
|
+
onDisconnect?: () => void;
|
|
36
|
+
}
|
|
37
|
+
declare function useAccount({ onConnect, onDisconnect }?: UseAccountArgs): {
|
|
31
38
|
data: Key | null;
|
|
32
39
|
isConnected: boolean;
|
|
33
40
|
isConnecting: boolean;
|
|
@@ -52,6 +59,7 @@ declare function useConnect({ onError, onLoading, onSuccess }?: UseConnectChainA
|
|
|
52
59
|
error: unknown;
|
|
53
60
|
isLoading: boolean;
|
|
54
61
|
isSuccess: boolean;
|
|
62
|
+
isSupported: boolean;
|
|
55
63
|
connect: react_query.UseMutateFunction<Key, unknown, GrazChain, unknown>;
|
|
56
64
|
connectAsync: react_query.UseMutateAsyncFunction<Key, unknown, GrazChain, unknown>;
|
|
57
65
|
status: "idle" | "error" | "loading" | "success";
|
|
@@ -81,10 +89,12 @@ declare function useSuggestChain({ onError, onLoading, onSuccess }?: UseSuggestC
|
|
|
81
89
|
status: "idle" | "error" | "loading" | "success";
|
|
82
90
|
};
|
|
83
91
|
|
|
92
|
+
declare function useCheckKeplr(): boolean;
|
|
93
|
+
|
|
84
94
|
declare function getKeplr(): _keplr_wallet_types.Keplr;
|
|
85
95
|
|
|
86
96
|
declare function GrazProvider({ children }: {
|
|
87
97
|
children: ReactNode;
|
|
88
98
|
}): JSX.Element;
|
|
89
99
|
|
|
90
|
-
export { GrazChain, GrazProvider, UseConnectChainArgs, UseSuggestChainArgs, defaultChains, defineChains, getKeplr, useAccount, useActiveChain, useBalances, useConnect, useCosmWasmClient, useDisconnect, useSigners, useSuggestChain };
|
|
100
|
+
export { GrazChain, GrazProvider, UseAccountArgs, UseConnectChainArgs, UseSuggestChainArgs, defaultChains, defineChains, getKeplr, useAccount, useActiveChain, useBalances, useCheckKeplr, useConnect, useCosmWasmClient, useDisconnect, useSigners, useSuggestChain };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var R=Object.create;var l=Object.defineProperty;var
|
|
1
|
+
"use strict";var R=Object.create;var l=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var o in t)l(e,o,{get:t[o],enumerable:!0})},w=(e,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of H(t))!J.call(e,n)&&n!==o&&l(e,n,{get:()=>t[n],enumerable:!(c=F(t,n))||c.enumerable});return e};var f=(e,t,o)=>(o=e!=null?R(Q(e)):{},w(t||!e||!e.__esModule?l(o,"default",{value:e,enumerable:!0}):o,e)),X=e=>w(l({},"__esModule",{value:!0}),e);var we={};V(we,{GrazProvider:()=>Ce,defaultChains:()=>me,defineChains:()=>ae,getKeplr:()=>u,useAccount:()=>N,useActiveChain:()=>fe,useBalances:()=>ue,useCheckKeplr:()=>C,useConnect:()=>le,useCosmWasmClient:()=>pe,useDisconnect:()=>ge,useSigners:()=>he,useSuggestChain:()=>ye});module.exports=X(we);var s=f(require("react"));var k=require("@keplr-wallet/cosmos"),S={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},A=[S],v={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:S,bip44:{coinType:118},bech32Config:k.Bech32Address.defaultBech32Config("cosmos"),currencies:A,feeCurrencies:A};var j=require("@keplr-wallet/cosmos"),b={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Y={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Z={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},$={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"},ne={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},te={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},oe={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},re={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},ie={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},se={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},x=[b,Y,Z,$,ee,ne,te,oe,re,ie,se],D={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:b,bip44:{coinType:118},bech32Config:j.Bech32Address.defaultBech32Config("juno"),currencies:x,feeCurrencies:x};var I=require("@keplr-wallet/cosmos"),G={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},ce={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},z=[G,ce],q={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:G,bip44:{coinType:118},bech32Config:I.Bech32Address.defaultBech32Config("osmo"),currencies:z,feeCurrencies:z};function ae(e){return e}var me={cosmos:v,juno:D,osmosis:q};var K=require("react"),p=require("react-query"),E=f(require("zustand/shallow"));var U=require("@cosmjs/cosmwasm-stargate");var M=f(require("zustand")),g=require("zustand/middleware"),y={account:null,activeChain:null,balances:null,client:null,signer:null,signerAmino:null,signerAuto:null,status:"disconnected",_notFoundFn:()=>null,_reconnect:!1,_supported:!1},r=(0,M.default)((0,g.subscribeWithSelector)((0,g.persist)(()=>({...y}),{name:"graz",partialize:e=>({activeChain:e.activeChain,_reconnect:e._reconnect}),version:1})));function u(){if(typeof window.keplr<"u")return window.keplr;throw r.getState()._notFoundFn(),new Error("Keplr is not defined")}async function d(e){try{let t=u();r.setState(W=>({status:W._reconnect?"reconnecting":"connecting"})),await t.enable(e.chainId);let o=t.getOfflineSigner(e.chainId),c=t.getOfflineSignerOnlyAmino(e.chainId),[n,i,a]=await Promise.all([await t.getKey(e.chainId),await t.getOfflineSignerAuto(e.chainId),await U.SigningCosmWasmClient.connectWithSigner(e.rpc,o)]);return r.setState({account:n,activeChain:e,client:a,signer:o,signerAuto:i,signerAmino:c,status:"connected",_reconnect:!0}),n}catch(t){throw r.getState().account===null&&r.setState({status:"disconnected"}),t}}async function _(){return r.setState({...y}),Promise.resolve()}async function O(e){let{activeChain:t,client: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&&d(e)}function C(){return r(e=>e._supported)}function N({onConnect:e,onDisconnect:t}={}){let o=r(n=>n.account),c=r(n=>n.status);return(0,K.useEffect)(()=>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:c==="connected",isConnecting:c==="connecting",isDisconnected:c==="disconnected",isReconnecting:c==="reconnecting",reconnect:m,status:c}}function ue(e){var i;let t=N(),o=e||((i=t.data)==null?void 0:i.bech32Address),n=(0,p.useQuery)(["WADESTA_USE_BALANCES",o],({queryKey:[,a]})=>O(a),{enabled:Boolean(o)});return{data:n.data,error:n.error,isLoading:n.isLoading,isFetching:n.isFetching,isRefetching:n.isRefetching,isSuccess:n.isSuccess,refetch:n.refetch,status:n.status}}function pe(){return r(e=>e.client)}function le({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,p.useMutation)(["WADESTA_USE_CONNECT",e,t,o],d,{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:C(),connect:n.mutate,connectAsync:n.mutateAsync,status:n.status}}function ge({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,p.useMutation)(["WADESTA_USE_DISCONNECT",e,t,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{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,disconnect:n.mutate,disconnectAsync:n.mutateAsync,status:n.status}}function he(){return r(e=>({signer:e.signer,signerAmino:e.signerAmino,signerAuto:e.signerAuto}),E.default)}var B=require("react-query");async function T(e){return await u().experimentalSuggestChain(e),e}function fe(){return r(e=>e.activeChain)}function ye({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,B.useMutation)(["WADESTA_USE_SUGGEST_CHAIN",e,t,o],T,{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}}var h=require("react-query");var P=require("react");function L(){return(0,P.useEffect)(()=>{r.setState({_supported:typeof window.keplr<"u"});let{_reconnect:e}=r.getState();return e&&m(),window.addEventListener("focus",m),window.addEventListener("keplr_keystorechange",m),()=>{window.removeEventListener("focus",m),window.removeEventListener("keplr_keystorechange",m)}},[]),null}var de=new h.QueryClient({defaultOptions:{queries:{notifyOnChangeProps:"tracked"}}});function Ce({children:e}){return s.createElement(h.QueryClientProvider,{key:"graz-query-client",client:de},s.createElement(L,null),e)}0&&(module.exports={GrazProvider,defaultChains,defineChains,getKeplr,useAccount,useActiveChain,useBalances,useCheckKeplr,useConnect,useCosmWasmClient,useDisconnect,useSigners,useSuggestChain});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as s from"react";import{Bech32Address as I}from"@keplr-wallet/cosmos";var h={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},g=[h],f={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:h,bip44:{coinType:118},bech32Config:I.defaultBech32Config("cosmos"),currencies:g,feeCurrencies:g};import{Bech32Address as G}from"@keplr-wallet/cosmos";var d={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},q={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},M={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},U={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},_={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},O={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},K={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},E={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},N={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},T={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},B={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},y=[d,q,M,U,_,O,K,E,N,T,B],C={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:d,bip44:{coinType:118},bech32Config:G.defaultBech32Config("juno"),currencies:y,feeCurrencies:y};import{Bech32Address as P}from"@keplr-wallet/cosmos";var A={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},L={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},w=[A,L],k={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:A,bip44:{coinType:118},bech32Config:P.defaultBech32Config("osmo"),currencies:w,feeCurrencies:w};function le(e){return e}var ge={cosmos:f,juno:C,osmosis:k};import{useEffect as Q}from"react";import{useMutation as j,useQuery as J}from"react-query";import V from"zustand/shallow";import{SigningCosmWasmClient as H}from"@cosmjs/cosmwasm-stargate";import W from"zustand";import{persist as R,subscribeWithSelector as F}from"zustand/middleware";var p={account:null,activeChain:null,balances:null,client:null,signer:null,signerAmino:null,signerAuto:null,status:"disconnected",_notFoundFn:()=>null,_reconnect:!1,_supported:!1},r=W(F(R(()=>({...p}),{name:"graz",partialize:e=>({activeChain:e.activeChain,_reconnect:e._reconnect}),version:1})));function u(){if(typeof window.keplr<"u")return window.keplr;throw r.getState()._notFoundFn(),new Error("Keplr is not defined")}async function l(e){try{let t=u();r.setState(z=>({status:z._reconnect?"reconnecting":"connecting"})),await t.enable(e.chainId);let o=t.getOfflineSigner(e.chainId),c=t.getOfflineSignerOnlyAmino(e.chainId),[n,i,a]=await Promise.all([await t.getKey(e.chainId),await t.getOfflineSignerAuto(e.chainId),await H.connectWithSigner(e.rpc,o)]);return r.setState({account:n,activeChain:e,client:a,signer:o,signerAuto:i,signerAmino:c,status:"connected",_reconnect:!0}),n}catch(t){throw r.getState().account===null&&r.setState({status:"disconnected"}),t}}async function S(){return r.setState({...p}),Promise.resolve()}async function v(e){let{activeChain:t,client: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&&l(e)}function x(){return r(e=>e._supported)}function X({onConnect:e,onDisconnect:t}={}){let o=r(n=>n.account),c=r(n=>n.status);return Q(()=>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:c==="connected",isConnecting:c==="connecting",isDisconnected:c==="disconnected",isReconnecting:c==="reconnecting",reconnect:m,status:c}}function Me(e){var i;let t=X(),o=e||((i=t.data)==null?void 0:i.bech32Address),n=J(["WADESTA_USE_BALANCES",o],({queryKey:[,a]})=>v(a),{enabled:Boolean(o)});return{data:n.data,error:n.error,isLoading:n.isLoading,isFetching:n.isFetching,isRefetching:n.isRefetching,isSuccess:n.isSuccess,refetch:n.refetch,status:n.status}}function Ue(){return r(e=>e.client)}function _e({onError:e,onLoading:t,onSuccess:o}={}){let n=j(["WADESTA_USE_CONNECT",e,t,o],l,{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:x(),connect:n.mutate,connectAsync:n.mutateAsync,status:n.status}}function Oe({onError:e,onLoading:t,onSuccess:o}={}){let n=j(["WADESTA_USE_DISCONNECT",e,t,o],S,{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{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,disconnect:n.mutate,disconnectAsync:n.mutateAsync,status:n.status}}function Ke(){return r(e=>({signer:e.signer,signerAmino:e.signerAmino,signerAuto:e.signerAuto}),V)}import{useMutation as Y}from"react-query";async function b(e){return await u().experimentalSuggestChain(e),e}function We(){return r(e=>e.activeChain)}function Re({onError:e,onLoading:t,onSuccess:o}={}){let n=Y(["WADESTA_USE_SUGGEST_CHAIN",e,t,o],b,{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}}import{QueryClient as $,QueryClientProvider as ee}from"react-query";import{useEffect as Z}from"react";function D(){return Z(()=>{r.setState({_supported:typeof window.keplr<"u"});let{_reconnect:e}=r.getState();return e&&m(),window.addEventListener("focus",m),window.addEventListener("keplr_keystorechange",m),()=>{window.removeEventListener("focus",m),window.removeEventListener("keplr_keystorechange",m)}},[]),null}var ne=new $({defaultOptions:{queries:{notifyOnChangeProps:"tracked"}}});function Ze({children:e}){return s.createElement(ee,{key:"graz-query-client",client:ne},s.createElement(D,null),e)}export{Ze as GrazProvider,ge as defaultChains,le as defineChains,u as getKeplr,X as useAccount,We as useActiveChain,Me as useBalances,x as useCheckKeplr,_e as useConnect,Ue as useCosmWasmClient,Oe as useDisconnect,Ke as useSigners,Re as useSuggestChain};
|
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.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"author": "Griko Nibras <griko@stranvgelove.ventures>",
|
|
6
6
|
"repository": "https://github.com/strangelove-ventures/graz.git",
|
|
7
7
|
"homepage": "https://github.com/strangelove-ventures/graz",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsup",
|
|
21
|
-
"dev": "tsup --watch"
|
|
22
|
-
"prepublish": "yarn build"
|
|
21
|
+
"dev": "tsup --watch"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
25
24
|
"@cosmjs/cosmwasm-stargate": "^0.28.10",
|