graz 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +5 -5
- package/dist/index.d.mts +35 -19
- package/dist/index.d.ts +35 -19
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +37 -27
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var h=require('fs/promises'),F=require('path'),url=require('url'),cosmos=require('@keplr-wallet/cosmos'),V=require('arg'),cosmosDirectoryClient=require('cosmos-directory-client');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var h__namespace=/*#__PURE__*/_interopNamespace(h);var F__namespace=/*#__PURE__*/_interopNamespace(F);var V__default=/*#__PURE__*/_interopDefault(V);var z=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,A=z();async function R(t,o,{concurrency:i=Number.POSITIVE_INFINITY,stopOnError:d=true,signal:c}={}){return new Promise((l,e)=>{if(t[Symbol.iterator]===void 0&&t[Symbol.asyncIterator]===void 0)throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof t})`);if(typeof o!="function")throw new TypeError("Mapper function is required");if(!(Number.isSafeInteger(i)&&i>=1||i===Number.POSITIVE_INFINITY))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${i}\` (${typeof i})`);let r=[],m=[],_=new Map,I=false,n=false,N=false,s=0,P=0,G=t[Symbol.iterator]===void 0?t[Symbol.asyncIterator]():t[Symbol.iterator](),x=()=>{g(c.reason);},$=()=>{c?.removeEventListener("abort",x);},v=f=>{l(f),$();},g=f=>{I=true,n=true,e(f),$();};c&&(c.aborted&&g(c.reason),c.addEventListener("abort",x,{once:true}));let C=async()=>{if(n)return;let f=await G.next(),S=P;if(P++,f.done){if(N=true,s===0&&!n){if(!d&&m.length>0){g(new AggregateError(m));return}if(n=true,_.size===0){v(r);return}let p=[];for(let[u,O]of r.entries())_.get(u)!==j&&p.push(O);v(p);}return}s++,(async()=>{try{let p=await f.value;if(n)return;let u=await o(p,S);u===j&&_.set(S,u),r[S]=u,s--,await C();}catch(p){if(d)g(p);else {m.push(p),s--;try{await C();}catch(u){g(u);}}}})();};(async()=>{for(let f=0;f<i;f++){try{await C();}catch(S){g(S);break}if(N||I)break}})();})}var j=Symbol("skip");var q=F.dirname(url.fileURLToPath(A)),X=t=>/^\d+$/.test(t),w=t=>X(t[0])?`_${t}`:t,D=`Usage: graz [options]
|
|
3
3
|
|
|
4
4
|
Options:
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ Generate options:
|
|
|
14
14
|
--authz Generate only authz compatible chains
|
|
15
15
|
|
|
16
16
|
https://github.com/graz-sh/graz
|
|
17
|
-
`,
|
|
18
|
-
`),
|
|
19
|
-
`}).join(""),
|
|
20
|
-
`),
|
|
17
|
+
`,a=V__default.default({"--generate":Boolean,"-g":"--generate","--authz":Boolean,"--best":Boolean,"--mainnet":String,"--testnet":String,"-b":"--best","-M":"--mainnet","-T":"--testnet","--help":Boolean,"-h":"--help","--endpoint":String,"-e":"--endpoint"}),J=async()=>{if(a["--help"]){console.log(D);return}if(a["--generate"]){await K();return}console.log(D);},K=async()=>{console.log("\u23F3 Generating chain list..."),a["--authz"]&&console.log("\u270D\uFE0F Detected authz flag, generating only compatible chains..."),a["--best"]&&console.log("\u{1F481}\u200D\u2642\uFE0F Detected best flag, setting REST and RPC endpoints to best latency..."),(a["--mainnet"]||a["--testnet"])&&console.log("\u{1F419} Detected chain filtering flag, generating only given chain paths...");let t,o;if(a["--endpoint"]){console.log("\u{1F310} Fetching chain information from specified endpoint");try{let e=await fetch(a["--endpoint"]);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);let r=await e.json();t=M(r.mainnet,a["--mainnet"]),o=M(r.testnet,a["--testnet"]);}catch(e){console.error(`\u274C Failed to fetch chain information: ${e.message}`),process.exit(1);}}else [t,o]=await Promise.all([L(cosmosDirectoryClient.createClient(),{filter:a["--mainnet"]}),L(cosmosDirectoryClient.createTestnetClient(),{filter:a["--testnet"]})]);let[i,d]=await Promise.all([h__namespace.readFile(b("index.js.stub"),{encoding:"utf-8"}),h__namespace.readFile(b("index.mjs.stub"),{encoding:"utf-8"})]),c=i.replace("/* REPLACE_MAINNET_DEFS */",T(t)).replace("/* REPLACE_TESTNET_DEFS */",T(o,{testnet:true})).replace("/* REPLACE_MAINNET_CHAINS */",y(t)).replace("/* REPLACE_TESTNET_CHAINS */",y(o,{testnet:true})).replace("/* REPLACE_MAINNET_CHAINS_ARRAY */",E(t)).replace("/* REPLACE_TESTNET_CHAINS_ARRAY */",E(o,{testnet:true})).replace("/* REPLACE_MAINNET_EXPORTS */",E(t)).replace("/* REPLACE_TESTNET_EXPORTS */",E(o,{testnet:true})).replace(/"(.+)":/g,"$1:").trim(),l=d.replace("/* REPLACE_MAINNET_DEFS */",T(t,{mjs:true})).replace("/* REPLACE_TESTNET_DEFS */",T(o,{mjs:true,testnet:true})).replace("/* REPLACE_MAINNET_CHAINS */",y(t)).replace("/* REPLACE_TESTNET_CHAINS */",y(o,{testnet:true})).replace("/* REPLACE_MAINNET_CHAINS_ARRAY */",E(t)).replace("/* REPLACE_TESTNET_CHAINS_ARRAY */",E(o,{testnet:true})).replace(/"(.+)":/g,"$1:").trim();await Promise.all([h__namespace.writeFile(b("index.js"),c,{encoding:"utf-8"}),h__namespace.writeFile(b("index.mjs"),l.replace('"../dist"','"../dist/index.mjs"'),{encoding:"utf-8"}),h__namespace.writeFile(b("index.ts"),l,{encoding:"utf-8"})]),console.log('\u2728 Generate complete! You can import `mainnetChains` and `testnetChains` from "graz/chains".\n');},M=(t,o)=>{if(!o)return t;let i=new Set(o.split(","));return Object.fromEntries(Object.entries(t).filter(([d])=>i.has(d)))},b=(...t)=>F__namespace.resolve(q,"../chains",...t),y=(t,{testnet:o=false}={})=>Object.keys(t).map(i=>` ${w(i)}: ${w(i)},`).join(`
|
|
18
|
+
`),T=(t,{mjs:o=false,testnet:i=false}={})=>Object.entries(t).map(([d,c])=>{let l=`${w(d)}`,e=JSON.stringify(c,null,2);return `${o?"export ":""}const ${l} = defineChainInfo(${e});
|
|
19
|
+
`}).join(""),E=(t,{testnet:o=false}={})=>Object.keys(t).map(i=>` ${w(i)},`).join(`
|
|
20
|
+
`),L=async(t,{filter:o=""}={})=>{let i;if(o)i=o.split(",").map(e=>({path:e}));else try{i=(await t.fetchChains()).chains.map(({path:r})=>({path:r}));}catch(e){return console.error(`\u274C Failed to fetch chains list: ${e.message}`),{}}let c=(await R(i,async e=>{try{return (await t.fetchChain(e.path)).chain}catch(r){return console.error(`\u274C Failed to fetch chain "${e.path}": ${r.message}`),null}},{concurrency:4})).filter(e=>e!==null),l={};return c.forEach(e=>{try{if(a["--authz"]&&!e.params?.authz)return;let r=a["--best"]?e.best_apis:e.apis;if(!r||!r.rest?.[0]||!r.rpc?.[0])throw new Error(`\u26A0\uFE0F ${e.name} has no REST/RPC endpoints, skipping codegen...`);if(!e.assets)throw new Error(`\u26A0\uFE0F ${e.name} has no assets, skipping codegen...`);let m=e.assets[0],_={coinDenom:m.denom_units[m.denom_units.length-1].denom,coinMinimalDenom:m.denom_units[0].denom,coinDecimals:m.denom_units[m.denom_units.length-1].exponent,coinGeckoId:m.coingecko_id},I=e.fees?.fee_tokens.map(n=>n.low_gas_price&&n.average_gas_price&&n.high_gas_price?{coinDenom:e.assets?.find(s=>s.denom===n.denom)?.denom_units.at(-1)?.denom||n.denom,coinMinimalDenom:e.assets?.find(s=>s.denom===n.denom)?.denom_units[0]?.denom||n.denom,coinDecimals:Number(e.assets?.find(s=>s.denom===n.denom)?.decimals),coinGeckoId:e.assets?.find(s=>s.denom===n.denom)?.coingecko_id||void 0,gasPriceStep:{low:Number(n.low_gas_price),average:Number(n.average_gas_price),high:Number(n.high_gas_price)}}:{coinDenom:e.assets?.find(s=>s.denom===n.denom)?.denom_units.at(-1)?.denom||n.denom,coinMinimalDenom:e.assets?.find(s=>s.denom===n.denom)?.denom_units[0]?.denom||n.denom,coinDecimals:Number(e.assets?.find(s=>s.denom===n.denom)?.decimals),coinGeckoId:e.assets?.find(s=>s.denom===n.denom)?.coingecko_id||void 0});if(!I)throw new Error(`\u26A0\uFE0F ${e.name} has no fee currencies, skipping codegen...`);l[e.path]={chainId:e.chain_id,currencies:e.assets.map(n=>({coinDenom:n.denom_units[n.denom_units.length-1].denom,coinMinimalDenom:n.denom_units[0].denom,coinDecimals:n.denom_units[n.denom_units.length-1].exponent,coinGeckoId:n.coingecko_id})),rest:r.rest[0].address||"",rpc:r.rpc[0].address||"",bech32Config:cosmos.Bech32Address.defaultBech32Config(e.bech32_prefix),chainName:e.chain_name,feeCurrencies:I,stakeCurrency:_,bip44:{coinType:e.slip44??0}};}catch(r){console.error(r instanceof Error?r.message:String(r));}}),l};J();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
/// <reference types="../types/global" />
|
|
2
|
+
import { OfflineAminoSigner, StdSignature } from '@cosmjs/amino';
|
|
2
3
|
import { DirectSignResponse, OfflineDirectSigner, Coin } from '@cosmjs/proto-signing';
|
|
3
|
-
import {
|
|
4
|
-
import { OfflineAminoSigner } from '@cosmjs/amino';
|
|
4
|
+
import { Keplr, ChainInfo, KeplrSignOptions, KeplrIntereactionOptions, Key as Key$1, AppCurrency } from '@keplr-wallet/types';
|
|
5
5
|
import { WalletConnectModalConfig } from '@walletconnect/modal';
|
|
6
6
|
import { SignClientTypes } from '@walletconnect/types';
|
|
7
7
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
8
|
-
import { UseQueryResult } from '@tanstack/react-query';
|
|
8
|
+
import { QueryClient, UseQueryResult } from '@tanstack/react-query';
|
|
9
9
|
import { ParaWeb } from '@getpara/web-sdk';
|
|
10
10
|
export { ParaWeb } from '@getpara/web-sdk';
|
|
11
|
-
import { ParaGrazConfig as ParaGrazConfig$1, ParaGrazConnector } from '@getpara/graz-connector';
|
|
12
11
|
import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
|
|
13
|
-
import { SigningCosmWasmClient, InstantiateOptions, CosmWasmClient,
|
|
14
|
-
import {
|
|
15
|
-
import { Height } from 'cosmjs-types/ibc/core/client/v1/client';
|
|
12
|
+
import { SigningCosmWasmClient, InstantiateOptions, CosmWasmClient, ExecuteResult, InstantiateResult, SigningCosmWasmClientOptions } from '@cosmjs/cosmwasm-stargate';
|
|
13
|
+
import { StdFee, SigningStargateClient, DeliverTxResponse, QueryClient as QueryClient$1, StakingExtension, StargateClient, SigningStargateClientOptions } from '@cosmjs/stargate';
|
|
16
14
|
import { BondStatusString } from '@cosmjs/stargate/build/modules/staking/queries';
|
|
17
|
-
import {
|
|
18
|
-
import { ReactNode, FC } from 'react';
|
|
15
|
+
import { FC, ReactNode } from 'react';
|
|
19
16
|
|
|
20
17
|
type Dictionary<T = string> = Record<string, T>;
|
|
21
18
|
type Maybe<T> = T | undefined;
|
|
@@ -42,11 +39,12 @@ declare enum WalletType {
|
|
|
42
39
|
CACTUSCOSMOS = "cactuscosmos"
|
|
43
40
|
}
|
|
44
41
|
declare const WALLET_TYPES: WalletType[];
|
|
45
|
-
type Wallet = Pick<Keplr, "enable" | "
|
|
42
|
+
type Wallet = Pick<Keplr, "enable" | "signAmino"> & {
|
|
46
43
|
experimentalSuggestChain: (chainInfo: Omit<ChainInfo, "nodeProvider">) => Promise<void>;
|
|
47
44
|
signArbitrary?: Keplr["signArbitrary"];
|
|
48
45
|
signDirect: (...args: SignDirectParams) => Promise<DirectSignResponse>;
|
|
49
46
|
getOfflineSigner: (chainId: string, signOptions?: KeplrSignOptions) => OfflineAminoSigner & OfflineDirectSigner;
|
|
47
|
+
getOfflineSignerOnlyAmino: (chainId: string, signOptions?: KeplrSignOptions) => OfflineAminoSigner;
|
|
50
48
|
getOfflineSignerAuto: (chainId: string, signOptions?: KeplrSignOptions) => Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
|
51
49
|
subscription?: (reconnect: () => void) => () => void;
|
|
52
50
|
init?: () => Promise<unknown>;
|
|
@@ -93,9 +91,9 @@ type ReconnectArgs = Maybe<{
|
|
|
93
91
|
}>;
|
|
94
92
|
declare const reconnect: (args?: ReconnectArgs) => Promise<ConnectResult | undefined>;
|
|
95
93
|
interface OfflineSigners {
|
|
96
|
-
offlineSigner: OfflineAminoSigner
|
|
97
|
-
offlineSignerAmino: OfflineAminoSigner
|
|
98
|
-
offlineSignerAuto: OfflineAminoSigner
|
|
94
|
+
offlineSigner: OfflineAminoSigner & OfflineDirectSigner;
|
|
95
|
+
offlineSignerAmino: OfflineAminoSigner;
|
|
96
|
+
offlineSignerAuto: OfflineAminoSigner | OfflineDirectSigner;
|
|
99
97
|
}
|
|
100
98
|
declare const getOfflineSigners: (args?: {
|
|
101
99
|
walletType?: WalletType;
|
|
@@ -243,9 +241,10 @@ interface ParaWallet {
|
|
|
243
241
|
}
|
|
244
242
|
/**
|
|
245
243
|
* Event callbacks for Para wallet connector lifecycle events
|
|
246
|
-
* Extracted from @getpara/graz-connector ParaGrazConfig
|
|
247
244
|
*/
|
|
248
|
-
|
|
245
|
+
interface ParaGrazConnectorEvents {
|
|
246
|
+
onEnabled?: (chainIds: string[], connector: ParaGrazConnector) => void;
|
|
247
|
+
}
|
|
249
248
|
/**
|
|
250
249
|
* Modal props for Para wallet UI
|
|
251
250
|
* Compatible with ParaModalProps from @getpara/react-sdk-lite
|
|
@@ -296,7 +295,19 @@ interface ParaGrazConfig {
|
|
|
296
295
|
* Should match the client used in your app's QueryClientProvider
|
|
297
296
|
* Only needed when using @getpara/graz-integration with modal support
|
|
298
297
|
*/
|
|
299
|
-
queryClient?:
|
|
298
|
+
queryClient?: QueryClient;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Para wallet connector interface
|
|
302
|
+
*
|
|
303
|
+
* Structural contract for the connector instance provided by
|
|
304
|
+
* @getpara/graz-integration. Defined here so graz's published types stay
|
|
305
|
+
* self-contained and do not pin a specific @getpara/graz-connector install.
|
|
306
|
+
*/
|
|
307
|
+
interface ParaGrazConnector extends Pick<Wallet, "enable" | "getKey" | "getOfflineSigner" | "getOfflineSignerOnlyAmino" | "getOfflineSignerAuto" | "signAmino" | "signDirect"> {
|
|
308
|
+
disconnect: () => Promise<void>;
|
|
309
|
+
getParaWebClient: () => ParaWeb;
|
|
310
|
+
signArbitrary: (chainId: string, signer: string, data: string | Uint8Array) => Promise<StdSignature>;
|
|
300
311
|
}
|
|
301
312
|
|
|
302
313
|
interface ChainConfig {
|
|
@@ -393,6 +404,10 @@ interface ConfigureGrazArgs {
|
|
|
393
404
|
}
|
|
394
405
|
declare const configureGraz: (args: ConfigureGrazArgs) => ConfigureGrazArgs;
|
|
395
406
|
|
|
407
|
+
interface Height {
|
|
408
|
+
revisionNumber: bigint;
|
|
409
|
+
revisionHeight: bigint;
|
|
410
|
+
}
|
|
396
411
|
interface SendTokensArgs {
|
|
397
412
|
signingClient?: SigningStargateClient | SigningCosmWasmClient;
|
|
398
413
|
senderAddress?: string;
|
|
@@ -1010,8 +1025,9 @@ declare function useOfflineSigners(args?: Record<string, never>): UseMultiChainQ
|
|
|
1010
1025
|
declare const useBalanceStaked: (args: {
|
|
1011
1026
|
bech32Address: string;
|
|
1012
1027
|
chainId: string;
|
|
1013
|
-
} & QueryConfig) => UseQueryResult<Coin, unknown>;
|
|
1028
|
+
} & QueryConfig) => UseQueryResult<Coin | null, unknown>;
|
|
1014
1029
|
|
|
1030
|
+
type QueryValidatorsResponse = Awaited<ReturnType<StakingExtension["staking"]["validators"]>>;
|
|
1015
1031
|
/**
|
|
1016
1032
|
* graz hook to retrieve connected account's active chainIds
|
|
1017
1033
|
*
|
|
@@ -1095,7 +1111,7 @@ declare const useActiveChainCurrency: ({ denom }: {
|
|
|
1095
1111
|
* const { data: response, ... } = useActiveChainValidators(queryClient);
|
|
1096
1112
|
* ```
|
|
1097
1113
|
*/
|
|
1098
|
-
declare const useQueryClientValidators: <T extends QueryClient & StakingExtension>(args: {
|
|
1114
|
+
declare const useQueryClientValidators: <T extends QueryClient$1 & StakingExtension>(args: {
|
|
1099
1115
|
queryClient: T | undefined;
|
|
1100
1116
|
status?: BondStatusString;
|
|
1101
1117
|
}) => UseQueryResult<QueryValidatorsResponse>;
|
|
@@ -1908,4 +1924,4 @@ declare const useGrazEvents: () => null;
|
|
|
1908
1924
|
*/
|
|
1909
1925
|
declare const GrazEvents: FC;
|
|
1910
1926
|
|
|
1911
|
-
export { type ActionChainId, type AddChainArgs, type CactusCosmosWallet, type ConfigureGrazArgs, type ConnectArgs, type ConnectResult, type Dictionary, type ErrorReporter, type ExecuteContractArgs, type ExecuteContractMutationArgs, GrazEvents, GrazProvider, type GrazProviderProps, type InstantiateContractArgs, type InstantiateContractMutationArgs, type Key, type KnownKeys, LOG_CATEGORIES, LOG_FUNCTIONS, LOG_HOOKS, LogCategory, LogLevel, type Logger, type LoggerOptions, type Maybe, type OfflineSigners, type ParaGrazConfig, type ParaGrazConnectorEvents, type ParaModalProps, type ParaWallet, type ReconnectArgs, type SendIbcTokensArgs, type SendTokensArgs, type SignAminoParams, type SignDirectParams, type SignDoc, type SuggestChainAndConnectArgs, type SuggestChainArgs, type UseAccountArgs, type UseAccountResult, type UseAddChainArgs, type UseConnectChainArgs, type UseExecuteContractArgs, type UseInstantiateContractArgs, type UseSuggestChainAndConnectArgs, type UseSuggestChainArgs, WALLET_TYPES, type Wallet, WalletType, addChain, checkWallet, clearRecentChain, clearSession, configureGraz, configureLogger, connect, defineChainInfo, defineChains, disconnect, executeContract, getAvailableWallets, getCactusCosmos, getChainInfo, getChainInfos, getCosmostation, getKeplr, getLeap, getLogger, getMetamaskSnapLeap, getOfflineSigners, getOkx, getPara, getQueryRaw, getQuerySmart, getRecentChainIds, getRecentChains, getVectis, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, instantiateContract, isLeapDappBrowser, isLeapSnaps, isPara, isWalletConnect, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, useAccount, useActiveChainCurrency, useActiveChainIds, useActiveChains, useActiveWalletType, useAddChain, useBalance, useBalanceStaked, useBalances, useChainInfo, useChainInfos, useCheckWallet, useConnect, useCosmWasmClient, useCosmWasmSigningClient, useDisconnect, useExecuteContract, useGrazEvents, useInstantiateContract, useOfflineSigners, useQueryClientValidators, useQueryRaw, useQuerySmart, useRecentChainIds, useRecentChains, useSendIbcTokens, useSendTokens, useStargateClient, useStargateSigningClient, useSuggestChain, useSuggestChainAndConnect };
|
|
1927
|
+
export { type ActionChainId, type AddChainArgs, type CactusCosmosWallet, type ConfigureGrazArgs, type ConnectArgs, type ConnectResult, type Dictionary, type ErrorReporter, type ExecuteContractArgs, type ExecuteContractMutationArgs, GrazEvents, GrazProvider, type GrazProviderProps, type Height, type InstantiateContractArgs, type InstantiateContractMutationArgs, type Key, type KnownKeys, LOG_CATEGORIES, LOG_FUNCTIONS, LOG_HOOKS, LogCategory, LogLevel, type Logger, type LoggerOptions, type Maybe, type OfflineSigners, type ParaGrazConfig, type ParaGrazConnector, type ParaGrazConnectorEvents, type ParaModalProps, type ParaWallet, type ReconnectArgs, type SendIbcTokensArgs, type SendTokensArgs, type SignAminoParams, type SignDirectParams, type SignDoc, type SuggestChainAndConnectArgs, type SuggestChainArgs, type UseAccountArgs, type UseAccountResult, type UseAddChainArgs, type UseConnectChainArgs, type UseExecuteContractArgs, type UseInstantiateContractArgs, type UseSuggestChainAndConnectArgs, type UseSuggestChainArgs, WALLET_TYPES, type Wallet, WalletType, addChain, checkWallet, clearRecentChain, clearSession, configureGraz, configureLogger, connect, defineChainInfo, defineChains, disconnect, executeContract, getAvailableWallets, getCactusCosmos, getChainInfo, getChainInfos, getCosmostation, getKeplr, getLeap, getLogger, getMetamaskSnapLeap, getOfflineSigners, getOkx, getPara, getQueryRaw, getQuerySmart, getRecentChainIds, getRecentChains, getVectis, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, instantiateContract, isLeapDappBrowser, isLeapSnaps, isPara, isWalletConnect, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, useAccount, useActiveChainCurrency, useActiveChainIds, useActiveChains, useActiveWalletType, useAddChain, useBalance, useBalanceStaked, useBalances, useChainInfo, useChainInfos, useCheckWallet, useConnect, useCosmWasmClient, useCosmWasmSigningClient, useDisconnect, useExecuteContract, useGrazEvents, useInstantiateContract, useOfflineSigners, useQueryClientValidators, useQueryRaw, useQuerySmart, useRecentChainIds, useRecentChains, useSendIbcTokens, useSendTokens, useStargateClient, useStargateSigningClient, useSuggestChain, useSuggestChainAndConnect };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
/// <reference types="../types/global" />
|
|
2
|
+
import { OfflineAminoSigner, StdSignature } from '@cosmjs/amino';
|
|
2
3
|
import { DirectSignResponse, OfflineDirectSigner, Coin } from '@cosmjs/proto-signing';
|
|
3
|
-
import {
|
|
4
|
-
import { OfflineAminoSigner } from '@cosmjs/amino';
|
|
4
|
+
import { Keplr, ChainInfo, KeplrSignOptions, KeplrIntereactionOptions, Key as Key$1, AppCurrency } from '@keplr-wallet/types';
|
|
5
5
|
import { WalletConnectModalConfig } from '@walletconnect/modal';
|
|
6
6
|
import { SignClientTypes } from '@walletconnect/types';
|
|
7
7
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
8
|
-
import { UseQueryResult } from '@tanstack/react-query';
|
|
8
|
+
import { QueryClient, UseQueryResult } from '@tanstack/react-query';
|
|
9
9
|
import { ParaWeb } from '@getpara/web-sdk';
|
|
10
10
|
export { ParaWeb } from '@getpara/web-sdk';
|
|
11
|
-
import { ParaGrazConfig as ParaGrazConfig$1, ParaGrazConnector } from '@getpara/graz-connector';
|
|
12
11
|
import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
|
|
13
|
-
import { SigningCosmWasmClient, InstantiateOptions, CosmWasmClient,
|
|
14
|
-
import {
|
|
15
|
-
import { Height } from 'cosmjs-types/ibc/core/client/v1/client';
|
|
12
|
+
import { SigningCosmWasmClient, InstantiateOptions, CosmWasmClient, ExecuteResult, InstantiateResult, SigningCosmWasmClientOptions } from '@cosmjs/cosmwasm-stargate';
|
|
13
|
+
import { StdFee, SigningStargateClient, DeliverTxResponse, QueryClient as QueryClient$1, StakingExtension, StargateClient, SigningStargateClientOptions } from '@cosmjs/stargate';
|
|
16
14
|
import { BondStatusString } from '@cosmjs/stargate/build/modules/staking/queries';
|
|
17
|
-
import {
|
|
18
|
-
import { ReactNode, FC } from 'react';
|
|
15
|
+
import { FC, ReactNode } from 'react';
|
|
19
16
|
|
|
20
17
|
type Dictionary<T = string> = Record<string, T>;
|
|
21
18
|
type Maybe<T> = T | undefined;
|
|
@@ -42,11 +39,12 @@ declare enum WalletType {
|
|
|
42
39
|
CACTUSCOSMOS = "cactuscosmos"
|
|
43
40
|
}
|
|
44
41
|
declare const WALLET_TYPES: WalletType[];
|
|
45
|
-
type Wallet = Pick<Keplr, "enable" | "
|
|
42
|
+
type Wallet = Pick<Keplr, "enable" | "signAmino"> & {
|
|
46
43
|
experimentalSuggestChain: (chainInfo: Omit<ChainInfo, "nodeProvider">) => Promise<void>;
|
|
47
44
|
signArbitrary?: Keplr["signArbitrary"];
|
|
48
45
|
signDirect: (...args: SignDirectParams) => Promise<DirectSignResponse>;
|
|
49
46
|
getOfflineSigner: (chainId: string, signOptions?: KeplrSignOptions) => OfflineAminoSigner & OfflineDirectSigner;
|
|
47
|
+
getOfflineSignerOnlyAmino: (chainId: string, signOptions?: KeplrSignOptions) => OfflineAminoSigner;
|
|
50
48
|
getOfflineSignerAuto: (chainId: string, signOptions?: KeplrSignOptions) => Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
|
51
49
|
subscription?: (reconnect: () => void) => () => void;
|
|
52
50
|
init?: () => Promise<unknown>;
|
|
@@ -93,9 +91,9 @@ type ReconnectArgs = Maybe<{
|
|
|
93
91
|
}>;
|
|
94
92
|
declare const reconnect: (args?: ReconnectArgs) => Promise<ConnectResult | undefined>;
|
|
95
93
|
interface OfflineSigners {
|
|
96
|
-
offlineSigner: OfflineAminoSigner
|
|
97
|
-
offlineSignerAmino: OfflineAminoSigner
|
|
98
|
-
offlineSignerAuto: OfflineAminoSigner
|
|
94
|
+
offlineSigner: OfflineAminoSigner & OfflineDirectSigner;
|
|
95
|
+
offlineSignerAmino: OfflineAminoSigner;
|
|
96
|
+
offlineSignerAuto: OfflineAminoSigner | OfflineDirectSigner;
|
|
99
97
|
}
|
|
100
98
|
declare const getOfflineSigners: (args?: {
|
|
101
99
|
walletType?: WalletType;
|
|
@@ -243,9 +241,10 @@ interface ParaWallet {
|
|
|
243
241
|
}
|
|
244
242
|
/**
|
|
245
243
|
* Event callbacks for Para wallet connector lifecycle events
|
|
246
|
-
* Extracted from @getpara/graz-connector ParaGrazConfig
|
|
247
244
|
*/
|
|
248
|
-
|
|
245
|
+
interface ParaGrazConnectorEvents {
|
|
246
|
+
onEnabled?: (chainIds: string[], connector: ParaGrazConnector) => void;
|
|
247
|
+
}
|
|
249
248
|
/**
|
|
250
249
|
* Modal props for Para wallet UI
|
|
251
250
|
* Compatible with ParaModalProps from @getpara/react-sdk-lite
|
|
@@ -296,7 +295,19 @@ interface ParaGrazConfig {
|
|
|
296
295
|
* Should match the client used in your app's QueryClientProvider
|
|
297
296
|
* Only needed when using @getpara/graz-integration with modal support
|
|
298
297
|
*/
|
|
299
|
-
queryClient?:
|
|
298
|
+
queryClient?: QueryClient;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Para wallet connector interface
|
|
302
|
+
*
|
|
303
|
+
* Structural contract for the connector instance provided by
|
|
304
|
+
* @getpara/graz-integration. Defined here so graz's published types stay
|
|
305
|
+
* self-contained and do not pin a specific @getpara/graz-connector install.
|
|
306
|
+
*/
|
|
307
|
+
interface ParaGrazConnector extends Pick<Wallet, "enable" | "getKey" | "getOfflineSigner" | "getOfflineSignerOnlyAmino" | "getOfflineSignerAuto" | "signAmino" | "signDirect"> {
|
|
308
|
+
disconnect: () => Promise<void>;
|
|
309
|
+
getParaWebClient: () => ParaWeb;
|
|
310
|
+
signArbitrary: (chainId: string, signer: string, data: string | Uint8Array) => Promise<StdSignature>;
|
|
300
311
|
}
|
|
301
312
|
|
|
302
313
|
interface ChainConfig {
|
|
@@ -393,6 +404,10 @@ interface ConfigureGrazArgs {
|
|
|
393
404
|
}
|
|
394
405
|
declare const configureGraz: (args: ConfigureGrazArgs) => ConfigureGrazArgs;
|
|
395
406
|
|
|
407
|
+
interface Height {
|
|
408
|
+
revisionNumber: bigint;
|
|
409
|
+
revisionHeight: bigint;
|
|
410
|
+
}
|
|
396
411
|
interface SendTokensArgs {
|
|
397
412
|
signingClient?: SigningStargateClient | SigningCosmWasmClient;
|
|
398
413
|
senderAddress?: string;
|
|
@@ -1010,8 +1025,9 @@ declare function useOfflineSigners(args?: Record<string, never>): UseMultiChainQ
|
|
|
1010
1025
|
declare const useBalanceStaked: (args: {
|
|
1011
1026
|
bech32Address: string;
|
|
1012
1027
|
chainId: string;
|
|
1013
|
-
} & QueryConfig) => UseQueryResult<Coin, unknown>;
|
|
1028
|
+
} & QueryConfig) => UseQueryResult<Coin | null, unknown>;
|
|
1014
1029
|
|
|
1030
|
+
type QueryValidatorsResponse = Awaited<ReturnType<StakingExtension["staking"]["validators"]>>;
|
|
1015
1031
|
/**
|
|
1016
1032
|
* graz hook to retrieve connected account's active chainIds
|
|
1017
1033
|
*
|
|
@@ -1095,7 +1111,7 @@ declare const useActiveChainCurrency: ({ denom }: {
|
|
|
1095
1111
|
* const { data: response, ... } = useActiveChainValidators(queryClient);
|
|
1096
1112
|
* ```
|
|
1097
1113
|
*/
|
|
1098
|
-
declare const useQueryClientValidators: <T extends QueryClient & StakingExtension>(args: {
|
|
1114
|
+
declare const useQueryClientValidators: <T extends QueryClient$1 & StakingExtension>(args: {
|
|
1099
1115
|
queryClient: T | undefined;
|
|
1100
1116
|
status?: BondStatusString;
|
|
1101
1117
|
}) => UseQueryResult<QueryValidatorsResponse>;
|
|
@@ -1908,4 +1924,4 @@ declare const useGrazEvents: () => null;
|
|
|
1908
1924
|
*/
|
|
1909
1925
|
declare const GrazEvents: FC;
|
|
1910
1926
|
|
|
1911
|
-
export { type ActionChainId, type AddChainArgs, type CactusCosmosWallet, type ConfigureGrazArgs, type ConnectArgs, type ConnectResult, type Dictionary, type ErrorReporter, type ExecuteContractArgs, type ExecuteContractMutationArgs, GrazEvents, GrazProvider, type GrazProviderProps, type InstantiateContractArgs, type InstantiateContractMutationArgs, type Key, type KnownKeys, LOG_CATEGORIES, LOG_FUNCTIONS, LOG_HOOKS, LogCategory, LogLevel, type Logger, type LoggerOptions, type Maybe, type OfflineSigners, type ParaGrazConfig, type ParaGrazConnectorEvents, type ParaModalProps, type ParaWallet, type ReconnectArgs, type SendIbcTokensArgs, type SendTokensArgs, type SignAminoParams, type SignDirectParams, type SignDoc, type SuggestChainAndConnectArgs, type SuggestChainArgs, type UseAccountArgs, type UseAccountResult, type UseAddChainArgs, type UseConnectChainArgs, type UseExecuteContractArgs, type UseInstantiateContractArgs, type UseSuggestChainAndConnectArgs, type UseSuggestChainArgs, WALLET_TYPES, type Wallet, WalletType, addChain, checkWallet, clearRecentChain, clearSession, configureGraz, configureLogger, connect, defineChainInfo, defineChains, disconnect, executeContract, getAvailableWallets, getCactusCosmos, getChainInfo, getChainInfos, getCosmostation, getKeplr, getLeap, getLogger, getMetamaskSnapLeap, getOfflineSigners, getOkx, getPara, getQueryRaw, getQuerySmart, getRecentChainIds, getRecentChains, getVectis, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, instantiateContract, isLeapDappBrowser, isLeapSnaps, isPara, isWalletConnect, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, useAccount, useActiveChainCurrency, useActiveChainIds, useActiveChains, useActiveWalletType, useAddChain, useBalance, useBalanceStaked, useBalances, useChainInfo, useChainInfos, useCheckWallet, useConnect, useCosmWasmClient, useCosmWasmSigningClient, useDisconnect, useExecuteContract, useGrazEvents, useInstantiateContract, useOfflineSigners, useQueryClientValidators, useQueryRaw, useQuerySmart, useRecentChainIds, useRecentChains, useSendIbcTokens, useSendTokens, useStargateClient, useStargateSigningClient, useSuggestChain, useSuggestChainAndConnect };
|
|
1927
|
+
export { type ActionChainId, type AddChainArgs, type CactusCosmosWallet, type ConfigureGrazArgs, type ConnectArgs, type ConnectResult, type Dictionary, type ErrorReporter, type ExecuteContractArgs, type ExecuteContractMutationArgs, GrazEvents, GrazProvider, type GrazProviderProps, type Height, type InstantiateContractArgs, type InstantiateContractMutationArgs, type Key, type KnownKeys, LOG_CATEGORIES, LOG_FUNCTIONS, LOG_HOOKS, LogCategory, LogLevel, type Logger, type LoggerOptions, type Maybe, type OfflineSigners, type ParaGrazConfig, type ParaGrazConnector, type ParaGrazConnectorEvents, type ParaModalProps, type ParaWallet, type ReconnectArgs, type SendIbcTokensArgs, type SendTokensArgs, type SignAminoParams, type SignDirectParams, type SignDoc, type SuggestChainAndConnectArgs, type SuggestChainArgs, type UseAccountArgs, type UseAccountResult, type UseAddChainArgs, type UseConnectChainArgs, type UseExecuteContractArgs, type UseInstantiateContractArgs, type UseSuggestChainAndConnectArgs, type UseSuggestChainArgs, WALLET_TYPES, type Wallet, WalletType, addChain, checkWallet, clearRecentChain, clearSession, configureGraz, configureLogger, connect, defineChainInfo, defineChains, disconnect, executeContract, getAvailableWallets, getCactusCosmos, getChainInfo, getChainInfos, getCosmostation, getKeplr, getLeap, getLogger, getMetamaskSnapLeap, getOfflineSigners, getOkx, getPara, getQueryRaw, getQuerySmart, getRecentChainIds, getRecentChains, getVectis, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, instantiateContract, isLeapDappBrowser, isLeapSnaps, isPara, isWalletConnect, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, useAccount, useActiveChainCurrency, useActiveChainIds, useActiveChains, useActiveWalletType, useAddChain, useBalance, useBalanceStaked, useBalances, useChainInfo, useChainInfos, useCheckWallet, useConnect, useCosmWasmClient, useCosmWasmSigningClient, useDisconnect, useExecuteContract, useGrazEvents, useInstantiateContract, useOfflineSigners, useQueryClientValidators, useQueryRaw, useQuerySmart, useRecentChainIds, useRecentChains, useSendIbcTokens, useSendTokens, useStargateClient, useStargateSigningClient, useSuggestChain, useSuggestChainAndConnect };
|