@polkadot-apps/tx 0.2.4 → 0.2.6

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/README.md ADDED
@@ -0,0 +1,259 @@
1
+ # @polkadot-apps/tx
2
+
3
+ Transaction submission, lifecycle watching, and dev signers for Polkadot chains.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @polkadot-apps/tx
9
+ ```
10
+
11
+ **Peer dependency**: `polkadot-api` must be installed in your project.
12
+
13
+ ```bash
14
+ pnpm add polkadot-api
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ ```typescript
20
+ import { submitAndWatch, createDevSigner } from "@polkadot-apps/tx";
21
+
22
+ const signer = createDevSigner("Alice");
23
+
24
+ const result = await submitAndWatch(tx, signer, {
25
+ waitFor: "finalized",
26
+ onStatus: (status) => console.log(status),
27
+ });
28
+
29
+ console.log(result.txHash, result.ok);
30
+ ```
31
+
32
+ ## Transaction lifecycle
33
+
34
+ `submitAndWatch` drives a transaction through its full lifecycle: signing, broadcasting, block inclusion, and optional finalization. You choose when to resolve the returned promise with the `waitFor` option.
35
+
36
+ ```typescript
37
+ import { submitAndWatch } from "@polkadot-apps/tx";
38
+
39
+ const result = await submitAndWatch(tx, signer, {
40
+ waitFor: "best-block", // resolve at best-block inclusion (default)
41
+ timeoutMs: 300_000, // 5-minute timeout (default)
42
+ mortalityPeriod: 256, // ~43 minutes on Polkadot (default)
43
+ onStatus: (status) => {
44
+ // "signing" -> "broadcasting" -> "in-block" -> "finalized"
45
+ updateUI(status);
46
+ },
47
+ });
48
+
49
+ if (!result.ok) {
50
+ console.error("Dispatch failed:", result.dispatchError);
51
+ }
52
+ ```
53
+
54
+ The function accepts both raw PAPI transactions and Ink SDK `AsyncTransaction` wrappers. Ink SDK wrappers are resolved automatically via the `.waited` promise.
55
+
56
+ ## Dev signers
57
+
58
+ Create signers from the well-known Substrate dev mnemonic for local testing. All keys derive at `//Name` using sr25519.
59
+
60
+ ```typescript
61
+ import { createDevSigner, getDevPublicKey } from "@polkadot-apps/tx";
62
+
63
+ const alice = createDevSigner("Alice");
64
+ const bobPubKey = getDevPublicKey("Bob"); // Uint8Array (32 bytes)
65
+ ```
66
+
67
+ Available names: `"Alice"`, `"Bob"`, `"Charlie"`, `"Dave"`, `"Eve"`, `"Ferdie"`.
68
+
69
+ ## Dry-run and weight buffers
70
+
71
+ Extract a submittable transaction from an Ink SDK dry-run result and apply a safety buffer to weight estimates before submission.
72
+
73
+ ```typescript
74
+ import { extractTransaction, applyWeightBuffer } from "@polkadot-apps/tx";
75
+
76
+ const dryRunResult = await contract.query.myMethod(args);
77
+ const tx = extractTransaction(dryRunResult);
78
+
79
+ const buffered = applyWeightBuffer(dryRunResult.weight_required, {
80
+ bufferPercent: 25, // default: 25%
81
+ });
82
+ ```
83
+
84
+ ## Account mapping
85
+
86
+ Map an SS58 address to an H160 address on Asset Hub. The operation is idempotent -- it returns `null` when the account is already mapped.
87
+
88
+ ```typescript
89
+ import { ensureAccountMapped, isAccountMapped } from "@polkadot-apps/tx";
90
+
91
+ const mapped = await isAccountMapped(address, checker);
92
+
93
+ if (!mapped) {
94
+ const result = await ensureAccountMapped(address, signer, checker, api);
95
+ // result is TxResult or null (if already mapped)
96
+ }
97
+ ```
98
+
99
+ ## Retry logic
100
+
101
+ `withRetry` wraps any async function with exponential backoff and jitter. It does **not** retry `TxDispatchError`, `TxSigningRejectedError`, or `TxTimeoutError` -- these represent terminal conditions that retrying cannot fix.
102
+
103
+ ```typescript
104
+ import { withRetry, calculateDelay } from "@polkadot-apps/tx";
105
+
106
+ const result = await withRetry(() => submitAndWatch(tx, signer), {
107
+ maxAttempts: 3, // total attempts including the first (default)
108
+ baseDelayMs: 1_000, // initial backoff (default)
109
+ maxDelayMs: 15_000, // backoff cap (default)
110
+ });
111
+
112
+ // Calculate delay directly for custom retry strategies
113
+ const delay = calculateDelay(2, 1_000, 15_000);
114
+ ```
115
+
116
+ ## Error handling
117
+
118
+ All errors extend a common `TxError` base class. Use the specific error types and utility functions to handle failures precisely.
119
+
120
+ ```typescript
121
+ import {
122
+ TxTimeoutError,
123
+ TxDispatchError,
124
+ TxSigningRejectedError,
125
+ TxDryRunError,
126
+ TxAccountMappingError,
127
+ formatDispatchError,
128
+ formatDryRunError,
129
+ isSigningRejection,
130
+ } from "@polkadot-apps/tx";
131
+
132
+ try {
133
+ await submitAndWatch(tx, signer);
134
+ } catch (error) {
135
+ if (isSigningRejection(error)) {
136
+ console.log("User cancelled signing");
137
+ } else if (error instanceof TxDispatchError) {
138
+ console.error(error.formatted, error.dispatchError);
139
+ } else if (error instanceof TxTimeoutError) {
140
+ console.error(`Timed out after ${error.timeoutMs}ms`);
141
+ } else if (error instanceof TxDryRunError) {
142
+ console.error(error.formatted, error.revertReason);
143
+ }
144
+ }
145
+ ```
146
+
147
+ ## API
148
+
149
+ ### `submitAndWatch(tx, signer, options?): Promise<TxResult>`
150
+
151
+ Submit a transaction and watch its lifecycle through to inclusion or finalization.
152
+
153
+ | Parameter | Type | Description |
154
+ |-----------|------|-------------|
155
+ | `tx` | `SubmittableTransaction` | Transaction with `signSubmitAndWatch`. Raw PAPI or Ink SDK. |
156
+ | `signer` | `PolkadotSigner` | Signer from a wallet, Host API, or `createDevSigner`. |
157
+ | `options` | `SubmitOptions` | Optional. See below. |
158
+
159
+ **Throws**: `TxTimeoutError`, `TxDispatchError`, `TxSigningRejectedError`.
160
+
161
+ ### `createDevSigner(name): PolkadotSigner`
162
+
163
+ Create a signer from the well-known dev mnemonic at `//Name` (sr25519).
164
+
165
+ | Parameter | Type | Description |
166
+ |-----------|------|-------------|
167
+ | `name` | `DevAccountName` | One of `"Alice"`, `"Bob"`, `"Charlie"`, `"Dave"`, `"Eve"`, `"Ferdie"`. |
168
+
169
+ ### `getDevPublicKey(name): Uint8Array`
170
+
171
+ Return the 32-byte public key for a dev account.
172
+
173
+ ### `withRetry<T>(fn, options?): Promise<T>`
174
+
175
+ Retry an async function with exponential backoff and jitter. Does not retry `TxDispatchError`, `TxSigningRejectedError`, or `TxTimeoutError`.
176
+
177
+ | Parameter | Type | Description |
178
+ |-----------|------|-------------|
179
+ | `fn` | `() => Promise<T>` | Async function to retry. |
180
+ | `options` | `RetryOptions` | Optional retry configuration. |
181
+
182
+ ### `calculateDelay(attempt, baseDelayMs, maxDelayMs): number`
183
+
184
+ Compute the backoff delay for a given attempt number, with jitter.
185
+
186
+ ### `extractTransaction(result): SubmittableTransaction`
187
+
188
+ Extract a submittable transaction from an Ink SDK dry-run result.
189
+
190
+ ### `applyWeightBuffer(weight, options?): Weight`
191
+
192
+ Apply a percentage safety buffer to a weight estimate. Default buffer is 25%.
193
+
194
+ ### `ensureAccountMapped(address, signer, checker, api, options?): Promise<TxResult | null>`
195
+
196
+ Map an SS58 address to H160 on Asset Hub. Returns `null` if the account is already mapped.
197
+
198
+ ### `isAccountMapped(address, checker): Promise<boolean>`
199
+
200
+ Check whether an SS58 address is already mapped to an H160 address.
201
+
202
+ ### Error utilities
203
+
204
+ | Function | Signature | Description |
205
+ |----------|-----------|-------------|
206
+ | `formatDispatchError` | `(result) => string` | Format a dispatch error into a readable string. |
207
+ | `formatDryRunError` | `(result) => string` | Format a dry-run error into a readable string. |
208
+ | `isSigningRejection` | `(error) => boolean` | Check if an error is a signing rejection. |
209
+
210
+ ## Types
211
+
212
+ ```typescript
213
+ type TxStatus = "signing" | "broadcasting" | "in-block" | "finalized" | "error";
214
+
215
+ type WaitFor = "best-block" | "finalized";
216
+
217
+ interface TxResult {
218
+ txHash: string;
219
+ ok: boolean;
220
+ block: { hash: string; number: number; index: number };
221
+ events: unknown[];
222
+ dispatchError?: unknown;
223
+ }
224
+
225
+ interface SubmitOptions {
226
+ waitFor?: WaitFor; // default: "best-block"
227
+ timeoutMs?: number; // default: 300_000
228
+ mortalityPeriod?: number; // default: 256
229
+ onStatus?: (status: TxStatus) => void;
230
+ }
231
+
232
+ interface RetryOptions {
233
+ maxAttempts?: number; // default: 3
234
+ baseDelayMs?: number; // default: 1_000
235
+ maxDelayMs?: number; // default: 15_000
236
+ }
237
+
238
+ type DevAccountName = "Alice" | "Bob" | "Charlie" | "Dave" | "Eve" | "Ferdie";
239
+
240
+ interface Weight {
241
+ ref_time: bigint;
242
+ proof_size: bigint;
243
+ }
244
+ ```
245
+
246
+ ### Error classes
247
+
248
+ | Class | Extends | Key properties |
249
+ |-------|---------|---------------|
250
+ | `TxError` | `Error` | Base class for all tx errors. |
251
+ | `TxTimeoutError` | `TxError` | `timeoutMs: number` |
252
+ | `TxDispatchError` | `TxError` | `dispatchError: unknown`, `formatted: string` |
253
+ | `TxSigningRejectedError` | `TxError` | User rejected signing. |
254
+ | `TxDryRunError` | `TxError` | `raw: unknown`, `formatted: string`, `revertReason?: string` |
255
+ | `TxAccountMappingError` | `TxError` | Account mapping failed. |
256
+
257
+ ## License
258
+
259
+ Apache-2.0
@@ -0,0 +1,77 @@
1
+ import type { PolkadotSigner } from "polkadot-api";
2
+ import type { SubmittableTransaction, TxResult } from "./types.js";
3
+ /**
4
+ * Error thrown when account mapping fails.
5
+ */
6
+ export declare class TxAccountMappingError extends Error {
7
+ constructor(message: string, options?: ErrorOptions);
8
+ }
9
+ /**
10
+ * Minimal interface for checking if an address is mapped on-chain.
11
+ *
12
+ * The Ink SDK's `createInkSdk(client)` returns an object with this method.
13
+ * We accept it structurally to avoid importing `@polkadot-api/sdk-ink`.
14
+ */
15
+ export interface MappingChecker {
16
+ addressIsMapped(address: string): Promise<boolean>;
17
+ }
18
+ /**
19
+ * Minimal typed API shape for `Revive.map_account()`.
20
+ *
21
+ * Accepted structurally so this module works with any PAPI typed API
22
+ * that has the Revive pallet, without importing chain-specific descriptors.
23
+ */
24
+ export interface ReviveApi {
25
+ tx: {
26
+ Revive: {
27
+ map_account(): SubmittableTransaction;
28
+ };
29
+ };
30
+ }
31
+ /** Options for {@link ensureAccountMapped}. */
32
+ export interface EnsureAccountMappedOptions {
33
+ /** Timeout in ms for the map_account transaction. Default: 60_000 (1 minute). */
34
+ timeoutMs?: number;
35
+ /** Called on mapping transaction status changes. */
36
+ onStatus?: (status: "checking" | "mapping" | "mapped" | "already-mapped") => void;
37
+ }
38
+ /**
39
+ * Ensure an account's SS58 address is mapped to its H160 EVM address on-chain.
40
+ *
41
+ * Account mapping is a prerequisite for any EVM contract interaction on Asset Hub.
42
+ * This function checks the on-chain mapping status and, if unmapped, submits a
43
+ * `Revive.map_account()` transaction and waits for inclusion.
44
+ *
45
+ * Idempotent — safe to call multiple times. Returns immediately if already mapped.
46
+ *
47
+ * @param address - The SS58 address to check/map.
48
+ * @param signer - The signer for the account (must match the address).
49
+ * @param checker - An object with `addressIsMapped()` (e.g., from `createInkSdk(client)`).
50
+ * @param api - A typed API with `tx.Revive.map_account()`.
51
+ * @param options - Optional timeout and status callback.
52
+ * @returns The transaction result if mapping was performed, or `null` if already mapped.
53
+ *
54
+ * @throws {TxAccountMappingError} If the mapping check or transaction fails.
55
+ * @throws {TxDispatchError} If the map_account transaction fails on-chain.
56
+ * @throws {TxTimeoutError} If the mapping transaction times out.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * import { ensureAccountMapped } from "@polkadot-apps/tx";
61
+ * import { createInkSdk } from "@polkadot-api/sdk-ink";
62
+ *
63
+ * const inkSdk = createInkSdk(client);
64
+ * const api = client.getTypedApi(descriptor);
65
+ *
66
+ * await ensureAccountMapped(address, signer, inkSdk, api);
67
+ * // Account is now mapped — safe to call EVM contracts
68
+ * ```
69
+ */
70
+ export declare function ensureAccountMapped(address: string, signer: PolkadotSigner, checker: MappingChecker, api: ReviveApi, options?: EnsureAccountMappedOptions): Promise<TxResult | null>;
71
+ /**
72
+ * Check if an address is mapped on-chain.
73
+ *
74
+ * Convenience wrapper around `checker.addressIsMapped()` with error handling.
75
+ */
76
+ export declare function isAccountMapped(address: string, checker: MappingChecker): Promise<boolean>;
77
+ //# sourceMappingURL=account-mapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-mapping.d.ts","sourceRoot":"","sources":["../src/account-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAKnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAInE;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAItD;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC3B,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtD;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACtB,EAAE,EAAE;QACA,MAAM,EAAE;YACJ,WAAW,IAAI,sBAAsB,CAAC;SACzC,CAAC;KACL,CAAC;CACL;AAED,+CAA+C;AAC/C,MAAM,WAAW,0BAA0B;IACvC,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,gBAAgB,KAAK,IAAI,CAAC;CACrF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,mBAAmB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,cAAc,EACvB,GAAG,EAAE,SAAS,EACd,OAAO,CAAC,EAAE,0BAA0B,GACrC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAkC1B;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAMhG"}
@@ -0,0 +1,243 @@
1
+ import { createLogger } from "@polkadot-apps/logger";
2
+ import { submitAndWatch } from "./submit.js";
3
+ const log = createLogger("tx:mapping");
4
+ /**
5
+ * Error thrown when account mapping fails.
6
+ */
7
+ export class TxAccountMappingError extends Error {
8
+ constructor(message, options) {
9
+ super(message, options);
10
+ this.name = "TxAccountMappingError";
11
+ }
12
+ }
13
+ /**
14
+ * Ensure an account's SS58 address is mapped to its H160 EVM address on-chain.
15
+ *
16
+ * Account mapping is a prerequisite for any EVM contract interaction on Asset Hub.
17
+ * This function checks the on-chain mapping status and, if unmapped, submits a
18
+ * `Revive.map_account()` transaction and waits for inclusion.
19
+ *
20
+ * Idempotent — safe to call multiple times. Returns immediately if already mapped.
21
+ *
22
+ * @param address - The SS58 address to check/map.
23
+ * @param signer - The signer for the account (must match the address).
24
+ * @param checker - An object with `addressIsMapped()` (e.g., from `createInkSdk(client)`).
25
+ * @param api - A typed API with `tx.Revive.map_account()`.
26
+ * @param options - Optional timeout and status callback.
27
+ * @returns The transaction result if mapping was performed, or `null` if already mapped.
28
+ *
29
+ * @throws {TxAccountMappingError} If the mapping check or transaction fails.
30
+ * @throws {TxDispatchError} If the map_account transaction fails on-chain.
31
+ * @throws {TxTimeoutError} If the mapping transaction times out.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * import { ensureAccountMapped } from "@polkadot-apps/tx";
36
+ * import { createInkSdk } from "@polkadot-api/sdk-ink";
37
+ *
38
+ * const inkSdk = createInkSdk(client);
39
+ * const api = client.getTypedApi(descriptor);
40
+ *
41
+ * await ensureAccountMapped(address, signer, inkSdk, api);
42
+ * // Account is now mapped — safe to call EVM contracts
43
+ * ```
44
+ */
45
+ export async function ensureAccountMapped(address, signer, checker, api, options) {
46
+ const timeoutMs = options?.timeoutMs ?? 60_000;
47
+ const onStatus = options?.onStatus;
48
+ // Step 1: Check if already mapped
49
+ onStatus?.("checking");
50
+ let isMapped;
51
+ try {
52
+ isMapped = await checker.addressIsMapped(address);
53
+ }
54
+ catch (cause) {
55
+ throw new TxAccountMappingError(`Failed to check mapping status for ${address}`, { cause });
56
+ }
57
+ if (isMapped) {
58
+ log.debug("account already mapped", { address });
59
+ onStatus?.("already-mapped");
60
+ return null;
61
+ }
62
+ // Step 2: Submit map_account transaction
63
+ log.info("mapping account", { address });
64
+ onStatus?.("mapping");
65
+ const tx = api.tx.Revive.map_account();
66
+ // submitAndWatch throws TxDispatchError on dispatch failure and
67
+ // TxTimeoutError on timeout — both propagate to the caller as documented.
68
+ const result = await submitAndWatch(tx, signer, {
69
+ waitFor: "best-block",
70
+ timeoutMs,
71
+ });
72
+ log.info("account mapped successfully", { address, block: result.block });
73
+ onStatus?.("mapped");
74
+ return result;
75
+ }
76
+ /**
77
+ * Check if an address is mapped on-chain.
78
+ *
79
+ * Convenience wrapper around `checker.addressIsMapped()` with error handling.
80
+ */
81
+ export async function isAccountMapped(address, checker) {
82
+ try {
83
+ return await checker.addressIsMapped(address);
84
+ }
85
+ catch (cause) {
86
+ throw new TxAccountMappingError(`Failed to check mapping status for ${address}`, { cause });
87
+ }
88
+ }
89
+ if (import.meta.vitest) {
90
+ const { describe, test, expect, vi } = import.meta.vitest;
91
+ describe("ensureAccountMapped", () => {
92
+ const mockSigner = {};
93
+ test("returns null when already mapped", async () => {
94
+ const checker = {
95
+ addressIsMapped: vi.fn().mockResolvedValue(true),
96
+ };
97
+ const api = {};
98
+ const result = await ensureAccountMapped("5Alice", mockSigner, checker, api);
99
+ expect(result).toBeNull();
100
+ expect(checker.addressIsMapped).toHaveBeenCalledWith("5Alice");
101
+ });
102
+ test("calls onStatus with already-mapped when mapped", async () => {
103
+ const statuses = [];
104
+ const checker = {
105
+ addressIsMapped: vi.fn().mockResolvedValue(true),
106
+ };
107
+ await ensureAccountMapped("5Alice", mockSigner, checker, {}, {
108
+ onStatus: (s) => statuses.push(s),
109
+ });
110
+ expect(statuses).toEqual(["checking", "already-mapped"]);
111
+ });
112
+ test("throws TxAccountMappingError when check fails", async () => {
113
+ const checker = {
114
+ addressIsMapped: vi.fn().mockRejectedValue(new Error("network error")),
115
+ };
116
+ await expect(ensureAccountMapped("5Alice", mockSigner, checker, {})).rejects.toThrow(TxAccountMappingError);
117
+ });
118
+ test("submits map_account when not mapped", async () => {
119
+ const checker = {
120
+ addressIsMapped: vi.fn().mockResolvedValue(false),
121
+ };
122
+ const mockTx = {
123
+ signSubmitAndWatch: (_signer, _options) => ({
124
+ subscribe: (handlers) => {
125
+ queueMicrotask(() => {
126
+ handlers.next({ type: "signed", txHash: "0xabc" });
127
+ handlers.next({
128
+ type: "txBestBlocksState",
129
+ txHash: "0xabc",
130
+ found: true,
131
+ ok: true,
132
+ events: [],
133
+ block: { hash: "0xblock", number: 1, index: 0 },
134
+ });
135
+ });
136
+ return { unsubscribe: () => { } };
137
+ },
138
+ }),
139
+ };
140
+ const api = {
141
+ tx: { Revive: { map_account: () => mockTx } },
142
+ };
143
+ const result = await ensureAccountMapped("5Alice", mockSigner, checker, api);
144
+ expect(result).not.toBeNull();
145
+ expect(result.ok).toBe(true);
146
+ });
147
+ test("calls onStatus through full mapping flow", async () => {
148
+ const statuses = [];
149
+ const checker = {
150
+ addressIsMapped: vi.fn().mockResolvedValue(false),
151
+ };
152
+ const mockTx = {
153
+ signSubmitAndWatch: (_signer, _options) => ({
154
+ subscribe: (handlers) => {
155
+ queueMicrotask(() => {
156
+ handlers.next({ type: "signed", txHash: "0xabc" });
157
+ handlers.next({
158
+ type: "txBestBlocksState",
159
+ txHash: "0xabc",
160
+ found: true,
161
+ ok: true,
162
+ events: [],
163
+ block: { hash: "0xblock", number: 1, index: 0 },
164
+ });
165
+ });
166
+ return { unsubscribe: () => { } };
167
+ },
168
+ }),
169
+ };
170
+ const api = {
171
+ tx: { Revive: { map_account: () => mockTx } },
172
+ };
173
+ await ensureAccountMapped("5Alice", mockSigner, checker, api, {
174
+ onStatus: (s) => statuses.push(s),
175
+ });
176
+ expect(statuses).toEqual(["checking", "mapping", "mapped"]);
177
+ });
178
+ test("propagates TxDispatchError from submitAndWatch", async () => {
179
+ const { TxDispatchError } = await import("./errors.js");
180
+ const checker = {
181
+ addressIsMapped: vi.fn().mockResolvedValue(false),
182
+ };
183
+ const mockTx = {
184
+ signSubmitAndWatch: (_signer, _options) => ({
185
+ subscribe: (handlers) => {
186
+ queueMicrotask(() => {
187
+ handlers.next({
188
+ type: "txBestBlocksState",
189
+ txHash: "0xabc",
190
+ found: true,
191
+ ok: false,
192
+ events: [],
193
+ block: { hash: "0xblock", number: 1, index: 0 },
194
+ dispatchError: { type: "BadOrigin" },
195
+ });
196
+ });
197
+ return { unsubscribe: () => { } };
198
+ },
199
+ }),
200
+ };
201
+ const api = {
202
+ tx: { Revive: { map_account: () => mockTx } },
203
+ };
204
+ await expect(ensureAccountMapped("5Alice", mockSigner, checker, api)).rejects.toThrow(TxDispatchError);
205
+ });
206
+ test("propagates TxTimeoutError from submitAndWatch", async () => {
207
+ const { TxTimeoutError } = await import("./errors.js");
208
+ const checker = {
209
+ addressIsMapped: vi.fn().mockResolvedValue(false),
210
+ };
211
+ const mockTx = {
212
+ signSubmitAndWatch: (_signer, _options) => ({
213
+ subscribe: () => ({ unsubscribe: () => { } }),
214
+ }),
215
+ };
216
+ const api = {
217
+ tx: { Revive: { map_account: () => mockTx } },
218
+ };
219
+ await expect(ensureAccountMapped("5Alice", mockSigner, checker, api, { timeoutMs: 50 })).rejects.toThrow(TxTimeoutError);
220
+ });
221
+ });
222
+ describe("isAccountMapped", () => {
223
+ test("returns true when mapped", async () => {
224
+ const checker = {
225
+ addressIsMapped: vi.fn().mockResolvedValue(true),
226
+ };
227
+ expect(await isAccountMapped("5Alice", checker)).toBe(true);
228
+ });
229
+ test("returns false when not mapped", async () => {
230
+ const checker = {
231
+ addressIsMapped: vi.fn().mockResolvedValue(false),
232
+ };
233
+ expect(await isAccountMapped("5Alice", checker)).toBe(false);
234
+ });
235
+ test("throws TxAccountMappingError on failure", async () => {
236
+ const checker = {
237
+ addressIsMapped: vi.fn().mockRejectedValue(new Error("timeout")),
238
+ };
239
+ await expect(isAccountMapped("5Alice", checker)).rejects.toThrow(TxAccountMappingError);
240
+ });
241
+ });
242
+ }
243
+ //# sourceMappingURL=account-mapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-mapping.js","sourceRoot":"","sources":["../src/account-mapping.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAEvC;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC5C,YAAY,OAAe,EAAE,OAAsB;QAC/C,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACxC,CAAC;CACJ;AAkCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACrC,OAAe,EACf,MAAsB,EACtB,OAAuB,EACvB,GAAc,EACd,OAAoC;IAEpC,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,MAAM,CAAC;IAC/C,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;IAEnC,kCAAkC;IAClC,QAAQ,EAAE,CAAC,UAAU,CAAC,CAAC;IACvB,IAAI,QAAiB,CAAC;IACtB,IAAI,CAAC;QACD,QAAQ,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,qBAAqB,CAAC,sCAAsC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACX,GAAG,CAAC,KAAK,CAAC,wBAAwB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACjD,QAAQ,EAAE,CAAC,gBAAgB,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IAChB,CAAC;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EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;aACpD,CAAC;YACF,MAAM,CAAC,MAAM,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;YACvD,MAAM,OAAO,GAAmB;gBAC5B,eAAe,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;aACnE,CAAC;YACF,MAAM,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAC5F,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,6 +2,8 @@ export { submitAndWatch } from "./submit.js";
2
2
  export { withRetry, calculateDelay } from "./retry.js";
3
3
  export { createDevSigner, getDevPublicKey } from "./dev-signers.js";
4
4
  export { extractTransaction, applyWeightBuffer } from "./dry-run.js";
5
+ export { ensureAccountMapped, isAccountMapped, TxAccountMappingError } from "./account-mapping.js";
6
+ export type { MappingChecker, ReviveApi, EnsureAccountMappedOptions, } from "./account-mapping.js";
5
7
  export { TxError, TxTimeoutError, TxDispatchError, TxDryRunError, TxSigningRejectedError, formatDispatchError, formatDryRunError, isSigningRejection, } from "./errors.js";
6
8
  export type { TxStatus, WaitFor, TxResult, SubmitOptions, RetryOptions, DevAccountName, Weight, SubmittableTransaction, TxEvent, } from "./types.js";
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EACH,OAAO,EACP,cAAc,EACd,eAAe,EACf,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,cAAc,EACd,MAAM,EACN,sBAAsB,EACtB,OAAO,GACV,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACnG,YAAY,EACR,cAAc,EACd,SAAS,EACT,0BAA0B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,OAAO,EACP,cAAc,EACd,eAAe,EACf,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,cAAc,EACd,MAAM,EACN,sBAAsB,EACtB,OAAO,GACV,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -2,5 +2,6 @@ export { submitAndWatch } from "./submit.js";
2
2
  export { withRetry, calculateDelay } from "./retry.js";
3
3
  export { createDevSigner, getDevPublicKey } from "./dev-signers.js";
4
4
  export { extractTransaction, applyWeightBuffer } from "./dry-run.js";
5
+ export { ensureAccountMapped, isAccountMapped, TxAccountMappingError } from "./account-mapping.js";
5
6
  export { TxError, TxTimeoutError, TxDispatchError, TxDryRunError, TxSigningRejectedError, formatDispatchError, formatDryRunError, isSigningRejection, } from "./errors.js";
6
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EACH,OAAO,EACP,cAAc,EACd,eAAe,EACf,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAMnG,OAAO,EACH,OAAO,EACP,cAAc,EACd,eAAe,EACf,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@polkadot-apps/tx",
3
- "version": "0.2.4",
3
+ "description": "Transaction submission, lifecycle watching, and dev signers for Polkadot chains",
4
+ "version": "0.2.6",
4
5
  "type": "module",
5
6
  "main": "./dist/index.js",
6
7
  "types": "./dist/index.d.ts",
@@ -19,8 +20,8 @@
19
20
  "dependencies": {
20
21
  "polkadot-api": "^1.23.3",
21
22
  "@polkadot-labs/hdkd-helpers": "^0.0.27",
22
- "@polkadot-apps/keys": "0.3.1",
23
- "@polkadot-apps/logger": "0.1.3"
23
+ "@polkadot-apps/keys": "0.3.3",
24
+ "@polkadot-apps/logger": "0.1.4"
24
25
  },
25
26
  "devDependencies": {
26
27
  "typescript": "^5.9.3"