/** * NEAR-specific types for Omni Bridge * * Re-uses zorsh schemas for Borsh serialization matching the on-chain contract format. */ import { ChainKind, type OmniAddress } from "@omni-bridge/core"; import { b } from "@zorsh/zorsh"; export declare const GAS: { readonly LOG_METADATA: bigint; readonly DEPLOY_TOKEN: bigint; readonly BIND_TOKEN: bigint; readonly INIT_TRANSFER: bigint; readonly FIN_TRANSFER: bigint; readonly SIGN_TRANSFER: bigint; readonly STORAGE_DEPOSIT: bigint; readonly FAST_FIN_TRANSFER: bigint; readonly UTXO_VERIFY_DEPOSIT: bigint; readonly UTXO_INIT_WITHDRAWAL: bigint; readonly UTXO_SUBMIT_WITHDRAWAL: bigint; readonly UTXO_SIGN_WITHDRAWAL: bigint; readonly UTXO_VERIFY_WITHDRAWAL: bigint; }; export declare const DEPOSIT: { readonly ONE_YOCTO: bigint; readonly MPC_SIGNING: bigint; readonly SAFE_VERIFY_DEPOSIT: bigint; }; /** * Transfer ID for identifying cross-chain transfers */ export interface TransferId { origin_chain: ChainKind | number | string; origin_nonce: bigint | string; } /** * Fee structure for transfers */ export interface TransferFee { fee: string; native_fee: string; } /** * Proof kind enumeration matching on-chain values */ export declare enum ProofKind { InitTransfer = 0, FinTransfer = 1, DeployToken = 2, LogMetadata = 3 } export declare const ProofKindSchema: import("@zorsh/zorsh").Schema; export declare const ChainKindSchema: import("@zorsh/zorsh").Schema; export declare const StorageDepositActionSchema: import("@zorsh/zorsh").Schema<{ token_id: string; account_id: string; storage_deposit_amount: bigint | null; }, string>; export type StorageDepositAction = b.infer; export declare const EvmProofSchema: import("@zorsh/zorsh").Schema<{ log_index: bigint; log_entry_data: Uint8Array; receipt_index: bigint; receipt_data: Uint8Array; header_data: Uint8Array; proof: Uint8Array[]; }, string>; export type NearEvmProof = b.infer; export declare const EvmVerifyProofArgsSchema: import("@zorsh/zorsh").Schema<{ proof_kind: ProofKind; proof: { log_index: bigint; log_entry_data: Uint8Array; receipt_index: bigint; receipt_data: Uint8Array; header_data: Uint8Array; proof: Uint8Array[]; }; }, string>; export type EvmVerifyProofArgs = b.infer; export declare const WormholeVerifyProofArgsSchema: import("@zorsh/zorsh").Schema<{ proof_kind: ProofKind; vaa: string; }, string>; export type WormholeVerifyProofArgs = b.infer; export declare const FinTransferArgsSchema: import("@zorsh/zorsh").Schema<{ chain_kind: ChainKind; storage_deposit_actions: { token_id: string; account_id: string; storage_deposit_amount: bigint | null; }[]; prover_args: Uint8Array; }, string>; export type FinTransferArgs = b.infer; export declare const DeployTokenArgsSchema: import("@zorsh/zorsh").Schema<{ chain_kind: ChainKind; prover_args: Uint8Array; }, string>; export type DeployTokenArgs = b.infer; export declare const BindTokenArgsSchema: import("@zorsh/zorsh").Schema<{ chain_kind: ChainKind; prover_args: Uint8Array; }, string>; export type BindTokenArgs = b.infer; /** * Finalization parameters */ export interface FinalizationParams { sourceChain: ChainKind; storageDepositActions: StorageDepositAction[]; vaa?: string; evmProof?: EvmVerifyProofArgs; signerId: string; } /** * Fast finalization transfer parameters */ export interface FastFinTransferParams { tokenId: string; amount: string; amountToSend: string; transferId: TransferId; recipient: OmniAddress; fee: TransferFee; msg?: string; storageDepositAmount?: string; relayer: string; } /** * Init transfer event from NEAR (parsed from logs) */ export interface InitTransferEvent { transfer_message: { origin_nonce: number; token: OmniAddress; amount: string; recipient: OmniAddress; fee: TransferFee; sender: OmniAddress; msg: string; destination_nonce: number; }; } /** * MPC signature affine point */ export interface AffinePoint { affine_point: string; } /** * MPC signature scalar */ export interface Scalar { scalar: string; } /** * MPC signature structure (raw from contract logs) */ export interface MPCSignatureRaw { big_r: AffinePoint; s: Scalar; recovery_id: number; } /** * MPC signature class with toBytes() conversion */ export declare class MPCSignature { big_r: AffinePoint; s: Scalar; recovery_id: number; constructor(big_r: AffinePoint, s: Scalar, recovery_id: number); /** * Convert signature to bytes for Solana/EVM * @param forEvm - If true, adds 27 to recovery_id for EVM compatibility */ toBytes(forEvm?: boolean): Uint8Array; /** * Create from raw signature object from contract logs */ static fromRaw(raw: MPCSignatureRaw): MPCSignature; } /** * Sign transfer event from NEAR */ export interface SignTransferEvent { signature: MPCSignature; message_payload: { prefix: string; destination_nonce: string; transfer_id: TransferId; token_address: OmniAddress; amount: string; recipient: OmniAddress; fee_recipient: string | null; }; } /** * Log metadata event */ export interface LogMetadataEvent { metadata_payload: { decimals: number; name: string; prefix: string; symbol: string; token: string; }; signature: MPCSignature; } /** * Post-action to execute after UTXO deposit is finalized on NEAR. * Used for automatic bridging to other chains. */ export interface UtxoPostAction { receiver_id: string; amount: bigint; memo?: string; msg: string; gas?: bigint; } /** * Safe deposit message for UTXO deposits. * When present, `verify_deposit_v2` routes through the safe-deposit path (reverts * on failure, charges no fee) and the caller must attach NEAR for token storage. */ export interface UtxoSafeDeposit { msg: string; } /** * Deposit message for UTXO deposits */ export interface UtxoDepositMsg { recipient_id: string; post_actions?: UtxoPostAction[]; extra_msg?: string; safe_deposit?: UtxoSafeDeposit; refund_address?: string; } /** * Arguments for finalizing a UTXO deposit on NEAR via `verify_deposit_v2`. */ export interface UtxoDepositFinalizationParams { /** The UTXO chain (BTC or Zcash) */ chain: "btc" | "zcash"; /** Deposit message matching what was used to generate the address */ depositMsg: UtxoDepositMsg; /** Raw transaction bytes (base64-encoded for the contract by the builder) */ txBytes: number[]; /** Output index in the transaction */ vout: number; /** Block hash containing the transaction */ txBlockBlockhash: string; /** Transaction index in the block */ txIndex: number; /** Merkle proof for transaction inclusion */ merkleProof: string[]; /** Coinbase transaction ID for the block (first transaction) */ coinbaseTxId: string; /** Merkle proof for the coinbase transaction */ coinbaseMerkleProof: string[]; /** Signer account ID */ signerId: string; } /** * Output structure for UTXO withdrawal plan */ export interface UtxoWithdrawalOutput { value: number; script_pubkey: string; } /** * Parameters for initiating a UTXO withdrawal from NEAR */ export interface UtxoWithdrawalInitParams { /** The UTXO chain (BTC or Zcash) */ chain: "btc" | "zcash"; /** Target BTC/Zcash address */ targetAddress: string; /** UTXO inputs in "txid:vout" format */ inputs: string[]; /** Transaction outputs */ outputs: UtxoWithdrawalOutput[]; /** Total amount to transfer (including fees) */ totalAmount: bigint; /** Optional maximum gas fee in satoshis/zatoshis */ maxGasFee?: bigint; /** Signer account ID */ signerId: string; } /** * Parameters for submitting a UTXO withdrawal to the chain connector. * Use this to "unstuck" a withdrawal when the relayer fails to submit it * after the user initiated the transfer on the omni bridge. */ export interface UtxoWithdrawalSubmitParams { /** The UTXO chain (BTC or Zcash) */ chain: "btc" | "zcash"; /** Transfer ID from the init_transfer event */ transferId: TransferId; /** Target BTC/Zcash address */ targetAddress: string; /** UTXO inputs in "txid:vout" format */ inputs: string[]; /** Transaction outputs */ outputs: UtxoWithdrawalOutput[]; /** Optional maximum gas fee in satoshis/zatoshis */ maxGasFee?: bigint; /** Signer account ID */ signerId: string; } /** * Parameters for signing a UTXO withdrawal transaction via MPC. * Call this for each input that needs signing when the relayer is stuck. */ export interface UtxoWithdrawalSignParams { /** The UTXO chain (BTC or Zcash) */ chain: "btc" | "zcash"; /** Pending sign ID from the generate_btc_pending_info event */ pendingSignId: string; /** Index of the input to sign (one call per input) */ signIndex: number; /** Signer account ID */ signerId: string; } /** * Parameters for verifying a UTXO withdrawal on NEAR via `verify_withdraw_v2`. */ export interface UtxoWithdrawalVerifyParams { /** The UTXO chain (BTC or Zcash) */ chain: "btc" | "zcash"; /** Transaction ID of the broadcast withdrawal transaction */ txId: string; /** Block hash containing the transaction */ txBlockBlockhash: string; /** Transaction index in the block */ txIndex: number; /** Merkle proof for transaction inclusion */ merkleProof: string[]; /** Coinbase transaction ID for the block (first transaction) */ coinbaseTxId: string; /** Merkle proof for the coinbase transaction */ coinbaseMerkleProof: string[]; /** Signer account ID */ signerId: string; } /** * Bridge fee configuration from UTXO connector */ export interface UtxoBridgeFee { fee_min: string; fee_rate: number; protocol_fee_rate: number; } /** * UTXO connector configuration (from get_config) */ export interface UtxoConnectorConfig { change_address: string; deposit_bridge_fee: UtxoBridgeFee; withdraw_bridge_fee: UtxoBridgeFee; min_deposit_amount: string; min_withdraw_amount: string; min_change_amount?: string; max_withdrawal_input_number?: number; } export type { UTXO } from "@omni-bridge/core"; //# sourceMappingURL=types.d.ts.map