"use strict";
// 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 __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DFNSTransactionAdapter = void 0;
const hedera_custodians_integration_1 = require("@hashgraph/hedera-custodians-integration");
const tsyringe_1 = require("tsyringe");
const WalletEvent_1 = require("../../../../app/service/event/WalletEvent");
const Wallet_1 = require("../../../../domain/context/network/Wallet");
const CustodialTransactionAdapter_1 = require("./CustodialTransactionAdapter");
const LogService_1 = __importDefault(require("../../../../app/service/log/LogService"));
let DFNSTransactionAdapter = class DFNSTransactionAdapter extends CustodialTransactionAdapter_1.CustodialTransactionAdapter {
    init() {
        this.eventService.emit(WalletEvent_1.WalletEvents.walletInit, {
            wallet: Wallet_1.SupportedWallets.DFNS,
            initData: {},
        });
        LogService_1.default.logTrace("DFNS Initialized");
        return Promise.resolve(this.networkService.environment);
    }
    initCustodialWalletService(settings) {
        this.custodialWalletService = new hedera_custodians_integration_1.CustodialWalletService(new hedera_custodians_integration_1.DFNSConfig(settings.serviceAccountSecretKey, settings.serviceAccountCredentialId, settings.serviceAccountAuthToken, settings.appOrigin, settings.appId, settings.baseUrl, settings.walletId, settings.publicKey));
    }
    getSupportedWallet() {
        return Wallet_1.SupportedWallets.DFNS;
    }
    stop() {
        this.client?.close();
        LogService_1.default.logTrace("DFNS stopped");
        this.eventService.emit(WalletEvent_1.WalletEvents.walletDisconnect, {
            wallet: Wallet_1.SupportedWallets.DFNS,
        });
        return Promise.resolve(true);
    }
};
exports.DFNSTransactionAdapter = DFNSTransactionAdapter;
exports.DFNSTransactionAdapter = DFNSTransactionAdapter = __decorate([
    (0, tsyringe_1.singleton)()
], DFNSTransactionAdapter);
