UNPKG

@aut-labs/sdk

Version:

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

98 lines (97 loc) 3.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HubNFT = exports.HubProperties = exports.HubGroupState = exports.HubReputationStats = exports.HubArchetype = void 0; const baseNFTModel_1 = require("./baseNFTModel"); const role_1 = require("./role"); const social_1 = require("./social"); const storage_api_1 = require("./storage.api"); var HubArchetype; (function (HubArchetype) { HubArchetype[HubArchetype["NONE"] = 0] = "NONE"; HubArchetype[HubArchetype["SIZE"] = 1] = "SIZE"; HubArchetype[HubArchetype["REPUTATION"] = 2] = "REPUTATION"; HubArchetype[HubArchetype["CONVICTION"] = 3] = "CONVICTION"; HubArchetype[HubArchetype["PERFORMANCE"] = 4] = "PERFORMANCE"; HubArchetype[HubArchetype["GROWTH"] = 5] = "GROWTH"; })(HubArchetype = exports.HubArchetype || (exports.HubArchetype = {})); /** * Response type names are: * * aDiffMembersLP: string * bMembersLastLP: string * cAverageRepLP: string * dAverageCommitmentLP: string * ePerformanceLP: string */ class HubReputationStats { } exports.HubReputationStats = HubReputationStats; HubReputationStats.mapToObject = (res) => ({ aDiffMembersLP: Number(res[0]), bMembersLastLP: Number(res[1]), cAverageRepLP: Number(res[2]), dAverageCommitmentLP: Number(res[3]), ePerformanceLP: Number(res[4]) }); /** * Response type names are: * */ class HubGroupState { } exports.HubGroupState = HubGroupState; HubGroupState.mapToObject = (res) => ({ lastPeriod: Number(res[0]), TCL: Number(res[1]), TCP: Number(res[2]), k: Number(res[3]), penalty: Number(res[4]), c: Number(res[5]), p: res[6], commitHash: res[7], lrUpdatesPerPeriod: Number(res[8]), periodHubParameters: HubReputationStats.mapToObject(res[9]) }); class HubProperties { constructor(data) { if (!data) { this.rolesSets = role_1.DefaultRoleSets; this.socials = social_1.DefaultSocials; } else { this.market = data.market; this.minCommitment = data.minCommitment; this.rolesSets = data.rolesSets; this.timestamp = data.timestamp; this.socials = data.socials; this.archetype = data.archetype; this.deployer = data.deployer; } } } exports.HubProperties = HubProperties; class HubNFT extends baseNFTModel_1.BaseNFTModel { constructor(data = {}) { super(data); this.properties = new HubProperties(data.properties); } static updateHubNFT(updatedHub) { const community = new HubNFT(updatedHub); return { name: community.name, description: community.description, image: (0, storage_api_1.httpUrlToIpfsCID)(community.image), properties: { market: community.properties.market, deployer: community.properties.deployer, minCommitment: community.properties.minCommitment, archetype: community.properties.archetype, rolesSets: community.properties.rolesSets, timestamp: community.properties.timestamp, socials: community.properties.socials } }; } } exports.HubNFT = HubNFT; //# sourceMappingURL=hub.js.map