graz 0.0.28 → 0.0.30
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 +175 -17
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { BondStatusString } from '@cosmjs/stargate/build/modules/staking/queries
|
|
|
12
12
|
import { QueryValidatorsResponse } from 'cosmjs-types/cosmos/staking/v1beta1/query';
|
|
13
13
|
import { FC } from 'react';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
type Dictionary<T = string> = Record<string, T>;
|
|
16
|
+
type Maybe<T> = T | undefined;
|
|
17
17
|
|
|
18
18
|
interface ChainInfoWithPath extends ChainInfo {
|
|
19
19
|
path: string;
|
|
@@ -151,7 +151,7 @@ declare enum WalletType {
|
|
|
151
151
|
}
|
|
152
152
|
declare const WALLET_TYPES: WalletType[];
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
type ConnectArgs = Maybe<GrazChain & {
|
|
155
155
|
signerOpts?: SigningCosmWasmClientOptions;
|
|
156
156
|
walletType?: WalletType;
|
|
157
157
|
}>;
|
|
@@ -159,7 +159,7 @@ declare const connect: (args?: ConnectArgs) => Promise<Key>;
|
|
|
159
159
|
declare const disconnect: (clearRecentChain?: boolean) => Promise<void>;
|
|
160
160
|
declare const reconnect: () => void;
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
type ExtensionSetup<P extends object = object> = (queryClient: QueryClient) => P;
|
|
163
163
|
|
|
164
164
|
interface CreateQueryClient {
|
|
165
165
|
(): QueryClient;
|
|
@@ -224,9 +224,9 @@ interface GrazStore {
|
|
|
224
224
|
_reconnect: boolean;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
type CreateClientArgs = Pick<GrazChain, "rpc" | "rpcHeaders">;
|
|
228
228
|
declare const createClients: ({ rpc, rpcHeaders }: CreateClientArgs) => Promise<GrazStore["clients"]>;
|
|
229
|
-
|
|
229
|
+
type CreateSigningClientArgs = CreateClientArgs & {
|
|
230
230
|
offlineSignerAuto: OfflineSigner | OfflineDirectSigner;
|
|
231
231
|
cosmWasmSignerOptions?: SigningCosmWasmClientOptions;
|
|
232
232
|
stargateSignerOptions?: SigningStargateClientOptions;
|
|
@@ -241,6 +241,37 @@ interface ConfigureGrazArgs {
|
|
|
241
241
|
}
|
|
242
242
|
declare const configureGraz: (args?: ConfigureGrazArgs) => ConfigureGrazArgs;
|
|
243
243
|
|
|
244
|
+
interface AddressToIbcDomainReturnValue {
|
|
245
|
+
domain: string;
|
|
246
|
+
domainFull: string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @see https://docs.ibc.domains/convert_address.html#relevant-bech32-prefixes
|
|
250
|
+
*/
|
|
251
|
+
type KnownChainPrefix = "agoric" | "chihuahua" | "gravity" | "lum" | "sent" | "akash" | "comdex" | "iaa" | "micro" | "sif" | "axelar" | "cosmos" | "inj" | "osmo" | "somm" | "bcna" | "cro" | "ixo" | "panacea" | "star" | "bitsong" | "desmos" | "juno" | "persistence" | "stars" | "bostrom" | "dig" | "ki" | "regen" | "terra" | "certik" | "emoney" | "kujira" | "rebus" | "umee" | "cheqd" | "evmos" | "like" | "secret" | "vdl";
|
|
252
|
+
type ChainPrefix = (string & {}) | KnownChainPrefix;
|
|
253
|
+
interface DomainDetails {
|
|
254
|
+
expiration: string | null;
|
|
255
|
+
imageData: string | null;
|
|
256
|
+
twitterId: string | null;
|
|
257
|
+
discordId: string | null;
|
|
258
|
+
telegramId: string | null;
|
|
259
|
+
keybaseId: string | null;
|
|
260
|
+
pgpPublicKey: string | null;
|
|
261
|
+
}
|
|
262
|
+
declare const isIbcDomainPostfix: (value: string) => boolean;
|
|
263
|
+
declare const validateAddress: (address: string, prefix: ChainPrefix) => boolean;
|
|
264
|
+
declare const getIbcDomainByAdress: (address: string, isTestnet?: boolean) => Promise<AddressToIbcDomainReturnValue | null>;
|
|
265
|
+
declare const getAddressesByIbcDomain: (ibcDomain: string, isTestnet?: boolean) => Promise<string[] | null>;
|
|
266
|
+
declare const getChainAddressByIbcDomain: (ibcDomain: string, prefix: ChainPrefix, isTestnet?: boolean) => Promise<string | null>;
|
|
267
|
+
declare const getIbcDomainDetails: (ibcDomain: string, isTestnet?: boolean) => Promise<DomainDetails | null>;
|
|
268
|
+
interface ResolveToChainAddressArgs {
|
|
269
|
+
value: string;
|
|
270
|
+
prefix: ChainPrefix;
|
|
271
|
+
isTestnet?: boolean;
|
|
272
|
+
}
|
|
273
|
+
declare const resolveToChainAddress: ({ value, prefix, isTestnet }: ResolveToChainAddressArgs) => Promise<string>;
|
|
274
|
+
|
|
244
275
|
declare const getBalances: (bech32Address: string) => Promise<Coin[]>;
|
|
245
276
|
declare const getBalanceStaked: (bech32Address: string) => Promise<Coin | null>;
|
|
246
277
|
interface SendTokensArgs {
|
|
@@ -271,7 +302,7 @@ interface InstantiateContractArgs<Message extends Record<string, unknown>> {
|
|
|
271
302
|
senderAddress: string;
|
|
272
303
|
codeId: number;
|
|
273
304
|
}
|
|
274
|
-
|
|
305
|
+
type InstantiateContractMutationArgs<Message extends Record<string, unknown>> = Omit<InstantiateContractArgs<Message>, "codeId" | "senderAddress" | "fee"> & {
|
|
275
306
|
fee?: StdFee | "auto" | number;
|
|
276
307
|
};
|
|
277
308
|
declare const instantiateContract: <Message extends Record<string, unknown>>({ senderAddress, msg, fee, options, label, codeId, }: InstantiateContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
@@ -281,7 +312,7 @@ interface ExecuteContractArgs<Message extends Record<string, unknown>> {
|
|
|
281
312
|
senderAddress: string;
|
|
282
313
|
contractAddress: string;
|
|
283
314
|
}
|
|
284
|
-
|
|
315
|
+
type ExecuteContractMutationArgs<Message extends Record<string, unknown>> = Omit<ExecuteContractArgs<Message>, "contractAddress" | "senderAddress" | "fee"> & {
|
|
285
316
|
fee?: StdFee | "auto" | number;
|
|
286
317
|
};
|
|
287
318
|
declare const executeContract: <Message extends Record<string, unknown>>({ senderAddress, msg, fee, contractAddress, }: ExecuteContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.ExecuteResult>;
|
|
@@ -423,7 +454,7 @@ declare const useBalances: (bech32Address?: string) => UseQueryResult<Coin[]>;
|
|
|
423
454
|
* ```
|
|
424
455
|
*/
|
|
425
456
|
declare const useBalance: (denom: string, bech32Address?: string) => UseQueryResult<Coin | undefined>;
|
|
426
|
-
|
|
457
|
+
type UseConnectChainArgs = MutationEventArgs<ConnectArgs, Key>;
|
|
427
458
|
/**
|
|
428
459
|
* graz mutation hook to execute wallet connection with optional arguments to
|
|
429
460
|
* invoke given functions on error, loading, or success event.
|
|
@@ -600,7 +631,7 @@ declare const useRecentChain: () => {
|
|
|
600
631
|
data: GrazChain | null;
|
|
601
632
|
clear: () => void;
|
|
602
633
|
};
|
|
603
|
-
|
|
634
|
+
type UseSuggestChainArgs = MutationEventArgs<ChainInfo>;
|
|
604
635
|
/**
|
|
605
636
|
* graz mutation hook to suggest chain to a Wallet
|
|
606
637
|
*
|
|
@@ -625,7 +656,7 @@ declare const useSuggestChain: ({ onError, onLoading, onSuccess }?: UseSuggestCh
|
|
|
625
656
|
suggestAsync: _tanstack_react_query.UseMutateAsyncFunction<ChainInfo, unknown, ChainInfo, unknown>;
|
|
626
657
|
status: "error" | "idle" | "loading" | "success";
|
|
627
658
|
};
|
|
628
|
-
|
|
659
|
+
type UseSuggestChainAndConnectArgs = MutationEventArgs<SuggestChainAndConnectArgs, {
|
|
629
660
|
chain: ChainInfo;
|
|
630
661
|
account: Key;
|
|
631
662
|
}>;
|
|
@@ -746,6 +777,128 @@ declare const useClients: (args?: CreateClientArgs) => UseQueryResult<GrazStore[
|
|
|
746
777
|
*/
|
|
747
778
|
declare const useSigningClients: (args?: CreateSigningClientArgs) => UseQueryResult<GrazStore["signingClients"]>;
|
|
748
779
|
|
|
780
|
+
/**
|
|
781
|
+
* graz query hook to retrieve an ibc domain from given address.
|
|
782
|
+
*
|
|
783
|
+
* @param address - Optional, if address undefined this hook won't run
|
|
784
|
+
* @param isTestnet - Optional for pointing to testnet
|
|
785
|
+
*
|
|
786
|
+
* @example
|
|
787
|
+
* ```ts
|
|
788
|
+
* import { useAddressToIbcDomain } from "graz";
|
|
789
|
+
*
|
|
790
|
+
* // basic example
|
|
791
|
+
* const { data, isFetching, refetch, ... } = useAddressToIbcDomain({
|
|
792
|
+
* address: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430",
|
|
793
|
+
* });
|
|
794
|
+
*
|
|
795
|
+
* ```
|
|
796
|
+
*/
|
|
797
|
+
declare const useAddressToIbcDomain: ({ address, isTestnet, }: {
|
|
798
|
+
address?: string | undefined;
|
|
799
|
+
isTestnet?: boolean | undefined;
|
|
800
|
+
}) => UseQueryResult<AddressToIbcDomainReturnValue | null>;
|
|
801
|
+
/**
|
|
802
|
+
* graz query hook to retrieve an addresses from given ibc domain.
|
|
803
|
+
*
|
|
804
|
+
* @param ibcDomain - Optional ibc domain, if ibc domain undefined this hook won't run
|
|
805
|
+
* @param isTestnet - Optional for pointing to testnet
|
|
806
|
+
*
|
|
807
|
+
* @example
|
|
808
|
+
* ```ts
|
|
809
|
+
* import { useIbcDomainToAddresses } from "graz";
|
|
810
|
+
*
|
|
811
|
+
* // basic example
|
|
812
|
+
* const { data, isFetching, refetch, ... } = useIbcDomainToAddresses({
|
|
813
|
+
* ibcDomain: "kikiding.cosmos",
|
|
814
|
+
* });
|
|
815
|
+
*
|
|
816
|
+
* ```
|
|
817
|
+
*/
|
|
818
|
+
declare const useIbcDomainToAddresses: ({ ibcDomain, isTestnet, }: {
|
|
819
|
+
ibcDomain?: string | undefined;
|
|
820
|
+
isTestnet?: boolean | undefined;
|
|
821
|
+
}) => UseQueryResult<string[] | null>;
|
|
822
|
+
/**
|
|
823
|
+
* graz query hook to retrieve an address from given ibc domain and prefix.
|
|
824
|
+
*
|
|
825
|
+
* @param ibcDomain - Optional ibc domain, if ibc domain undefined this hook won't run
|
|
826
|
+
* @param prefix - Optional string or bech32 prefix of the destination chain, for instance "cosmos", "somm", etc
|
|
827
|
+
* @param isTestnet - Optional for pointing to testnet
|
|
828
|
+
*
|
|
829
|
+
* @example
|
|
830
|
+
* ```ts
|
|
831
|
+
* import { useIbcDomainToChainAddress } from "graz";
|
|
832
|
+
*
|
|
833
|
+
* // basic example
|
|
834
|
+
* const { data, isFetching, refetch, ... } = useIbcDomainToChainAddress({
|
|
835
|
+
* ibcDomain: "kikiding.cosmos",
|
|
836
|
+
* prefix: "osmo"
|
|
837
|
+
* });
|
|
838
|
+
*
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
841
|
+
declare const useIbcDomainToChainAddress: ({ ibcDomain, prefix, isTestnet, }: {
|
|
842
|
+
ibcDomain?: string | undefined;
|
|
843
|
+
prefix?: ChainPrefix | undefined;
|
|
844
|
+
isTestnet?: boolean | undefined;
|
|
845
|
+
}) => UseQueryResult<string | null>;
|
|
846
|
+
/**
|
|
847
|
+
* graz query hook to retrieve a ibc domain details from given ibc domain.
|
|
848
|
+
*
|
|
849
|
+
* @param ibcDomain - Optional ibc domain, if ibc domain undefined this hook won't run
|
|
850
|
+
* @param isTestnet - Optional for pointing to testnet
|
|
851
|
+
*
|
|
852
|
+
* @example
|
|
853
|
+
* ```ts
|
|
854
|
+
* import { useIbcDomainDetails } from "graz";
|
|
855
|
+
*
|
|
856
|
+
* // basic example
|
|
857
|
+
* const { data, isFetching, refetch, ... } = useIbcDomainDetails({
|
|
858
|
+
* ibcDomain: "kikiding.cosmos",
|
|
859
|
+
* });
|
|
860
|
+
*
|
|
861
|
+
* ```
|
|
862
|
+
*/
|
|
863
|
+
declare const useIbcDomainDetails: ({ ibcDomain, isTestnet }: {
|
|
864
|
+
ibcDomain?: string | undefined;
|
|
865
|
+
isTestnet?: boolean | undefined;
|
|
866
|
+
}) => UseQueryResult<DomainDetails | null, unknown>;
|
|
867
|
+
type UseResolveToChainAddressArgs = MutationEventArgs<ResolveToChainAddressArgs, string>;
|
|
868
|
+
/**
|
|
869
|
+
* graz mutation hook to resolve an Ibc domain or an address to bech32 address from given string
|
|
870
|
+
*
|
|
871
|
+
* @example
|
|
872
|
+
* ```ts
|
|
873
|
+
* import { useResolveToChainAddress } from "graz";
|
|
874
|
+
*
|
|
875
|
+
* // basic example
|
|
876
|
+
* const { resolveToChainAddress } = useResolveToChainAddress();
|
|
877
|
+
*
|
|
878
|
+
* // with event arguments
|
|
879
|
+
* useResolveToChainAddress({
|
|
880
|
+
* onError: (err, args) => { ... },
|
|
881
|
+
* onLoading: () => { ... },
|
|
882
|
+
* onSuccess: ({ account, address }) => { ... },
|
|
883
|
+
* });
|
|
884
|
+
*
|
|
885
|
+
* // resolveToChainAddress usage
|
|
886
|
+
* resolveToChainAddress({
|
|
887
|
+
* value: "kikiding.cosmos",
|
|
888
|
+
* prefix: "osmo"
|
|
889
|
+
* ...
|
|
890
|
+
* });
|
|
891
|
+
* ```
|
|
892
|
+
*/
|
|
893
|
+
declare const useResolveToChainAddress: ({ onError, onLoading, onSuccess }?: UseResolveToChainAddressArgs) => {
|
|
894
|
+
error: unknown;
|
|
895
|
+
isLoading: boolean;
|
|
896
|
+
isSuccess: boolean;
|
|
897
|
+
resolveToChainAddress: _tanstack_react_query.UseMutateFunction<string, unknown, ResolveToChainAddressArgs, unknown>;
|
|
898
|
+
resolveToChainAddressAsync: _tanstack_react_query.UseMutateAsyncFunction<string, unknown, ResolveToChainAddressArgs, unknown>;
|
|
899
|
+
status: "error" | "idle" | "loading" | "success";
|
|
900
|
+
};
|
|
901
|
+
|
|
749
902
|
/**
|
|
750
903
|
* graz mutation hook to send tokens. Note: if `senderAddress` undefined, it will use current connected account address.
|
|
751
904
|
*
|
|
@@ -799,7 +952,7 @@ declare const useSendIbcTokens: ({ onError, onLoading, onSuccess, }?: MutationEv
|
|
|
799
952
|
sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, unknown, SendIbcTokensArgs, unknown>;
|
|
800
953
|
status: "error" | "idle" | "loading" | "success";
|
|
801
954
|
};
|
|
802
|
-
|
|
955
|
+
type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
|
|
803
956
|
codeId: number;
|
|
804
957
|
} & MutationEventArgs<InstantiateContractMutationArgs<Message>, InstantiateResult>;
|
|
805
958
|
/**
|
|
@@ -815,7 +968,10 @@ declare type UseInstantiateContractArgs<Message extends Record<string, unknown>>
|
|
|
815
968
|
* })
|
|
816
969
|
*
|
|
817
970
|
* const instantiateMessage = { foo: 'bar' };
|
|
818
|
-
* instantiateMyContract(
|
|
971
|
+
* instantiateMyContract({
|
|
972
|
+
* msg: instatiateMessage,
|
|
973
|
+
* label: "test"
|
|
974
|
+
* });
|
|
819
975
|
* ```
|
|
820
976
|
*/
|
|
821
977
|
declare const useInstantiateContract: <Message extends Record<string, unknown>>({ codeId, onError, onLoading, onSuccess, }: UseInstantiateContractArgs<Message>) => {
|
|
@@ -826,7 +982,7 @@ declare const useInstantiateContract: <Message extends Record<string, unknown>>(
|
|
|
826
982
|
instantiateContractAsync: _tanstack_react_query.UseMutateAsyncFunction<InstantiateResult, unknown, InstantiateContractMutationArgs<Message>, unknown>;
|
|
827
983
|
status: "error" | "idle" | "loading" | "success";
|
|
828
984
|
};
|
|
829
|
-
|
|
985
|
+
type UseExecuteContractArgs<Message extends Record<string, unknown>> = {
|
|
830
986
|
contractAddress: string;
|
|
831
987
|
} & MutationEventArgs<ExecuteContractMutationArgs<Message>, ExecuteResult>;
|
|
832
988
|
/**
|
|
@@ -847,7 +1003,9 @@ declare type UseExecuteContractArgs<Message extends Record<string, unknown>> = {
|
|
|
847
1003
|
*
|
|
848
1004
|
* const contractAddress = "cosmosfoobarbaz";
|
|
849
1005
|
* const { executeContract } = useExecuteContract<ExecuteMessage>({ contractAddress });
|
|
850
|
-
* executeContract({
|
|
1006
|
+
* executeContract({ msg: {
|
|
1007
|
+
* foo: "bar"
|
|
1008
|
+
* }}, {
|
|
851
1009
|
* onSuccess: (data: GreetResponse) => console.log('Got message:', data.message);
|
|
852
1010
|
* });
|
|
853
1011
|
* ```
|
|
@@ -904,7 +1062,7 @@ declare const useCheckKeplr: () => UseQueryResult<boolean>;
|
|
|
904
1062
|
*/
|
|
905
1063
|
declare const useCheckWallet: (type?: WalletType) => UseQueryResult<boolean>;
|
|
906
1064
|
|
|
907
|
-
|
|
1065
|
+
type GrazProviderProps = Partial<QueryClientProviderProps> & {
|
|
908
1066
|
grazOptions?: ConfigureGrazArgs;
|
|
909
1067
|
};
|
|
910
1068
|
/**
|
|
@@ -940,4 +1098,4 @@ declare const useGrazEvents: () => null;
|
|
|
940
1098
|
*/
|
|
941
1099
|
declare const GrazEvents: FC;
|
|
942
1100
|
|
|
943
|
-
export { ChainInfoWithPath, ConfigureGrazArgs, ConnectArgs, CreateClientArgs, CreateQueryClient, CreateSigningClientArgs, Dictionary, ExecuteContractArgs, ExecuteContractMutationArgs, GrazAdapter, GrazChain, GrazEvents, GrazProvider, GrazProviderProps, InstantiateContractArgs, InstantiateContractMutationArgs, Maybe, SendIbcTokensArgs, SendTokensArgs, SuggestChainAndConnectArgs, UseAccountArgs, UseConnectChainArgs, UseExecuteContractArgs, UseInstantiateContractArgs, UseQueryClient, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WALLET_TYPES, WalletType, checkWallet, clearRecentChain, configureGraz, connect, createClients, createQueryClient, createSigningClients, defineChain, defineChainInfo, defineChains, disconnect, executeContract, getActiveChainCurrency, getAvailableWallets, getBalanceStaked, getBalances, getKeplr, getLeap, getQueryRaw, getQuerySmart, getRecentChain, getWallet, instantiateContract, mainnetChains, mainnetChainsArray, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChain, useActiveChainCurrency, useActiveChainValidators, useBalance, useBalanceStaked, useBalances, useCheckKeplr, useCheckWallet, useClients, useConnect, useDisconnect, useExecuteContract, useGrazEvents, useInstantiateContract, useOfflineSigners, useQueryClient, useQueryRaw, useQuerySmart, useRecentChain, useSendIbcTokens, useSendTokens, useSigners, useSigningClients, useSuggestChain, useSuggestChainAndConnect };
|
|
1101
|
+
export { AddressToIbcDomainReturnValue, ChainInfoWithPath, ChainPrefix, ConfigureGrazArgs, ConnectArgs, CreateClientArgs, CreateQueryClient, CreateSigningClientArgs, Dictionary, DomainDetails, ExecuteContractArgs, ExecuteContractMutationArgs, GrazAdapter, GrazChain, GrazEvents, GrazProvider, GrazProviderProps, InstantiateContractArgs, InstantiateContractMutationArgs, KnownChainPrefix, Maybe, ResolveToChainAddressArgs, SendIbcTokensArgs, SendTokensArgs, SuggestChainAndConnectArgs, UseAccountArgs, UseConnectChainArgs, UseExecuteContractArgs, UseInstantiateContractArgs, UseQueryClient, UseResolveToChainAddressArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WALLET_TYPES, WalletType, checkWallet, clearRecentChain, configureGraz, connect, createClients, createQueryClient, createSigningClients, defineChain, defineChainInfo, defineChains, disconnect, executeContract, getActiveChainCurrency, getAddressesByIbcDomain, getAvailableWallets, getBalanceStaked, getBalances, getChainAddressByIbcDomain, getIbcDomainByAdress, getIbcDomainDetails, getKeplr, getLeap, getQueryRaw, getQuerySmart, getRecentChain, getWallet, instantiateContract, isIbcDomainPostfix, mainnetChains, mainnetChainsArray, reconnect, resolveToChainAddress, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChain, useActiveChainCurrency, useActiveChainValidators, useAddressToIbcDomain, useBalance, useBalanceStaked, useBalances, useCheckKeplr, useCheckWallet, useClients, useConnect, useDisconnect, useExecuteContract, useGrazEvents, useIbcDomainDetails, useIbcDomainToAddresses, useIbcDomainToChainAddress, useInstantiateContract, useOfflineSigners, useQueryClient, useQueryRaw, useQuerySmart, useRecentChain, useResolveToChainAddress, useSendIbcTokens, useSendTokens, useSigners, useSigningClients, useSuggestChain, useSuggestChainAndConnect, validateAddress };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ye=Object.create;var b=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var $e=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,Ze=Object.prototype.hasOwnProperty;var et=(e,t)=>{for(var n in t)b(e,n,{get:t[n],enumerable:!0})},pe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $e(t))!Ze.call(e,s)&&s!==n&&b(e,s,{get:()=>t[s],enumerable:!(r=Je(t,s))||r.enumerable});return e};var me=(e,t,n)=>(n=e!=null?Ye(Xe(e)):{},pe(t||!e||!e.__esModule?b(n,"default",{value:e,enumerable:!0}):n,e)),tt=e=>pe(b({},"__esModule",{value:!0}),e);var Xt={};et(Xt,{GrazEvents:()=>ce,GrazProvider:()=>$t,WALLET_TYPES:()=>U,WalletType:()=>G,checkWallet:()=>D,clearRecentChain:()=>z,configureGraz:()=>O,connect:()=>h,createClients:()=>E,createQueryClient:()=>v,createSigningClients:()=>w,defineChain:()=>wt,defineChainInfo:()=>bt,defineChains:()=>re,disconnect:()=>Q,executeContract:()=>L,getActiveChainCurrency:()=>K,getAvailableWallets:()=>st,getBalanceStaked:()=>P,getBalances:()=>F,getKeplr:()=>ye,getLeap:()=>Ce,getQueryRaw:()=>Y,getQuerySmart:()=>V,getRecentChain:()=>ot,getWallet:()=>x,instantiateContract:()=>H,mainnetChains:()=>jt,mainnetChainsArray:()=>Dt,reconnect:()=>y,sendIbcTokens:()=>_,sendTokens:()=>N,suggestChain:()=>k,suggestChainAndConnect:()=>W,testnetChains:()=>kt,testnetChainsArray:()=>It,useAccount:()=>g,useActiveChain:()=>Mt,useActiveChainCurrency:()=>Rt,useActiveChainValidators:()=>Qt,useBalance:()=>Bt,useBalanceStaked:()=>vt,useBalances:()=>Oe,useCheckKeplr:()=>Tt,useCheckWallet:()=>A,useClients:()=>Ft,useConnect:()=>Gt,useDisconnect:()=>Ut,useExecuteContract:()=>Lt,useGrazEvents:()=>_e,useInstantiateContract:()=>Ht,useOfflineSigners:()=>Fe,useQueryClient:()=>Ot,useQueryRaw:()=>Yt,useQuerySmart:()=>Vt,useRecentChain:()=>zt,useSendIbcTokens:()=>_t,useSendTokens:()=>Nt,useSigners:()=>qt,useSigningClients:()=>Pt,useSuggestChain:()=>Kt,useSuggestChainAndConnect:()=>Wt});module.exports=tt(Xt);var fe=require("@cosmjs/stargate");var le=me(require("zustand")),j=require("zustand/middleware");var G=(n=>(n.KEPLR="keplr",n.LEAP="leap",n))(G||{}),U=["keplr","leap"];var q={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},nt={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},c=(0,le.default)((0,j.subscribeWithSelector)((0,j.persist)(()=>q,nt)));var M=require("@cosmjs/cosmwasm-stargate"),R=require("@cosmjs/stargate"),de=require("@cosmjs/tendermint-rpc");var ge=require("@cosmjs/stargate"),f=require("@cosmjs/utils");var v=(...e)=>{let{tendermint:t}=c.getState().clients,n=new ge.QueryClient(t),r=e.map(s=>s(n));for(let s of r){(0,f.assert)((0,f.isNonNullObject)(s),"Extension must be a non-null object");for(let[i,o]of Object.entries(s)){(0,f.assert)((0,f.isNonNullObject)(o),`Module must be a non-null object. Found type ${typeof o} for module "${i}".`);let u=n[i]||{};n[i]={...u,...o}}}return n};var E=async({rpc:e,rpcHeaders:t})=>{let n={url:e,headers:{...t||{}}},[r,s,i]=await Promise.all([M.SigningCosmWasmClient.connect(n),R.SigningStargateClient.connect(n),de.Tendermint34Client.connect(e)]);return{cosmWasm:r,stargate:s,tendermint:i}},w=async e=>{let{rpc:t,rpcHeaders:n,offlineSignerAuto:r,cosmWasmSignerOptions:s={},stargateSignerOptions:i={}}=e,o={url:t,headers:{...n||{}}},[u,p]=await Promise.all([M.SigningCosmWasmClient.connectWithSigner(o,r,s),R.SigningStargateClient.connectWithSigner(o,r,i)]);return{cosmWasm:u,stargate:p}};var D=(e=c.getState().walletType)=>{try{return x(e),!0}catch(t){return console.error(t),!1}},ye=()=>{if(typeof window.keplr<"u")return window.keplr;throw c.getState()._notFoundFn(),new Error("window.keplr is not defined")},Ce=()=>{if(typeof window.leap<"u")return window.leap;throw c.getState()._notFoundFn(),new Error("window.leap is not defined")},x=(e=c.getState().walletType)=>{switch(e){case"keplr":return ye();case"leap":return Ce();default:throw new Error("Unknown wallet type")}},st=()=>Object.fromEntries(U.map(e=>[e,D(e)]));var h=async e=>{try{let{defaultChain:t,recentChain:n,walletType:r}=c.getState(),s=(e==null?void 0:e.walletType)||r,i=x(s),o=e||n||t;if(!o)throw new Error("No last known connected chain, connect action requires chain info");c.setState(B=>{let Ve=B._reconnect;return B.activeChain&&B.activeChain.chainId!==o.chainId?{status:"connecting"}:Ve?{status:"reconnecting"}:{status:"connecting"}}),await i.enable(o.chainId);let u=i.getOfflineSigner(o.chainId),p=i.getOfflineSignerOnlyAmino(o.chainId),m=await i.getOfflineSignerAuto(o.chainId),l=o.gas?fe.GasPrice.fromString(`${o.gas.price}${o.gas.denom}`):void 0,[ue,He,Le]=await Promise.all([i.getKey(o.chainId),E(o),w({...o,offlineSignerAuto:m,cosmWasmSignerOptions:{gasPrice:l,...(e==null?void 0:e.signerOpts)||{}}})]);return c.setState({account:ue,activeChain:o,clients:He,offlineSigner:u,offlineSignerAmino:p,offlineSignerAuto:m,recentChain:o,signingClients:Le,status:"connected",walletType:s,_reconnect:!0}),ue}catch(t){throw c.getState().account===null&&c.setState({status:"disconnected"}),t}},Q=async(e=!1)=>(c.setState(t=>({...q,recentChain:e?null:t.recentChain})),Promise.resolve()),y=()=>{let{activeChain:e}=c.getState();e&&h(e)};var z=()=>{c.setState({recentChain:null})},K=e=>{let{activeChain:t}=c.getState();return t==null?void 0:t.currencies.find(n=>n.coinMinimalDenom===e)},ot=()=>c.getState().recentChain,k=async e=>(await x().experimentalSuggestChain(e),e),W=async({chainInfo:e,...t})=>{let n=await k(e);return{account:await h({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:n}};var O=(e={})=>(c.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e);var F=async e=>{let{activeChain:t,signingClients:n}=c.getState();if(!t||!n)throw new Error("No connected account detected");let{defaultSigningClient:r}=c.getState();return await Promise.all(t.currencies.map(async i=>n[r].getBalance(e,i.coinMinimalDenom)))},P=async e=>{let{clients:t}=c.getState();if(!(t!=null&&t.stargate))throw new Error("Stargate client is not ready");return t.stargate.getBalanceStaked(e)},N=async({senderAddress:e,recipientAddress:t,amount:n,fee:r,memo:s})=>{let{signingClients:i,defaultSigningClient:o}=c.getState();if(!i)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return i[o].sendTokens(e,t,n,r,s)},_=async({senderAddress:e,recipientAddress:t,transferAmount:n,sourcePort:r,sourceChannel:s,timeoutHeight:i,timeoutTimestamp:o,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,n,r,s,i,o,u,p)},H=async({senderAddress:e,msg:t,fee:n,options:r,label:s,codeId:i})=>{let{signingClients:o}=c.getState();if(!(o!=null&&o.cosmWasm))throw new Error("CosmWasm signing client is not ready");return o.cosmWasm.instantiate(e,i,t,s,n,r)},L=async({senderAddress:e,msg:t,fee:n,contractAddress:r})=>{let{signingClients:s}=c.getState();if(!(s!=null&&s.cosmWasm))throw new Error("CosmWasm signing client is not ready");return s.cosmWasm.execute(e,r,t,n)},V=async(e,t)=>{let{signingClients:n}=c.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm signing client is not ready");return await n.cosmWasm.queryContractSmart(e,t)},Y=(e,t)=>{let{signingClients:n}=c.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm signing client is not ready");let r=new TextEncoder().encode(t);return n.cosmWasm.queryContractRaw(e,r)};var he=require("@keplr-wallet/cosmos"),Ae={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},rt={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},it={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},ct={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},at={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},ut={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},xe=[Ae,rt,it,ct,at,ut],J={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:Ae,bip44:{coinType:118},bech32Config:he.Bech32Address.defaultBech32Config("axelar"),currencies:xe,feeCurrencies:xe};var Ee=require("@keplr-wallet/cosmos"),we={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Se=[we],I={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:we,bip44:{coinType:118},bech32Config:Ee.Bech32Address.defaultBech32Config("cosmos"),currencies:Se,feeCurrencies:Se};var je=require("@keplr-wallet/cosmos"),De={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},pt={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},mt={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},lt={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},gt={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},dt={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},yt={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Ct={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},ft={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},xt={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},ht={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},be=[De,pt,mt,lt,gt,dt,yt,Ct,ft,xt,ht],$={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:De,bip44:{coinType:118},bech32Config:je.Bech32Address.defaultBech32Config("juno"),currencies:be,feeCurrencies:be};var Ie=require("@keplr-wallet/cosmos"),Te={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},At={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},ke=[Te,At],X={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Te,bip44:{coinType:118},bech32Config:Ie.Bech32Address.defaultBech32Config("osmo"),currencies:ke,feeCurrencies:ke};var Ge=require("@keplr-wallet/cosmos"),Ue={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},Be=[Ue],Z={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:Ue,bip44:{coinType:118},bech32Config:Ge.Bech32Address.defaultBech32Config("somm"),currencies:Be,feeCurrencies:Be};var ve=require("@keplr-wallet/cosmos"),Me={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},qe=[Me],ee={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:ve.Bech32Address.defaultBech32Config("CRE"),currencies:qe,feeCurrencies:qe,stakeCurrency:Me,coinType:118};var Re=require("@keplr-wallet/cosmos"),te={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},St=[te],ne={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:te,bip44:{coinType:118},bech32Config:Re.Bech32Address.defaultBech32Config("juno"),currencies:St,feeCurrencies:[te],coinType:118};var Qe=require("@keplr-wallet/cosmos"),se={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Et=[se],oe={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:se,bip44:{coinType:118},bech32Config:Qe.Bech32Address.defaultBech32Config("osmo"),currencies:Et,feeCurrencies:[se],coinType:118};var re=e=>e,wt=e=>e,bt=e=>e,jt=re({axelar:J,cosmos:I,cosmoshub:I,juno:$,osmosis:X,sommelier:Z}),Dt=[J,I,$,X,Z],kt=re({crescent:ee,juno:ne,osmosis:oe}),It=[ee,ne,oe];var C=require("@tanstack/react-query"),Ke=require("react"),We=me(require("zustand/shallow"));var ze=require("@tanstack/react-query");var Tt=()=>A("keplr"),A=e=>{let t=c(s=>e||s.walletType);return(0,ze.useQuery)(["USE_CHECK_WALLET",t],({queryKey:[,s]})=>D(s))};var g=({onConnect:e,onDisconnect:t}={})=>{let n=c(s=>s.account),r=c(s=>s.status);return(0,Ke.useEffect)(()=>c.subscribe(s=>s.status,(s,i)=>{if(s==="connected"){let o=c.getState();e==null||e({account:o.account,isReconnect:i==="reconnecting"})}s==="disconnected"&&(t==null||t())}),[e,t]),{data:n,isConnected:Boolean(n),isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",reconnect:y,status:r}},Oe=e=>{let{data:t}=g(),n=e||(t==null?void 0:t.bech32Address);return(0,C.useQuery)(["USE_BALANCES",n],({queryKey:[,i]})=>F(i),{enabled:Boolean(n)})},Bt=(e,t)=>{let{data:n}=Oe(t);return(0,C.useQuery)(["USE_BALANCE",n,e,t],({queryKey:[,i]})=>i==null?void 0:i.find(o=>o.denom===e),{enabled:Boolean(n)})},Gt=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=(0,C.useMutation)(["USE_CONNECT",e,t,n],h,{onError:(o,u)=>Promise.resolve(e==null?void 0:e(o,u)),onMutate:t,onSuccess:o=>Promise.resolve(n==null?void 0:n(o))}),{data:i}=A();return{connect:o=>s.mutate(o),connectAsync:o=>s.mutateAsync(o),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:Boolean(i),status:s.status}},Ut=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=(0,C.useMutation)(["USE_DISCONNECT",e,t,n],Q,{onError:i=>Promise.resolve(e==null?void 0:e(i,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:i=>s.mutate(i),disconnectAsync:i=>s.mutateAsync(i),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,status:s.status}},Fe=()=>c(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),We.default),qt=()=>Fe(),vt=e=>{let{data:t}=g(),n=e||(t==null?void 0:t.bech32Address);return(0,C.useQuery)(["USE_BALANCE_STAKED",n],({queryKey:[,i]})=>P(n),{enabled:Boolean(n)})};var S=require("@tanstack/react-query");var Mt=()=>c(e=>e.activeChain),Rt=e=>(0,S.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,r]})=>K(r)),Qt=(e,t="BOND_STATUS_BONDED")=>(0,S.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,s,i]})=>s.staking.validators(i),{enabled:typeof e<"u"}),zt=()=>({data:c(t=>t.recentChain),clear:z}),Kt=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=(0,S.useMutation)(["USE_SUGGEST_CHAIN",e,t,n],k,{onError:(i,o)=>Promise.resolve(e==null?void 0:e(i,o)),onMutate:t,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,suggest:s.mutate,suggestAsync:s.mutateAsync,status:s.status}},Wt=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=(0,S.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,n],W,{onError:(o,u)=>Promise.resolve(e==null?void 0:e(o,u)),onMutate:o=>t==null?void 0:t(o),onSuccess:o=>Promise.resolve(n==null?void 0:n(o))}),{data:i}=A();return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:Boolean(i),status:s.status,suggestAndConnect:s.mutate,suggestAndConnectAsync:s.mutateAsync}};var ie=require("@tanstack/react-query");var Pe=require("@tanstack/react-query");var Ot=(...e)=>{let t=["USE_QUERY_CLIENT",...e];return(0,Pe.useQuery)(t,({queryKey:[,...r]})=>v(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var Ft=e=>{let t=c(s=>s.clients);return(0,ie.useQuery)(["USE_CLIENTS",e,t],({queryKey:[,s,i]})=>s!=null&&s.rpc?E(s):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})},Pt=e=>{let t=c(s=>s.signingClients);return(0,ie.useQuery)(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,s,i]})=>s!=null&&s.rpc?w(s):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})};var d=require("@tanstack/react-query");var Nt=({onError:e,onLoading:t,onSuccess:n}={})=>{let{data:r}=g(),s=r==null?void 0:r.bech32Address,o=(0,d.useMutation)(["USE_SEND_TOKENS",e,t,n,s],u=>N({senderAddress:s,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(n==null?void 0:n(u))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,sendTokens:o.mutate,sendTokensAsync:o.mutateAsync,status:o.status}},_t=({onError:e,onLoading:t,onSuccess:n}={})=>{let{data:r}=g(),s=r==null?void 0:r.bech32Address,o=(0,d.useMutation)(["USE_SEND_IBC_TOKENS",e,t,n,s],u=>_({senderAddress:s,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(n==null?void 0:n(u))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,sendIbcTokens:o.mutate,sendIbcTokensAsync:o.mutateAsync,status:o.status}},Ht=({codeId:e,onError:t,onLoading:n,onSuccess:r})=>{let{data:s}=g(),i=s==null?void 0:s.bech32Address,p=(0,d.useMutation)(["USE_INSTANTIATE_CONTRACT",t,n,r,e,i],m=>{if(!i)throw new Error("senderAddress is undefined");let l={...m,fee:m.fee??"auto",senderAddress:i,codeId:e};return H(l)},{onError:(m,l)=>Promise.resolve(t==null?void 0:t(m,l)),onMutate:n,onSuccess:m=>Promise.resolve(r==null?void 0:r(m))});return{error:p.error,isLoading:p.isLoading,isSuccess:p.isSuccess,instantiateContract:p.mutate,instantiateContractAsync:p.mutateAsync,status:p.status}},Lt=({contractAddress:e,onError:t,onLoading:n,onSuccess:r})=>{let{data:s}=g(),i=s==null?void 0:s.bech32Address,p=(0,d.useMutation)(["USE_EXECUTE_CONTRACT",t,n,r,e,i],m=>{if(!i)throw new Error("senderAddress is undefined");let l={...m,fee:m.fee??"auto",senderAddress:i,contractAddress:e};return L(l)},{onError:(m,l)=>Promise.resolve(t==null?void 0:t(m,l)),onMutate:n,onSuccess:m=>Promise.resolve(r==null?void 0:r(m))});return{error:p.error,isLoading:p.isLoading,isSuccess:p.isSuccess,executeContract:p.mutate,executeContractAsync:p.mutateAsync,status:p.status}},Vt=(e,t)=>(0,d.useQuery)(["USE_QUERY_SMART",e,t],({queryKey:[,s]})=>{if(!e||!t)throw new Error("address or queryMsg undefined");return V(e,t)},{enabled:Boolean(e)&&Boolean(t)}),Yt=(e,t)=>(0,d.useQuery)(["USE_QUERY_RAW",t,e],({queryKey:[,s]})=>{if(!e||!t)throw new Error("address or key undefined");return Y(e,t)},{enabled:Boolean(e)&&Boolean(t)});var T=require("@tanstack/react-query");var Ne=require("react");var _e=()=>((0,Ne.useEffect)(()=>{let{_reconnect:e}=c.getState();return e&&y(),window.addEventListener("keplr_keystorechange",y),()=>{window.removeEventListener("keplr_keystorechange",y)}},[]),null),ce=()=>(_e(),null);var ae=require("react/jsx-runtime"),Jt=new T.QueryClient({}),$t=({children:e,grazOptions:t,...n})=>(t&&O(t),(0,ae.jsxs)(T.QueryClientProvider,{client:Jt,...n,children:[(0,ae.jsx)(ce,{}),e]}));0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineChain,defineChainInfo,defineChains,disconnect,executeContract,getActiveChainCurrency,getAvailableWallets,getBalanceStaked,getBalances,getKeplr,getLeap,getQueryRaw,getQuerySmart,getRecentChain,getWallet,instantiateContract,mainnetChains,mainnetChainsArray,reconnect,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useBalance,useBalanceStaked,useBalances,useCheckKeplr,useCheckWallet,useClients,useConnect,useDisconnect,useExecuteContract,useGrazEvents,useInstantiateContract,useOfflineSigners,useQueryClient,useQueryRaw,useQuerySmart,useRecentChain,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useSuggestChain,useSuggestChainAndConnect});
|
|
1
|
+
"use strict";var rt=Object.create;var j=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var pt=(e,t)=>{for(var n in t)j(e,n,{get:t[n],enumerable:!0})},fe=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of at(t))!ut.call(e,s)&&s!==n&&j(e,s,{get:()=>t[s],enumerable:!(o=it(t,s))||o.enumerable});return e};var xe=(e,t,n)=>(n=e!=null?rt(ct(e)):{},fe(t||!e||!e.__esModule?j(n,"default",{value:e,enumerable:!0}):n,e)),mt=e=>fe(j({},"__esModule",{value:!0}),e);var dn={};pt(dn,{GrazEvents:()=>ye,GrazProvider:()=>gn,WALLET_TYPES:()=>M,WalletType:()=>G,checkWallet:()=>T,clearRecentChain:()=>W,configureGraz:()=>N,connect:()=>S,createClients:()=>w,createQueryClient:()=>Q,createSigningClients:()=>D,defineChain:()=>Ut,defineChainInfo:()=>Rt,defineChains:()=>ge,disconnect:()=>z,executeContract:()=>te,getActiveChainCurrency:()=>_,getAddressesByIbcDomain:()=>L,getAvailableWallets:()=>gt,getBalanceStaked:()=>$,getBalances:()=>J,getChainAddressByIbcDomain:()=>v,getIbcDomainByAdress:()=>H,getIbcDomainDetails:()=>V,getKeplr:()=>Ee,getLeap:()=>be,getQueryRaw:()=>se,getQuerySmart:()=>ne,getRecentChain:()=>dt,getWallet:()=>A,instantiateContract:()=>ee,isIbcDomainPostfix:()=>je,mainnetChains:()=>Gt,mainnetChainsArray:()=>Mt,reconnect:()=>C,resolveToChainAddress:()=>Y,sendIbcTokens:()=>Z,sendTokens:()=>X,suggestChain:()=>k,suggestChainAndConnect:()=>F,testnetChains:()=>Kt,testnetChainsArray:()=>Qt,useAccount:()=>d,useActiveChain:()=>Nt,useActiveChainCurrency:()=>Ht,useActiveChainValidators:()=>Lt,useAddressToIbcDomain:()=>en,useBalance:()=>Ot,useBalanceStaked:()=>Ft,useBalances:()=>$e,useCheckKeplr:()=>Pt,useCheckWallet:()=>E,useClients:()=>Xt,useConnect:()=>zt,useDisconnect:()=>Wt,useExecuteContract:()=>un,useGrazEvents:()=>tt,useIbcDomainDetails:()=>sn,useIbcDomainToAddresses:()=>tn,useIbcDomainToChainAddress:()=>nn,useInstantiateContract:()=>cn,useOfflineSigners:()=>Xe,useQueryClient:()=>$t,useQueryRaw:()=>mn,useQuerySmart:()=>pn,useRecentChain:()=>Vt,useResolveToChainAddress:()=>on,useSendIbcTokens:()=>an,useSendTokens:()=>rn,useSigners:()=>_t,useSigningClients:()=>Zt,useSuggestChain:()=>Yt,useSuggestChainAndConnect:()=>Jt,validateAddress:()=>Ie});module.exports=mt(dn);var we=require("@cosmjs/stargate");var he=xe(require("zustand")),I=require("zustand/middleware");var G=(n=>(n.KEPLR="keplr",n.LEAP="leap",n))(G||{}),M=["keplr","leap"];var K={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},lt={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},a=(0,he.default)((0,I.subscribeWithSelector)((0,I.persist)(()=>K,lt)));var P=require("@cosmjs/cosmwasm-stargate"),O=require("@cosmjs/stargate"),Se=require("@cosmjs/tendermint-rpc");var Ae=require("@cosmjs/stargate"),h=require("@cosmjs/utils");var Q=(...e)=>{let{tendermint:t}=a.getState().clients,n=new Ae.QueryClient(t),o=e.map(s=>s(n));for(let s of o){(0,h.assert)((0,h.isNonNullObject)(s),"Extension must be a non-null object");for(let[r,i]of Object.entries(s)){(0,h.assert)((0,h.isNonNullObject)(i),`Module must be a non-null object. Found type ${typeof i} for module "${r}".`);let u=n[r]||{};n[r]={...u,...i}}}return n};var w=async({rpc:e,rpcHeaders:t})=>{let n={url:e,headers:{...t||{}}},[o,s,r]=await Promise.all([P.SigningCosmWasmClient.connect(n),O.SigningStargateClient.connect(n),Se.Tendermint34Client.connect(e)]);return{cosmWasm:o,stargate:s,tendermint:r}},D=async e=>{let{rpc:t,rpcHeaders:n,offlineSignerAuto:o,cosmWasmSignerOptions:s={},stargateSignerOptions:r={}}=e,i={url:t,headers:{...n||{}}},[u,p]=await Promise.all([P.SigningCosmWasmClient.connectWithSigner(i,o,s),O.SigningStargateClient.connectWithSigner(i,o,r)]);return{cosmWasm:u,stargate:p}};var T=(e=a.getState().walletType)=>{try{return A(e),!0}catch(t){return console.error(t),!1}},Ee=()=>{if(typeof window.keplr<"u")return window.keplr;throw a.getState()._notFoundFn(),new Error("window.keplr is not defined")},be=()=>{if(typeof window.leap<"u")return window.leap;throw a.getState()._notFoundFn(),new Error("window.leap is not defined")},A=(e=a.getState().walletType)=>{switch(e){case"keplr":return Ee();case"leap":return be();default:throw new Error("Unknown wallet type")}},gt=()=>Object.fromEntries(M.map(e=>[e,T(e)]));var S=async e=>{try{let{defaultChain:t,recentChain:n,walletType:o}=a.getState(),s=(e==null?void 0:e.walletType)||o,r=A(s),i=e||n||t;if(!i)throw new Error("No last known connected chain, connect action requires chain info");a.setState(R=>{let ot=R._reconnect;return R.activeChain&&R.activeChain.chainId!==i.chainId?{status:"connecting"}:ot?{status:"reconnecting"}:{status:"connecting"}}),await r.enable(i.chainId);let u=r.getOfflineSigner(i.chainId),p=r.getOfflineSignerOnlyAmino(i.chainId),m=await r.getOfflineSignerAuto(i.chainId),l=i.gas?we.GasPrice.fromString(`${i.gas.price}${i.gas.denom}`):void 0,[Ce,nt,st]=await Promise.all([r.getKey(i.chainId),w(i),D({...i,offlineSignerAuto:m,cosmWasmSignerOptions:{gasPrice:l,...(e==null?void 0:e.signerOpts)||{}}})]);return a.setState({account:Ce,activeChain:i,clients:nt,offlineSigner:u,offlineSignerAmino:p,offlineSignerAuto:m,recentChain:i,signingClients:st,status:"connected",walletType:s,_reconnect:!0}),Ce}catch(t){throw a.getState().account===null&&a.setState({status:"disconnected"}),t}},z=async(e=!1)=>(a.setState(t=>({...K,recentChain:e?null:t.recentChain})),Promise.resolve()),C=()=>{let{activeChain:e}=a.getState();e&&S(e)};var W=()=>{a.setState({recentChain:null})},_=e=>{let{activeChain:t}=a.getState();return t==null?void 0:t.currencies.find(n=>n.coinMinimalDenom===e)},dt=()=>a.getState().recentChain,k=async e=>(await A().experimentalSuggestChain(e),e),F=async({chainInfo:e,...t})=>{let n=await k(e);return{account:await S({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:n}};var N=(e={})=>(a.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e);var De=require("bech32"),g=require("ibc-domains-sdk"),je=e=>e.endsWith(".cosmos"),Ie=(e,t)=>{if(!e)return!1;try{return De.bech32.decode(e).prefix===t}catch{return!1}},H=async(e,t)=>{let n=await(0,g.resolvePrimaryDomainByAddress)(e,t);if(n.error)throw new Error(n.error);if(n.value===null)return null;let o=n.value;return{domain:o.domain,domainFull:o.domain_full}},L=async(e,t)=>{let n=await(0,g.resolveDomainIntoAddresses)(e,t);if(n.error)throw new Error(n.error);return n.value===null?null:n.value},v=async(e,t,n)=>{let o=await(0,g.resolveDomainIntoChainAddress)(e,t,n);if(o.error)throw new Error(o.error);return o.value===null?null:o.value},V=async(e,t)=>{let n=await(0,g.resolveDomainDetails)(e,t);if(n.error)throw new Error(n.error);return n.value===null?null:n.value},Y=async({value:e,prefix:t,isTestnet:n})=>{if(e.trim()==="")throw new Error("value can't be an empty string");if(je(e)){let r=await v(e,t,n);if(!r)throw new Error("ibc domain not found");return r}if(!Ie(e,t))throw new Error("Address is not valid");return e};var J=async e=>{let{activeChain:t,signingClients:n}=a.getState();if(!t||!n)throw new Error("No connected account detected");let{defaultSigningClient:o}=a.getState();return await Promise.all(t.currencies.map(async r=>n[o].getBalance(e,r.coinMinimalDenom)))},$=async e=>{let{clients:t}=a.getState();if(!(t!=null&&t.stargate))throw new Error("Stargate client is not ready");return t.stargate.getBalanceStaked(e)},X=async({senderAddress:e,recipientAddress:t,amount:n,fee:o,memo:s})=>{let{signingClients:r,defaultSigningClient:i}=a.getState();if(!r)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return r[i].sendTokens(e,t,n,o,s)},Z=async({senderAddress:e,recipientAddress:t,transferAmount:n,sourcePort:o,sourceChannel:s,timeoutHeight:r,timeoutTimestamp:i,fee:u,memo:p})=>{let{signingClients:m}=a.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,n,o,s,r,i,u,p)},ee=async({senderAddress:e,msg:t,fee:n,options:o,label:s,codeId:r})=>{let{signingClients:i}=a.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.instantiate(e,r,t,s,n,o)},te=async({senderAddress:e,msg:t,fee:n,contractAddress:o})=>{let{signingClients:s}=a.getState();if(!(s!=null&&s.cosmWasm))throw new Error("CosmWasm signing client is not ready");return s.cosmWasm.execute(e,o,t,n)},ne=async(e,t)=>{let{signingClients:n}=a.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm signing client is not ready");return await n.cosmWasm.queryContractSmart(e,t)},se=(e,t)=>{let{signingClients:n}=a.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm signing client is not ready");let o=new TextEncoder().encode(t);return n.cosmWasm.queryContractRaw(e,o)};var ke=require("@keplr-wallet/cosmos"),ve={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},yt={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Ct={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},ft={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},xt={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},ht={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},Te=[ve,yt,Ct,ft,xt,ht],oe={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:ve,bip44:{coinType:118},bech32Config:ke.Bech32Address.defaultBech32Config("axelar"),currencies:Te,feeCurrencies:Te};var qe=require("@keplr-wallet/cosmos"),Ue={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Be=[Ue],B={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:Ue,bip44:{coinType:118},bech32Config:qe.Bech32Address.defaultBech32Config("cosmos"),currencies:Be,feeCurrencies:Be};var Ge=require("@keplr-wallet/cosmos"),Me={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},At={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},St={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Et={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},bt={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},wt={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Dt={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},jt={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},It={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},Tt={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},kt={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},Re=[Me,At,St,Et,bt,wt,Dt,jt,It,Tt,kt],re={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:Me,bip44:{coinType:118},bech32Config:Ge.Bech32Address.defaultBech32Config("juno"),currencies:Re,feeCurrencies:Re};var Qe=require("@keplr-wallet/cosmos"),Pe={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},vt={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Ke=[Pe,vt],ie={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Pe,bip44:{coinType:118},bech32Config:Qe.Bech32Address.defaultBech32Config("osmo"),currencies:Ke,feeCurrencies:Ke};var ze=require("@keplr-wallet/cosmos"),We={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},Oe=[We],ae={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:We,bip44:{coinType:118},bech32Config:ze.Bech32Address.defaultBech32Config("somm"),currencies:Oe,feeCurrencies:Oe};var Fe=require("@keplr-wallet/cosmos"),Ne={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},_e=[Ne],ce={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:Fe.Bech32Address.defaultBech32Config("CRE"),currencies:_e,feeCurrencies:_e,stakeCurrency:Ne,coinType:118};var He=require("@keplr-wallet/cosmos"),ue={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Bt=[ue],pe={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:ue,bip44:{coinType:118},bech32Config:He.Bech32Address.defaultBech32Config("juno"),currencies:Bt,feeCurrencies:[ue],coinType:118};var Le=require("@keplr-wallet/cosmos"),me={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},qt=[me],le={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:me,bip44:{coinType:118},bech32Config:Le.Bech32Address.defaultBech32Config("osmo"),currencies:qt,feeCurrencies:[me],coinType:118};var ge=e=>e,Ut=e=>e,Rt=e=>e,Gt=ge({axelar:oe,cosmos:B,cosmoshub:B,juno:re,osmosis:ie,sommelier:ae}),Mt=[oe,B,re,ie,ae],Kt=ge({crescent:ce,juno:pe,osmosis:le}),Qt=[ce,pe,le];var f=require("@tanstack/react-query"),Ye=require("react"),Je=xe(require("zustand/shallow"));var Ve=require("@tanstack/react-query");var Pt=()=>E("keplr"),E=e=>{let n=["USE_CHECK_WALLET",a(s=>e||s.walletType)];return(0,Ve.useQuery)(n,({queryKey:[,s]})=>T(s))};var d=({onConnect:e,onDisconnect:t}={})=>{let n=a(s=>s.account),o=a(s=>s.status);return(0,Ye.useEffect)(()=>a.subscribe(s=>s.status,(s,r)=>{if(s==="connected"){let i=a.getState();e==null||e({account:i.account,isReconnect:r==="reconnecting"})}s==="disconnected"&&(t==null||t())}),[e,t]),{data:n,isConnected:Boolean(n),isConnecting:o==="connecting",isDisconnected:o==="disconnected",isReconnecting:o==="reconnecting",reconnect:C,status:o}},$e=e=>{let{data:t}=d(),n=e||(t==null?void 0:t.bech32Address);return(0,f.useQuery)(["USE_BALANCES",n],({queryKey:[,r]})=>J(r),{enabled:Boolean(n)})},Ot=(e,t)=>{let{data:n}=$e(t);return(0,f.useQuery)(["USE_BALANCE",n,e,t],({queryKey:[,r]})=>r==null?void 0:r.find(i=>i.denom===e),{enabled:Boolean(n)})},zt=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=(0,f.useMutation)(["USE_CONNECT",e,t,n],S,{onError:(i,u)=>Promise.resolve(e==null?void 0:e(i,u)),onMutate:t,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:r}=E();return{connect:i=>s.mutate(i),connectAsync:i=>s.mutateAsync(i),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:Boolean(r),status:s.status}},Wt=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=(0,f.useMutation)(["USE_DISCONNECT",e,t,n],z,{onError:r=>Promise.resolve(e==null?void 0:e(r,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:r=>s.mutate(r),disconnectAsync:r=>s.mutateAsync(r),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,status:s.status}},Xe=()=>a(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Je.default),_t=()=>Xe(),Ft=e=>{let{data:t}=d(),n=e||(t==null?void 0:t.bech32Address);return(0,f.useQuery)(["USE_BALANCE_STAKED",n],({queryKey:[,r]})=>$(n),{enabled:Boolean(n)})};var b=require("@tanstack/react-query");var Nt=()=>a(e=>e.activeChain),Ht=e=>(0,b.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,o]})=>_(o)),Lt=(e,t="BOND_STATUS_BONDED")=>(0,b.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,s,r]})=>s.staking.validators(r),{enabled:typeof e<"u"}),Vt=()=>({data:a(t=>t.recentChain),clear:W}),Yt=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=(0,b.useMutation)(["USE_SUGGEST_CHAIN",e,t,n],k,{onError:(r,i)=>Promise.resolve(e==null?void 0:e(r,i)),onMutate:t,onSuccess:r=>Promise.resolve(n==null?void 0:n(r))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,suggest:s.mutate,suggestAsync:s.mutateAsync,status:s.status}},Jt=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=(0,b.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,n],F,{onError:(i,u)=>Promise.resolve(e==null?void 0:e(i,u)),onMutate:i=>t==null?void 0:t(i),onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:r}=E();return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:Boolean(r),status:s.status,suggestAndConnect:s.mutate,suggestAndConnectAsync:s.mutateAsync}};var de=require("@tanstack/react-query");var Ze=require("@tanstack/react-query");var $t=(...e)=>{let t=["USE_QUERY_CLIENT",...e];return(0,Ze.useQuery)(t,({queryKey:[,...o]})=>Q(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var Xt=e=>{let t=a(s=>s.clients);return(0,de.useQuery)(["USE_CLIENTS",e,t],({queryKey:[,s,r]})=>s!=null&&s.rpc?w(s):r,{refetchOnMount:!1,refetchOnWindowFocus:!1})},Zt=e=>{let t=a(s=>s.signingClients);return(0,de.useQuery)(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,s,r]})=>s!=null&&s.rpc?D(s):r,{refetchOnMount:!1,refetchOnWindowFocus:!1})};var x=require("@tanstack/react-query");var en=({address:e,isTestnet:t})=>(0,x.useQuery)(["USE_ADRESS_TO_IBC_DOMAIN",e,t],()=>H(e,t),{enabled:Boolean(e)}),tn=({ibcDomain:e,isTestnet:t})=>(0,x.useQuery)(["USE_IBC_DOMAIN_TO_ADDRESSES",e,t],()=>L(e,t),{enabled:Boolean(e)}),nn=({ibcDomain:e,prefix:t,isTestnet:n})=>(0,x.useQuery)(["USE_IBC_DOMAIN_TO_CHAIN_ADDRESS",t,e,n],()=>v(e,t,n),{enabled:Boolean(e&&t)}),sn=({ibcDomain:e,isTestnet:t})=>(0,x.useQuery)(["USE_IBC_DOMAIN_DETAILS",e,t],()=>V(e,t),{enabled:Boolean(e)}),on=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=(0,x.useMutation)(["USE_RESOLVE_TO_CHAIN_ADDRESS",e,t,n],Y,{onError:(r,i)=>Promise.resolve(e==null?void 0:e(r,i)),onMutate:t,onSuccess:r=>Promise.resolve(n==null?void 0:n(r))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,resolveToChainAddress:s.mutate,resolveToChainAddressAsync:s.mutateAsync,status:s.status}};var y=require("@tanstack/react-query");var rn=({onError:e,onLoading:t,onSuccess:n}={})=>{let{data:o}=d(),s=o==null?void 0:o.bech32Address,i=(0,y.useMutation)(["USE_SEND_TOKENS",e,t,n,s],u=>X({senderAddress:s,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(n==null?void 0:n(u))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},an=({onError:e,onLoading:t,onSuccess:n}={})=>{let{data:o}=d(),s=o==null?void 0:o.bech32Address,i=(0,y.useMutation)(["USE_SEND_IBC_TOKENS",e,t,n,s],u=>Z({senderAddress:s,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(n==null?void 0:n(u))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},cn=({codeId:e,onError:t,onLoading:n,onSuccess:o})=>{let{data:s}=d(),r=s==null?void 0:s.bech32Address,p=(0,y.useMutation)(["USE_INSTANTIATE_CONTRACT",t,n,o,e,r],m=>{if(!r)throw new Error("senderAddress is undefined");let l={...m,fee:m.fee??"auto",senderAddress:r,codeId:e};return ee(l)},{onError:(m,l)=>Promise.resolve(t==null?void 0:t(m,l)),onMutate:n,onSuccess:m=>Promise.resolve(o==null?void 0:o(m))});return{error:p.error,isLoading:p.isLoading,isSuccess:p.isSuccess,instantiateContract:p.mutate,instantiateContractAsync:p.mutateAsync,status:p.status}},un=({contractAddress:e,onError:t,onLoading:n,onSuccess:o})=>{let{data:s}=d(),r=s==null?void 0:s.bech32Address,p=(0,y.useMutation)(["USE_EXECUTE_CONTRACT",t,n,o,e,r],m=>{if(!r)throw new Error("senderAddress is undefined");let l={...m,fee:m.fee??"auto",senderAddress:r,contractAddress:e};return te(l)},{onError:(m,l)=>Promise.resolve(t==null?void 0:t(m,l)),onMutate:n,onSuccess:m=>Promise.resolve(o==null?void 0:o(m))});return{error:p.error,isLoading:p.isLoading,isSuccess:p.isSuccess,executeContract:p.mutate,executeContractAsync:p.mutateAsync,status:p.status}},pn=(e,t)=>(0,y.useQuery)(["USE_QUERY_SMART",e,t],({queryKey:[,s]})=>{if(!e||!t)throw new Error("address or queryMsg undefined");return ne(e,t)},{enabled:Boolean(e)&&Boolean(t)}),mn=(e,t)=>(0,y.useQuery)(["USE_QUERY_RAW",t,e],({queryKey:[,s]})=>{if(!e||!t)throw new Error("address or key undefined");return se(e,t)},{enabled:Boolean(e)&&Boolean(t)});var q=require("@tanstack/react-query");var et=require("react");var tt=()=>((0,et.useEffect)(()=>{let{_reconnect:e}=a.getState();return e&&C(),window.addEventListener("keplr_keystorechange",C),()=>{window.removeEventListener("keplr_keystorechange",C)}},[]),null),ye=()=>(tt(),null);var U=require("react/jsx-runtime"),ln=new q.QueryClient({}),gn=({children:e,grazOptions:t,...n})=>(t&&N(t),(0,U.jsxs)(q.QueryClientProvider,{client:ln,...n,children:[(0,U.jsx)(ye,{}),e]}));0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineChain,defineChainInfo,defineChains,disconnect,executeContract,getActiveChainCurrency,getAddressesByIbcDomain,getAvailableWallets,getBalanceStaked,getBalances,getChainAddressByIbcDomain,getIbcDomainByAdress,getIbcDomainDetails,getKeplr,getLeap,getQueryRaw,getQuerySmart,getRecentChain,getWallet,instantiateContract,isIbcDomainPostfix,mainnetChains,mainnetChainsArray,reconnect,resolveToChainAddress,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useAddressToIbcDomain,useBalance,useBalanceStaked,useBalances,useCheckKeplr,useCheckWallet,useClients,useConnect,useDisconnect,useExecuteContract,useGrazEvents,useIbcDomainDetails,useIbcDomainToAddresses,useIbcDomainToChainAddress,useInstantiateContract,useOfflineSigners,useQueryClient,useQueryRaw,useQuerySmart,useRecentChain,useResolveToChainAddress,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useSuggestChain,useSuggestChainAndConnect,validateAddress});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GasPrice as qe}from"@cosmjs/stargate";import je from"zustand";import{persist as De,subscribeWithSelector as ke}from"zustand/middleware";var Q=(s=>(s.KEPLR="keplr",s.LEAP="leap",s))(Q||{}),z=["keplr","leap"];var w={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},Ie={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},c=je(ke(De(()=>w,Ie)));import{SigningCosmWasmClient as F}from"@cosmjs/cosmwasm-stargate";import{SigningStargateClient as P}from"@cosmjs/stargate";import{Tendermint34Client as Be}from"@cosmjs/tendermint-rpc";import{QueryClient as Te}from"@cosmjs/stargate";import{assert as K,isNonNullObject as W}from"@cosmjs/utils";var O=(...e)=>{let{tendermint:t}=c.getState().clients,s=new Te(t),r=e.map(n=>n(s));for(let n of r){K(W(n),"Extension must be a non-null object");for(let[i,o]of Object.entries(n)){K(W(o),`Module must be a non-null object. Found type ${typeof o} for module "${i}".`);let u=s[i]||{};s[i]={...u,...o}}}return s};var x=async({rpc:e,rpcHeaders:t})=>{let s={url:e,headers:{...t||{}}},[r,n,i]=await Promise.all([F.connect(s),P.connect(s),Be.connect(e)]);return{cosmWasm:r,stargate:n,tendermint:i}},h=async e=>{let{rpc:t,rpcHeaders:s,offlineSignerAuto:r,cosmWasmSignerOptions:n={},stargateSignerOptions:i={}}=e,o={url:t,headers:{...s||{}}},[u,p]=await Promise.all([F.connectWithSigner(o,r,n),P.connectWithSigner(o,r,i)]);return{cosmWasm:u,stargate:p}};var b=(e=c.getState().walletType)=>{try{return y(e),!0}catch(t){return console.error(t),!1}},Ge=()=>{if(typeof window.keplr<"u")return window.keplr;throw c.getState()._notFoundFn(),new Error("window.keplr is not defined")},Ue=()=>{if(typeof window.leap<"u")return window.leap;throw c.getState()._notFoundFn(),new Error("window.leap is not defined")},y=(e=c.getState().walletType)=>{switch(e){case"keplr":return Ge();case"leap":return Ue();default:throw new Error("Unknown wallet type")}},Mt=()=>Object.fromEntries(z.map(e=>[e,b(e)]));var C=async e=>{try{let{defaultChain:t,recentChain:s,walletType:r}=c.getState(),n=(e==null?void 0:e.walletType)||r,i=y(n),o=e||s||t;if(!o)throw new Error("No last known connected chain, connect action requires chain info");c.setState(E=>{let be=E._reconnect;return E.activeChain&&E.activeChain.chainId!==o.chainId?{status:"connecting"}:be?{status:"reconnecting"}:{status:"connecting"}}),await i.enable(o.chainId);let u=i.getOfflineSigner(o.chainId),p=i.getOfflineSignerOnlyAmino(o.chainId),m=await i.getOfflineSignerAuto(o.chainId),l=o.gas?qe.fromString(`${o.gas.price}${o.gas.denom}`):void 0,[R,Ee,we]=await Promise.all([i.getKey(o.chainId),x(o),h({...o,offlineSignerAuto:m,cosmWasmSignerOptions:{gasPrice:l,...(e==null?void 0:e.signerOpts)||{}}})]);return c.setState({account:R,activeChain:o,clients:Ee,offlineSigner:u,offlineSignerAmino:p,offlineSignerAuto:m,recentChain:o,signingClients:we,status:"connected",walletType:n,_reconnect:!0}),R}catch(t){throw c.getState().account===null&&c.setState({status:"disconnected"}),t}},N=async(e=!1)=>(c.setState(t=>({...w,recentChain:e?null:t.recentChain})),Promise.resolve()),d=()=>{let{activeChain:e}=c.getState();e&&C(e)};var _=()=>{c.setState({recentChain:null})},H=e=>{let{activeChain:t}=c.getState();return t==null?void 0:t.currencies.find(s=>s.coinMinimalDenom===e)},_t=()=>c.getState().recentChain,j=async e=>(await y().experimentalSuggestChain(e),e),L=async({chainInfo:e,...t})=>{let s=await j(e);return{account:await C({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:s}};var V=(e={})=>(c.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e);var Y=async e=>{let{activeChain:t,signingClients:s}=c.getState();if(!t||!s)throw new Error("No connected account detected");let{defaultSigningClient:r}=c.getState();return await Promise.all(t.currencies.map(async i=>s[r].getBalance(e,i.coinMinimalDenom)))},J=async 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({senderAddress:e,recipientAddress:t,amount:s,fee:r,memo:n})=>{let{signingClients:i,defaultSigningClient:o}=c.getState();if(!i)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return i[o].sendTokens(e,t,s,r,n)},X=async({senderAddress:e,recipientAddress:t,transferAmount:s,sourcePort:r,sourceChannel:n,timeoutHeight:i,timeoutTimestamp:o,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,s,r,n,i,o,u,p)},Z=async({senderAddress:e,msg:t,fee:s,options:r,label:n,codeId:i})=>{let{signingClients:o}=c.getState();if(!(o!=null&&o.cosmWasm))throw new Error("CosmWasm signing client is not ready");return o.cosmWasm.instantiate(e,i,t,n,s,r)},ee=async({senderAddress:e,msg:t,fee:s,contractAddress:r})=>{let{signingClients:n}=c.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm signing client is not ready");return n.cosmWasm.execute(e,r,t,s)},te=async(e,t)=>{let{signingClients:s}=c.getState();if(!(s!=null&&s.cosmWasm))throw new Error("CosmWasm signing client is not ready");return await s.cosmWasm.queryContractSmart(e,t)},ne=(e,t)=>{let{signingClients:s}=c.getState();if(!(s!=null&&s.cosmWasm))throw new Error("CosmWasm signing client is not ready");let r=new TextEncoder().encode(t);return s.cosmWasm.queryContractRaw(e,r)};import{Bech32Address as ve}from"@keplr-wallet/cosmos";var oe={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Me={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Re={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Qe={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},ze={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Ke={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},se=[oe,Me,Re,Qe,ze,Ke],D={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:oe,bip44:{coinType:118},bech32Config:ve.defaultBech32Config("axelar"),currencies:se,feeCurrencies:se};import{Bech32Address as We}from"@keplr-wallet/cosmos";var ie={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},re=[ie],A={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:ie,bip44:{coinType:118},bech32Config:We.defaultBech32Config("cosmos"),currencies:re,feeCurrencies:re};import{Bech32Address as Oe}from"@keplr-wallet/cosmos";var ae={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Fe={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Pe={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Ne={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},_e={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},He={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Le={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Ve={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Ye={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},Je={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},$e={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},ce=[ae,Fe,Pe,Ne,_e,He,Le,Ve,Ye,Je,$e],k={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:ae,bip44:{coinType:118},bech32Config:Oe.defaultBech32Config("juno"),currencies:ce,feeCurrencies:ce};import{Bech32Address as Xe}from"@keplr-wallet/cosmos";var pe={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Ze={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},ue=[pe,Ze],I={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:pe,bip44:{coinType:118},bech32Config:Xe.defaultBech32Config("osmo"),currencies:ue,feeCurrencies:ue};import{Bech32Address as et}from"@keplr-wallet/cosmos";var le={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},me=[le],T={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:le,bip44:{coinType:118},bech32Config:et.defaultBech32Config("somm"),currencies:me,feeCurrencies:me};import{Bech32Address as tt}from"@keplr-wallet/cosmos";var de={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},ge=[de],B={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:tt.defaultBech32Config("CRE"),currencies:ge,feeCurrencies:ge,stakeCurrency:de,coinType:118};import{Bech32Address as nt}from"@keplr-wallet/cosmos";var G={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},st=[G],U={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:G,bip44:{coinType:118},bech32Config:nt.defaultBech32Config("juno"),currencies:st,feeCurrencies:[G],coinType:118};import{Bech32Address as ot}from"@keplr-wallet/cosmos";var q={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},rt=[q],v={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:q,bip44:{coinType:118},bech32Config:ot.defaultBech32Config("osmo"),currencies:rt,feeCurrencies:[q],coinType:118};var ye=e=>e,wn=e=>e,bn=e=>e,jn=ye({axelar:D,cosmos:A,cosmoshub:A,juno:k,osmosis:I,sommelier:T}),Dn=[D,A,k,I,T],kn=ye({crescent:B,juno:U,osmosis:v}),In=[B,U,v];import{useMutation as Ce,useQuery as M}from"@tanstack/react-query";import{useEffect as ct}from"react";import at from"zustand/shallow";import{useQuery as it}from"@tanstack/react-query";var qn=()=>f("keplr"),f=e=>{let t=c(n=>e||n.walletType);return it(["USE_CHECK_WALLET",t],({queryKey:[,n]})=>b(n))};var g=({onConnect:e,onDisconnect:t}={})=>{let s=c(n=>n.account),r=c(n=>n.status);return ct(()=>c.subscribe(n=>n.status,(n,i)=>{if(n==="connected"){let o=c.getState();e==null||e({account:o.account,isReconnect:i==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:s,isConnected:Boolean(s),isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",reconnect:d,status:r}},ut=e=>{let{data:t}=g(),s=e||(t==null?void 0:t.bech32Address);return M(["USE_BALANCES",s],({queryKey:[,i]})=>Y(i),{enabled:Boolean(s)})},Fn=(e,t)=>{let{data:s}=ut(t);return M(["USE_BALANCE",s,e,t],({queryKey:[,i]})=>i==null?void 0:i.find(o=>o.denom===e),{enabled:Boolean(s)})},Pn=({onError:e,onLoading:t,onSuccess:s}={})=>{let n=Ce(["USE_CONNECT",e,t,s],C,{onError:(o,u)=>Promise.resolve(e==null?void 0:e(o,u)),onMutate:t,onSuccess:o=>Promise.resolve(s==null?void 0:s(o))}),{data:i}=f();return{connect:o=>n.mutate(o),connectAsync:o=>n.mutateAsync(o),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(i),status:n.status}},Nn=({onError:e,onLoading:t,onSuccess:s}={})=>{let n=Ce(["USE_DISCONNECT",e,t,s],N,{onError:i=>Promise.resolve(e==null?void 0:e(i,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(s==null?void 0:s(void 0))});return{disconnect:i=>n.mutate(i),disconnectAsync:i=>n.mutateAsync(i),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}},pt=()=>c(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),at),_n=()=>pt(),Hn=e=>{let{data:t}=g(),s=e||(t==null?void 0:t.bech32Address);return M(["USE_BALANCE_STAKED",s],({queryKey:[,i]})=>J(s),{enabled:Boolean(s)})};import{useMutation as fe,useQuery as xe}from"@tanstack/react-query";var Xn=()=>c(e=>e.activeChain),Zn=e=>xe(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,r]})=>H(r)),es=(e,t="BOND_STATUS_BONDED")=>xe(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,n,i]})=>n.staking.validators(i),{enabled:typeof e<"u"}),ts=()=>({data:c(t=>t.recentChain),clear:_}),ns=({onError:e,onLoading:t,onSuccess:s}={})=>{let n=fe(["USE_SUGGEST_CHAIN",e,t,s],j,{onError:(i,o)=>Promise.resolve(e==null?void 0:e(i,o)),onMutate:t,onSuccess:i=>Promise.resolve(s==null?void 0:s(i))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}},ss=({onError:e,onLoading:t,onSuccess:s}={})=>{let n=fe(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,s],L,{onError:(o,u)=>Promise.resolve(e==null?void 0:e(o,u)),onMutate:o=>t==null?void 0:t(o),onSuccess:o=>Promise.resolve(s==null?void 0:s(o))}),{data:i}=f();return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(i),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}};import{useQuery as he}from"@tanstack/react-query";import{useQuery as mt}from"@tanstack/react-query";var cs=(...e)=>{let t=["USE_QUERY_CLIENT",...e];return mt(t,({queryKey:[,...r]})=>O(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var ls=e=>{let t=c(n=>n.clients);return he(["USE_CLIENTS",e,t],({queryKey:[,n,i]})=>n!=null&&n.rpc?x(n):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})},gs=e=>{let t=c(n=>n.signingClients);return he(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,n,i]})=>n!=null&&n.rpc?h(n):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})};import{useMutation as S,useQuery as Ae}from"@tanstack/react-query";var hs=({onError:e,onLoading:t,onSuccess:s}={})=>{let{data:r}=g(),n=r==null?void 0:r.bech32Address,o=S(["USE_SEND_TOKENS",e,t,s,n],u=>$({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(s==null?void 0:s(u))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,sendTokens:o.mutate,sendTokensAsync:o.mutateAsync,status:o.status}},As=({onError:e,onLoading:t,onSuccess:s}={})=>{let{data:r}=g(),n=r==null?void 0:r.bech32Address,o=S(["USE_SEND_IBC_TOKENS",e,t,s,n],u=>X({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(s==null?void 0:s(u))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,sendIbcTokens:o.mutate,sendIbcTokensAsync:o.mutateAsync,status:o.status}},Ss=({codeId:e,onError:t,onLoading:s,onSuccess:r})=>{let{data:n}=g(),i=n==null?void 0:n.bech32Address,p=S(["USE_INSTANTIATE_CONTRACT",t,s,r,e,i],m=>{if(!i)throw new Error("senderAddress is undefined");let l={...m,fee:m.fee??"auto",senderAddress:i,codeId:e};return Z(l)},{onError:(m,l)=>Promise.resolve(t==null?void 0:t(m,l)),onMutate:s,onSuccess:m=>Promise.resolve(r==null?void 0:r(m))});return{error:p.error,isLoading:p.isLoading,isSuccess:p.isSuccess,instantiateContract:p.mutate,instantiateContractAsync:p.mutateAsync,status:p.status}},Es=({contractAddress:e,onError:t,onLoading:s,onSuccess:r})=>{let{data:n}=g(),i=n==null?void 0:n.bech32Address,p=S(["USE_EXECUTE_CONTRACT",t,s,r,e,i],m=>{if(!i)throw new Error("senderAddress is undefined");let l={...m,fee:m.fee??"auto",senderAddress:i,contractAddress:e};return ee(l)},{onError:(m,l)=>Promise.resolve(t==null?void 0:t(m,l)),onMutate:s,onSuccess:m=>Promise.resolve(r==null?void 0:r(m))});return{error:p.error,isLoading:p.isLoading,isSuccess:p.isSuccess,executeContract:p.mutate,executeContractAsync:p.mutateAsync,status:p.status}},ws=(e,t)=>Ae(["USE_QUERY_SMART",e,t],({queryKey:[,n]})=>{if(!e||!t)throw new Error("address or queryMsg undefined");return te(e,t)},{enabled:Boolean(e)&&Boolean(t)}),bs=(e,t)=>Ae(["USE_QUERY_RAW",t,e],({queryKey:[,n]})=>{if(!e||!t)throw new Error("address or key undefined");return ne(e,t)},{enabled:Boolean(e)&&Boolean(t)});import{QueryClient as dt,QueryClientProvider as yt}from"@tanstack/react-query";import{useEffect as lt}from"react";var gt=()=>(lt(()=>{let{_reconnect:e}=c.getState();return e&&d(),window.addEventListener("keplr_keystorechange",d),()=>{window.removeEventListener("keplr_keystorechange",d)}},[]),null),Se=()=>(gt(),null);import{jsx as ft,jsxs as xt}from"react/jsx-runtime";var Ct=new dt({}),qs=({children:e,grazOptions:t,...s})=>(t&&V(t),xt(yt,{client:Ct,...s,children:[ft(Se,{}),e]}));export{Se as GrazEvents,qs as GrazProvider,z as WALLET_TYPES,Q as WalletType,b as checkWallet,_ as clearRecentChain,V as configureGraz,C as connect,x as createClients,O as createQueryClient,h as createSigningClients,wn as defineChain,bn as defineChainInfo,ye as defineChains,N as disconnect,ee as executeContract,H as getActiveChainCurrency,Mt as getAvailableWallets,J as getBalanceStaked,Y as getBalances,Ge as getKeplr,Ue as getLeap,ne as getQueryRaw,te as getQuerySmart,_t as getRecentChain,y as getWallet,Z as instantiateContract,jn as mainnetChains,Dn as mainnetChainsArray,d as reconnect,X as sendIbcTokens,$ as sendTokens,j as suggestChain,L as suggestChainAndConnect,kn as testnetChains,In as testnetChainsArray,g as useAccount,Xn as useActiveChain,Zn as useActiveChainCurrency,es as useActiveChainValidators,Fn as useBalance,Hn as useBalanceStaked,ut as useBalances,qn as useCheckKeplr,f as useCheckWallet,ls as useClients,Pn as useConnect,Nn as useDisconnect,Es as useExecuteContract,gt as useGrazEvents,Ss as useInstantiateContract,pt as useOfflineSigners,cs as useQueryClient,bs as useQueryRaw,ws as useQuerySmart,ts as useRecentChain,As as useSendIbcTokens,hs as useSendTokens,_n as useSigners,gs as useSigningClients,ns as useSuggestChain,ss as useSuggestChainAndConnect};
|
|
1
|
+
import{GasPrice as Pe}from"@cosmjs/stargate";import Be from"zustand";import{persist as qe,subscribeWithSelector as Ue}from"zustand/middleware";var P=(n=>(n.KEPLR="keplr",n.LEAP="leap",n))(P||{}),O=["keplr","leap"];var w={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},Re={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},a=Be(Ue(qe(()=>w,Re)));import{SigningCosmWasmClient as F}from"@cosmjs/cosmwasm-stargate";import{SigningStargateClient as N}from"@cosmjs/stargate";import{Tendermint34Client as Me}from"@cosmjs/tendermint-rpc";import{QueryClient as Ge}from"@cosmjs/stargate";import{assert as z,isNonNullObject as W}from"@cosmjs/utils";var _=(...e)=>{let{tendermint:t}=a.getState().clients,n=new Ge(t),o=e.map(s=>s(n));for(let s of o){z(W(s),"Extension must be a non-null object");for(let[r,i]of Object.entries(s)){z(W(i),`Module must be a non-null object. Found type ${typeof i} for module "${r}".`);let u=n[r]||{};n[r]={...u,...i}}}return n};var x=async({rpc:e,rpcHeaders:t})=>{let n={url:e,headers:{...t||{}}},[o,s,r]=await Promise.all([F.connect(n),N.connect(n),Me.connect(e)]);return{cosmWasm:o,stargate:s,tendermint:r}},h=async e=>{let{rpc:t,rpcHeaders:n,offlineSignerAuto:o,cosmWasmSignerOptions:s={},stargateSignerOptions:r={}}=e,i={url:t,headers:{...n||{}}},[u,p]=await Promise.all([F.connectWithSigner(i,o,s),N.connectWithSigner(i,o,r)]);return{cosmWasm:u,stargate:p}};var D=(e=a.getState().walletType)=>{try{return y(e),!0}catch(t){return console.error(t),!1}},Ke=()=>{if(typeof window.keplr<"u")return window.keplr;throw a.getState()._notFoundFn(),new Error("window.keplr is not defined")},Qe=()=>{if(typeof window.leap<"u")return window.leap;throw a.getState()._notFoundFn(),new Error("window.leap is not defined")},y=(e=a.getState().walletType)=>{switch(e){case"keplr":return Ke();case"leap":return Qe();default:throw new Error("Unknown wallet type")}},Zt=()=>Object.fromEntries(O.map(e=>[e,D(e)]));var C=async e=>{try{let{defaultChain:t,recentChain:n,walletType:o}=a.getState(),s=(e==null?void 0:e.walletType)||o,r=y(s),i=e||n||t;if(!i)throw new Error("No last known connected chain, connect action requires chain info");a.setState(b=>{let ve=b._reconnect;return b.activeChain&&b.activeChain.chainId!==i.chainId?{status:"connecting"}:ve?{status:"reconnecting"}:{status:"connecting"}}),await r.enable(i.chainId);let u=r.getOfflineSigner(i.chainId),p=r.getOfflineSignerOnlyAmino(i.chainId),m=await r.getOfflineSignerAuto(i.chainId),l=i.gas?Pe.fromString(`${i.gas.price}${i.gas.denom}`):void 0,[Q,Te,ke]=await Promise.all([r.getKey(i.chainId),x(i),h({...i,offlineSignerAuto:m,cosmWasmSignerOptions:{gasPrice:l,...(e==null?void 0:e.signerOpts)||{}}})]);return a.setState({account:Q,activeChain:i,clients:Te,offlineSigner:u,offlineSignerAmino:p,offlineSignerAuto:m,recentChain:i,signingClients:ke,status:"connected",walletType:s,_reconnect:!0}),Q}catch(t){throw a.getState().account===null&&a.setState({status:"disconnected"}),t}},H=async(e=!1)=>(a.setState(t=>({...w,recentChain:e?null:t.recentChain})),Promise.resolve()),d=()=>{let{activeChain:e}=a.getState();e&&C(e)};var L=()=>{a.setState({recentChain:null})},V=e=>{let{activeChain:t}=a.getState();return t==null?void 0:t.currencies.find(n=>n.coinMinimalDenom===e)},ln=()=>a.getState().recentChain,j=async e=>(await y().experimentalSuggestChain(e),e),Y=async({chainInfo:e,...t})=>{let n=await j(e);return{account:await C({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:n}};var J=(e={})=>(a.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e);import{bech32 as Oe}from"bech32";import{resolveDomainDetails as ze,resolveDomainIntoAddresses as We,resolveDomainIntoChainAddress as _e,resolvePrimaryDomainByAddress as Fe}from"ibc-domains-sdk";var Ne=e=>e.endsWith(".cosmos"),He=(e,t)=>{if(!e)return!1;try{return Oe.decode(e).prefix===t}catch{return!1}},$=async(e,t)=>{let n=await Fe(e,t);if(n.error)throw new Error(n.error);if(n.value===null)return null;let o=n.value;return{domain:o.domain,domainFull:o.domain_full}},X=async(e,t)=>{let n=await We(e,t);if(n.error)throw new Error(n.error);return n.value===null?null:n.value},I=async(e,t,n)=>{let o=await _e(e,t,n);if(o.error)throw new Error(o.error);return o.value===null?null:o.value},Z=async(e,t)=>{let n=await ze(e,t);if(n.error)throw new Error(n.error);return n.value===null?null:n.value},ee=async({value:e,prefix:t,isTestnet:n})=>{if(e.trim()==="")throw new Error("value can't be an empty string");if(Ne(e)){let r=await I(e,t,n);if(!r)throw new Error("ibc domain not found");return r}if(!He(e,t))throw new Error("Address is not valid");return e};var te=async e=>{let{activeChain:t,signingClients:n}=a.getState();if(!t||!n)throw new Error("No connected account detected");let{defaultSigningClient:o}=a.getState();return await Promise.all(t.currencies.map(async r=>n[o].getBalance(e,r.coinMinimalDenom)))},ne=async e=>{let{clients:t}=a.getState();if(!(t!=null&&t.stargate))throw new Error("Stargate client is not ready");return t.stargate.getBalanceStaked(e)},se=async({senderAddress:e,recipientAddress:t,amount:n,fee:o,memo:s})=>{let{signingClients:r,defaultSigningClient:i}=a.getState();if(!r)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return r[i].sendTokens(e,t,n,o,s)},oe=async({senderAddress:e,recipientAddress:t,transferAmount:n,sourcePort:o,sourceChannel:s,timeoutHeight:r,timeoutTimestamp:i,fee:u,memo:p})=>{let{signingClients:m}=a.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,n,o,s,r,i,u,p)},re=async({senderAddress:e,msg:t,fee:n,options:o,label:s,codeId:r})=>{let{signingClients:i}=a.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.instantiate(e,r,t,s,n,o)},ie=async({senderAddress:e,msg:t,fee:n,contractAddress:o})=>{let{signingClients:s}=a.getState();if(!(s!=null&&s.cosmWasm))throw new Error("CosmWasm signing client is not ready");return s.cosmWasm.execute(e,o,t,n)},ae=async(e,t)=>{let{signingClients:n}=a.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm signing client is not ready");return await n.cosmWasm.queryContractSmart(e,t)},ce=(e,t)=>{let{signingClients:n}=a.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm signing client is not ready");let o=new TextEncoder().encode(t);return n.cosmWasm.queryContractRaw(e,o)};import{Bech32Address as Le}from"@keplr-wallet/cosmos";var pe={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Ve={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Ye={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Je={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},$e={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Xe={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},ue=[pe,Ve,Ye,Je,$e,Xe],T={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:pe,bip44:{coinType:118},bech32Config:Le.defaultBech32Config("axelar"),currencies:ue,feeCurrencies:ue};import{Bech32Address as Ze}from"@keplr-wallet/cosmos";var le={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},me=[le],A={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:le,bip44:{coinType:118},bech32Config:Ze.defaultBech32Config("cosmos"),currencies:me,feeCurrencies:me};import{Bech32Address as et}from"@keplr-wallet/cosmos";var de={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},tt={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},nt={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},st={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},ot={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},rt={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},it={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},at={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},ct={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},ut={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},pt={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},ge=[de,tt,nt,st,ot,rt,it,at,ct,ut,pt],k={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:de,bip44:{coinType:118},bech32Config:et.defaultBech32Config("juno"),currencies:ge,feeCurrencies:ge};import{Bech32Address as mt}from"@keplr-wallet/cosmos";var Ce={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},lt={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},ye=[Ce,lt],v={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Ce,bip44:{coinType:118},bech32Config:mt.defaultBech32Config("osmo"),currencies:ye,feeCurrencies:ye};import{Bech32Address as gt}from"@keplr-wallet/cosmos";var xe={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},fe=[xe],B={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:xe,bip44:{coinType:118},bech32Config:gt.defaultBech32Config("somm"),currencies:fe,feeCurrencies:fe};import{Bech32Address as dt}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"},he=[Ae],q={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:dt.defaultBech32Config("CRE"),currencies:he,feeCurrencies:he,stakeCurrency:Ae,coinType:118};import{Bech32Address as yt}from"@keplr-wallet/cosmos";var U={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Ct=[U],R={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:U,bip44:{coinType:118},bech32Config:yt.defaultBech32Config("juno"),currencies:Ct,feeCurrencies:[U],coinType:118};import{Bech32Address as ft}from"@keplr-wallet/cosmos";var G={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},xt=[G],M={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:ft.defaultBech32Config("osmo"),currencies:xt,feeCurrencies:[G],coinType:118};var Se=e=>e,os=e=>e,rs=e=>e,is=Se({axelar:T,cosmos:A,cosmoshub:A,juno:k,osmosis:v,sommelier:B}),as=[T,A,k,v,B],cs=Se({crescent:q,juno:R,osmosis:M}),us=[q,R,M];import{useMutation as Ee,useQuery as K}from"@tanstack/react-query";import{useEffect as At}from"react";import St from"zustand/shallow";import{useQuery as ht}from"@tanstack/react-query";var ys=()=>f("keplr"),f=e=>{let n=["USE_CHECK_WALLET",a(s=>e||s.walletType)];return ht(n,({queryKey:[,s]})=>D(s))};var g=({onConnect:e,onDisconnect:t}={})=>{let n=a(s=>s.account),o=a(s=>s.status);return At(()=>a.subscribe(s=>s.status,(s,r)=>{if(s==="connected"){let i=a.getState();e==null||e({account:i.account,isReconnect:r==="reconnecting"})}s==="disconnected"&&(t==null||t())}),[e,t]),{data:n,isConnected:Boolean(n),isConnecting:o==="connecting",isDisconnected:o==="disconnected",isReconnecting:o==="reconnecting",reconnect:d,status:o}},Et=e=>{let{data:t}=g(),n=e||(t==null?void 0:t.bech32Address);return K(["USE_BALANCES",n],({queryKey:[,r]})=>te(r),{enabled:Boolean(n)})},Ds=(e,t)=>{let{data:n}=Et(t);return K(["USE_BALANCE",n,e,t],({queryKey:[,r]})=>r==null?void 0:r.find(i=>i.denom===e),{enabled:Boolean(n)})},js=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=Ee(["USE_CONNECT",e,t,n],C,{onError:(i,u)=>Promise.resolve(e==null?void 0:e(i,u)),onMutate:t,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:r}=f();return{connect:i=>s.mutate(i),connectAsync:i=>s.mutateAsync(i),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:Boolean(r),status:s.status}},Is=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=Ee(["USE_DISCONNECT",e,t,n],H,{onError:r=>Promise.resolve(e==null?void 0:e(r,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:r=>s.mutate(r),disconnectAsync:r=>s.mutateAsync(r),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,status:s.status}},bt=()=>a(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),St),Ts=()=>bt(),ks=e=>{let{data:t}=g(),n=e||(t==null?void 0:t.bech32Address);return K(["USE_BALANCE_STAKED",n],({queryKey:[,r]})=>ne(n),{enabled:Boolean(n)})};import{useMutation as be,useQuery as we}from"@tanstack/react-query";var Ms=()=>a(e=>e.activeChain),Ks=e=>we(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,o]})=>V(o)),Qs=(e,t="BOND_STATUS_BONDED")=>we(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,s,r]})=>s.staking.validators(r),{enabled:typeof e<"u"}),Ps=()=>({data:a(t=>t.recentChain),clear:L}),Os=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=be(["USE_SUGGEST_CHAIN",e,t,n],j,{onError:(r,i)=>Promise.resolve(e==null?void 0:e(r,i)),onMutate:t,onSuccess:r=>Promise.resolve(n==null?void 0:n(r))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,suggest:s.mutate,suggestAsync:s.mutateAsync,status:s.status}},zs=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=be(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,n],Y,{onError:(i,u)=>Promise.resolve(e==null?void 0:e(i,u)),onMutate:i=>t==null?void 0:t(i),onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:r}=f();return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:Boolean(r),status:s.status,suggestAndConnect:s.mutate,suggestAndConnectAsync:s.mutateAsync}};import{useQuery as De}from"@tanstack/react-query";import{useQuery as wt}from"@tanstack/react-query";var Hs=(...e)=>{let t=["USE_QUERY_CLIENT",...e];return wt(t,({queryKey:[,...o]})=>_(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var Xs=e=>{let t=a(s=>s.clients);return De(["USE_CLIENTS",e,t],({queryKey:[,s,r]})=>s!=null&&s.rpc?x(s):r,{refetchOnMount:!1,refetchOnWindowFocus:!1})},Zs=e=>{let t=a(s=>s.signingClients);return De(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,s,r]})=>s!=null&&s.rpc?h(s):r,{refetchOnMount:!1,refetchOnWindowFocus:!1})};import{useMutation as Dt,useQuery as S}from"@tanstack/react-query";var ro=({address:e,isTestnet:t})=>S(["USE_ADRESS_TO_IBC_DOMAIN",e,t],()=>$(e,t),{enabled:Boolean(e)}),io=({ibcDomain:e,isTestnet:t})=>S(["USE_IBC_DOMAIN_TO_ADDRESSES",e,t],()=>X(e,t),{enabled:Boolean(e)}),ao=({ibcDomain:e,prefix:t,isTestnet:n})=>S(["USE_IBC_DOMAIN_TO_CHAIN_ADDRESS",t,e,n],()=>I(e,t,n),{enabled:Boolean(e&&t)}),co=({ibcDomain:e,isTestnet:t})=>S(["USE_IBC_DOMAIN_DETAILS",e,t],()=>Z(e,t),{enabled:Boolean(e)}),uo=({onError:e,onLoading:t,onSuccess:n}={})=>{let s=Dt(["USE_RESOLVE_TO_CHAIN_ADDRESS",e,t,n],ee,{onError:(r,i)=>Promise.resolve(e==null?void 0:e(r,i)),onMutate:t,onSuccess:r=>Promise.resolve(n==null?void 0:n(r))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,resolveToChainAddress:s.mutate,resolveToChainAddressAsync:s.mutateAsync,status:s.status}};import{useMutation as E,useQuery as je}from"@tanstack/react-query";var Co=({onError:e,onLoading:t,onSuccess:n}={})=>{let{data:o}=g(),s=o==null?void 0:o.bech32Address,i=E(["USE_SEND_TOKENS",e,t,n,s],u=>se({senderAddress:s,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(n==null?void 0:n(u))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},fo=({onError:e,onLoading:t,onSuccess:n}={})=>{let{data:o}=g(),s=o==null?void 0:o.bech32Address,i=E(["USE_SEND_IBC_TOKENS",e,t,n,s],u=>oe({senderAddress:s,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(n==null?void 0:n(u))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},xo=({codeId:e,onError:t,onLoading:n,onSuccess:o})=>{let{data:s}=g(),r=s==null?void 0:s.bech32Address,p=E(["USE_INSTANTIATE_CONTRACT",t,n,o,e,r],m=>{if(!r)throw new Error("senderAddress is undefined");let l={...m,fee:m.fee??"auto",senderAddress:r,codeId:e};return re(l)},{onError:(m,l)=>Promise.resolve(t==null?void 0:t(m,l)),onMutate:n,onSuccess:m=>Promise.resolve(o==null?void 0:o(m))});return{error:p.error,isLoading:p.isLoading,isSuccess:p.isSuccess,instantiateContract:p.mutate,instantiateContractAsync:p.mutateAsync,status:p.status}},ho=({contractAddress:e,onError:t,onLoading:n,onSuccess:o})=>{let{data:s}=g(),r=s==null?void 0:s.bech32Address,p=E(["USE_EXECUTE_CONTRACT",t,n,o,e,r],m=>{if(!r)throw new Error("senderAddress is undefined");let l={...m,fee:m.fee??"auto",senderAddress:r,contractAddress:e};return ie(l)},{onError:(m,l)=>Promise.resolve(t==null?void 0:t(m,l)),onMutate:n,onSuccess:m=>Promise.resolve(o==null?void 0:o(m))});return{error:p.error,isLoading:p.isLoading,isSuccess:p.isSuccess,executeContract:p.mutate,executeContractAsync:p.mutateAsync,status:p.status}},Ao=(e,t)=>je(["USE_QUERY_SMART",e,t],({queryKey:[,s]})=>{if(!e||!t)throw new Error("address or queryMsg undefined");return ae(e,t)},{enabled:Boolean(e)&&Boolean(t)}),So=(e,t)=>je(["USE_QUERY_RAW",t,e],({queryKey:[,s]})=>{if(!e||!t)throw new Error("address or key undefined");return ce(e,t)},{enabled:Boolean(e)&&Boolean(t)});import{QueryClient as Tt,QueryClientProvider as kt}from"@tanstack/react-query";import{useEffect as jt}from"react";var It=()=>(jt(()=>{let{_reconnect:e}=a.getState();return e&&d(),window.addEventListener("keplr_keystorechange",d),()=>{window.removeEventListener("keplr_keystorechange",d)}},[]),null),Ie=()=>(It(),null);import{jsx as Bt,jsxs as qt}from"react/jsx-runtime";var vt=new Tt({}),qo=({children:e,grazOptions:t,...n})=>(t&&J(t),qt(kt,{client:vt,...n,children:[Bt(Ie,{}),e]}));export{Ie as GrazEvents,qo as GrazProvider,O as WALLET_TYPES,P as WalletType,D as checkWallet,L as clearRecentChain,J as configureGraz,C as connect,x as createClients,_ as createQueryClient,h as createSigningClients,os as defineChain,rs as defineChainInfo,Se as defineChains,H as disconnect,ie as executeContract,V as getActiveChainCurrency,X as getAddressesByIbcDomain,Zt as getAvailableWallets,ne as getBalanceStaked,te as getBalances,I as getChainAddressByIbcDomain,$ as getIbcDomainByAdress,Z as getIbcDomainDetails,Ke as getKeplr,Qe as getLeap,ce as getQueryRaw,ae as getQuerySmart,ln as getRecentChain,y as getWallet,re as instantiateContract,Ne as isIbcDomainPostfix,is as mainnetChains,as as mainnetChainsArray,d as reconnect,ee as resolveToChainAddress,oe as sendIbcTokens,se as sendTokens,j as suggestChain,Y as suggestChainAndConnect,cs as testnetChains,us as testnetChainsArray,g as useAccount,Ms as useActiveChain,Ks as useActiveChainCurrency,Qs as useActiveChainValidators,ro as useAddressToIbcDomain,Ds as useBalance,ks as useBalanceStaked,Et as useBalances,ys as useCheckKeplr,f as useCheckWallet,Xs as useClients,js as useConnect,Is as useDisconnect,ho as useExecuteContract,It as useGrazEvents,co as useIbcDomainDetails,io as useIbcDomainToAddresses,ao as useIbcDomainToChainAddress,xo as useInstantiateContract,bt as useOfflineSigners,Hs as useQueryClient,So as useQueryRaw,Ao as useQuerySmart,Ps as useRecentChain,uo as useResolveToChainAddress,fo as useSendIbcTokens,Co as useSendTokens,Ts as useSigners,Zs as useSigningClients,Os as useSuggestChain,zs as useSuggestChainAndConnect,He as validateAddress};
|
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.30",
|
|
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",
|
|
@@ -43,7 +43,9 @@
|
|
|
43
43
|
"@keplr-wallet/types": "^0",
|
|
44
44
|
"@tanstack/react-query": "^4",
|
|
45
45
|
"arg": "^5",
|
|
46
|
+
"bech32": "2.0.0",
|
|
46
47
|
"cosmos-directory-client": "0.0.6",
|
|
48
|
+
"ibc-domains-sdk": "1.0.2",
|
|
47
49
|
"zustand": "^4"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|