winnode 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WinNode
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # WinNode SDK
2
+
3
+ [![npm version](https://img.shields.io/npm/v/winnode.svg)](https://www.npmjs.com/package/winnode)
4
+ [![CI](https://github.com/winnode/sdk-cosmos/actions/workflows/ci.yml/badge.svg)](https://github.com/winnode/sdk-cosmos/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+
7
+ Transaction toolkits for Cosmos SDK and EVM chains — send, delegate, vote,
8
+ and more, with a small dependency-free `isEvmChain` helper to pick the right
9
+ toolkit for a given chain.
10
+
11
+ ## Features
12
+
13
+ - **Cosmos SDK** (`cosmosTx`) — `send`, `delegate`, `undelegate`,
14
+ `redelegate`, `vote`, `unjail`, `withdrawRewards`. Signs via any
15
+ `OfflineSigner`-compatible wallet (Keplr, Leap, etc).
16
+ - **EVM chains** (`evmTx`) — `sendNative`, `sendToken`, `writeContract`.
17
+ Signs via the injected browser wallet (MetaMask).
18
+ - **Chain-type detection** — `isEvmChain(chain)` picks which toolkit
19
+ applies based on `coin_type` / `evm_rpc`.
20
+ - Ships as CJS, ESM, and TypeScript types.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install winnode
26
+ ```
27
+
28
+ Requires Node.js 18+ and (for EVM signing) a browser environment with
29
+ MetaMask injected as `window.ethereum`.
30
+
31
+ ## Usage
32
+
33
+ ```typescript
34
+ import { isEvmChain, cosmosTx, evmTx } from 'winnode';
35
+ import type { ChainData } from 'winnode';
36
+
37
+ declare const chain: ChainData;
38
+
39
+ if (isEvmChain(chain)) {
40
+ // EVM chain
41
+ const signer = await evmTx.getBrowserSigner(chain);
42
+ const result = await evmTx.sendNative(signer, {
43
+ toAddress: '0x...',
44
+ amount: '1.5',
45
+ });
46
+ } else {
47
+ // Cosmos SDK chain
48
+ const result = await cosmosTx.send(chain, offlineSigner, {
49
+ fromAddress: 'cosmos1...',
50
+ toAddress: 'cosmos1...',
51
+ amount: '1000000',
52
+ });
53
+ }
54
+ ```
55
+
56
+ ### `ChainData`
57
+
58
+ Both toolkits take a `ChainData` describing the chain (see
59
+ [`types/chain.ts`](types/chain.ts)): `chain_name`, `chain_id`, `coin_type`,
60
+ `assets`, `rpc`, `evm_rpc`, `evm_chain_id`, and `fees.fee_tokens` (used for
61
+ Cosmos fee calculation).
62
+
63
+ ### Cosmos SDK API (`cosmosTx`)
64
+
65
+ | Function | Description |
66
+ | --- | --- |
67
+ | `send(chain, signer, params, opts?)` | `MsgSend` |
68
+ | `delegate(chain, signer, params, opts?)` | `MsgDelegate` |
69
+ | `undelegate(chain, signer, params, opts?)` | `MsgUndelegate` |
70
+ | `redelegate(chain, signer, params, opts?)` | `MsgBeginRedelegate` |
71
+ | `vote(chain, signer, params, opts?)` | `MsgVote` |
72
+ | `unjail(chain, signer, params, opts?)` | `MsgUnjail` |
73
+ | `withdrawRewards(chain, signer, params, opts?)` | `MsgWithdrawDelegatorReward` |
74
+ | `getSigningStargateClient(chain, signer)` | Cached `SigningStargateClient` |
75
+
76
+ Every function returns a `Promise<TxResult>`:
77
+ `{ success: boolean; txHash?: string; error?: string; raw?: any }`.
78
+
79
+ ### EVM API (`evmTx`)
80
+
81
+ | Function | Description |
82
+ | --- | --- |
83
+ | `sendNative(signer, params, opts?)` | Send the chain's native coin |
84
+ | `sendToken(signer, params, opts?)` | ERC-20 `transfer` |
85
+ | `writeContract(signer, address, abi, method, args?, opts?)` | Generic contract write (e.g. staking/gov precompiles) |
86
+ | `getReadProvider(chain)` | Read-only `JsonRpcProvider` |
87
+ | `getBrowserSigner(chain)` | MetaMask-backed `JsonRpcSigner`, switching chains as needed |
88
+
89
+ ## Development
90
+
91
+ ```bash
92
+ npm install # install dependencies
93
+ npm run build # build dist/ (CJS + ESM + types via tsup)
94
+ npm run typecheck # tsc --noEmit
95
+ npm run lint # eslint .
96
+ npm test # vitest run
97
+ ```
98
+
99
+ ## Releasing
100
+
101
+ Versions are bumped with `npm version`, which updates `package.json`,
102
+ commits the change, and creates a matching git tag:
103
+
104
+ ```bash
105
+ npm version patch # bug fixes: 1.0.0 -> 1.0.1
106
+ npm version minor # new features: 1.0.0 -> 1.1.0
107
+ npm version major # breaking changes: 1.0.0 -> 2.0.0
108
+ ```
109
+
110
+ Before bumping, add an entry to [CHANGELOG.md](CHANGELOG.md) describing what
111
+ changed. Push the resulting commit and tag to `main`
112
+ (`git push && git push --tags`); the `Publish to npm` workflow lints,
113
+ typechecks, tests, builds, and publishes the package automatically.
114
+
115
+ ## Staying up to date
116
+
117
+ [Dependabot](.github/dependabot.yml) opens weekly PRs to keep dependencies
118
+ (`@cosmjs/*`, `ethers`, etc.) and GitHub Actions on their latest versions.
119
+ Every dependency PR runs through the same [CI checks](.github/workflows/ci.yml)
120
+ as any other change before it can be merged.
121
+
122
+ ## Security
123
+
124
+ See [SECURITY.md](SECURITY.md) for supported versions and how to report a
125
+ vulnerability.
126
+
127
+ ## License
128
+
129
+ [MIT](LICENSE)
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
10
+ //# sourceMappingURL=chunk-J5LGTIGS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,206 @@
1
+ import { OfflineSigner, Registry } from '@cosmjs/proto-signing';
2
+ import { SigningStargateClient } from '@cosmjs/stargate';
3
+ import { JsonRpcSigner, JsonRpcProvider } from 'ethers';
4
+
5
+ interface RpcEndpoint {
6
+ address: string;
7
+ provider?: string;
8
+ tx_index?: string;
9
+ }
10
+ interface ChainAsset {
11
+ base: string;
12
+ display?: string;
13
+ symbol?: string;
14
+ denom_units?: Array<{
15
+ denom: string;
16
+ exponent: number;
17
+ }>;
18
+ }
19
+ interface FeeToken {
20
+ denom: string;
21
+ fixed_min_gas_price?: number;
22
+ low_gas_price?: number;
23
+ average_gas_price?: number;
24
+ high_gas_price?: number;
25
+ }
26
+ interface ChainFees {
27
+ fee_tokens?: FeeToken[];
28
+ }
29
+ interface ChainData {
30
+ chain_name: string;
31
+ chain_id?: string;
32
+ coin_type?: string;
33
+ assets?: ChainAsset[];
34
+ rpc?: RpcEndpoint[];
35
+ evm_rpc?: RpcEndpoint[];
36
+ evm_chain_id?: number;
37
+ fees?: ChainFees;
38
+ }
39
+
40
+ interface TxResult {
41
+ success: boolean;
42
+ txHash?: string;
43
+ error?: string;
44
+ raw?: any;
45
+ }
46
+ interface TxOptions {
47
+ memo?: string;
48
+ gasLimit?: string;
49
+ }
50
+ /**
51
+ * A chain is treated as EVM when it declares evm_rpc endpoints or its
52
+ * coin_type is 60 (Ethereum's SLIP-44 index) — same heuristic used across
53
+ * the rest of the app (see lib/keplr.ts isEvmChain checks).
54
+ */
55
+ declare function isEvmChain(chain: ChainData): boolean;
56
+
57
+ interface SendParams {
58
+ fromAddress: string;
59
+ toAddress: string;
60
+ amount: string;
61
+ denom?: string;
62
+ }
63
+ interface DelegateParams {
64
+ delegatorAddress: string;
65
+ validatorAddress: string;
66
+ amount: string;
67
+ denom?: string;
68
+ }
69
+ interface UndelegateParams extends DelegateParams {
70
+ }
71
+ interface RedelegateParams {
72
+ delegatorAddress: string;
73
+ validatorSrcAddress: string;
74
+ validatorDstAddress: string;
75
+ amount: string;
76
+ denom?: string;
77
+ }
78
+ /** 1 = Yes, 2 = Abstain, 3 = No, 4 = NoWithVeto */
79
+ type VoteOption = 1 | 2 | 3 | 4;
80
+ interface VoteParams {
81
+ voterAddress: string;
82
+ proposalId: string;
83
+ option: VoteOption;
84
+ }
85
+ interface UnjailParams {
86
+ senderAddress: string;
87
+ validatorAddress: string;
88
+ }
89
+ interface WithdrawRewardsParams {
90
+ delegatorAddress: string;
91
+ validatorAddress: string;
92
+ }
93
+ declare function send(chain: ChainData, signer: OfflineSigner, params: SendParams, opts?: TxOptions): Promise<TxResult>;
94
+ declare function delegate(chain: ChainData, signer: OfflineSigner, params: DelegateParams, opts?: TxOptions): Promise<TxResult>;
95
+ declare function undelegate(chain: ChainData, signer: OfflineSigner, params: UndelegateParams, opts?: TxOptions): Promise<TxResult>;
96
+ declare function redelegate(chain: ChainData, signer: OfflineSigner, params: RedelegateParams, opts?: TxOptions): Promise<TxResult>;
97
+ declare function vote(chain: ChainData, signer: OfflineSigner, params: VoteParams, opts?: TxOptions): Promise<TxResult>;
98
+ declare function unjail(chain: ChainData, signer: OfflineSigner, params: UnjailParams, opts?: TxOptions): Promise<TxResult>;
99
+ declare function withdrawRewards(chain: ChainData, signer: OfflineSigner, params: WithdrawRewardsParams, opts?: TxOptions): Promise<TxResult>;
100
+
101
+ /**
102
+ * Connects a SigningStargateClient for the given chain using any
103
+ * OfflineSigner-compatible wallet (Keplr's getOfflineSignerAuto/getOfflineSigner,
104
+ * Leap, etc). Clients are cached per rpc+address so repeated calls in the
105
+ * same session reuse the open connection.
106
+ */
107
+ declare function getSigningStargateClient(chain: ChainData, signer: OfflineSigner): Promise<SigningStargateClient>;
108
+ declare function clearCosmosClientCache(): void;
109
+
110
+ /**
111
+ * @cosmjs/stargate's defaultRegistryTypes already covers MsgSend, MsgDelegate,
112
+ * MsgUndelegate, MsgBeginRedelegate, MsgVote and MsgWithdrawDelegatorReward.
113
+ * MsgUnjail is the only staking-adjacent message missing from it.
114
+ */
115
+ declare function createCosmosRegistry(): Registry;
116
+
117
+ declare function getPrimaryDenom(chain: ChainData): string;
118
+ /**
119
+ * Delegates to the app's existing, battle-tested fee calculation
120
+ * (gas_price / fee_tokens / exponent-based fallbacks, PaxiHub minimums, etc.)
121
+ * so every SDK tx uses the same fee logic as the rest of the explorer.
122
+ */
123
+ declare function buildFee(chain: ChainData, gasLimit: string): Promise<{
124
+ amount: Array<{
125
+ denom: string;
126
+ amount: string;
127
+ }>;
128
+ gas: string;
129
+ }>;
130
+ /**
131
+ * Picks the RPC endpoint with tx_index enabled when available, otherwise
132
+ * falls back to the first configured endpoint.
133
+ */
134
+ declare function pickRpcEndpoint(chain: ChainData): string;
135
+
136
+ type index$1_DelegateParams = DelegateParams;
137
+ type index$1_RedelegateParams = RedelegateParams;
138
+ type index$1_SendParams = SendParams;
139
+ type index$1_UndelegateParams = UndelegateParams;
140
+ type index$1_UnjailParams = UnjailParams;
141
+ type index$1_VoteOption = VoteOption;
142
+ type index$1_VoteParams = VoteParams;
143
+ type index$1_WithdrawRewardsParams = WithdrawRewardsParams;
144
+ declare const index$1_buildFee: typeof buildFee;
145
+ declare const index$1_clearCosmosClientCache: typeof clearCosmosClientCache;
146
+ declare const index$1_createCosmosRegistry: typeof createCosmosRegistry;
147
+ declare const index$1_delegate: typeof delegate;
148
+ declare const index$1_getPrimaryDenom: typeof getPrimaryDenom;
149
+ declare const index$1_getSigningStargateClient: typeof getSigningStargateClient;
150
+ declare const index$1_pickRpcEndpoint: typeof pickRpcEndpoint;
151
+ declare const index$1_redelegate: typeof redelegate;
152
+ declare const index$1_send: typeof send;
153
+ declare const index$1_undelegate: typeof undelegate;
154
+ declare const index$1_unjail: typeof unjail;
155
+ declare const index$1_vote: typeof vote;
156
+ declare const index$1_withdrawRewards: typeof withdrawRewards;
157
+ declare namespace index$1 {
158
+ export { type index$1_DelegateParams as DelegateParams, type index$1_RedelegateParams as RedelegateParams, type index$1_SendParams as SendParams, type index$1_UndelegateParams as UndelegateParams, type index$1_UnjailParams as UnjailParams, type index$1_VoteOption as VoteOption, type index$1_VoteParams as VoteParams, type index$1_WithdrawRewardsParams as WithdrawRewardsParams, index$1_buildFee as buildFee, index$1_clearCosmosClientCache as clearCosmosClientCache, index$1_createCosmosRegistry as createCosmosRegistry, index$1_delegate as delegate, index$1_getPrimaryDenom as getPrimaryDenom, index$1_getSigningStargateClient as getSigningStargateClient, index$1_pickRpcEndpoint as pickRpcEndpoint, index$1_redelegate as redelegate, index$1_send as send, index$1_undelegate as undelegate, index$1_unjail as unjail, index$1_vote as vote, index$1_withdrawRewards as withdrawRewards };
159
+ }
160
+
161
+ interface SendNativeParams {
162
+ toAddress: string;
163
+ amount: string;
164
+ decimals?: number;
165
+ }
166
+ interface SendTokenParams {
167
+ tokenAddress: string;
168
+ toAddress: string;
169
+ amount: string;
170
+ decimals?: number;
171
+ }
172
+ /** Sends the chain's native coin (e.g. MON on Monad). */
173
+ declare function sendNative(signer: JsonRpcSigner, params: SendNativeParams, opts?: TxOptions): Promise<TxResult>;
174
+ /** Sends an ERC-20 token via its standard `transfer` method. */
175
+ declare function sendToken(signer: JsonRpcSigner, params: SendTokenParams, opts?: TxOptions): Promise<TxResult>;
176
+ /**
177
+ * Generic contract write, for chains that expose staking/governance actions
178
+ * (delegate, undelegate, vote, unjail) through a contract or precompile
179
+ * rather than a native Cosmos message — e.g. Cosmos-EVM staking/gov
180
+ * precompiles. Pass the ABI fragment for the single method being called.
181
+ */
182
+ declare function writeContract(signer: JsonRpcSigner, contractAddress: string, abiFragment: string[], method: string, args?: any[], opts?: TxOptions): Promise<TxResult>;
183
+
184
+ /**
185
+ * Read-only provider for the chain's EVM RPC (falls back to the Tendermint
186
+ * rpc list for chains that only expose one endpoint set).
187
+ */
188
+ declare function getReadProvider(chain: ChainData): JsonRpcProvider;
189
+ /**
190
+ * Signer backed by the injected wallet (MetaMask). Ensures the wallet is
191
+ * switched to the requested chain before returning the signer.
192
+ */
193
+ declare function getBrowserSigner(chain: ChainData): Promise<JsonRpcSigner>;
194
+
195
+ type index_SendNativeParams = SendNativeParams;
196
+ type index_SendTokenParams = SendTokenParams;
197
+ declare const index_getBrowserSigner: typeof getBrowserSigner;
198
+ declare const index_getReadProvider: typeof getReadProvider;
199
+ declare const index_sendNative: typeof sendNative;
200
+ declare const index_sendToken: typeof sendToken;
201
+ declare const index_writeContract: typeof writeContract;
202
+ declare namespace index {
203
+ export { type index_SendNativeParams as SendNativeParams, type index_SendTokenParams as SendTokenParams, index_getBrowserSigner as getBrowserSigner, index_getReadProvider as getReadProvider, index_sendNative as sendNative, index_sendToken as sendToken, index_writeContract as writeContract };
204
+ }
205
+
206
+ export { type TxOptions, type TxResult, index$1 as cosmosTx, index as evmTx, isEvmChain };
@@ -0,0 +1,206 @@
1
+ import { OfflineSigner, Registry } from '@cosmjs/proto-signing';
2
+ import { SigningStargateClient } from '@cosmjs/stargate';
3
+ import { JsonRpcSigner, JsonRpcProvider } from 'ethers';
4
+
5
+ interface RpcEndpoint {
6
+ address: string;
7
+ provider?: string;
8
+ tx_index?: string;
9
+ }
10
+ interface ChainAsset {
11
+ base: string;
12
+ display?: string;
13
+ symbol?: string;
14
+ denom_units?: Array<{
15
+ denom: string;
16
+ exponent: number;
17
+ }>;
18
+ }
19
+ interface FeeToken {
20
+ denom: string;
21
+ fixed_min_gas_price?: number;
22
+ low_gas_price?: number;
23
+ average_gas_price?: number;
24
+ high_gas_price?: number;
25
+ }
26
+ interface ChainFees {
27
+ fee_tokens?: FeeToken[];
28
+ }
29
+ interface ChainData {
30
+ chain_name: string;
31
+ chain_id?: string;
32
+ coin_type?: string;
33
+ assets?: ChainAsset[];
34
+ rpc?: RpcEndpoint[];
35
+ evm_rpc?: RpcEndpoint[];
36
+ evm_chain_id?: number;
37
+ fees?: ChainFees;
38
+ }
39
+
40
+ interface TxResult {
41
+ success: boolean;
42
+ txHash?: string;
43
+ error?: string;
44
+ raw?: any;
45
+ }
46
+ interface TxOptions {
47
+ memo?: string;
48
+ gasLimit?: string;
49
+ }
50
+ /**
51
+ * A chain is treated as EVM when it declares evm_rpc endpoints or its
52
+ * coin_type is 60 (Ethereum's SLIP-44 index) — same heuristic used across
53
+ * the rest of the app (see lib/keplr.ts isEvmChain checks).
54
+ */
55
+ declare function isEvmChain(chain: ChainData): boolean;
56
+
57
+ interface SendParams {
58
+ fromAddress: string;
59
+ toAddress: string;
60
+ amount: string;
61
+ denom?: string;
62
+ }
63
+ interface DelegateParams {
64
+ delegatorAddress: string;
65
+ validatorAddress: string;
66
+ amount: string;
67
+ denom?: string;
68
+ }
69
+ interface UndelegateParams extends DelegateParams {
70
+ }
71
+ interface RedelegateParams {
72
+ delegatorAddress: string;
73
+ validatorSrcAddress: string;
74
+ validatorDstAddress: string;
75
+ amount: string;
76
+ denom?: string;
77
+ }
78
+ /** 1 = Yes, 2 = Abstain, 3 = No, 4 = NoWithVeto */
79
+ type VoteOption = 1 | 2 | 3 | 4;
80
+ interface VoteParams {
81
+ voterAddress: string;
82
+ proposalId: string;
83
+ option: VoteOption;
84
+ }
85
+ interface UnjailParams {
86
+ senderAddress: string;
87
+ validatorAddress: string;
88
+ }
89
+ interface WithdrawRewardsParams {
90
+ delegatorAddress: string;
91
+ validatorAddress: string;
92
+ }
93
+ declare function send(chain: ChainData, signer: OfflineSigner, params: SendParams, opts?: TxOptions): Promise<TxResult>;
94
+ declare function delegate(chain: ChainData, signer: OfflineSigner, params: DelegateParams, opts?: TxOptions): Promise<TxResult>;
95
+ declare function undelegate(chain: ChainData, signer: OfflineSigner, params: UndelegateParams, opts?: TxOptions): Promise<TxResult>;
96
+ declare function redelegate(chain: ChainData, signer: OfflineSigner, params: RedelegateParams, opts?: TxOptions): Promise<TxResult>;
97
+ declare function vote(chain: ChainData, signer: OfflineSigner, params: VoteParams, opts?: TxOptions): Promise<TxResult>;
98
+ declare function unjail(chain: ChainData, signer: OfflineSigner, params: UnjailParams, opts?: TxOptions): Promise<TxResult>;
99
+ declare function withdrawRewards(chain: ChainData, signer: OfflineSigner, params: WithdrawRewardsParams, opts?: TxOptions): Promise<TxResult>;
100
+
101
+ /**
102
+ * Connects a SigningStargateClient for the given chain using any
103
+ * OfflineSigner-compatible wallet (Keplr's getOfflineSignerAuto/getOfflineSigner,
104
+ * Leap, etc). Clients are cached per rpc+address so repeated calls in the
105
+ * same session reuse the open connection.
106
+ */
107
+ declare function getSigningStargateClient(chain: ChainData, signer: OfflineSigner): Promise<SigningStargateClient>;
108
+ declare function clearCosmosClientCache(): void;
109
+
110
+ /**
111
+ * @cosmjs/stargate's defaultRegistryTypes already covers MsgSend, MsgDelegate,
112
+ * MsgUndelegate, MsgBeginRedelegate, MsgVote and MsgWithdrawDelegatorReward.
113
+ * MsgUnjail is the only staking-adjacent message missing from it.
114
+ */
115
+ declare function createCosmosRegistry(): Registry;
116
+
117
+ declare function getPrimaryDenom(chain: ChainData): string;
118
+ /**
119
+ * Delegates to the app's existing, battle-tested fee calculation
120
+ * (gas_price / fee_tokens / exponent-based fallbacks, PaxiHub minimums, etc.)
121
+ * so every SDK tx uses the same fee logic as the rest of the explorer.
122
+ */
123
+ declare function buildFee(chain: ChainData, gasLimit: string): Promise<{
124
+ amount: Array<{
125
+ denom: string;
126
+ amount: string;
127
+ }>;
128
+ gas: string;
129
+ }>;
130
+ /**
131
+ * Picks the RPC endpoint with tx_index enabled when available, otherwise
132
+ * falls back to the first configured endpoint.
133
+ */
134
+ declare function pickRpcEndpoint(chain: ChainData): string;
135
+
136
+ type index$1_DelegateParams = DelegateParams;
137
+ type index$1_RedelegateParams = RedelegateParams;
138
+ type index$1_SendParams = SendParams;
139
+ type index$1_UndelegateParams = UndelegateParams;
140
+ type index$1_UnjailParams = UnjailParams;
141
+ type index$1_VoteOption = VoteOption;
142
+ type index$1_VoteParams = VoteParams;
143
+ type index$1_WithdrawRewardsParams = WithdrawRewardsParams;
144
+ declare const index$1_buildFee: typeof buildFee;
145
+ declare const index$1_clearCosmosClientCache: typeof clearCosmosClientCache;
146
+ declare const index$1_createCosmosRegistry: typeof createCosmosRegistry;
147
+ declare const index$1_delegate: typeof delegate;
148
+ declare const index$1_getPrimaryDenom: typeof getPrimaryDenom;
149
+ declare const index$1_getSigningStargateClient: typeof getSigningStargateClient;
150
+ declare const index$1_pickRpcEndpoint: typeof pickRpcEndpoint;
151
+ declare const index$1_redelegate: typeof redelegate;
152
+ declare const index$1_send: typeof send;
153
+ declare const index$1_undelegate: typeof undelegate;
154
+ declare const index$1_unjail: typeof unjail;
155
+ declare const index$1_vote: typeof vote;
156
+ declare const index$1_withdrawRewards: typeof withdrawRewards;
157
+ declare namespace index$1 {
158
+ export { type index$1_DelegateParams as DelegateParams, type index$1_RedelegateParams as RedelegateParams, type index$1_SendParams as SendParams, type index$1_UndelegateParams as UndelegateParams, type index$1_UnjailParams as UnjailParams, type index$1_VoteOption as VoteOption, type index$1_VoteParams as VoteParams, type index$1_WithdrawRewardsParams as WithdrawRewardsParams, index$1_buildFee as buildFee, index$1_clearCosmosClientCache as clearCosmosClientCache, index$1_createCosmosRegistry as createCosmosRegistry, index$1_delegate as delegate, index$1_getPrimaryDenom as getPrimaryDenom, index$1_getSigningStargateClient as getSigningStargateClient, index$1_pickRpcEndpoint as pickRpcEndpoint, index$1_redelegate as redelegate, index$1_send as send, index$1_undelegate as undelegate, index$1_unjail as unjail, index$1_vote as vote, index$1_withdrawRewards as withdrawRewards };
159
+ }
160
+
161
+ interface SendNativeParams {
162
+ toAddress: string;
163
+ amount: string;
164
+ decimals?: number;
165
+ }
166
+ interface SendTokenParams {
167
+ tokenAddress: string;
168
+ toAddress: string;
169
+ amount: string;
170
+ decimals?: number;
171
+ }
172
+ /** Sends the chain's native coin (e.g. MON on Monad). */
173
+ declare function sendNative(signer: JsonRpcSigner, params: SendNativeParams, opts?: TxOptions): Promise<TxResult>;
174
+ /** Sends an ERC-20 token via its standard `transfer` method. */
175
+ declare function sendToken(signer: JsonRpcSigner, params: SendTokenParams, opts?: TxOptions): Promise<TxResult>;
176
+ /**
177
+ * Generic contract write, for chains that expose staking/governance actions
178
+ * (delegate, undelegate, vote, unjail) through a contract or precompile
179
+ * rather than a native Cosmos message — e.g. Cosmos-EVM staking/gov
180
+ * precompiles. Pass the ABI fragment for the single method being called.
181
+ */
182
+ declare function writeContract(signer: JsonRpcSigner, contractAddress: string, abiFragment: string[], method: string, args?: any[], opts?: TxOptions): Promise<TxResult>;
183
+
184
+ /**
185
+ * Read-only provider for the chain's EVM RPC (falls back to the Tendermint
186
+ * rpc list for chains that only expose one endpoint set).
187
+ */
188
+ declare function getReadProvider(chain: ChainData): JsonRpcProvider;
189
+ /**
190
+ * Signer backed by the injected wallet (MetaMask). Ensures the wallet is
191
+ * switched to the requested chain before returning the signer.
192
+ */
193
+ declare function getBrowserSigner(chain: ChainData): Promise<JsonRpcSigner>;
194
+
195
+ type index_SendNativeParams = SendNativeParams;
196
+ type index_SendTokenParams = SendTokenParams;
197
+ declare const index_getBrowserSigner: typeof getBrowserSigner;
198
+ declare const index_getReadProvider: typeof getReadProvider;
199
+ declare const index_sendNative: typeof sendNative;
200
+ declare const index_sendToken: typeof sendToken;
201
+ declare const index_writeContract: typeof writeContract;
202
+ declare namespace index {
203
+ export { type index_SendNativeParams as SendNativeParams, type index_SendTokenParams as SendTokenParams, index_getBrowserSigner as getBrowserSigner, index_getReadProvider as getReadProvider, index_sendNative as sendNative, index_sendToken as sendToken, index_writeContract as writeContract };
204
+ }
205
+
206
+ export { type TxOptions, type TxResult, index$1 as cosmosTx, index as evmTx, isEvmChain };