UNPKG

@aut-labs/sdk

Version:

The TS/JS SDK package aims to make it easy for frontends/backends to integrate with Aut Smart Contracts

29 lines 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HubRegistry = void 0; const hubRegistry_contract_1 = require("../contracts/hubRegistry.contract"); const base64_1 = require("../utils/base64"); const ipfs_cache_1 = require("../utils/ipfs-cache"); class HubRegistry { constructor(_hubAddress, _multiSigner, _biconomyWrapper, _client) { this._hubAddress = _hubAddress; this._multiSigner = _multiSigner; this._biconomyWrapper = _biconomyWrapper; this._client = _client; this.contract = new hubRegistry_contract_1.HubRegistryContract(this._hubAddress, this._multiSigner, this._biconomyWrapper); } async deployHub(roles, market, minimumCommitment, hubModel, overrides) { const logoFile = (0, base64_1.base64toFile)(hubModel.image, "logo"); const logoCID = await this._client.sendFileToIPFS(logoFile); hubModel.image = logoCID; hubModel.properties.timestamp = new Date().getTime(); const cid = await this._client.sendJSONToIPFS(hubModel); const response = await this.contract.deployHub(roles, market, cid, minimumCommitment, overrides); if (response.isSuccess) { (0, ipfs_cache_1.addMetadataToCache)(cid, hubModel); } return response; } } exports.HubRegistry = HubRegistry; //# sourceMappingURL=hubRegistry.service.js.map