"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const constants_1 = require("../constants");
const rest_1 = __importDefault(require("./rest"));
/**
 * @description REST endpoints for data related to a particular address.
 */
class AccountClient extends rest_1.default {
    // ------ Subaccount ------ //
    async getSubaccounts(address, limit) {
        const uri = `/v4/addresses/${address}`;
        return this.get(uri, { limit });
    }
    async getSubaccount(address, subaccountNumber) {
        const uri = `/v4/addresses/${address}/subaccountNumber/${subaccountNumber}`;
        return this.get(uri);
    }
    async getParentSubaccount(address, parentSubaccountNumber) {
        const uri = `/v4/addresses/${address}/parentSubaccountNumber/${parentSubaccountNumber}`;
        return this.get(uri);
    }
    // ------ Positions ------ //
    async getSubaccountPerpetualPositions(address, subaccountNumber, status, limit, createdBeforeOrAtHeight, createdBeforeOrAt) {
        const uri = '/v4/perpetualPositions';
        return this.get(uri, {
            address,
            subaccountNumber,
            status,
            limit,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
        });
    }
    async getParentSubaccountNumberPerpetualPositions(address, parentSubaccountNumber, status, limit, createdBeforeOrAtHeight, createdBeforeOrAt) {
        const uri = '/v4/perpetualPositions/parentSubaccountNumber';
        const statusParam = Array.isArray(status) ? status : status != null ? [status] : undefined;
        return this.get(uri, {
            address,
            parentSubaccountNumber,
            status: statusParam,
            limit,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
        });
    }
    async getSubaccountAssetPositions(address, subaccountNumber, status, limit, createdBeforeOrAtHeight, createdBeforeOrAt) {
        const uri = '/v4/assetPositions';
        return this.get(uri, {
            address,
            subaccountNumber,
            status,
            limit,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
        });
    }
    // ------ Transfers ------ //
    async getTransfersBetween(sourceAddress, sourceSubaccountNumber, recipientAddress, recipientSubaccountNumber, createdBeforeOrAtHeight, createdBeforeOrAt) {
        const uri = '/v4/transfers/between';
        return this.get(uri, {
            sourceAddress,
            sourceSubaccountNumber,
            recipientAddress,
            recipientSubaccountNumber,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
        });
    }
    async getSubaccountTransfers(address, subaccountNumber, limit, createdBeforeOrAtHeight, createdBeforeOrAt, page) {
        const uri = '/v4/transfers';
        return this.get(uri, {
            address,
            subaccountNumber,
            limit,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
            page,
        });
    }
    async getParentSubaccountNumberTransfers(address, parentSubaccountNumber, limit, createdBeforeOrAtHeight, createdBeforeOrAt, page) {
        const uri = '/v4/transfers/parentSubaccountNumber';
        return this.get(uri, {
            address,
            parentSubaccountNumber,
            limit,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
            page,
        });
    }
    /**
     * Get wallet-to-wallet transfers (native token transfers) for a wallet address.
     * These are transfers that don't involve subaccounts - direct wallet transfers.
     *
     * @param address Wallet address to get transfers for.
     * @param assetId Optional asset ID to filter by (e.g., '1' for RIT).
     * @param limit Maximum number of transfers to return.
     * @param createdBeforeOrAtHeight Filter by block height.
     * @param createdBeforeOrAt Filter by timestamp.
     * @param page Page number for pagination.
     */
    async getWalletTransfers(address, assetId, limit, createdBeforeOrAtHeight, createdBeforeOrAt, page) {
        const uri = '/v4/transfers/wallet';
        return this.get(uri, {
            address,
            assetId,
            limit,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
            page,
        });
    }
    // ------ Orders ------ //
    async getSubaccountOrders(address, subaccountNumber, ticker, tickerType = constants_1.TickerType.PERPETUAL, side, status, type, limit, goodTilBlockBeforeOrAt, goodTilBlockTimeBeforeOrAt, returnLatestOrders) {
        const uri = '/v4/orders';
        return this.get(uri, {
            address,
            subaccountNumber,
            ticker,
            tickerType,
            side,
            status,
            type,
            limit,
            goodTilBlockBeforeOrAt,
            goodTilBlockTimeBeforeOrAt,
            returnLatestOrders,
        });
    }
    async getParentSubaccountNumberOrders(address, parentSubaccountNumber, ticker, side, status, type, limit, goodTilBlockBeforeOrAt, goodTilBlockTimeBeforeOrAt, returnLatestOrders) {
        const uri = '/v4/orders/parentSubaccountNumber';
        return this.get(uri, {
            address,
            parentSubaccountNumber,
            ticker,
            side,
            status,
            type,
            limit,
            goodTilBlockBeforeOrAt,
            goodTilBlockTimeBeforeOrAt,
            returnLatestOrders,
        });
    }
    async getOrder(orderId) {
        const uri = `/v4/orders/${orderId}`;
        return this.get(uri);
    }
    // ------ Fills ------ //
    async getSubaccountFills(address, subaccountNumber, ticker, tickerType = constants_1.TickerType.PERPETUAL, limit, createdBeforeOrAtHeight, createdBeforeOrAt, page) {
        const uri = '/v4/fills';
        return this.get(uri, {
            address,
            subaccountNumber,
            ticker,
            tickerType,
            limit,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
            page,
        });
    }
    async getParentSubaccountNumberFills(address, parentSubaccountNumber, ticker, tickerType = constants_1.TickerType.PERPETUAL, limit, createdBeforeOrAtHeight, createdBeforeOrAt, page) {
        const uri = '/v4/fills/parentSubaccountNumber';
        return this.get(uri, {
            address,
            parentSubaccountNumber,
            ticker,
            tickerType,
            limit,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
            page,
        });
    }
    // ------ Pnl ------ //
    async getSubaccountHistoricalPNLs(address, subaccountNumber, createdBeforeOrAtHeight, createdBeforeOrAt, createdOnOrAfterHeight, createdOnOrAfter, limit, page) {
        const uri = '/v4/historical-pnl';
        return this.get(uri, {
            address,
            subaccountNumber,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
            createdOnOrAfterHeight,
            createdOnOrAfter,
            limit,
            page,
        });
    }
    // limit applies to the subaccount ticks, so expect number of results to be much lower than limit
    async getParentSubaccountNumberHistoricalPNLs(address, parentSubaccountNumber, createdBeforeOrAtHeight, createdBeforeOrAt, createdOnOrAfterHeight, createdOnOrAfter, limit, page) {
        const uri = '/v4/historical-pnl/parentSubaccountNumber';
        return this.get(uri, {
            address,
            parentSubaccountNumber,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
            createdOnOrAfterHeight,
            createdOnOrAfter,
            limit,
            page,
        });
    }
    async getSubaccountHistoricalPNLsV2(address, subaccountNumber, 
    // false or undefined = hourly
    daily, createdBeforeOrAtHeight, createdBeforeOrAt, createdOnOrAfterHeight, createdOnOrAfter, limit, page) {
        const uri = '/v4/pnl';
        return this.get(uri, {
            address,
            subaccountNumber,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
            createdOnOrAfterHeight,
            createdOnOrAfter,
            limit,
            page,
            daily,
        });
    }
    async getParentSubaccountNumberHistoricalPNLsV2(address, parentSubaccountNumber, 
    // false or undefined = hourly
    daily, createdBeforeOrAtHeight, createdBeforeOrAt, createdOnOrAfterHeight, createdOnOrAfter) {
        const uri = '/v4/pnl/parentSubaccountNumber';
        return this.get(uri, {
            address,
            parentSubaccountNumber,
            createdBeforeOrAtHeight,
            createdBeforeOrAt,
            createdOnOrAfterHeight,
            createdOnOrAfter,
            daily,
        });
    }
    // ------ Rewards ------ //
    async getHistoricalTradingRewardsAggregations(address, period, limit, startingBeforeOrAt, startingBeforeOrAtHeight) {
        const uri = `/v4/historicalTradingRewardAggregations/${address}`;
        return this.get(uri, { period, limit, startingBeforeOrAt, startingBeforeOrAtHeight });
    }
    async getHistoricalBlockTradingRewards(address, limit, startingBeforeOrAt, startingBeforeOrAtHeight) {
        const uri = `/v4/historicalBlockTradingRewards/${address}`;
        return this.get(uri, { limit, startingBeforeOrAt, startingBeforeOrAtHeight });
    }
    // ------ Funding Payments------ //
    async getSubaccountFundingPayments(address, subaccountNumber, limit, ticker, afterOrAt, page) {
        const uri = `/v4/fundingPayments`;
        return this.get(uri, { address, subaccountNumber, limit, ticker, afterOrAt, page });
    }
    async getParentSubaccountNumberFundingPayments(address, parentSubaccountNumber, limit, ticker, afterOrAt, page) {
        const uri = `/v4/fundingPayments/parentSubaccount`;
        return this.get(uri, { address, parentSubaccountNumber, limit, ticker, afterOrAt, page });
    }
}
exports.default = AccountClient;
//# sourceMappingURL=data:application/json;base64, 