@initia/interwovenkit-react 2.4.5 → 2.5.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/dist/index.cjs +3 -3
- package/dist/index.d.ts +290 -1
- package/dist/index.js +5157 -4712
- package/dist/styles.css +1 -1
- package/dist/styles.js +1 -1
- package/package.json +5 -7
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { IndexedTx } from '@cosmjs/stargate';
|
|
|
14
14
|
import { JSX } from 'react/jsx-runtime';
|
|
15
15
|
import { OfflineAminoSigner } from '@cosmjs/amino';
|
|
16
16
|
import { PropsWithChildren } from 'react';
|
|
17
|
+
import { ProviderConnectInfo } from 'viem';
|
|
17
18
|
import { SimulateResponse } from 'cosmjs-types/cosmos/tx/v1beta1/service';
|
|
18
19
|
import { StdFee } from '@cosmjs/stargate';
|
|
19
20
|
import { StdSignDoc } from '@cosmjs/amino';
|
|
@@ -49,8 +50,296 @@ declare interface Config {
|
|
|
49
50
|
disableAnalytics?: boolean;
|
|
50
51
|
enableAutoSign?: boolean | Record<string, string[]>;
|
|
51
52
|
autoSignFeePolicy?: Record<string, AutoSignFeePolicy>;
|
|
53
|
+
cosmosWallets?: CosmosWallet[];
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
export declare interface CosmosWallet {
|
|
57
|
+
name: string;
|
|
58
|
+
image?: string;
|
|
59
|
+
getProvider: () => CosmosWalletProvider | undefined;
|
|
60
|
+
fallbackUrl?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare interface CosmosWalletProvider {
|
|
64
|
+
getOfflineSigner(chainId: string): OfflineAminoSigner;
|
|
65
|
+
getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Creates a Cosmos wallet for the Bridge wallet selection list,
|
|
70
|
+
* backed by a mnemonic-derived `Secp256k1HdWallet` (standard Cosmos
|
|
71
|
+
* secp256k1 signing). Designed for automated testing and local
|
|
72
|
+
* development against chains like Noble and Neutron.
|
|
73
|
+
*
|
|
74
|
+
* Pass the returned wallet via the `cosmosWallets` config prop
|
|
75
|
+
* on `InterwovenKitProvider`. It will appear in the Bridge's
|
|
76
|
+
* "Connect wallet" list alongside Keplr and Leap.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* import {
|
|
81
|
+
* InterwovenKitProvider,
|
|
82
|
+
* createTestCosmosWallet,
|
|
83
|
+
* } from "@initia/interwovenkit-react"
|
|
84
|
+
*
|
|
85
|
+
* const testCosmosWallet = createTestCosmosWallet({
|
|
86
|
+
* mnemonic: process.env.TEST_COSMOS_MNEMONIC!,
|
|
87
|
+
* })
|
|
88
|
+
*
|
|
89
|
+
* function App() {
|
|
90
|
+
* return (
|
|
91
|
+
* <InterwovenKitProvider cosmosWallets={[testCosmosWallet]}>
|
|
92
|
+
* {children}
|
|
93
|
+
* </InterwovenKitProvider>
|
|
94
|
+
* )
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function createTestCosmosWallet(config: CreateTestCosmosWalletConfig): CosmosWallet;
|
|
99
|
+
|
|
100
|
+
export declare interface CreateTestCosmosWalletConfig {
|
|
101
|
+
/**
|
|
102
|
+
* BIP-39 mnemonic phrase used to derive Cosmos accounts.
|
|
103
|
+
*/
|
|
104
|
+
mnemonic: string;
|
|
105
|
+
/**
|
|
106
|
+
* Display name shown in the wallet selection list.
|
|
107
|
+
* @default "Test Cosmos Wallet"
|
|
108
|
+
*/
|
|
109
|
+
name?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Wallet icon URL. Omit to show the default placeholder.
|
|
112
|
+
*/
|
|
113
|
+
image?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Override the bech32 prefix for specific chain IDs.
|
|
116
|
+
* By default, the prefix is derived from the chain ID
|
|
117
|
+
* (e.g. `noble-1` → `noble`). Use this for chains where
|
|
118
|
+
* the prefix differs from the chain ID stem.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* chains: {
|
|
123
|
+
* "cosmoshub-4": { prefix: "cosmos" },
|
|
124
|
+
* "osmosis-1": { prefix: "osmo" },
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
chains?: Record<string, {
|
|
129
|
+
prefix: string;
|
|
130
|
+
}>;
|
|
131
|
+
/**
|
|
132
|
+
* Log signer creation to the console for debugging.
|
|
133
|
+
* @default false
|
|
134
|
+
*/
|
|
135
|
+
debug?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export declare type CreateTestWalletConfig = CreateTestWalletOptions & {
|
|
139
|
+
/**
|
|
140
|
+
* Wagmi connector id. Useful when running multiple test wallets.
|
|
141
|
+
* @default "testWallet"
|
|
142
|
+
*/
|
|
143
|
+
id?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Display name shown in wallet selection UI.
|
|
146
|
+
* @default "Test Wallet"
|
|
147
|
+
*/
|
|
148
|
+
name?: string;
|
|
149
|
+
/**
|
|
150
|
+
* CORS-friendly RPC URLs keyed by chain ID.
|
|
151
|
+
* User-provided URLs override built-in defaults for matching chain IDs.
|
|
152
|
+
*/
|
|
153
|
+
rpcUrls?: Record<number, string>;
|
|
154
|
+
/**
|
|
155
|
+
* Log every RPC call to the console for debugging.
|
|
156
|
+
* @default false
|
|
157
|
+
*/
|
|
158
|
+
debug?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Override fields on every `eth_sendTransaction` call.
|
|
161
|
+
* Useful for testing failure scenarios:
|
|
162
|
+
* - `{ gas: 21000n }` — out of gas for contract calls (triggers revert)
|
|
163
|
+
* - `{ maxFeePerGas: 1n }` — below base fee (rejected by RPC or stuck in mempool)
|
|
164
|
+
*/
|
|
165
|
+
sendTransactionOverrides?: {
|
|
166
|
+
gas?: bigint;
|
|
167
|
+
maxFeePerGas?: bigint;
|
|
168
|
+
maxPriorityFeePerGas?: bigint;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Creates a wagmi-compatible wallet connector from a mnemonic or
|
|
174
|
+
* private key for automated testing and local development.
|
|
175
|
+
*
|
|
176
|
+
* Browser wallets require manual interaction (popups, confirmations)
|
|
177
|
+
* that cannot be driven programmatically. This connector creates an
|
|
178
|
+
* in-memory EIP-1193 wallet that handles chain switching, transaction
|
|
179
|
+
* signing, and gas estimation entirely in code. Standard contract
|
|
180
|
+
* interactions (e.g. ERC-20 approvals) work via the RPC proxy.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* import { createTestWalletConnector } from "@initia/interwovenkit-react"
|
|
185
|
+
*
|
|
186
|
+
* // From mnemonic
|
|
187
|
+
* const connector = createTestWalletConnector({
|
|
188
|
+
* mnemonic: process.env.TEST_MNEMONIC!,
|
|
189
|
+
* })
|
|
190
|
+
*
|
|
191
|
+
* // Or from private key
|
|
192
|
+
* const connector = createTestWalletConnector({
|
|
193
|
+
* privateKey: process.env.TEST_PRIVATE_KEY as `0x${string}`,
|
|
194
|
+
* })
|
|
195
|
+
*
|
|
196
|
+
* const config = createConfig({
|
|
197
|
+
* connectors: [connector, ...otherConnectors],
|
|
198
|
+
* })
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* ### Supported EIP-1193 methods
|
|
202
|
+
*
|
|
203
|
+
* | Method | Behavior |
|
|
204
|
+
* | --- | --- |
|
|
205
|
+
* | `eth_requestAccounts`, `eth_accounts` | Returns the account address |
|
|
206
|
+
* | `eth_chainId` | Returns current chain ID (hex) |
|
|
207
|
+
* | `personal_sign` | Signs with the account |
|
|
208
|
+
* | `eth_signTypedData`, `eth_signTypedData_v4` | Simplified: signs raw bytes (not EIP-712 compliant) |
|
|
209
|
+
* | `wallet_switchEthereumChain` | Switches chain; auto-registers from rpcUrls; throws 4902 if no RPC known |
|
|
210
|
+
* | `wallet_addEthereumChain` | Registers a new chain with its RPC URL |
|
|
211
|
+
* | `wallet_getPermissions`, `wallet_requestPermissions` | Returns `eth_accounts` permission |
|
|
212
|
+
* | `eth_sendTransaction` | Signs locally via viem, broadcasts to RPC |
|
|
213
|
+
* | *(any other method)* | Proxied to the current chain's RPC node |
|
|
214
|
+
*/
|
|
215
|
+
export declare function createTestWalletConnector(options: CreateTestWalletConfig): CreateConnectorFn< {
|
|
216
|
+
on: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void;
|
|
217
|
+
removeListener: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void;
|
|
218
|
+
request: EIP1193RequestFn<EIP1474Methods>;
|
|
219
|
+
isApexWallet?: true | undefined;
|
|
220
|
+
isAvalanche?: true | undefined;
|
|
221
|
+
isBackpack?: true | undefined;
|
|
222
|
+
isBifrost?: true | undefined;
|
|
223
|
+
isBitKeep?: true | undefined;
|
|
224
|
+
isBitski?: true | undefined;
|
|
225
|
+
isBlockWallet?: true | undefined;
|
|
226
|
+
isBraveWallet?: true | undefined;
|
|
227
|
+
isCoinbaseWallet?: true | undefined;
|
|
228
|
+
isDawn?: true | undefined;
|
|
229
|
+
isEnkrypt?: true | undefined;
|
|
230
|
+
isExodus?: true | undefined;
|
|
231
|
+
isFrame?: true | undefined;
|
|
232
|
+
isFrontier?: true | undefined;
|
|
233
|
+
isGamestop?: true | undefined;
|
|
234
|
+
isHyperPay?: true | undefined;
|
|
235
|
+
isImToken?: true | undefined;
|
|
236
|
+
isKuCoinWallet?: true | undefined;
|
|
237
|
+
isMathWallet?: true | undefined;
|
|
238
|
+
isMetaMask?: true | undefined;
|
|
239
|
+
isOkxWallet?: true | undefined;
|
|
240
|
+
isOKExWallet?: true | undefined;
|
|
241
|
+
isOneInchAndroidWallet?: true | undefined;
|
|
242
|
+
isOneInchIOSWallet?: true | undefined;
|
|
243
|
+
isOpera?: true | undefined;
|
|
244
|
+
isPhantom?: true | undefined;
|
|
245
|
+
isPortal?: true | undefined;
|
|
246
|
+
isRabby?: true | undefined;
|
|
247
|
+
isRainbow?: true | undefined;
|
|
248
|
+
isStatus?: true | undefined;
|
|
249
|
+
isTally?: true | undefined;
|
|
250
|
+
isTokenPocket?: true | undefined;
|
|
251
|
+
isTokenary?: true | undefined;
|
|
252
|
+
isTrust?: true | undefined;
|
|
253
|
+
isTrustWallet?: true | undefined;
|
|
254
|
+
isUniswapWallet?: true | undefined;
|
|
255
|
+
isXDEFI?: true | undefined;
|
|
256
|
+
isZerion?: true | undefined;
|
|
257
|
+
providers?: {
|
|
258
|
+
on: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void;
|
|
259
|
+
removeListener: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void;
|
|
260
|
+
request: EIP1193RequestFn<EIP1474Methods>;
|
|
261
|
+
isApexWallet?: true | undefined;
|
|
262
|
+
isAvalanche?: true | undefined;
|
|
263
|
+
isBackpack?: true | undefined;
|
|
264
|
+
isBifrost?: true | undefined;
|
|
265
|
+
isBitKeep?: true | undefined;
|
|
266
|
+
isBitski?: true | undefined;
|
|
267
|
+
isBlockWallet?: true | undefined;
|
|
268
|
+
isBraveWallet?: true | undefined;
|
|
269
|
+
isCoinbaseWallet?: true | undefined;
|
|
270
|
+
isDawn?: true | undefined;
|
|
271
|
+
isEnkrypt?: true | undefined;
|
|
272
|
+
isExodus?: true | undefined;
|
|
273
|
+
isFrame?: true | undefined;
|
|
274
|
+
isFrontier?: true | undefined;
|
|
275
|
+
isGamestop?: true | undefined;
|
|
276
|
+
isHyperPay?: true | undefined;
|
|
277
|
+
isImToken?: true | undefined;
|
|
278
|
+
isKuCoinWallet?: true | undefined;
|
|
279
|
+
isMathWallet?: true | undefined;
|
|
280
|
+
isMetaMask?: true | undefined;
|
|
281
|
+
isOkxWallet?: true | undefined;
|
|
282
|
+
isOKExWallet?: true | undefined;
|
|
283
|
+
isOneInchAndroidWallet?: true | undefined;
|
|
284
|
+
isOneInchIOSWallet?: true | undefined;
|
|
285
|
+
isOpera?: true | undefined;
|
|
286
|
+
isPhantom?: true | undefined;
|
|
287
|
+
isPortal?: true | undefined;
|
|
288
|
+
isRabby?: true | undefined;
|
|
289
|
+
isRainbow?: true | undefined;
|
|
290
|
+
isStatus?: true | undefined;
|
|
291
|
+
isTally?: true | undefined;
|
|
292
|
+
isTokenPocket?: true | undefined;
|
|
293
|
+
isTokenary?: true | undefined;
|
|
294
|
+
isTrust?: true | undefined;
|
|
295
|
+
isTrustWallet?: true | undefined;
|
|
296
|
+
isUniswapWallet?: true | undefined;
|
|
297
|
+
isXDEFI?: true | undefined;
|
|
298
|
+
isZerion?: true | undefined;
|
|
299
|
+
providers?: /*elided*/ any[] | undefined | undefined;
|
|
300
|
+
_events?: {
|
|
301
|
+
connect?: (() => void) | undefined;
|
|
302
|
+
} | undefined | undefined;
|
|
303
|
+
_state?: {
|
|
304
|
+
accounts?: string[];
|
|
305
|
+
initialized?: boolean;
|
|
306
|
+
isConnected?: boolean;
|
|
307
|
+
isPermanentlyDisconnected?: boolean;
|
|
308
|
+
isUnlocked?: boolean;
|
|
309
|
+
} | undefined | undefined;
|
|
310
|
+
}[] | undefined | undefined;
|
|
311
|
+
_events?: {
|
|
312
|
+
connect?: (() => void) | undefined;
|
|
313
|
+
} | undefined | undefined;
|
|
314
|
+
_state?: {
|
|
315
|
+
accounts?: string[];
|
|
316
|
+
initialized?: boolean;
|
|
317
|
+
isConnected?: boolean;
|
|
318
|
+
isPermanentlyDisconnected?: boolean;
|
|
319
|
+
isUnlocked?: boolean;
|
|
320
|
+
} | undefined | undefined;
|
|
321
|
+
} | undefined, {
|
|
322
|
+
onConnect(connectInfo: ProviderConnectInfo): void;
|
|
323
|
+
}, {
|
|
324
|
+
[x: `${string}.disconnected`]: true;
|
|
325
|
+
"injected.connected": true;
|
|
326
|
+
}>;
|
|
327
|
+
|
|
328
|
+
export declare type CreateTestWalletOptions = {
|
|
329
|
+
/**
|
|
330
|
+
* BIP-39 mnemonic phrase. Provide either `mnemonic` or `privateKey`.
|
|
331
|
+
*/
|
|
332
|
+
mnemonic: string;
|
|
333
|
+
privateKey?: never;
|
|
334
|
+
} | {
|
|
335
|
+
mnemonic?: never;
|
|
336
|
+
/**
|
|
337
|
+
* Hex-encoded private key (with `0x` prefix).
|
|
338
|
+
* Provide either `mnemonic` or `privateKey`.
|
|
339
|
+
*/
|
|
340
|
+
privateKey: `0x${string}`;
|
|
341
|
+
};
|
|
342
|
+
|
|
54
343
|
export declare const DEFAULT_GAS_ADJUSTMENT = 1.4;
|
|
55
344
|
|
|
56
345
|
export declare const DEFAULT_GAS_PRICE_MULTIPLIER = 1.05;
|
|
@@ -233,6 +522,6 @@ export declare function usePortfolio(): {
|
|
|
233
522
|
totalValue: number;
|
|
234
523
|
};
|
|
235
524
|
|
|
236
|
-
export declare function useUsernameQuery(): UseQueryResult<string | null, Error>;
|
|
525
|
+
export declare function useUsernameQuery(address?: string): UseQueryResult<string | null, Error>;
|
|
237
526
|
|
|
238
527
|
export { }
|