/** * Internet Computer (ICP) Chain Adapter * * Builds ICP ledger transfer requests, computes the signing payload * as SHA-256 of the request envelope, attaches secp256k1 ECDSA * signatures from the FROST threshold signing network, and * broadcasts via the IC HTTP API. * * Curve: secp256k1 (ECDSA) * Native token: ICP (1 ICP = 1e8 e8s) * API: IC HTTP API at https://ic0.app * * No external dependencies — uses raw HTTP calls and built-in crypto. * * The ICP transaction model is canister-call based. A transfer is a * call to the ICP ledger canister (ryjl3-tyaaa-aaaaa-aaaba-cai) with * the "transfer" method. The signing payload is the SHA-256 hash of * the CBOR-encoded request ID derived from the request content map. */ import { ChainAdapter, IcpTransaction } from '../core/types'; export declare class IcpAdapter implements ChainAdapter { private apiUrl; private network; constructor(network?: 'mainnet' | 'local', apiUrl?: string); getRpcUrl(): string; /** * Build an unsigned ICP ledger transfer request. * * Constructs the transfer call content map, computes the request ID * (signing payload), and returns the hex-encoded payload containing * all information needed for signing and broadcast. * * The signing payload is: SHA-256(domain_separator || request_id) * where domain_separator = "\x0Aic-request" * * @param tx - ICP transfer details (to, amount in e8s, optional memo/fee) * @param fromAddress - Sender's principal or account ID (hex) * @returns hex-encoded JSON payload with signingHash and request data */ buildTransaction(tx: IcpTransaction, fromAddress: string): Promise; /** * Extract the signing payload (SHA-256 hash) from the build output. * * The signing payload is the SHA-256 of (domain_separator || request_id). * This is the 32-byte hash that the FROST network signs with secp256k1. */ getSigningPayload(unsignedTx: string): string; /** * Attach a secp256k1 ECDSA signature to the ICP request envelope. * * The IC expects the signature in DER-encoded format within a * CBOR envelope. We store the 65-byte raw signature (r||s||v) * and convert during broadcast. */ attachSignature(unsignedTx: string, signature: string): Promise; /** * Broadcast a signed ICP transaction via the IC HTTP API. * * Submits the signed request envelope to: * POST /api/v2/canister/{canister_id}/call * * The IC returns a 202 Accepted on success with the request ID * that can be polled for status. * * @returns request ID (hex) which serves as the transaction identifier */ broadcast(signedTx: string): Promise; /** * Get ICP balance in e8s (1 ICP = 1e8 e8s). * * Queries the ledger canister using the read_state/query endpoint * with the "icrc1_balance_of" method. * * @param address - Principal ID or account ID (hex) * @returns balance in e8s as string */ getBalance(address: string): Promise; /** * Check the status of a submitted request. * * After broadcast, callers can poll this method with the request ID * to check whether the transfer was accepted by the ledger canister. * * @param requestId - hex-encoded request ID from broadcast() * @returns status string: 'received', 'processing', 'replied', 'rejected', 'done', or 'unknown' */ getRequestStatus(requestId: string): Promise; /** * Get the ICP ledger canister ID. */ getLedgerCanisterId(): string; } /** Create a mainnet ICP adapter */ export declare function createIcpAdapter(apiUrl?: string): IcpAdapter; //# sourceMappingURL=icp.d.ts.map