"use strict";
/**
 * Token operations — thin wrappers around the wallet-worker RPCs that
 * implement the OData `sendNight` / `shieldFunds` / `unshieldFunds`
 * actions. Each wrapper translates between the OData/user-facing shape
 * and the worker's primitive RPC contract.
 *
 * Pattern mirrors `srv/submission/dust-registration.ts`. The worker owns
 * the wallet facade; main thread just orchestrates and persists the
 * audit record.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendNight = sendNight;
exports.unshieldFunds = unshieldFunds;
exports.shieldFunds = shieldFunds;
exports.getWalletBalance = getWalletBalance;
exports.estimateSendNightFee = estimateSendNightFee;
exports.estimateUnshieldFee = estimateUnshieldFee;
exports.estimateShieldFee = estimateShieldFee;
const wallet_worker_client_1 = require("../midnight/wallet-worker-client");
async function sendNight(args) {
    return (0, wallet_worker_client_1.walletTransferNight)({
        sessionId: args.cacheKey,
        receiverAddress: args.receiverAddress,
        amount: args.amount,
        ttlIso: args.ttlIso,
        syncTimeoutMs: args.syncTimeoutMs
    });
}
async function unshieldFunds(args) {
    return (0, wallet_worker_client_1.walletUnshieldNight)({
        sessionId: args.cacheKey,
        amount: args.amount,
        ttlIso: args.ttlIso,
        syncTimeoutMs: args.syncTimeoutMs
    });
}
async function shieldFunds(args) {
    return (0, wallet_worker_client_1.walletShieldNight)({
        sessionId: args.cacheKey,
        amount: args.amount,
        ttlIso: args.ttlIso,
        syncTimeoutMs: args.syncTimeoutMs
    });
}
async function getWalletBalance(args) {
    return (0, wallet_worker_client_1.walletGetBalance)({
        sessionId: args.cacheKey,
        syncTimeoutMs: args.syncTimeoutMs
    });
}
async function estimateSendNightFee(args) {
    return (0, wallet_worker_client_1.walletEstimateTransferFee)({
        sessionId: args.cacheKey,
        receiverAddress: args.receiverAddress,
        amount: args.amount,
        ttlIso: args.ttlIso,
        syncTimeoutMs: args.syncTimeoutMs
    });
}
async function estimateUnshieldFee(args) {
    return (0, wallet_worker_client_1.walletEstimateSwapFee)({
        sessionId: args.cacheKey,
        direction: 'unshield',
        amount: args.amount,
        ttlIso: args.ttlIso,
        syncTimeoutMs: args.syncTimeoutMs
    });
}
async function estimateShieldFee(args) {
    return (0, wallet_worker_client_1.walletEstimateSwapFee)({
        sessionId: args.cacheKey,
        direction: 'shield',
        amount: args.amount,
        ttlIso: args.ttlIso,
        syncTimeoutMs: args.syncTimeoutMs
    });
}
