"use strict";
// SPDX-License-Identifier: Apache-2.0
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
require("../environmentMock");
const in_1 = require("../../../src/port/in");
const config_1 = require("../../config");
const ConnectRequest_1 = __importDefault(require("../../../src/port/in/request/network/ConnectRequest"));
const Injectable_1 = __importDefault(require("../../../src/core/injectable/Injectable"));
const RegulationType_1 = require("../../../src/domain/context/factory/RegulationType");
in_1.SDK.log = { level: "ERROR", transports: new in_1.LoggerTransports.Console() };
const decimals = 0;
const name = "TEST_SECURITY_TOKEN";
const symbol = "TEST";
const isin = "ABCDE123456Z";
const currency = "0x455552";
const TIME = 30;
const numberOfUnits = "1000";
const nominalValue = "100";
const nominalValueDecimals = 3;
const currentTimeInSeconds = Math.floor(new Date().getTime() / 1000) + 1000;
const startingDate = currentTimeInSeconds + TIME;
const numberOfCoupons = 15;
const couponFrequency = 7;
const couponRate = "3";
const maturityDate = startingDate + numberOfCoupons * couponFrequency;
const firstCouponDate = startingDate + 1;
const regulationType = RegulationType_1.RegulationType.REG_S;
const regulationSubType = RegulationType_1.RegulationSubType.NONE;
const countries = "AF,HG,BN";
const info = "Anything";
const configId = "0x0000000000000000000000000000000000000000000000000000000000000000";
const configVersion = 0;
const mirrorNode = {
    name: "testmirrorNode",
    baseUrl: "https://testnet.mirrornode.hedera.com/api/v1/",
};
const rpcNode = {
    name: "testrpcNode",
    baseUrl: "http://localhost:7546",
};
describe("Fireblocks Transaction Adapter test", () => {
    let bond;
    beforeAll(async () => {
        await in_1.Network.connect(new ConnectRequest_1.default({
            network: "testnet",
            wallet: in_1.SupportedWallets.FIREBLOCKS,
            mirrorNode: mirrorNode,
            rpcNode: rpcNode,
            custodialWalletSettings: config_1.FIREBLOCKS_SETTINGS,
        }));
        await in_1.Network.init(new in_1.InitializationRequest({
            network: "testnet",
            configuration: {
                factoryAddress: config_1.FACTORY_ADDRESS,
                resolverAddress: config_1.RESOLVER_ADDRESS,
            },
            mirrorNode: mirrorNode,
            rpcNode: rpcNode,
        }));
        Injectable_1.default.resolveTransactionHandler();
        //Create a security for example a bond
        const requestST = new in_1.CreateBondRequest({
            name: name,
            symbol: symbol,
            isin: isin,
            decimals: decimals,
            isWhiteList: false,
            erc20VotesActivated: false,
            isControllable: true,
            arePartitionsProtected: false,
            clearingActive: false,
            internalKycActivated: true,
            isMultiPartition: false,
            diamondOwnerAccount: config_1.FIREBLOCKS_SETTINGS.hederaAccountId,
            currency: currency,
            numberOfUnits: numberOfUnits.toString(),
            nominalValue: nominalValue,
            nominalValueDecimals: nominalValueDecimals,
            startingDate: startingDate.toString(),
            maturityDate: maturityDate.toString(),
            regulationType: RegulationType_1.CastRegulationType.toNumber(regulationType),
            regulationSubType: RegulationType_1.CastRegulationSubType.toNumber(regulationSubType),
            isCountryControlListWhiteList: true,
            countries: countries,
            info: info,
            configId: configId,
            configVersion: configVersion,
        });
        bond = (await in_1.Bond.create(requestST)).security;
        console.log(bond.diamondAddress);
        console.log(bond.evmDiamondAddress);
        console.log("bond: " + JSON.stringify(bond));
    }, 600_000);
    it("Fireblocks should create a Bond", async () => {
        expect(bond).not.toBeNull();
    }, 60_000);
});
