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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';var m=require('fs/promises'),R=require('path'),url=require('url'),cosmos=require('@keplr-wallet/cosmos'),I=require('arg'),cosmosDirectoryClient=require('cosmos-directory-client'),$=require('p-map');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 m__namespace=/*#__PURE__*/_interopNamespace(m);var R__namespace=/*#__PURE__*/_interopNamespace(R);var I__default=/*#__PURE__*/_interopDefault(I);var $__default=/*#__PURE__*/_interopDefault($);var N=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href,C=N();var L=R.dirname(url.fileURLToPath(C)),M=n=>/^\d+$/.test(n),_=n=>M(n[0])?`_${n}`:n,b=`Usage: graz [options]
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
- `,r=I__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"}),v=async()=>{if(r["--help"]){console.log(b);return}if(r["--generate"]){await x();return}console.log(b);},x=async()=>{console.log("\u23F3 Generating chain list..."),r["--authz"]&&console.log("\u270D\uFE0F Detected authz flag, generating only compatible chains..."),r["--best"]&&console.log("\u{1F481}\u200D\u2642\uFE0F Detected best flag, setting REST and RPC endpoints to best latency..."),(r["--mainnet"]||r["--testnet"])&&console.log("\u{1F419} Detected chain filtering flag, generating only given chain paths...");let n,s;if(r["--endpoint"]){console.log("\u{1F310} Fetching chain information from specified endpoint");try{let e=await fetch(r["--endpoint"]);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);let o=await e.json();n=A(o.mainnet,r["--mainnet"]),s=A(o.testnet,r["--testnet"]);}catch(e){console.error(`\u274C Failed to fetch chain information: ${e.message}`),process.exit(1);}}else [n,s]=await Promise.all([S(cosmosDirectoryClient.createClient(),{filter:r["--mainnet"]}),S(cosmosDirectoryClient.createTestnetClient(),{filter:r["--testnet"]})]);let[a,d]=await Promise.all([m__namespace.readFile(u("index.js.stub"),{encoding:"utf-8"}),m__namespace.readFile(u("index.mjs.stub"),{encoding:"utf-8"})]),f=a.replace("/* REPLACE_MAINNET_DEFS */",h(n)).replace("/* REPLACE_TESTNET_DEFS */",h(s,{testnet:true})).replace("/* REPLACE_MAINNET_CHAINS */",g(n)).replace("/* REPLACE_TESTNET_CHAINS */",g(s,{testnet:true})).replace("/* REPLACE_MAINNET_CHAINS_ARRAY */",p(n)).replace("/* REPLACE_TESTNET_CHAINS_ARRAY */",p(s,{testnet:true})).replace("/* REPLACE_MAINNET_EXPORTS */",p(n)).replace("/* REPLACE_TESTNET_EXPORTS */",p(s,{testnet:true})).replace(/"(.+)":/g,"$1:").trim(),c=d.replace("/* REPLACE_MAINNET_DEFS */",h(n,{mjs:true})).replace("/* REPLACE_TESTNET_DEFS */",h(s,{mjs:true,testnet:true})).replace("/* REPLACE_MAINNET_CHAINS */",g(n)).replace("/* REPLACE_TESTNET_CHAINS */",g(s,{testnet:true})).replace("/* REPLACE_MAINNET_CHAINS_ARRAY */",p(n)).replace("/* REPLACE_TESTNET_CHAINS_ARRAY */",p(s,{testnet:true})).replace(/"(.+)":/g,"$1:").trim();await Promise.all([m__namespace.writeFile(u("index.js"),f,{encoding:"utf-8"}),m__namespace.writeFile(u("index.mjs"),c.replace('"../dist"','"../dist/index.mjs"'),{encoding:"utf-8"}),m__namespace.writeFile(u("index.ts"),c,{encoding:"utf-8"})]),console.log('\u2728 Generate complete! You can import `mainnetChains` and `testnetChains` from "graz/chains".\n');},A=(n,s)=>{if(!s)return n;let a=new Set(s.split(","));return Object.fromEntries(Object.entries(n).filter(([d])=>a.has(d)))},u=(...n)=>R__namespace.resolve(L,"../chains",...n),g=(n,{testnet:s=false}={})=>Object.keys(n).map(a=>` ${_(a)}: ${_(a)},`).join(`
18
- `),h=(n,{mjs:s=false,testnet:a=false}={})=>Object.entries(n).map(([d,f])=>{let c=`${_(d)}`,e=JSON.stringify(f,null,2);return `${s?"export ":""}const ${c} = defineChainInfo(${e});
19
- `}).join(""),p=(n,{testnet:s=false}={})=>Object.keys(n).map(a=>` ${_(a)},`).join(`
20
- `),S=async(n,{filter:s=""}={})=>{let a;if(s)a=s.split(",").map(e=>({path:e}));else try{a=(await n.fetchChains()).chains.map(({path:o})=>({path:o}));}catch(e){return console.error(`\u274C Failed to fetch chains list: ${e.message}`),{}}let f=(await $__default.default(a,async e=>{try{return (await n.fetchChain(e.path)).chain}catch(o){return console.error(`\u274C Failed to fetch chain "${e.path}": ${o.message}`),null}},{concurrency:4})).filter(e=>e!==null),c={};return f.forEach(e=>{try{if(r["--authz"]&&!e.params?.authz)return;let o=r["--best"]?e.best_apis:e.apis;if(!o||!o.rest?.[0]||!o.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 l=e.assets[0],T={coinDenom:l.denom_units[l.denom_units.length-1].denom,coinMinimalDenom:l.denom_units[0].denom,coinDecimals:l.denom_units[l.denom_units.length-1].exponent,coinGeckoId:l.coingecko_id},E=e.fees?.fee_tokens.map(t=>t.low_gas_price&&t.average_gas_price&&t.high_gas_price?{coinDenom:e.assets?.find(i=>i.denom===t.denom)?.denom_units.at(-1)?.denom||t.denom,coinMinimalDenom:e.assets?.find(i=>i.denom===t.denom)?.denom_units[0]?.denom||t.denom,coinDecimals:Number(e.assets?.find(i=>i.denom===t.denom)?.decimals),coinGeckoId:e.assets?.find(i=>i.denom===t.denom)?.coingecko_id||void 0,gasPriceStep:{low:Number(t.low_gas_price),average:Number(t.average_gas_price),high:Number(t.high_gas_price)}}:{coinDenom:e.assets?.find(i=>i.denom===t.denom)?.denom_units.at(-1)?.denom||t.denom,coinMinimalDenom:e.assets?.find(i=>i.denom===t.denom)?.denom_units[0]?.denom||t.denom,coinDecimals:Number(e.assets?.find(i=>i.denom===t.denom)?.decimals),coinGeckoId:e.assets?.find(i=>i.denom===t.denom)?.coingecko_id||void 0});if(!E)throw new Error(`\u26A0\uFE0F ${e.name} has no fee currencies, skipping codegen...`);c[e.path]={chainId:e.chain_id,currencies:e.assets.map(t=>({coinDenom:t.denom_units[t.denom_units.length-1].denom,coinMinimalDenom:t.denom_units[0].denom,coinDecimals:t.denom_units[t.denom_units.length-1].exponent,coinGeckoId:t.coingecko_id})),rest:o.rest[0].address||"",rpc:o.rpc[0].address||"",bech32Config:cosmos.Bech32Address.defaultBech32Config(e.bech32_prefix),chainName:e.chain_name,feeCurrencies:E,stakeCurrency:T,bip44:{coinType:e.slip44??0}};}catch(o){console.error(o instanceof Error?o.message:String(o));}}),c};v();
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 { Key as Key$1, Keplr, ChainInfo, KeplrSignOptions, KeplrIntereactionOptions, OfflineAminoSigner as OfflineAminoSigner$1, AppCurrency } from '@keplr-wallet/types';
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, InstantiateResult, ExecuteResult, SigningCosmWasmClientOptions } from '@cosmjs/cosmwasm-stargate';
14
- import { SigningStargateClient, StdFee, DeliverTxResponse, QueryClient, StakingExtension, StargateClient, SigningStargateClientOptions } from '@cosmjs/stargate';
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 { QueryValidatorsResponse } from 'cosmjs-types/cosmos/staking/v1beta1/query';
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" | "getOfflineSignerOnlyAmino" | "signAmino"> & {
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$1 & OfflineDirectSigner;
97
- offlineSignerAmino: OfflineAminoSigner$1;
98
- offlineSignerAuto: OfflineAminoSigner$1 | OfflineDirectSigner;
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
- type ParaGrazConnectorEvents = NonNullable<ParaGrazConfig$1["events"]>;
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?: _tanstack_react_query.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 { Key as Key$1, Keplr, ChainInfo, KeplrSignOptions, KeplrIntereactionOptions, OfflineAminoSigner as OfflineAminoSigner$1, AppCurrency } from '@keplr-wallet/types';
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, InstantiateResult, ExecuteResult, SigningCosmWasmClientOptions } from '@cosmjs/cosmwasm-stargate';
14
- import { SigningStargateClient, StdFee, DeliverTxResponse, QueryClient, StakingExtension, StargateClient, SigningStargateClientOptions } from '@cosmjs/stargate';
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 { QueryValidatorsResponse } from 'cosmjs-types/cosmos/staking/v1beta1/query';
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" | "getOfflineSignerOnlyAmino" | "signAmino"> & {
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$1 & OfflineDirectSigner;
97
- offlineSignerAmino: OfflineAminoSigner$1;
98
- offlineSignerAuto: OfflineAminoSigner$1 | OfflineDirectSigner;
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
- type ParaGrazConnectorEvents = NonNullable<ParaGrazConfig$1["events"]>;
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?: _tanstack_react_query.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 };