@1hive/connect-core
Version:
Access and interact with Aragon Organizations and their apps.
21 lines • 1.06 kB
JavaScript
import { resolveArtifact } from '../utils/metadata';
import Permission from './Permission';
export default class Role {
constructor(data, metadata, organization) {
var _a;
const { roles } = metadata[0];
const role = roles === null || roles === void 0 ? void 0 : roles.find((role) => role.bytes === data.hash);
this.appAddress = data.appAddress;
this.description = role === null || role === void 0 ? void 0 : role.name;
this.hash = data.hash;
this.manager = data.manager;
this.name = role === null || role === void 0 ? void 0 : role.id;
this.params = role === null || role === void 0 ? void 0 : role.params;
this.permissions = (_a = data.grantees) === null || _a === void 0 ? void 0 : _a.map((grantee) => new Permission(grantee, organization));
}
static async create(data, organization) {
const artifact = await resolveArtifact(organization.connection.ipfs, data);
return new Role(data, [artifact], organization);
}
}
//# sourceMappingURL=Role.js.map