graz 0.4.1 → 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 +230 -21
- package/dist/index.d.ts +230 -21
- 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;
|
|
@@ -127,6 +125,92 @@ interface SuggestChainAndConnectArgs {
|
|
|
127
125
|
}
|
|
128
126
|
declare const suggestChainAndConnect: (args: SuggestChainAndConnectArgs) => Promise<ConnectResult>;
|
|
129
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Logger types and interfaces for Graz
|
|
130
|
+
*/
|
|
131
|
+
declare enum LogLevel {
|
|
132
|
+
ERROR = 0,
|
|
133
|
+
WARN = 1,
|
|
134
|
+
INFO = 2,
|
|
135
|
+
DEBUG = 3,
|
|
136
|
+
TRACE = 4
|
|
137
|
+
}
|
|
138
|
+
declare enum LogCategory {
|
|
139
|
+
WALLET = "wallet",// Wallet connections, disconnections
|
|
140
|
+
TRANSACTION = "transaction",// Transaction signing and broadcasting
|
|
141
|
+
QUERY = "query",// Blockchain queries
|
|
142
|
+
STORE = "store",// State management
|
|
143
|
+
MULTICHAIN = "multichain",// Multi-chain operations
|
|
144
|
+
EVENT = "event",// Wallet events
|
|
145
|
+
PERFORMANCE = "performance"
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Error reporter interface for integration with error tracking services
|
|
149
|
+
* (e.g., Sentry, custom error tracking)
|
|
150
|
+
*/
|
|
151
|
+
interface ErrorReporter {
|
|
152
|
+
captureException: (error: Error, context?: {
|
|
153
|
+
category?: string;
|
|
154
|
+
context?: Record<string, unknown>;
|
|
155
|
+
}) => void;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Logger configuration options
|
|
159
|
+
*/
|
|
160
|
+
interface LoggerOptions {
|
|
161
|
+
/**
|
|
162
|
+
* Enable/disable logging
|
|
163
|
+
* @default true in development, false in production
|
|
164
|
+
*/
|
|
165
|
+
enabled?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Log level configuration:
|
|
168
|
+
* - Single LogLevel: Minimum level (e.g., LogLevel.INFO logs INFO, WARN, ERROR)
|
|
169
|
+
* - Array of LogLevel: Only log these specific levels
|
|
170
|
+
* - undefined/not specified: Log all levels
|
|
171
|
+
* @default undefined (all levels)
|
|
172
|
+
*/
|
|
173
|
+
level?: LogLevel | LogLevel[];
|
|
174
|
+
/**
|
|
175
|
+
* Categories to log:
|
|
176
|
+
* - Array of categories: Only log these specific categories
|
|
177
|
+
* - Empty array or undefined: Log all categories
|
|
178
|
+
* @default undefined (all categories)
|
|
179
|
+
*/
|
|
180
|
+
categories?: (keyof typeof LogCategory)[];
|
|
181
|
+
/**
|
|
182
|
+
* Optional error reporter for error tracking integration
|
|
183
|
+
*/
|
|
184
|
+
errorReporter?: ErrorReporter;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Logger interface
|
|
188
|
+
*/
|
|
189
|
+
interface Logger {
|
|
190
|
+
error(category: LogCategory, message: string, context?: Record<string, unknown>): void;
|
|
191
|
+
warn(category: LogCategory, message: string, context?: Record<string, unknown>): void;
|
|
192
|
+
info(category: LogCategory, message: string, context?: Record<string, unknown>): void;
|
|
193
|
+
debug(category: LogCategory, message: string, context?: Record<string, unknown>): void;
|
|
194
|
+
trace(category: LogCategory, message: string, context?: Record<string, unknown>): void;
|
|
195
|
+
time(label: string): void;
|
|
196
|
+
timeEnd(label: string): void;
|
|
197
|
+
group(label: string): void;
|
|
198
|
+
groupEnd(): void;
|
|
199
|
+
setLevel(level: LogLevel | LogLevel[] | undefined): void;
|
|
200
|
+
setCategories(categories: (keyof typeof LogCategory)[] | undefined): void;
|
|
201
|
+
enable(): void;
|
|
202
|
+
disable(): void;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Global window extensions for Graz debugging
|
|
206
|
+
*/
|
|
207
|
+
declare global {
|
|
208
|
+
interface Window {
|
|
209
|
+
__GRAZ_DEBUG__?: boolean;
|
|
210
|
+
grazErrorReporter?: ErrorReporter;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
130
214
|
/**
|
|
131
215
|
* Para wallet entity (compatible with Wallet from @getpara/core-sdk)
|
|
132
216
|
* Represents a wallet within the Para ecosystem (different from Graz Wallet)
|
|
@@ -157,9 +241,10 @@ interface ParaWallet {
|
|
|
157
241
|
}
|
|
158
242
|
/**
|
|
159
243
|
* Event callbacks for Para wallet connector lifecycle events
|
|
160
|
-
* Extracted from @getpara/graz-connector ParaGrazConfig
|
|
161
244
|
*/
|
|
162
|
-
|
|
245
|
+
interface ParaGrazConnectorEvents {
|
|
246
|
+
onEnabled?: (chainIds: string[], connector: ParaGrazConnector) => void;
|
|
247
|
+
}
|
|
163
248
|
/**
|
|
164
249
|
* Modal props for Para wallet UI
|
|
165
250
|
* Compatible with ParaModalProps from @getpara/react-sdk-lite
|
|
@@ -210,7 +295,19 @@ interface ParaGrazConfig {
|
|
|
210
295
|
* Should match the client used in your app's QueryClientProvider
|
|
211
296
|
* Only needed when using @getpara/graz-integration with modal support
|
|
212
297
|
*/
|
|
213
|
-
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>;
|
|
214
311
|
}
|
|
215
312
|
|
|
216
313
|
interface ChainConfig {
|
|
@@ -258,6 +355,14 @@ interface GrazInternalStore {
|
|
|
258
355
|
* Interval in milliseconds to ping the wallet.
|
|
259
356
|
*/
|
|
260
357
|
pingInterval: number;
|
|
358
|
+
/**
|
|
359
|
+
* Logger configuration
|
|
360
|
+
*/
|
|
361
|
+
loggerConfig: {
|
|
362
|
+
enabled: boolean;
|
|
363
|
+
level?: LogLevel | LogLevel[];
|
|
364
|
+
categories?: (keyof typeof LogCategory)[];
|
|
365
|
+
} | null;
|
|
261
366
|
_notFoundFn: () => void;
|
|
262
367
|
_reconnect: boolean;
|
|
263
368
|
_reconnectConnector: WalletType | null;
|
|
@@ -288,9 +393,21 @@ interface ConfigureGrazArgs {
|
|
|
288
393
|
*/
|
|
289
394
|
iframeOptions?: IframeOptions;
|
|
290
395
|
pingInteval?: number;
|
|
396
|
+
/**
|
|
397
|
+
* Logger configuration
|
|
398
|
+
*/
|
|
399
|
+
logger?: {
|
|
400
|
+
enabled?: boolean;
|
|
401
|
+
level?: LogLevel | LogLevel[] | undefined;
|
|
402
|
+
categories?: (keyof typeof LogCategory)[] | undefined;
|
|
403
|
+
};
|
|
291
404
|
}
|
|
292
405
|
declare const configureGraz: (args: ConfigureGrazArgs) => ConfigureGrazArgs;
|
|
293
406
|
|
|
407
|
+
interface Height {
|
|
408
|
+
revisionNumber: bigint;
|
|
409
|
+
revisionHeight: bigint;
|
|
410
|
+
}
|
|
294
411
|
interface SendTokensArgs {
|
|
295
412
|
signingClient?: SigningStargateClient | SigningCosmWasmClient;
|
|
296
413
|
senderAddress?: string;
|
|
@@ -374,6 +491,88 @@ declare const isLeapDappBrowser: () => boolean;
|
|
|
374
491
|
declare const isWalletConnect: (type: WalletType) => boolean;
|
|
375
492
|
declare const isPara: (type: WalletType) => type is WalletType.PARA;
|
|
376
493
|
|
|
494
|
+
/**
|
|
495
|
+
* Logger Categories
|
|
496
|
+
* Used for categorizing logs throughout the Graz library
|
|
497
|
+
*/
|
|
498
|
+
declare const LOG_CATEGORIES: {
|
|
499
|
+
/** Wallet connections, disconnections, and adapter operations */
|
|
500
|
+
readonly WALLET: "wallet";
|
|
501
|
+
/** Transaction signing and broadcasting */
|
|
502
|
+
readonly TRANSACTION: "transaction";
|
|
503
|
+
/** Blockchain queries (balance, contract queries, etc.) */
|
|
504
|
+
readonly QUERY: "query";
|
|
505
|
+
/** State management operations (store updates) */
|
|
506
|
+
readonly STORE: "store";
|
|
507
|
+
/** Multi-chain parallel operations */
|
|
508
|
+
readonly MULTICHAIN: "multichain";
|
|
509
|
+
/** Wallet events and listeners */
|
|
510
|
+
readonly EVENT: "event";
|
|
511
|
+
/** Performance metrics and timing */
|
|
512
|
+
readonly PERFORMANCE: "performance";
|
|
513
|
+
};
|
|
514
|
+
/**
|
|
515
|
+
* Logger Function Names
|
|
516
|
+
* Action/method function names used in logging context
|
|
517
|
+
*/
|
|
518
|
+
declare const LOG_FUNCTIONS: {
|
|
519
|
+
readonly CONNECT: "connect";
|
|
520
|
+
readonly DISCONNECT: "disconnect";
|
|
521
|
+
readonly RECONNECT: "reconnect";
|
|
522
|
+
readonly GET_WALLET: "getWallet";
|
|
523
|
+
readonly CLEAR_RECENT_CHAIN: "clearRecentChain";
|
|
524
|
+
readonly GET_RECENT_CHAIN_IDS: "getRecentChainIds";
|
|
525
|
+
readonly GET_RECENT_CHAINS: "getRecentChains";
|
|
526
|
+
readonly GET_CHAIN_INFO: "getChainInfo";
|
|
527
|
+
readonly GET_CHAIN_INFOS: "getChainInfos";
|
|
528
|
+
readonly ADD_CHAIN: "addChain";
|
|
529
|
+
readonly SUGGEST_CHAIN: "suggestChain";
|
|
530
|
+
readonly SUGGEST_CHAIN_AND_CONNECT: "suggestChainAndConnect";
|
|
531
|
+
readonly SEND_TOKENS: "sendTokens";
|
|
532
|
+
readonly SEND_IBC_TOKENS: "sendIbcTokens";
|
|
533
|
+
readonly INSTANTIATE_CONTRACT: "instantiateContract";
|
|
534
|
+
readonly EXECUTE_CONTRACT: "executeContract";
|
|
535
|
+
readonly GET_QUERY_SMART: "getQuerySmart";
|
|
536
|
+
readonly GET_QUERY_RAW: "getQueryRaw";
|
|
537
|
+
readonly CREATE_MULTI_CHAIN_ASYNC_FUNCTION: "createMultiChainAsyncFunction";
|
|
538
|
+
readonly HANDLE_FOCUS: "handleFocus";
|
|
539
|
+
readonly AUTO_CONNECT_IFRAME: "autoConnectIframe";
|
|
540
|
+
readonly RECONNECT_EFFECT: "reconnectEffect";
|
|
541
|
+
readonly SUBSCRIPTION: "subscription";
|
|
542
|
+
};
|
|
543
|
+
/**
|
|
544
|
+
* Logger Hook Names
|
|
545
|
+
* React hook names used in logging context
|
|
546
|
+
*/
|
|
547
|
+
declare const LOG_HOOKS: {
|
|
548
|
+
readonly USE_CONNECT: "useConnect";
|
|
549
|
+
readonly USE_DISCONNECT: "useDisconnect";
|
|
550
|
+
readonly USE_CHECK_WALLET: "useCheckWallet";
|
|
551
|
+
readonly USE_ADD_CHAIN: "useAddChain";
|
|
552
|
+
readonly USE_SUGGEST_CHAIN: "useSuggestChain";
|
|
553
|
+
readonly USE_SUGGEST_CHAIN_AND_CONNECT: "useSuggestChainAndConnect";
|
|
554
|
+
readonly USE_STARGATE_CLIENT: "useStargateClient";
|
|
555
|
+
readonly USE_COSMWASM_CLIENT: "useCosmWasmClient";
|
|
556
|
+
readonly USE_STARGATE_SIGNING_CLIENT: "useStargateSigningClient";
|
|
557
|
+
readonly USE_COSMWASM_SIGNING_CLIENT: "useCosmWasmSigningClient";
|
|
558
|
+
readonly USE_SEND_TOKENS: "useSendTokens";
|
|
559
|
+
readonly USE_SEND_IBC_TOKENS: "useSendIbcTokens";
|
|
560
|
+
readonly USE_INSTANTIATE_CONTRACT: "useInstantiateContract";
|
|
561
|
+
readonly USE_EXECUTE_CONTRACT: "useExecuteContract";
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Get the singleton logger instance
|
|
566
|
+
* @returns Logger instance
|
|
567
|
+
*/
|
|
568
|
+
declare const getLogger: () => Logger;
|
|
569
|
+
/**
|
|
570
|
+
* Configure the logger with custom options
|
|
571
|
+
* This will recreate the logger instance with new options
|
|
572
|
+
* @param options Logger configuration options
|
|
573
|
+
*/
|
|
574
|
+
declare const configureLogger: (options: LoggerOptions) => void;
|
|
575
|
+
|
|
377
576
|
type CactusCosmosWallet = Pick<Keplr, "enable" | "getOfflineSigner" | "signDirect" | "signAmino" | "signArbitrary" | "getKey">;
|
|
378
577
|
declare const getCactusCosmos: () => Wallet;
|
|
379
578
|
|
|
@@ -801,7 +1000,7 @@ declare const useDisconnect: ({ onError, onLoading, onSuccess }?: MutationEventA
|
|
|
801
1000
|
declare function useOfflineSigners<const TChainIds extends readonly string[]>(args: {
|
|
802
1001
|
chainId: TChainIds;
|
|
803
1002
|
}): UseMultiChainQueryResult<TChainIds, OfflineSigners>;
|
|
804
|
-
declare function useOfflineSigners(args?:
|
|
1003
|
+
declare function useOfflineSigners(args?: Record<string, never>): UseMultiChainQueryResult<undefined, OfflineSigners>;
|
|
805
1004
|
/**
|
|
806
1005
|
* graz query hook to retrieve staked balance for a specific chain and address.
|
|
807
1006
|
*
|
|
@@ -826,8 +1025,9 @@ declare function useOfflineSigners(args?: {}): UseMultiChainQueryResult<undefine
|
|
|
826
1025
|
declare const useBalanceStaked: (args: {
|
|
827
1026
|
bech32Address: string;
|
|
828
1027
|
chainId: string;
|
|
829
|
-
} & QueryConfig) => UseQueryResult<Coin, unknown>;
|
|
1028
|
+
} & QueryConfig) => UseQueryResult<Coin | null, unknown>;
|
|
830
1029
|
|
|
1030
|
+
type QueryValidatorsResponse = Awaited<ReturnType<StakingExtension["staking"]["validators"]>>;
|
|
831
1031
|
/**
|
|
832
1032
|
* graz hook to retrieve connected account's active chainIds
|
|
833
1033
|
*
|
|
@@ -911,7 +1111,7 @@ declare const useActiveChainCurrency: ({ denom }: {
|
|
|
911
1111
|
* const { data: response, ... } = useActiveChainValidators(queryClient);
|
|
912
1112
|
* ```
|
|
913
1113
|
*/
|
|
914
|
-
declare const useQueryClientValidators: <T extends QueryClient & StakingExtension>(args: {
|
|
1114
|
+
declare const useQueryClientValidators: <T extends QueryClient$1 & StakingExtension>(args: {
|
|
915
1115
|
queryClient: T | undefined;
|
|
916
1116
|
status?: BondStatusString;
|
|
917
1117
|
}) => UseQueryResult<QueryValidatorsResponse>;
|
|
@@ -1686,11 +1886,20 @@ interface GrazProviderProps {
|
|
|
1686
1886
|
* Graz uses `@tanstack/react-query`'s features under the hood, hence you need to wrap `GrazProvider` with `QueryClientProvider`.
|
|
1687
1887
|
* @example
|
|
1688
1888
|
* ```tsx
|
|
1889
|
+
* import { GrazProvider, LogLevel } from "graz";
|
|
1890
|
+
*
|
|
1689
1891
|
* // example next.js application in _app.tsx
|
|
1690
1892
|
* export default function CustomApp({ Component, pageProps }: AppProps) {
|
|
1691
1893
|
* return (
|
|
1692
1894
|
* <QueryClientProvider queryClient={queryClient}>
|
|
1693
|
-
* <GrazProvider grazOptions={
|
|
1895
|
+
* <GrazProvider grazOptions={{
|
|
1896
|
+
* chains: [cosmoshubChainInfo, osmosisChainInfo],
|
|
1897
|
+
* logger: {
|
|
1898
|
+
* enabled: true,
|
|
1899
|
+
* level: LogLevel.DEBUG,
|
|
1900
|
+
* categories: ['wallet', 'transaction'],
|
|
1901
|
+
* }
|
|
1902
|
+
* }}>
|
|
1694
1903
|
* <Component {...pageProps} />
|
|
1695
1904
|
* </GrazProvider>
|
|
1696
1905
|
* </QueryClientProvider>
|
|
@@ -1715,4 +1924,4 @@ declare const useGrazEvents: () => null;
|
|
|
1715
1924
|
*/
|
|
1716
1925
|
declare const GrazEvents: FC;
|
|
1717
1926
|
|
|
1718
|
-
export { type ActionChainId, type AddChainArgs, type CactusCosmosWallet, type ConfigureGrazArgs, type ConnectArgs, type ConnectResult, type Dictionary, type ExecuteContractArgs, type ExecuteContractMutationArgs, GrazEvents, GrazProvider, type GrazProviderProps, type InstantiateContractArgs, type InstantiateContractMutationArgs, type Key, type KnownKeys, 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, connect, defineChainInfo, defineChains, disconnect, executeContract, getAvailableWallets, getCactusCosmos, getChainInfo, getChainInfos, getCosmostation, getKeplr, getLeap, 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 };
|