@ic-wallet-kit/hpl
Version:
Ic middleware wallet HPL protocol
56 lines (55 loc) • 3.39 kB
JavaScript
;
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); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HplRefreshService = void 0;
const handlers_1 = require("../handlers");
const getHplContactListHandler_1 = require("../handlers/contacts/getHplContactListHandler/getHplContactListHandler");
const hplRxSyncStateService_1 = require("../replications/hplRxSyncStateService");
const common_1 = require("@ic-wallet-kit/common");
const typedi_1 = require("typedi");
let HplRefreshService = class HplRefreshService extends common_1.RefreshServiceBase {
getHplAssetListHandler;
getHplAccountListHandler;
getHplVirtualAccountListHandler;
getHplContactListHandler;
configuration;
constructor(getHplAssetListHandler, getHplAccountListHandler, getHplVirtualAccountListHandler, getHplContactListHandler, configuration, rxSyncStateService) {
super(configuration, rxSyncStateService);
this.getHplAssetListHandler = getHplAssetListHandler;
this.getHplAccountListHandler = getHplAccountListHandler;
this.getHplVirtualAccountListHandler = getHplVirtualAccountListHandler;
this.getHplContactListHandler = getHplContactListHandler;
this.configuration = configuration;
}
async runSync() {
let assetListResult = await this.getHplAssetListHandler.handle({ loadType: common_1.LoadType.Full });
let isSuccess = assetListResult.isSuccess;
let accountListResult = await this.getHplAccountListHandler.handle({ loadType: common_1.LoadType.Full });
isSuccess = accountListResult.isSuccess && isSuccess;
let virtualAccountListResult = await this.getHplVirtualAccountListHandler.handle({ loadType: common_1.LoadType.Full });
isSuccess = virtualAccountListResult.isSuccess && isSuccess;
const contactListResult = await this.getHplContactListHandler.handle({ loadType: common_1.LoadType.Full });
isSuccess = contactListResult.isSuccess && isSuccess;
return isSuccess;
}
};
exports.HplRefreshService = HplRefreshService;
exports.HplRefreshService = HplRefreshService = __decorate([
(0, typedi_1.Service)(),
__param(4, (0, typedi_1.Inject)("RefreshServiceConfiguration")),
__metadata("design:paramtypes", [handlers_1.GetHplAssetListHandler,
handlers_1.GetHplAccountListHandler,
handlers_1.GetHplVirtualAccountListHandler,
getHplContactListHandler_1.GetHplContactListHandler, Object, hplRxSyncStateService_1.HplRxSyncStateService])
], HplRefreshService);