@parity/product-sdk-contracts 0.0.0-dev.312.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,99 @@
1
+ import { decodeFunctionData, bytesToHex, hexToBytes, encodeFunctionResult } from 'viem';
2
+
3
+ // src/testing.ts
4
+ var REVERT_FLAG = 1;
5
+ var textEncoder = new TextEncoder();
6
+ function fakeDryRunResult(options) {
7
+ const base = {
8
+ weight_consumed: { ref_time: 0n, proof_size: 0n },
9
+ weight_required: options?.weightRequired ?? { ref_time: 1n, proof_size: 1n },
10
+ storage_deposit: { type: "Refund", value: 0n },
11
+ max_storage_deposit: { type: "Refund", value: 0n },
12
+ gas_consumed: 0n
13
+ };
14
+ if (options?.failure !== void 0) {
15
+ return { ...base, result: { success: false, value: options.failure } };
16
+ }
17
+ if (options?.revert !== void 0 && options.revert !== false) {
18
+ const reason = typeof options.revert === "string" ? options.revert : "";
19
+ return {
20
+ ...base,
21
+ result: {
22
+ success: true,
23
+ value: { flags: REVERT_FLAG, data: textEncoder.encode(reason) }
24
+ }
25
+ };
26
+ }
27
+ return {
28
+ ...base,
29
+ result: { success: true, value: { flags: 0, data: options?.data ?? new Uint8Array(0) } }
30
+ };
31
+ }
32
+ function isDryRunResult(value) {
33
+ return typeof value === "object" && value !== null && "result" in value && "weight_required" in value;
34
+ }
35
+ function createFakeContractRuntime(options) {
36
+ const abi = options?.abi;
37
+ const calls = [];
38
+ const dryRunCall = async (origin, dest, value, _gasLimit, _storageDepositLimit, data) => {
39
+ let functionName;
40
+ let args;
41
+ if (abi) {
42
+ const decoded = decodeFunctionData({
43
+ abi,
44
+ data: bytesToHex(data)
45
+ });
46
+ functionName = decoded.functionName;
47
+ args = decoded.args ? [...decoded.args] : [];
48
+ }
49
+ const call = { origin, dest, value, data, functionName, args };
50
+ calls.push(call);
51
+ const out = options?.onQuery ? options.onQuery(call) : void 0;
52
+ if (isDryRunResult(out)) return out;
53
+ if (out instanceof Uint8Array) return fakeDryRunResult({ data: out });
54
+ if (out === void 0) return fakeDryRunResult();
55
+ if (!abi || !functionName) {
56
+ throw new Error(
57
+ "createFakeContractRuntime: onQuery returned a value but no abi is set to encode it. Pass `abi`, or return a Uint8Array or fakeDryRunResult()."
58
+ );
59
+ }
60
+ const encoded = hexToBytes(
61
+ encodeFunctionResult({
62
+ abi,
63
+ functionName,
64
+ result: out
65
+ })
66
+ );
67
+ return fakeDryRunResult({ data: encoded });
68
+ };
69
+ const api = {
70
+ tx: {
71
+ Revive: {
72
+ call: (built) => {
73
+ options?.onCall?.(built);
74
+ return {};
75
+ },
76
+ map_account: () => ({})
77
+ }
78
+ },
79
+ query: { Revive: { OriginalAccount: { getValue: async () => void 0 } } },
80
+ apis: {
81
+ ReviveApi: {
82
+ // Same signature as dryRunCall (it ignores the 7th `options` arg).
83
+ call: dryRunCall
84
+ }
85
+ }
86
+ };
87
+ return {
88
+ api,
89
+ dryRunCall,
90
+ calls,
91
+ reset() {
92
+ calls.length = 0;
93
+ }
94
+ };
95
+ }
96
+
97
+ export { createFakeContractRuntime, fakeDryRunResult };
98
+ //# sourceMappingURL=testing.js.map
99
+ //# sourceMappingURL=testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/testing.ts"],"names":[],"mappings":"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","file":"testing.js","sourcesContent":["// Copyright 2026 Parity Technologies (UK) Ltd.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Test fakes for `@parity/product-sdk-contracts`.\n *\n * `createFakeContractRuntime` is an in-memory `ContractRuntime` for\n * `createContract(runtime, address, abi)` — test `.query()` / `.prepare()` with\n * no chain and no deployed contract. `fakeDryRunResult` builds the fiddly\n * `ReviveDryRunResult` when you need full control over reverts / failures.\n *\n * @packageDocumentation\n */\nimport {\n type Abi as ViemAbi,\n bytesToHex,\n decodeFunctionData,\n encodeFunctionResult,\n hexToBytes,\n} from \"viem\";\nimport type { HexString, SS58String } from \"polkadot-api\";\nimport type { SubmittableTransaction, Weight } from \"@parity/product-sdk-tx\";\n\nimport type { ContractRuntime, ReviveDryRunResult, ReviveTypedApi } from \"./runtime.js\";\nimport type { AbiEntry } from \"./types.js\";\n\n/** pallet-revive sets bit 0 of `flags` when a call reverts (mirror of wrap.ts). */\nconst REVERT_FLAG = 1;\n\nconst textEncoder = new TextEncoder();\n\n/** Options for {@link fakeDryRunResult}. */\nexport interface FakeDryRunResultOptions {\n /** Raw ABI-encoded return bytes. Ignored when the runtime encodes for you. */\n data?: Uint8Array;\n /** Simulate a revert: `true` for an empty reason, a string for a UTF-8 reason. Sets the revert flag. */\n revert?: boolean | string;\n /** Simulate a dispatch failure (`result.success: false`) carrying this payload. */\n failure?: unknown;\n /** Weight surfaced as a query's `gasRequired`. Default `{ ref_time: 1n, proof_size: 1n }`. */\n weightRequired?: Weight;\n}\n\n/**\n * Build a {@link ReviveDryRunResult}. Defaults to a successful, empty return;\n * pass `data` for a raw payload, `revert` for a revert, or `failure` for a\n * dispatch error.\n */\nexport function fakeDryRunResult(options?: FakeDryRunResultOptions): ReviveDryRunResult {\n const base = {\n weight_consumed: { ref_time: 0n, proof_size: 0n },\n weight_required: options?.weightRequired ?? { ref_time: 1n, proof_size: 1n },\n storage_deposit: { type: \"Refund\" as const, value: 0n },\n max_storage_deposit: { type: \"Refund\" as const, value: 0n },\n gas_consumed: 0n,\n };\n if (options?.failure !== undefined) {\n return { ...base, result: { success: false, value: options.failure } };\n }\n if (options?.revert !== undefined && options.revert !== false) {\n const reason = typeof options.revert === \"string\" ? options.revert : \"\";\n return {\n ...base,\n result: {\n success: true,\n value: { flags: REVERT_FLAG, data: textEncoder.encode(reason) },\n },\n };\n }\n return {\n ...base,\n result: { success: true, value: { flags: 0, data: options?.data ?? new Uint8Array(0) } },\n };\n}\n\nfunction isDryRunResult(value: unknown): value is ReviveDryRunResult {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"result\" in value &&\n \"weight_required\" in value\n );\n}\n\n/** The dry-run / query a fake runtime was asked to perform. */\nexport interface DecodedContractCall {\n origin: SS58String;\n dest: HexString;\n value: bigint;\n data: Uint8Array;\n /** Decoded function name — present only when `abi` was supplied. */\n functionName?: string;\n /** Decoded arguments — present only when `abi` was supplied. */\n args?: unknown[];\n}\n\n/** The extrinsic a fake runtime was asked to build via `.tx()` / `.prepare()`. */\nexport interface BuiltContractCall {\n dest: HexString;\n value: bigint;\n weight_limit: Weight;\n storage_deposit_limit: bigint;\n data: Uint8Array;\n}\n\n/** A fake {@link ContractRuntime} with an inspection surface for tests. */\nexport interface FakeContractRuntime extends ContractRuntime {\n /** Every dry-run / query the runtime handled, in order. */\n readonly calls: ReadonlyArray<DecodedContractCall>;\n /** Clear the recorded calls. */\n reset(): void;\n}\n\n/** Options for {@link createFakeContractRuntime}. */\nexport interface CreateFakeContractRuntimeOptions {\n /**\n * ABI used to decode inbound calldata (so `onQuery` gets `functionName` /\n * `args`) and to encode a value `onQuery` returns. Omit only if `onQuery`\n * returns raw bytes or a {@link fakeDryRunResult}.\n */\n abi?: AbiEntry[];\n /**\n * Handle each query / dry-run. Return the value to decode to (encoded via\n * `abi`), raw bytes, or a {@link fakeDryRunResult}. Default: empty success.\n */\n onQuery?: (call: DecodedContractCall) => unknown;\n /** Called with the extrinsic `.tx()` / `.prepare()` builds. */\n onCall?: (call: BuiltContractCall) => void;\n}\n\n/**\n * Create an in-memory {@link ContractRuntime}.\n *\n * @example\n * ```ts\n * import { createContract } from \"@parity/product-sdk-contracts\";\n * import { createFakeContractRuntime } from \"@parity/product-sdk-contracts/testing\";\n *\n * const runtime = createFakeContractRuntime({\n * abi: erc20Abi,\n * onQuery: ({ functionName }) => (functionName === \"balanceOf\" ? 1000n : 0n),\n * });\n * const token = createContract(runtime, ADDRESS, erc20Abi);\n * const { value } = await token.balanceOf.query(HOLDER); // 1000n\n * ```\n */\nexport function createFakeContractRuntime(\n options?: CreateFakeContractRuntimeOptions,\n): FakeContractRuntime {\n const abi = options?.abi;\n const calls: DecodedContractCall[] = [];\n\n const dryRunCall: ContractRuntime[\"dryRunCall\"] = async (\n origin,\n dest,\n value,\n _gasLimit,\n _storageDepositLimit,\n data,\n ) => {\n let functionName: string | undefined;\n let args: unknown[] | undefined;\n if (abi) {\n const decoded = decodeFunctionData({\n abi: abi as unknown as ViemAbi,\n data: bytesToHex(data),\n });\n functionName = decoded.functionName;\n args = decoded.args ? [...decoded.args] : [];\n }\n const call: DecodedContractCall = { origin, dest, value, data, functionName, args };\n calls.push(call);\n\n const out = options?.onQuery ? options.onQuery(call) : undefined;\n if (isDryRunResult(out)) return out;\n if (out instanceof Uint8Array) return fakeDryRunResult({ data: out });\n if (out === undefined) return fakeDryRunResult();\n\n if (!abi || !functionName) {\n throw new Error(\n \"createFakeContractRuntime: onQuery returned a value but no abi is set to encode it. Pass `abi`, or return a Uint8Array or fakeDryRunResult().\",\n );\n }\n const encoded = hexToBytes(\n encodeFunctionResult({\n abi: abi as unknown as ViemAbi,\n functionName,\n result: out,\n }),\n );\n return fakeDryRunResult({ data: encoded });\n };\n\n const api: ReviveTypedApi = {\n tx: {\n Revive: {\n call: (built) => {\n options?.onCall?.(built);\n return {} as unknown as SubmittableTransaction;\n },\n map_account: () => ({}) as unknown as SubmittableTransaction,\n },\n },\n query: { Revive: { OriginalAccount: { getValue: async () => undefined } } },\n apis: {\n ReviveApi: {\n // Same signature as dryRunCall (it ignores the 7th `options` arg).\n call: dryRunCall,\n },\n },\n };\n\n return {\n api,\n dryRunCall,\n calls,\n reset() {\n calls.length = 0;\n },\n } satisfies FakeContractRuntime;\n}\n\nif (import.meta.vitest) {\n // Round-trip guard: drive the fake through the *real* createContract.\n const { describe, test, expect } = import.meta.vitest;\n const { createContract } = await import(\"./manager.js\");\n\n const abi: AbiEntry[] = [\n {\n type: \"function\",\n name: \"balanceOf\",\n stateMutability: \"view\",\n inputs: [{ name: \"owner\", type: \"address\" }],\n outputs: [{ name: \"\", type: \"uint256\" }],\n },\n {\n type: \"function\",\n name: \"transfer\",\n stateMutability: \"nonpayable\",\n inputs: [\n { name: \"to\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n outputs: [{ name: \"\", type: \"bool\" }],\n },\n ];\n\n const CONTRACT = `0x${\"22\".repeat(20)}` as HexString;\n const HOLDER = `0x${\"11\".repeat(20)}` as HexString;\n\n // Minimal typed handle for the two ABI methods above.\n type TestToken = {\n balanceOf: {\n query: (\n owner: HexString,\n ) => Promise<{ success: true; value: bigint } | { success: false; value: unknown }>;\n };\n transfer: {\n prepare: (\n to: HexString,\n amount: bigint,\n opts?: { gasLimit?: Weight; storageDepositLimit?: bigint },\n ) => Promise<unknown>;\n };\n };\n const makeToken = (runtime: ContractRuntime) =>\n createContract(runtime, CONTRACT, abi) as unknown as TestToken;\n\n describe(\"createFakeContractRuntime\", () => {\n test(\"query decodes a value the runtime encodes from onQuery\", async () => {\n const runtime = createFakeContractRuntime({\n abi,\n onQuery: ({ functionName }) => (functionName === \"balanceOf\" ? 1000n : 0n),\n });\n const token = makeToken(runtime);\n\n const res = await token.balanceOf.query(HOLDER);\n expect(res.success).toBe(true);\n if (res.success) expect(res.value).toBe(1000n);\n expect(runtime.calls[0]?.functionName).toBe(\"balanceOf\");\n });\n\n test(\"query surfaces a revert as success:false\", async () => {\n const runtime = createFakeContractRuntime({\n abi,\n onQuery: () => fakeDryRunResult({ revert: \"InsufficientBalance\" }),\n });\n const res = await makeToken(runtime).balanceOf.query(HOLDER);\n expect(res.success).toBe(false);\n });\n\n test(\"query surfaces a dispatch failure with its payload\", async () => {\n const runtime = createFakeContractRuntime({\n abi,\n onQuery: () => fakeDryRunResult({ failure: { type: \"AccountNotMapped\" } }),\n });\n const res = await makeToken(runtime).balanceOf.query(HOLDER);\n expect(res.success).toBe(false);\n expect(res.value).toEqual({ type: \"AccountNotMapped\" });\n });\n\n test(\"prepare builds an extrinsic that onCall captures\", async () => {\n let captured: BuiltContractCall | undefined;\n const runtime = createFakeContractRuntime({\n abi,\n onCall: (c) => {\n captured = c;\n },\n });\n // Supply both limits so the sizing dry-run is skipped (no origin needed).\n await makeToken(runtime).transfer.prepare(HOLDER, 5n, {\n gasLimit: { ref_time: 100n, proof_size: 200n },\n storageDepositLimit: 0n,\n });\n\n expect(captured?.dest).toBe(CONTRACT);\n expect(captured?.value).toBe(0n);\n expect(captured?.weight_limit).toEqual({ ref_time: 100n, proof_size: 200n });\n expect(captured?.data).toBeInstanceOf(Uint8Array);\n });\n });\n}\n"]}
@@ -0,0 +1,552 @@
1
+ import { Result } from '@parity/result';
2
+ import { SignerManager } from '@parity/product-sdk-signer';
3
+ import { Weight, SubmittableTransaction, TxResult, TxError, SubmitOptions, BatchableCall } from '@parity/product-sdk-tx';
4
+ import { HexString, SS58String, PolkadotClient, PolkadotSigner } from 'polkadot-api';
5
+ import { SdkError } from '@parity/product-sdk-errors';
6
+
7
+ /**
8
+ * Base class for all contract errors. Use `instanceof ContractError` to catch any
9
+ * contract-related error. Implements the cross-package {@link SdkError} marker so
10
+ * `isSdkError(e)` also recognizes it.
11
+ */
12
+ declare class ContractError extends Error implements SdkError {
13
+ readonly isSdkError: true;
14
+ readonly source = "contracts";
15
+ constructor(message: string, options?: ErrorOptions);
16
+ }
17
+ /** No signer was available for a transaction call. */
18
+ declare class ContractSignerMissingError extends ContractError {
19
+ constructor();
20
+ }
21
+ /** A contract was not found in the cdm.json manifest. */
22
+ declare class ContractNotFoundError extends ContractError {
23
+ readonly library: string;
24
+ constructor(library: string);
25
+ }
26
+ /**
27
+ * A dry-run / transaction origin was not a valid SS58 address.
28
+ *
29
+ * Raised *before* the origin reaches PAPI's `AccountId` codec, which would
30
+ * otherwise fail deep inside the encode stack with a bare `Invalid checksum`
31
+ * and no hint that the origin was the wrong format. The most common mistake
32
+ * is passing the account's H160 (`0x…`): pallet-revive derives the H160
33
+ * `msg.sender` *from* the SS58 origin, so the origin itself must be SS58 —
34
+ * the message calls that case out with a `h160ToSs58` pointer.
35
+ *
36
+ * Deliberately a validation error, not an auto-conversion: silently converting
37
+ * an H160 here would hide which account the caller believes is calling.
38
+ */
39
+ declare class ContractInvalidOriginError extends ContractError {
40
+ /** The rejected origin value. */
41
+ readonly origin: string;
42
+ constructor(origin: string);
43
+ }
44
+ /** Live CDM registry address resolution failed. */
45
+ declare class ContractLiveAddressResolutionError extends ContractError {
46
+ readonly library: string | undefined;
47
+ readonly detail: unknown;
48
+ constructor(message: string, options?: {
49
+ library?: string;
50
+ detail?: unknown;
51
+ cause?: unknown;
52
+ });
53
+ }
54
+ /**
55
+ * A pre-flight `ReviveApi.call` dry-run reported failure. Thrown from the `.tx()`
56
+ * path before the extrinsic is built — prevents callers from paying gas on a
57
+ * transaction the chain already told us would revert.
58
+ *
59
+ * `dispatchError` carries the chain's encoded error (typically `ModuleError`,
60
+ * `ContractReverted`, `OutOfGas`, or `AccountNotMapped` — see the `Revive`
61
+ * pallet error variants).
62
+ */
63
+ declare class ContractDryRunFailedError extends ContractError {
64
+ readonly methodName: string;
65
+ readonly dispatchError: unknown;
66
+ constructor(methodName: string, dispatchError: unknown);
67
+ }
68
+ /** viem-decoded standard or ABI-defined contract error. */
69
+ interface DecodedContractRevert {
70
+ errorName: string;
71
+ args: readonly unknown[] | undefined;
72
+ }
73
+ /**
74
+ * Tagged-enum value surfaced on `QueryResult.value` when a contract reverts
75
+ * via the REVERT flag. The discriminant is intentionally distinct from
76
+ * `pallet-revive`'s bare `{ type: "ContractReverted" }` dispatch-error variant,
77
+ * which is the other path that can populate `QueryResult.value` on failure.
78
+ */
79
+ interface ContractRevertInfo {
80
+ type: "ContractRevertedWithPayload";
81
+ data: HexString;
82
+ reason?: string;
83
+ decoded?: DecodedContractRevert;
84
+ }
85
+ /** A contract call returned with the `REVERT` flag set on a dispatched-OK call. */
86
+ declare class ContractRevertedError extends ContractError {
87
+ readonly methodName: string;
88
+ readonly data: HexString;
89
+ readonly reason?: string;
90
+ readonly decoded?: DecodedContractRevert;
91
+ constructor(methodName: string, data: HexString, info?: {
92
+ reason?: string;
93
+ decoded?: DecodedContractRevert;
94
+ });
95
+ }
96
+
97
+ /**
98
+ * Result of a `Revive.call` extrinsic — present on the typed API as
99
+ * `api.tx.Revive.call(args)`. Returned object is a PAPI submittable that
100
+ * `submitAndWatch` consumes natively.
101
+ *
102
+ * `dest` is an H160 hex string and `data` is a raw `Uint8Array`: this matches
103
+ * what `polkadot-api` ≥2.0 codecs accept and produce. The class-based
104
+ * `Binary` / `FixedSizeBinary` wrappers from `@polkadot-api/substrate-bindings`
105
+ * 0.12 are *not* accepted by PAPI 2.x's compatibility check.
106
+ */
107
+ type ReviveCallTx = (args: {
108
+ dest: HexString;
109
+ value: bigint;
110
+ weight_limit: Weight;
111
+ storage_deposit_limit: bigint;
112
+ data: Uint8Array;
113
+ }) => SubmittableTransaction;
114
+ /**
115
+ * Dry-run result returned by `ReviveApi.call`. Mirrors the shape exposed by
116
+ * descriptors (`paseo-asset-hub`, `polkadot-asset-hub`, `kusama-asset-hub`).
117
+ *
118
+ * `data` is a raw `Uint8Array` because PAPI ≥2.0 dropped the `Binary` class
119
+ * wrapper for `Vec<u8>` codecs.
120
+ */
121
+ interface ReviveDryRunResult {
122
+ weight_consumed: Weight;
123
+ weight_required: Weight;
124
+ storage_deposit: {
125
+ type: "Refund" | "Charge";
126
+ value: bigint;
127
+ };
128
+ max_storage_deposit: {
129
+ type: "Refund" | "Charge";
130
+ value: bigint;
131
+ };
132
+ gas_consumed: bigint;
133
+ /**
134
+ * `success: true` carries `{ flags, data }`; `success: false` carries the
135
+ * dispatch error as the chain encoded it.
136
+ */
137
+ result: {
138
+ success: true;
139
+ value: {
140
+ flags: number;
141
+ data: Uint8Array;
142
+ };
143
+ } | {
144
+ success: false;
145
+ value: unknown;
146
+ };
147
+ }
148
+ /**
149
+ * Block reference used to target `ReviveApi.call` dry-runs. Matches PAPI's
150
+ * runtime-call `at` option: `"best"`, `"finalized"`, or a block hash.
151
+ */
152
+ type ContractDryRunAt = "best" | "finalized" | HexString;
153
+ /**
154
+ * Per-call options accepted by {@link ReviveDryRunCall}.
155
+ *
156
+ * Note on the trailing `options` arg: pallet-revive's Rust runtime API
157
+ * `ReviveApi::call` only takes the 6 positional args (origin, dest, value,
158
+ * gas_limit, storage_deposit_limit, input_data). This 7th `options` object
159
+ * is **injected by PAPI** on every `api.apis.X.Y` runtime-API call via its
160
+ * `WithCallOptions` type wrapper (see
161
+ * `polkadot-api/packages/client/src/viewFns.ts:9-11` upstream — defined
162
+ * as `WithCallOptions$2` in the bundled `.d.ts` due to TS bundler suffixing).
163
+ * It never reaches the Rust side — PAPI's `viewFns.ts:38-41` consumes it in
164
+ * JS, reads `options.at`, resolves it to a concrete block hash via the
165
+ * chain-head's runtime context, and uses that hash on the JSON-RPC
166
+ * `state_call` invocation. The 6-arg payload sent over the wire is
167
+ * unchanged.
168
+ */
169
+ interface ReviveDryRunCallOptions {
170
+ at?: ContractDryRunAt;
171
+ }
172
+ /** Structural shape consumed by `ContractManager` / `createContract`. */
173
+ interface ReviveTypedApi {
174
+ tx: {
175
+ Revive: {
176
+ call: ReviveCallTx;
177
+ map_account(): SubmittableTransaction;
178
+ };
179
+ };
180
+ query: {
181
+ Revive: {
182
+ OriginalAccount: {
183
+ getValue(address: HexString): Promise<SS58String | undefined>;
184
+ };
185
+ };
186
+ };
187
+ apis: {
188
+ ReviveApi: {
189
+ call(origin: SS58String, dest: HexString, value: bigint, gas_limit: Weight | undefined, storage_deposit_limit: bigint | undefined, input_data: Uint8Array, options?: ReviveDryRunCallOptions): Promise<ReviveDryRunResult>;
190
+ };
191
+ };
192
+ }
193
+ /**
194
+ * Signature of a `ReviveApi.call` dry-run, used by the wrapped contract layer
195
+ * to estimate weight + storage deposit and surface revert / OOG /
196
+ * `AccountNotMapped` failures before a tx is signed.
197
+ *
198
+ * Identical to `ReviveTypedApi.apis.ReviveApi.call`, but extracted so the
199
+ * runtime can route this single hot call through PAPI's *unsafe* API
200
+ * (skipping compatibility-token checks) on production runtimes whose
201
+ * descriptors lag a chain upgrade — every other surface still uses the
202
+ * compat-checked typed API.
203
+ */
204
+ type ReviveDryRunCall = (origin: SS58String, dest: HexString, value: bigint, gas_limit: Weight | undefined, storage_deposit_limit: bigint | undefined, input_data: Uint8Array, options?: ReviveDryRunCallOptions) => Promise<ReviveDryRunResult>;
205
+ /**
206
+ * Runtime handle that drives queries and transactions against a
207
+ * pallet-revive-capable chain.
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * import { createChainClient } from "@parity/product-sdk-chain-client";
212
+ * import { paseo_asset_hub } from "@parity/product-sdk-descriptors/paseo-asset-hub";
213
+ * import { createContractRuntimeFromClient } from "@parity/product-sdk-contracts";
214
+ *
215
+ * const client = await createChainClient({
216
+ * chains: { assetHub: paseo_asset_hub },
217
+ * });
218
+ * const runtime = createContractRuntimeFromClient(client.raw.assetHub, paseo_asset_hub);
219
+ * ```
220
+ */
221
+ interface ContractRuntime {
222
+ readonly api: ReviveTypedApi;
223
+ /**
224
+ * Dry-run entry point. Production factories route this through the
225
+ * *unsafe* API to avoid compatibility-token failures when the descriptor
226
+ * trails a runtime upgrade. The {@link createContractRuntime} test factory
227
+ * delegates to `api.apis.ReviveApi.call`.
228
+ *
229
+ * The runtime default `at` (set via {@link ContractRuntimeOptions.at} on
230
+ * the factory) is applied when the caller does not pass an explicit
231
+ * `options.at`. `.query()` per-call overrides flow through this argument.
232
+ */
233
+ readonly dryRunCall: ReviveDryRunCall;
234
+ }
235
+ /** Options for {@link createContractRuntime} / {@link createContractRuntimeFromClient}. */
236
+ interface ContractRuntimeOptions {
237
+ /**
238
+ * Block to target for `ReviveApi.call` dry-runs. Defaults to `"best"`
239
+ * so contract `.query()` reads observe the same state as transactions
240
+ * resolved at best-block (the product-sdk `.tx()` default). Set to
241
+ * `"finalized"` to read the canonical, lagged state, or to a specific
242
+ * block hash to pin reads to a historical block. Can be overridden per
243
+ * call via `QueryOptions.at`.
244
+ */
245
+ at?: ContractDryRunAt;
246
+ }
247
+ /**
248
+ * Wrap a typed PAPI API as a `ContractRuntime`. Intended for tests and
249
+ * advanced setups where the caller already holds a typed API. Routes the
250
+ * dry-run through the typed (compatibility-token-checked) `ReviveApi.call`
251
+ * — fine for mocks but susceptible to `Incompatible runtime entry` errors
252
+ * on a live chain whose descriptor lags. Prefer
253
+ * {@link createContractRuntimeFromClient} for production use.
254
+ */
255
+ declare function createContractRuntime(api: ReviveTypedApi, options?: ContractRuntimeOptions): ContractRuntime;
256
+ /**
257
+ * Build a `ContractRuntime` from a raw `PolkadotClient` plus its descriptor.
258
+ *
259
+ * The typed API powers `tx.Revive.call`, `tx.Revive.map_account`, and
260
+ * `query.Revive.OriginalAccount` (extrinsics + storage are tolerant of
261
+ * descriptor drift). The runtime-API dry-run, which is *not* tolerant of
262
+ * descriptor drift on PAPI's compat-token path, is routed through
263
+ * `client.getUnsafeApi()` — bypassing the compat check while preserving
264
+ * argument and return shapes.
265
+ *
266
+ * Use this on every production code path that calls a contract's `.tx()` or
267
+ * `.query()` against a live chain.
268
+ *
269
+ * @example
270
+ * ```ts
271
+ * import { paseo_asset_hub } from "@parity/product-sdk-descriptors/paseo-asset-hub";
272
+ * import { createContractRuntimeFromClient } from "@parity/product-sdk-contracts";
273
+ *
274
+ * const runtime = createContractRuntimeFromClient(rawClient, paseo_asset_hub);
275
+ * ```
276
+ */
277
+ declare function createContractRuntimeFromClient<TDescriptor>(client: PolkadotClient, descriptor: TDescriptor, options?: ContractRuntimeOptions): ContractRuntime;
278
+ /**
279
+ * Ensure the SS58 account is mapped to its derived H160 on `pallet-revive`.
280
+ *
281
+ * `pallet-revive` requires every signing account to have a registered
282
+ * `OriginalAccount` mapping before the runtime accepts its `Revive.call`
283
+ * extrinsics. The mapping is one-time and cheap. This helper:
284
+ *
285
+ * 1. Reads `Revive.OriginalAccount` for the H160 derived from `address`.
286
+ * 2. Returns `null` if already mapped (idempotent fast-path).
287
+ * 3. Otherwise submits `Revive.map_account()` and waits for inclusion.
288
+ *
289
+ * Call this once per signing account at app startup — after that, every
290
+ * subsequent `contract.<method>.tx({ signer })` against the same chain will
291
+ * succeed without further mapping work.
292
+ *
293
+ * @param runtime - The contract runtime (typically `createContractRuntime(...)`).
294
+ * @param address - The SS58 address of the account to map.
295
+ * @param signer - A signer matching `address`.
296
+ * @param options - Optional timeout / status callback (forwarded to the underlying tx).
297
+ * @returns A `Result`: `ok(TxResult)` from the mapping extrinsic, `ok(null)` if already mapped,
298
+ * or `err(TxError)` on failure. Delegates to `@parity/product-sdk-tx`'s `ensureAccountMapped`.
299
+ *
300
+ * @example
301
+ * ```ts
302
+ * import { createContractRuntime, ensureContractAccountMapped } from "@parity/product-sdk-contracts";
303
+ *
304
+ * const runtime = createContractRuntime(client.getTypedApi(paseo_asset_hub));
305
+ * await ensureContractAccountMapped(runtime, signerManager.getState().selectedAccount!.address, signer);
306
+ * // now safe to call contract.<method>.tx({ signer })
307
+ * ```
308
+ */
309
+ declare function ensureContractAccountMapped(runtime: ContractRuntime, address: SS58String, signer: PolkadotSigner, options?: {
310
+ timeoutMs?: number;
311
+ onStatus?: (s: string) => void;
312
+ }): Promise<Result<TxResult | null, TxError>>;
313
+ /**
314
+ * Read-only probe: is `address` mapped on `pallet-revive`?
315
+ *
316
+ * The read half of {@link ensureContractAccountMapped}: checks
317
+ * `Revive.OriginalAccount` for the H160 derived from `address` without
318
+ * needing a signer, so it can never submit a transaction or prompt a wallet.
319
+ * Use it for readiness checks ("can this account make contract calls right
320
+ * now?") from paths that must stay side-effect free.
321
+ *
322
+ * @param runtime - The contract runtime (typically `createContractRuntime(...)`).
323
+ * @param address - The SS58 address to check.
324
+ * @returns A {@link Result}: `ok(true)` when the mapping exists, `ok(false)` when it
325
+ * doesn't, or `err(ContractError)` when the address can't be converted or the
326
+ * storage query fails (underlying error attached as `cause`).
327
+ */
328
+ declare function isContractAccountMapped(runtime: ContractRuntime, address: SS58String): Promise<Result<boolean, ContractError>>;
329
+
330
+ type CdmJsonDependencyVersion = number | string;
331
+ /**
332
+ * A deployed contract's on-chain address, ABI, and optional metadata CID.
333
+ *
334
+ * `metadataCid` is optional because real-world cdm.json files (e.g.
335
+ * `paritytech/playground-cli/cdm.json`) don't always include it — only
336
+ * `version`, `address`, and `abi` are load-bearing for `getContract()`.
337
+ */
338
+ interface CdmJsonContract {
339
+ version: number;
340
+ address: HexString;
341
+ abi: AbiEntry[];
342
+ metadataCid?: string;
343
+ }
344
+ /** A project's `cdm.json` manifest. */
345
+ interface CdmJson {
346
+ dependencies: Record<string, CdmJsonDependencyVersion>;
347
+ contracts?: Record<string, CdmJsonContract>;
348
+ registry?: HexString;
349
+ }
350
+ /** An ABI parameter or return value, with support for nested tuple and struct types. */
351
+ interface AbiParam {
352
+ name: string;
353
+ type: string;
354
+ components?: AbiParam[];
355
+ }
356
+ /** One function, constructor, or event in a contract's ABI. */
357
+ interface AbiEntry {
358
+ type: string;
359
+ name?: string;
360
+ inputs: AbiParam[];
361
+ outputs?: AbiParam[];
362
+ stateMutability?: string;
363
+ }
364
+ /** Per-contract definition shape — generated into `.cdm/contracts.d.ts` via module augmentation. */
365
+ interface ContractDef {
366
+ methods: Record<string, {
367
+ args: any[];
368
+ response: any;
369
+ }>;
370
+ }
371
+ /**
372
+ * Augmentable interface extended by codegen with per-contract method types.
373
+ *
374
+ * After running `cdm install`, a generated `.d.ts` file augments this
375
+ * interface so that `ContractManager.getContract()` returns fully-typed
376
+ * contract handles.
377
+ */
378
+ interface Contracts {
379
+ }
380
+ /**
381
+ * Result from a read-only contract query.
382
+ *
383
+ * On success, `value` is the decoded response and `gasRequired` is the
384
+ * `Weight` consumed by `ReviveApi.call`'s dry-run — consumable directly by
385
+ * `Revive.call`'s `weight_limit` parameter.
386
+ *
387
+ * On failure, `value` carries the raw dispatch-error payload the runtime
388
+ * returned (typically a tagged enum like `{ type: "Module", value: ... }`,
389
+ * `{ type: "ContractReverted" }`, or `{ type: "AccountNotMapped" }` — see the
390
+ * `Revive` pallet error variants). Surfacing it lets callers narrow on shape
391
+ * to diagnose silent failures instead of seeing `undefined` and being unable
392
+ * to tell whether the contract reverted, gas estimation failed, or the
393
+ * dry-run never ran. `gasRequired` is still populated when the runtime
394
+ * reported a weight even though the call ultimately failed (e.g. a revert
395
+ * after partial execution); it's optional because some failure modes don't
396
+ * carry one.
397
+ */
398
+ type QueryResult<T> = {
399
+ success: true;
400
+ value: T;
401
+ gasRequired: Weight;
402
+ } | {
403
+ success: false;
404
+ value: unknown;
405
+ gasRequired?: Weight;
406
+ };
407
+ /** Options for query calls — passed as the last argument after positional args. */
408
+ interface QueryOptions {
409
+ origin?: SS58String;
410
+ value?: bigint;
411
+ /**
412
+ * Override the block targeted by this dry-run. Accepts `"best"`,
413
+ * `"finalized"`, or a block hash. Defaults to the runtime's configured
414
+ * `at` (see `createContractRuntimeFromClient({ at })`), which is `"best"`
415
+ * unless overridden — chosen so `.query()` observes the same state as
416
+ * `.tx()` resolved at best-block.
417
+ */
418
+ at?: ContractDryRunAt;
419
+ }
420
+ /** Options for transaction calls — passed as the last argument after positional args. */
421
+ interface TxOptions extends SubmitOptions {
422
+ signer?: PolkadotSigner;
423
+ origin?: SS58String;
424
+ value?: bigint;
425
+ gasLimit?: Weight;
426
+ storageDepositLimit?: bigint;
427
+ /**
428
+ * Override the block targeted by the sizing dry-run that `.tx()` runs
429
+ * before submission. Accepts `"best"`, `"finalized"`, or a block hash.
430
+ * Defaults to the runtime's configured `at` (see
431
+ * `createContractRuntimeFromClient({ at })`), which is `"best"` unless
432
+ * overridden. No-op when both `gasLimit` and `storageDepositLimit` are
433
+ * passed — the dry-run is skipped entirely in that case.
434
+ */
435
+ at?: ContractDryRunAt;
436
+ }
437
+ /**
438
+ * Options for `.prepare()` — subset of {@link TxOptions}.
439
+ *
440
+ * Signer and submission lifecycle options (`signer`, `waitFor`, `timeoutMs`,
441
+ * `mortalityPeriod`, `onStatus`) are intentionally absent — those belong to
442
+ * the batch submission, not the individual prepared call.
443
+ */
444
+ interface PrepareOptions {
445
+ origin?: SS58String;
446
+ value?: bigint;
447
+ gasLimit?: Weight;
448
+ storageDepositLimit?: bigint;
449
+ /**
450
+ * Override the block targeted by the sizing dry-run. See
451
+ * {@link TxOptions.at}.
452
+ */
453
+ at?: ContractDryRunAt;
454
+ }
455
+ /** Mutable defaults shared across all contract handles from a manager. */
456
+ interface ContractDefaults {
457
+ origin?: SS58String;
458
+ signer?: PolkadotSigner;
459
+ signerManager?: SignerManager;
460
+ }
461
+ /**
462
+ * Options for {@link createContract} and base for {@link ContractManagerOptions}.
463
+ *
464
+ * Signer resolution order (highest wins):
465
+ * 1. Explicit override in call options
466
+ * 2. `signerManager` (current logged-in account)
467
+ * 3. Static `defaultSigner` / `defaultOrigin`
468
+ */
469
+ interface ContractOptions {
470
+ /**
471
+ * Signer manager from `@parity/product-sdk-signer`. When provided, the
472
+ * currently selected account is used as the default signer and origin
473
+ * for all contract interactions. Resolved at call time so account
474
+ * switches are reflected immediately.
475
+ */
476
+ signerManager?: SignerManager;
477
+ /** Static fallback caller address for queries. */
478
+ defaultOrigin?: SS58String;
479
+ /** Static fallback signer for transactions. */
480
+ defaultSigner?: PolkadotSigner;
481
+ }
482
+ /** Options for {@link ContractManager} construction. */
483
+ type ContractManagerOptions = ContractOptions;
484
+ /** Options for resolving installed CDM contract addresses from the live CDM registry. */
485
+ interface LiveContractResolutionOptions {
486
+ /** CDM registry contract address. Defaults to `cdm.json.registry`. */
487
+ registryAddress?: HexString;
488
+ /** Subset of installed libraries to resolve. Defaults to every contract in the manifest. */
489
+ libraries?: readonly string[];
490
+ /** Origin used for CDM registry dry-run queries. Defaults to `defaultOrigin` in manager helpers. */
491
+ registryOrigin?: SS58String;
492
+ }
493
+ /**
494
+ * A typed contract handle where each ABI method exposes `.query()` and `.tx()`.
495
+ *
496
+ * Both accept the method's positional arguments followed by an optional
497
+ * options object as the last argument.
498
+ */
499
+ type Contract<C extends ContractDef> = {
500
+ [K in keyof C["methods"]]: {
501
+ /**
502
+ * Dry-run the method (read-only). Does not submit a transaction or
503
+ * cost gas. Returns the decoded response and estimated gas required.
504
+ *
505
+ * Origin is resolved from: explicit `{ origin }` option → signerManager →
506
+ * defaultOrigin → pallet-revive account fallback.
507
+ */
508
+ query: (...args: [...C["methods"][K]["args"], opts?: QueryOptions]) => Promise<QueryResult<C["methods"][K]["response"]>>;
509
+ /**
510
+ * Sign, submit, and watch the method as an on-chain transaction.
511
+ * Resolves at best-block by default (configurable via `waitFor`).
512
+ *
513
+ * Signer is resolved from: explicit `{ signer }` option → signerManager →
514
+ * defaultSigner.
515
+ *
516
+ * @returns A {@link Result}: `ok(TxResult)` once included/finalized, or `err`
517
+ * carrying a `ContractError` (no signer available, pre-submit dry-run failed,
518
+ * or the call reverted) or a `TxError` (submission/dispatch failure).
519
+ */
520
+ tx: (...args: [...C["methods"][K]["args"], opts?: TxOptions]) => Promise<Result<TxResult, ContractError | TxError>>;
521
+ /**
522
+ * Prepare the method as a {@link BatchableCall} — returns the same
523
+ * submittable that `.tx()` would build, but without signing or
524
+ * submitting. Consumable directly by `batchSubmitAndWatch` from
525
+ * `@parity/product-sdk-tx`:
526
+ *
527
+ * ```ts
528
+ * import { batchSubmitAndWatch } from "@parity/product-sdk-tx";
529
+ *
530
+ * const a = contract.transfer.prepare(addr1, 100n);
531
+ * const b = contract.transfer.prepare(addr2, 200n);
532
+ * await batchSubmitAndWatch([a, b], api, signer);
533
+ * ```
534
+ *
535
+ * Sizing: when either `gasLimit` or `storageDepositLimit` is
536
+ * omitted, `.prepare()` runs a `ReviveApi.call` dry-run (same as
537
+ * `.tx()`) against the fallback origin to fill the missing
538
+ * field(s) — pass both to skip the dry-run entirely. A failing
539
+ * dry-run yields `err({@link ContractDryRunFailedError})` before the
540
+ * call is constructed.
541
+ *
542
+ * `.prepare()` does not require a signer; the batch's signer
543
+ * replaces the dispatched origin at submission.
544
+ *
545
+ * @returns A {@link Result}: `ok(BatchableCall)`, or `err(ContractError)` if the
546
+ * pre-build dry-run fails or the call reverts.
547
+ */
548
+ prepare: (...args: [...C["methods"][K]["args"], opts?: PrepareOptions]) => Promise<Result<BatchableCall, ContractError>>;
549
+ };
550
+ };
551
+
552
+ export { type AbiEntry as A, ensureContractAccountMapped as B, type CdmJson as C, type DecodedContractRevert as D, isContractAccountMapped as E, type LiveContractResolutionOptions as L, type PrepareOptions as P, type QueryOptions as Q, type ReviveDryRunCall as R, type TxOptions as T, type ContractRuntime as a, type ContractManagerOptions as b, type ContractDefaults as c, type ContractRuntimeOptions as d, ContractError as e, type Contracts as f, type Contract as g, type ContractDef as h, type ContractOptions as i, type AbiParam as j, type CdmJsonContract as k, type CdmJsonDependencyVersion as l, type ContractDryRunAt as m, ContractDryRunFailedError as n, ContractInvalidOriginError as o, ContractLiveAddressResolutionError as p, ContractNotFoundError as q, type ContractRevertInfo as r, ContractRevertedError as s, ContractSignerMissingError as t, type QueryResult as u, type ReviveDryRunCallOptions as v, type ReviveDryRunResult as w, type ReviveTypedApi as x, createContractRuntime as y, createContractRuntimeFromClient as z };