graz 0.0.44-alpha.2 → 0.0.45-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,13 +1,12 @@
1
+ import { ChainInfo, AppCurrency, Bech32Config, Keplr, Key, OfflineAminoSigner, OfflineDirectSigner as OfflineDirectSigner$1 } from '@keplr-wallet/types';
2
+ import { SignClientTypes } from '@walletconnect/types';
3
+ import { Web3ModalConfig } from '@web3modal/standalone';
1
4
  import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
2
- import { SigningCosmWasmClientOptions, CosmWasmClient, SigningCosmWasmClient, InstantiateOptions, InstantiateResult, ExecuteResult } from '@cosmjs/cosmwasm-stargate';
3
- import * as _keplr_wallet_types from '@keplr-wallet/types';
4
- import { ChainInfo, AppCurrency, Keplr, Key } from '@keplr-wallet/types';
5
- import * as _cosmjs_proto_signing from '@cosmjs/proto-signing';
6
- import { Coin, OfflineSigner, OfflineDirectSigner } from '@cosmjs/proto-signing';
7
- import { QueryClient, StargateClient, SigningStargateClient, SigningStargateClientOptions, StdFee, DeliverTxResponse, StakingExtension } from '@cosmjs/stargate';
5
+ import { CosmWasmClient, SigningCosmWasmClientOptions, SigningCosmWasmClient, InstantiateOptions } from '@cosmjs/cosmwasm-stargate';
6
+ import { OfflineSigner, OfflineDirectSigner, Coin } from '@cosmjs/proto-signing';
7
+ import * as _cosmjs_stargate from '@cosmjs/stargate';
8
+ import { StargateClient, StargateClientOptions, SigningStargateClient, StdFee, DeliverTxResponse, QueryClient, StakingExtension, Coin as Coin$1 } from '@cosmjs/stargate';
8
9
  import { Tendermint34Client } from '@cosmjs/tendermint-rpc';
9
- import { ISignClient, SignClientTypes } from '@walletconnect/types';
10
- import { Web3ModalConfig } from '@web3modal/standalone';
11
10
  import { Height } from 'cosmjs-types/ibc/core/client/v1/client';
12
11
  import { OfflineSigner as OfflineSigner$1 } from '@cosmjs/launchpad';
13
12
  import * as _tanstack_react_query from '@tanstack/react-query';
@@ -34,6 +33,7 @@ interface GrazChain {
34
33
  price: string;
35
34
  denom: string;
36
35
  };
36
+ bech32Config: Bech32Config;
37
37
  }
38
38
  /**
39
39
  * Helper function to define chain information records (key values).
@@ -158,9 +158,25 @@ declare const testnetChains: {
158
158
  */
159
159
  declare const testnetChainsArray: ChainInfo[];
160
160
 
161
+ type Clients = "cosmWasm" | "stargate" | "tendermint";
162
+ type ConnectClientArgs<T extends Clients> = Pick<GrazChain, "rpc" | "rpcHeaders"> & {
163
+ client: T;
164
+ };
165
+ type ConnectClient<T> = T extends "cosmWasm" ? CosmWasmClient : T extends "stargate" ? StargateClient : T extends "tendermint" ? Tendermint34Client : never;
166
+ declare const connectClient: <T extends Clients>({ rpc, rpcHeaders, client }: ConnectClientArgs<T>) => Promise<ConnectClient<T>>;
167
+ type SigningClients = "cosmWasm" | "stargate";
168
+ type ConnectSigningClientArgs<T extends SigningClients> = Pick<GrazChain, "rpc" | "rpcHeaders"> & {
169
+ client: T;
170
+ offlineSignerAuto: OfflineSigner | OfflineDirectSigner;
171
+ options?: T extends "cosmWasm" ? SigningCosmWasmClientOptions : T extends "stargate" ? StargateClientOptions : never;
172
+ };
173
+ type ConnectSigningClient<T> = T extends "cosmWasm" ? SigningCosmWasmClient : T extends "stargate" ? SigningStargateClient : never;
174
+ declare const connectSigningClient: <T extends SigningClients>(args: ConnectSigningClientArgs<T>) => Promise<ConnectSigningClient<T>>;
175
+
161
176
  declare enum WalletType {
162
177
  KEPLR = "keplr",
163
178
  LEAP = "leap",
179
+ VECTIS = "vectis",
164
180
  COSMOSTATION = "cosmostation",
165
181
  WALLETCONNECT = "walletconnect",
166
182
  WC_KEPLR_MOBILE = "wc_keplr_mobile",
@@ -173,108 +189,68 @@ type Wallet = Pick<Keplr, "enable" | "getKey" | "getOfflineSigner" | "getOffline
173
189
  init?: () => Promise<unknown>;
174
190
  };
175
191
 
192
+ interface WalletConnectStore {
193
+ options: SignClientTypes.Options | null;
194
+ web3Modal?: Pick<Web3ModalConfig, "themeVariables" | "themeMode" | "privacyPolicyUrl" | "termsOfServiceUrl"> | null;
195
+ }
196
+ interface GrazInternalStore {
197
+ chains: GrazChain[] | null;
198
+ recentChains: string[] | null;
199
+ defaultClient: Clients;
200
+ defaultSigningClient: SigningClients;
201
+ walletType: WalletType;
202
+ walletConnect: WalletConnectStore | null;
203
+ _notFoundFn: () => void;
204
+ _reconnect: boolean;
205
+ _reconnectConnector: WalletType | null;
206
+ _onReconnectFailed: () => void;
207
+ }
208
+ interface GrazAccountSession {
209
+ account: Key | null;
210
+ chainId: string;
211
+ status: "connected" | "connecting" | "reconnecting" | "disconnected";
212
+ }
213
+
176
214
  type ConnectArgs = Maybe<{
177
- chain?: GrazChain;
178
- signerOpts?: SigningCosmWasmClientOptions;
215
+ chainId: string[];
179
216
  walletType?: WalletType;
180
217
  autoReconnect?: boolean;
181
218
  }>;
182
219
  interface ConnectResult {
183
- account: Key;
184
220
  walletType: WalletType;
185
- chain: GrazChain;
221
+ sessions: GrazAccountSession[];
186
222
  }
187
223
  declare const connect: (args?: ConnectArgs) => Promise<ConnectResult>;
188
- declare const disconnect: (clearRecentChain?: boolean) => Promise<void>;
224
+ interface OfflineSigners {
225
+ offlineSigner: OfflineAminoSigner & OfflineDirectSigner$1;
226
+ offlineSignerAmino: OfflineAminoSigner;
227
+ offlineSignerAuto: OfflineAminoSigner | OfflineDirectSigner$1;
228
+ }
229
+ declare const getOfflineSigners: (args?: {
230
+ walletType?: WalletType;
231
+ chainId: string;
232
+ }) => Promise<OfflineSigners>;
233
+ declare const disconnect: (args?: {
234
+ chainId?: string[];
235
+ }) => Promise<void>;
189
236
  type ReconnectArgs = Maybe<{
190
237
  onError?: (error: unknown) => void;
191
238
  }>;
192
239
  declare const reconnect: (args?: ReconnectArgs) => Promise<ConnectResult | undefined>;
193
240
 
194
- type ExtensionSetup<P extends object = object> = (queryClient: QueryClient) => P;
195
-
196
- interface CreateQueryClient {
197
- (): QueryClient;
198
- <A extends object>(setupA: ExtensionSetup<A>): QueryClient & A;
199
- <A extends object, B extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>): QueryClient & A & B;
200
- <A extends object, B extends object, C extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>): QueryClient & A & B & C;
201
- <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;
202
- <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;
203
- <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;
204
- <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;
205
- <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;
206
- <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;
207
- }
208
- /**
209
- * Note: `createQueryClient` creates \@cosmjs/stargate's {@link QueryClient},
210
- * NOT to be confused with \@tanstack/react-query query client
211
- */
212
- declare const createQueryClient: CreateQueryClient;
213
-
214
241
  declare const clearRecentChain: () => void;
215
- declare const getActiveChainCurrency: (denom: string) => AppCurrency | undefined;
216
- declare const getRecentChain: () => GrazChain | null;
242
+ declare const getRecentChains: () => string[] | null;
217
243
  declare const suggestChain: (chainInfo: ChainInfo) => Promise<ChainInfo>;
218
244
  interface SuggestChainAndConnectArgs {
219
245
  chainInfo: ChainInfo;
220
- signerOpts?: SigningCosmWasmClientOptions;
221
- walletType?: WalletType;
222
- gas?: {
223
- price: string;
224
- denom: string;
225
- };
226
- rpcHeaders?: Dictionary;
227
- path?: string;
228
246
  autoReconnect?: boolean;
247
+ walletType?: WalletType;
229
248
  }
230
- declare const suggestChainAndConnect: ({ chainInfo, rpcHeaders, gas, path, ...rest }: SuggestChainAndConnectArgs) => Promise<ConnectResult>;
231
-
232
- interface WalletConnectStore {
233
- options: SignClientTypes.Options | null;
234
- web3Modal?: Pick<Web3ModalConfig, "themeVariables" | "themeMode" | "privacyPolicyUrl" | "termsOfServiceUrl"> | null;
235
- }
236
- interface GrazInternalStore {
237
- defaultChain: GrazChain | null;
238
- defaultSigningClient: "cosmWasm" | "stargate";
239
- recentChain: GrazChain | null;
240
- walletType: WalletType;
241
- walletConnect: WalletConnectStore | null;
242
- _notFoundFn: () => void;
243
- _reconnect: boolean;
244
- _reconnectConnector: WalletType | null;
245
- _onReconnectFailed: () => void;
246
- }
247
- interface GrazSessionStore {
248
- account: Key | null;
249
- activeChain: GrazChain | null;
250
- balances: Coin[] | null;
251
- clients: {
252
- cosmWasm: CosmWasmClient;
253
- stargate: StargateClient;
254
- tendermint: Tendermint34Client;
255
- } | null;
256
- offlineSigner: (OfflineSigner & OfflineDirectSigner) | null;
257
- offlineSignerAmino: OfflineSigner | null;
258
- offlineSignerAuto: (OfflineSigner | OfflineDirectSigner) | null;
259
- signingClients: {
260
- cosmWasm: SigningCosmWasmClient;
261
- stargate: SigningStargateClient;
262
- } | null;
263
- status: "connected" | "connecting" | "reconnecting" | "disconnected";
264
- wcSignClient?: ISignClient | null;
265
- }
266
-
267
- type CreateClientArgs = Pick<GrazChain, "rpc" | "rpcHeaders">;
268
- declare const createClients: ({ rpc, rpcHeaders }: CreateClientArgs) => Promise<GrazSessionStore["clients"]>;
269
- type CreateSigningClientArgs = CreateClientArgs & {
270
- offlineSignerAuto: OfflineSigner | OfflineDirectSigner;
271
- cosmWasmSignerOptions?: SigningCosmWasmClientOptions;
272
- stargateSignerOptions?: SigningStargateClientOptions;
273
- };
274
- declare const createSigningClients: (args: CreateSigningClientArgs) => Promise<GrazSessionStore["signingClients"]>;
249
+ declare const suggestChainAndConnect: (args: SuggestChainAndConnectArgs) => Promise<ConnectResult>;
275
250
 
276
251
  interface ConfigureGrazArgs {
277
- defaultChain?: GrazChain;
252
+ chains?: GrazChain[];
253
+ defaultClient?: GrazInternalStore["defaultClient"];
278
254
  defaultSigningClient?: GrazInternalStore["defaultSigningClient"];
279
255
  defaultWallet?: WalletType;
280
256
  onNotFound?: () => void;
@@ -285,20 +261,29 @@ interface ConfigureGrazArgs {
285
261
  */
286
262
  autoReconnect?: boolean;
287
263
  }
288
- declare const configureGraz: (args?: ConfigureGrazArgs) => ConfigureGrazArgs;
264
+ declare const configureGraz: (args: ConfigureGrazArgs) => ConfigureGrazArgs;
289
265
 
290
- declare const getBalances: (bech32Address: string) => Promise<Coin[]>;
291
- declare const getBalanceStaked: (bech32Address: string) => Promise<Coin | null>;
292
- interface SendTokensArgs {
293
- senderAddress?: string;
266
+ declare const getBalances: <T extends "cosmWasm" | "stargate">({ bech32Address, client, currencies, }: {
267
+ currencies: AppCurrency[];
268
+ bech32Address: string;
269
+ client: ConnectClient<T>;
270
+ }) => Promise<Coin[]>;
271
+ declare const getBalanceStaked: ({ bech32Address, client, }: {
272
+ bech32Address: string;
273
+ client: ConnectClient<"stargate">;
274
+ }) => Promise<Coin | null>;
275
+ interface SendTokensArgs<T> {
276
+ signingClient: ConnectSigningClient<T>;
277
+ senderAddress: string;
294
278
  recipientAddress: string;
295
279
  amount: Coin[];
296
280
  fee: number | StdFee | "auto";
297
281
  memo?: string;
298
282
  }
299
- declare const sendTokens: ({ senderAddress, recipientAddress, amount, fee, memo, }: SendTokensArgs) => Promise<DeliverTxResponse>;
283
+ declare const sendTokens: <T extends SigningClients>({ senderAddress, recipientAddress, amount, fee, memo, signingClient, }: SendTokensArgs<T>) => Promise<DeliverTxResponse>;
300
284
  interface SendIbcTokensArgs {
301
- senderAddress?: string;
285
+ signingClient: ConnectSigningClient<"stargate">;
286
+ senderAddress: string;
302
287
  recipientAddress: string;
303
288
  transferAmount: Coin;
304
289
  sourcePort: string;
@@ -308,8 +293,9 @@ interface SendIbcTokensArgs {
308
293
  fee: number | StdFee | "auto";
309
294
  memo?: string;
310
295
  }
311
- declare const sendIbcTokens: ({ senderAddress, recipientAddress, transferAmount, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, fee, memo, }: SendIbcTokensArgs) => Promise<DeliverTxResponse>;
296
+ declare const sendIbcTokens: ({ signingClient, senderAddress, recipientAddress, transferAmount, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, fee, memo, }: SendIbcTokensArgs) => Promise<DeliverTxResponse>;
312
297
  interface InstantiateContractArgs<Message extends Record<string, unknown>> {
298
+ signingClient: ConnectSigningClient<"cosmWasm">;
313
299
  msg: Message;
314
300
  label: string;
315
301
  fee: StdFee | "auto" | number;
@@ -320,8 +306,9 @@ interface InstantiateContractArgs<Message extends Record<string, unknown>> {
320
306
  type InstantiateContractMutationArgs<Message extends Record<string, unknown>> = Omit<InstantiateContractArgs<Message>, "codeId" | "senderAddress" | "fee"> & {
321
307
  fee?: StdFee | "auto" | number;
322
308
  };
323
- declare const instantiateContract: <Message extends Record<string, unknown>>({ senderAddress, msg, fee, options, label, codeId, }: InstantiateContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
309
+ declare const instantiateContract: <Message extends Record<string, unknown>>({ signingClient, senderAddress, msg, fee, options, label, codeId, }: InstantiateContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
324
310
  interface ExecuteContractArgs<Message extends Record<string, unknown>> {
311
+ signingClient: ConnectSigningClient<"cosmWasm">;
325
312
  msg: Message;
326
313
  fee: StdFee | "auto" | number;
327
314
  senderAddress: string;
@@ -334,9 +321,17 @@ type ExecuteContractMutationArgs<Message extends Record<string, unknown>> = Omit
334
321
  funds?: Coin[];
335
322
  memo?: string;
336
323
  };
337
- declare const executeContract: <Message extends Record<string, unknown>>({ senderAddress, msg, fee, contractAddress, funds, memo, }: ExecuteContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.ExecuteResult>;
338
- declare const getQuerySmart: <TData>(address: string, queryMsg: Record<string, unknown>) => Promise<TData>;
339
- declare const getQueryRaw: (address: string, keyStr: string) => Promise<Uint8Array | null>;
324
+ declare const executeContract: <Message extends Record<string, unknown>>({ signingClient, senderAddress, msg, fee, contractAddress, funds, memo, }: ExecuteContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.ExecuteResult>;
325
+ declare const getQuerySmart: <TData>({ client, address, queryMsg, }: {
326
+ client: ConnectClient<"cosmWasm">;
327
+ address: string;
328
+ queryMsg: Record<string, unknown>;
329
+ }) => Promise<TData>;
330
+ declare const getQueryRaw: ({ client, address, keyStr, }: {
331
+ client: ConnectClient<"cosmWasm">;
332
+ address: string;
333
+ keyStr: string;
334
+ }) => Promise<Uint8Array | null>;
340
335
 
341
336
  /**
342
337
  * Function to check whether given {@link WalletType} or default configured wallet exists.
@@ -393,6 +388,21 @@ declare const getLeap: () => Wallet;
393
388
  * @see https://docs.cosmostation.io/integration-extension/cosmos/integrate-keplr
394
389
  */
395
390
  declare const getCosmostation: () => Wallet;
391
+ /**
392
+ * Function to return {@link Wallet} object and throws and error if it does not exist on `window`.
393
+ *
394
+ * @example
395
+ * ```ts
396
+ * try {
397
+ * const vectis = getVectis();
398
+ * } catch (error: Error) {
399
+ * console.error(error.message);
400
+ * }
401
+ * ```
402
+ *
403
+ *
404
+ */
405
+ declare const getVectis: () => Wallet;
396
406
  interface GetWalletConnectParams {
397
407
  encoding: BufferEncoding;
398
408
  walletType: WalletType.WC_KEPLR_MOBILE | WalletType.WC_LEAP_MOBILE;
@@ -442,14 +452,31 @@ interface GrazAdapter extends Connector {
442
452
  keystoreEvent: string;
443
453
  }
444
454
 
455
+ interface ChainIdArgs {
456
+ /**
457
+ * if provided, it will only return the data of the given chainId
458
+ */
459
+ chainId?: string | undefined;
460
+ }
461
+ type HookResultDataWithChainId<T, U extends ChainIdArgs> = U["chainId"] extends string ? T : Record<string, T>;
462
+
445
463
  interface MutationEventArgs<TInitial = unknown, TSuccess = TInitial> {
446
464
  onError?: (error: unknown, data: TInitial) => unknown;
447
465
  onLoading?: (data: TInitial) => unknown;
448
466
  onSuccess?: (data: TSuccess) => unknown;
449
467
  }
450
468
 
469
+ interface UseAccount {
470
+ data?: GrazAccountSession;
471
+ isConnected: boolean;
472
+ isConnecting: boolean;
473
+ isDisconnected: boolean;
474
+ isReconnecting: boolean;
475
+ isLoading: boolean;
476
+ status?: GrazAccountSession["status"];
477
+ }
451
478
  interface UseAccountArgs {
452
- onConnect?: (args: ConnectResult & {
479
+ onConnect?: (args: GrazAccountSession & {
453
480
  isReconnect: boolean;
454
481
  }) => void;
455
482
  onDisconnect?: () => void;
@@ -472,51 +499,7 @@ interface UseAccountArgs {
472
499
  * });
473
500
  * ```
474
501
  */
475
- declare const useAccount: ({ onConnect, onDisconnect }?: UseAccountArgs) => {
476
- data: _keplr_wallet_types.Key | null;
477
- isConnected: boolean;
478
- isConnecting: boolean;
479
- isDisconnected: boolean;
480
- isReconnecting: boolean;
481
- isLoading: boolean;
482
- reconnect: (args?: ReconnectArgs) => Promise<ConnectResult | undefined>;
483
- status: "connected" | "connecting" | "reconnecting" | "disconnected";
484
- };
485
- /**
486
- * graz query hook to retrieve list of balances from current account or given address.
487
- *
488
- * @param bech32Address - Optional bech32 account address, defaults to connected account address
489
- *
490
- * @example
491
- * ```ts
492
- * import { useBalances } from "graz";
493
- *
494
- * // basic example
495
- * const { data, isFetching, refetch, ... } = useBalances();
496
- *
497
- * // with custom bech32 address
498
- * useBalances("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
499
- * ```
500
- */
501
- declare const useBalances: (bech32Address?: string) => UseQueryResult<Coin[]>;
502
- /**
503
- * graz query hook to retrieve specific asset balance from current account or given address.
504
- *
505
- * @param denom - Asset denom to search
506
- * @param bech32Address - Optional bech32 account address, defaults to connected account address
507
- *
508
- * @example
509
- * ```ts
510
- * import { useBalance } from "graz";
511
- *
512
- * // basic example
513
- * const { data, isFetching, refetch, ... } = useBalance("atom");
514
- *
515
- * // with custom bech32 address
516
- * useBalance("atom", "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
517
- * ```
518
- */
519
- declare const useBalance: (denom: string, bech32Address?: string) => UseQueryResult<Coin | undefined>;
502
+ declare const useAccount: <T extends ChainIdArgs>(args?: (UseAccountArgs & T) | undefined) => HookResultDataWithChainId<UseAccount, T> | undefined;
520
503
  type UseConnectChainArgs = MutationEventArgs<ConnectArgs, ConnectResult>;
521
504
  /**
522
505
  * graz mutation hook to execute wallet connection with optional arguments to
@@ -586,8 +569,12 @@ declare const useConnect: ({ onError, onLoading, onSuccess }?: UseConnectChainAr
586
569
  * @see {@link disconnect}
587
570
  */
588
571
  declare const useDisconnect: ({ onError, onLoading, onSuccess }?: MutationEventArgs) => {
589
- disconnect: (forget?: boolean) => void;
590
- disconnectAsync: (forget?: boolean) => Promise<void>;
572
+ disconnect: (args?: {
573
+ chainid?: string[];
574
+ }) => void;
575
+ disconnectAsync: (args?: {
576
+ chainid?: string[];
577
+ }) => Promise<void>;
591
578
  error: unknown;
592
579
  isLoading: boolean;
593
580
  isSuccess: boolean;
@@ -604,62 +591,8 @@ declare const useDisconnect: ({ onError, onLoading, onSuccess }?: MutationEventA
604
591
  * const { signer, signerAmino, signerAuto } = useOfflineSigners();
605
592
  * ```
606
593
  */
607
- declare const useOfflineSigners: () => {
608
- signer: (_cosmjs_proto_signing.OfflineSigner & _cosmjs_proto_signing.OfflineDirectSigner) | null;
609
- signerAmino: _cosmjs_proto_signing.OfflineSigner | null;
610
- signerAuto: _cosmjs_proto_signing.OfflineSigner | null;
611
- };
612
- /**
613
- * graz hook to retrieve offline signer objects (default, amino enabled, and auto).
614
- *
615
- * @deprecated prefer using {@link useOfflineSigners}
616
- * @see {@link useOfflineSigners}
617
- */
618
- declare const useSigners: () => {
619
- signer: (_cosmjs_proto_signing.OfflineSigner & _cosmjs_proto_signing.OfflineDirectSigner) | null;
620
- signerAmino: _cosmjs_proto_signing.OfflineSigner | null;
621
- signerAuto: _cosmjs_proto_signing.OfflineSigner | null;
622
- };
623
- /**
624
- * graz query hook to retrieve list of staked balances from current account or given address.
625
- *
626
- * @param bech32Address - Optional bech32 account address, defaults to connected account address
627
- *
628
- * @example
629
- * ```ts
630
- * import { useBalanceStaked } from "graz";
631
- *
632
- * // basic example
633
- * const { data, isFetching, refetch, ... } = useBalanceStaked();
634
- *
635
- * // with custom bech32 address
636
- * useBalanceStaked("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
637
- * ```
638
- */
639
- declare const useBalanceStaked: (bech32Address?: string) => UseQueryResult<Coin | null>;
594
+ declare const useOfflineSigners: <T extends ChainIdArgs>(args?: T | undefined) => UseQueryResult<HookResultDataWithChainId<OfflineSigners, T> | undefined>;
640
595
 
641
- /**
642
- * graz hook to retrieve connected account's active chain
643
- *
644
- * @example
645
- * ```ts
646
- * import { useActiveChain } from "graz";
647
- * const { rpc, rest, chainId, currencies } = useActiveChain();
648
- * ```
649
- */
650
- declare const useActiveChain: () => GrazChain | null;
651
- /**
652
- * graz hook to retrieve specific connected account's currency
653
- *
654
- * @param denom - Currency denom to search
655
- *
656
- * @example
657
- * ```ts
658
- * import { useActiveChainCurrency } from "graz";
659
- * const { data: currency, ... } = useActiveChainCurrency("juno");
660
- * ```
661
- */
662
- declare const useActiveChainCurrency: (denom: string) => UseQueryResult<AppCurrency | undefined>;
663
596
  /**
664
597
  * graz hook to retrieve active chain validators with given query client and optional bond status
665
598
  *
@@ -693,7 +626,7 @@ declare const useActiveChainValidators: <T extends QueryClient & StakingExtensio
693
626
  * @see {@link useActiveChain}
694
627
  */
695
628
  declare const useRecentChain: () => {
696
- data: GrazChain | null;
629
+ data: string[] | null;
697
630
  clear: () => void;
698
631
  };
699
632
  type UseSuggestChainArgs = MutationEventArgs<ChainInfo>;
@@ -776,7 +709,15 @@ declare const useSuggestChainAndConnect: ({ onError, onLoading, onSuccess }?: Us
776
709
  * useClient({ rpc: "https://rpc.cosmoshub.strange.love", });
777
710
  * ```
778
711
  */
779
- declare const useClients: (args?: CreateClientArgs) => UseQueryResult<GrazSessionStore["clients"]>;
712
+ declare const useConnectClient: <T extends Clients, U extends ChainIdArgs>(args?: ({
713
+ client?: T | undefined;
714
+ /**
715
+ *
716
+ * if true, it will only return the client of the given connected chains
717
+ */
718
+ onlyConnectedChains?: boolean | undefined;
719
+ enabled?: boolean | undefined;
720
+ } & U) | undefined) => UseQueryResult<HookResultDataWithChainId<ConnectClient<T>, U> | undefined>;
780
721
  /**
781
722
  * graz query hook to retrieve a SigningCosmWasmClient. If there's no given args it will be using the current connected signer
782
723
  *
@@ -795,180 +736,63 @@ declare const useClients: (args?: CreateClientArgs) => UseQueryResult<GrazSessio
795
736
  * });
796
737
  * ```
797
738
  */
798
- declare const useSigningClients: (args?: CreateSigningClientArgs) => UseQueryResult<GrazSessionStore["signingClients"]>;
739
+ declare const useConnectSigningClient: <T extends SigningClients, U extends ChainIdArgs>(args?: ({
740
+ client?: T | undefined;
741
+ options?: (U["chainId"] extends string ? (T extends "cosmWasm" ? _cosmjs_cosmwasm_stargate.SigningCosmWasmClientOptions : T extends "stargate" ? _cosmjs_stargate.StargateClientOptions : never) | undefined : Record<string, (T extends "cosmWasm" ? _cosmjs_cosmwasm_stargate.SigningCosmWasmClientOptions : T extends "stargate" ? _cosmjs_stargate.StargateClientOptions : never) | undefined>) | undefined;
742
+ } & U) | undefined) => UseQueryResult<HookResultDataWithChainId<ConnectSigningClient<T>, U> | undefined>;
799
743
 
800
- interface UseQueryClient {
801
- (): UseQueryResult<QueryClient>;
802
- <A extends object>(setupA: ExtensionSetup<A>): UseQueryResult<QueryClient & A>;
803
- <A extends object, B extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>): UseQueryResult<QueryClient & A & B>;
804
- <A extends object, B extends object, C extends object>(setupA: ExtensionSetup<A>, setupB: ExtensionSetup<B>, setupC: ExtensionSetup<C>): UseQueryResult<QueryClient & A & B & C>;
805
- <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>;
806
- <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>;
807
- <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>;
808
- <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>;
809
- <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>;
810
- <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>;
811
- }
812
744
  /**
813
- * graz query hook to create and use {@link QueryClient} similar when using {@link QueryClient.withExtensions}.
814
- *
815
- * Note: `useQueryClient` returns \@cosmjs/stargate's {@link QueryClient},
816
- * NOT to be confused with \@tanstack/react-query useQueryClient.
817
- *
818
- * @example
819
- * ```ts
820
- * // example without extensions
821
- * import { useQueryClient } from "graz";
822
- *
823
- * const queryClient = useQueryClient();
824
- *
825
- * // example with extensions
826
- * import { useQueryClient } from "graz";
827
- * import { setupAuthExtension, setupIbcExtension } from "@cosmjs/stargate";
828
- *
829
- * const queryClientWithExtensions = useQueryClient(setupAuthExtension, setupIbcExtension);
830
- * ```
745
+ * graz query hook to retrieve list of balances from current account or given address.
831
746
  *
832
- * @see {@link createQueryClient}
833
- */
834
- declare const useQueryClient: UseQueryClient;
835
-
836
- /**
837
- * graz mutation hook to send tokens. Note: if `senderAddress` undefined, it will use current connected account address.
747
+ * @param bech32Address - Optional bech32 account address, defaults to connected account address
838
748
  *
839
749
  * @example
840
750
  * ```ts
841
- * import { useSendTokens } from "graz";
751
+ * import { useBalances } from "graz";
842
752
  *
843
753
  * // basic example
844
- * const { sendTokens } = useSendTokens();
754
+ * const { data, isFetching, refetch, ... } = useBalances();
845
755
  *
846
- * sendTokens({
847
- * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430";
848
- * amount: [coin];
849
- * ...
850
- * })
756
+ * // with custom bech32 address
757
+ * useBalances("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
851
758
  * ```
852
- *
853
- * @see {@link sendTokens}
854
759
  */
855
- declare const useSendTokens: ({ onError, onLoading, onSuccess, }?: MutationEventArgs<SendTokensArgs, DeliverTxResponse>) => {
856
- error: unknown;
857
- isLoading: boolean;
858
- isSuccess: boolean;
859
- sendTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, unknown, SendTokensArgs, unknown>;
860
- sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, unknown, SendTokensArgs, unknown>;
861
- status: "error" | "idle" | "loading" | "success";
862
- };
760
+ declare const useBalances: <T extends "cosmWasm" | "stargate", U extends ChainIdArgs>(args: {
761
+ bech32Address?: string | undefined;
762
+ client?: T | undefined;
763
+ } & U) => UseQueryResult<HookResultDataWithChainId<Coin$1[], U>>;
863
764
  /**
864
- * graz mutation hook to send IBC tokens. Note: if `senderAddress` undefined, it will use current connected account address.
765
+ * graz query hook to retrieve list of staked balances from current account or given address.
865
766
  *
767
+ * @param bech32Address - Optional bech32 account address, defaults to connected account address
866
768
  *
867
769
  * @example
868
770
  * ```ts
869
- * import { useSendIbcTokens } from "graz";
771
+ * import { useBalanceStaked } from "graz";
870
772
  *
871
773
  * // basic example
872
- * const { sendIbcTokens } = useSendIbcTokens();
873
- *
874
- * sendIbcTokens({
875
- * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430",
876
- * transferAmount: coin,
877
- * ...
878
- * })
879
- * ```
880
- */
881
- declare const useSendIbcTokens: ({ onError, onLoading, onSuccess, }?: MutationEventArgs<SendIbcTokensArgs, DeliverTxResponse>) => {
882
- error: unknown;
883
- isLoading: boolean;
884
- isSuccess: boolean;
885
- sendIbcTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, unknown, SendIbcTokensArgs, unknown>;
886
- sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, unknown, SendIbcTokensArgs, unknown>;
887
- status: "error" | "idle" | "loading" | "success";
888
- };
889
- type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
890
- codeId: number;
891
- } & MutationEventArgs<InstantiateContractMutationArgs<Message>, InstantiateResult>;
892
- /**
893
- * graz mutation hook to instantiate a CosmWasm smart contract when supported.
894
- *
895
- * @example
896
- * ```ts
897
- * import { useInstantiateContract } from "graz"
898
- *
899
- * const { instantiateContract: instantiateMyContract } = useInstantiateContract({
900
- * codeId: 4,
901
- * onSuccess: ({ contractAddress }) => console.log('Address:', contractAddress)
902
- * })
903
- *
904
- * const instantiateMessage = { foo: 'bar' };
905
- * instantiateMyContract({
906
- * msg: instatiateMessage,
907
- * label: "test"
908
- * });
909
- * ```
910
- */
911
- declare const useInstantiateContract: <Message extends Record<string, unknown>>({ codeId, onError, onLoading, onSuccess, }: UseInstantiateContractArgs<Message>) => {
912
- error: unknown;
913
- isLoading: boolean;
914
- isSuccess: boolean;
915
- instantiateContract: _tanstack_react_query.UseMutateFunction<InstantiateResult, unknown, InstantiateContractMutationArgs<Message>, unknown>;
916
- instantiateContractAsync: _tanstack_react_query.UseMutateAsyncFunction<InstantiateResult, unknown, InstantiateContractMutationArgs<Message>, unknown>;
917
- status: "error" | "idle" | "loading" | "success";
918
- };
919
- type UseExecuteContractArgs<Message extends Record<string, unknown>> = {
920
- contractAddress: string;
921
- } & MutationEventArgs<ExecuteContractMutationArgs<Message>, ExecuteResult>;
922
- /**
923
- * graz mutation hook for executing transactions against a CosmWasm smart
924
- * contract.
925
- *
926
- * @example
927
- * ```ts
928
- * import { useExecuteContract } from "graz"
929
- *
930
- * interface GreetMessage {
931
- * name: string;
932
- * }
933
- *
934
- * interface GreetResponse {
935
- * message: string;
936
- * }
774
+ * const { data, isFetching, refetch, ... } = useBalanceStaked();
937
775
  *
938
- * const contractAddress = "cosmosfoobarbaz";
939
- * const { executeContract } = useExecuteContract<ExecuteMessage>({ contractAddress });
940
- * executeContract({ msg: {
941
- * foo: "bar"
942
- * }}, {
943
- * onSuccess: (data: GreetResponse) => console.log('Got message:', data.message);
944
- * });
776
+ * // with custom bech32 address
777
+ * useBalanceStaked("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
945
778
  * ```
946
779
  */
947
- declare const useExecuteContract: <Message extends Record<string, unknown>>({ contractAddress, onError, onLoading, onSuccess, }: UseExecuteContractArgs<Message>) => {
780
+ declare const useBalanceStaked: <T extends "stargate", U extends ChainIdArgs>(args: {
781
+ bech32Address?: string | undefined;
782
+ client?: T | undefined;
783
+ } & U) => UseQueryResult<HookResultDataWithChainId<Coin$1 | null, U>>;
784
+ declare const useSendTokens: <T extends SigningClients>({ signingClient, signingClientOptions, chainId, onError, onLoading, onSuccess, }: MutationEventArgs<SendTokensArgs<T>, DeliverTxResponse> & {
785
+ signingClient?: T | undefined;
786
+ signingClientOptions?: (T extends "cosmWasm" ? _cosmjs_cosmwasm_stargate.SigningCosmWasmClientOptions : T extends "stargate" ? _cosmjs_stargate.StargateClientOptions : never) | undefined;
787
+ chainId: string;
788
+ }) => {
948
789
  error: unknown;
949
790
  isLoading: boolean;
950
791
  isSuccess: boolean;
951
- executeContract: _tanstack_react_query.UseMutateFunction<ExecuteResult, unknown, ExecuteContractMutationArgs<Message>, unknown>;
952
- executeContractAsync: _tanstack_react_query.UseMutateAsyncFunction<ExecuteResult, unknown, ExecuteContractMutationArgs<Message>, unknown>;
792
+ sendTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, unknown, SendTokensArgs<T>, unknown>;
793
+ sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, unknown, SendTokensArgs<T>, unknown>;
953
794
  status: "error" | "idle" | "loading" | "success";
954
795
  };
955
- /**
956
- * graz query hook for dispatching a "smart" query to a CosmWasm smart
957
- * contract.
958
- *
959
- * @param address - The address of the contract to query
960
- * @param queryMsg - The query message to send to the contract
961
- * @returns A query result with the result returned by the smart contract.
962
- */
963
- declare const useQuerySmart: <TData, TError>(address?: string, queryMsg?: Record<string, unknown>) => UseQueryResult<TData, TError>;
964
- /**
965
- * graz query hook for dispatching a "raw" query to a CosmWasm smart contract.
966
- *
967
- * @param address - The address of the contract to query
968
- * @param key - The key to lookup in the contract storage
969
- * @returns A query result with raw byte array stored at the key queried.
970
- */
971
- declare const useQueryRaw: <TError>(address?: string, key?: string) => UseQueryResult<Uint8Array | null, TError>;
972
796
 
973
797
  /**
974
798
  * graz hook to retrieve current active {@link WalletType}
@@ -987,6 +811,7 @@ declare const useActiveWalletType: () => {
987
811
  isKeplrMobile: boolean;
988
812
  isLeap: boolean;
989
813
  isLeapMobile: boolean;
814
+ isVectis: boolean;
990
815
  isWalletConnect: boolean;
991
816
  };
992
817
  /**
@@ -1002,9 +827,23 @@ declare const useActiveWalletType: () => {
1002
827
  */
1003
828
  declare const useCheckWallet: (type?: WalletType) => UseQueryResult<boolean>;
1004
829
 
830
+ /**
831
+ * Graz custom hook to track `keplr_keystorechange`, `leap_keystorechange`, `accountChanged` event and reconnect state
832
+ *
833
+ * **Note: only use this hook if not using graz's provider component.**
834
+ */
835
+ declare const useGrazEvents: () => null;
836
+ /**
837
+ * Null component to run {@link useGrazEvents} without affecting component tree.
838
+ *
839
+ * **Note: only use this component if not using graz's provider component.**
840
+ */
841
+ declare const GrazEvents: FC;
842
+
1005
843
  type GrazProviderProps = Partial<QueryClientProviderProps> & {
1006
- grazOptions?: ConfigureGrazArgs;
1007
- debug?: boolean;
844
+ grazConfig: Omit<ConfigureGrazArgs, "chains"> & {
845
+ chains: GrazChain[];
846
+ };
1008
847
  };
1009
848
  /**
1010
849
  * Provider component which extends `@tanstack/react-query`'s {@link QueryClientProvider} with built-in query client
@@ -1026,601 +865,4 @@ type GrazProviderProps = Partial<QueryClientProviderProps> & {
1026
865
  */
1027
866
  declare const GrazProvider: FC<GrazProviderProps>;
1028
867
 
1029
- /**
1030
- * Graz custom hook to track `keplr_keystorechange`, `leap_keystorechange`, `accountChanged` event and reconnect state
1031
- *
1032
- * **Note: only use this hook if not using graz's provider component.**
1033
- */
1034
- declare const useGrazEvents: () => null;
1035
- /**
1036
- * Null component to run {@link useGrazEvents} without affecting component tree.
1037
- *
1038
- * **Note: only use this component if not using graz's provider component.**
1039
- */
1040
- declare const GrazEvents: FC;
1041
-
1042
- /**
1043
- * Asset lists are a similar mechanism to allow frontends and other UIs to fetch metadata
1044
- * associated with Cosmos SDK denoms, especially for assets sent over IBC.
1045
- */
1046
- interface AssetList {
1047
- $schema?: string;
1048
- assets: Asset[];
1049
- chain_name: string;
1050
- }
1051
- interface Asset {
1052
- /**
1053
- * [OPTIONAL] The address of the asset. Only required for type_asset : cw20, snip20
1054
- */
1055
- address?: string;
1056
- /**
1057
- * The base unit of the asset. Must be in denom_units.
1058
- */
1059
- base: string;
1060
- /**
1061
- * [OPTIONAL] The coingecko id to fetch asset data from coingecko v3 api. See
1062
- * https://api.coingecko.com/api/v3/coins/list
1063
- */
1064
- coingecko_id?: string;
1065
- denom_units: DenomUnit[];
1066
- /**
1067
- * [OPTIONAL] A short description of the asset
1068
- */
1069
- description?: string;
1070
- /**
1071
- * The human friendly unit of the asset. Must be in denom_units.
1072
- */
1073
- display: string;
1074
- /**
1075
- * [OPTIONAL] IBC Channel between src and dst between chain
1076
- */
1077
- ibc?: Ibc;
1078
- images?: AssetImage[];
1079
- keywords?: string[];
1080
- logo_URIs?: AssetLogoURIs;
1081
- /**
1082
- * The project name of the asset. For example Bitcoin.
1083
- */
1084
- name: string;
1085
- /**
1086
- * The symbol of an asset. For example BTC.
1087
- */
1088
- symbol: string;
1089
- /**
1090
- * The origin of the asset, starting with the index, and capturing all transitions in form
1091
- * and location.
1092
- */
1093
- traces?: Trace[];
1094
- /**
1095
- * [OPTIONAL] The potential options for type of asset. By default, assumes sdk.coin
1096
- */
1097
- type_asset?: TypeAsset;
1098
- }
1099
- interface DenomUnit {
1100
- aliases?: string[];
1101
- denom: string;
1102
- exponent: number;
1103
- }
1104
- /**
1105
- * [OPTIONAL] IBC Channel between src and dst between chain
1106
- */
1107
- interface Ibc {
1108
- dst_channel: string;
1109
- source_channel: string;
1110
- source_denom: string;
1111
- }
1112
- interface AssetImage {
1113
- png?: string;
1114
- svg?: string;
1115
- theme?: Theme;
1116
- }
1117
- interface Theme {
1118
- primary_color_hex?: string;
1119
- }
1120
- interface AssetLogoURIs {
1121
- png?: string;
1122
- svg?: string;
1123
- }
1124
- interface Trace {
1125
- chain?: TraceChain;
1126
- counterparty: Counterparty;
1127
- /**
1128
- * The entity offering the service. E.g., 'Gravity Bridge' [Network] or 'Tether' [Company].
1129
- */
1130
- provider?: string;
1131
- type: TraceType;
1132
- }
1133
- interface TraceChain {
1134
- /**
1135
- * The chain's IBC transfer channel(, e.g., 'channel-1').
1136
- */
1137
- channel_id?: string;
1138
- /**
1139
- * The contract address where the transition takes place, where applicable. E.g., The
1140
- * Ethereum contract that locks up the asset while it's minted on another chain.
1141
- */
1142
- contract?: string;
1143
- /**
1144
- * The port/channel/denom input string that generates the 'ibc/...' denom.
1145
- */
1146
- path?: string;
1147
- /**
1148
- * The port used to transfer IBC assets; often 'transfer', but sometimes varies, e.g., for
1149
- * outgoing cw20 transfers.
1150
- */
1151
- port?: string;
1152
- }
1153
- interface Counterparty {
1154
- /**
1155
- * The base unit of the asset on its source platform. E.g., when describing ATOM from Cosmos
1156
- * Hub, specify 'uatom', NOT 'atom' nor 'ATOM'; base units are unique per platform.
1157
- */
1158
- base_denom: string;
1159
- /**
1160
- * The name of the counterparty chain. (must match exactly the chain name used in the Chain
1161
- * Registry)
1162
- *
1163
- * The chain or platform from which the asset originates. E.g., 'cosmoshub', 'ethereum',
1164
- * 'forex', or 'nasdaq'
1165
- */
1166
- chain_name: string;
1167
- /**
1168
- * The counterparty IBC transfer channel(, e.g., 'channel-1').
1169
- */
1170
- channel_id?: string;
1171
- /**
1172
- * The contract address where the transition takes place, where applicable. E.g., The
1173
- * Ethereum contract that locks up the asset while it's minted on another chain.
1174
- */
1175
- contract?: string;
1176
- /**
1177
- * The port used to transfer IBC assets; often 'transfer', but sometimes varies, e.g., for
1178
- * outgoing cw20 transfers.
1179
- */
1180
- port?: string;
1181
- }
1182
- declare enum TraceType {
1183
- Bridge = "bridge",
1184
- Ibc = "ibc",
1185
- IbcCw20 = "ibc-cw20",
1186
- LiquidStake = "liquid-stake",
1187
- Synthetic = "synthetic",
1188
- Wrapped = "wrapped"
1189
- }
1190
- /**
1191
- * [OPTIONAL] The potential options for type of asset. By default, assumes sdk.coin
1192
- */
1193
- declare enum TypeAsset {
1194
- Cw20 = "cw20",
1195
- Erc20 = "erc20",
1196
- Ics20 = "ics20",
1197
- SDKCoin = "sdk.coin",
1198
- Snip20 = "snip20",
1199
- Snip25 = "snip25"
1200
- }
1201
- /**
1202
- * Cosmos Chain.json is a metadata file that contains information about a cosmos sdk based
1203
- * chain.
1204
- */
1205
- interface Chain {
1206
- $schema?: string;
1207
- alternative_slip44s?: number[];
1208
- apis?: Apis;
1209
- /**
1210
- * Used to override the bech32_prefix for specific uses.
1211
- */
1212
- bech32_config?: Bech32Config;
1213
- /**
1214
- * The default prefix for the human-readable part of addresses that identifies the coin
1215
- * type. Must be registered with SLIP-0173. E.g., 'cosmos'
1216
- */
1217
- bech32_prefix: string;
1218
- chain_id: string;
1219
- chain_name: string;
1220
- codebase?: Codebase;
1221
- daemon_name?: string;
1222
- explorers?: Explorer[];
1223
- extra_codecs?: ExtraCodec[];
1224
- fees?: Fees;
1225
- images?: ChainImage[];
1226
- key_algos?: KeyAlgo[];
1227
- keywords?: string[];
1228
- logo_URIs?: ChainLogoURIs;
1229
- network_type?: NetworkType;
1230
- node_home?: string;
1231
- peers?: Peers;
1232
- pretty_name?: string;
1233
- slip44?: number;
1234
- staking?: Staking;
1235
- status?: Status;
1236
- update_link?: string;
1237
- website?: string;
1238
- }
1239
- interface Apis {
1240
- "evm-http-jsonrpc"?: Api[];
1241
- grpc?: Api[];
1242
- "grpc-web"?: Api[];
1243
- rest?: Api[];
1244
- rpc?: Api[];
1245
- wss?: Api[];
1246
- }
1247
- interface Api {
1248
- address: string;
1249
- archive?: boolean;
1250
- provider?: string;
1251
- }
1252
- /**
1253
- * Used to override the bech32_prefix for specific uses.
1254
- */
1255
- interface Bech32Config {
1256
- /**
1257
- * e.g., 'cosmos'
1258
- */
1259
- bech32PrefixAccAddr?: string;
1260
- /**
1261
- * e.g., 'cosmospub'
1262
- */
1263
- bech32PrefixAccPub?: string;
1264
- /**
1265
- * e.g., 'cosmosvalcons'
1266
- */
1267
- bech32PrefixConsAddr?: string;
1268
- /**
1269
- * e.g., 'cosmosvalconspub'
1270
- */
1271
- bech32PrefixConsPub?: string;
1272
- /**
1273
- * e.g., 'cosmosvaloper'
1274
- */
1275
- bech32PrefixValAddr?: string;
1276
- /**
1277
- * e.g., 'cosmosvaloperpub'
1278
- */
1279
- bech32PrefixValPub?: string;
1280
- }
1281
- interface Codebase {
1282
- binaries?: CodebaseBinaries;
1283
- compatible_versions?: string[];
1284
- consensus?: CodebaseConsensus;
1285
- cosmos_sdk_version?: string;
1286
- cosmwasm_enabled?: boolean;
1287
- /**
1288
- * Relative path to the cosmwasm directory. ex. $HOME/.juno/data/wasm
1289
- */
1290
- cosmwasm_path?: string;
1291
- cosmwasm_version?: string;
1292
- genesis?: Genesis;
1293
- git_repo?: string;
1294
- ibc_go_version?: string;
1295
- /**
1296
- * List of IBC apps (usually corresponding to a ICS standard) which have been enabled on the
1297
- * network.
1298
- */
1299
- ics_enabled?: ICSEnabled[];
1300
- recommended_version?: string;
1301
- versions?: Version[];
1302
- }
1303
- interface CodebaseBinaries {
1304
- "darwin/amd64"?: string;
1305
- "darwin/arm64"?: string;
1306
- "linux/amd64"?: string;
1307
- "linux/arm64"?: string;
1308
- "windows/amd64"?: string;
1309
- }
1310
- interface CodebaseConsensus {
1311
- type: ConsensusType;
1312
- version?: string;
1313
- }
1314
- declare enum ConsensusType {
1315
- Cometbft = "cometbft",
1316
- Tendermint = "tendermint"
1317
- }
1318
- interface Genesis {
1319
- genesis_url: string;
1320
- name?: string;
1321
- }
1322
- /**
1323
- * IBC app or ICS standard.
1324
- */
1325
- declare enum ICSEnabled {
1326
- Ics201 = "ics20-1",
1327
- Ics271 = "ics27-1",
1328
- Mauth = "mauth"
1329
- }
1330
- interface Version {
1331
- binaries?: VersionBinaries;
1332
- compatible_versions?: string[];
1333
- consensus?: VersionConsensus;
1334
- cosmos_sdk_version?: string;
1335
- cosmwasm_enabled?: boolean;
1336
- /**
1337
- * Relative path to the cosmwasm directory. ex. $HOME/.juno/data/wasm
1338
- */
1339
- cosmwasm_path?: string;
1340
- cosmwasm_version?: string;
1341
- /**
1342
- * Block Height
1343
- */
1344
- height?: number;
1345
- ibc_go_version?: string;
1346
- /**
1347
- * List of IBC apps (usually corresponding to a ICS standard) which have been enabled on the
1348
- * network.
1349
- */
1350
- ics_enabled?: ICSEnabled[];
1351
- /**
1352
- * Official Upgrade Name
1353
- */
1354
- name: string;
1355
- /**
1356
- * [Optional] Name of the following version
1357
- */
1358
- next_version_name?: string;
1359
- /**
1360
- * Proposal that will officially signal community acceptance of the upgrade.
1361
- */
1362
- proposal?: number;
1363
- recommended_version?: string;
1364
- /**
1365
- * Git Upgrade Tag
1366
- */
1367
- tag?: string;
1368
- }
1369
- interface VersionBinaries {
1370
- "darwin/amd64"?: string;
1371
- "darwin/arm64"?: string;
1372
- "linux/amd64"?: string;
1373
- "linux/arm64"?: string;
1374
- "windows/amd64"?: string;
1375
- }
1376
- interface VersionConsensus {
1377
- type: ConsensusType;
1378
- version?: string;
1379
- }
1380
- interface Explorer {
1381
- account_page?: string;
1382
- kind?: string;
1383
- tx_page?: string;
1384
- url?: string;
1385
- }
1386
- declare enum ExtraCodec {
1387
- Ethermint = "ethermint",
1388
- Injective = "injective"
1389
- }
1390
- interface Fees {
1391
- fee_tokens: FeeToken[];
1392
- }
1393
- interface FeeToken {
1394
- average_gas_price?: number;
1395
- denom: string;
1396
- fixed_min_gas_price?: number;
1397
- gas_costs?: GasCosts;
1398
- high_gas_price?: number;
1399
- low_gas_price?: number;
1400
- }
1401
- interface GasCosts {
1402
- cosmos_send?: number;
1403
- ibc_transfer?: number;
1404
- }
1405
- interface ChainImage {
1406
- png?: string;
1407
- svg?: string;
1408
- theme?: Theme;
1409
- }
1410
- declare enum KeyAlgo {
1411
- Ed25519 = "ed25519",
1412
- Ethsecp256K1 = "ethsecp256k1",
1413
- Secp256K1 = "secp256k1",
1414
- Sr25519 = "sr25519"
1415
- }
1416
- interface ChainLogoURIs {
1417
- png?: string;
1418
- svg?: string;
1419
- }
1420
- declare enum NetworkType {
1421
- Devnet = "devnet",
1422
- Mainnet = "mainnet",
1423
- Testnet = "testnet"
1424
- }
1425
- interface Peers {
1426
- persistent_peers?: PersistentPeer[];
1427
- seeds?: PersistentPeer[];
1428
- }
1429
- interface PersistentPeer {
1430
- address: string;
1431
- id: string;
1432
- provider?: string;
1433
- }
1434
- interface Staking {
1435
- lock_duration?: LockDuration;
1436
- staking_tokens: StakingToken[];
1437
- }
1438
- interface LockDuration {
1439
- /**
1440
- * The number of blocks for which the staked tokens are locked.
1441
- */
1442
- blocks?: number;
1443
- /**
1444
- * The approximate time for which the staked tokens are locked.
1445
- */
1446
- time?: string;
1447
- }
1448
- interface StakingToken {
1449
- denom: string;
1450
- }
1451
- declare enum Status {
1452
- Killed = "killed",
1453
- Live = "live",
1454
- Upcoming = "upcoming"
1455
- }
1456
- interface IbcDataSchema {
1457
- $schema?: string;
1458
- chain_1: IbcDataSchemaChain;
1459
- chain_2: IbcDataSchemaChain;
1460
- channels: Channel[];
1461
- }
1462
- /**
1463
- * Top level IBC data pertaining to the chain. `chain_1` and `chain_2` should be in
1464
- * alphabetical order.
1465
- */
1466
- interface IbcDataSchemaChain {
1467
- chain_name: string;
1468
- /**
1469
- * The client ID on the corresponding chain representing the other chain's light client.
1470
- */
1471
- client_id: string;
1472
- /**
1473
- * The connection ID on the corresponding chain representing a connection to the other chain.
1474
- */
1475
- connection_id: string;
1476
- }
1477
- interface Channel {
1478
- chain_1: ChannelChain;
1479
- chain_2: ChannelChain;
1480
- /**
1481
- * Human readable description of the channel.
1482
- */
1483
- description?: string;
1484
- /**
1485
- * Determines if packets from a sending module must be 'ordered' or 'unordered'.
1486
- */
1487
- ordering: Ordering;
1488
- /**
1489
- * Human readable key:value pairs that help describe and distinguish channels.
1490
- */
1491
- tags?: Tags;
1492
- /**
1493
- * IBC Version
1494
- */
1495
- version: string;
1496
- }
1497
- interface ChannelChain {
1498
- /**
1499
- * The channel ID on the corresponding chain's connection representing a channel on the
1500
- * other chain.
1501
- */
1502
- channel_id: string;
1503
- /**
1504
- * The IBC port ID which a relevant module binds to on the corresponding chain.
1505
- */
1506
- port_id: string;
1507
- }
1508
- /**
1509
- * Determines if packets from a sending module must be 'ordered' or 'unordered'.
1510
- */
1511
- declare enum Ordering {
1512
- Ordered = "ordered",
1513
- Unordered = "unordered"
1514
- }
1515
- /**
1516
- * Human readable key:value pairs that help describe and distinguish channels.
1517
- */
1518
- interface Tags {
1519
- dex?: string;
1520
- preferred?: boolean;
1521
- /**
1522
- * String that helps describe non-dex use cases ex: interchain accounts(ICA).
1523
- */
1524
- properties?: string;
1525
- status?: Status;
1526
- [property: string]: any;
1527
- }
1528
- interface MemoKeysSchema {
1529
- $schema?: string;
1530
- memo_keys: MemoKey[];
1531
- }
1532
- interface MemoKey {
1533
- description: string;
1534
- git_repo: string;
1535
- key: string;
1536
- memo: Record<string, any>;
1537
- [property: string]: any;
1538
- }
1539
-
1540
- /**
1541
- * Helper function to define chain.
1542
- *
1543
- * This function does not do anything special else than providing type safety
1544
- * when defining chain information.
1545
- *
1546
- * @example
1547
- * ```ts
1548
- * import { defineAsset } from "graz";
1549
- *
1550
- * const atom = defineAsset({
1551
- * base: "uatom",
1552
- * display: "atom",
1553
- * symbol: "ATOM",
1554
- * ...
1555
- * });
1556
- * ```
1557
- */
1558
- declare const defineAsset: <T extends Asset>(asset: T) => T;
1559
- /**
1560
- * Helper function to define chains asset list.
1561
- *
1562
- * This function does not do anything special else than providing type safety
1563
- * when defining chain information.
1564
- *
1565
- * @example
1566
- * ```ts
1567
- * import { defineAssetList } from "graz";
1568
- *
1569
- * const assetlist = defineAssetList({
1570
- * chain_name: "cosmoshub",
1571
- * assets: [...]
1572
- * });
1573
- * ```
1574
- */
1575
- declare const defineAssetList: <T extends AssetList>(assetlist: T) => T;
1576
- /**
1577
- * Helper function to define chain with registry compliant type.
1578
- *
1579
- * This function does not do anything special else than providing type safety
1580
- * when defining chain information.
1581
- *
1582
- * @example
1583
- * ```ts
1584
- * import { defineRegistryChain } from "graz";
1585
- *
1586
- * const cosmoshub = defineRegistryChain({
1587
- * chain_name: "cosmoshub",
1588
- * chain_id: "cosmoshub-4",
1589
- * ...
1590
- * });
1591
- * ```
1592
- */
1593
- declare const defineRegistryChain: <T extends Chain>(chain: T) => T;
1594
-
1595
- /**
1596
- * Function to convert chain object from registry to Keplr's {@link ChainInfo} object.
1597
- *
1598
- * Note that every chain generated in `graz/chains` already has {@link ChainInfo}.
1599
- * (e.g. `import chainInfo from "graz/chains/cosmoshub"`).
1600
- *
1601
- * @example
1602
- * ```ts
1603
- * import { registryToChainInfo } from "graz";
1604
- *
1605
- * import chain from "graz/chains/cosmoshub/chain";
1606
- * import assetlist from "graz/chains/cosmoshub/assetlist";
1607
- *
1608
- * const chainInfo = registryToChainInfo({ chain, assetlist });
1609
- * const chainInfoFromAsset = registryToChainInfo({ chain, assets: assetlist.assets });
1610
- * ```
1611
- *
1612
- */
1613
- declare const registryToChainInfo: (args: RegistryToChainInfoArgs) => ChainInfo;
1614
- type MapEndpointGetters<T extends string> = Record<`get${Capitalize<T>}Endpoint`, (chain: Chain) => string>;
1615
- type RegistryToChainInfoArgs = Partial<MapEndpointGetters<"rpc" | "rest">> & ({
1616
- chain: Chain;
1617
- assetlists: AssetList[];
1618
- } | {
1619
- chain: Chain;
1620
- assetlist: AssetList;
1621
- } | {
1622
- chain: Chain;
1623
- assets: Asset[];
1624
- });
1625
-
1626
- export { AccountData, Api, Apis, Asset, AssetImage, AssetList, AssetLogoURIs, Bech32Config, Chain, ChainImage, ChainInfoWithPath, ChainLogoURIs, Channel, ChannelChain, Codebase, CodebaseBinaries, CodebaseConsensus, ConfigureGrazArgs, ConnectArgs, ConnectResult, Connector, ConsensusType, Counterparty, CreateClientArgs, CreateQueryClient, CreateSigningClientArgs, DenomUnit, Dictionary, ExecuteContractArgs, ExecuteContractMutationArgs, Explorer, ExtraCodec, FeeToken, Fees, GasCosts, Genesis, GetWalletConnectParams, GrazAdapter, GrazChain, GrazEvents, GrazProvider, GrazProviderProps, ICSEnabled, Ibc, IbcDataSchema, IbcDataSchemaChain, InstantiateContractArgs, InstantiateContractMutationArgs, KeyAlgo, LockDuration, Maybe, MemoKey, MemoKeysSchema, NetworkType, Ordering, Peers, PersistentPeer, ReconnectArgs, SendIbcTokensArgs, SendTokensArgs, Staking, StakingToken, Status, SuggestChainAndConnectArgs, Tags, Theme, Trace, TraceChain, TraceType, TypeAsset, UseAccountArgs, UseConnectChainArgs, UseExecuteContractArgs, UseInstantiateContractArgs, UseQueryClient, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, Version, VersionBinaries, VersionConsensus, WALLET_TYPES, Wallet, WalletType, checkWallet, clearRecentChain, configureGraz, connect, createClients, createQueryClient, createSigningClients, defineAsset, defineAssetList, defineChain, defineChainInfo, defineChains, defineRegistryChain, disconnect, executeContract, getActiveChainCurrency, getAvailableWallets, getBalanceStaked, getBalances, getCosmostation, getKeplr, getLeap, getQueryRaw, getQuerySmart, getRecentChain, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, instantiateContract, mainnetChains, mainnetChainsArray, reconnect, registryToChainInfo, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChain, useActiveChainCurrency, useActiveChainValidators, useActiveWalletType, useBalance, useBalanceStaked, useBalances, useCheckWallet, useClients, useConnect, useDisconnect, useExecuteContract, useGrazEvents, useInstantiateContract, useOfflineSigners, useQueryClient, useQueryRaw, useQuerySmart, useRecentChain, useSendIbcTokens, useSendTokens, useSigners, useSigningClients, useSuggestChain, useSuggestChainAndConnect };
868
+ export { AccountData, ChainInfoWithPath, Clients, ConfigureGrazArgs, ConnectArgs, ConnectClient, ConnectClientArgs, ConnectResult, ConnectSigningClient, ConnectSigningClientArgs, Connector, Dictionary, ExecuteContractArgs, ExecuteContractMutationArgs, GetWalletConnectParams, GrazAdapter, GrazChain, GrazEvents, GrazProvider, GrazProviderProps, InstantiateContractArgs, InstantiateContractMutationArgs, Maybe, OfflineSigners, ReconnectArgs, SendIbcTokensArgs, SendTokensArgs, SigningClients, SuggestChainAndConnectArgs, UseAccount, UseAccountArgs, UseConnectChainArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WALLET_TYPES, Wallet, WalletType, checkWallet, clearRecentChain, configureGraz, connect, connectClient, connectSigningClient, defineChain, defineChainInfo, defineChains, disconnect, executeContract, getAvailableWallets, getBalanceStaked, getBalances, getCosmostation, getKeplr, getLeap, getOfflineSigners, getQueryRaw, getQuerySmart, getRecentChains, getVectis, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, instantiateContract, mainnetChains, mainnetChainsArray, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChainValidators, useActiveWalletType, useBalanceStaked, useBalances, useCheckWallet, useConnect, useConnectClient, useConnectSigningClient, useDisconnect, useGrazEvents, useOfflineSigners, useRecentChain, useSendTokens, useSuggestChain, useSuggestChainAndConnect };