@aut-labs/sdk
Version:
The TS/JS SDK package aims to make it easy for frontends/backends to integrate with Aut Smart Contracts
100 lines • 4.34 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HubContract = void 0;
const admin_contract_1 = require("./admin.contract");
const members_contract_1 = require("./members.contract");
const metadata_contract_1 = require("./metadata.contract");
const market_contract_1 = require("./market.contract");
const commitment_contract_1 = require("./commitment.contract");
const abi_types_1 = require("@aut-labs/abi-types");
const base_contract_1 = __importDefault(require("./base.contract"));
const response_1 = require("../models/response");
const hub_1 = require("../models/hub");
class HubContract extends base_contract_1.default {
constructor(address, multiSigner, biconomyWrapper) {
super(address, multiSigner, biconomyWrapper, abi_types_1.Web3HubProvider);
this.admins = new admin_contract_1.AdminsContract(address, multiSigner, biconomyWrapper, abi_types_1.Web3HubProvider);
this.members = new members_contract_1.MembersContract(address, multiSigner, biconomyWrapper, abi_types_1.Web3HubProvider);
this.metadata = new metadata_contract_1.MetadataContract(address, multiSigner, biconomyWrapper, abi_types_1.Web3HubProvider);
this.market = new market_contract_1.MarketContract(address, multiSigner, biconomyWrapper, abi_types_1.Web3HubProvider);
this.commitment = new commitment_contract_1.CommitmentContract(address, multiSigner, biconomyWrapper, abi_types_1.Web3HubProvider);
}
async getArchetype() {
try {
const archetype = await this.functions.archetype();
// @TODO implement setArchetypeAndParameters
if (archetype !== 0) {
// const size = await this.functions.weightFor(HubArchetype.SIZE);
// const reputation = await this.functions.weightFor(
// HubArchetype.REPUTATION
// );
// const conviction = await this.functions.weightFor(
// HubArchetype.CONVICTION
// );
// const performance = await this.functions.weightFor(
// HubArchetype.PERFORMANCE
// );
// const growth = await this.functions.weightFor(HubArchetype.GROWTH);
const size = 0;
const reputation = 0;
const conviction = 0;
const performance = 0;
const growth = 0;
return new response_1.SDKContractGenericResponse({
isSuccess: true,
data: {
archetype: Number(archetype),
size: Number(size),
reputation: Number(reputation),
conviction: Number(conviction),
performance: Number(performance),
growth: Number(growth)
}
});
}
return new response_1.SDKContractGenericResponse({
isSuccess: true,
data: {
archetype: hub_1.HubArchetype.NONE,
size: 0,
reputation: 0,
conviction: 0,
performance: 0,
growth: 0
}
});
}
catch (error) {
return new response_1.SDKContractGenericResponse({
error
});
}
}
async setArchetype(data) {
try {
const archetypeAndParams = [
data.archetype,
data.size,
data.reputation,
data.conviction,
data.performance,
data.growth
];
await (await this.functions.setArchetypeAndParameters(archetypeAndParams)).wait();
return new response_1.SDKContractGenericResponse({
isSuccess: true,
data
});
}
catch (error) {
return new response_1.SDKContractGenericResponse({
error
});
}
}
}
exports.HubContract = HubContract;
//# sourceMappingURL=hub.contract.js.map