graz 0.0.21 → 0.0.23
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/chunk-6M3A6KFX.mjs +1 -0
- package/dist/cosmjs.mjs +1 -1
- package/dist/index.d.ts +223 -56
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/keplr.mjs +1 -1
- package/dist/tendermint.d.ts +1 -0
- package/dist/tendermint.js +1 -0
- package/dist/tendermint.mjs +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.create;var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var R=(a,e)=>()=>(a&&(e=a(a=0)),e);var g=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var b=(a,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!x.call(a,r)&&r!==o&&c(a,r,{get:()=>e[r],enumerable:!(t=m(e,r))||t.enumerable});return a};var h=(a,e,o)=>(o=a!=null?f(s(a)):{},b(e||!a||!a.__esModule?c(o,"default",{value:a,enumerable:!0}):o,a));import*as k from"react";var d=R(()=>{"use strict"});export{g as a,h as b,d as c};
|
package/dist/cosmjs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"@cosmjs/cosmwasm-stargate";export*from"@cosmjs/proto-signing";export*from"@cosmjs/stargate";
|
|
1
|
+
import{c as o}from"./chunk-6M3A6KFX.mjs";o();export*from"@cosmjs/cosmwasm-stargate";export*from"@cosmjs/proto-signing";export*from"@cosmjs/stargate";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
|
|
2
1
|
import { SigningCosmWasmClientOptions, CosmWasmClient, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
|
|
2
|
+
import { ChainInfo, AppCurrency, Key, Keplr } from '@keplr-wallet/types';
|
|
3
3
|
import * as _cosmjs_proto_signing from '@cosmjs/proto-signing';
|
|
4
4
|
import { Coin, OfflineSigner, OfflineDirectSigner } from '@cosmjs/proto-signing';
|
|
5
|
-
import { ChainInfo, AppCurrency, Key, Keplr } from '@keplr-wallet/types';
|
|
6
5
|
import * as _cosmjs_stargate from '@cosmjs/stargate';
|
|
7
|
-
import { StargateClient, SigningStargateClient, SigningStargateClientOptions } from '@cosmjs/stargate';
|
|
6
|
+
import { QueryClient, StargateClient, SigningStargateClient, SigningStargateClientOptions, StdFee, DeliverTxResponse, StakingExtension } from '@cosmjs/stargate';
|
|
7
|
+
import { Tendermint34Client } from '@cosmjs/tendermint-rpc';
|
|
8
|
+
import { Height } from 'cosmjs-types/ibc/core/client/v1/client';
|
|
8
9
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
9
|
-
import { QueryClientProviderProps } from '@tanstack/react-query';
|
|
10
|
-
import
|
|
10
|
+
import { UseQueryResult, QueryClientProviderProps } from '@tanstack/react-query';
|
|
11
|
+
import { BondStatusString } from '@cosmjs/stargate/build/modules/staking/queries';
|
|
12
|
+
import { QueryValidatorsResponse } from 'cosmjs-types/cosmos/staking/v1beta1/query';
|
|
11
13
|
|
|
12
14
|
declare type Dictionary<T = string> = Record<string, T>;
|
|
13
15
|
declare type Maybe<T> = T | undefined;
|
|
@@ -149,10 +151,27 @@ declare type ConnectArgs = Maybe<GrazChain & {
|
|
|
149
151
|
}>;
|
|
150
152
|
declare function connect(args?: ConnectArgs): Promise<Key>;
|
|
151
153
|
declare function disconnect(clearRecentChain?: boolean): Promise<void>;
|
|
152
|
-
declare function getBalances(bech32Address: string): Promise<Coin[]>;
|
|
153
154
|
declare function reconnect(): void;
|
|
154
155
|
|
|
156
|
+
declare type ExtensionSetup<P extends object = object> = (queryClient: QueryClient) => P;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Note: `createQueryClient` creates \@cosmjs/stargate's {@link QueryClient},
|
|
160
|
+
* NOT to be confused with \@tanstack/react-query query client
|
|
161
|
+
*/
|
|
162
|
+
declare function createQueryClient(): QueryClient;
|
|
163
|
+
declare function createQueryClient<A extends object>(setupA: ExtensionSetup<A>): QueryClient & A;
|
|
164
|
+
declare function createQueryClient<A extends object, B extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>): QueryClient & A & B;
|
|
165
|
+
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;
|
|
166
|
+
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;
|
|
167
|
+
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;
|
|
168
|
+
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;
|
|
169
|
+
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;
|
|
170
|
+
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;
|
|
171
|
+
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;
|
|
172
|
+
|
|
155
173
|
declare function clearRecentChain(): void;
|
|
174
|
+
declare function getActiveChainCurrency(denom: string): AppCurrency | undefined;
|
|
156
175
|
declare function getRecentChain(): GrazChain | null;
|
|
157
176
|
declare function suggestChain(chainInfo: ChainInfo): Promise<ChainInfo>;
|
|
158
177
|
declare function suggestChainAndConnect(chainInfo: ChainInfo): Promise<{
|
|
@@ -167,6 +186,7 @@ interface GrazStore {
|
|
|
167
186
|
clients: {
|
|
168
187
|
cosmWasm: CosmWasmClient;
|
|
169
188
|
stargate: StargateClient;
|
|
189
|
+
tendermint: Tendermint34Client;
|
|
170
190
|
} | null;
|
|
171
191
|
defaultChain: GrazChain | null;
|
|
172
192
|
defaultSigningClient: "cosmWasm" | "stargate";
|
|
@@ -201,6 +221,29 @@ interface ConfigureGrazArgs {
|
|
|
201
221
|
}
|
|
202
222
|
declare function configureGraz(args?: ConfigureGrazArgs): ConfigureGrazArgs;
|
|
203
223
|
|
|
224
|
+
declare function getBalances(bech32Address: string): Promise<Coin[]>;
|
|
225
|
+
declare function getStakedBalances(bech32Address: string): Promise<Coin | null>;
|
|
226
|
+
interface SendTokensArgs {
|
|
227
|
+
senderAddress?: string;
|
|
228
|
+
recipientAddress: string;
|
|
229
|
+
amount: Coin[];
|
|
230
|
+
fee: number | StdFee | "auto";
|
|
231
|
+
memo?: string;
|
|
232
|
+
}
|
|
233
|
+
declare function sendTokens({ senderAddress, recipientAddress, amount, fee, memo, }: SendTokensArgs): Promise<DeliverTxResponse>;
|
|
234
|
+
interface SendIbcTokensArgs {
|
|
235
|
+
senderAddress?: string;
|
|
236
|
+
recipientAddress: string;
|
|
237
|
+
transferAmount: Coin;
|
|
238
|
+
sourcePort: string;
|
|
239
|
+
sourceChannel: string;
|
|
240
|
+
timeoutHeight?: Height;
|
|
241
|
+
timeoutTimestamp?: number;
|
|
242
|
+
fee: number | StdFee | "auto";
|
|
243
|
+
memo: string;
|
|
244
|
+
}
|
|
245
|
+
declare function sendIbcTokens({ senderAddress, recipientAddress, transferAmount, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, fee, memo, }: SendIbcTokensArgs): Promise<DeliverTxResponse>;
|
|
246
|
+
|
|
204
247
|
/**
|
|
205
248
|
* Function to check whether given {@link WalletType} or default configured wallet exists.
|
|
206
249
|
*
|
|
@@ -240,6 +283,11 @@ declare function getKeplr(): Keplr;
|
|
|
240
283
|
*/
|
|
241
284
|
declare function getWallet(type?: WalletType): Keplr;
|
|
242
285
|
|
|
286
|
+
interface GrazAdapter {
|
|
287
|
+
name: string;
|
|
288
|
+
id: string;
|
|
289
|
+
}
|
|
290
|
+
|
|
243
291
|
interface MutationEventArgs<TInitial = unknown, TSuccess = TInitial> {
|
|
244
292
|
onError?: (error: unknown, data: TInitial) => unknown;
|
|
245
293
|
onLoading?: (data: TInitial) => unknown;
|
|
@@ -296,16 +344,25 @@ declare function useAccount({ onConnect, onDisconnect }?: UseAccountArgs): {
|
|
|
296
344
|
* useBalances("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
|
|
297
345
|
* ```
|
|
298
346
|
*/
|
|
299
|
-
declare function useBalances(bech32Address?: string):
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
};
|
|
347
|
+
declare function useBalances(bech32Address?: string): UseQueryResult<Coin[]>;
|
|
348
|
+
/**
|
|
349
|
+
* graz query hook to retrieve specific asset balance from current account or given address.
|
|
350
|
+
*
|
|
351
|
+
* @param denom - Asset denom to search
|
|
352
|
+
* @param bech32Address - Optional bech32 account address, defaults to connected account address
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```ts
|
|
356
|
+
* import { useBalance } from "graz";
|
|
357
|
+
*
|
|
358
|
+
* // basic example
|
|
359
|
+
* const { data, isFetching, refetch, ... } = useBalance("atom");
|
|
360
|
+
*
|
|
361
|
+
* // with custom bech32 address
|
|
362
|
+
* useBalance("atom", "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
|
|
363
|
+
* ```
|
|
364
|
+
*/
|
|
365
|
+
declare function useBalance(denom: string, bech32Address?: string): UseQueryResult<Coin | undefined>;
|
|
309
366
|
declare type UseConnectChainArgs = MutationEventArgs<ConnectArgs, Key>;
|
|
310
367
|
/**
|
|
311
368
|
* graz mutation hook to execute wallet connection with optional arguments to
|
|
@@ -346,7 +403,7 @@ declare function useConnect({ onError, onLoading, onSuccess }?: UseConnectChainA
|
|
|
346
403
|
isLoading: boolean;
|
|
347
404
|
isSuccess: boolean;
|
|
348
405
|
isSupported: boolean;
|
|
349
|
-
status: "error" | "
|
|
406
|
+
status: "error" | "idle" | "loading" | "success";
|
|
350
407
|
};
|
|
351
408
|
/**
|
|
352
409
|
* graz mutation hook to execute wallet disconnection with optional arguments to
|
|
@@ -378,7 +435,7 @@ declare function useDisconnect({ onError, onLoading, onSuccess }?: MutationEvent
|
|
|
378
435
|
error: unknown;
|
|
379
436
|
isLoading: boolean;
|
|
380
437
|
isSuccess: boolean;
|
|
381
|
-
status: "error" | "
|
|
438
|
+
status: "error" | "idle" | "loading" | "success";
|
|
382
439
|
};
|
|
383
440
|
/**
|
|
384
441
|
* graz hook to retrieve offline signer objects (default, amino enabled, and auto).
|
|
@@ -387,15 +444,43 @@ declare function useDisconnect({ onError, onLoading, onSuccess }?: MutationEvent
|
|
|
387
444
|
*
|
|
388
445
|
* @example
|
|
389
446
|
* ```ts
|
|
390
|
-
* import {
|
|
391
|
-
* const { signer, signerAmino, signerAuto } =
|
|
447
|
+
* import { useOfflineSigners } from "graz";
|
|
448
|
+
* const { signer, signerAmino, signerAuto } = useOfflineSigners();
|
|
392
449
|
* ```
|
|
393
450
|
*/
|
|
451
|
+
declare function useOfflineSigners(): {
|
|
452
|
+
signer: (_cosmjs_proto_signing.OfflineSigner & _cosmjs_proto_signing.OfflineDirectSigner) | null;
|
|
453
|
+
signerAmino: _cosmjs_proto_signing.OfflineSigner | null;
|
|
454
|
+
signerAuto: _cosmjs_proto_signing.OfflineSigner | null;
|
|
455
|
+
};
|
|
456
|
+
/**
|
|
457
|
+
* graz hook to retrieve offline signer objects (default, amino enabled, and auto).
|
|
458
|
+
*
|
|
459
|
+
* @deprecated prefer using {@link useOfflineSigners}
|
|
460
|
+
* @see {@link useOfflineSigners}
|
|
461
|
+
*/
|
|
394
462
|
declare function useSigners(): {
|
|
395
463
|
signer: (_cosmjs_proto_signing.OfflineSigner & _cosmjs_proto_signing.OfflineDirectSigner) | null;
|
|
396
464
|
signerAmino: _cosmjs_proto_signing.OfflineSigner | null;
|
|
397
465
|
signerAuto: _cosmjs_proto_signing.OfflineSigner | null;
|
|
398
466
|
};
|
|
467
|
+
/**
|
|
468
|
+
* graz query hook to retrieve list of staked balances from current account or given address.
|
|
469
|
+
*
|
|
470
|
+
* @param bech32Address - Optional bech32 account address, defaults to connected account address
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```ts
|
|
474
|
+
* import { useStakedBalances } from "graz";
|
|
475
|
+
*
|
|
476
|
+
* // basic example
|
|
477
|
+
* const { data, isFetching, refetch, ... } = useStakedBalances();
|
|
478
|
+
*
|
|
479
|
+
* // with custom bech32 address
|
|
480
|
+
* useStakedBalances("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
declare function useStakedBalances(bech32Address?: string): UseQueryResult<Coin | null>;
|
|
399
484
|
|
|
400
485
|
/**
|
|
401
486
|
* graz hook to retrieve connected account's active chain
|
|
@@ -407,6 +492,34 @@ declare function useSigners(): {
|
|
|
407
492
|
* ```
|
|
408
493
|
*/
|
|
409
494
|
declare function useActiveChain(): GrazChain | null;
|
|
495
|
+
/**
|
|
496
|
+
* graz hook to retrieve specific connected account's currency
|
|
497
|
+
*
|
|
498
|
+
* @param denom - Currency denom to search
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* ```ts
|
|
502
|
+
* import { useActiveChainCurrency } from "graz";
|
|
503
|
+
* const { data: currency, ... } = useActiveChainCurrency("juno");
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
declare function useActiveChainCurrency(denom: string): UseQueryResult<AppCurrency | undefined>;
|
|
507
|
+
/**
|
|
508
|
+
* graz hook to retrieve active chain validators with given query client and optional bond status
|
|
509
|
+
*
|
|
510
|
+
* @param queryClient - \@cosmjs/stargate query client object with {@link StakingExtension}
|
|
511
|
+
* @param status - Validator bond status string (defaults to BOND_STATUS_BONDED)
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```ts
|
|
515
|
+
* import { useActiveChainValidators, useQueryClient } from "graz";
|
|
516
|
+
* import { setupStakingExtension } from "@cosmjs/stargate";
|
|
517
|
+
*
|
|
518
|
+
* const queryClient = useQueryClient(setupStakingExtension);
|
|
519
|
+
* const { data: response, ... } = useActiveChainValidators(queryClient);
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
declare function useActiveChainValidators<T extends QueryClient & StakingExtension>(queryClient: T | undefined, status?: BondStatusString): UseQueryResult<QueryValidatorsResponse>;
|
|
410
523
|
/**
|
|
411
524
|
* graz hook to retrieve last connected chain info
|
|
412
525
|
*
|
|
@@ -450,7 +563,7 @@ declare function useSuggestChain({ onError, onLoading, onSuccess }?: UseSuggestC
|
|
|
450
563
|
isSuccess: boolean;
|
|
451
564
|
suggest: _tanstack_react_query.UseMutateFunction<ChainInfo, unknown, ChainInfo, unknown>;
|
|
452
565
|
suggestAsync: _tanstack_react_query.UseMutateAsyncFunction<ChainInfo, unknown, ChainInfo, unknown>;
|
|
453
|
-
status: "error" | "
|
|
566
|
+
status: "error" | "idle" | "loading" | "success";
|
|
454
567
|
};
|
|
455
568
|
declare type UseSuggestChainAndConnectArgs = MutationEventArgs<ChainInfo, {
|
|
456
569
|
chain: ChainInfo;
|
|
@@ -488,7 +601,7 @@ declare function useSuggestChainAndConnect({ onError, onLoading, onSuccess }?: U
|
|
|
488
601
|
isLoading: boolean;
|
|
489
602
|
isSuccess: boolean;
|
|
490
603
|
isSupported: boolean;
|
|
491
|
-
status: "error" | "
|
|
604
|
+
status: "error" | "idle" | "loading" | "success";
|
|
492
605
|
suggestAndConnect: _tanstack_react_query.UseMutateFunction<{
|
|
493
606
|
account: Key;
|
|
494
607
|
chain: ChainInfo;
|
|
@@ -499,9 +612,39 @@ declare function useSuggestChainAndConnect({ onError, onLoading, onSuccess }?: U
|
|
|
499
612
|
}, unknown, ChainInfo, unknown>;
|
|
500
613
|
};
|
|
501
614
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
615
|
+
/**
|
|
616
|
+
* graz query hook to create and use {@link QueryClient} similar when using {@link QueryClient.withExtensions}.
|
|
617
|
+
*
|
|
618
|
+
* Note: `useQueryClient` returns \@cosmjs/stargate's {@link QueryClient},
|
|
619
|
+
* NOT to be confused with \@tanstack/react-query useQueryClient.
|
|
620
|
+
*
|
|
621
|
+
* @example
|
|
622
|
+
* ```ts
|
|
623
|
+
* // example without extensions
|
|
624
|
+
* import { useQueryClient } from "graz";
|
|
625
|
+
*
|
|
626
|
+
* const queryClient = useQueryClient();
|
|
627
|
+
*
|
|
628
|
+
* // example with extensions
|
|
629
|
+
* import { useQueryClient } from "graz";
|
|
630
|
+
* import { setupAuthExtension, setupIbcExtension } from "@cosmjs/stargate";
|
|
631
|
+
*
|
|
632
|
+
* const queryClientWithExtensions = useQueryClient(setupAuthExtension, setupIbcExtension);
|
|
633
|
+
* ```
|
|
634
|
+
*
|
|
635
|
+
* @see {@link createQueryClient}
|
|
636
|
+
*/
|
|
637
|
+
declare function useQueryClient(): UseQueryResult<QueryClient>;
|
|
638
|
+
declare function useQueryClient<A extends object>(setupA: ExtensionSetup<A>): UseQueryResult<QueryClient & A>;
|
|
639
|
+
declare function useQueryClient<A extends object, B extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>): UseQueryResult<QueryClient & A & B>;
|
|
640
|
+
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>;
|
|
641
|
+
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>;
|
|
642
|
+
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>;
|
|
643
|
+
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>;
|
|
644
|
+
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>;
|
|
645
|
+
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>;
|
|
646
|
+
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>;
|
|
647
|
+
|
|
505
648
|
/**
|
|
506
649
|
* graz query hook to retrieve a CosmWasmClient. If there's no given arguments it will be using the current connected client
|
|
507
650
|
*
|
|
@@ -516,22 +659,7 @@ declare type WithRefetchOpts<T> = T & {
|
|
|
516
659
|
* useClient({ rpc: "https://rpc.cosmoshub.strange.love", });
|
|
517
660
|
* ```
|
|
518
661
|
*/
|
|
519
|
-
declare function useClients(args?:
|
|
520
|
-
data: {
|
|
521
|
-
cosmWasm: _cosmjs_cosmwasm_stargate.CosmWasmClient;
|
|
522
|
-
stargate: _cosmjs_stargate.StargateClient;
|
|
523
|
-
} | null | undefined;
|
|
524
|
-
error: unknown;
|
|
525
|
-
isFetching: boolean;
|
|
526
|
-
isLoading: boolean;
|
|
527
|
-
isRefetching: boolean;
|
|
528
|
-
isSuccess: boolean;
|
|
529
|
-
refetch: <TPageData>(options?: (_tanstack_react_query.RefetchOptions & _tanstack_react_query.RefetchQueryFilters<TPageData>) | undefined) => Promise<_tanstack_react_query.QueryObserverResult<{
|
|
530
|
-
cosmWasm: _cosmjs_cosmwasm_stargate.CosmWasmClient;
|
|
531
|
-
stargate: _cosmjs_stargate.StargateClient;
|
|
532
|
-
} | null, unknown>>;
|
|
533
|
-
status: "error" | "success" | "loading";
|
|
534
|
-
};
|
|
662
|
+
declare function useClients(args?: CreateClientArgs): UseQueryResult<GrazStore["clients"]>;
|
|
535
663
|
/**
|
|
536
664
|
* graz query hook to retrieve a SigningCosmWasmClient. If there's no given args it will be using the current connected signer
|
|
537
665
|
*
|
|
@@ -550,21 +678,60 @@ declare function useClients(args?: WithRefetchOpts<CreateClientArgs>): {
|
|
|
550
678
|
* });
|
|
551
679
|
* ```
|
|
552
680
|
*/
|
|
553
|
-
declare function useSigningClients(args?:
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
681
|
+
declare function useSigningClients(args?: CreateSigningClientArgs): UseQueryResult<GrazStore["signingClients"]>;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* graz mutation hook to send tokens. Note: if `senderAddress` undefined, it will use current connected account address.
|
|
685
|
+
*
|
|
686
|
+
* @example
|
|
687
|
+
* ```ts
|
|
688
|
+
* import { useSendTokens } from "graz";
|
|
689
|
+
*
|
|
690
|
+
* // basic example
|
|
691
|
+
* const { sendTokens } = useSendTokens();
|
|
692
|
+
*
|
|
693
|
+
* sendTokens({
|
|
694
|
+
* recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430";
|
|
695
|
+
* amount: [coin];
|
|
696
|
+
* ...
|
|
697
|
+
* })
|
|
698
|
+
* ```
|
|
699
|
+
*
|
|
700
|
+
* @see {@link sendTokens}
|
|
701
|
+
*/
|
|
702
|
+
declare function useSendTokens({ onError, onLoading, onSuccess }?: MutationEventArgs): {
|
|
703
|
+
error: unknown;
|
|
704
|
+
isLoading: boolean;
|
|
705
|
+
isSuccess: boolean;
|
|
706
|
+
sendTokens: _tanstack_react_query.UseMutateFunction<_cosmjs_stargate.DeliverTxResponse, unknown, SendTokensArgs, unknown>;
|
|
707
|
+
sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<_cosmjs_stargate.DeliverTxResponse, unknown, SendTokensArgs, unknown>;
|
|
708
|
+
status: "error" | "idle" | "loading" | "success";
|
|
709
|
+
};
|
|
710
|
+
/**
|
|
711
|
+
* graz mutation hook to send IBC tokens. Note: if `senderAddress` undefined, it will use current connected account address.
|
|
712
|
+
*
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* ```ts
|
|
716
|
+
* import { useSendIbcTokens } from "graz";
|
|
717
|
+
*
|
|
718
|
+
* // basic example
|
|
719
|
+
* const { sendIbcTokens } = useSendIbcTokens();
|
|
720
|
+
*
|
|
721
|
+
* sendIbcTokens({
|
|
722
|
+
* recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430",
|
|
723
|
+
* transferAmount: coin,
|
|
724
|
+
* ...
|
|
725
|
+
* })
|
|
726
|
+
* ```
|
|
727
|
+
*/
|
|
728
|
+
declare function useSendIbcTokens({ onError, onLoading, onSuccess }?: MutationEventArgs): {
|
|
558
729
|
error: unknown;
|
|
559
|
-
isFetching: boolean;
|
|
560
730
|
isLoading: boolean;
|
|
561
|
-
isRefetching: boolean;
|
|
562
731
|
isSuccess: boolean;
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
} | null, unknown>>;
|
|
567
|
-
status: "error" | "success" | "loading";
|
|
732
|
+
sendIbcTokens: _tanstack_react_query.UseMutateFunction<_cosmjs_stargate.DeliverTxResponse, unknown, SendIbcTokensArgs, unknown>;
|
|
733
|
+
sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<_cosmjs_stargate.DeliverTxResponse, unknown, SendIbcTokensArgs, unknown>;
|
|
734
|
+
status: "error" | "idle" | "loading" | "success";
|
|
568
735
|
};
|
|
569
736
|
|
|
570
737
|
/**
|
|
@@ -579,7 +746,7 @@ declare function useSigningClients(args?: WithRefetchOpts<CreateSigningClientArg
|
|
|
579
746
|
*
|
|
580
747
|
* @deprecated prefer using {@link useCheckWallet}
|
|
581
748
|
*/
|
|
582
|
-
declare function useCheckKeplr():
|
|
749
|
+
declare function useCheckKeplr(): UseQueryResult<boolean>;
|
|
583
750
|
/**
|
|
584
751
|
* graz query hook to check whether given {@link WalletType} or default configured wallet is supported
|
|
585
752
|
*
|
|
@@ -591,7 +758,7 @@ declare function useCheckKeplr(): _tanstack_react_query.UseQueryResult<boolean,
|
|
|
591
758
|
* const { data: isKeplrSupported } = useCheckWallet("keplr");
|
|
592
759
|
* ```
|
|
593
760
|
*/
|
|
594
|
-
declare function useCheckWallet(type?: WalletType):
|
|
761
|
+
declare function useCheckWallet(type?: WalletType): UseQueryResult<boolean>;
|
|
595
762
|
|
|
596
763
|
declare type GrazProviderProps = Partial<QueryClientProviderProps> & {
|
|
597
764
|
grazOptions?: ConfigureGrazArgs;
|
|
@@ -629,4 +796,4 @@ declare function useGrazEvents(): null;
|
|
|
629
796
|
*/
|
|
630
797
|
declare function GrazEvents(): null;
|
|
631
798
|
|
|
632
|
-
export { ChainInfoWithPath, ConfigureGrazArgs, ConnectArgs, CreateClientArgs, CreateSigningClientArgs, Dictionary, GrazChain, GrazEvents, GrazProvider, GrazProviderProps, Maybe, UseAccountArgs, UseConnectChainArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WalletType, checkWallet, clearRecentChain, configureGraz, connect, createClients, createSigningClients, defineChain, defineChainInfo, defineChains, disconnect, getBalances, getKeplr, getRecentChain, getWallet, mainnetChains, mainnetChainsArray, reconnect, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChain, useBalances, useCheckKeplr, useCheckWallet, useClients, useConnect, useDisconnect, useGrazEvents, useRecentChain, useSigners, useSigningClients, useSuggestChain, useSuggestChainAndConnect };
|
|
799
|
+
export { ChainInfoWithPath, ConfigureGrazArgs, ConnectArgs, CreateClientArgs, CreateSigningClientArgs, Dictionary, GrazAdapter, GrazChain, GrazEvents, GrazProvider, GrazProviderProps, Maybe, SendIbcTokensArgs, SendTokensArgs, UseAccountArgs, UseConnectChainArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WalletType, checkWallet, clearRecentChain, configureGraz, connect, createClients, createQueryClient, createSigningClients, defineChain, defineChainInfo, defineChains, disconnect, getActiveChainCurrency, getBalances, getKeplr, getRecentChain, getStakedBalances, getWallet, mainnetChains, mainnetChainsArray, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChain, useActiveChainCurrency, useActiveChainValidators, useBalance, useBalances, useCheckKeplr, useCheckWallet, useClients, useConnect, useDisconnect, useGrazEvents, useOfflineSigners, useQueryClient, useRecentChain, useSendIbcTokens, useSendTokens, useSigners, useSigningClients, useStakedBalances, useSuggestChain, useSuggestChainAndConnect };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ze=Object.create;var C=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,We=Object.prototype.hasOwnProperty;var Me=(e,t)=>{for(var o in t)C(e,o,{get:t[o],enumerable:!0})},J=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Te(t))!We.call(e,n)&&n!==o&&C(e,n,{get:()=>t[n],enumerable:!(r=je(t,n))||r.enumerable});return e};var V=(e,t,o)=>(o=e!=null?ze(Oe(e)):{},J(t||!e||!e.__esModule?C(o,"default",{value:e,enumerable:!0}):o,e)),Ue=e=>J(C({},"__esModule",{value:!0}),e);var kn={};Me(kn,{GrazEvents:()=>L,GrazProvider:()=>xn,checkWallet:()=>G,clearRecentChain:()=>j,configureGraz:()=>O,connect:()=>l,createClients:()=>h,createSigningClients:()=>f,defineChain:()=>on,defineChainInfo:()=>rn,defineChains:()=>tn,disconnect:()=>b,getBalances:()=>z,getKeplr:()=>$,getRecentChain:()=>Pe,getWallet:()=>u,mainnetChains:()=>sn,mainnetChainsArray:()=>cn,reconnect:()=>p,suggestChain:()=>w,suggestChainAndConnect:()=>T,testnetChains:()=>an,testnetChainsArray:()=>mn,useAccount:()=>xe,useActiveChain:()=>fn,useBalances:()=>un,useCheckKeplr:()=>pn,useCheckWallet:()=>g,useClients:()=>wn,useConnect:()=>ln,useDisconnect:()=>gn,useGrazEvents:()=>Ie,useRecentChain:()=>yn,useSigners:()=>hn,useSigningClients:()=>Sn,useSuggestChain:()=>Cn,useSuggestChainAndConnect:()=>dn});module.exports=Ue(kn);var Y=require("@cosmjs/stargate");var X=V(require("zustand")),d=require("zustand/middleware"),I={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},qe={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},i=(0,X.default)((0,d.subscribeWithSelector)((0,d.persist)(()=>I,qe)));var D=require("@cosmjs/cosmwasm-stargate"),v=require("@cosmjs/stargate");async function h({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}},[r,n]=await Promise.all([D.SigningCosmWasmClient.connect(o),v.SigningStargateClient.connect(o)]);return{cosmWasm:r,stargate:n}}async function f(e){let{rpc:t,rpcHeaders:o,offlineSignerAuto:r,cosmWasmSignerOptions:n={},stargateSignerOptions:c={}}=e,s={url:t,headers:{...o||{}}},[m,x]=await Promise.all([D.SigningCosmWasmClient.connectWithSigner(s,r,n),v.SigningStargateClient.connectWithSigner(s,r,c)]);return{cosmWasm:m,stargate:x}}function G(e=i.getState().walletType){try{return u(e),!0}catch(t){return console.error(t),!1}}function $(){if(typeof window.keplr<"u")return window.keplr;throw i.getState()._notFoundFn(),new Error("window.keplr is not defined")}function u(e=i.getState().walletType){switch(e){case"keplr":return $();default:throw new Error("Unknown wallet type")}}async function l(e){try{let{defaultChain:t,recentChain:o,walletType:r}=i.getState(),n=(e==null?void 0:e.walletType)||r,c=u(n),s=e||o||t;if(!s)throw new Error("No last known connected chain, connect action requires chain info");i.setState(k=>{let be=k._reconnect;return k.activeChain&&k.activeChain.chainId!==s.chainId?{status:"connecting"}:be?{status:"reconnecting"}:{status:"connecting"}}),await c.enable(s.chainId);let m=c.getOfflineSigner(s.chainId),x=c.getOfflineSignerOnlyAmino(s.chainId),H=await c.getOfflineSignerAuto(s.chainId),De=s.gas?Y.GasPrice.fromString(`${s.gas.price}${s.gas.denom}`):void 0,[Q,ve,Ge]=await Promise.all([c.getKey(s.chainId),h(s),f({...s,offlineSignerAuto:H,cosmWasmSignerOptions:{gasPrice:De,...(e==null?void 0:e.signerOpts)||{}}})]);return i.setState({account:Q,activeChain:s,clients:ve,offlineSigner:m,offlineSignerAmino:x,offlineSignerAuto:H,recentChain:s,signingClients:Ge,status:"connected",walletType:n,_reconnect:!0}),Q}catch(t){throw i.getState().account===null&&i.setState({status:"disconnected"}),t}}async function b(e=!1){return i.setState(t=>({...I,recentChain:e?null:t.recentChain})),Promise.resolve()}async function z(e){let{activeChain:t,signingClients:o}=i.getState();if(!t||!o)throw new Error("No connected account detected");let{defaultSigningClient:r}=i.getState();return await Promise.all(t.currencies.map(async c=>o[r].getBalance(e,c.coinMinimalDenom)))}function p(){let{activeChain:e}=i.getState();e&&l(e)}function j(){i.setState({recentChain:null})}function Pe(){return i.getState().recentChain}async function w(e){return await u().experimentalSuggestChain(e),e}async function T(e){let t=await w(e);return{account:await l(e),chain:t}}function O(e={}){return i.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||e.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}var ee=require("@keplr-wallet/cosmos"),ne={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Ke={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"},Ee={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},Ne={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Re={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},Z=[ne,Ke,Be,Ee,Ne,Re],W={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:ne,bip44:{coinType:118},bech32Config:ee.Bech32Address.defaultBech32Config("axelar"),currencies:Z,feeCurrencies:Z};var oe=require("@keplr-wallet/cosmos"),re={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},te=[re],S={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:re,bip44:{coinType:118},bech32Config:oe.Bech32Address.defaultBech32Config("cosmos"),currencies:te,feeCurrencies:te};var se=require("@keplr-wallet/cosmos"),ce={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Fe={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Le={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},_e={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},He={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Qe={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Je={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Ve={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Xe={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},$e={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Ye={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},ie=[ce,Fe,Le,_e,He,Qe,Je,Ve,Xe,$e,Ye],M={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:ce,bip44:{coinType:118},bech32Config:se.Bech32Address.defaultBech32Config("juno"),currencies:ie,feeCurrencies:ie};var me=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"},Ze={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},ae=[pe,Ze],U={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:pe,bip44:{coinType:118},bech32Config:me.Bech32Address.defaultBech32Config("osmo"),currencies:ae,feeCurrencies:ae};var le=require("@keplr-wallet/cosmos"),ge={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},ue=[ge],q={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:ge,bip44:{coinType:118},bech32Config:le.Bech32Address.defaultBech32Config("somm"),currencies:ue,feeCurrencies:ue};var fe=require("@keplr-wallet/cosmos"),ye={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},he=[ye],P={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:he,feeCurrencies:he,stakeCurrency:ye,coinType:118};var Ce=require("@keplr-wallet/cosmos"),K={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},en=[K],B={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:K,bip44:{coinType:118},bech32Config:Ce.Bech32Address.defaultBech32Config("juno"),currencies:en,feeCurrencies:[K],coinType:118};var de=require("@keplr-wallet/cosmos"),E={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},nn=[E],N={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:E,bip44:{coinType:118},bech32Config:de.Bech32Address.defaultBech32Config("osmo"),currencies:nn,feeCurrencies:[E],coinType:118};function tn(e){return e}function on(e){return e}function rn(e){return e}var sn={axelar:W,cosmos:S,cosmoshub:S,juno:M,osmosis:U,sommelier:q},cn=[W,S,M,U,q],an={crescent:P,juno:B,osmosis:N},mn=[P,B,N];var y=require("@tanstack/react-query"),Se=require("react"),Ae=V(require("zustand/shallow"));var we=require("@tanstack/react-query");function pn(){return g("keplr")}function g(e){let t=i(r=>e||r.walletType);return(0,we.useQuery)(["USE_CHECK_WALLET",t],({queryKey:[,r]})=>G(r))}function xe({onConnect:e,onDisconnect:t}={}){let o=i(n=>n.account),r=i(n=>n.status);return(0,Se.useEffect)(()=>i.subscribe(n=>n.status,(n,c)=>{if(n==="connected"){let s=i.getState();e==null||e({account:s.account,isReconnect:c==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",reconnect:p,status:r}}function un(e){let{data:t}=xe(),o=e||(t==null?void 0:t.bech32Address),n=(0,y.useQuery)(["USE_BALANCES",o],({queryKey:[,c]})=>z(c),{enabled:Boolean(o)});return{data:n.data,error:n.error,isFetching:n.isFetching,isLoading:n.isLoading,isRefetching:n.isRefetching,isSuccess:n.isSuccess,refetch:n.refetch,status:n.status}}function ln({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,y.useMutation)(["USE_CONNECT",e,t,o],l,{onError:(s,m)=>Promise.resolve(e==null?void 0:e(s,m)),onMutate:t,onSuccess:s=>Promise.resolve(o==null?void 0:o(s))}),{data:c}=g();return{connect:s=>n.mutate(s),connectAsync:s=>n.mutateAsync(s),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(c),status:n.status}}function gn({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,y.useMutation)(["USE_DISCONNECT",e,t,o],b,{onError:c=>Promise.resolve(e==null?void 0:e(c,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:c=>n.mutate(c),disconnectAsync:c=>n.mutateAsync(c),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function hn(){return i(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Ae.default)}var R=require("@tanstack/react-query");function fn(){return i(e=>e.activeChain)}function yn(){return{data:i(t=>t.recentChain),clear:j}}function Cn({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,R.useMutation)(["USE_SUGGEST_CHAIN",e,t,o],w,{onError:(c,s)=>Promise.resolve(e==null?void 0:e(c,s)),onMutate:t,onSuccess:c=>Promise.resolve(o==null?void 0:o(c))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function dn({onError:e,onLoading:t,onSuccess:o}={}){let n=(0,R.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],T,{onError:(s,m)=>Promise.resolve(e==null?void 0:e(s,m)),onMutate:t,onSuccess:s=>Promise.resolve(o==null?void 0:o(s))}),{data:c}=g();return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(c),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}var F=require("@tanstack/react-query");function wn(e){let t=i(n=>n.clients),r=(0,F.useQuery)(["USE_CLIENTS",e,t],({queryKey:[,n,c]})=>n!=null&&n.rpc?h(n):c,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:r.data,error:r.error,isFetching:r.isFetching,isLoading:r.isLoading,isRefetching:r.isRefetching,isSuccess:r.isSuccess,refetch:r.refetch,status:r.status}}function Sn(e){let t=i(n=>n.signingClients),r=(0,F.useQuery)(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,n,c]})=>n!=null&&n.rpc?f(n):c,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:r.data,error:r.error,isFetching:r.isFetching,isLoading:r.isLoading,isRefetching:r.isRefetching,isSuccess:r.isSuccess,refetch:r.refetch,status:r.status}}var A=require("@tanstack/react-query");var ke=require("react");function Ie(){return(0,ke.useEffect)(()=>{let{_reconnect:e}=i.getState();return e&&p(),window.addEventListener("keplr_keystorechange",p),()=>{window.removeEventListener("keplr_keystorechange",p)}},[]),null}function L(){return Ie(),null}var _=require("react/jsx-runtime"),An=new A.QueryClient({});function xn({children:e,grazOptions:t,...o}){return t&&O(t),(0,_.jsxs)(A.QueryClientProvider,{client:An,...o,children:[(0,_.jsx)(L,{}),e]})}0&&(module.exports={GrazEvents,GrazProvider,checkWallet,clearRecentChain,configureGraz,connect,createClients,createSigningClients,defineChain,defineChainInfo,defineChains,disconnect,getBalances,getKeplr,getRecentChain,getWallet,mainnetChains,mainnetChainsArray,reconnect,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useBalances,useCheckKeplr,useCheckWallet,useClients,useConnect,useDisconnect,useGrazEvents,useRecentChain,useSigners,useSigningClients,useSuggestChain,useSuggestChainAndConnect});
|
|
1
|
+
"use strict";var ot=Object.create;var I=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,ct=Object.prototype.hasOwnProperty;var ut=(e,t)=>()=>(e&&(t=e(e=0)),t);var w=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),at=(e,t)=>{for(var n in t)I(e,n,{get:t[n],enumerable:!0})},me=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of st(t))!ct.call(e,o)&&o!==n&&I(e,o,{get:()=>t[o],enumerable:!(c=rt(t,o))||c.enumerable});return e};var B=(e,t,n)=>(n=e!=null?ot(it(e)):{},me(t||!e||!e.__esModule?I(n,"default",{value:e,enumerable:!0}):n,e)),pt=e=>me(I({},"__esModule",{value:!0}),e);var a,r=ut(()=>{"use strict";a=B(require("react"))});var fe=w(C=>{"use strict";r();Object.defineProperty(C,"__esModule",{value:!0});C.arrayContentStartsWith=C.arrayContentEquals=void 0;function lt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}C.arrayContentEquals=lt;function ft(e,t){if(e.length<t.length)return!1;for(let n=0;n<t.length;++n)if(e[n]!==t[n])return!1;return!0}C.arrayContentStartsWith=ft});var ye=w(f=>{"use strict";r();Object.defineProperty(f,"__esModule",{value:!0});f.assertDefinedAndNotNull=f.assertDefined=f.assert=void 0;function yt(e,t){if(!e)throw new Error(t||"condition is not truthy")}f.assert=yt;function dt(e,t){if(e===void 0)throw new Error(t??"value is undefined")}f.assertDefined=dt;function gt(e,t){if(e==null)throw new Error(t??"value is undefined or null")}f.assertDefinedAndNotNull=gt});var de=w(G=>{"use strict";r();Object.defineProperty(G,"__esModule",{value:!0});G.sleep=void 0;async function Ct(e){return new Promise(t=>setTimeout(t,e))}G.sleep=Ct});var Ce=w(h=>{"use strict";r();Object.defineProperty(h,"__esModule",{value:!0});h.isUint8Array=h.isNonNullObject=void 0;function ge(e){return typeof e=="object"&&e!==null}h.isNonNullObject=ge;function ht(e){return!(!ge(e)||Object.prototype.toString.call(e)!=="[object Uint8Array]"||typeof Buffer<"u"&&typeof Buffer.isBuffer<"u"&&Buffer.isBuffer(e))}h.isUint8Array=ht});var Se=w(m=>{"use strict";r();Object.defineProperty(m,"__esModule",{value:!0});m.isUint8Array=m.isNonNullObject=m.sleep=m.assertDefinedAndNotNull=m.assertDefined=m.assert=m.arrayContentStartsWith=m.arrayContentEquals=void 0;var he=fe();Object.defineProperty(m,"arrayContentEquals",{enumerable:!0,get:function(){return he.arrayContentEquals}});Object.defineProperty(m,"arrayContentStartsWith",{enumerable:!0,get:function(){return he.arrayContentStartsWith}});var z=ye();Object.defineProperty(m,"assert",{enumerable:!0,get:function(){return z.assert}});Object.defineProperty(m,"assertDefined",{enumerable:!0,get:function(){return z.assertDefined}});Object.defineProperty(m,"assertDefinedAndNotNull",{enumerable:!0,get:function(){return z.assertDefinedAndNotNull}});var xt=de();Object.defineProperty(m,"sleep",{enumerable:!0,get:function(){return xt.sleep}});var xe=Ce();Object.defineProperty(m,"isNonNullObject",{enumerable:!0,get:function(){return xe.isNonNullObject}});Object.defineProperty(m,"isUint8Array",{enumerable:!0,get:function(){return xe.isUint8Array}})});var ln={};at(ln,{GrazEvents:()=>ue,GrazProvider:()=>mn,checkWallet:()=>K,clearRecentChain:()=>F,configureGraz:()=>H,connect:()=>A,createClients:()=>D,createQueryClient:()=>N,createSigningClients:()=>k,defineChain:()=>Mt,defineChainInfo:()=>Kt,defineChains:()=>Pt,disconnect:()=>W,getActiveChainCurrency:()=>R,getBalances:()=>L,getKeplr:()=>Ee,getRecentChain:()=>St,getStakedBalances:()=>V,getWallet:()=>S,mainnetChains:()=>Wt,mainnetChainsArray:()=>Ft,reconnect:()=>d,sendIbcTokens:()=>$,sendTokens:()=>J,suggestChain:()=>T,suggestChainAndConnect:()=>_,testnetChains:()=>Rt,testnetChainsArray:()=>_t,useAccount:()=>E,useActiveChain:()=>Yt,useActiveChainCurrency:()=>Zt,useActiveChainValidators:()=>en,useBalance:()=>Lt,useBalances:()=>Ve,useCheckKeplr:()=>Ht,useCheckWallet:()=>b,useClients:()=>sn,useConnect:()=>Vt,useDisconnect:()=>Jt,useGrazEvents:()=>Ye,useOfflineSigners:()=>Je,useQueryClient:()=>rn,useRecentChain:()=>tn,useSendIbcTokens:()=>an,useSendTokens:()=>un,useSigners:()=>$t,useSigningClients:()=>cn,useStakedBalances:()=>Xt,useSuggestChain:()=>nn,useSuggestChainAndConnect:()=>on});module.exports=pt(ln);r();r();var je=require("@cosmjs/stargate");r();var le=B(require("zustand")),v=require("zustand/middleware"),O={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},mt={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},u=(0,le.default)((0,v.subscribeWithSelector)((0,v.persist)(()=>O,mt)));r();var P=require("@cosmjs/cosmwasm-stargate"),M=require("@cosmjs/stargate"),be=require("@cosmjs/tendermint-rpc");r();var Ae=require("@cosmjs/stargate"),x=B(Se());function N(...e){let{tendermint:t}=u.getState().clients,n=new Ae.QueryClient(t),c=e.map(o=>o(n));for(let o of c){(0,x.assert)((0,x.isNonNullObject)(o),"Extension must be a non-null object");for(let[i,s]of Object.entries(o)){(0,x.assert)((0,x.isNonNullObject)(s),`Module must be a non-null object. Found type ${typeof s} for module "${i}".`);let p=n[i]||{};n[i]={...p,...s}}}return n}async function D({rpc:e,rpcHeaders:t}){let n={url:e,headers:{...t||{}}},[c,o,i]=await Promise.all([P.SigningCosmWasmClient.connect(n),M.SigningStargateClient.connect(n),be.Tendermint34Client.connect(e)]);return{cosmWasm:c,stargate:o,tendermint:i}}async function k(e){let{rpc:t,rpcHeaders:n,offlineSignerAuto:c,cosmWasmSignerOptions:o={},stargateSignerOptions:i={}}=e,s={url:t,headers:{...n||{}}},[p,l]=await Promise.all([P.SigningCosmWasmClient.connectWithSigner(s,c,o),M.SigningStargateClient.connectWithSigner(s,c,i)]);return{cosmWasm:p,stargate:l}}r();function K(e=u.getState().walletType){try{return S(e),!0}catch(t){return console.error(t),!1}}function Ee(){if(typeof window.keplr<"u")return window.keplr;throw u.getState()._notFoundFn(),new Error("window.keplr is not defined")}function S(e=u.getState().walletType){switch(e){case"keplr":return Ee();default:throw new Error("Unknown wallet type")}}async function A(e){try{let{defaultChain:t,recentChain:n,walletType:c}=u.getState(),o=(e==null?void 0:e.walletType)||c,i=S(o),s=e||n||t;if(!s)throw new Error("No last known connected chain, connect action requires chain info");u.setState(Q=>{let nt=Q._reconnect;return Q.activeChain&&Q.activeChain.chainId!==s.chainId?{status:"connecting"}:nt?{status:"reconnecting"}:{status:"connecting"}}),await i.enable(s.chainId);let p=i.getOfflineSigner(s.chainId),l=i.getOfflineSignerOnlyAmino(s.chainId),y=await i.getOfflineSignerAuto(s.chainId),Ze=s.gas?je.GasPrice.fromString(`${s.gas.price}${s.gas.denom}`):void 0,[pe,et,tt]=await Promise.all([i.getKey(s.chainId),D(s),k({...s,offlineSignerAuto:y,cosmWasmSignerOptions:{gasPrice:Ze,...(e==null?void 0:e.signerOpts)||{}}})]);return u.setState({account:pe,activeChain:s,clients:et,offlineSigner:p,offlineSignerAmino:l,offlineSignerAuto:y,recentChain:s,signingClients:tt,status:"connected",walletType:o,_reconnect:!0}),pe}catch(t){throw u.getState().account===null&&u.setState({status:"disconnected"}),t}}async function W(e=!1){return u.setState(t=>({...O,recentChain:e?null:t.recentChain})),Promise.resolve()}function d(){let{activeChain:e}=u.getState();e&&A(e)}r();function F(){u.setState({recentChain:null})}function R(e){let{activeChain:t}=u.getState();return t==null?void 0:t.currencies.find(n=>n.coinMinimalDenom===e)}function St(){return u.getState().recentChain}async function T(e){return await S().experimentalSuggestChain(e),e}async function _(e){let t=await T(e);return{account:await A(e),chain:t}}r();function H(e={}){return u.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||e.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}r();async function L(e){let{activeChain:t,signingClients:n}=u.getState();if(!t||!n)throw new Error("No connected account detected");let{defaultSigningClient:c}=u.getState();return await Promise.all(t.currencies.map(async i=>n[c].getBalance(e,i.coinMinimalDenom)))}async function V(e){let{clients:t}=u.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:n,fee:c,memo:o}){let{signingClients:i,defaultSigningClient:s}=u.getState();if(!i)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return i[s].sendTokens(e,t,n,c,o)}async function $({senderAddress:e,recipientAddress:t,transferAmount:n,sourcePort:c,sourceChannel:o,timeoutHeight:i,timeoutTimestamp:s,fee:p,memo:l}){let{signingClients:y}=u.getState();if(!(y!=null&&y.stargate))throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return y.stargate.sendIbcTokens(e,t,n,c,o,i,s,p,l)}r();r();var De=require("@keplr-wallet/cosmos"),ke={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},At={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},bt={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Et={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},jt={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},wt={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},we=[ke,At,bt,Et,jt,wt],X={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:ke,bip44:{coinType:118},bech32Config:De.Bech32Address.defaultBech32Config("axelar"),currencies:we,feeCurrencies:we};r();var Be=require("@keplr-wallet/cosmos"),ve={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Ie=[ve],q={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:ve,bip44:{coinType:118},bech32Config:Be.Bech32Address.defaultBech32Config("cosmos"),currencies:Ie,feeCurrencies:Ie};r();var Te=require("@keplr-wallet/cosmos"),qe={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Dt={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},kt={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},It={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"},vt={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Gt={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Tt={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},qt={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"},Qt={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},Ge=[qe,Dt,kt,It,Bt,vt,Gt,Tt,qt,Ut,Qt],Y={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:qe,bip44:{coinType:118},bech32Config:Te.Bech32Address.defaultBech32Config("juno"),currencies:Ge,feeCurrencies:Ge};r();var Qe=require("@keplr-wallet/cosmos"),Oe={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Ot={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Ue=[Oe,Ot],Z={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Oe,bip44:{coinType:118},bech32Config:Qe.Bech32Address.defaultBech32Config("osmo"),currencies:Ue,feeCurrencies:Ue};r();var Ne=require("@keplr-wallet/cosmos"),Pe={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},ze=[Pe],ee={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:Pe,bip44:{coinType:118},bech32Config:Ne.Bech32Address.defaultBech32Config("somm"),currencies:ze,feeCurrencies:ze};r();var Ke=require("@keplr-wallet/cosmos"),We={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},Me=[We],te={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:Ke.Bech32Address.defaultBech32Config("CRE"),currencies:Me,feeCurrencies:Me,stakeCurrency:We,coinType:118};r();var Fe=require("@keplr-wallet/cosmos"),ne={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},zt=[ne],oe={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:ne,bip44:{coinType:118},bech32Config:Fe.Bech32Address.defaultBech32Config("juno"),currencies:zt,feeCurrencies:[ne],coinType:118};r();var Re=require("@keplr-wallet/cosmos"),re={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Nt=[re],se={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:re,bip44:{coinType:118},bech32Config:Re.Bech32Address.defaultBech32Config("osmo"),currencies:Nt,feeCurrencies:[re],coinType:118};function Pt(e){return e}function Mt(e){return e}function Kt(e){return e}var Wt={axelar:X,cosmos:q,cosmoshub:q,juno:Y,osmosis:Z,sommelier:ee},Ft=[X,q,Y,Z,ee],Rt={crescent:te,juno:oe,osmosis:se},_t=[te,oe,se];r();var g=require("@tanstack/react-query"),He=require("react"),Le=B(require("zustand/shallow"));r();var _e=require("@tanstack/react-query");function Ht(){return b("keplr")}function b(e){let t=u(o=>e||o.walletType);return(0,_e.useQuery)(["USE_CHECK_WALLET",t],({queryKey:[,o]})=>K(o))}function E({onConnect:e,onDisconnect:t}={}){let n=u(o=>o.account),c=u(o=>o.status);return(0,He.useEffect)(()=>u.subscribe(o=>o.status,(o,i)=>{if(o==="connected"){let s=u.getState();e==null||e({account:s.account,isReconnect:i==="reconnecting"})}o==="disconnected"&&(t==null||t())}),[e,t]),{data:n,isConnected:Boolean(n),isConnecting:c==="connecting",isDisconnected:c==="disconnected",isReconnecting:c==="reconnecting",reconnect:d,status:c}}function Ve(e){let{data:t}=E(),n=e||(t==null?void 0:t.bech32Address);return(0,g.useQuery)(["USE_BALANCES",n],({queryKey:[,i]})=>L(i),{enabled:Boolean(n)})}function Lt(e,t){let{data:n}=Ve(t);return(0,g.useQuery)(["USE_BALANCE",n,e,t],({queryKey:[,i]})=>i==null?void 0:i.find(s=>s.denom===e),{enabled:Boolean(n)})}function Vt({onError:e,onLoading:t,onSuccess:n}={}){let o=(0,g.useMutation)(["USE_CONNECT",e,t,n],A,{onError:(s,p)=>Promise.resolve(e==null?void 0:e(s,p)),onMutate:t,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=b();return{connect:s=>o.mutate(s),connectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:Boolean(i),status:o.status}}function Jt({onError:e,onLoading:t,onSuccess:n}={}){let o=(0,g.useMutation)(["USE_DISCONNECT",e,t,n],W,{onError:i=>Promise.resolve(e==null?void 0:e(i,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:i=>o.mutate(i),disconnectAsync:i=>o.mutateAsync(i),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,status:o.status}}function Je(){return u(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Le.default)}function $t(){return Je()}function Xt(e){let{data:t}=E(),n=e||(t==null?void 0:t.bech32Address);return(0,g.useQuery)(["USE_STAKED_BALANCES",n],({queryKey:[,i]})=>V(n),{enabled:Boolean(n)})}r();var j=require("@tanstack/react-query");function Yt(){return u(e=>e.activeChain)}function Zt(e){return(0,j.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,c]})=>R(c))}function en(e,t="BOND_STATUS_BONDED"){return(0,j.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,o,i]})=>o.staking.validators(i),{enabled:typeof e<"u"})}function tn(){return{data:u(t=>t.recentChain),clear:F}}function nn({onError:e,onLoading:t,onSuccess:n}={}){let o=(0,j.useMutation)(["USE_SUGGEST_CHAIN",e,t,n],T,{onError:(i,s)=>Promise.resolve(e==null?void 0:e(i,s)),onMutate:t,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,suggest:o.mutate,suggestAsync:o.mutateAsync,status:o.status}}function on({onError:e,onLoading:t,onSuccess:n}={}){let o=(0,j.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,n],_,{onError:(s,p)=>Promise.resolve(e==null?void 0:e(s,p)),onMutate:t,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=b();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:Boolean(i),status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}}r();var ie=require("@tanstack/react-query");r();var $e=require("@tanstack/react-query");function rn(...e){let t=["USE_QUERY_CLIENT",...e];return(0,$e.useQuery)(t,({queryKey:[,...c]})=>N(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})}function sn(e){let t=u(o=>o.clients);return(0,ie.useQuery)(["USE_CLIENTS",e,t],({queryKey:[,o,i]})=>o!=null&&o.rpc?D(o):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})}function cn(e){let t=u(o=>o.signingClients);return(0,ie.useQuery)(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,o,i]})=>o!=null&&o.rpc?k(o):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})}r();var ce=require("@tanstack/react-query");function un({onError:e,onLoading:t,onSuccess:n}={}){let{data:c}=E(),o=c==null?void 0:c.bech32Address,s=(0,ce.useMutation)(["USE_SEND_TOKENS",e,t,n,o],p=>J({senderAddress:o,...p}),{onError:(p,l)=>Promise.resolve(e==null?void 0:e(p,l)),onMutate:t,onSuccess:p=>Promise.resolve(n==null?void 0:n(p))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,sendTokens:s.mutate,sendTokensAsync:s.mutateAsync,status:s.status}}function an({onError:e,onLoading:t,onSuccess:n}={}){let{data:c}=E(),o=c==null?void 0:c.bech32Address,s=(0,ce.useMutation)(["USE_SEND_IBC_TOKENS",e,t,n,o],p=>$({senderAddress:o,...p}),{onError:(p,l)=>Promise.resolve(e==null?void 0:e(p,l)),onMutate:t,onSuccess:p=>Promise.resolve(n==null?void 0:n(p))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,sendIbcTokens:s.mutate,sendIbcTokensAsync:s.mutateAsync,status:s.status}}r();var U=require("@tanstack/react-query");r();var Xe=require("react");function Ye(){return(0,Xe.useEffect)(()=>{let{_reconnect:e}=u.getState();return e&&d(),window.addEventListener("keplr_keystorechange",d),()=>{window.removeEventListener("keplr_keystorechange",d)}},[]),null}function ue(){return Ye(),null}var ae=require("react/jsx-runtime"),pn=new U.QueryClient({});function mn({children:e,grazOptions:t,...n}){return t&&H(t),(0,ae.jsxs)(U.QueryClientProvider,{client:pn,...n,children:[(0,ae.jsx)(ue,{}),e]})}0&&(module.exports={GrazEvents,GrazProvider,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineChain,defineChainInfo,defineChains,disconnect,getActiveChainCurrency,getBalances,getKeplr,getRecentChain,getStakedBalances,getWallet,mainnetChains,mainnetChainsArray,reconnect,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useBalance,useBalances,useCheckKeplr,useCheckWallet,useClients,useConnect,useDisconnect,useGrazEvents,useOfflineSigners,useQueryClient,useRecentChain,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useStakedBalances,useSuggestChain,useSuggestChainAndConnect});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GasPrice as ue}from"@cosmjs/stargate";import se from"zustand";import{persist as ce,subscribeWithSelector as ae}from"zustand/middleware";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},me={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},i=se(ae(ce(()=>w,me)));import{SigningCosmWasmClient as O}from"@cosmjs/cosmwasm-stargate";import{SigningStargateClient as W}from"@cosmjs/stargate";async function h({rpc:e,rpcHeaders:t}){let o={url:e,headers:{...t||{}}},[r,n]=await Promise.all([O.connect(o),W.connect(o)]);return{cosmWasm:r,stargate:n}}async function f(e){let{rpc:t,rpcHeaders:o,offlineSignerAuto:r,cosmWasmSignerOptions:n={},stargateSignerOptions:c={}}=e,s={url:t,headers:{...o||{}}},[m,C]=await Promise.all([O.connectWithSigner(s,r,n),W.connectWithSigner(s,r,c)]);return{cosmWasm:m,stargate:C}}function M(e=i.getState().walletType){try{return u(e),!0}catch(t){return console.error(t),!1}}function pe(){if(typeof window.keplr<"u")return window.keplr;throw i.getState()._notFoundFn(),new Error("window.keplr is not defined")}function u(e=i.getState().walletType){switch(e){case"keplr":return pe();default:throw new Error("Unknown wallet type")}}async function l(e){try{let{defaultChain:t,recentChain:o,walletType:r}=i.getState(),n=(e==null?void 0:e.walletType)||r,c=u(n),s=e||o||t;if(!s)throw new Error("No last known connected chain, connect action requires chain info");i.setState(d=>{let ie=d._reconnect;return d.activeChain&&d.activeChain.chainId!==s.chainId?{status:"connecting"}:ie?{status:"reconnecting"}:{status:"connecting"}}),await c.enable(s.chainId);let m=c.getOfflineSigner(s.chainId),C=c.getOfflineSignerOnlyAmino(s.chainId),j=await c.getOfflineSignerAuto(s.chainId),te=s.gas?ue.fromString(`${s.gas.price}${s.gas.denom}`):void 0,[T,oe,re]=await Promise.all([c.getKey(s.chainId),h(s),f({...s,offlineSignerAuto:j,cosmWasmSignerOptions:{gasPrice:te,...(e==null?void 0:e.signerOpts)||{}}})]);return i.setState({account:T,activeChain:s,clients:oe,offlineSigner:m,offlineSignerAmino:C,offlineSignerAuto:j,recentChain:s,signingClients:re,status:"connected",walletType:n,_reconnect:!0}),T}catch(t){throw i.getState().account===null&&i.setState({status:"disconnected"}),t}}async function U(e=!1){return i.setState(t=>({...w,recentChain:e?null:t.recentChain})),Promise.resolve()}async function q(e){let{activeChain:t,signingClients:o}=i.getState();if(!t||!o)throw new Error("No connected account detected");let{defaultSigningClient:r}=i.getState();return await Promise.all(t.currencies.map(async c=>o[r].getBalance(e,c.coinMinimalDenom)))}function p(){let{activeChain:e}=i.getState();e&&l(e)}function P(){i.setState({recentChain:null})}function hn(){return i.getState().recentChain}async function S(e){return await u().experimentalSuggestChain(e),e}async function K(e){let t=await S(e);return{account:await l(e),chain:t}}function B(e={}){return i.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||e.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}import{Bech32Address as le}from"@keplr-wallet/cosmos";var N={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},ge={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},he={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},fe={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},ye={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Ce={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},E=[N,ge,he,fe,ye,Ce],A={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:N,bip44:{coinType:118},bech32Config:le.defaultBech32Config("axelar"),currencies:E,feeCurrencies:E};import{Bech32Address as de}from"@keplr-wallet/cosmos";var F={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},R=[F],y={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:F,bip44:{coinType:118},bech32Config:de.defaultBech32Config("cosmos"),currencies:R,feeCurrencies:R};import{Bech32Address as we}from"@keplr-wallet/cosmos";var _={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Se={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Ae={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},xe={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},ke={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Ie={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},De={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},ve={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Ge={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},be={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},ze={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},L=[_,Se,Ae,xe,ke,Ie,De,ve,Ge,be,ze],x={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:_,bip44:{coinType:118},bech32Config:we.defaultBech32Config("juno"),currencies:L,feeCurrencies:L};import{Bech32Address as je}from"@keplr-wallet/cosmos";var Q={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Te={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},H=[Q,Te],k={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Q,bip44:{coinType:118},bech32Config:je.defaultBech32Config("osmo"),currencies:H,feeCurrencies:H};import{Bech32Address as Oe}from"@keplr-wallet/cosmos";var V={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},J=[V],I={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:V,bip44:{coinType:118},bech32Config:Oe.defaultBech32Config("somm"),currencies:J,feeCurrencies:J};import{Bech32Address as We}from"@keplr-wallet/cosmos";var $={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},X=[$],D={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:We.defaultBech32Config("CRE"),currencies:X,feeCurrencies:X,stakeCurrency:$,coinType:118};import{Bech32Address as Me}from"@keplr-wallet/cosmos";var v={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Ue=[v],G={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:v,bip44:{coinType:118},bech32Config:Me.defaultBech32Config("juno"),currencies:Ue,feeCurrencies:[v],coinType:118};import{Bech32Address as qe}from"@keplr-wallet/cosmos";var b={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Pe=[b],z={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:b,bip44:{coinType:118},bech32Config:qe.defaultBech32Config("osmo"),currencies:Pe,feeCurrencies:[b],coinType:118};function Rn(e){return e}function Fn(e){return e}function Ln(e){return e}var _n={axelar:A,cosmos:y,cosmoshub:y,juno:x,osmosis:k,sommelier:I},Hn=[A,y,x,k,I],Qn={crescent:D,juno:G,osmosis:z},Jn=[D,G,z];import{useMutation as Y,useQuery as Be}from"@tanstack/react-query";import{useEffect as Ee}from"react";import Ne from"zustand/shallow";import{useQuery as Ke}from"@tanstack/react-query";function Zn(){return g("keplr")}function g(e){let t=i(r=>e||r.walletType);return Ke(["USE_CHECK_WALLET",t],({queryKey:[,r]})=>M(r))}function Re({onConnect:e,onDisconnect:t}={}){let o=i(n=>n.account),r=i(n=>n.status);return Ee(()=>i.subscribe(n=>n.status,(n,c)=>{if(n==="connected"){let s=i.getState();e==null||e({account:s.account,isReconnect:c==="reconnecting"})}n==="disconnected"&&(t==null||t())}),[e,t]),{data:o,isConnected:Boolean(o),isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",reconnect:p,status:r}}function ct(e){let{data:t}=Re(),o=e||(t==null?void 0:t.bech32Address),n=Be(["USE_BALANCES",o],({queryKey:[,c]})=>q(c),{enabled:Boolean(o)});return{data:n.data,error:n.error,isFetching:n.isFetching,isLoading:n.isLoading,isRefetching:n.isRefetching,isSuccess:n.isSuccess,refetch:n.refetch,status:n.status}}function at({onError:e,onLoading:t,onSuccess:o}={}){let n=Y(["USE_CONNECT",e,t,o],l,{onError:(s,m)=>Promise.resolve(e==null?void 0:e(s,m)),onMutate:t,onSuccess:s=>Promise.resolve(o==null?void 0:o(s))}),{data:c}=g();return{connect:s=>n.mutate(s),connectAsync:s=>n.mutateAsync(s),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(c),status:n.status}}function mt({onError:e,onLoading:t,onSuccess:o}={}){let n=Y(["USE_DISCONNECT",e,t,o],U,{onError:c=>Promise.resolve(e==null?void 0:e(c,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(o==null?void 0:o(void 0))});return{disconnect:c=>n.mutate(c),disconnectAsync:c=>n.mutateAsync(c),error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,status:n.status}}function pt(){return i(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Ne)}import{useMutation as Z}from"@tanstack/react-query";function yt(){return i(e=>e.activeChain)}function Ct(){return{data:i(t=>t.recentChain),clear:P}}function dt({onError:e,onLoading:t,onSuccess:o}={}){let n=Z(["USE_SUGGEST_CHAIN",e,t,o],S,{onError:(c,s)=>Promise.resolve(e==null?void 0:e(c,s)),onMutate:t,onSuccess:c=>Promise.resolve(o==null?void 0:o(c))});return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,suggest:n.mutate,suggestAsync:n.mutateAsync,status:n.status}}function wt({onError:e,onLoading:t,onSuccess:o}={}){let n=Z(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,o],K,{onError:(s,m)=>Promise.resolve(e==null?void 0:e(s,m)),onMutate:t,onSuccess:s=>Promise.resolve(o==null?void 0:o(s))}),{data:c}=g();return{error:n.error,isLoading:n.isLoading,isSuccess:n.isSuccess,isSupported:Boolean(c),status:n.status,suggestAndConnect:n.mutate,suggestAndConnectAsync:n.mutateAsync}}import{useQuery as ee}from"@tanstack/react-query";function It(e){let t=i(n=>n.clients),r=ee(["USE_CLIENTS",e,t],({queryKey:[,n,c]})=>n!=null&&n.rpc?h(n):c,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:r.data,error:r.error,isFetching:r.isFetching,isLoading:r.isLoading,isRefetching:r.isRefetching,isSuccess:r.isSuccess,refetch:r.refetch,status:r.status}}function Dt(e){let t=i(n=>n.signingClients),r=ee(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,n,c]})=>n!=null&&n.rpc?f(n):c,{refetchOnMount:Boolean(e==null?void 0:e.keepRefetchBehavior),refetchOnWindowFocus:Boolean(e==null?void 0:e.keepRefetchBehavior)});return{data:r.data,error:r.error,isFetching:r.isFetching,isLoading:r.isLoading,isRefetching:r.isRefetching,isSuccess:r.isSuccess,refetch:r.refetch,status:r.status}}import{QueryClient as _e,QueryClientProvider as He}from"@tanstack/react-query";import{useEffect as Fe}from"react";function Le(){return Fe(()=>{let{_reconnect:e}=i.getState();return e&&p(),window.addEventListener("keplr_keystorechange",p),()=>{window.removeEventListener("keplr_keystorechange",p)}},[]),null}function ne(){return Le(),null}import{jsx as Je,jsxs as Ve}from"react/jsx-runtime";var Qe=new _e({});function Mt({children:e,grazOptions:t,...o}){return t&&B(t),Ve(He,{client:Qe,...o,children:[Je(ne,{}),e]})}export{ne as GrazEvents,Mt as GrazProvider,M as checkWallet,P as clearRecentChain,B as configureGraz,l as connect,h as createClients,f as createSigningClients,Fn as defineChain,Ln as defineChainInfo,Rn as defineChains,U as disconnect,q as getBalances,pe as getKeplr,hn as getRecentChain,u as getWallet,_n as mainnetChains,Hn as mainnetChainsArray,p as reconnect,S as suggestChain,K as suggestChainAndConnect,Qn as testnetChains,Jn as testnetChainsArray,Re as useAccount,yt as useActiveChain,ct as useBalances,Zn as useCheckKeplr,g as useCheckWallet,It as useClients,at as useConnect,mt as useDisconnect,Le as useGrazEvents,Ct as useRecentChain,pt as useSigners,Dt as useSigningClients,dt as useSuggestChain,wt as useSuggestChainAndConnect};
|
|
1
|
+
import{a as x,b as Te,c as r}from"./chunk-6M3A6KFX.mjs";var F=x(d=>{"use strict";r();Object.defineProperty(d,"__esModule",{value:!0});d.arrayContentStartsWith=d.arrayContentEquals=void 0;function ze(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}d.arrayContentEquals=ze;function Ne(e,t){if(e.length<t.length)return!1;for(let n=0;n<t.length;++n)if(e[n]!==t[n])return!1;return!0}d.arrayContentStartsWith=Ne});var _=x(f=>{"use strict";r();Object.defineProperty(f,"__esModule",{value:!0});f.assertDefinedAndNotNull=f.assertDefined=f.assert=void 0;function Pe(e,t){if(!e)throw new Error(t||"condition is not truthy")}f.assert=Pe;function Me(e,t){if(e===void 0)throw new Error(t??"value is undefined")}f.assertDefined=Me;function Ke(e,t){if(e==null)throw new Error(t??"value is undefined or null")}f.assertDefinedAndNotNull=Ke});var R=x(j=>{"use strict";r();Object.defineProperty(j,"__esModule",{value:!0});j.sleep=void 0;async function We(e){return new Promise(t=>setTimeout(t,e))}j.sleep=We});var L=x(g=>{"use strict";r();Object.defineProperty(g,"__esModule",{value:!0});g.isUint8Array=g.isNonNullObject=void 0;function H(e){return typeof e=="object"&&e!==null}g.isNonNullObject=H;function Fe(e){return!(!H(e)||Object.prototype.toString.call(e)!=="[object Uint8Array]"||typeof Buffer<"u"&&typeof Buffer.isBuffer<"u"&&Buffer.isBuffer(e))}g.isUint8Array=Fe});var $=x(m=>{"use strict";r();Object.defineProperty(m,"__esModule",{value:!0});m.isUint8Array=m.isNonNullObject=m.sleep=m.assertDefinedAndNotNull=m.assertDefined=m.assert=m.arrayContentStartsWith=m.arrayContentEquals=void 0;var V=F();Object.defineProperty(m,"arrayContentEquals",{enumerable:!0,get:function(){return V.arrayContentEquals}});Object.defineProperty(m,"arrayContentStartsWith",{enumerable:!0,get:function(){return V.arrayContentStartsWith}});var v=_();Object.defineProperty(m,"assert",{enumerable:!0,get:function(){return v.assert}});Object.defineProperty(m,"assertDefined",{enumerable:!0,get:function(){return v.assertDefined}});Object.defineProperty(m,"assertDefinedAndNotNull",{enumerable:!0,get:function(){return v.assertDefinedAndNotNull}});var _e=R();Object.defineProperty(m,"sleep",{enumerable:!0,get:function(){return _e.sleep}});var J=L();Object.defineProperty(m,"isNonNullObject",{enumerable:!0,get:function(){return J.isNonNullObject}});Object.defineProperty(m,"isUint8Array",{enumerable:!0,get:function(){return J.isUint8Array}})});r();r();import{GasPrice as Ve}from"@cosmjs/stargate";r();import qe from"zustand";import{persist as Ue,subscribeWithSelector as Qe}from"zustand/middleware";var B={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},Oe={name:"graz",partialize:e=>({activeChain:e.activeChain,recentChain:e.recentChain,_reconnect:e._reconnect}),version:1},c=qe(Qe(Ue(()=>B,Oe)));r();import{SigningCosmWasmClient as Y}from"@cosmjs/cosmwasm-stargate";import{SigningStargateClient as Z}from"@cosmjs/stargate";import{Tendermint34Client as He}from"@cosmjs/tendermint-rpc";r();var C=Te($());import{QueryClient as Re}from"@cosmjs/stargate";function X(...e){let{tendermint:t}=c.getState().clients,n=new Re(t),u=e.map(o=>o(n));for(let o of u){(0,C.assert)((0,C.isNonNullObject)(o),"Extension must be a non-null object");for(let[i,s]of Object.entries(o)){(0,C.assert)((0,C.isNonNullObject)(s),`Module must be a non-null object. Found type ${typeof s} for module "${i}".`);let p=n[i]||{};n[i]={...p,...s}}}return n}async function w({rpc:e,rpcHeaders:t}){let n={url:e,headers:{...t||{}}},[u,o,i]=await Promise.all([Y.connect(n),Z.connect(n),He.connect(e)]);return{cosmWasm:u,stargate:o,tendermint:i}}async function D(e){let{rpc:t,rpcHeaders:n,offlineSignerAuto:u,cosmWasmSignerOptions:o={},stargateSignerOptions:i={}}=e,s={url:t,headers:{...n||{}}},[p,l]=await Promise.all([Y.connectWithSigner(s,u,o),Z.connectWithSigner(s,u,i)]);return{cosmWasm:p,stargate:l}}r();function ee(e=c.getState().walletType){try{return S(e),!0}catch(t){return console.error(t),!1}}function Le(){if(typeof window.keplr<"u")return window.keplr;throw c.getState()._notFoundFn(),new Error("window.keplr is not defined")}function S(e=c.getState().walletType){switch(e){case"keplr":return Le();default:throw new Error("Unknown wallet type")}}async function A(e){try{let{defaultChain:t,recentChain:n,walletType:u}=c.getState(),o=(e==null?void 0:e.walletType)||u,i=S(o),s=e||n||t;if(!s)throw new Error("No last known connected chain, connect action requires chain info");c.setState(I=>{let Ge=I._reconnect;return I.activeChain&&I.activeChain.chainId!==s.chainId?{status:"connecting"}:Ge?{status:"reconnecting"}:{status:"connecting"}}),await i.enable(s.chainId);let p=i.getOfflineSigner(s.chainId),l=i.getOfflineSignerOnlyAmino(s.chainId),y=await i.getOfflineSignerAuto(s.chainId),Ie=s.gas?Ve.fromString(`${s.gas.price}${s.gas.denom}`):void 0,[W,Be,ve]=await Promise.all([i.getKey(s.chainId),w(s),D({...s,offlineSignerAuto:y,cosmWasmSignerOptions:{gasPrice:Ie,...(e==null?void 0:e.signerOpts)||{}}})]);return c.setState({account:W,activeChain:s,clients:Be,offlineSigner:p,offlineSignerAmino:l,offlineSignerAuto:y,recentChain:s,signingClients:ve,status:"connected",walletType:o,_reconnect:!0}),W}catch(t){throw c.getState().account===null&&c.setState({status:"disconnected"}),t}}async function te(e=!1){return c.setState(t=>({...B,recentChain:e?null:t.recentChain})),Promise.resolve()}function h(){let{activeChain:e}=c.getState();e&&A(e)}r();function ne(){c.setState({recentChain:null})}function oe(e){let{activeChain:t}=c.getState();return t==null?void 0:t.currencies.find(n=>n.coinMinimalDenom===e)}function un(){return c.getState().recentChain}async function G(e){return await S().experimentalSuggestChain(e),e}async function re(e){let t=await G(e);return{account:await A(e),chain:t}}r();function se(e={}){return c.setState(t=>({defaultChain:e.defaultChain||t.defaultChain,defaultSigningClient:e.defaultSigningClient||e.defaultSigningClient,walletType:e.defaultWallet||t.walletType,_notFoundFn:e.onNotFound||t._notFoundFn})),e}r();async function ie(e){let{activeChain:t,signingClients:n}=c.getState();if(!t||!n)throw new Error("No connected account detected");let{defaultSigningClient:u}=c.getState();return await Promise.all(t.currencies.map(async i=>n[u].getBalance(e,i.coinMinimalDenom)))}async function ce(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 ue({senderAddress:e,recipientAddress:t,amount:n,fee:u,memo:o}){let{signingClients:i,defaultSigningClient:s}=c.getState();if(!i)throw new Error("No connected account detected");if(!e)throw new Error("senderAddress is not defined");return i[s].sendTokens(e,t,n,u,o)}async function ae({senderAddress:e,recipientAddress:t,transferAmount:n,sourcePort:u,sourceChannel:o,timeoutHeight:i,timeoutTimestamp:s,fee:p,memo:l}){let{signingClients:y}=c.getState();if(!(y!=null&&y.stargate))throw new Error("Stargate signing client is not ready");if(!e)throw new Error("senderAddress is not defined");return y.stargate.sendIbcTokens(e,t,n,u,o,i,s,p,l)}r();r();import{Bech32Address as Je}from"@keplr-wallet/cosmos";var me={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},$e={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Xe={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Ye={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},Ze={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},et={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},pe=[me,$e,Xe,Ye,Ze,et],T={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:me,bip44:{coinType:118},bech32Config:Je.defaultBech32Config("axelar"),currencies:pe,feeCurrencies:pe};r();import{Bech32Address as tt}from"@keplr-wallet/cosmos";var fe={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},le=[fe],k={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:fe,bip44:{coinType:118},bech32Config:tt.defaultBech32Config("cosmos"),currencies:le,feeCurrencies:le};r();import{Bech32Address as nt}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"},ot={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},rt={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"},it={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},ct={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},ut={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"},pt={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},mt={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},lt={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},ye=[de,ot,rt,st,it,ct,ut,at,pt,mt,lt],q={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:de,bip44:{coinType:118},bech32Config:nt.defaultBech32Config("juno"),currencies:ye,feeCurrencies:ye};r();import{Bech32Address as ft}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"},yt={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},ge=[Ce,yt],U={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Ce,bip44:{coinType:118},bech32Config:ft.defaultBech32Config("osmo"),currencies:ge,feeCurrencies:ge};r();import{Bech32Address as dt}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"},he=[xe],Q={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:xe,bip44:{coinType:118},bech32Config:dt.defaultBech32Config("somm"),currencies:he,feeCurrencies:he};r();import{Bech32Address as gt}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"},Se=[Ae],O={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:gt.defaultBech32Config("CRE"),currencies:Se,feeCurrencies:Se,stakeCurrency:Ae,coinType:118};r();import{Bech32Address as Ct}from"@keplr-wallet/cosmos";var z={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},ht=[z],N={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-3",chainName:"Juno Testnet",stakeCurrency:z,bip44:{coinType:118},bech32Config:Ct.defaultBech32Config("juno"),currencies:ht,feeCurrencies:[z],coinType:118};r();import{Bech32Address as xt}from"@keplr-wallet/cosmos";var P={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},St=[P],M={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:P,bip44:{coinType:118},bech32Config:xt.defaultBech32Config("osmo"),currencies:St,feeCurrencies:[P],coinType:118};function Pn(e){return e}function Mn(e){return e}function Kn(e){return e}var Wn={axelar:T,cosmos:k,cosmoshub:k,juno:q,osmosis:U,sommelier:Q},Fn=[T,k,q,U,Q],_n={crescent:O,juno:N,osmosis:M},Rn=[O,N,M];r();import{useMutation as be,useQuery as K}from"@tanstack/react-query";import{useEffect as bt}from"react";import Et from"zustand/shallow";r();import{useQuery as At}from"@tanstack/react-query";function $n(){return b("keplr")}function b(e){let t=c(o=>e||o.walletType);return At(["USE_CHECK_WALLET",t],({queryKey:[,o]})=>ee(o))}function E({onConnect:e,onDisconnect:t}={}){let n=c(o=>o.account),u=c(o=>o.status);return bt(()=>c.subscribe(o=>o.status,(o,i)=>{if(o==="connected"){let s=c.getState();e==null||e({account:s.account,isReconnect:i==="reconnecting"})}o==="disconnected"&&(t==null||t())}),[e,t]),{data:n,isConnected:Boolean(n),isConnecting:u==="connecting",isDisconnected:u==="disconnected",isReconnecting:u==="reconnecting",reconnect:h,status:u}}function jt(e){let{data:t}=E(),n=e||(t==null?void 0:t.bech32Address);return K(["USE_BALANCES",n],({queryKey:[,i]})=>ie(i),{enabled:Boolean(n)})}function so(e,t){let{data:n}=jt(t);return K(["USE_BALANCE",n,e,t],({queryKey:[,i]})=>i==null?void 0:i.find(s=>s.denom===e),{enabled:Boolean(n)})}function io({onError:e,onLoading:t,onSuccess:n}={}){let o=be(["USE_CONNECT",e,t,n],A,{onError:(s,p)=>Promise.resolve(e==null?void 0:e(s,p)),onMutate:t,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=b();return{connect:s=>o.mutate(s),connectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:Boolean(i),status:o.status}}function co({onError:e,onLoading:t,onSuccess:n}={}){let o=be(["USE_DISCONNECT",e,t,n],te,{onError:i=>Promise.resolve(e==null?void 0:e(i,void 0)),onMutate:t,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:i=>o.mutate(i),disconnectAsync:i=>o.mutateAsync(i),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,status:o.status}}function wt(){return c(e=>({signer:e.offlineSigner,signerAmino:e.offlineSignerAmino,signerAuto:e.offlineSignerAuto}),Et)}function uo(){return wt()}function ao(e){let{data:t}=E(),n=e||(t==null?void 0:t.bech32Address);return K(["USE_STAKED_BALANCES",n],({queryKey:[,i]})=>ce(n),{enabled:Boolean(n)})}r();import{useMutation as Ee,useQuery as je}from"@tanstack/react-query";function go(){return c(e=>e.activeChain)}function Co(e){return je(["USE_ACTIVE_CHAIN_CURRENCY",e],({queryKey:[,u]})=>oe(u))}function ho(e,t="BOND_STATUS_BONDED"){return je(["USE_ACTIVE_CHAIN_VALIDATORS",e,t],({queryKey:[,o,i]})=>o.staking.validators(i),{enabled:typeof e<"u"})}function xo(){return{data:c(t=>t.recentChain),clear:ne}}function So({onError:e,onLoading:t,onSuccess:n}={}){let o=Ee(["USE_SUGGEST_CHAIN",e,t,n],G,{onError:(i,s)=>Promise.resolve(e==null?void 0:e(i,s)),onMutate:t,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,suggest:o.mutate,suggestAsync:o.mutateAsync,status:o.status}}function Ao({onError:e,onLoading:t,onSuccess:n}={}){let o=Ee(["USE_SUGGEST_CHAIN_AND_CONNECT",e,t,n],re,{onError:(s,p)=>Promise.resolve(e==null?void 0:e(s,p)),onMutate:t,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))}),{data:i}=b();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:Boolean(i),status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}}r();import{useQuery as we}from"@tanstack/react-query";r();import{useQuery as Dt}from"@tanstack/react-query";function wo(...e){let t=["USE_QUERY_CLIENT",...e];return Dt(t,({queryKey:[,...u]})=>X(...e),{refetchOnMount:!1,refetchOnWindowFocus:!1})}function vo(e){let t=c(o=>o.clients);return we(["USE_CLIENTS",e,t],({queryKey:[,o,i]})=>o!=null&&o.rpc?w(o):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})}function Go(e){let t=c(o=>o.signingClients);return we(["USE_SIGNING_CLIENTS",e,t],({queryKey:[,o,i]})=>o!=null&&o.rpc?D(o):i,{refetchOnMount:!1,refetchOnWindowFocus:!1})}r();import{useMutation as De}from"@tanstack/react-query";function zo({onError:e,onLoading:t,onSuccess:n}={}){let{data:u}=E(),o=u==null?void 0:u.bech32Address,s=De(["USE_SEND_TOKENS",e,t,n,o],p=>ue({senderAddress:o,...p}),{onError:(p,l)=>Promise.resolve(e==null?void 0:e(p,l)),onMutate:t,onSuccess:p=>Promise.resolve(n==null?void 0:n(p))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,sendTokens:s.mutate,sendTokensAsync:s.mutateAsync,status:s.status}}function No({onError:e,onLoading:t,onSuccess:n}={}){let{data:u}=E(),o=u==null?void 0:u.bech32Address,s=De(["USE_SEND_IBC_TOKENS",e,t,n,o],p=>ae({senderAddress:o,...p}),{onError:(p,l)=>Promise.resolve(e==null?void 0:e(p,l)),onMutate:t,onSuccess:p=>Promise.resolve(n==null?void 0:n(p))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,sendIbcTokens:s.mutate,sendIbcTokensAsync:s.mutateAsync,status:s.status}}r();import{QueryClient as Bt,QueryClientProvider as vt}from"@tanstack/react-query";r();import{useEffect as kt}from"react";function It(){return kt(()=>{let{_reconnect:e}=c.getState();return e&&h(),window.addEventListener("keplr_keystorechange",h),()=>{window.removeEventListener("keplr_keystorechange",h)}},[]),null}function ke(){return It(),null}import{jsx as Tt,jsxs as qt}from"react/jsx-runtime";var Gt=new Bt({});function Lo({children:e,grazOptions:t,...n}){return t&&se(t),qt(vt,{client:Gt,...n,children:[Tt(ke,{}),e]})}export{ke as GrazEvents,Lo as GrazProvider,ee as checkWallet,ne as clearRecentChain,se as configureGraz,A as connect,w as createClients,X as createQueryClient,D as createSigningClients,Mn as defineChain,Kn as defineChainInfo,Pn as defineChains,te as disconnect,oe as getActiveChainCurrency,ie as getBalances,Le as getKeplr,un as getRecentChain,ce as getStakedBalances,S as getWallet,Wn as mainnetChains,Fn as mainnetChainsArray,h as reconnect,ae as sendIbcTokens,ue as sendTokens,G as suggestChain,re as suggestChainAndConnect,_n as testnetChains,Rn as testnetChainsArray,E as useAccount,go as useActiveChain,Co as useActiveChainCurrency,ho as useActiveChainValidators,so as useBalance,jt as useBalances,$n as useCheckKeplr,b as useCheckWallet,vo as useClients,io as useConnect,co as useDisconnect,It as useGrazEvents,wt as useOfflineSigners,wo as useQueryClient,xo as useRecentChain,No as useSendIbcTokens,zo as useSendTokens,uo as useSigners,Go as useSigningClients,ao as useStakedBalances,So as useSuggestChain,Ao as useSuggestChainAndConnect};
|
package/dist/keplr.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"@keplr-wallet/cosmos";export*from"@keplr-wallet/types";
|
|
1
|
+
import{c as o}from"./chunk-6M3A6KFX.mjs";o();export*from"@keplr-wallet/cosmos";export*from"@keplr-wallet/types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@cosmjs/tendermint-rpc';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(r,o,m,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==m&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},p=(r,o,m)=>(t(r,o,"default"),m&&t(m,o,"default"));var g=r=>t(a({},"__esModule",{value:!0}),r);var f={};module.exports=g(f);p(f,require("@cosmjs/tendermint-rpc"),module.exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as o}from"./chunk-6M3A6KFX.mjs";o();export*from"@cosmjs/tendermint-rpc";
|
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.23",
|
|
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",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@cosmjs/cosmwasm-stargate": "^0",
|
|
39
39
|
"@cosmjs/proto-signing": "^0",
|
|
40
40
|
"@cosmjs/stargate": "^0",
|
|
41
|
+
"@cosmjs/tendermint-rpc": "^0",
|
|
41
42
|
"@keplr-wallet/cosmos": "^0",
|
|
42
43
|
"@keplr-wallet/types": "^0",
|
|
43
44
|
"@tanstack/react-query": "^4",
|