import { Result } from '@parity/result'; import { PolkadotClient, HexString, SS58String } from 'polkadot-api'; import { C as CdmJson, a as ContractRuntime, b as ContractManagerOptions, c as ContractDefaults, d as ContractRuntimeOptions, L as LiveContractResolutionOptions, e as ContractError, f as Contracts, g as Contract, h as ContractDef, A as AbiEntry, i as ContractOptions } from './types-Dtu4IsSh.js'; export { j as AbiParam, k as CdmJsonContract, l as CdmJsonDependencyVersion, m as ContractDryRunAt, n as ContractDryRunFailedError, o as ContractInvalidOriginError, p as ContractLiveAddressResolutionError, q as ContractNotFoundError, r as ContractRevertInfo, s as ContractRevertedError, t as ContractSignerMissingError, D as DecodedContractRevert, P as PrepareOptions, Q as QueryOptions, u as QueryResult, R as ReviveDryRunCall, v as ReviveDryRunCallOptions, w as ReviveDryRunResult, x as ReviveTypedApi, T as TxOptions, y as createContractRuntime, z as createContractRuntimeFromClient, B as ensureContractAccountMapped, E as isContractAccountMapped } from './types-Dtu4IsSh.js'; export { BatchableCall, TxResult } from '@parity/product-sdk-tx'; import '@parity/product-sdk-signer'; import '@parity/product-sdk-errors'; /** * Return a cloned manifest whose installed contract addresses have been * replaced by live addresses from the CDM registry. * * This is intentionally strict: if a requested library cannot be resolved from * the registry, the result is `err`. Use `new ContractManager(...)` or * `ContractManager.fromClient(...)` directly for snapshot-only behavior. * * @returns A {@link Result}: `ok(CdmJson)` with live addresses patched in, or * `err(ContractError)` — a `ContractLiveAddressResolutionError` (missing * contracts, no registry, or a lookup that failed / returned nothing) or a * `ContractNotFoundError` (a requested library isn't installed). */ declare function withLiveContractAddresses(cdmJson: CdmJson, runtime: ContractRuntime, options?: LiveContractResolutionOptions): Promise>; /** * Manages typed contract interactions backed by a `cdm.json` manifest. * * Pass a `signerManager` (e.g. a `SignerManager` from `@parity/product-sdk-signer`) * so the currently logged-in account is used automatically — no manual * signer/origin wiring needed. * * @example * ```ts * import { createChainClient } from "@parity/product-sdk-chain-client"; * import { paseo_asset_hub } from "@parity/product-sdk-descriptors/paseo-asset-hub"; * import { ContractManager, createContractRuntime } from "@parity/product-sdk-contracts"; * import cdmJson from "./cdm.json"; * * const client = await createChainClient({ * chains: { assetHub: paseo_asset_hub }, * }); * const runtime = createContractRuntime(client.assetHub); * const manager = new ContractManager(cdmJson, runtime, { * signerManager, * }); * * const counter = manager.getContract("@example/counter"); * const { value } = await counter.getCount.query(); * await counter.increment.tx(); * ``` */ declare class ContractManager { private contracts; private runtime; private defaults; constructor(cdmJson: CdmJson, runtime: ContractRuntime, options?: ContractManagerOptions); /** Update the default origin, signer, or signerManager used by all contract handles. */ setDefaults(defaults: ContractDefaults): void; /** * Create a `ContractManager` from a raw `PolkadotClient`. * * Convenience factory: builds a `ContractRuntime` internally from the * client's typed API. Requires that the chain's typed API exposes the * `Revive` pallet and `ReviveApi` runtime API (Asset Hub Paseo / * Polkadot / Kusama). * * @param cdmJson - The CDM manifest. * @param client - A `PolkadotClient` for the chain where contracts are deployed. * @param descriptor - The chain descriptor used to derive the typed API. * @param options - Optional configuration (signerManager, defaults). */ static fromClient(cdmJson: CdmJson, client: PolkadotClient, descriptor: TDescriptor, options?: ContractManagerOptions & ContractRuntimeOptions): ContractManager; /** * Create a manager after strictly resolving installed contract addresses * from the live CDM registry. ABIs still come from the installed manifest. */ static fromLive(cdmJson: CdmJson, runtime: ContractRuntime, options?: ContractManagerOptions & LiveContractResolutionOptions): Promise>; /** * Convenience factory for {@link fromLive} when the caller has a raw * `PolkadotClient` and descriptor. */ static fromLiveClient(cdmJson: CdmJson, client: PolkadotClient, descriptor: TDescriptor, options?: ContractManagerOptions & ContractRuntimeOptions & LiveContractResolutionOptions): Promise>; private getContractData; /** * Get a typed contract handle. * * Each method on the returned object has `.query()` for read-only calls * and `.tx()` for signed transactions. When codegen augments * {@link Contracts}, passing a known library name returns a fully-typed * handle. Without codegen the generic overload still works — methods are * accessible but untyped. */ getContract(library: K): Contract; getContract(library: string): Contract; /** Get the on-chain address of an installed contract. */ getAddress(library: string): HexString; /** * Get the underlying {@link ContractRuntime} backing this manager. * * Useful when a consumer needs to call helpers that take a runtime * directly — most commonly {@link ensureContractAccountMapped} at app * boot. Avoids the alternative of building a second runtime against the * same client and descriptor. */ getRuntime(): ContractRuntime; } /** * Create a contract handle from a raw H160 address and ABI — no `cdm.json` needed. * * @example * ```ts * import { createContractRuntime, createContract } from "@parity/product-sdk-contracts"; * * const runtime = createContractRuntime(client.assetHub); * const counter = createContract(runtime, "0xC472...", abi, { signerManager }); * await counter.getCount.query(); * await counter.increment.tx(); * ``` */ declare function createContract(runtime: ContractRuntime, address: HexString, abi: AbiEntry[], options?: ContractOptions): Contract; /** * Create a contract handle from a raw `PolkadotClient`, descriptor, address, and ABI. * * Convenience wrapper that builds the `ContractRuntime` from the client's * typed API. The chain must expose `Revive` + `ReviveApi`. * * @example * ```ts * const counter = createContractFromClient(client, paseo_asset_hub, "0xC472...", abi); * const { value } = await counter.getCount.query(); * ``` */ declare function createContractFromClient(client: PolkadotClient, descriptor: TDescriptor, address: HexString, abi: AbiEntry[], options?: ContractOptions & ContractRuntimeOptions): Contract; declare const QUERY_FALLBACK_ORIGIN: SS58String; export { AbiEntry, CdmJson, Contract, ContractDef, ContractDefaults, ContractError, ContractManager, ContractManagerOptions, ContractOptions, ContractRuntime, ContractRuntimeOptions, Contracts, LiveContractResolutionOptions, QUERY_FALLBACK_ORIGIN, createContract, createContractFromClient, withLiveContractAddresses };