graz 0.0.27 → 0.0.29
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 +325 -75
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
|
|
2
|
+
import { SigningCosmWasmClientOptions, CosmWasmClient, SigningCosmWasmClient, InstantiateOptions, InstantiateResult, ExecuteResult } from '@cosmjs/cosmwasm-stargate';
|
|
2
3
|
import { ChainInfo, AppCurrency, Key, Keplr } from '@keplr-wallet/types';
|
|
3
4
|
import * as _cosmjs_proto_signing from '@cosmjs/proto-signing';
|
|
4
5
|
import { Coin, OfflineSigner, OfflineDirectSigner } from '@cosmjs/proto-signing';
|
|
5
|
-
import * as _cosmjs_stargate from '@cosmjs/stargate';
|
|
6
6
|
import { QueryClient, StargateClient, SigningStargateClient, SigningStargateClientOptions, StdFee, DeliverTxResponse, StakingExtension } from '@cosmjs/stargate';
|
|
7
7
|
import { Tendermint34Client } from '@cosmjs/tendermint-rpc';
|
|
8
8
|
import { Height } from 'cosmjs-types/ibc/core/client/v1/client';
|
|
@@ -10,6 +10,7 @@ import * as _tanstack_react_query from '@tanstack/react-query';
|
|
|
10
10
|
import { UseQueryResult, QueryClientProviderProps } from '@tanstack/react-query';
|
|
11
11
|
import { BondStatusString } from '@cosmjs/stargate/build/modules/staking/queries';
|
|
12
12
|
import { QueryValidatorsResponse } from 'cosmjs-types/cosmos/staking/v1beta1/query';
|
|
13
|
+
import { FC } from 'react';
|
|
13
14
|
|
|
14
15
|
declare type Dictionary<T = string> = Record<string, T>;
|
|
15
16
|
declare type Maybe<T> = T | undefined;
|
|
@@ -52,7 +53,7 @@ interface GrazChain {
|
|
|
52
53
|
* connect(myChains.cosmoshub);
|
|
53
54
|
* ```
|
|
54
55
|
*/
|
|
55
|
-
declare
|
|
56
|
+
declare const defineChains: <T extends Dictionary<GrazChain>>(chains: T) => T;
|
|
56
57
|
/**
|
|
57
58
|
* Helper function to define chain information object.
|
|
58
59
|
*
|
|
@@ -73,7 +74,7 @@ declare function defineChains<T extends Dictionary<GrazChain>>(chains: T): T;
|
|
|
73
74
|
* connect(cosmoshub);
|
|
74
75
|
* ```
|
|
75
76
|
*/
|
|
76
|
-
declare
|
|
77
|
+
declare const defineChain: <T extends GrazChain>(chain: T) => T;
|
|
77
78
|
/**
|
|
78
79
|
* Helper function to define Keplr's `ChainInfo` object.
|
|
79
80
|
*
|
|
@@ -94,7 +95,7 @@ declare function defineChain<T extends GrazChain>(chain: T): T;
|
|
|
94
95
|
* });
|
|
95
96
|
* ```
|
|
96
97
|
*/
|
|
97
|
-
declare
|
|
98
|
+
declare const defineChainInfo: <T extends ChainInfoWithPath | ChainInfo>(chain: T) => T;
|
|
98
99
|
/**
|
|
99
100
|
* Provided mainnet chains
|
|
100
101
|
*
|
|
@@ -154,31 +155,34 @@ declare type ConnectArgs = Maybe<GrazChain & {
|
|
|
154
155
|
signerOpts?: SigningCosmWasmClientOptions;
|
|
155
156
|
walletType?: WalletType;
|
|
156
157
|
}>;
|
|
157
|
-
declare
|
|
158
|
-
declare
|
|
159
|
-
declare
|
|
158
|
+
declare const connect: (args?: ConnectArgs) => Promise<Key>;
|
|
159
|
+
declare const disconnect: (clearRecentChain?: boolean) => Promise<void>;
|
|
160
|
+
declare const reconnect: () => void;
|
|
160
161
|
|
|
161
162
|
declare type ExtensionSetup<P extends object = object> = (queryClient: QueryClient) => P;
|
|
162
163
|
|
|
164
|
+
interface CreateQueryClient {
|
|
165
|
+
(): QueryClient;
|
|
166
|
+
<A extends object>(setupA: ExtensionSetup<A>): QueryClient & A;
|
|
167
|
+
<A extends object, B extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>): QueryClient & A & B;
|
|
168
|
+
<A extends object, B extends object, C extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>): QueryClient & A & B & C;
|
|
169
|
+
<A extends object, B extends object, C extends object, D extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>): QueryClient & A & B & C & D;
|
|
170
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>): QueryClient & A & B & C & D & E;
|
|
171
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>): QueryClient & A & B & C & D & E & F;
|
|
172
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>): QueryClient & A & B & C & D & E & F & G;
|
|
173
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object, H extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>, setupH: ExtensionSetup<H>): QueryClient & A & B & C & D & E & F & G & H;
|
|
174
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object, H extends object, I extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>, setupH: ExtensionSetup<H>, setupI: ExtensionSetup<I>): QueryClient & A & B & C & D & E & F & G & H & I;
|
|
175
|
+
}
|
|
163
176
|
/**
|
|
164
177
|
* Note: `createQueryClient` creates \@cosmjs/stargate's {@link QueryClient},
|
|
165
178
|
* NOT to be confused with \@tanstack/react-query query client
|
|
166
179
|
*/
|
|
167
|
-
declare
|
|
168
|
-
declare function createQueryClient<A extends object>(setupA: ExtensionSetup<A>): QueryClient & A;
|
|
169
|
-
declare function createQueryClient<A extends object, B extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>): QueryClient & A & B;
|
|
170
|
-
declare function createQueryClient<A extends object, B extends object, C extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>): QueryClient & A & B & C;
|
|
171
|
-
declare function createQueryClient<A extends object, B extends object, C extends object, D extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>): QueryClient & A & B & C & D;
|
|
172
|
-
declare function createQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>): QueryClient & A & B & C & D & E;
|
|
173
|
-
declare function createQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>): QueryClient & A & B & C & D & E & F;
|
|
174
|
-
declare function createQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>): QueryClient & A & B & C & D & E & F & G;
|
|
175
|
-
declare function createQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object, H extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>, setupH: ExtensionSetup<H>): QueryClient & A & B & C & D & E & F & G & H;
|
|
176
|
-
declare function createQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object, H extends object, I extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>, setupH: ExtensionSetup<H>, setupI: ExtensionSetup<I>): QueryClient & A & B & C & D & E & F & G & H & I;
|
|
180
|
+
declare const createQueryClient: CreateQueryClient;
|
|
177
181
|
|
|
178
|
-
declare
|
|
179
|
-
declare
|
|
180
|
-
declare
|
|
181
|
-
declare
|
|
182
|
+
declare const clearRecentChain: () => void;
|
|
183
|
+
declare const getActiveChainCurrency: (denom: string) => AppCurrency | undefined;
|
|
184
|
+
declare const getRecentChain: () => GrazChain | null;
|
|
185
|
+
declare const suggestChain: (chainInfo: ChainInfo) => Promise<ChainInfo>;
|
|
182
186
|
interface SuggestChainAndConnectArgs {
|
|
183
187
|
chainInfo: ChainInfo;
|
|
184
188
|
signerOpts?: SigningCosmWasmClientOptions;
|
|
@@ -190,7 +194,7 @@ interface SuggestChainAndConnectArgs {
|
|
|
190
194
|
rpcHeaders?: Dictionary;
|
|
191
195
|
path?: string;
|
|
192
196
|
}
|
|
193
|
-
declare
|
|
197
|
+
declare const suggestChainAndConnect: ({ chainInfo, ...rest }: SuggestChainAndConnectArgs) => Promise<{
|
|
194
198
|
account: Key;
|
|
195
199
|
chain: ChainInfo;
|
|
196
200
|
}>;
|
|
@@ -221,13 +225,13 @@ interface GrazStore {
|
|
|
221
225
|
}
|
|
222
226
|
|
|
223
227
|
declare type CreateClientArgs = Pick<GrazChain, "rpc" | "rpcHeaders">;
|
|
224
|
-
declare
|
|
228
|
+
declare const createClients: ({ rpc, rpcHeaders }: CreateClientArgs) => Promise<GrazStore["clients"]>;
|
|
225
229
|
declare type CreateSigningClientArgs = CreateClientArgs & {
|
|
226
230
|
offlineSignerAuto: OfflineSigner | OfflineDirectSigner;
|
|
227
231
|
cosmWasmSignerOptions?: SigningCosmWasmClientOptions;
|
|
228
232
|
stargateSignerOptions?: SigningStargateClientOptions;
|
|
229
233
|
};
|
|
230
|
-
declare
|
|
234
|
+
declare const createSigningClients: (args: CreateSigningClientArgs) => Promise<GrazStore["signingClients"]>;
|
|
231
235
|
|
|
232
236
|
interface ConfigureGrazArgs {
|
|
233
237
|
defaultChain?: GrazChain;
|
|
@@ -235,10 +239,41 @@ interface ConfigureGrazArgs {
|
|
|
235
239
|
defaultWallet?: WalletType;
|
|
236
240
|
onNotFound?: () => void;
|
|
237
241
|
}
|
|
238
|
-
declare
|
|
242
|
+
declare const configureGraz: (args?: ConfigureGrazArgs) => ConfigureGrazArgs;
|
|
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
|
+
declare 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
|
+
declare type ChainPrefix = (string & {}) | KnownChainPrefix;
|
|
253
|
+
interface DomainDetails {
|
|
254
|
+
expiration: string;
|
|
255
|
+
imageData: string;
|
|
256
|
+
twitterId: string;
|
|
257
|
+
discordId: string;
|
|
258
|
+
telegramId: string;
|
|
259
|
+
keybaseId: string;
|
|
260
|
+
pgpPublicKey: string;
|
|
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>;
|
|
239
274
|
|
|
240
|
-
declare
|
|
241
|
-
declare
|
|
275
|
+
declare const getBalances: (bech32Address: string) => Promise<Coin[]>;
|
|
276
|
+
declare const getBalanceStaked: (bech32Address: string) => Promise<Coin | null>;
|
|
242
277
|
interface SendTokensArgs {
|
|
243
278
|
senderAddress?: string;
|
|
244
279
|
recipientAddress: string;
|
|
@@ -246,7 +281,7 @@ interface SendTokensArgs {
|
|
|
246
281
|
fee: number | StdFee | "auto";
|
|
247
282
|
memo?: string;
|
|
248
283
|
}
|
|
249
|
-
declare
|
|
284
|
+
declare const sendTokens: ({ senderAddress, recipientAddress, amount, fee, memo, }: SendTokensArgs) => Promise<DeliverTxResponse>;
|
|
250
285
|
interface SendIbcTokensArgs {
|
|
251
286
|
senderAddress?: string;
|
|
252
287
|
recipientAddress: string;
|
|
@@ -258,7 +293,31 @@ interface SendIbcTokensArgs {
|
|
|
258
293
|
fee: number | StdFee | "auto";
|
|
259
294
|
memo: string;
|
|
260
295
|
}
|
|
261
|
-
declare
|
|
296
|
+
declare const sendIbcTokens: ({ senderAddress, recipientAddress, transferAmount, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, fee, memo, }: SendIbcTokensArgs) => Promise<DeliverTxResponse>;
|
|
297
|
+
interface InstantiateContractArgs<Message extends Record<string, unknown>> {
|
|
298
|
+
msg: Message;
|
|
299
|
+
label: string;
|
|
300
|
+
fee: StdFee | "auto" | number;
|
|
301
|
+
options?: InstantiateOptions;
|
|
302
|
+
senderAddress: string;
|
|
303
|
+
codeId: number;
|
|
304
|
+
}
|
|
305
|
+
declare type InstantiateContractMutationArgs<Message extends Record<string, unknown>> = Omit<InstantiateContractArgs<Message>, "codeId" | "senderAddress" | "fee"> & {
|
|
306
|
+
fee?: StdFee | "auto" | number;
|
|
307
|
+
};
|
|
308
|
+
declare const instantiateContract: <Message extends Record<string, unknown>>({ senderAddress, msg, fee, options, label, codeId, }: InstantiateContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
|
|
309
|
+
interface ExecuteContractArgs<Message extends Record<string, unknown>> {
|
|
310
|
+
msg: Message;
|
|
311
|
+
fee: StdFee | "auto" | number;
|
|
312
|
+
senderAddress: string;
|
|
313
|
+
contractAddress: string;
|
|
314
|
+
}
|
|
315
|
+
declare type ExecuteContractMutationArgs<Message extends Record<string, unknown>> = Omit<ExecuteContractArgs<Message>, "contractAddress" | "senderAddress" | "fee"> & {
|
|
316
|
+
fee?: StdFee | "auto" | number;
|
|
317
|
+
};
|
|
318
|
+
declare const executeContract: <Message extends Record<string, unknown>>({ senderAddress, msg, fee, contractAddress, }: ExecuteContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.ExecuteResult>;
|
|
319
|
+
declare const getQuerySmart: <TData>(address: string, queryMsg: Record<string, unknown>) => Promise<TData>;
|
|
320
|
+
declare const getQueryRaw: (address: string, keyStr: string) => Promise<Uint8Array | null>;
|
|
262
321
|
|
|
263
322
|
/**
|
|
264
323
|
* Function to check whether given {@link WalletType} or default configured wallet exists.
|
|
@@ -269,7 +328,7 @@ declare function sendIbcTokens({ senderAddress, recipientAddress, transferAmount
|
|
|
269
328
|
* const isKeplrSupported = checkWallet("keplr");
|
|
270
329
|
* ```
|
|
271
330
|
*/
|
|
272
|
-
declare
|
|
331
|
+
declare const checkWallet: (type?: WalletType) => boolean;
|
|
273
332
|
/**
|
|
274
333
|
* Function to return {@link Keplr} object and throws and error if it does not exist on `window`.
|
|
275
334
|
*
|
|
@@ -284,7 +343,7 @@ declare function checkWallet(type?: WalletType): boolean;
|
|
|
284
343
|
*
|
|
285
344
|
* @see https://docs.keplr.app
|
|
286
345
|
*/
|
|
287
|
-
declare
|
|
346
|
+
declare const getKeplr: () => Keplr;
|
|
288
347
|
/**
|
|
289
348
|
* Function to return Leap object (which is {@link Keplr}) and throws and error if it does not exist on `window`.
|
|
290
349
|
*
|
|
@@ -299,7 +358,7 @@ declare function getKeplr(): Keplr;
|
|
|
299
358
|
*
|
|
300
359
|
* @see https://docs.keplr.app
|
|
301
360
|
*/
|
|
302
|
-
declare
|
|
361
|
+
declare const getLeap: () => Keplr;
|
|
303
362
|
/**
|
|
304
363
|
* Function to return wallet object based on given {@link WalletType} or from store and throws an error if it does not
|
|
305
364
|
* exist on `window` or unknown wallet type.
|
|
@@ -312,8 +371,8 @@ declare function getLeap(): Keplr;
|
|
|
312
371
|
*
|
|
313
372
|
* @see {@link getKeplr}
|
|
314
373
|
*/
|
|
315
|
-
declare
|
|
316
|
-
declare
|
|
374
|
+
declare const getWallet: (type?: WalletType) => Keplr;
|
|
375
|
+
declare const getAvailableWallets: () => Record<WalletType, boolean>;
|
|
317
376
|
|
|
318
377
|
interface GrazAdapter {
|
|
319
378
|
name: string;
|
|
@@ -351,13 +410,13 @@ interface UseAccountArgs {
|
|
|
351
410
|
* });
|
|
352
411
|
* ```
|
|
353
412
|
*/
|
|
354
|
-
declare
|
|
413
|
+
declare const useAccount: ({ onConnect, onDisconnect }?: UseAccountArgs) => {
|
|
355
414
|
data: Key | null;
|
|
356
415
|
isConnected: boolean;
|
|
357
416
|
isConnecting: boolean;
|
|
358
417
|
isDisconnected: boolean;
|
|
359
418
|
isReconnecting: boolean;
|
|
360
|
-
reconnect:
|
|
419
|
+
reconnect: () => void;
|
|
361
420
|
status: "connected" | "connecting" | "reconnecting" | "disconnected";
|
|
362
421
|
};
|
|
363
422
|
/**
|
|
@@ -376,7 +435,7 @@ declare function useAccount({ onConnect, onDisconnect }?: UseAccountArgs): {
|
|
|
376
435
|
* useBalances("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
|
|
377
436
|
* ```
|
|
378
437
|
*/
|
|
379
|
-
declare
|
|
438
|
+
declare const useBalances: (bech32Address?: string) => UseQueryResult<Coin[]>;
|
|
380
439
|
/**
|
|
381
440
|
* graz query hook to retrieve specific asset balance from current account or given address.
|
|
382
441
|
*
|
|
@@ -394,7 +453,7 @@ declare function useBalances(bech32Address?: string): UseQueryResult<Coin[]>;
|
|
|
394
453
|
* useBalance("atom", "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
|
|
395
454
|
* ```
|
|
396
455
|
*/
|
|
397
|
-
declare
|
|
456
|
+
declare const useBalance: (denom: string, bech32Address?: string) => UseQueryResult<Coin | undefined>;
|
|
398
457
|
declare type UseConnectChainArgs = MutationEventArgs<ConnectArgs, Key>;
|
|
399
458
|
/**
|
|
400
459
|
* graz mutation hook to execute wallet connection with optional arguments to
|
|
@@ -428,7 +487,7 @@ declare type UseConnectChainArgs = MutationEventArgs<ConnectArgs, Key>;
|
|
|
428
487
|
*
|
|
429
488
|
* @see {@link connect}
|
|
430
489
|
*/
|
|
431
|
-
declare
|
|
490
|
+
declare const useConnect: ({ onError, onLoading, onSuccess }?: UseConnectChainArgs) => {
|
|
432
491
|
connect: (args?: ConnectArgs) => void;
|
|
433
492
|
connectAsync: (args?: ConnectArgs) => Promise<Key>;
|
|
434
493
|
error: unknown;
|
|
@@ -461,7 +520,7 @@ declare function useConnect({ onError, onLoading, onSuccess }?: UseConnectChainA
|
|
|
461
520
|
*
|
|
462
521
|
* @see {@link disconnect}
|
|
463
522
|
*/
|
|
464
|
-
declare
|
|
523
|
+
declare const useDisconnect: ({ onError, onLoading, onSuccess }?: MutationEventArgs) => {
|
|
465
524
|
disconnect: (forget?: boolean) => void;
|
|
466
525
|
disconnectAsync: (forget?: boolean) => Promise<void>;
|
|
467
526
|
error: unknown;
|
|
@@ -480,7 +539,7 @@ declare function useDisconnect({ onError, onLoading, onSuccess }?: MutationEvent
|
|
|
480
539
|
* const { signer, signerAmino, signerAuto } = useOfflineSigners();
|
|
481
540
|
* ```
|
|
482
541
|
*/
|
|
483
|
-
declare
|
|
542
|
+
declare const useOfflineSigners: () => {
|
|
484
543
|
signer: (_cosmjs_proto_signing.OfflineSigner & _cosmjs_proto_signing.OfflineDirectSigner) | null;
|
|
485
544
|
signerAmino: _cosmjs_proto_signing.OfflineSigner | null;
|
|
486
545
|
signerAuto: _cosmjs_proto_signing.OfflineSigner | null;
|
|
@@ -491,7 +550,7 @@ declare function useOfflineSigners(): {
|
|
|
491
550
|
* @deprecated prefer using {@link useOfflineSigners}
|
|
492
551
|
* @see {@link useOfflineSigners}
|
|
493
552
|
*/
|
|
494
|
-
declare
|
|
553
|
+
declare const useSigners: () => {
|
|
495
554
|
signer: (_cosmjs_proto_signing.OfflineSigner & _cosmjs_proto_signing.OfflineDirectSigner) | null;
|
|
496
555
|
signerAmino: _cosmjs_proto_signing.OfflineSigner | null;
|
|
497
556
|
signerAuto: _cosmjs_proto_signing.OfflineSigner | null;
|
|
@@ -512,7 +571,7 @@ declare function useSigners(): {
|
|
|
512
571
|
* useBalanceStaked("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
|
|
513
572
|
* ```
|
|
514
573
|
*/
|
|
515
|
-
declare
|
|
574
|
+
declare const useBalanceStaked: (bech32Address?: string) => UseQueryResult<Coin | null>;
|
|
516
575
|
|
|
517
576
|
/**
|
|
518
577
|
* graz hook to retrieve connected account's active chain
|
|
@@ -523,7 +582,7 @@ declare function useBalanceStaked(bech32Address?: string): UseQueryResult<Coin |
|
|
|
523
582
|
* const { rpc, rest, chainId, currencies } = useActiveChain();
|
|
524
583
|
* ```
|
|
525
584
|
*/
|
|
526
|
-
declare
|
|
585
|
+
declare const useActiveChain: () => GrazChain | null;
|
|
527
586
|
/**
|
|
528
587
|
* graz hook to retrieve specific connected account's currency
|
|
529
588
|
*
|
|
@@ -535,7 +594,7 @@ declare function useActiveChain(): GrazChain | null;
|
|
|
535
594
|
* const { data: currency, ... } = useActiveChainCurrency("juno");
|
|
536
595
|
* ```
|
|
537
596
|
*/
|
|
538
|
-
declare
|
|
597
|
+
declare const useActiveChainCurrency: (denom: string) => UseQueryResult<AppCurrency | undefined>;
|
|
539
598
|
/**
|
|
540
599
|
* graz hook to retrieve active chain validators with given query client and optional bond status
|
|
541
600
|
*
|
|
@@ -551,7 +610,7 @@ declare function useActiveChainCurrency(denom: string): UseQueryResult<AppCurren
|
|
|
551
610
|
* const { data: response, ... } = useActiveChainValidators(queryClient);
|
|
552
611
|
* ```
|
|
553
612
|
*/
|
|
554
|
-
declare
|
|
613
|
+
declare const useActiveChainValidators: <T extends QueryClient & StakingExtension>(queryClient: T | undefined, status?: BondStatusString) => UseQueryResult<QueryValidatorsResponse>;
|
|
555
614
|
/**
|
|
556
615
|
* graz hook to retrieve last connected chain info
|
|
557
616
|
*
|
|
@@ -568,9 +627,9 @@ declare function useActiveChainValidators<T extends QueryClient & StakingExtensi
|
|
|
568
627
|
*
|
|
569
628
|
* @see {@link useActiveChain}
|
|
570
629
|
*/
|
|
571
|
-
declare
|
|
630
|
+
declare const useRecentChain: () => {
|
|
572
631
|
data: GrazChain | null;
|
|
573
|
-
clear:
|
|
632
|
+
clear: () => void;
|
|
574
633
|
};
|
|
575
634
|
declare type UseSuggestChainArgs = MutationEventArgs<ChainInfo>;
|
|
576
635
|
/**
|
|
@@ -589,7 +648,7 @@ declare type UseSuggestChainArgs = MutationEventArgs<ChainInfo>;
|
|
|
589
648
|
* });
|
|
590
649
|
* ```
|
|
591
650
|
*/
|
|
592
|
-
declare
|
|
651
|
+
declare const useSuggestChain: ({ onError, onLoading, onSuccess }?: UseSuggestChainArgs) => {
|
|
593
652
|
error: unknown;
|
|
594
653
|
isLoading: boolean;
|
|
595
654
|
isSuccess: boolean;
|
|
@@ -631,7 +690,7 @@ declare type UseSuggestChainAndConnectArgs = MutationEventArgs<SuggestChainAndCo
|
|
|
631
690
|
* });
|
|
632
691
|
* ```
|
|
633
692
|
*/
|
|
634
|
-
declare
|
|
693
|
+
declare const useSuggestChainAndConnect: ({ onError, onLoading, onSuccess }?: UseSuggestChainAndConnectArgs) => {
|
|
635
694
|
error: unknown;
|
|
636
695
|
isLoading: boolean;
|
|
637
696
|
isSuccess: boolean;
|
|
@@ -647,6 +706,18 @@ declare function useSuggestChainAndConnect({ onError, onLoading, onSuccess }?: U
|
|
|
647
706
|
}, unknown, SuggestChainAndConnectArgs, unknown>;
|
|
648
707
|
};
|
|
649
708
|
|
|
709
|
+
interface UseQueryClient {
|
|
710
|
+
(): UseQueryResult<QueryClient>;
|
|
711
|
+
<A extends object>(setupA: ExtensionSetup<A>): UseQueryResult<QueryClient & A>;
|
|
712
|
+
<A extends object, B extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>): UseQueryResult<QueryClient & A & B>;
|
|
713
|
+
<A extends object, B extends object, C extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>): UseQueryResult<QueryClient & A & B & C>;
|
|
714
|
+
<A extends object, B extends object, C extends object, D extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>): UseQueryResult<QueryClient & A & B & C & D>;
|
|
715
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>): UseQueryResult<QueryClient & A & B & C & D & E>;
|
|
716
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>): UseQueryResult<QueryClient & A & B & C & D & E & F>;
|
|
717
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>): UseQueryResult<QueryClient & A & B & C & D & E & F & G>;
|
|
718
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object, H extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>, setupH: ExtensionSetup<H>): UseQueryResult<QueryClient & A & B & C & D & E & F & G & H>;
|
|
719
|
+
<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object, H extends object, I extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>, setupH: ExtensionSetup<H>, setupI: ExtensionSetup<I>): UseQueryResult<QueryClient & A & B & C & D & E & F & G & H & I>;
|
|
720
|
+
}
|
|
650
721
|
/**
|
|
651
722
|
* graz query hook to create and use {@link QueryClient} similar when using {@link QueryClient.withExtensions}.
|
|
652
723
|
*
|
|
@@ -669,16 +740,7 @@ declare function useSuggestChainAndConnect({ onError, onLoading, onSuccess }?: U
|
|
|
669
740
|
*
|
|
670
741
|
* @see {@link createQueryClient}
|
|
671
742
|
*/
|
|
672
|
-
declare
|
|
673
|
-
declare function useQueryClient<A extends object>(setupA: ExtensionSetup<A>): UseQueryResult<QueryClient & A>;
|
|
674
|
-
declare function useQueryClient<A extends object, B extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>): UseQueryResult<QueryClient & A & B>;
|
|
675
|
-
declare function useQueryClient<A extends object, B extends object, C extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>): UseQueryResult<QueryClient & A & B & C>;
|
|
676
|
-
declare function useQueryClient<A extends object, B extends object, C extends object, D extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>): UseQueryResult<QueryClient & A & B & C & D>;
|
|
677
|
-
declare function useQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>): UseQueryResult<QueryClient & A & B & C & D & E>;
|
|
678
|
-
declare function useQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>): UseQueryResult<QueryClient & A & B & C & D & E & F>;
|
|
679
|
-
declare function useQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>): UseQueryResult<QueryClient & A & B & C & D & E & F & G>;
|
|
680
|
-
declare function useQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object, H extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>, setupH: ExtensionSetup<H>): UseQueryResult<QueryClient & A & B & C & D & E & F & G & H>;
|
|
681
|
-
declare function useQueryClient<A extends object, B extends object, C extends object, D extends object, E extends object, F extends object, G extends object, H extends object, I extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>, setupD: ExtensionSetup<D>, setupE: ExtensionSetup<E>, setupF: ExtensionSetup<F>, setupG: ExtensionSetup<G>, setupH: ExtensionSetup<H>, setupI: ExtensionSetup<I>): UseQueryResult<QueryClient & A & B & C & D & E & F & G & H & I>;
|
|
743
|
+
declare const useQueryClient: UseQueryClient;
|
|
682
744
|
|
|
683
745
|
/**
|
|
684
746
|
* graz query hook to retrieve a CosmWasmClient, StargateClient and Tendermint34Client. If there's no given arguments it will be using the current connected client
|
|
@@ -694,7 +756,7 @@ declare function useQueryClient<A extends object, B extends object, C extends ob
|
|
|
694
756
|
* useClient({ rpc: "https://rpc.cosmoshub.strange.love", });
|
|
695
757
|
* ```
|
|
696
758
|
*/
|
|
697
|
-
declare
|
|
759
|
+
declare const useClients: (args?: CreateClientArgs) => UseQueryResult<GrazStore["clients"]>;
|
|
698
760
|
/**
|
|
699
761
|
* graz query hook to retrieve a SigningCosmWasmClient. If there's no given args it will be using the current connected signer
|
|
700
762
|
*
|
|
@@ -713,7 +775,112 @@ declare function useClients(args?: CreateClientArgs): UseQueryResult<GrazStore["
|
|
|
713
775
|
* });
|
|
714
776
|
* ```
|
|
715
777
|
*/
|
|
716
|
-
declare
|
|
778
|
+
declare const useSigningClients: (args?: CreateSigningClientArgs) => UseQueryResult<GrazStore["signingClients"]>;
|
|
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
|
+
declare const useIbcDomainDetails: ({ ibcDomain, isTestnet }: {
|
|
847
|
+
ibcDomain?: string | undefined;
|
|
848
|
+
isTestnet?: boolean | undefined;
|
|
849
|
+
}) => UseQueryResult<DomainDetails | null, unknown>;
|
|
850
|
+
declare type UseResolveToChainAddressArgs = MutationEventArgs<ResolveToChainAddressArgs, string>;
|
|
851
|
+
/**
|
|
852
|
+
* graz mutation hook to resolve an Ibc domain or an address to bech32 address from given string
|
|
853
|
+
*
|
|
854
|
+
* @example
|
|
855
|
+
* ```ts
|
|
856
|
+
* import { useResolveToChainAddress } from "graz";
|
|
857
|
+
*
|
|
858
|
+
* // basic example
|
|
859
|
+
* const { resolveToChainAddress } = useResolveToChainAddress();
|
|
860
|
+
*
|
|
861
|
+
* // with event arguments
|
|
862
|
+
* useResolveToChainAddress({
|
|
863
|
+
* onError: (err, args) => { ... },
|
|
864
|
+
* onLoading: () => { ... },
|
|
865
|
+
* onSuccess: ({ account, address }) => { ... },
|
|
866
|
+
* });
|
|
867
|
+
*
|
|
868
|
+
* // resolveToChainAddress usage
|
|
869
|
+
* resolveToChainAddress({
|
|
870
|
+
* value: "kikiding.cosmos",
|
|
871
|
+
* prefix: "osmo"
|
|
872
|
+
* ...
|
|
873
|
+
* });
|
|
874
|
+
* ```
|
|
875
|
+
*/
|
|
876
|
+
declare const useResolveToChainAddress: ({ onError, onLoading, onSuccess }?: UseResolveToChainAddressArgs) => {
|
|
877
|
+
error: unknown;
|
|
878
|
+
isLoading: boolean;
|
|
879
|
+
isSuccess: boolean;
|
|
880
|
+
resolveToChainAddress: _tanstack_react_query.UseMutateFunction<string, unknown, ResolveToChainAddressArgs, unknown>;
|
|
881
|
+
resolveToChainAddressAsync: _tanstack_react_query.UseMutateAsyncFunction<string, unknown, ResolveToChainAddressArgs, unknown>;
|
|
882
|
+
status: "error" | "idle" | "loading" | "success";
|
|
883
|
+
};
|
|
717
884
|
|
|
718
885
|
/**
|
|
719
886
|
* graz mutation hook to send tokens. Note: if `senderAddress` undefined, it will use current connected account address.
|
|
@@ -734,12 +901,12 @@ declare function useSigningClients(args?: CreateSigningClientArgs): UseQueryResu
|
|
|
734
901
|
*
|
|
735
902
|
* @see {@link sendTokens}
|
|
736
903
|
*/
|
|
737
|
-
declare
|
|
904
|
+
declare const useSendTokens: ({ onError, onLoading, onSuccess, }?: MutationEventArgs<SendTokensArgs, DeliverTxResponse>) => {
|
|
738
905
|
error: unknown;
|
|
739
906
|
isLoading: boolean;
|
|
740
907
|
isSuccess: boolean;
|
|
741
|
-
sendTokens: _tanstack_react_query.UseMutateFunction<
|
|
742
|
-
sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<
|
|
908
|
+
sendTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, unknown, SendTokensArgs, unknown>;
|
|
909
|
+
sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, unknown, SendTokensArgs, unknown>;
|
|
743
910
|
status: "error" | "idle" | "loading" | "success";
|
|
744
911
|
};
|
|
745
912
|
/**
|
|
@@ -760,14 +927,97 @@ declare function useSendTokens({ onError, onLoading, onSuccess }?: MutationEvent
|
|
|
760
927
|
* })
|
|
761
928
|
* ```
|
|
762
929
|
*/
|
|
763
|
-
declare
|
|
930
|
+
declare const useSendIbcTokens: ({ onError, onLoading, onSuccess, }?: MutationEventArgs<SendIbcTokensArgs, DeliverTxResponse>) => {
|
|
931
|
+
error: unknown;
|
|
932
|
+
isLoading: boolean;
|
|
933
|
+
isSuccess: boolean;
|
|
934
|
+
sendIbcTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, unknown, SendIbcTokensArgs, unknown>;
|
|
935
|
+
sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, unknown, SendIbcTokensArgs, unknown>;
|
|
936
|
+
status: "error" | "idle" | "loading" | "success";
|
|
937
|
+
};
|
|
938
|
+
declare type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
|
|
939
|
+
codeId: number;
|
|
940
|
+
} & MutationEventArgs<InstantiateContractMutationArgs<Message>, InstantiateResult>;
|
|
941
|
+
/**
|
|
942
|
+
* graz mutation hook to instantiate a CosmWasm smart contract when supported.
|
|
943
|
+
*
|
|
944
|
+
* @example
|
|
945
|
+
* ```ts
|
|
946
|
+
* import { useInstantiateContract } from "graz"
|
|
947
|
+
*
|
|
948
|
+
* const { instantiateContract: instantiateMyContract } = useInstantiateContract({
|
|
949
|
+
* codeId: 4,
|
|
950
|
+
* onSuccess: ({ contractAddress }) => console.log('Address:', contractAddress)
|
|
951
|
+
* })
|
|
952
|
+
*
|
|
953
|
+
* const instantiateMessage = { foo: 'bar' };
|
|
954
|
+
* instantiateMyContract({
|
|
955
|
+
* msg: instatiateMessage,
|
|
956
|
+
* label: "test"
|
|
957
|
+
* });
|
|
958
|
+
* ```
|
|
959
|
+
*/
|
|
960
|
+
declare const useInstantiateContract: <Message extends Record<string, unknown>>({ codeId, onError, onLoading, onSuccess, }: UseInstantiateContractArgs<Message>) => {
|
|
961
|
+
error: unknown;
|
|
962
|
+
isLoading: boolean;
|
|
963
|
+
isSuccess: boolean;
|
|
964
|
+
instantiateContract: _tanstack_react_query.UseMutateFunction<InstantiateResult, unknown, InstantiateContractMutationArgs<Message>, unknown>;
|
|
965
|
+
instantiateContractAsync: _tanstack_react_query.UseMutateAsyncFunction<InstantiateResult, unknown, InstantiateContractMutationArgs<Message>, unknown>;
|
|
966
|
+
status: "error" | "idle" | "loading" | "success";
|
|
967
|
+
};
|
|
968
|
+
declare type UseExecuteContractArgs<Message extends Record<string, unknown>> = {
|
|
969
|
+
contractAddress: string;
|
|
970
|
+
} & MutationEventArgs<ExecuteContractMutationArgs<Message>, ExecuteResult>;
|
|
971
|
+
/**
|
|
972
|
+
* graz mutation hook for executing transactions against a CosmWasm smart
|
|
973
|
+
* contract.
|
|
974
|
+
*
|
|
975
|
+
* @example
|
|
976
|
+
* ```ts
|
|
977
|
+
* import { useExecuteContract } from "graz"
|
|
978
|
+
*
|
|
979
|
+
* interface GreetMessage {
|
|
980
|
+
* name: string;
|
|
981
|
+
* }
|
|
982
|
+
*
|
|
983
|
+
* interface GreetResponse {
|
|
984
|
+
* message: string;
|
|
985
|
+
* }
|
|
986
|
+
*
|
|
987
|
+
* const contractAddress = "cosmosfoobarbaz";
|
|
988
|
+
* const { executeContract } = useExecuteContract<ExecuteMessage>({ contractAddress });
|
|
989
|
+
* executeContract({ msg: {
|
|
990
|
+
* foo: "bar"
|
|
991
|
+
* }}, {
|
|
992
|
+
* onSuccess: (data: GreetResponse) => console.log('Got message:', data.message);
|
|
993
|
+
* });
|
|
994
|
+
* ```
|
|
995
|
+
*/
|
|
996
|
+
declare const useExecuteContract: <Message extends Record<string, unknown>>({ contractAddress, onError, onLoading, onSuccess, }: UseExecuteContractArgs<Message>) => {
|
|
764
997
|
error: unknown;
|
|
765
998
|
isLoading: boolean;
|
|
766
999
|
isSuccess: boolean;
|
|
767
|
-
|
|
768
|
-
|
|
1000
|
+
executeContract: _tanstack_react_query.UseMutateFunction<ExecuteResult, unknown, ExecuteContractMutationArgs<Message>, unknown>;
|
|
1001
|
+
executeContractAsync: _tanstack_react_query.UseMutateAsyncFunction<ExecuteResult, unknown, ExecuteContractMutationArgs<Message>, unknown>;
|
|
769
1002
|
status: "error" | "idle" | "loading" | "success";
|
|
770
1003
|
};
|
|
1004
|
+
/**
|
|
1005
|
+
* graz query hook for dispatching a "smart" query to a CosmWasm smart
|
|
1006
|
+
* contract.
|
|
1007
|
+
*
|
|
1008
|
+
* @param address - The address of the contract to query
|
|
1009
|
+
* @param queryMsg - The query message to send to the contract
|
|
1010
|
+
* @returns A query result with the result returned by the smart contract.
|
|
1011
|
+
*/
|
|
1012
|
+
declare const useQuerySmart: <TData, TError>(address?: string, queryMsg?: Record<string, unknown>) => UseQueryResult<TData, TError>;
|
|
1013
|
+
/**
|
|
1014
|
+
* graz query hook for dispatching a "raw" query to a CosmWasm smart contract.
|
|
1015
|
+
*
|
|
1016
|
+
* @param address - The address of the contract to query
|
|
1017
|
+
* @param key - The key to lookup in the contract storage
|
|
1018
|
+
* @returns A query result with raw byte array stored at the key queried.
|
|
1019
|
+
*/
|
|
1020
|
+
declare const useQueryRaw: <TError>(address?: string, key?: string) => UseQueryResult<Uint8Array | null, TError>;
|
|
771
1021
|
|
|
772
1022
|
/**
|
|
773
1023
|
* graz hook which returns boolean whether Keplr Wallet is supported
|
|
@@ -781,7 +1031,7 @@ declare function useSendIbcTokens({ onError, onLoading, onSuccess }?: MutationEv
|
|
|
781
1031
|
*
|
|
782
1032
|
* @deprecated prefer using {@link useCheckWallet}
|
|
783
1033
|
*/
|
|
784
|
-
declare
|
|
1034
|
+
declare const useCheckKeplr: () => UseQueryResult<boolean>;
|
|
785
1035
|
/**
|
|
786
1036
|
* graz query hook to check whether given {@link WalletType} or default configured wallet is supported
|
|
787
1037
|
*
|
|
@@ -793,7 +1043,7 @@ declare function useCheckKeplr(): UseQueryResult<boolean>;
|
|
|
793
1043
|
* const { data: isKeplrSupported } = useCheckWallet("keplr");
|
|
794
1044
|
* ```
|
|
795
1045
|
*/
|
|
796
|
-
declare
|
|
1046
|
+
declare const useCheckWallet: (type?: WalletType) => UseQueryResult<boolean>;
|
|
797
1047
|
|
|
798
1048
|
declare type GrazProviderProps = Partial<QueryClientProviderProps> & {
|
|
799
1049
|
grazOptions?: ConfigureGrazArgs;
|
|
@@ -816,19 +1066,19 @@ declare type GrazProviderProps = Partial<QueryClientProviderProps> & {
|
|
|
816
1066
|
*
|
|
817
1067
|
* @see https://tanstack.com/query
|
|
818
1068
|
*/
|
|
819
|
-
declare
|
|
1069
|
+
declare const GrazProvider: FC<GrazProviderProps>;
|
|
820
1070
|
|
|
821
1071
|
/**
|
|
822
1072
|
* Graz custom hook to track `keplr_keystorechange` event and reconnect state
|
|
823
1073
|
*
|
|
824
1074
|
* **Note: only use this hook if not using graz's provider component.**
|
|
825
1075
|
*/
|
|
826
|
-
declare
|
|
1076
|
+
declare const useGrazEvents: () => null;
|
|
827
1077
|
/**
|
|
828
1078
|
* Null component to run {@link useGrazEvents} without affecting component tree.
|
|
829
1079
|
*
|
|
830
1080
|
* **Note: only use this component if not using graz's provider component.**
|
|
831
1081
|
*/
|
|
832
|
-
declare
|
|
1082
|
+
declare const GrazEvents: FC;
|
|
833
1083
|
|
|
834
|
-
export { ChainInfoWithPath, ConfigureGrazArgs, ConnectArgs, CreateClientArgs, CreateSigningClientArgs, Dictionary, GrazAdapter, GrazChain, GrazEvents, GrazProvider, GrazProviderProps, Maybe, SendIbcTokensArgs, SendTokensArgs, SuggestChainAndConnectArgs, UseAccountArgs, UseConnectChainArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WALLET_TYPES, WalletType, checkWallet, clearRecentChain, configureGraz, connect, createClients, createQueryClient, createSigningClients, defineChain, defineChainInfo, defineChains, disconnect, getActiveChainCurrency, getAvailableWallets, getBalanceStaked, getBalances, getKeplr, getLeap, getRecentChain, getWallet, mainnetChains, mainnetChainsArray, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChain, useActiveChainCurrency, useActiveChainValidators, useBalance, useBalanceStaked, useBalances, useCheckKeplr, useCheckWallet, useClients, useConnect, useDisconnect, useGrazEvents, useOfflineSigners, useQueryClient, useRecentChain, useSendIbcTokens, useSendTokens, useSigners, useSigningClients, useSuggestChain, useSuggestChainAndConnect };
|
|
1084
|
+
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 Ne=Object.create;var E=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Le=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var Je=(e,t)=>{for(var o in t)E(e,o,{get:t[o],enumerable:!0})},re=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of He(t))!Ve.call(e,n)&&n!==o&&E(e,n,{get:()=>t[n],enumerable:!(i=_e(t,n))||i.enumerable});return e};var se=(e,t,o)=>(o=e!=null?Ne(Le(e)):{},re(t||!e||!e.__esModule?E(o,"default",{value:e,enumerable:!0}):o,e)),Ye=e=>re(E({},"__esModule",{value:!0}),e);var Nt={};Je(Nt,{GrazEvents:()=>te,GrazProvider:()=>Ft,WALLET_TYPES:()=>B,WalletType:()=>T,checkWallet:()=>j,clearRecentChain:()=>z,configureGraz:()=>P,connect:()=>C,createClients:()=>S,createQueryClient:()=>v,createSigningClients:()=>A,defineChain:()=>xt,defineChainInfo:()=>St,defineChains:()=>ht,disconnect:()=>U,getActiveChainCurrency:()=>K,getAvailableWallets:()=>Xe,getBalanceStaked:()=>M,getBalances:()=>W,getKeplr:()=>ue,getLeap:()=>pe,getRecentChain:()=>Ze,getWallet:()=>f,mainnetChains:()=>At,mainnetChainsArray:()=>Et,reconnect:()=>l,sendIbcTokens:()=>F,sendTokens:()=>R,suggestChain:()=>w,suggestChainAndConnect:()=>O,testnetChains:()=>bt,testnetChainsArray:()=>jt,useAccount:()=>h,useActiveChain:()=>Gt,useActiveChainCurrency:()=>vt,useActiveChainValidators:()=>qt,useBalance:()=>Dt,useBalanceStaked:()=>Bt,useBalances:()=>Ue,useCheckKeplr:()=>wt,useCheckWallet:()=>d,useClients:()=>Ot,useConnect:()=>kt,useDisconnect:()=>It,useGrazEvents:()=>Pe,useOfflineSigners:()=>ze,useQueryClient:()=>Kt,useRecentChain:()=>Qt,useSendIbcTokens:()=>Mt,useSendTokens:()=>Wt,useSigners:()=>Tt,useSigningClients:()=>Pt,useSuggestChain:()=>Ut,useSuggestChainAndConnect:()=>zt});module.exports=Ye(Nt);var me=require("@cosmjs/stargate");var ie=se(require("zustand")),b=require("zustand/middleware");var T=(o=>(o.KEPLR="keplr",o.LEAP="leap",o))(T||{}),B=["keplr","leap"];var G={account:null,activeChain:null,balances:null,clients:null,defaultChain:null,defaultSigningClient:"stargate",offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClients:null,status:"disconnected",walletType:"keplr",_notFoundFn:()=>null,_reconnect:!1},$e={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},c=(0,ie.default)((0,b.subscribeWithSelector)((0,b.persist)(()=>G,$e)));var q=require("@cosmjs/cosmwasm-stargate"),Q=require("@cosmjs/stargate"),ae=require("@cosmjs/tendermint-rpc");var ce=require("@cosmjs/stargate"),g=require("@cosmjs/utils");function v(...e){let{tendermint:t}=c.getState().clients,o=new ce.QueryClient(t),i=e.map(n=>n(o));for(let n of i){(0,g.assert)((0,g.isNonNullObject)(n),"Extension must be a non-null object");for(let[s,r]of Object.entries(n)){(0,g.assert)((0,g.isNonNullObject)(r),`Module must be a non-null object. Found type ${typeof r} for module "${s}".`);let u=o[s]||{};o[s]={...u,...r}}}return o}async function S({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}},[i,n,s]=await Promise.all([q.SigningCosmWasmClient.connect(o),Q.SigningStargateClient.connect(o),ae.Tendermint34Client.connect(e)]);return{cosmWasm:i,stargate:n,tendermint:s}}async function A(e){let{rpc:t,rpcHeaders:o,offlineSignerAuto:i,cosmWasmSignerOptions:n={},stargateSignerOptions:s={}}=e,r={url:t,headers:{...o||{}}},[u,p]=await Promise.all([q.SigningCosmWasmClient.connectWithSigner(r,i,n),Q.SigningStargateClient.connectWithSigner(r,i,s)]);return{cosmWasm:u,stargate:p}}function j(e=c.getState().walletType){try{return f(e),!0}catch(t){return console.error(t),!1}}function ue(){if(typeof window.keplr<"u")return window.keplr;throw c.getState()._notFoundFn(),new Error("window.keplr is not defined")}function pe(){if(typeof window.leap<"u")return window.leap;throw c.getState()._notFoundFn(),new Error("window.leap is not defined")}function f(e=c.getState().walletType){switch(e){case"keplr":return ue();case"leap":return pe();default:throw new Error("Unknown wallet type")}}function Xe(){return Object.fromEntries(B.map(e=>[e,j(e)]))}async function C(e){try{let{defaultChain:t,recentChain:o,walletType:i}=c.getState(),n=(e==null?void 0:e.walletType)||i,s=f(n),r=e||o||t;if(!r)throw new Error("No last known connected chain, connect action requires chain info");c.setState(I=>{let Fe=I._reconnect;return I.activeChain&&I.activeChain.chainId!==r.chainId?{status:"connecting"}:Fe?{status:"reconnecting"}:{status:"connecting"}}),await s.enable(r.chainId);let u=s.getOfflineSigner(r.chainId),p=s.getOfflineSignerOnlyAmino(r.chainId),m=await s.getOfflineSignerAuto(r.chainId),We=r.gas?me.GasPrice.fromString(`${r.gas.price}${r.gas.denom}`):void 0,[oe,Me,Re]=await Promise.all([s.getKey(r.chainId),S(r),A({...r,offlineSignerAuto:m,cosmWasmSignerOptions:{gasPrice:We,...(e==null?void 0:e.signerOpts)||{}}})]);return c.setState({account:oe,activeChain:r,clients:Me,offlineSigner:u,offlineSignerAmino:p,offlineSignerAuto:m,recentChain:r,signingClients:Re,status:"connected",walletType:n,_reconnect:!0}),oe}catch(t){throw c.getState().account===null&&c.setState({status:"disconnected"}),t}}async function U(e=!1){return c.setState(t=>({...G,recentChain:e?null:t.recentChain})),Promise.resolve()}function l(){let{activeChain:e}=c.getState();e&&C(e)}function z(){c.setState({recentChain:null})}function K(e){let{activeChain:t}=c.getState();return t==null?void 0:t.currencies.find(o=>o.coinMinimalDenom===e)}function Ze(){return c.getState().recentChain}async function w(e){return await f().experimentalSuggestChain(e),e}async function O({chainInfo:e,...t}){let o=await w(e);return{account:await C({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:o}}function P(e={}){return c.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}async function W(e){let{activeChain:t,signingClients:o}=c.getState();if(!t||!o)throw new Error("No connected account detected");let{defaultSigningClient:i}=c.getState();return await Promise.all(t.currencies.map(async s=>o[i].getBalance(e,s.coinMinimalDenom)))}async function M(e){let{clients:t}=c.getState();if(!(t!=null&&t.stargate))throw new Error("Stargate client is not ready");return t.stargate.getBalanceStaked(e)}async function R({senderAddress:e,recipientAddress:t,amount:o,fee:i,memo:n}){let{signingClients:s,defaultSigningClient:r}=c.getState();if(!s)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return s[r].sendTokens(e,t,o,i,n)}async function F({senderAddress:e,recipientAddress:t,transferAmount:o,sourcePort:i,sourceChannel:n,timeoutHeight:s,timeoutTimestamp:r,fee:u,memo:p}){let{signingClients:m}=c.getState();if(!(m!=null&&m.stargate))throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return m.stargate.sendIbcTokens(e,t,o,i,n,s,r,u,p)}var ye=require("@keplr-wallet/cosmos"),ge={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},et={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},tt={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},nt={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},ot={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},rt={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},le=[ge,et,tt,nt,ot,rt],N={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:ge,bip44:{coinType:118},bech32Config:ye.Bech32Address.defaultBech32Config("axelar"),currencies:le,feeCurrencies:le};var Ce=require("@keplr-wallet/cosmos"),de={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},fe=[de],D={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:de,bip44:{coinType:118},bech32Config:Ce.Bech32Address.defaultBech32Config("cosmos"),currencies:fe,feeCurrencies:fe};var xe=require("@keplr-wallet/cosmos"),Se={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},st={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},it={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},ct={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},at={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},ut={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},pt={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},mt={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},lt={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},yt={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},gt={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},he=[Se,st,it,ct,at,ut,pt,mt,lt,yt,gt],_={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:Se,bip44:{coinType:118},bech32Config:xe.Bech32Address.defaultBech32Config("juno"),currencies:he,feeCurrencies:he};var Ee=require("@keplr-wallet/cosmos"),be={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},ft={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Ae=[be,ft],H={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:be,bip44:{coinType:118},bech32Config:Ee.Bech32Address.defaultBech32Config("osmo"),currencies:Ae,feeCurrencies:Ae};var we=require("@keplr-wallet/cosmos"),De={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},je=[De],L={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:De,bip44:{coinType:118},bech32Config:we.Bech32Address.defaultBech32Config("somm"),currencies:je,feeCurrencies:je};var Ie=require("@keplr-wallet/cosmos"),Te={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},ke=[Te],V={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:Ie.Bech32Address.defaultBech32Config("CRE"),currencies:ke,feeCurrencies:ke,stakeCurrency:Te,coinType:118};var Be=require("@keplr-wallet/cosmos"),J={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Ct=[J],Y={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:J,bip44:{coinType:118},bech32Config:Be.Bech32Address.defaultBech32Config("juno"),currencies:Ct,feeCurrencies:[J],coinType:118};var Ge=require("@keplr-wallet/cosmos"),$={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},dt=[$],X={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:$,bip44:{coinType:118},bech32Config:Ge.Bech32Address.defaultBech32Config("osmo"),currencies:dt,feeCurrencies:[$],coinType:118};function ht(e){return e}function xt(e){return e}function St(e){return e}var At={axelar:N,cosmos:D,cosmoshub:D,juno:_,osmosis:H,sommelier:L},Et=[N,D,_,H,L],bt={crescent:V,juno:Y,osmosis:X},jt=[V,Y,X];var y=require("@tanstack/react-query"),qe=require("react"),Qe=se(require("zustand/shallow"));var ve=require("@tanstack/react-query");function wt(){return d("keplr")}function d(e){let t=c(n=>e||n.walletType);return(0,ve.useQuery)(["USE_CHECK_WALLET",t],({queryKey:[,n]})=>j(n))}function h({onConnect:e,onDisconnect:t}={}){let o=c(n=>n.account),i=c(n=>n.status);return(0,qe.useEffect)(()=>c.subscribe(n=>n.status,(n,s)=>{if(n==="connected"){let r=c.getState();e==null||e({account:r.account,isReconnect:s==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:i==="connecting",isDisconnected:i==="disconnected",isReconnecting:i==="reconnecting",reconnect:l,status:i}}function Ue(e){let{data:t}=h(),o=e||(t==null?void 0:t.bech32Address);return(0,y.useQuery)(["USE_BALANCES",o],({queryKey:[,s]})=>W(s),{enabled:Boolean(o)})}function Dt(e,t){let{data:o}=Ue(t);return(0,y.useQuery)(["USE_BALANCE",o,e,t],({queryKey:[,s]})=>s==null?void 0:s.find(r=>r.denom===e),{enabled:Boolean(o)})}function kt({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,y.useMutation)(["USE_CONNECT",e,t,o],C,{onError:(r,u)=>Promise.resolve(e==null?void 0:e(r,u)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))}),{data:s}=d();return{connect:r=>n.mutate(r),connectAsync:r=>n.mutateAsync(r),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(s),status:n.status}}function It({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,y.useMutation)(["USE_DISCONNECT",e,t,o],U,{onError:s=>Promise.resolve(e==null?void 0:e(s,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:s=>n.mutate(s),disconnectAsync:s=>n.mutateAsync(s),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function ze(){return c(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Qe.default)}function Tt(){return ze()}function Bt(e){let{data:t}=h(),o=e||(t==null?void 0:t.bech32Address);return(0,y.useQuery)(["USE_BALANCE_STAKED",o],({queryKey:[,s]})=>M(o),{enabled:Boolean(o)})}var x=require("@tanstack/react-query");function Gt(){return c(e=>e.activeChain)}function vt(e){return(0,x.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,i]})=>K(i))}function qt(e,t="BOND_STATUS_BONDED"){return(0,x.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,n,s]})=>n.staking.validators(s),{enabled:typeof e<"u"})}function Qt(){return{data:c(t=>t.recentChain),clear:z}}function Ut({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,x.useMutation)(["USE_SUGGEST_CHAIN",e,t,o],w,{onError:(s,r)=>Promise.resolve(e==null?void 0:e(s,r)),onMutate:t,onSuccess:s=>Promise.resolve(o==null?void 0:o(s))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function zt({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,x.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],O,{onError:(r,u)=>Promise.resolve(e==null?void 0:e(r,u)),onMutate:r=>t==null?void 0:t(r),onSuccess:r=>Promise.resolve(o==null?void 0:o(r))}),{data:s}=d();return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(s),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}var Z=require("@tanstack/react-query");var Ke=require("@tanstack/react-query");function Kt(...e){let t=["USE_QUERY_CLIENT",...e];return(0,Ke.useQuery)(t,({queryKey:[,...i]})=>v(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})}function Ot(e){let t=c(n=>n.clients);return(0,Z.useQuery)(["USE_CLIENTS",e,t],({queryKey:[,n,s]})=>n!=null&&n.rpc?S(n):s,{refetchOnMount:!1,refetchOnWindowFocus:!1})}function Pt(e){let t=c(n=>n.signingClients);return(0,Z.useQuery)(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,n,s]})=>n!=null&&n.rpc?A(n):s,{refetchOnMount:!1,refetchOnWindowFocus:!1})}var ee=require("@tanstack/react-query");function Wt({onError:e,onLoading:t,onSuccess:o}={}){let{data:i}=h(),n=i==null?void 0:i.bech32Address,r=(0,ee.useMutation)(["USE_SEND_TOKENS",e,t,o,n],u=>R({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(o==null?void 0:o(u))});return{error:r.error,isLoading:r.isLoading,isSuccess:r.isSuccess,sendTokens:r.mutate,sendTokensAsync:r.mutateAsync,status:r.status}}function Mt({onError:e,onLoading:t,onSuccess:o}={}){let{data:i}=h(),n=i==null?void 0:i.bech32Address,r=(0,ee.useMutation)(["USE_SEND_IBC_TOKENS",e,t,o,n],u=>F({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(o==null?void 0:o(u))});return{error:r.error,isLoading:r.isLoading,isSuccess:r.isSuccess,sendIbcTokens:r.mutate,sendIbcTokensAsync:r.mutateAsync,status:r.status}}var k=require("@tanstack/react-query");var Oe=require("react");function Pe(){return(0,Oe.useEffect)(()=>{let{_reconnect:e}=c.getState();return e&&l(),window.addEventListener("keplr_keystorechange",l),()=>{window.removeEventListener("keplr_keystorechange",l)}},[]),null}function te(){return Pe(),null}var ne=require("react/jsx-runtime"),Rt=new k.QueryClient({});function Ft({children:e,grazOptions:t,...o}){return t&&P(t),(0,ne.jsxs)(k.QueryClientProvider,{client:Rt,...o,children:[(0,ne.jsx)(te,{}),e]})}0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineChain,defineChainInfo,defineChains,disconnect,getActiveChainCurrency,getAvailableWallets,getBalanceStaked,getBalances,getKeplr,getLeap,getRecentChain,getWallet,mainnetChains,mainnetChainsArray,reconnect,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useBalance,useBalanceStaked,useBalances,useCheckKeplr,useCheckWallet,useClients,useConnect,useDisconnect,useGrazEvents,useOfflineSigners,useQueryClient,useRecentChain,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useSuggestChain,useSuggestChainAndConnect});
|
|
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:()=>de,GrazProvider:()=>gn,WALLET_TYPES:()=>G,WalletType:()=>R,checkWallet:()=>T,clearRecentChain:()=>z,configureGraz:()=>F,connect:()=>S,createClients:()=>w,createQueryClient:()=>K,createSigningClients:()=>D,defineChain:()=>Ut,defineChainInfo:()=>Rt,defineChains:()=>le,disconnect:()=>O,executeContract:()=>ee,getActiveChainCurrency:()=>W,getAddressesByIbcDomain:()=>H,getAvailableWallets:()=>gt,getBalanceStaked:()=>J,getBalances:()=>Y,getChainAddressByIbcDomain:()=>v,getIbcDomainByAdress:()=>N,getIbcDomainDetails:()=>L,getKeplr:()=>Ee,getLeap:()=>be,getQueryRaw:()=>ne,getQuerySmart:()=>te,getRecentChain:()=>dt,getWallet:()=>A,instantiateContract:()=>Z,isIbcDomainPostfix:()=>je,mainnetChains:()=>Gt,mainnetChainsArray:()=>Mt,reconnect:()=>C,resolveToChainAddress:()=>V,sendIbcTokens:()=>X,sendTokens:()=>$,suggestChain:()=>k,suggestChainAndConnect:()=>_,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 R=(n=>(n.KEPLR="keplr",n.LEAP="leap",n))(R||{}),G=["keplr","leap"];var M={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)(()=>M,lt)));var Q=require("@cosmjs/cosmwasm-stargate"),P=require("@cosmjs/stargate"),Se=require("@cosmjs/tendermint-rpc");var Ae=require("@cosmjs/stargate"),h=require("@cosmjs/utils");var K=(...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([Q.SigningCosmWasmClient.connect(n),P.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([Q.SigningCosmWasmClient.connectWithSigner(i,o,s),P.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(G.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(U=>{let ot=U._reconnect;return U.activeChain&&U.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}},O=async(e=!1)=>(a.setState(t=>({...M,recentChain:e?null:t.recentChain})),Promise.resolve()),C=()=>{let{activeChain:e}=a.getState();e&&S(e)};var z=()=>{a.setState({recentChain:null})},W=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),_=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 F=(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}},N=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}},H=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},L=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},V=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 Y=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)))},J=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)},$=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)},X=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)},Z=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)},ee=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)},te=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)},ne=(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],se={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],oe={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],re={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],ie={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],ae={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"),ce={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Bt=[ce],ue={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:ce,bip44:{coinType:118},bech32Config:He.Bech32Address.defaultBech32Config("juno"),currencies:Bt,feeCurrencies:[ce],coinType:118};var Le=require("@keplr-wallet/cosmos"),pe={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},qt=[pe],me={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:pe,bip44:{coinType:118},bech32Config:Le.Bech32Address.defaultBech32Config("osmo"),currencies:qt,feeCurrencies:[pe],coinType:118};var le=e=>e,Ut=e=>e,Rt=e=>e,Gt=le({axelar:se,cosmos:B,cosmoshub:B,juno:oe,osmosis:re,sommelier:ie}),Mt=[se,B,oe,re,ie],Kt=le({crescent:ae,juno:ue,osmosis:me}),Qt=[ae,ue,me];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 t=a(s=>e||s.walletType);return(0,Ve.useQuery)(["USE_CHECK_WALLET",t],({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]})=>Y(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],O,{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]})=>J(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]})=>W(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:z}),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],_,{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 ge=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]})=>K(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var Xt=e=>{let t=a(s=>s.clients);return(0,ge.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,ge.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],()=>N(e,t),{enabled:Boolean(e)}),tn=({ibcDomain:e,isTestnet:t})=>(0,x.useQuery)(["USE_IBC_DOMAIN_TO_ADDRESSES",e,t],()=>H(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],()=>L(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],V,{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=>$({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=>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,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 Z(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 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,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 te(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 ne(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),de=()=>(tt(),null);var ye=require("react/jsx-runtime"),ln=new q.QueryClient({}),gn=({children:e,grazOptions:t,...n})=>(t&&F(t),(0,ye.jsxs)(q.QueryClientProvider,{client:ln,...n,children:[(0,ye.jsx)(de,{}),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 ke}from"@cosmjs/stargate";import xe from"zustand";import{persist as Se,subscribeWithSelector as Ae}from"zustand/middleware";var U=(o=>(o.KEPLR="keplr",o.LEAP="leap",o))(U||{}),z=["keplr","leap"];var A={account:null,activeChain:null,balances:null,clients:null,defaultChain:null,defaultSigningClient:"stargate",offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClients:null,status:"disconnected",walletType:"keplr",_notFoundFn:()=>null,_reconnect:!1},Ee={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},i=xe(Ae(Se(()=>A,Ee)));import{SigningCosmWasmClient as W}from"@cosmjs/cosmwasm-stargate";import{SigningStargateClient as M}from"@cosmjs/stargate";import{Tendermint34Client as je}from"@cosmjs/tendermint-rpc";import{QueryClient as be}from"@cosmjs/stargate";import{assert as K,isNonNullObject as O}from"@cosmjs/utils";function P(...e){let{tendermint:t}=i.getState().clients,o=new be(t),c=e.map(n=>n(o));for(let n of c){K(O(n),"Extension must be a non-null object");for(let[s,r]of Object.entries(n)){K(O(r),`Module must be a non-null object. Found type ${typeof r} for module "${s}".`);let u=o[s]||{};o[s]={...u,...r}}}return o}async function d({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}},[c,n,s]=await Promise.all([W.connect(o),M.connect(o),je.connect(e)]);return{cosmWasm:c,stargate:n,tendermint:s}}async function h(e){let{rpc:t,rpcHeaders:o,offlineSignerAuto:c,cosmWasmSignerOptions:n={},stargateSignerOptions:s={}}=e,r={url:t,headers:{...o||{}}},[u,p]=await Promise.all([W.connectWithSigner(r,c,n),M.connectWithSigner(r,c,s)]);return{cosmWasm:u,stargate:p}}function E(e=i.getState().walletType){try{return y(e),!0}catch(t){return console.error(t),!1}}function we(){if(typeof window.keplr<"u")return window.keplr;throw i.getState()._notFoundFn(),new Error("window.keplr is not defined")}function De(){if(typeof window.leap<"u")return window.leap;throw i.getState()._notFoundFn(),new Error("window.leap is not defined")}function y(e=i.getState().walletType){switch(e){case"keplr":return we();case"leap":return De();default:throw new Error("Unknown wallet type")}}function Tt(){return Object.fromEntries(z.map(e=>[e,E(e)]))}async function g(e){try{let{defaultChain:t,recentChain:o,walletType:c}=i.getState(),n=(e==null?void 0:e.walletType)||c,s=y(n),r=e||o||t;if(!r)throw new Error("No last known connected chain, connect action requires chain info");i.setState(S=>{let he=S._reconnect;return S.activeChain&&S.activeChain.chainId!==r.chainId?{status:"connecting"}:he?{status:"reconnecting"}:{status:"connecting"}}),await s.enable(r.chainId);let u=s.getOfflineSigner(r.chainId),p=s.getOfflineSignerOnlyAmino(r.chainId),m=await s.getOfflineSignerAuto(r.chainId),fe=r.gas?ke.fromString(`${r.gas.price}${r.gas.denom}`):void 0,[Q,Ce,de]=await Promise.all([s.getKey(r.chainId),d(r),h({...r,offlineSignerAuto:m,cosmWasmSignerOptions:{gasPrice:fe,...(e==null?void 0:e.signerOpts)||{}}})]);return i.setState({account:Q,activeChain:r,clients:Ce,offlineSigner:u,offlineSignerAmino:p,offlineSignerAuto:m,recentChain:r,signingClients:de,status:"connected",walletType:n,_reconnect:!0}),Q}catch(t){throw i.getState().account===null&&i.setState({status:"disconnected"}),t}}async function R(e=!1){return i.setState(t=>({...A,recentChain:e?null:t.recentChain})),Promise.resolve()}function l(){let{activeChain:e}=i.getState();e&&g(e)}function F(){i.setState({recentChain:null})}function N(e){let{activeChain:t}=i.getState();return t==null?void 0:t.currencies.find(o=>o.coinMinimalDenom===e)}function Pt(){return i.getState().recentChain}async function b(e){return await y().experimentalSuggestChain(e),e}async function _({chainInfo:e,...t}){let o=await b(e);return{account:await g({chainId:e.chainId,currencies:e.currencies,rest:e.rest,rpc:e.rpc,...t}),chain:o}}function H(e={}){return i.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||t.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}async function L(e){let{activeChain:t,signingClients:o}=i.getState();if(!t||!o)throw new Error("No connected account detected");let{defaultSigningClient:c}=i.getState();return await Promise.all(t.currencies.map(async s=>o[c].getBalance(e,s.coinMinimalDenom)))}async function V(e){let{clients:t}=i.getState();if(!(t!=null&&t.stargate))throw new Error("Stargate client is not ready");return t.stargate.getBalanceStaked(e)}async function J({senderAddress:e,recipientAddress:t,amount:o,fee:c,memo:n}){let{signingClients:s,defaultSigningClient:r}=i.getState();if(!s)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return s[r].sendTokens(e,t,o,c,n)}async function Y({senderAddress:e,recipientAddress:t,transferAmount:o,sourcePort:c,sourceChannel:n,timeoutHeight:s,timeoutTimestamp:r,fee:u,memo:p}){let{signingClients:m}=i.getState();if(!(m!=null&&m.stargate))throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return m.stargate.sendIbcTokens(e,t,o,c,n,s,r,u,p)}import{Bech32Address as Ie}from"@keplr-wallet/cosmos";var X={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Te={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Be={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Ge={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},ve={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},qe={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},$=[X,Te,Be,Ge,ve,qe],j={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:X,bip44:{coinType:118},bech32Config:Ie.defaultBech32Config("axelar"),currencies:$,feeCurrencies:$};import{Bech32Address as Qe}from"@keplr-wallet/cosmos";var ee={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Z=[ee],x={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:ee,bip44:{coinType:118},bech32Config:Qe.defaultBech32Config("cosmos"),currencies:Z,feeCurrencies:Z};import{Bech32Address as Ue}from"@keplr-wallet/cosmos";var ne={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},ze={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Ke={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Oe={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Pe={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},We={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Me={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Re={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Fe={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},Ne={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},_e={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},te=[ne,ze,Ke,Oe,Pe,We,Me,Re,Fe,Ne,_e],w={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:ne,bip44:{coinType:118},bech32Config:Ue.defaultBech32Config("juno"),currencies:te,feeCurrencies:te};import{Bech32Address as He}from"@keplr-wallet/cosmos";var re={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Le={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},oe=[re,Le],D={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:re,bip44:{coinType:118},bech32Config:He.defaultBech32Config("osmo"),currencies:oe,feeCurrencies:oe};import{Bech32Address as Ve}from"@keplr-wallet/cosmos";var ie={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},se=[ie],k={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:ie,bip44:{coinType:118},bech32Config:Ve.defaultBech32Config("somm"),currencies:se,feeCurrencies:se};import{Bech32Address as Je}from"@keplr-wallet/cosmos";var ae={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},ce=[ae],I={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:Je.defaultBech32Config("CRE"),currencies:ce,feeCurrencies:ce,stakeCurrency:ae,coinType:118};import{Bech32Address as Ye}from"@keplr-wallet/cosmos";var T={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},$e=[T],B={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:T,bip44:{coinType:118},bech32Config:Ye.defaultBech32Config("juno"),currencies:$e,feeCurrencies:[T],coinType:118};import{Bech32Address as Xe}from"@keplr-wallet/cosmos";var G={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Ze=[G],v={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:G,bip44:{coinType:118},bech32Config:Xe.defaultBech32Config("osmo"),currencies:Ze,feeCurrencies:[G],coinType:118};function dn(e){return e}function hn(e){return e}function xn(e){return e}var Sn={axelar:j,cosmos:x,cosmoshub:x,juno:w,osmosis:D,sommelier:k},An=[j,x,w,D,k],En={crescent:I,juno:B,osmosis:v},bn=[I,B,v];import{useMutation as ue,useQuery as q}from"@tanstack/react-query";import{useEffect as tt}from"react";import nt from"zustand/shallow";import{useQuery as et}from"@tanstack/react-query";function In(){return f("keplr")}function f(e){let t=i(n=>e||n.walletType);return et(["USE_CHECK_WALLET",t],({queryKey:[,n]})=>E(n))}function C({onConnect:e,onDisconnect:t}={}){let o=i(n=>n.account),c=i(n=>n.status);return tt(()=>i.subscribe(n=>n.status,(n,s)=>{if(n==="connected"){let r=i.getState();e==null||e({account:r.account,isReconnect:s==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:c==="connecting",isDisconnected:c==="disconnected",isReconnecting:c==="reconnecting",reconnect:l,status:c}}function ot(e){let{data:t}=C(),o=e||(t==null?void 0:t.bech32Address);return q(["USE_BALANCES",o],({queryKey:[,s]})=>L(s),{enabled:Boolean(o)})}function Kn(e,t){let{data:o}=ot(t);return q(["USE_BALANCE",o,e,t],({queryKey:[,s]})=>s==null?void 0:s.find(r=>r.denom===e),{enabled:Boolean(o)})}function On({onError:e,onLoading:t,onSuccess:o}={}){let n=ue(["USE_CONNECT",e,t,o],g,{onError:(r,u)=>Promise.resolve(e==null?void 0:e(r,u)),onMutate:t,onSuccess:r=>Promise.resolve(o==null?void 0:o(r))}),{data:s}=f();return{connect:r=>n.mutate(r),connectAsync:r=>n.mutateAsync(r),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(s),status:n.status}}function Pn({onError:e,onLoading:t,onSuccess:o}={}){let n=ue(["USE_DISCONNECT",e,t,o],R,{onError:s=>Promise.resolve(e==null?void 0:e(s,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:s=>n.mutate(s),disconnectAsync:s=>n.mutateAsync(s),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function rt(){return i(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),nt)}function Wn(){return rt()}function Mn(e){let{data:t}=C(),o=e||(t==null?void 0:t.bech32Address);return q(["USE_BALANCE_STAKED",o],({queryKey:[,s]})=>V(o),{enabled:Boolean(o)})}import{useMutation as pe,useQuery as me}from"@tanstack/react-query";function Ln(){return i(e=>e.activeChain)}function Vn(e){return me(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,c]})=>N(c))}function Jn(e,t="BOND_STATUS_BONDED"){return me(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,n,s]})=>n.staking.validators(s),{enabled:typeof e<"u"})}function Yn(){return{data:i(t=>t.recentChain),clear:F}}function $n({onError:e,onLoading:t,onSuccess:o}={}){let n=pe(["USE_SUGGEST_CHAIN",e,t,o],b,{onError:(s,r)=>Promise.resolve(e==null?void 0:e(s,r)),onMutate:t,onSuccess:s=>Promise.resolve(o==null?void 0:o(s))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function Xn({onError:e,onLoading:t,onSuccess:o}={}){let n=pe(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],_,{onError:(r,u)=>Promise.resolve(e==null?void 0:e(r,u)),onMutate:r=>t==null?void 0:t(r),onSuccess:r=>Promise.resolve(o==null?void 0:o(r))}),{data:s}=f();return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(s),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}import{useQuery as le}from"@tanstack/react-query";import{useQuery as st}from"@tanstack/react-query";function no(...e){let t=["USE_QUERY_CLIENT",...e];return st(t,({queryKey:[,...c]})=>P(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})}function co(e){let t=i(n=>n.clients);return le(["USE_CLIENTS",e,t],({queryKey:[,n,s]})=>n!=null&&n.rpc?d(n):s,{refetchOnMount:!1,refetchOnWindowFocus:!1})}function ao(e){let t=i(n=>n.signingClients);return le(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,n,s]})=>n!=null&&n.rpc?h(n):s,{refetchOnMount:!1,refetchOnWindowFocus:!1})}import{useMutation as ye}from"@tanstack/react-query";function go({onError:e,onLoading:t,onSuccess:o}={}){let{data:c}=C(),n=c==null?void 0:c.bech32Address,r=ye(["USE_SEND_TOKENS",e,t,o,n],u=>J({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(o==null?void 0:o(u))});return{error:r.error,isLoading:r.isLoading,isSuccess:r.isSuccess,sendTokens:r.mutate,sendTokensAsync:r.mutateAsync,status:r.status}}function fo({onError:e,onLoading:t,onSuccess:o}={}){let{data:c}=C(),n=c==null?void 0:c.bech32Address,r=ye(["USE_SEND_IBC_TOKENS",e,t,o,n],u=>Y({senderAddress:n,...u}),{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:t,onSuccess:u=>Promise.resolve(o==null?void 0:o(u))});return{error:r.error,isLoading:r.isLoading,isSuccess:r.isSuccess,sendIbcTokens:r.mutate,sendIbcTokensAsync:r.mutateAsync,status:r.status}}import{QueryClient as at,QueryClientProvider as ut}from"@tanstack/react-query";import{useEffect as it}from"react";function ct(){return it(()=>{let{_reconnect:e}=i.getState();return e&&l(),window.addEventListener("keplr_keystorechange",l),()=>{window.removeEventListener("keplr_keystorechange",l)}},[]),null}function ge(){return ct(),null}import{jsx as mt,jsxs as lt}from"react/jsx-runtime";var pt=new at({});function wo({children:e,grazOptions:t,...o}){return t&&H(t),lt(ut,{client:pt,...o,children:[mt(ge,{}),e]})}export{ge as GrazEvents,wo as GrazProvider,z as WALLET_TYPES,U as WalletType,E as checkWallet,F as clearRecentChain,H as configureGraz,g as connect,d as createClients,P as createQueryClient,h as createSigningClients,hn as defineChain,xn as defineChainInfo,dn as defineChains,R as disconnect,N as getActiveChainCurrency,Tt as getAvailableWallets,V as getBalanceStaked,L as getBalances,we as getKeplr,De as getLeap,Pt as getRecentChain,y as getWallet,Sn as mainnetChains,An as mainnetChainsArray,l as reconnect,Y as sendIbcTokens,J as sendTokens,b as suggestChain,_ as suggestChainAndConnect,En as testnetChains,bn as testnetChainsArray,C as useAccount,Ln as useActiveChain,Vn as useActiveChainCurrency,Jn as useActiveChainValidators,Kn as useBalance,Mn as useBalanceStaked,ot as useBalances,In as useCheckKeplr,f as useCheckWallet,co as useClients,On as useConnect,Pn as useDisconnect,ct as useGrazEvents,rt as useOfflineSigners,no as useQueryClient,Yn as useRecentChain,fo as useSendIbcTokens,go as useSendTokens,Wn as useSigners,ao as useSigningClients,$n as useSuggestChain,Xn as useSuggestChainAndConnect};
|
|
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")}},Yt=()=>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)},rn=()=>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,On=e=>e,zn=e=>e,Wn=Se({axelar:T,cosmos:A,cosmoshub:A,juno:k,osmosis:v,sommelier:B}),_n=[T,A,k,v,B],Fn=Se({crescent:q,juno:R,osmosis:M}),Nn=[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 Jn=()=>f("keplr"),f=e=>{let t=a(s=>e||s.walletType);return ht(["USE_CHECK_WALLET",t],({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)})},rs=(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)})},is=({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}},as=({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),cs=()=>bt(),us=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 ys=()=>a(e=>e.activeChain),Cs=e=>we(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,o]})=>V(o)),fs=(e,t="BOND_STATUS_BONDED")=>we(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,s,r]})=>s.staking.validators(r),{enabled:typeof e<"u"}),xs=()=>({data:a(t=>t.recentChain),clear:L}),hs=({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}},As=({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 ws=(...e)=>{let t=["USE_QUERY_CLIENT",...e];return wt(t,({queryKey:[,...o]})=>_(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var ks=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})},vs=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 Gs=({address:e,isTestnet:t})=>S(["USE_ADRESS_TO_IBC_DOMAIN",e,t],()=>$(e,t),{enabled:Boolean(e)}),Ms=({ibcDomain:e,isTestnet:t})=>S(["USE_IBC_DOMAIN_TO_ADDRESSES",e,t],()=>X(e,t),{enabled:Boolean(e)}),Ks=({ibcDomain:e,prefix:t,isTestnet:n})=>S(["USE_IBC_DOMAIN_TO_CHAIN_ADDRESS",t,e,n],()=>I(e,t,n),{enabled:Boolean(e&&t)}),Qs=({ibcDomain:e,isTestnet:t})=>S(["USE_IBC_DOMAIN_DETAILS",e,t],()=>Z(e,t),{enabled:Boolean(e)}),Ps=({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 Fs=({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}},Ns=({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}},Hs=({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}},Ls=({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}},Vs=(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)}),Ys=(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({}),oo=({children:e,grazOptions:t,...n})=>(t&&J(t),qt(kt,{client:vt,...n,children:[Bt(Ie,{}),e]}));export{Ie as GrazEvents,oo 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,On as defineChain,zn as defineChainInfo,Se as defineChains,H as disconnect,ie as executeContract,V as getActiveChainCurrency,X as getAddressesByIbcDomain,Yt 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,rn as getRecentChain,y as getWallet,re as instantiateContract,Ne as isIbcDomainPostfix,Wn as mainnetChains,_n as mainnetChainsArray,d as reconnect,ee as resolveToChainAddress,oe as sendIbcTokens,se as sendTokens,j as suggestChain,Y as suggestChainAndConnect,Fn as testnetChains,Nn as testnetChainsArray,g as useAccount,ys as useActiveChain,Cs as useActiveChainCurrency,fs as useActiveChainValidators,Gs as useAddressToIbcDomain,rs as useBalance,us as useBalanceStaked,Et as useBalances,Jn as useCheckKeplr,f as useCheckWallet,ks as useClients,is as useConnect,as as useDisconnect,Ls as useExecuteContract,It as useGrazEvents,Qs as useIbcDomainDetails,Ms as useIbcDomainToAddresses,Ks as useIbcDomainToChainAddress,Hs as useInstantiateContract,bt as useOfflineSigners,ws as useQueryClient,Ys as useQueryRaw,Vs as useQuerySmart,xs as useRecentChain,Ps as useResolveToChainAddress,Ns as useSendIbcTokens,Fs as useSendTokens,cs as useSigners,vs as useSigningClients,hs as useSuggestChain,As 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.29",
|
|
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": {
|
|
@@ -71,6 +73,7 @@
|
|
|
71
73
|
"license": "MIT",
|
|
72
74
|
"scripts": {
|
|
73
75
|
"build": "tsup",
|
|
76
|
+
"clean": "rm -rf dist/*",
|
|
74
77
|
"cli": "node cli.mjs",
|
|
75
78
|
"dev": "tsup --watch",
|
|
76
79
|
"lint": "eslint --fix \"src/**/*.{ts,tsx}\""
|