"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlockchainIntegrationsClient = void 0;
const constants_1 = require("../constants");
class BlockchainIntegrationsClient {
    constructor(client) {
        this.client = client;
    }
    checkNotEmptyNetwork(network) {
        if (!network) {
            throw Error('network cannot be empty');
        }
    }
    async getAddress(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetAddress, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async getBalance(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetBalance, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async getNativeBalance(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetNativeBalance, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async getAssetBalance(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetAssetBalance, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async listTransactions(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsListTransactions, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async getBlock(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetBlock, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async getBlockNumber(network) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetBlockNumber, network);
        const resp = await this.client.post(path);
        return resp.data;
    }
    async getContract(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetContract, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async callContractView(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsCallContractView, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async submitGenericTransaction(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsSubmitGenericTransaction, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async submitPaymentTransaction(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsSubmitPaymentTransaction, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async getNft(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetNft, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async getNftBalance(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetNftBalance, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async getTransaction(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsGetTransaction, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async checkIsNft(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsCheckIsNft, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
    async startWalletConnectSession(network, body) {
        this.checkNotEmptyNetwork(network);
        const { path } = (0, constants_1.getBlockchainIntegrationEndpointDetails)(constants_1.PrivateApiEndpoint.BlockchainIntegrationsStartWalletConnectSession, network);
        const resp = await this.client.post(path, body);
        return resp.data;
    }
}
exports.BlockchainIntegrationsClient = BlockchainIntegrationsClient;
