// SPDX-License-Identifier: Apache-2.0
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
/* eslint-disable no-case-declarations */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { CommandBus } from "../../../core/command/CommandBus";
import { _PARTITION_ID_1, CANCEL_AMORTIZATION_EVENT, CANCEL_COUPON_EVENT, CANCEL_DIVIDEND_EVENT, CANCEL_SCHEDULED_BALANCE_ADJUSTMENT_EVENT, CANCEL_VOTING_EVENT, EVM_ZERO_ADDRESS, GAS, NOMINAL_VALUE_SET_EVENT, RELEASE_AMORTIZATION_HOLD_EVENT, SET_AMORTIZATION_EVENT, SET_AMORTIZATION_HOLD_EVENT, SET_COUPON_EVENT, SET_DIVIDEND_EVENT, SET_SCHEDULED_BALANCE_ADJUSTMENT_EVENT, SET_VOTING_RIGHTS_EVENT, } from "../../../core/Constants";
import { lazyInject } from "../../../core/decorator/LazyInjectDecorator";
import { CastRateStatus } from "../../../domain/context/bond/RateStatus";
import { FactoryBondFixedRateToken, FactoryBondKpiLinkedRateToken, FactoryBondToken, FactoryEquityToken, } from "../../../domain/context/factory/FactorySecurityToken";
import { CastClearingOperationType, } from "../../../domain/context/security/Clearing";
import { SecurityDataBuilder } from "../../../domain/context/util/SecurityDataBuilder";
import { AccessControlFacet__factory, Bond__factory, CapFacet__factory, Coupon__factory, ClearingActionsFacet__factory, ClearingHoldCreationFacet__factory, ClearingRedeemFacet__factory, ClearingTransferFacet__factory, ControlListFacet__factory, DiamondFacet__factory, Dividend__factory, Equity__factory, ERC1410IssuerFacet__factory, ERC1410ManagementFacet__factory, ERC1410TokenHolderFacet__factory, ERC1643Facet__factory, ERC3643BatchFacet__factory, ERC3643ManagementFacet__factory, ERC3643OperationsFacet__factory, ExternalControlListManagementFacet__factory, ExternalKycListManagementFacet__factory, ExternalPauseManagementFacet__factory, Factory__factory, FixedRate__factory, FreezeFacet__factory, HoldManagementFacet__factory, HoldTokenHolderFacet__factory, VotingFacet__factory, KpiLinkedRate__factory, Kpis__factory, KycFacet__factory, LockFacet__factory, MockedBlacklist__factory, MockedExternalKycList__factory, MockedExternalPause__factory, MockedWhitelist__factory, PauseFacet__factory, ProceedRecipientsFacet__factory, ProtectedPartitionsFacet__factory, ScheduledCrossOrderedTasksFacet__factory, SnapshotsFacet__factory, SsiManagementFacet__factory, TransferAndLockFacet__factory, TREXFactoryAts__factory, NominalValue__factory, AmortizationFacet__factory, } from "@hashgraph/asset-tokenization-contracts";
import EventService from "../../../app/service/event/EventService";
import LogService from "../../../app/service/log/LogService";
import NetworkService from "../../../app/service/network/NetworkService";
import MetamaskService from "../../../app/service/wallet/metamask/MetamaskService";
import { singleton } from "tsyringe";
import { SigningError } from "../error/SigningError";
import { MirrorNodeAdapter } from "../mirror/MirrorNodeAdapter";
import TransactionAdapter from "../TransactionAdapter";
import { RPCTransactionResponseAdapter } from "../../out/response/RPCTransactionResponseAdapter";
let RPCTransactionAdapter = class RPCTransactionAdapter extends TransactionAdapter {
    mirrorNodeAdapter;
    networkService;
    eventService;
    commandBus;
    metamaskService;
    constructor(mirrorNodeAdapter, networkService, eventService, commandBus) {
        super();
        this.mirrorNodeAdapter = mirrorNodeAdapter;
        this.networkService = networkService;
        this.eventService = eventService;
        this.commandBus = commandBus;
        this.metamaskService = new MetamaskService(this.eventService, this.commandBus, this.networkService, this.mirrorNodeAdapter);
        this.metamaskService.registerMetamaskEvents();
    }
    async init(debug = false) {
        return this.metamaskService.init(debug);
    }
    async register(account, debug = false) {
        return this.metamaskService.register(this, account, debug);
    }
    async stop() {
        return this.metamaskService.stop();
    }
    getMirrorNodeAdapter() {
        return this.mirrorNodeAdapter;
    }
    getAccount() {
        return this.metamaskService.getAccount();
    }
    setConfig(config) {
        this.metamaskService.setConfig({
            mirrorNodes: config.mirrorNodes,
            jsonRpcRelays: config.jsonRpcRelays,
            factories: config.factories,
            resolvers: config.resolvers,
        });
    }
    getSignerOrProvider() {
        return this.metamaskService.getSignerOrProvider();
    }
    setSignerOrProvider(signerOrProvider) {
        return this.metamaskService.setSignerOrProvider(signerOrProvider);
    }
    async createEquity(securityInfo, equityInfo, factory, resolver, configId, configVersion, compliance, identityRegistryAddress, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount) {
        return this.createSecurity(securityInfo, SecurityDataBuilder.buildEquityDetails(equityInfo), factory, resolver, configId, configVersion, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount, (security, details) => new FactoryEquityToken(security, details), "deployEquity", GAS.CREATE_EQUITY_ST, "EquityDeployed", compliance, identityRegistryAddress);
    }
    async createBond(securityInfo, bondInfo, factory, resolver, configId, configVersion, compliance, identityRegistryAddress, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount, proceedRecipients = [], proceedRecipientsData = []) {
        return this.createSecurity(securityInfo, {
            bondDetails: SecurityDataBuilder.buildBondDetails(bondInfo),
        }, factory, resolver, configId, configVersion, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount, (security, details) => new FactoryBondToken(security, details.bondDetails, proceedRecipients.map((addr) => addr.toString()), proceedRecipientsData.map((data) => (data == "" ? "0x" : data))), "deployBond", GAS.CREATE_BOND_ST, "BondDeployed", compliance, identityRegistryAddress);
    }
    async createBondFixedRate(securityInfo, bondFixedRateDetails, factory, resolver, configId, configVersion, compliance, identityRegistryAddress, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount, proceedRecipients = [], proceedRecipientsData = [], factoryId) {
        return this.createSecurity(securityInfo, {
            bondDetails: SecurityDataBuilder.buildBondFixedRateDetails(bondFixedRateDetails),
        }, factory, resolver, configId, configVersion, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount, (security, details) => new FactoryBondFixedRateToken(security, details.bondDetails, proceedRecipients.map((addr) => addr.toString()), proceedRecipientsData.map((data) => (data == "" ? "0x" : data))), "deployBondFixedRate", GAS.CREATE_BOND_ST, "BondFixedRateDeployed", compliance, identityRegistryAddress);
    }
    async createBondKpiLinkedRate(securityInfo, bondKpiLinkedRateDetails, factory, resolver, configId, configVersion, compliance, identityRegistryAddress, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount, proceedRecipients = [], proceedRecipientsData = [], factoryId) {
        return this.createSecurity(securityInfo, {
            bondDetails: SecurityDataBuilder.buildBondKpiLinkedRateDetails(bondKpiLinkedRateDetails),
        }, factory, resolver, configId, configVersion, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount, (security, details) => new FactoryBondKpiLinkedRateToken(security, details.bondDetails, proceedRecipients.map((addr) => addr.toString()), proceedRecipientsData.map((data) => (data == "" ? "0x" : data))), "deployBondKpiLinkedRate", GAS.CREATE_BOND_ST, "BondKpiLinkedRateDeployed", compliance, identityRegistryAddress);
    }
    async transfer(security, targetId, amount) {
        LogService.logTrace(`Transfering ${amount} securities to account ${targetId.toString()}`);
        const basicTransferInfo = {
            to: targetId.toString(),
            value: amount.toHexString(),
        };
        return this.executeTransaction(ERC1410TokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "transferByPartition", [_PARTITION_ID_1, basicTransferInfo, "0x"], GAS.TRANSFER);
    }
    async transferAndLock(security, targetId, amount, expirationDate) {
        LogService.logTrace(`Transfering ${amount} securities to account ${targetId.toString()} and locking them until ${expirationDate.toString()}`);
        return this.executeTransaction(TransferAndLockFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "transferAndLockByPartition", [_PARTITION_ID_1, targetId.toString(), amount.toBigInt(), "0x", expirationDate.toBigInt()], GAS.TRANSFER_AND_LOCK);
    }
    async redeem(security, amount) {
        LogService.logTrace(`Redeeming ${amount} securities`);
        return this.executeTransaction(ERC1410TokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "redeemByPartition", [_PARTITION_ID_1, amount.toBigInt(), "0x"], GAS.REDEEM);
    }
    async burn(security, source, amount) {
        LogService.logTrace(`Burning ${amount} securities from source: ${source.toString()}`);
        return this.executeTransaction(ERC3643OperationsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "burn", [source.toString(), amount.toBigInt()], GAS.BURN);
    }
    async pause(security) {
        LogService.logTrace(`Pausing security: ${security.toString()}`);
        return this.executeTransaction(PauseFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "pause", [], GAS.PAUSE);
    }
    async unpause(security) {
        LogService.logTrace(`Unpausing security: ${security.toString()}`);
        return this.executeTransaction(PauseFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "unpause", [], GAS.UNPAUSE);
    }
    async grantRole(security, targetId, role) {
        LogService.logTrace(`Granting role ${role.toString()} to account: ${targetId.toString()}`);
        return this.executeTransaction(AccessControlFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "grantRole", [role, targetId.toString()], GAS.GRANT_ROLES);
    }
    async applyRoles(security, targetId, roles, actives) {
        let gas = roles.length * GAS.GRANT_ROLES;
        gas = gas > GAS.MAX_ROLES ? GAS.MAX_ROLES : gas;
        return this.executeTransaction(AccessControlFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "applyRoles", [roles, actives, targetId.toString()], gas);
    }
    async revokeRole(security, targetId, role) {
        LogService.logTrace(`Revoking role ${role.toString()} to account: ${targetId.toString()}`);
        return this.executeTransaction(AccessControlFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "revokeRole", [role, targetId.toString()], GAS.GRANT_ROLES);
    }
    async renounceRole(security, role) {
        LogService.logTrace(`Renounce role ${role.toString()}`);
        return this.executeTransaction(AccessControlFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "renounceRole", [role], GAS.RENOUNCE_ROLES);
    }
    async issue(security, targetId, amount) {
        LogService.logTrace(`Issue ${amount} ${security} to account: ${targetId.toString()}`);
        const issueData = {
            partition: _PARTITION_ID_1,
            tokenHolder: targetId.toString(),
            value: amount.toHexString(),
            data: "0x",
        };
        return this.executeTransaction(ERC1410IssuerFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "issueByPartition", [issueData], GAS.ISSUE);
    }
    async mint(security, target, amount) {
        LogService.logTrace(`Minting ${amount} ${security} to account: ${target.toString()}`);
        return this.executeTransaction(ERC3643OperationsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "mint", [target.toString(), amount.toBigInt()], GAS.MINT);
    }
    async addToControlList(security, targetId) {
        LogService.logTrace(`Adding account ${targetId.toString()} to a control list`);
        return this.executeTransaction(ControlListFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "addToControlList", [targetId.toString()], GAS.ADD_TO_CONTROL_LIST);
    }
    async removeFromControlList(security, targetId) {
        LogService.logTrace(`Adding account ${targetId.toString()} to a control list`);
        return this.executeTransaction(ControlListFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "removeFromControlList", [targetId.toString()], GAS.REMOVE_FROM_CONTROL_LIST);
    }
    async controllerTransfer(security, sourceId, targetId, amount) {
        LogService.logTrace(`Controller transfer ${amount} tokens from account ${sourceId.toString()} to account ${targetId.toString()}`);
        return this.executeTransaction(ERC1410ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "controllerTransferByPartition", [_PARTITION_ID_1, sourceId.toString(), targetId.toString(), amount.toBigInt(), "0x", "0x"], GAS.CONTROLLER_TRANSFER);
    }
    async forcedTransfer(security, source, target, amount) {
        LogService.logTrace(`Forced transfer ${amount} tokens from account ${source.toString()} to account ${target.toString()}`);
        return this.executeTransaction(ERC3643OperationsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "forcedTransfer", [source.toString(), target.toString(), amount.toBigInt()], GAS.FORCED_TRANSFER);
    }
    async controllerRedeem(security, sourceId, amount) {
        LogService.logTrace(`Force redeem ${amount} tokens from account ${sourceId.toString()}`);
        return this.executeTransaction(ERC1410ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "controllerRedeemByPartition", [_PARTITION_ID_1, sourceId.toString(), amount.toBigInt(), "0x", "0x"], GAS.CONTROLLER_REDEEM);
    }
    async setDividend(security, recordDate, executionDate, amount) {
        LogService.logTrace(`equity: ${security} ,
      recordDate :${recordDate} , 
      executionDate: ${executionDate},
      amount : ${amount}  `);
        const dividendStruct = {
            recordDate: recordDate.toBigInt(),
            executionDate: executionDate.toBigInt(),
            amount: amount.toBigInt(),
            amountDecimals: amount.decimals,
        };
        return this.executeTransaction(Dividend__factory.connect(security.toString(), this.getSignerOrProvider()), "setDividend", [dividendStruct], GAS.SET_DIVIDENDS, SET_DIVIDEND_EVENT);
    }
    async cancelDividend(security, dividendId) {
        return this.executeTransaction(Dividend__factory.connect(security.toString(), this.getSignerOrProvider()), "cancelDividend", [dividendId], GAS.CANCEL_DIVIDEND, CANCEL_DIVIDEND_EVENT);
    }
    async setVotingRights(security, recordDate, data) {
        LogService.logTrace(`equity: ${security} ,
      recordDate :${recordDate} , `);
        const votingStruct = {
            recordDate: recordDate.toBigInt(),
            data: data,
        };
        return this.executeTransaction(VotingFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setVoting", [votingStruct], GAS.SET_VOTING_RIGHTS, SET_VOTING_RIGHTS_EVENT);
    }
    async setCoupon(security, recordDate, executionDate, rate, startDate, endDate, fixingDate, rateStatus, securityId) {
        LogService.logTrace(`bond: ${security} ,
      recordDate :${recordDate} , 
      executionDate: ${executionDate},
      rate : ${rate},
      rateStatus : ${rateStatus},
      startDate: ${startDate},
      endDate: ${endDate},
      fixingDate: ${fixingDate}`);
        const couponStruct = {
            recordDate: recordDate.toBigInt(),
            executionDate: executionDate.toBigInt(),
            rate: rate.toBigInt(),
            rateDecimals: rate.decimals,
            startDate: startDate.toBigInt(),
            endDate: endDate.toBigInt(),
            fixingDate: fixingDate.toBigInt(),
            rateStatus: CastRateStatus.toNumber(rateStatus),
        };
        return this.executeTransaction(Coupon__factory.connect(security.toString(), this.getSignerOrProvider()), "setCoupon", [couponStruct], GAS.SET_COUPON, SET_COUPON_EVENT);
    }
    async cancelCoupon(security, couponId) {
        LogService.logTrace(`Cancelling coupon: ${couponId} for bond: ${security}`);
        return this.executeTransaction(Coupon__factory.connect(security.toString(), this.getSignerOrProvider()), "cancelCoupon", [couponId], GAS.CANCEL_COUPON, CANCEL_COUPON_EVENT);
    }
    async cancelVoting(security, votingId) {
        LogService.logTrace(`Cancelling voting: ${votingId} for equity: ${security}`);
        return this.executeTransaction(VotingFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "cancelVoting", [votingId], GAS.CANCEL_VOTING, CANCEL_VOTING_EVENT);
    }
    async takeSnapshot(security) {
        LogService.logTrace(`Take snapshot of: ${security.toString()}`);
        return this.executeTransaction(SnapshotsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "takeSnapshot", [], GAS.TAKE_SNAPSHOT);
    }
    async setDocument(security, name, uri, hash) {
        LogService.logTrace(`Setting document: ${name}, with ${uri}, and hash ${hash} for security ${security.toString()}`);
        return this.executeTransaction(ERC1643Facet__factory.connect(security.toString(), this.getSignerOrProvider()), "setDocument", [name, uri, hash], GAS.SET_DOCUMENT);
    }
    async removeDocument(security, name) {
        LogService.logTrace(`Removing document: ${name} for security ${security.toString()}`);
        return this.executeTransaction(ERC1643Facet__factory.connect(security.toString(), this.getSignerOrProvider()), "removeDocument", [name], GAS.REMOVE_DOCUMENT);
    }
    async authorizeOperator(security, targetId) {
        LogService.logTrace(`authorizing operator: ${targetId.toString()} for security ${security.toString()}`);
        return this.executeTransaction(ERC1410TokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "authorizeOperator", [targetId.toString()], GAS.AUTHORIZE_OPERATOR);
    }
    async revokeOperator(security, targetId) {
        LogService.logTrace(`revoking operator: ${targetId.toString()} for security ${security.toString()}`);
        return this.executeTransaction(ERC1410TokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "revokeOperator", [targetId.toString()], GAS.REVOKE_OPERATOR);
    }
    async authorizeOperatorByPartition(security, targetId, partitionId) {
        LogService.logTrace(`authorizing operator: ${targetId.toString()} for security ${security.toString()} and partition ${partitionId}`);
        return this.executeTransaction(ERC1410TokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "authorizeOperatorByPartition", [partitionId, targetId.toString()], GAS.AUTHORIZE_OPERATOR);
    }
    async revokeOperatorByPartition(security, targetId, partitionId) {
        LogService.logTrace(`revoking operator: ${targetId.toString()} for security ${security.toString()} and partition ${partitionId}`);
        return this.executeTransaction(ERC1410TokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "revokeOperatorByPartition", [partitionId, targetId.toString()], GAS.REVOKE_OPERATOR);
    }
    async operatorTransferByPartition(security, sourceId, targetId, amount, partitionId) {
        LogService.logTrace(`Transfering ${amount} securities to account ${targetId.toString()} for partition ${partitionId}`);
        const operatorTransferData = {
            partition: partitionId,
            from: sourceId.toString(),
            to: targetId.toString(),
            value: amount.toHexString(),
            data: "0x",
            operatorData: "0x",
        };
        return this.executeTransaction(ERC1410ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "operatorTransferByPartition", [operatorTransferData], GAS.TRANSFER_OPERATOR);
    }
    async setMaxSupply(security, maxSupply) {
        LogService.logTrace(`Setting max supply ${maxSupply} for security ${security.toString()}`);
        return this.executeTransaction(CapFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setMaxSupply", [maxSupply.toBigInt()], GAS.SET_MAX_SUPPLY);
    }
    async triggerPendingScheduledSnapshots(security) {
        LogService.logTrace(`Triggerring pending scheduled snapshots for ${security.toString()}`);
        return this.executeTransaction(ScheduledCrossOrderedTasksFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "triggerPendingScheduledCrossOrderedTasks", [], GAS.TRIGGER_PENDING_SCHEDULED_SNAPSHOTS);
    }
    async triggerScheduledSnapshots(security, max) {
        LogService.logTrace(`Triggerring up to ${max.toString()} pending scheduled snapshots for ${security.toString()}`);
        return this.executeTransaction(ScheduledCrossOrderedTasksFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "triggerScheduledCrossOrderedTasks", [max.toBigInt()], GAS.TRIGGER_PENDING_SCHEDULED_SNAPSHOTS);
    }
    async lock(security, sourceId, amount, expirationDate) {
        LogService.logTrace(`Locking ${amount} tokens from account ${sourceId.toString()} until ${expirationDate}`);
        return this.executeTransaction(LockFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "lockByPartition", [_PARTITION_ID_1, amount.toBigInt(), sourceId.toString(), expirationDate.toBigInt()], GAS.LOCK);
    }
    async release(security, sourceId, lockId) {
        LogService.logTrace(`Releasing lock ${lockId} from account ${sourceId.toString()}`);
        return this.executeTransaction(LockFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "releaseByPartition", [_PARTITION_ID_1, lockId.toBigInt(), sourceId.toString()], GAS.RELEASE);
    }
    async updateConfigVersion(security, configVersion) {
        LogService.logTrace(`Updating config version ${configVersion} for security ${security.toString()}`);
        return this.executeTransaction(DiamondFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "updateConfigVersion", [configVersion], GAS.UPDATE_CONFIG_VERSION);
    }
    async updateConfig(security, configId, configVersion) {
        LogService.logTrace(`Updating config ${configId} & version ${configVersion} for security ${security.toString()}`);
        return this.executeTransaction(DiamondFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "updateConfig", [configId, configVersion], GAS.UPDATE_CONFIG);
    }
    async updateResolver(security, resolver, configVersion, configId) {
        LogService.logTrace(`Updating resolver ${resolver.toString()} for security ${security.toString()}`);
        return this.executeTransaction(DiamondFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "updateResolver", [resolver.toString(), configId, configVersion], GAS.UPDATE_RESOLVER);
    }
    async updateMaturityDate(security, maturityDate) {
        LogService.logTrace(`Updating bond maturity date ${maturityDate} for security ${security.toString()}`);
        return this.executeTransaction(Bond__factory.connect(security.toString(), this.getSignerOrProvider()), "updateMaturityDate", [maturityDate], GAS.UPDATE_MATURITY_DATE);
    }
    async setScheduledBalanceAdjustment(security, executionDate, factor, decimals) {
        LogService.logTrace(`equity: ${security} ,
            executionDate :${executionDate} ,
            factor: ${factor},
            decimals : ${decimals}  `);
        const scheduledBalanceAdjustmentStruct = {
            executionDate: executionDate.toBigInt(),
            factor: factor.toBigInt(),
            decimals: decimals.toBigInt(),
        };
        return this.executeTransaction(Equity__factory.connect(security.toString(), this.getSignerOrProvider()), "setScheduledBalanceAdjustment", [scheduledBalanceAdjustmentStruct], GAS.SET_SCHEDULED_BALANCE_ADJUSTMENT, SET_SCHEDULED_BALANCE_ADJUSTMENT_EVENT);
    }
    async protectPartitions(address) {
        LogService.logTrace(`Protecting Partitions for security: ${address.toString()}`);
        return this.executeTransaction(ProtectedPartitionsFacet__factory.connect(address.toString(), this.getSignerOrProvider()), "protectPartitions", [], GAS.PROTECT_PARTITION);
    }
    async unprotectPartitions(address) {
        LogService.logTrace(`Unprotecting Partitions for security: ${address.toString()}`);
        return this.executeTransaction(ProtectedPartitionsFacet__factory.connect(address.toString(), this.getSignerOrProvider()), "unprotectPartitions", [], GAS.UNPROTECT_PARTITION);
    }
    async protectedRedeemFromByPartition(security, partitionId, sourceId, amount, deadline, nounce, signature) {
        LogService.logTrace(`Protected Redeeming ${amount} securities from account ${sourceId.toString()}`);
        const protectionData = {
            deadline: deadline.toBigInt(),
            nounce: nounce.toBigInt(),
            signature: signature,
        };
        return this.executeTransaction(ERC1410ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "protectedRedeemFromByPartition", [partitionId, sourceId.toString(), amount.toBigInt(), protectionData], GAS.PROTECTED_REDEEM);
    }
    async protectedTransferFromByPartition(security, partitionId, sourceId, targetId, amount, deadline, nounce, signature) {
        LogService.logTrace(`Protected Transfering ${amount} securities from account ${sourceId.toString()} to account ${targetId.toString()}`);
        const protectionData = {
            deadline: deadline.toBigInt(),
            nounce: nounce.toBigInt(),
            signature: signature,
        };
        return this.executeTransaction(ERC1410ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "protectedTransferFromByPartition", [partitionId, sourceId.toString(), targetId.toString(), amount.toBigInt(), protectionData], GAS.PROTECTED_TRANSFER);
    }
    async createHoldByPartition(security, partitionId, escrowId, amount, targetId, expirationDate) {
        LogService.logTrace(`Holding ${amount} tokens from account ${targetId.toString()} until ${expirationDate} with escrow ${escrowId}`);
        const hold = {
            amount: amount.toBigInt(),
            expirationTimestamp: expirationDate.toBigInt(),
            escrow: escrowId.toString(),
            to: targetId.toString(),
            data: "0x",
        };
        return this.executeTransaction(HoldTokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "createHoldByPartition", [partitionId, hold], GAS.CREATE_HOLD);
    }
    async createHoldFromByPartition(security, partitionId, escrowId, amount, sourceId, targetId, expirationDate) {
        LogService.logTrace(`Holding ${amount} tokens from account ${sourceId.toString()} until ${expirationDate} with escrow ${escrowId}`);
        const hold = {
            amount: amount.toBigInt(),
            expirationTimestamp: expirationDate.toBigInt(),
            escrow: escrowId.toString(),
            to: targetId.toString(),
            data: "0x",
        };
        return this.executeTransaction(HoldTokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "createHoldFromByPartition", [partitionId, sourceId.toString(), hold, "0x"], GAS.CREATE_HOLD_FROM);
    }
    async controllerCreateHoldByPartition(security, partitionId, escrowId, amount, sourceId, targetId, expirationDate) {
        LogService.logTrace(`Controller Holding ${amount} tokens from account ${sourceId.toString()} until ${expirationDate} with escrow ${escrowId}`);
        const hold = {
            amount: amount.toBigInt(),
            expirationTimestamp: expirationDate.toBigInt(),
            escrow: escrowId.toString(),
            to: targetId.toString(),
            data: "0x",
        };
        return this.executeTransaction(HoldManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "controllerCreateHoldByPartition", [partitionId, sourceId.toString(), hold, "0x"], GAS.CONTROLLER_CREATE_HOLD);
    }
    async protectedCreateHoldByPartition(security, partitionId, amount, escrowId, sourceId, targetId, expirationDate, deadline, nonce, signature) {
        LogService.logTrace(`Protected Holding ${amount} tokens from account ${sourceId.toString()} until ${expirationDate} with escrow ${escrowId}`);
        const hold = {
            amount: amount.toBigInt(),
            expirationTimestamp: expirationDate.toBigInt(),
            escrow: escrowId.toString(),
            to: targetId.toString(),
            data: "0x",
        };
        const protectedHold = {
            hold,
            deadline: deadline.toBigInt(),
            nonce: nonce.toBigInt(),
        };
        return this.executeTransaction(HoldManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "protectedCreateHoldByPartition", [partitionId, sourceId.toString(), protectedHold, signature], GAS.PROTECTED_CREATE_HOLD);
    }
    async releaseHoldByPartition(security, partitionId, holdId, targetId, amount) {
        LogService.logTrace(`Releasing hold amount ${amount} from account ${targetId.toString()}}`);
        const holdIdentifier = {
            partition: partitionId,
            tokenHolder: targetId.toString(),
            holdId,
        };
        return this.executeTransaction(HoldTokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "releaseHoldByPartition", [holdIdentifier, amount.toBigInt()], GAS.RELEASE_HOLD);
    }
    async reclaimHoldByPartition(security, partitionId, holdId, targetId) {
        LogService.logTrace(`Reclaiming hold amount from account ${targetId.toString()}}`);
        const holdIdentifier = {
            partition: partitionId,
            tokenHolder: targetId.toString(),
            holdId,
        };
        return this.executeTransaction(HoldTokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "reclaimHoldByPartition", [holdIdentifier], GAS.RECLAIM_HOLD);
    }
    async executeHoldByPartition(security, sourceId, targetId, amount, partitionId, holdId) {
        LogService.logTrace(`Executing hold with Id ${holdId} from account ${sourceId.toString()} to account ${targetId.toString()}`);
        const holdIdentifier = {
            partition: partitionId,
            tokenHolder: sourceId.toString(),
            holdId,
        };
        return this.executeTransaction(HoldTokenHolderFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "executeHoldByPartition", [holdIdentifier, targetId.toString(), amount.toBigInt()], GAS.EXECUTE_HOLD_BY_PARTITION);
    }
    async setRevocationRegistryAddress(security, revocationRegistry) {
        LogService.logTrace(`Setting revocation registry address ${revocationRegistry}`);
        return this.executeTransaction(SsiManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setRevocationRegistryAddress", [revocationRegistry.toString()], GAS.SET_REVOCATION_REGISTRY);
    }
    async addIssuer(security, issuer) {
        LogService.logTrace(`Adding issuer ${issuer}`);
        return this.executeTransaction(SsiManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "addIssuer", [issuer.toString()], GAS.ADD_ISSUER);
    }
    async removeIssuer(security, issuer) {
        LogService.logTrace(`Removing issuer ${issuer}`);
        return this.executeTransaction(SsiManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "removeIssuer", [issuer.toString()], GAS.REMOVE_ISSUER);
    }
    async grantKyc(security, targetId, vcId, validFrom, validTo, issuer) {
        LogService.logTrace(`Granting KYC from issuer ${issuer.toString()} to address ${targetId.toString()} with VC id ${vcId}`);
        return this.executeTransaction(KycFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "grantKyc", [targetId.toString(), vcId, validFrom.toBigInt(), validTo.toBigInt(), issuer.toString()], GAS.GRANT_KYC);
    }
    async revokeKyc(security, targetId) {
        LogService.logTrace(`Revoking KYC to address ${targetId.toString()}`);
        return this.executeTransaction(KycFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "revokeKyc", [targetId.toString()], GAS.REVOKE_KYC);
    }
    async activateClearing(security) {
        LogService.logTrace(`Activating Clearing to address ${security.toString()}`);
        return this.executeTransaction(ClearingActionsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "activateClearing", [], GAS.ACTIVATE_CLEARING);
    }
    async deactivateClearing(security) {
        LogService.logTrace(`Deactivate Clearing to address ${security.toString()}`);
        return this.executeTransaction(ClearingActionsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "deactivateClearing", [], GAS.DEACTIVATE_CLEARING);
    }
    async clearingTransferByPartition(security, partitionId, amount, targetId, expirationDate) {
        LogService.logTrace(`Clearing Transfer By Partition to address ${security.toString()}`);
        const clearingOperation = {
            partition: partitionId,
            expirationTimestamp: expirationDate.toBigInt(),
            data: "0x",
        };
        return this.executeTransaction(ClearingTransferFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "clearingTransferByPartition", [clearingOperation, amount.toBigInt(), targetId.toString()], GAS.CLEARING_TRANSFER_BY_PARTITION);
    }
    async clearingTransferFromByPartition(security, partitionId, amount, sourceId, targetId, expirationDate) {
        LogService.logTrace(`Clearing Transfer From By Partition to address ${security.toString()}`);
        const clearingOperationFrom = {
            clearingOperation: {
                partition: partitionId,
                expirationTimestamp: expirationDate.toBigInt(),
                data: "0x",
            },
            from: sourceId.toString(),
            operatorData: "0x",
        };
        return this.executeTransaction(ClearingTransferFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "clearingTransferFromByPartition", [clearingOperationFrom, amount.toBigInt(), targetId.toString()], GAS.CLEARING_TRANSFER_FROM_BY_PARTITION);
    }
    async protectedClearingTransferByPartition(security, partitionId, amount, sourceId, targetId, expirationDate, deadline, nonce, signature) {
        LogService.logTrace(`Protected Clearing Transfer By Partition to address ${security.toString()}`);
        const protectedClearingOperation = {
            clearingOperation: {
                partition: partitionId,
                expirationTimestamp: expirationDate.toBigInt(),
                data: "0x",
            },
            from: sourceId.toString(),
            deadline: deadline.toBigInt(),
            nonce: nonce.toBigInt(),
        };
        return this.executeTransaction(ClearingTransferFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "protectedClearingTransferByPartition", [protectedClearingOperation, amount.toBigInt(), targetId.toString(), signature], GAS.PROTECTED_CLEARING_TRANSFER_BY_PARTITION);
    }
    async approveClearingOperationByPartition(security, partitionId, targetId, clearingId, clearingOperationType) {
        LogService.logTrace(`Approve Clearing Operation By Partition to address ${security.toString()}`);
        const clearingOperationIdentifier = {
            partition: partitionId,
            tokenHolder: targetId.toString(),
            clearingOperationType: CastClearingOperationType.toNumber(clearingOperationType),
            clearingId: clearingId,
        };
        return this.executeTransaction(ClearingActionsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "approveClearingOperationByPartition", [clearingOperationIdentifier], GAS.APPROVE_CLEARING_TRANSFER_BY_PARTITION);
    }
    async cancelClearingOperationByPartition(security, partitionId, targetId, clearingId, clearingOperationType) {
        LogService.logTrace(`Cancel Clearing Operation By Partition to address ${security.toString()}`);
        const clearingOperationIdentifier = {
            partition: partitionId,
            tokenHolder: targetId.toString(),
            clearingOperationType: CastClearingOperationType.toNumber(clearingOperationType),
            clearingId: clearingId,
        };
        return this.executeTransaction(ClearingActionsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "cancelClearingOperationByPartition", [clearingOperationIdentifier], GAS.CANCEL_CLEARING_TRANSFER_BY_PARTITION);
    }
    async reclaimClearingOperationByPartition(security, partitionId, targetId, clearingId, clearingOperationType) {
        LogService.logTrace(`Reclaim Clearing Operation By Partition to address ${security.toString()}`);
        const clearingOperationIdentifier = {
            partition: partitionId,
            tokenHolder: targetId.toString(),
            clearingOperationType: CastClearingOperationType.toNumber(clearingOperationType),
            clearingId: clearingId,
        };
        return this.executeTransaction(ClearingActionsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "reclaimClearingOperationByPartition", [clearingOperationIdentifier], GAS.RECLAIM_CLEARING_TRANSFER_BY_PARTITION);
    }
    async clearingRedeemByPartition(security, partitionId, amount, expirationDate) {
        LogService.logTrace(`Clearing Redeem By Partition to address ${security.toString()}`);
        const clearingOperation = {
            partition: partitionId,
            expirationTimestamp: expirationDate.toBigInt(),
            data: "0x",
        };
        return this.executeTransaction(ClearingRedeemFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "clearingRedeemByPartition", [clearingOperation, amount.toBigInt()], GAS.CLEARING_REDEEM_BY_PARTITION);
    }
    async clearingRedeemFromByPartition(security, partitionId, amount, sourceId, expirationDate) {
        LogService.logTrace(`Clearing Redeem From By Partition to address ${security.toString()}`);
        const clearingOperationFrom = {
            clearingOperation: {
                partition: partitionId,
                expirationTimestamp: expirationDate.toBigInt(),
                data: "0x",
            },
            from: sourceId.toString(),
            operatorData: "0x",
        };
        return this.executeTransaction(ClearingRedeemFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "clearingRedeemFromByPartition", [clearingOperationFrom, amount.toBigInt()], GAS.CLEARING_REDEEM_FROM_BY_PARTITION);
    }
    async protectedClearingRedeemByPartition(security, partitionId, amount, sourceId, expirationDate, deadline, nonce, signature) {
        LogService.logTrace(`Protected Clearing Redeem By Partition to address ${security.toString()}`);
        const protectedClearingOperation = {
            clearingOperation: {
                partition: partitionId,
                expirationTimestamp: expirationDate.toBigInt(),
                data: "0x",
            },
            from: sourceId.toString(),
            deadline: deadline.toBigInt(),
            nonce: nonce.toBigInt(),
        };
        return this.executeTransaction(ClearingRedeemFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "protectedClearingRedeemByPartition", [protectedClearingOperation, amount.toBigInt(), signature], GAS.PROTECTED_CLEARING_REDEEM_BY_PARTITION);
    }
    async clearingCreateHoldByPartition(security, partitionId, escrowId, amount, targetId, clearingExpirationDate, holdExpirationDate) {
        LogService.logTrace(`Clearing Create Hold By Partition to address ${security.toString()}`);
        const clearingOperation = {
            partition: partitionId,
            expirationTimestamp: clearingExpirationDate.toBigInt(),
            data: "0x",
        };
        const hold = {
            amount: amount.toBigInt(),
            expirationTimestamp: holdExpirationDate.toBigInt(),
            escrow: escrowId.toString(),
            to: targetId.toString(),
            data: "0x",
        };
        return this.executeTransaction(ClearingHoldCreationFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "clearingCreateHoldByPartition", [clearingOperation, hold], GAS.CLEARING_CREATE_HOLD_BY_PARTITION);
    }
    async clearingCreateHoldFromByPartition(security, partitionId, escrowId, amount, sourceId, targetId, clearingExpirationDate, holdExpirationDate) {
        LogService.logTrace(`Clearing Create Hold From By Partition to address ${security.toString()}`);
        const clearingOperationFrom = {
            clearingOperation: {
                partition: partitionId,
                expirationTimestamp: clearingExpirationDate.toBigInt(),
                data: "0x",
            },
            from: sourceId.toString(),
            operatorData: "0x",
        };
        const hold = {
            amount: amount.toBigInt(),
            expirationTimestamp: holdExpirationDate.toBigInt(),
            escrow: escrowId.toString(),
            to: targetId.toString(),
            data: "0x",
        };
        return this.executeTransaction(ClearingHoldCreationFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "clearingCreateHoldFromByPartition", [clearingOperationFrom, hold], GAS.CLEARING_CREATE_HOLD_FROM_BY_PARTITION);
    }
    async protectedClearingCreateHoldByPartition(security, partitionId, amount, escrowId, sourceId, targetId, clearingExpirationDate, holdExpirationDate, deadline, nonce, signature) {
        LogService.logTrace(`Protected Clearing Create Hold By Partition to address ${security.toString()}`);
        const protectedClearingOperation = {
            clearingOperation: {
                partition: partitionId,
                expirationTimestamp: clearingExpirationDate.toBigInt(),
                data: "0x",
            },
            from: sourceId.toString(),
            deadline: deadline.toBigInt(),
            nonce: nonce.toBigInt(),
        };
        const hold = {
            amount: amount.toBigInt(),
            expirationTimestamp: holdExpirationDate.toBigInt(),
            escrow: escrowId.toString(),
            to: targetId.toString(),
            data: "0x",
        };
        return this.executeTransaction(ClearingHoldCreationFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "protectedClearingCreateHoldByPartition", [protectedClearingOperation, hold, signature], GAS.PROTECTED_CLEARING_CREATE_HOLD_BY_PARTITION);
    }
    async operatorClearingCreateHoldByPartition(security, partitionId, escrowId, amount, sourceId, targetId, clearingExpirationDate, holdExpirationDate) {
        LogService.logTrace(`Operator Clearing Create Hold By Partition to address ${security.toString()}`);
        const clearingOperationFrom = {
            clearingOperation: {
                partition: partitionId,
                expirationTimestamp: clearingExpirationDate.toBigInt(),
                data: "0x",
            },
            from: sourceId.toString(),
            operatorData: "0x",
        };
        const hold = {
            amount: amount.toBigInt(),
            expirationTimestamp: holdExpirationDate.toBigInt(),
            escrow: escrowId.toString(),
            to: targetId.toString(),
            data: "0x",
        };
        return this.executeTransaction(ClearingHoldCreationFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "operatorClearingCreateHoldByPartition", [clearingOperationFrom, hold], GAS.OPERATOR_CLEARING_CREATE_HOLD_BY_PARTITION);
    }
    async operatorClearingRedeemByPartition(security, partitionId, amount, sourceId, expirationDate) {
        LogService.logTrace(`Operator Clearing Redeem By Partition to address ${security.toString()}`);
        const clearingOperationFrom = {
            clearingOperation: {
                partition: partitionId,
                expirationTimestamp: expirationDate.toBigInt(),
                data: "0x",
            },
            from: sourceId.toString(),
            operatorData: "0x",
        };
        return this.executeTransaction(ClearingRedeemFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "operatorClearingRedeemByPartition", [clearingOperationFrom, amount.toBigInt()], GAS.OPERATOR_CLEARING_REDEEM_BY_PARTITION);
    }
    async operatorClearingTransferByPartition(security, partitionId, amount, sourceId, targetId, expirationDate) {
        LogService.logTrace(`Operator Clearing Transfer By Partition to address ${security.toString()}`);
        const clearingOperationFrom = {
            clearingOperation: {
                partition: partitionId,
                expirationTimestamp: expirationDate.toBigInt(),
                data: "0x",
            },
            from: sourceId.toString(),
            operatorData: "0x",
        };
        return this.executeTransaction(ClearingTransferFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "clearingTransferFromByPartition", [clearingOperationFrom, amount.toBigInt(), targetId.toString()], GAS.OPERATOR_CLEARING_TRANSFER_BY_PARTITION);
    }
    async updateExternalPauses(security, externalPausesAddresses, actives) {
        LogService.logTrace(`Updating External Pauses for security ${security.toString()}`);
        return this.executeTransaction(ExternalPauseManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "updateExternalPauses", [externalPausesAddresses.map((addr) => addr.toString()), actives], GAS.UPDATE_EXTERNAL_PAUSES);
    }
    async addExternalPause(security, externalPauseAddress) {
        LogService.logTrace(`Adding External Pause for security ${security.toString()}`);
        return this.executeTransaction(ExternalPauseManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "addExternalPause", [externalPauseAddress.toString()], GAS.ADD_EXTERNAL_PAUSE);
    }
    async removeExternalPause(security, externalPauseAddress) {
        LogService.logTrace(`Removing External Pause for security ${security.toString()}`);
        return this.executeTransaction(ExternalPauseManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "removeExternalPause", [externalPauseAddress.toString()], GAS.REMOVE_EXTERNAL_PAUSE);
    }
    async setPausedMock(contract, paused) {
        LogService.logTrace(`Setting paused to external pause mock contract ${contract.toString()}`);
        return this.executeTransaction(MockedExternalPause__factory.connect(contract.toString(), this.getSignerOrProvider()), "setPaused", [paused], GAS.SET_PAUSED_MOCK);
    }
    async createExternalPauseMock() {
        LogService.logTrace(`Deploying External Pause Mock contract`);
        const factory = new MockedExternalPause__factory(this.getSignerOrProvider());
        const contract = await factory.deploy({
            gasLimit: GAS.CREATE_EXTERNAL_PAUSE_MOCK,
        });
        await contract.waitForDeployment();
        return contract.target.toString();
    }
    async updateExternalControlLists(security, externalControlListsAddresses, actives) {
        LogService.logTrace(`Updating External Control Lists for security ${security.toString()}`);
        return this.executeTransaction(ExternalControlListManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "updateExternalControlLists", [externalControlListsAddresses.map((addr) => addr.toString()), actives], GAS.UPDATE_EXTERNAL_CONTROL_LISTS);
    }
    async addExternalControlList(security, externalControlListAddress) {
        LogService.logTrace(`Adding External Control List for security ${security.toString()}`);
        return this.executeTransaction(ExternalControlListManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "addExternalControlList", [externalControlListAddress.toString()], GAS.ADD_EXTERNAL_CONTROL_LIST);
    }
    async removeExternalControlList(security, externalControlListAddress) {
        LogService.logTrace(`Removing External Control List for security ${security.toString()}`);
        return this.executeTransaction(ExternalControlListManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "removeExternalControlList", [externalControlListAddress.toString()], GAS.REMOVE_EXTERNAL_CONTROL_LIST);
    }
    async addToBlackListMock(contract, targetId) {
        LogService.logTrace(`Adding address ${targetId.toString()} to external Control black List mock ${contract.toString()}`);
        return this.executeTransaction(MockedBlacklist__factory.connect(contract.toString(), this.getSignerOrProvider()), "addToBlacklist", [targetId.toString()], GAS.ADD_TO_BLACK_LIST_MOCK);
    }
    async addToWhiteListMock(contract, targetId) {
        LogService.logTrace(`Adding address ${targetId.toString()} to external Control white List mock ${contract.toString()}`);
        return this.executeTransaction(MockedWhitelist__factory.connect(contract.toString(), this.getSignerOrProvider()), "addToWhitelist", [targetId.toString()], GAS.ADD_TO_WHITE_LIST_MOCK);
    }
    async removeFromBlackListMock(contract, targetId) {
        LogService.logTrace(`Removing address ${targetId.toString()} from external Control black List mock ${contract.toString()}`);
        return this.executeTransaction(MockedBlacklist__factory.connect(contract.toString(), this.getSignerOrProvider()), "removeFromBlacklist", [targetId.toString()], GAS.REMOVE_FROM_BLACK_LIST_MOCK);
    }
    async removeFromWhiteListMock(contract, targetId) {
        LogService.logTrace(`Removing address ${targetId.toString()} from external Control white List mock ${contract.toString()}`);
        return this.executeTransaction(MockedWhitelist__factory.connect(contract.toString(), this.getSignerOrProvider()), "removeFromWhitelist", [targetId.toString()], GAS.REMOVE_FROM_WHITE_LIST_MOCK);
    }
    async createExternalBlackListMock() {
        LogService.logTrace(`Deploying External Control Black List Mock contract`);
        const factory = new MockedBlacklist__factory(this.getSignerOrProvider());
        const contract = await factory.deploy({
            gasLimit: GAS.CREATE_EXTERNAL_BLACK_LIST_MOCK,
        });
        await contract.waitForDeployment();
        return contract.target.toString();
    }
    async createExternalWhiteListMock() {
        LogService.logTrace(`Deploying External Control White List Mock contract`);
        const factory = new MockedWhitelist__factory(this.getSignerOrProvider());
        const contract = await factory.deploy({
            gasLimit: GAS.CREATE_EXTERNAL_WHITE_LIST_MOCK,
        });
        await contract.waitForDeployment();
        return contract.target.toString();
    }
    async updateExternalKycLists(security, externalKycListsAddresses, actives) {
        LogService.logTrace(`Updating External Kyc Lists for security ${security.toString()}`);
        return this.executeTransaction(ExternalKycListManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "updateExternalKycLists", [externalKycListsAddresses.map((address) => address.toString()), actives], GAS.UPDATE_EXTERNAL_KYC_LISTS);
    }
    async addExternalKycList(security, externalKycListAddress) {
        LogService.logTrace(`Adding External kyc List for security ${security.toString()}`);
        return this.executeTransaction(ExternalKycListManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "addExternalKycList", [externalKycListAddress.toString()], GAS.ADD_EXTERNAL_KYC_LIST);
    }
    async removeExternalKycList(security, externalKycListAddress) {
        LogService.logTrace(`Removing External kyc List for security ${security.toString()}`);
        return this.executeTransaction(ExternalKycListManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "removeExternalKycList", [externalKycListAddress.toString()], GAS.REMOVE_EXTERNAL_KYC_LIST);
    }
    async grantKycMock(contract, targetId) {
        LogService.logTrace(`Grant kyc address ${targetId.toString()} to external kyc mock ${contract.toString()}`);
        return this.executeTransaction(MockedExternalKycList__factory.connect(contract.toString(), this.getSignerOrProvider()), "grantKyc", [targetId.toString()], GAS.GRANT_KYC_MOCK);
    }
    async revokeKycMock(contract, targetId) {
        LogService.logTrace(`Revoke kyc address ${targetId.toString()} to external kyc mock ${contract.toString()}`);
        return this.executeTransaction(MockedExternalKycList__factory.connect(contract.toString(), this.getSignerOrProvider()), "revokeKyc", [targetId.toString()], GAS.REVOKE_KYC_MOCK);
    }
    async createExternalKycListMock() {
        LogService.logTrace(`Deploying External Kyc List Mock contract`);
        const factory = new MockedExternalKycList__factory(this.getSignerOrProvider());
        const contract = await factory.deploy({
            gasLimit: GAS.CREATE_EXTERNAL_KYC_LIST_MOCK,
        });
        await contract.waitForDeployment();
        return contract.target.toString();
    }
    async activateInternalKyc(security) {
        LogService.logTrace(`Activating Internal Kyc to address ${security.toString()}`);
        return this.executeTransaction(KycFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "activateInternalKyc", [], GAS.ACTIVATE_INTERNAL_KYC);
    }
    async deactivateInternalKyc(security) {
        LogService.logTrace(`Deactivate Internal Kyc to address ${security.toString()}`);
        return this.executeTransaction(KycFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "deactivateInternalKyc", [], GAS.DEACTIVATE_INTERNAL_KYC);
    }
    async setName(security, name) {
        LogService.logTrace(`Setting name to ${security.toString()}`);
        return this.executeTransaction(ERC3643ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setName", [name], GAS.SET_NAME);
    }
    async setSymbol(security, symbol) {
        LogService.logTrace(`Setting symbol to ${security.toString()}`);
        return this.executeTransaction(ERC3643ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setSymbol", [symbol], GAS.SET_SYMBOL);
    }
    async setOnchainID(security, onchainID) {
        LogService.logTrace(`Setting onchainID to ${security.toString()}`);
        return this.executeTransaction(ERC3643ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setOnchainID", [onchainID.toString()], GAS.SET_ONCHAIN_ID);
    }
    async setIdentityRegistry(security, identityRegistry) {
        LogService.logTrace(`Setting Identity Registry to ${security.toString()}`);
        return this.executeTransaction(ERC3643ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setIdentityRegistry", [identityRegistry.toString()], GAS.SET_IDENTITY_REGISTRY);
    }
    async setCompliance(security, compliance) {
        LogService.logTrace(`Setting Compliance to ${security.toString()}`);
        return this.executeTransaction(ERC3643ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setCompliance", [compliance.toString()], GAS.SET_COMPLIANCE);
    }
    async freezePartialTokens(security, amount, targetId) {
        LogService.logTrace(`Freezing ${amount} tokens ${security.toString()} to account ${targetId.toString()}`);
        return this.executeTransaction(FreezeFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "freezePartialTokens", [targetId.toString(), amount.toBigInt()], GAS.FREEZE_PARTIAL_TOKENS);
    }
    async unfreezePartialTokens(security, amount, targetId) {
        LogService.logTrace(`Unfreezing ${amount} tokens ${security.toString()} to account ${targetId.toString()}`);
        return this.executeTransaction(FreezeFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "unfreezePartialTokens", [targetId.toString(), amount.toBigInt()], GAS.UNFREEZE_PARTIAL_TOKENS);
    }
    async recoveryAddress(security, lostWallet, newWallet) {
        LogService.logTrace(`Recovering address ${lostWallet.toString()} to ${newWallet.toString()}`);
        return this.executeTransaction(ERC3643ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "recoveryAddress", [lostWallet.toString(), newWallet.toString(), EVM_ZERO_ADDRESS], GAS.RECOVERY_ADDRESS);
    }
    async addAgent(security, agentId) {
        LogService.logTrace(`Granting agent role to ${agentId.toString()}`);
        return this.executeTransaction(ERC3643ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "addAgent", [agentId.toString()], GAS.ADD_AGENT);
    }
    async removeAgent(security, agentId) {
        LogService.logTrace(`Revoking agent role from ${agentId.toString()}`);
        return this.executeTransaction(ERC3643ManagementFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "removeAgent", [agentId.toString()], GAS.REMOVE_AGENT);
    }
    async batchTransfer(security, amountList, toList) {
        LogService.logTrace(`Batch transferring ${amountList.length} token amounts from ${security.toString()} to ${toList.map((item) => item.toString()).join(", ")}`);
        return this.executeTransaction(ERC3643BatchFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "batchTransfer", [toList.map((account) => account.toString()), amountList.map((item) => item.toBigInt())], GAS.BATCH_TRANSFER);
    }
    async batchForcedTransfer(security, amountList, fromList, toList) {
        LogService.logTrace(`Batch forced transferring ${amountList.length} token amounts from ${fromList.map((item) => item.toString())} to ${toList.map((item) => item.toString())}`);
        return this.executeTransaction(ERC3643BatchFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "batchForcedTransfer", [
            fromList.map((item) => item.toString()),
            toList.map((item) => item.toString()),
            amountList.map((item) => item.toBigInt()),
        ], GAS.BATCH_FORCED_TRANSFER);
    }
    async batchMint(security, amountList, toList) {
        LogService.logTrace(`Batch minting ${amountList.length} token amounts on ${security.toString()} to ${toList.map((item) => item.toString())}`);
        return this.executeTransaction(ERC3643BatchFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "batchMint", [toList.map((item) => item.toString()), amountList.map((item) => item.toBigInt())], GAS.BATCH_MINT);
    }
    async batchBurn(security, amountList, targetList) {
        LogService.logTrace(`Batch burning ${amountList.length} token amounts from ${targetList.map((item) => item.toString())}`);
        return this.executeTransaction(ERC3643BatchFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "batchBurn", [targetList.map((item) => item.toString()), amountList.map((item) => item.toBigInt())], GAS.BATCH_BURN);
    }
    async batchSetAddressFrozen(security, freezeList, targetList) {
        LogService.logTrace(`Batch setting address frozen status on ${targetList.length} addresses from ${security.toString()}`);
        return this.executeTransaction(FreezeFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "batchSetAddressFrozen", [targetList.map((item) => item.toString()), freezeList], GAS.BATCH_SET_ADDRESS_FROZEN);
    }
    async batchFreezePartialTokens(security, amountList, targetList) {
        LogService.logTrace(`Batch freezing partial tokens (${amountList.length}) on ${security.toString()} for targets ${targetList.map((item) => item.toString())}`);
        return this.executeTransaction(FreezeFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "batchFreezePartialTokens", [targetList.map((item) => item.toString()), amountList.map((item) => item.toBigInt())], GAS.BATCH_FREEZE_PARTIAL_TOKENS);
    }
    async batchUnfreezePartialTokens(security, amountList, targetList) {
        LogService.logTrace(`Batch unfreezing partial tokens (${amountList.length}) on ${security.toString()} for targets ${targetList.map((item) => item.toString())}`);
        return this.executeTransaction(FreezeFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "batchUnfreezePartialTokens", [targetList.map((item) => item.toString()), amountList.map((item) => item.toBigInt())], GAS.BATCH_UNFREEZE_PARTIAL_TOKENS);
    }
    async setAddressFrozen(security, status, target) {
        LogService.logTrace(`Freezing address ${target.toString()}`);
        return this.executeTransaction(FreezeFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setAddressFrozen", [target.toString(), status], GAS.SET_ADDRESS_FROZEN);
    }
    async redeemAtMaturityByPartition(security, partitionId, sourceId, amount) {
        LogService.logTrace(`Redeeming at maturity by partition to address ${security.toString()}`);
        return this.executeTransaction(Bond__factory.connect(security.toString(), this.getSignerOrProvider()), "redeemAtMaturityByPartition", [sourceId.toString(), partitionId, amount.toBigInt()], GAS.REDEEM_AT_MATURITY_BY_PARTITION_GAS);
    }
    async fullRedeemAtMaturity(security, sourceId) {
        LogService.logTrace(`Full redeeming at maturity to address ${security.toString()}`);
        return this.executeTransaction(Bond__factory.connect(security.toString(), this.getSignerOrProvider()), "fullRedeemAtMaturity", [sourceId.toString()], GAS.FULL_REDEEM_AT_MATURITY_GAS);
    }
    async executeTransaction(factory, method, args, gasLimit, eventName) {
        LogService.logTrace(`Executing ${method} with args:`, args);
        const fn = factory[method];
        const tx = await fn(...args, { gasLimit });
        return RPCTransactionResponseAdapter.manageResponse(tx, this.networkService.environment, eventName);
    }
    async createSecurity(securityInfo, details, factory, resolver, configId, configVersion, externalPauses = [], externalControlLists = [], externalKycLists = [], diamondOwnerAccount, createToken, deployMethod, gasLimit, eventName, compliance, identityRegistry) {
        try {
            const securityData = SecurityDataBuilder.buildSecurityData(securityInfo, resolver, configId, configVersion, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount, compliance, identityRegistry);
            const regulationData = SecurityDataBuilder.buildRegulationData(securityInfo);
            const securityToken = createToken(securityData, details);
            const factoryInstance = Factory__factory.connect(factory.toString(), this.getSignerOrProvider());
            LogService.logTrace(`Deploying ${deployMethod}: `, {
                security: securityToken,
            });
            const res = await factoryInstance[deployMethod](securityToken, regulationData, { gasLimit });
            return await RPCTransactionResponseAdapter.manageResponse(res, this.networkService.environment, eventName);
        }
        catch (error) {
            LogService.logError(error);
            throw new SigningError(`Unexpected error in ${deployMethod} operation: ${error}`);
        }
    }
    async createTrexSuiteBond(salt, owner, irs, onchainId, irAgents, tokenAgents, compliancesModules, complianceSettings, claimTopics, issuers, issuerClaims, security, bondDetails, factory, resolver, configId, configVersion, compliance, identityRegistryAddress, diamondOwnerAccount, proceedRecipients = [], proceedRecipientsData = [], externalPauses, externalControlLists, externalKycLists) {
        return this.createTrexSuite("bond", salt, owner, irs, onchainId, irAgents, tokenAgents, compliancesModules, complianceSettings, claimTopics, issuers, issuerClaims, security, { bondDetails }, factory, resolver, configId, configVersion, compliance, identityRegistryAddress, diamondOwnerAccount, proceedRecipients, proceedRecipientsData, externalPauses, externalControlLists, externalKycLists);
    }
    async createTrexSuiteEquity(salt, owner, irs, onchainId, irAgents, tokenAgents, compliancesModules, complianceSettings, claimTopics, issuers, issuerClaims, security, equityDetails, factory, resolver, configId, configVersion, compliance, identityRegistryAddress, diamondOwnerAccount, externalPauses, externalControlLists, externalKycLists) {
        return this.createTrexSuite("equity", salt, owner, irs, onchainId, irAgents, tokenAgents, compliancesModules, complianceSettings, claimTopics, issuers, issuerClaims, security, equityDetails, factory, resolver, configId, configVersion, compliance, identityRegistryAddress, diamondOwnerAccount, [], [], externalPauses, externalControlLists, externalKycLists);
    }
    async createTrexSuite(tokenType, salt, owner, irs, onchainId, irAgents, tokenAgents, compliancesModules, complianceSettings, claimTopics, issuers, issuerClaims, security, tokenDetails, factory, resolver, configId, configVersion, compliance, identityRegistryAddress, diamondOwnerAccount, proceedRecipientsId, proceedRecipientsData, externalPauses, externalControlLists, externalKycLists) {
        const securityData = SecurityDataBuilder.buildSecurityData(security, resolver, configId, configVersion, externalPauses, externalControlLists, externalKycLists, diamondOwnerAccount, compliance, identityRegistryAddress);
        const regulationData = SecurityDataBuilder.buildRegulationData(security);
        let tokenData;
        if (tokenType === "bond") {
            const details = tokenDetails;
            tokenData = {
                security: securityData,
                bondDetails: SecurityDataBuilder.buildBondDetails(details.bondDetails),
                proceedRecipients: proceedRecipientsId.map((addr) => addr.toString()),
                proceedRecipientsData: proceedRecipientsData.map((data) => (data == "" ? "0x" : data)),
            };
        }
        else {
            tokenData = {
                security: securityData,
                equityDetails: SecurityDataBuilder.buildEquityDetails(tokenDetails),
            };
        }
        const factoryContract = TREXFactoryAts__factory.connect(factory.toString(), this.getSignerOrProvider());
        LogService.logTrace(`Deploying TrexSuiteAts${tokenType.charAt(0).toUpperCase() + tokenType.slice(1)}:`, {
            security: tokenData,
        });
        const methodMap = {
            bond: "deployTREXSuiteAtsBond",
            equity: "deployTREXSuiteAtsEquity",
        };
        try {
            return this.executeTransaction(factoryContract, methodMap[tokenType], [
                salt,
                {
                    owner,
                    irs,
                    ONCHAINID: onchainId,
                    irAgents,
                    tokenAgents,
                    complianceModules: compliancesModules,
                    complianceSettings,
                },
                {
                    claimTopics,
                    issuers,
                    issuerClaims,
                },
                tokenData,
                regulationData,
            ], GAS.TREX_CREATE_SUITE, "TREXSuiteDeployed");
        }
        catch (error) {
            LogService.logError(error);
            throw new SigningError(`Unexpected error in ${methodMap[tokenType]} operation: ${error}`);
        }
    }
    addProceedRecipient(security, proceedRecipient, data, securityId) {
        LogService.logTrace(`Adding proceed recipient ${proceedRecipient.toString()} to security ${security.toString()}`);
        return this.executeTransaction(ProceedRecipientsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "addProceedRecipient", [proceedRecipient.toString(), data], GAS.ADD_PROCEED_RECIPIENT);
    }
    removeProceedRecipient(security, proceedRecipient, securityId) {
        LogService.logTrace(`Removing proceed recipient ${proceedRecipient.toString()} from security ${security.toString()}`);
        return this.executeTransaction(ProceedRecipientsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "removeProceedRecipient", [proceedRecipient.toString()], GAS.REMOVE_PROCEED_RECIPIENT);
    }
    updateProceedRecipientData(security, proceedRecipient, data) {
        LogService.logTrace(`Updating proceed recipient ${proceedRecipient.toString()} for security ${security.toString()}`);
        return this.executeTransaction(ProceedRecipientsFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "updateProceedRecipientData", [proceedRecipient.toString(), data], GAS.UPDATE_PROCEED_RECIPIENT);
    }
    setRate(security, rate, rateDecimals, securityId) {
        LogService.logTrace(`Setting Rate ${rate.toString()} with decimals ${rateDecimals} for security ${security.toString()}`);
        return this.executeTransaction(FixedRate__factory.connect(security.toString(), this.getSignerOrProvider()), "setRate", [rate.toBigInt(), rateDecimals], GAS.SET_RATE);
    }
    setInterestRate(security, maxRate, baseRate, minRate, startPeriod, startRate, missedPenalty, reportPeriod, rateDecimals, securityId) {
        LogService.logTrace(`Setting Interest Rate for security ${security.toString()}`);
        return this.executeTransaction(KpiLinkedRate__factory.connect(security.toString(), this.getSignerOrProvider()), "setInterestRate", [
            {
                maxRate: maxRate.toBigInt(),
                baseRate: baseRate.toBigInt(),
                minRate: minRate.toBigInt(),
                startPeriod: startPeriod.toBigInt(),
                startRate: startRate.toBigInt(),
                missedPenalty: missedPenalty.toBigInt(),
                reportPeriod: reportPeriod.toBigInt(),
                rateDecimals: rateDecimals,
            },
        ], GAS.SET_INTEREST_RATE);
    }
    setImpactData(security, maxDeviationCap, baseLine, maxDeviationFloor, impactDataDecimals, adjustmentPrecision, securityId) {
        LogService.logTrace(`Setting Impact Data for security ${security.toString()}`);
        return this.executeTransaction(KpiLinkedRate__factory.connect(security.toString(), this.getSignerOrProvider()), "setImpactData", [
            {
                maxDeviationCap: maxDeviationCap.toBigInt(),
                baseLine: baseLine.toBigInt(),
                maxDeviationFloor: maxDeviationFloor.toBigInt(),
                impactDataDecimals: impactDataDecimals,
                adjustmentPrecision: adjustmentPrecision.toBigInt(),
            },
        ], GAS.SET_IMPACT_DATA);
    }
    addKpiData(security, date, value, project, securityId) {
        LogService.logTrace(`Adding KPI data for security ${security.toString()}, date: ${date}, value: ${value}, project: ${project.toString()}`);
        return this.executeTransaction(Kpis__factory.connect(security.toString(), this.getSignerOrProvider()), "addKpiData", [date, value, project.toString()], GAS.ADD_KPI_DATA);
    }
    async cancelScheduledBalanceAdjustment(security, balanceAdjustmentId) {
        return this.executeTransaction(Equity__factory.connect(security.toString(), this.getSignerOrProvider()), "cancelScheduledBalanceAdjustment", [balanceAdjustmentId], GAS.CANCEL_SCHEDULED_BALANCE_ADJUSTMENT, CANCEL_SCHEDULED_BALANCE_ADJUSTMENT_EVENT);
    }
    async setNominalValue(security, nominalValue, nominalValueDecimals) {
        LogService.logTrace(`Setting nominal value for security: ${security.toString()}`);
        return this.executeTransaction(NominalValue__factory.connect(security.toString(), this.getSignerOrProvider()), "setNominalValue", [nominalValue, nominalValueDecimals], GAS.SET_NOMINAL_VALUE, NOMINAL_VALUE_SET_EVENT);
    }
    async setAmortization(security, recordDate, executionDate, tokensToRedeem) {
        LogService.logTrace(`Setting amortization: security=${security}, recordDate=${recordDate}, executionDate=${executionDate}, tokensToRedeem=${tokensToRedeem}`);
        const amortizationStruct = {
            recordDate: recordDate.toBigInt(),
            executionDate: executionDate.toBigInt(),
            tokensToRedeem: tokensToRedeem.toBigInt(),
        };
        return this.executeTransaction(AmortizationFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setAmortization", [amortizationStruct], GAS.SET_AMORTIZATION, SET_AMORTIZATION_EVENT);
    }
    async cancelAmortization(security, amortizationId) {
        LogService.logTrace(`Cancelling amortization: ${amortizationId} for security: ${security}`);
        return this.executeTransaction(AmortizationFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "cancelAmortization", [amortizationId], GAS.CANCEL_AMORTIZATION, CANCEL_AMORTIZATION_EVENT);
    }
    async setAmortizationHold(security, amortizationId, tokenHolder, tokenAmount) {
        LogService.logTrace(`Setting amortization hold: security=${security}, amortizationId=${amortizationId}, tokenHolder=${tokenHolder}, tokenAmount=${tokenAmount}`);
        return this.executeTransaction(AmortizationFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "setAmortizationHold", [amortizationId, tokenHolder.toString(), tokenAmount.toBigInt()], GAS.SET_AMORTIZATION_HOLD, SET_AMORTIZATION_HOLD_EVENT);
    }
    async releaseAmortizationHold(security, amortizationId, tokenHolder) {
        LogService.logTrace(`Releasing amortization hold: security=${security}, amortizationId=${amortizationId}, tokenHolder=${tokenHolder}`);
        return this.executeTransaction(AmortizationFacet__factory.connect(security.toString(), this.getSignerOrProvider()), "releaseAmortizationHold", [amortizationId, tokenHolder.toString()], GAS.RELEASE_AMORTIZATION_HOLD, RELEASE_AMORTIZATION_HOLD_EVENT);
    }
};
RPCTransactionAdapter = __decorate([
    singleton(),
    __param(0, lazyInject(MirrorNodeAdapter)),
    __param(1, lazyInject(NetworkService)),
    __param(2, lazyInject(EventService)),
    __param(3, lazyInject(CommandBus)),
    __metadata("design:paramtypes", [MirrorNodeAdapter,
        NetworkService,
        EventService,
        CommandBus])
], RPCTransactionAdapter);
export { RPCTransactionAdapter };
