/** * Multi-Signature Escrow Service * * Implements escrow functionality using Substrate's multisig pallet * This replaces smart contracts with native Substrate multi-signature accounts */ import type { ApiPromise } from '@polkadot/api'; import type { EscrowAccount, MultisigTimepoint } from '../types/escrow.types'; export declare class EscrowService { private api; constructor(api: ApiPromise); /** * Create a multi-signature escrow account * * Creates a 2-of-3 multi-sig account with Buyer, Merchant, and Platform as signatories. * This account will hold funds in escrow until release or refund. * * @param buyer - Buyer's Polkadot address * @param merchant - Merchant's Polkadot address * @param platform - Platform's Polkadot address (for dispute resolution) * @param paymentId - Unique payment identifier * @param expirationMinutes - When the escrow expires (default: 60) * @returns EscrowAccount with multi-sig address and details */ createMultiSigAccount(buyer: string, merchant: string, platform: string, paymentId: string, expirationMinutes?: number): Promise; /** * Create a transfer transaction to fund the escrow * * Buyer calls this to deposit funds into the multi-sig escrow account */ createDepositTransaction(escrowAddress: string, amount: bigint): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult>; /** * Create a multi-sig transaction to release payment to merchant * * This initiates a multi-sig call to transfer funds from escrow to merchant. * Requires 2 of 3 signatures (typically Buyer + Platform, or Buyer + Merchant). * * @param escrowAccount - The escrow account details * @param merchant - Merchant's address (recipient) * @param amount - Amount to release (after platform fee) * @param signer - Address of the account initiating this call * @param timepoint - Timepoint from previous approval (if this is the 2nd approval) */ createReleaseTransaction(escrowAccount: EscrowAccount, merchant: string, amount: bigint, signer: string, timepoint?: MultisigTimepoint): Promise>; /** * Create a multi-sig transaction to refund payment to buyer * * Similar to release, but sends funds back to the buyer. * Typically initiated by Merchant + Platform. */ createRefundTransaction(escrowAccount: EscrowAccount, buyer: string, amount: bigint, signer: string, timepoint?: MultisigTimepoint): Promise>; /** * Create a transaction to cancel a multi-sig call * * Allows a signatory to cancel an initiated multi-sig call before it's executed */ createCancelTransaction(escrowAccount: EscrowAccount, callHash: string, timepoint: MultisigTimepoint, signer: string): Promise>; /** * Get balance of escrow account */ getEscrowBalance(escrowAddress: string): Promise; /** * Check if a multi-sig call is pending */ getPendingMultisigCall(escrowAccount: EscrowAccount, callHash: string): Promise<{ when: MultisigTimepoint; depositor: string; approvals: string[]; } | null>; /** * Calculate platform fee * * @param amount - Total payment amount * @param feeBps - Fee in basis points (e.g., 250 = 2.5%) * @returns Fee amount */ calculatePlatformFee(amount: bigint, feeBps?: number): bigint; /** * Calculate net merchant amount (after platform fee) */ calculateMerchantAmount(amount: bigint, feeBps?: number): bigint; /** * Validate escrow account structure */ validateEscrowAccount(escrow: EscrowAccount): void; /** * Check if an address is a signatory of the escrow */ isSignatory(escrowAccount: EscrowAccount, address: string): boolean; /** * Get the role of an address in the escrow */ getRole(_escrowAccount: EscrowAccount, address: string, buyer: string, merchant: string, platform: string): 'buyer' | 'merchant' | 'platform' | null; } //# sourceMappingURL=escrow.service.d.ts.map