const autoPayStore = new Map();
export async function setAutoPay(params) {
    const { Wallet } = await import('ethers');
    const wallet = new Wallet(params.walletPrivateKey);
    const config = {
        enabled: true,
        walletPrivateKey: params.walletPrivateKey,
        rpcUrl: params.rpcUrl ?? 'https://eth.llamarpc.com',
        maxGasPrice: params.maxGasPrice,
        whitelist: params.whitelist,
    };
    autoPayStore.set(params.agentId, config);
    return {
        agentId: params.agentId,
        enabled: true,
        walletAddress: wallet.address,
        rpcUrl: config.rpcUrl,
    };
}
export async function getAutoPayConfig(agentId) {
    return autoPayStore.get(agentId) ?? null;
}
export async function disableAutoPay(agentId) {
    const config = autoPayStore.get(agentId);
    if (config) {
        config.enabled = false;
    }
    return { agentId, enabled: false };
}
