@parity/product-sdk-tx 0.1.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.
@@ -0,0 +1,538 @@
1
+ import { PolkadotSigner } from 'polkadot-api';
2
+
3
+ /** Transaction lifecycle status for UI callbacks. */
4
+ type TxStatus = "signing" | "broadcasting" | "in-block" | "finalized" | "error";
5
+ /** When to resolve the submission promise. */
6
+ type WaitFor = "best-block" | "finalized";
7
+ /** Successful transaction result. */
8
+ interface TxResult {
9
+ /** Transaction hash. */
10
+ txHash: string;
11
+ /** Whether the on-chain dispatch succeeded. */
12
+ ok: boolean;
13
+ /** Block where the transaction was included. */
14
+ block: {
15
+ hash: string;
16
+ number: number;
17
+ index: number;
18
+ };
19
+ /** Raw events emitted by the transaction. */
20
+ events: unknown[];
21
+ /** Dispatch error details when ok is false. */
22
+ dispatchError?: unknown;
23
+ }
24
+ /** Options for {@link submitAndWatch}. */
25
+ interface SubmitOptions {
26
+ /** When to resolve the promise. Default: `"best-block"`. */
27
+ waitFor?: WaitFor;
28
+ /** Timeout in milliseconds. Default: `300_000` (5 minutes). */
29
+ timeoutMs?: number;
30
+ /** Mortality period in blocks. Default: `256` (~43 minutes on Polkadot). */
31
+ mortalityPeriod?: number;
32
+ /** Called on each lifecycle transition for UI progress indicators. */
33
+ onStatus?: (status: TxStatus) => void;
34
+ }
35
+ /** Options for {@link withRetry}. */
36
+ interface RetryOptions {
37
+ /** Total attempts including the first. Default: `3`. */
38
+ maxAttempts?: number;
39
+ /** Base delay in ms for exponential backoff. Default: `1_000`. */
40
+ baseDelayMs?: number;
41
+ /** Maximum delay in ms. Default: `15_000`. */
42
+ maxDelayMs?: number;
43
+ }
44
+ /**
45
+ * Substrate weight representing computational and storage resources.
46
+ *
47
+ * Matches the shape returned by `ReviveApi.call` and `ReviveApi.eth_transact`
48
+ * dry-run results in the `weight_required` field.
49
+ */
50
+ interface Weight {
51
+ /** Reference time component in picoseconds. */
52
+ ref_time: bigint;
53
+ /** Proof size component in bytes. */
54
+ proof_size: bigint;
55
+ }
56
+ /** Standard Substrate dev account names. */
57
+ type DevAccountName = "Alice" | "Bob" | "Charlie" | "Dave" | "Eve" | "Ferdie";
58
+ /**
59
+ * Structural type for any transaction object that supports Observable-based
60
+ * sign-submit-and-watch. Works with raw PAPI transactions and Ink SDK
61
+ * resolved transactions.
62
+ */
63
+ interface SubmittableTransaction {
64
+ signSubmitAndWatch: (signer: PolkadotSigner, options?: {
65
+ mortality?: {
66
+ mortal: boolean;
67
+ period: number;
68
+ };
69
+ }) => {
70
+ subscribe: (handlers: {
71
+ next: (event: TxEvent) => void;
72
+ error: (error: Error) => void;
73
+ }) => {
74
+ unsubscribe: () => void;
75
+ };
76
+ };
77
+ /** Present on Ink SDK AsyncTransaction wrappers. */
78
+ waited?: Promise<SubmittableTransaction>;
79
+ /** The decoded call data. Present on PAPI transactions. */
80
+ decodedCall?: unknown;
81
+ }
82
+ /** Batch execution mode corresponding to Substrate's Utility pallet. */
83
+ type BatchMode = "batch_all" | "batch" | "force_batch";
84
+ /**
85
+ * A transaction or decoded call that can be included in a batch.
86
+ *
87
+ * Accepts:
88
+ * - A {@link SubmittableTransaction} (has `.decodedCall`)
89
+ * - An Ink SDK AsyncTransaction (has `.waited` that resolves to one with `.decodedCall`)
90
+ * - A raw decoded call object (passed through as `Record<string, unknown>`)
91
+ *
92
+ * The `Record<string, unknown>` variant is intentionally broad because PAPI decoded
93
+ * calls are chain-specific enum types that cannot be imported without chain descriptors.
94
+ * Runtime validation in `resolveDecodedCall` rejects null, undefined, and primitives.
95
+ */
96
+ type BatchableCall = SubmittableTransaction | {
97
+ decodedCall: unknown;
98
+ } | Record<string, unknown>;
99
+ /** Options for {@link batchSubmitAndWatch}. Extends {@link SubmitOptions} with batch mode. */
100
+ interface BatchSubmitOptions extends SubmitOptions {
101
+ /**
102
+ * Batch execution mode. Default: `"batch_all"` (atomic, all-or-nothing).
103
+ *
104
+ * - `"batch_all"` — Atomic. Reverts all calls if any single call fails.
105
+ * - `"batch"` — Best-effort. Stops at first failure but earlier successful calls are not reverted.
106
+ * - `"force_batch"` — Like `batch` but continues executing remaining calls after failures (never aborts early).
107
+ */
108
+ mode?: BatchMode;
109
+ }
110
+ /**
111
+ * Minimal structural type for a PAPI typed API with the Utility pallet.
112
+ *
113
+ * Structural so it works with any chain that has the Utility pallet, without
114
+ * importing chain-specific descriptors.
115
+ */
116
+ interface BatchApi {
117
+ tx: {
118
+ Utility: {
119
+ batch(args: {
120
+ calls: unknown[];
121
+ }): SubmittableTransaction;
122
+ batch_all(args: {
123
+ calls: unknown[];
124
+ }): SubmittableTransaction;
125
+ force_batch(args: {
126
+ calls: unknown[];
127
+ }): SubmittableTransaction;
128
+ };
129
+ };
130
+ }
131
+ /** PAPI transaction event (discriminated union). */
132
+ type TxEvent = {
133
+ type: "signed";
134
+ txHash: string;
135
+ } | {
136
+ type: "broadcasted";
137
+ txHash: string;
138
+ } | {
139
+ type: "txBestBlocksState";
140
+ txHash: string;
141
+ found: boolean;
142
+ ok?: boolean;
143
+ events?: unknown[];
144
+ block?: {
145
+ hash: string;
146
+ number: number;
147
+ index: number;
148
+ };
149
+ dispatchError?: unknown;
150
+ } | {
151
+ type: "finalized";
152
+ txHash: string;
153
+ ok: boolean;
154
+ events: unknown[];
155
+ block: {
156
+ hash: string;
157
+ number: number;
158
+ index: number;
159
+ };
160
+ dispatchError?: unknown;
161
+ };
162
+
163
+ /**
164
+ * Submit a transaction and watch its lifecycle through signing, broadcasting,
165
+ * block inclusion, and (optionally) finalization.
166
+ *
167
+ * @param tx - A transaction object with `signSubmitAndWatch`. Works with raw PAPI
168
+ * transactions and Ink SDK `AsyncTransaction` wrappers (resolved automatically).
169
+ * @param signer - The signer to use. Can come from a wallet extension, Host API
170
+ * (`getProductAccountSigner`), or {@link createDevSigner}.
171
+ * @param options - Submission options (waitFor, timeout, mortality, status callback).
172
+ * @returns The transaction result once included/finalized.
173
+ *
174
+ * @throws {TxTimeoutError} If the transaction does not reach the target state within `timeoutMs`.
175
+ * @throws {TxDispatchError} If the on-chain dispatch fails (e.g., insufficient balance, contract revert).
176
+ * @throws {TxSigningRejectedError} If the user rejects signing in their wallet.
177
+ */
178
+ declare function submitAndWatch(tx: SubmittableTransaction, signer: PolkadotSigner, options?: SubmitOptions): Promise<TxResult>;
179
+
180
+ /**
181
+ * Batch multiple transactions into a single Substrate Utility batch and submit.
182
+ *
183
+ * Extracts `.decodedCall` from each transaction (handling Ink SDK `AsyncTransaction`
184
+ * wrappers), wraps them in `Utility.batch_all` (or `batch`/`force_batch` via the
185
+ * `mode` option), and submits via {@link submitAndWatch} with full lifecycle tracking.
186
+ *
187
+ * @param calls - Array of transactions, AsyncTransactions, or raw decoded calls to batch.
188
+ * @param api - A typed API with `tx.Utility.batch_all/batch/force_batch`. Works with any
189
+ * chain that has the Utility pallet — no chain-specific imports required.
190
+ * **All calls must target the same chain as this API.** Do not mix decoded calls
191
+ * from different chains (e.g., Asset Hub and Bulletin) in a single batch.
192
+ * @param signer - The signer to use. Can come from a wallet extension, Host API
193
+ * (`getProductAccountSigner`), or {@link createDevSigner}.
194
+ * @param options - Optional {@link BatchSubmitOptions} (extends `SubmitOptions` with `mode`).
195
+ * @returns The transaction result from the batch submission.
196
+ *
197
+ * @throws {TxBatchError} If `calls` is empty.
198
+ * @throws {TxBatchError} If an AsyncTransaction resolves without a `.decodedCall` property.
199
+ * @throws {TxTimeoutError} If the batch transaction does not reach the target state within `timeoutMs`.
200
+ * @throws {TxDispatchError} If the on-chain dispatch fails.
201
+ * @throws {TxSigningRejectedError} If the user rejects signing in their wallet.
202
+ *
203
+ * @example
204
+ * ```ts
205
+ * import { batchSubmitAndWatch } from "@parity/product-sdk-tx";
206
+ *
207
+ * const tx1 = api.tx.Balances.transfer_keep_alive({ dest: addr1, value: 1_000n });
208
+ * const tx2 = api.tx.Balances.transfer_keep_alive({ dest: addr2, value: 2_000n });
209
+ *
210
+ * const result = await batchSubmitAndWatch([tx1, tx2], api, signer, {
211
+ * onStatus: (status) => console.log(status),
212
+ * });
213
+ * ```
214
+ */
215
+ declare function batchSubmitAndWatch(calls: BatchableCall[], api: BatchApi, signer: PolkadotSigner, options?: BatchSubmitOptions): Promise<TxResult>;
216
+
217
+ /**
218
+ * Calculate delay with exponential backoff and jitter.
219
+ *
220
+ * Jitter prevents thundering-herd when multiple clients retry simultaneously.
221
+ * The delay is `min(baseDelay * 2^attempt, maxDelay) * random(0.5, 1.0)`.
222
+ */
223
+ declare function calculateDelay(attempt: number, baseDelayMs: number, maxDelayMs: number): number;
224
+ /**
225
+ * Wrap an async function with retry logic and exponential backoff.
226
+ *
227
+ * Only retries transient errors (network disconnects, temporary RPC failures).
228
+ * Deterministic errors ({@link TxDispatchError}, {@link TxBatchError}), user
229
+ * rejections ({@link TxSigningRejectedError}), and timeouts ({@link TxTimeoutError})
230
+ * are rethrown immediately without retry.
231
+ *
232
+ * @param fn - The async function to retry.
233
+ * @param options - Retry configuration.
234
+ * @returns The result of the first successful call.
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * const result = await withRetry(
239
+ * () => submitAndWatch(tx, signer),
240
+ * { maxAttempts: 3, baseDelayMs: 1_000 },
241
+ * );
242
+ * ```
243
+ */
244
+ declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
245
+
246
+ /**
247
+ * Create a PolkadotSigner for a standard Substrate dev account.
248
+ *
249
+ * Dev accounts use the well-known Substrate dev mnemonic (`DEV_PHRASE`) with
250
+ * Sr25519 key derivation at the path `//{Name}`. These accounts have known
251
+ * private keys and are pre-funded on dev/test chains.
252
+ *
253
+ * Only for local development, scripts, and testing. Never use in production.
254
+ *
255
+ * @param name - Dev account name ("Alice", "Bob", "Charlie", "Dave", "Eve", or "Ferdie").
256
+ * @returns A PolkadotSigner that can sign transactions.
257
+ *
258
+ * @example
259
+ * ```ts
260
+ * import { createDevSigner } from "@parity/product-sdk-tx";
261
+ *
262
+ * const alice = createDevSigner("Alice");
263
+ * const result = await submitAndWatch(tx, alice);
264
+ * ```
265
+ */
266
+ declare function createDevSigner(name: DevAccountName): PolkadotSigner;
267
+ /**
268
+ * Get the public key bytes for a dev account.
269
+ *
270
+ * Useful for address derivation or identity checks in tests without
271
+ * needing the full signer.
272
+ *
273
+ * @param name - Dev account name.
274
+ * @returns 32-byte Sr25519 public key.
275
+ */
276
+ declare function getDevPublicKey(name: DevAccountName): Uint8Array;
277
+
278
+ /**
279
+ * Validate an Ink SDK dry-run result and extract the submittable transaction.
280
+ *
281
+ * Replaces the 5-10 line boilerplate that every contract interaction repeats:
282
+ * check `success`, parse the error, verify `send()` exists, and call it.
283
+ *
284
+ * Works with any object whose shape matches the Ink SDK contract query result
285
+ * (typed structurally — no Ink SDK import required):
286
+ *
287
+ * - `contract.query("method", { origin, data })` (Ink SDK)
288
+ * - `contract.write("method", args, origin)` (patched SDK wrappers)
289
+ * - Any object with `{ success: boolean; value?: { send?(): ... } }`
290
+ *
291
+ * @param result - The dry-run result from a contract query or write simulation.
292
+ * @returns The submittable transaction, ready to pass to {@link submitAndWatch}.
293
+ * @throws {TxDryRunError} If the dry run failed or the result has no `send()`.
294
+ *
295
+ * @example
296
+ * ```ts
297
+ * import { extractTransaction, submitAndWatch, createDevSigner } from "@parity/product-sdk-tx";
298
+ *
299
+ * const dryRun = await contract.query("createItem", { origin, data: { name, price } });
300
+ * const tx = extractTransaction(dryRun);
301
+ * const result = await submitAndWatch(tx, createDevSigner("Alice"));
302
+ * ```
303
+ *
304
+ * @example Composing with retry logic:
305
+ * ```ts
306
+ * const tx = extractTransaction(await contract.query("transfer", { origin, data }));
307
+ * const result = await withRetry(() => submitAndWatch(tx, signer));
308
+ * ```
309
+ */
310
+ declare function extractTransaction(result: {
311
+ success: boolean;
312
+ value?: unknown;
313
+ error?: unknown;
314
+ }): SubmittableTransaction;
315
+ /**
316
+ * Apply a safety buffer to weight estimates from a dry-run result.
317
+ *
318
+ * Dry-run weight estimates reflect the exact execution cost at the time of
319
+ * simulation. On-chain conditions can change between dry-run and actual
320
+ * submission (storage growth, state changes by other transactions), so a
321
+ * buffer prevents unexpected `OutOfGas` failures.
322
+ *
323
+ * The default 25% buffer matches the convention used across Polkadot
324
+ * ecosystem tooling.
325
+ *
326
+ * @param weight - The `weight_required` from a `ReviveApi.call` or `ReviveApi.eth_transact` dry-run.
327
+ * @param options - Override the buffer percentage (default: 25%).
328
+ * @returns A new weight with both components scaled up.
329
+ *
330
+ * @example Basic usage with ReviveApi dry-run:
331
+ * ```ts
332
+ * const dryRun = await api.apis.ReviveApi.call(origin, dest, value, undefined, undefined, data);
333
+ *
334
+ * const tx = api.tx.Revive.call({
335
+ * dest, value, data,
336
+ * weight_limit: applyWeightBuffer(dryRun.weight_required),
337
+ * storage_deposit_limit: dryRun.storage_deposit.value,
338
+ * });
339
+ * ```
340
+ *
341
+ * @example Custom buffer for latency-sensitive operations:
342
+ * ```ts
343
+ * applyWeightBuffer(dryRun.weight_required, { percent: 50 });
344
+ * ```
345
+ */
346
+ declare function applyWeightBuffer(weight: Weight, options?: {
347
+ percent?: number;
348
+ }): Weight;
349
+
350
+ /**
351
+ * Error thrown when account mapping fails.
352
+ */
353
+ declare class TxAccountMappingError extends Error {
354
+ constructor(message: string, options?: ErrorOptions);
355
+ }
356
+ /**
357
+ * Minimal interface for checking if an address is mapped on-chain.
358
+ *
359
+ * The Ink SDK's `createInkSdk(client)` returns an object with this method.
360
+ * We accept it structurally to avoid importing `@polkadot-api/sdk-ink`.
361
+ */
362
+ interface MappingChecker {
363
+ addressIsMapped(address: string): Promise<boolean>;
364
+ }
365
+ /**
366
+ * Minimal typed API shape for `Revive.map_account()`.
367
+ *
368
+ * Accepted structurally so this module works with any PAPI typed API
369
+ * that has the Revive pallet, without importing chain-specific descriptors.
370
+ */
371
+ interface ReviveApi {
372
+ tx: {
373
+ Revive: {
374
+ map_account(): SubmittableTransaction;
375
+ };
376
+ };
377
+ }
378
+ /** Options for {@link ensureAccountMapped}. */
379
+ interface EnsureAccountMappedOptions {
380
+ /** Timeout in ms for the map_account transaction. Default: 60_000 (1 minute). */
381
+ timeoutMs?: number;
382
+ /** Called on mapping transaction status changes. */
383
+ onStatus?: (status: "checking" | "mapping" | "mapped" | "already-mapped") => void;
384
+ }
385
+ /**
386
+ * Ensure an account's SS58 address is mapped to its H160 EVM address on-chain.
387
+ *
388
+ * Account mapping is a prerequisite for any EVM contract interaction on Asset Hub.
389
+ * This function checks the on-chain mapping status and, if unmapped, submits a
390
+ * `Revive.map_account()` transaction and waits for inclusion.
391
+ *
392
+ * Idempotent — safe to call multiple times. Returns immediately if already mapped.
393
+ *
394
+ * @param address - The SS58 address to check/map.
395
+ * @param signer - The signer for the account (must match the address).
396
+ * @param checker - An object with `addressIsMapped()` (e.g., from `createInkSdk(client)`).
397
+ * @param api - A typed API with `tx.Revive.map_account()`.
398
+ * @param options - Optional timeout and status callback.
399
+ * @returns The transaction result if mapping was performed, or `null` if already mapped.
400
+ *
401
+ * @throws {TxAccountMappingError} If the mapping check or transaction fails.
402
+ * @throws {TxDispatchError} If the map_account transaction fails on-chain.
403
+ * @throws {TxTimeoutError} If the mapping transaction times out.
404
+ *
405
+ * @example
406
+ * ```ts
407
+ * import { ensureAccountMapped } from "@parity/product-sdk-tx";
408
+ * import { createInkSdk } from "@polkadot-api/sdk-ink";
409
+ *
410
+ * const inkSdk = createInkSdk(client);
411
+ * const api = client.getTypedApi(descriptor);
412
+ *
413
+ * await ensureAccountMapped(address, signer, inkSdk, api);
414
+ * // Account is now mapped — safe to call EVM contracts
415
+ * ```
416
+ */
417
+ declare function ensureAccountMapped(address: string, signer: PolkadotSigner, checker: MappingChecker, api: ReviveApi, options?: EnsureAccountMappedOptions): Promise<TxResult | null>;
418
+ /**
419
+ * Check if an address is mapped on-chain.
420
+ *
421
+ * Convenience wrapper around `checker.addressIsMapped()` with error handling.
422
+ */
423
+ declare function isAccountMapped(address: string, checker: MappingChecker): Promise<boolean>;
424
+
425
+ /** Base class for all transaction errors. Use `instanceof TxError` to catch any tx-related error. */
426
+ declare class TxError extends Error {
427
+ constructor(message: string, options?: ErrorOptions);
428
+ }
429
+ /** The transaction did not finalize within the configured timeout. It may still be processing on-chain. */
430
+ declare class TxTimeoutError extends TxError {
431
+ readonly timeoutMs: number;
432
+ constructor(timeoutMs: number);
433
+ }
434
+ /** The transaction was included on-chain but the dispatch failed. */
435
+ declare class TxDispatchError extends TxError {
436
+ /** Raw dispatch error from polkadot-api. */
437
+ readonly dispatchError: unknown;
438
+ /** Human-readable error string (e.g., "Revive.ContractReverted"). */
439
+ readonly formatted: string;
440
+ constructor(dispatchError: unknown, formatted: string);
441
+ }
442
+ /** The user rejected the signing request in their wallet. */
443
+ declare class TxSigningRejectedError extends TxError {
444
+ constructor();
445
+ }
446
+ /**
447
+ * Extract a human-readable error from a transaction result's dispatch error.
448
+ *
449
+ * PAPI dispatch errors for pallet modules are nested:
450
+ * `{ type: "Module", value: { type: "Revive", value: { type: "ContractReverted" } } }`
451
+ *
452
+ * This walks the chain to build a string like `"Revive.ContractReverted"`.
453
+ *
454
+ * @param result - A transaction result with `ok` and optional `dispatchError`.
455
+ * @returns A human-readable error string, or `""` if the result is ok, or `"unknown error"` if
456
+ * the dispatch error cannot be decoded.
457
+ */
458
+ declare function formatDispatchError(result: {
459
+ ok: boolean;
460
+ dispatchError?: unknown;
461
+ }): string;
462
+ /** Error specific to batch transaction construction (e.g., empty calls array). */
463
+ declare class TxBatchError extends TxError {
464
+ constructor(message: string);
465
+ }
466
+ /**
467
+ * A dry-run simulation failed before the transaction was submitted on-chain.
468
+ *
469
+ * Thrown by {@link extractTransaction} when the dry-run result indicates failure.
470
+ * Carries structured error information so callers can distinguish revert reasons
471
+ * from dispatch errors programmatically.
472
+ *
473
+ * @example
474
+ * ```ts
475
+ * try {
476
+ * const tx = extractTransaction(await contract.query("mint", { origin, data }));
477
+ * } catch (e) {
478
+ * if (e instanceof TxDryRunError) {
479
+ * console.log(e.revertReason); // "InsufficientBalance" (if contract provided one)
480
+ * console.log(e.formatted); // "Revive.StorageDepositNotEnoughFunds"
481
+ * }
482
+ * }
483
+ * ```
484
+ */
485
+ declare class TxDryRunError extends TxError {
486
+ /** The raw dry-run result for programmatic inspection. */
487
+ readonly raw: unknown;
488
+ /** Human-readable error string derived from the dry-run result. */
489
+ readonly formatted: string;
490
+ /** Solidity revert reason, if the contract provided one. */
491
+ readonly revertReason?: string;
492
+ constructor(raw: unknown, formatted: string, revertReason?: string);
493
+ }
494
+ /**
495
+ * Extract a human-readable error from a failed dry-run result.
496
+ *
497
+ * Handles every error shape found across the Polkadot contract ecosystem:
498
+ *
499
+ * 1. **Revert reason** (Ink SDK patched results / EVM contracts):
500
+ * `{ value: { revertReason: "InsufficientBalance" } }`
501
+ *
502
+ * 2. **Nested dispatch errors** (raw Ink SDK / pallet errors):
503
+ * `{ value: { type: "Module", value: { type: "Revive", value: { type: "StorageDepositNotEnoughFunds" } } } }`
504
+ * Delegates to {@link formatDispatchError} for the Module.Pallet.Error chain.
505
+ *
506
+ * 3. **ReviveApi runtime messages** (`eth_transact` / `ReviveApi.call`):
507
+ * `{ value: { type: "Message", value: "Insufficient balance for gas * price + value" } }`
508
+ *
509
+ * 4. **ReviveApi contract revert data**:
510
+ * `{ value: { type: "Data", value: "0x08c379a0..." } }`
511
+ *
512
+ * 5. **Wrapped raw errors** (patched SDK wrappers):
513
+ * `{ value: { raw: { type: "Message", value: "..." } } }`
514
+ *
515
+ * 6. **Generic error field**:
516
+ * `{ error: { type: "ContractTrapped" } }` or `{ error: { name: "..." } }`
517
+ *
518
+ * @param result - A dry-run result with at least `success`, and optionally `value` / `error`.
519
+ * @returns A human-readable error string, or `""` if the result succeeded.
520
+ */
521
+ declare function formatDryRunError(result: {
522
+ success?: boolean;
523
+ value?: unknown;
524
+ error?: unknown;
525
+ }): string;
526
+ /**
527
+ * Check if an error looks like a user-rejected signing request.
528
+ *
529
+ * Different wallets use different error messages when the user rejects signing:
530
+ * "Cancelled", "Rejected", "User rejected", "denied". This checks for common
531
+ * patterns as a best-effort heuristic. Non-Error values always return false.
532
+ *
533
+ * @param error - The error to check.
534
+ * @returns `true` if the error message matches a known rejection pattern.
535
+ */
536
+ declare function isSigningRejection(error: unknown): boolean;
537
+
538
+ export { type BatchApi, type BatchMode, type BatchSubmitOptions, type BatchableCall, type DevAccountName, type EnsureAccountMappedOptions, type MappingChecker, type RetryOptions, type ReviveApi, type SubmitOptions, type SubmittableTransaction, TxAccountMappingError, TxBatchError, TxDispatchError, TxDryRunError, TxError, type TxEvent, type TxResult, TxSigningRejectedError, type TxStatus, TxTimeoutError, type WaitFor, type Weight, applyWeightBuffer, batchSubmitAndWatch, calculateDelay, createDevSigner, ensureAccountMapped, extractTransaction, formatDispatchError, formatDryRunError, getDevPublicKey, isAccountMapped, isSigningRejection, submitAndWatch, withRetry };