import { NearEthAdapter, SignRequestData, EncodedSignRequest, SetupConfig as MpcConfig } from "near-ca-test";
import { Address, Hash, Hex } from "viem";
import { SafeContractSuite } from "./lib/safe";
import { EncodedTxData, MetaTransaction, SponsorshipPolicyData, UserOperation, UserOperationReceipt } from "./types";
export interface NearSafeConfig {
    mpc: MpcConfig;
    pimlicoKey: string;
    safeSaltNonce?: string;
    setupRpc?: string;
}
export declare class NearSafe {
    readonly nearAdapter: NearEthAdapter;
    readonly address: Address;
    private safePack;
    private setup;
    private pimlicoKey;
    private safeSaltNonce;
    /**
     * Creates a new instance of the `NearSafe` class using the provided configuration.
     *
     * @param {NearSafeConfig} config - The configuration object required to initialize the `NearSafe` instance, including the Pimlico key and safe salt nonce.
     * @returns {Promise<NearSafe>} - A promise that resolves to a new `NearSafe` instance.
     */
    static create(config: NearSafeConfig): Promise<NearSafe>;
    /**
     * Constructs a new `NearSafe` object with the provided parameters.
     *
     * @param {NearEthAdapter} nearAdapter - The NEAR adapter used for interacting with the NEAR blockchain.
     * @param {SafeContractSuite} safePack - A suite of contracts and utilities for managing the Safe contract.
     * @param {string} pimlicoKey - A key required for authenticating with the Pimlico service.
     * @param {string} setup - The setup string generated for the Safe contract.
     * @param {Address} safeAddress - The address of the deployed Safe contract.
     * @param {string} safeSaltNonce - A unique nonce used to differentiate the Safe setup.
     */
    constructor(nearAdapter: NearEthAdapter, safePack: SafeContractSuite, pimlicoKey: string, setup: string, safeAddress: Address, safeSaltNonce: string);
    /**
     * Retrieves the MPC (Multi-Party Computation) address associated with the NEAR adapter.
     *
     * @returns {Address} - The MPC address of the NEAR adapter.
     */
    get mpcAddress(): Address;
    /**
     * Retrieves the contract ID of the MPC contract associated with the NEAR adapter.
     *
     * @returns {string} - The contract ID of the MPC contract.
     */
    get mpcContractId(): string;
    /**
     * Retrieves the balance of the Safe account on the specified EVM chain.
     *
     * @param {number} chainId - The ID of the blockchain network where the Safe account is located.
     * @returns {Promise<bigint>} - A promise that resolves to the balance of the Safe account in wei.
     */
    getBalance(chainId: number): Promise<bigint>;
    /**
     * Constructs a user operation for the specified chain, including necessary gas fees, nonce, and paymaster data.
     * Warning: Uses a private ethRPC with sensitive Pimlico API key (should be run server side).
     *
     * @param {Object} args - The arguments for building the transaction.
     * @param {number} args.chainId - The ID of the blockchain network where the transaction will be executed.
     * @param {MetaTransaction[]} args.transactions - A list of meta-transactions to be included in the user operation.
     * @param {boolean} args.usePaymaster - Flag indicating whether to use a paymaster for gas fees. If true, the transaction will be sponsored by the paymaster.
     * @returns {Promise<UserOperation>} - A promise that resolves to a complete `UserOperation` object, including gas fees, nonce, and paymaster data.
     * @throws {Error} - Throws an error if the transaction set is empty or if any operation fails during the building process.
     */
    buildTransaction(args: {
        chainId: number;
        transactions: MetaTransaction[];
        sponsorshipPolicy?: string;
    }): Promise<UserOperation>;
    /**
     * Signs a transaction with the NEAR adapter using the provided operation hash.
     *
     * @param {Hex} safeOpHash - The hash of the user operation that needs to be signed.
     * @returns {Promise<Hex>} - A promise that resolves to the packed signature in hexadecimal format.
     */
    signTransaction(safeOpHash: Hex): Promise<Hex>;
    /**
     * Computes the operation hash for a given user operation.
     *
     * @param {UserOperation} userOp - The user operation for which the hash needs to be computed.
     * @returns {Promise<Hash>} - A promise that resolves to the hash of the provided user operation.
     */
    opHash(chainId: number, userOp: UserOperation): Promise<Hash>;
    /**
     * Encodes a request to sign a transaction using either a paymaster or the user's own funds.
     *
     * @param {SignRequestData} signRequest - The data required to create the signature request. This includes information such as the chain ID and other necessary fields for the transaction.
     * @param {boolean} usePaymaster - Flag indicating whether to use a paymaster for gas fees. If true, the transaction will be sponsored by the paymaster.
     * @returns {Promise<EncodedTxData>} - A promise that resolves to the encoded transaction data for the NEAR and EVM networks.
     */
    encodeSignRequest(signRequest: SignRequestData, sponsorshipPolicy?: string): Promise<EncodedTxData>;
    /**
     * Broadcasts a user operation to the EVM network with a provided signature.
     * Warning: Uses a private ethRPC with sensitive Pimlico API key (should be run server side).
     *
     * @param {number} chainId - The ID of the EVM network to which the transaction should be broadcasted.
     * @param {Signature} signature - The valid signature of the unsignedUserOp.
     * @param {UserOperation} unsignedUserOp - The unsigned user operation to be broadcasted. This includes transaction data such as the destination address and data payload.
     * @returns {Promise<Hash>} - A promise that resolves hash of the executed user operation.
     * @throws {Error} - Throws an error if the EVM broadcast fails, including the error message for debugging.
     */
    broadcastBundler(chainId: number, signatureHex: Hex, unsignedUserOp: UserOperation): Promise<Hash>;
    /**
     * Executes a user operation on the specified blockchain network.
     * Warning: Uses a private ethRPC with sensitive Pimlico API key (should be run server side).
     *
     * @param {number} chainId - The ID of the blockchain network on which to execute the transaction.
     * @param {UserOperation} userOp - The user operation to be executed, typically includes the data and signatures necessary for the transaction.
     * @returns {Promise<Hash>} - A promise that resolves to the hash of the executed transaction.
     */
    executeTransaction(chainId: number, userOp: UserOperation): Promise<Hash>;
    /**
     * Retrieves the receipt of a previously executed user operation.
     * Warning: Uses a private ethRPC with sensitive Pimlico API key (should be run server side).
     *
     * @param {number} chainId - The ID of the blockchain network where the operation was executed.
     * @param {Hash} userOpHash - The hash of the user operation for which to retrieve the receipt.
     * @returns {Promise<UserOperationReceipt>} - A promise that resolves to the receipt of the user operation, which includes status and logs.
     */
    getOpReceipt(chainId: number, userOpHash: Hash): Promise<UserOperationReceipt>;
    /**
     * Checks if the Safe contract is deployed on the specified chain.
     *
     * @param {number} chainId - The ID of the blockchain network where the Safe contract should be checked.
     * @returns {Promise<boolean>} - A promise that resolves to `true` if the Safe contract is deployed, otherwise `false`.
     */
    safeDeployed(chainId: number): Promise<boolean>;
    /**
     * Determines if the Safe account has sufficient funds to cover the transaction costs.
     *
     * @param {number} chainId - The ID of the blockchain network where the Safe account is located.
     * @param {MetaTransaction[]} transactions - A list of meta-transactions to be evaluated for funding.
     * @param {bigint} gasCost - The estimated gas cost of executing the transactions.
     * @returns {Promise<boolean>} - A promise that resolves to `true` if the Safe account has sufficient funds, otherwise `false`.
     */
    sufficientlyFunded(chainId: number, transactions: MetaTransaction[], gasCost: bigint): Promise<boolean>;
    /**
     * Creates a meta-transaction for adding a new owner to the Safe contract.
     *
     * @param {Address} address - The address of the new owner to be added.
     * @returns {MetaTransaction} - A meta-transaction object for adding the new owner.
     */
    addOwnerTx(address: Address): MetaTransaction;
    /**
     * Creates a meta-transaction for adding a new owner to the Safe contract.
     *
     * @param {number} chainId - the chainId to build the transaction for.
     * @param {Address} address - The address of the new owner to be removed.
     * @returns {Promise<MetaTransaction>} - A meta-transaction object for adding the new owner.
     */
    removeOwnerTx(chainId: number, address: Address): Promise<MetaTransaction>;
    /**
     * Creates and returns a new `Erc4337Bundler` instance for the specified chain.
     *
     * @param {number} chainId - The ID of the blockchain network for which the bundler is to be created.
     * @returns {Erc4337Bundler} - A new instance of the `Erc4337Bundler` class configured for the specified chain.
     */
    private bundlerForChainId;
    /**
     * Handles routing of signature requests based on the provided method, chain ID, and parameters.
     *
     * @async
     * @function requestRouter
     * @param {SignRequestData} params - An object containing the method, chain ID, and request parameters.
     * @returns {Promise<{ evmMessage: string; payload: number[]; recoveryData: RecoveryData }>}
     * - Returns a promise that resolves to an object containing the Ethereum Virtual Machine (EVM) message,
     *   the payload (hashed data), and recovery data needed for reconstructing the signature request.
     */
    requestRouter({ method, chainId, params }: SignRequestData, sponsorshipPolicy?: string): Promise<EncodedSignRequest>;
    encodeForSafe(from: string): boolean;
    policyForChainId(chainId: number): Promise<SponsorshipPolicyData[]>;
    deploymentRequest(chainId: number): SignRequestData;
    addOwnerRequest(chainId: number, recoveryAddress: Address): SignRequestData;
}
