import { ChainProvider, UtxoProvider } from '../providers/index.js'; import { ExtPsbt } from '../psbt/extPsbt.js'; import { Signer } from '../signer.js'; import { SmartContract } from '../smart-contract/smartContract.js'; import { ByteString, OpcatState } from '../smart-contract/types/primitives.js'; /** * Deploys a smart contract, which can be traced back to genesis, to the blockchain. * * **IMPORTANT**: This function performs TWO blockchain transactions sequentially: * 1. First deploys a Genesis contract (requires fees + 1 sat postage) * 2. Then deploys the target contract using the Genesis contract as input (requires additional fees) * * ## Fee Implications * Total cost = Genesis transaction fees + Deploy transaction fees + 1 sat Genesis postage * The Genesis postage (1 sat) is consumed when the Genesis UTXO is spent in step 2. * * ## Atomicity Warning * These two transactions are NOT atomic. If step 2 fails after step 1 broadcasts: * - The Genesis UTXO will exist on-chain but remain unspent * - The target contract will NOT be deployed * - Manual recovery is possible by creating a new deploy transaction using the Genesis UTXO * * ## Error Recovery * If an error occurs during step 2: * - The Genesis transaction is already broadcast and cannot be reverted * - The Genesis UTXO at `genesisPsbt.getUtxo(0)` can be used for retry * - Provider state may be inconsistent (Genesis marked spent but deploy failed) * * @param signer - The signer used to sign both transactions * @param provider - The provider for chain and UTXO data * @param createContract - Factory function to create the contract instance with genesis outpoint * @param satoshis - Amount of satoshis to lock in the target contract (default: 1) * @param metadata - Optional metadata (hex string) to attach to the Genesis contract output * @returns Promise resolving to the deploy PSBT and deployed contract instance * * @throws {Error} If signing fails for either transaction * @throws {Error} If broadcast fails for either transaction * @throws {Error} If insufficient UTXOs are available * * @example * ```typescript * const { psbt, contract } = await deployGenesis( * signer, * provider, * (genesisOutpoint) => new MyContract(genesisOutpoint), * 1000 // lock 1000 sats in contract * ); * ``` */ export declare function deployGenesis>(signer: Signer, provider: UtxoProvider & ChainProvider, createContract: (genesisOutpoint: ByteString) => Contract, satoshis?: number, metadata?: string): Promise<{ psbt: ExtPsbt; contract: Contract; }>; //# sourceMappingURL=deployGenesis.d.ts.map