UNPKG

@effectai/effect-js

Version:

Effect Network Javscript/Typescript SDK (for [https://effect.network](https://effect.network))

59 lines 1.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DaoService = void 0; class DaoService { constructor(client) { this.client = client; /** * Retrieve the DAO config * @returns {Promise<DaoConfig>} Returns the DAO config */ this.getConfig = async () => { const { rows } = await this.client.eos.v1.chain.get_table_rows({ code: this.client.config.daoContract, scope: this.client.config.daoContract, table: 'config', limit: 1 }); const [config] = rows; return config; }; } /** * Set the avatar asset for the given account * @param asset */ async setAvatarAsset(asset) { const authorization = this.client.sessionAuth(); const response = await this.client.session.transact({ actions: [{ account: this.client.config.daoContract, name: 'setavatar', authorization, data: { account: this.client.session.actor, asset_id: asset.asset_id } }] }); return response; } /** * Retrieve the avatar for the given account * @param account * @returns * @example { type: 0, asset_id: '2199025109172' } */ async getAvatar(account) { const response = await this.client.eos.v1.chain.get_table_rows({ code: this.client.config.daoContract, scope: account, table: 'avatar', limit: 1 }); const [avatar] = response.rows; return avatar; } } exports.DaoService = DaoService; //# sourceMappingURL=dao.js.map