1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.DaoService = void 0;
|
4 | class DaoService {
|
5 | constructor(client) {
|
6 | this.client = client;
|
7 | |
8 |
|
9 |
|
10 |
|
11 | this.getConfig = async () => {
|
12 | const { rows } = await this.client.eos.v1.chain.get_table_rows({
|
13 | code: this.client.config.daoContract,
|
14 | scope: this.client.config.daoContract,
|
15 | table: 'config',
|
16 | limit: 1
|
17 | });
|
18 | const [config] = rows;
|
19 | return config;
|
20 | };
|
21 | }
|
22 | |
23 |
|
24 |
|
25 |
|
26 | async setAvatarAsset(asset) {
|
27 | const authorization = this.client.sessionAuth();
|
28 | const response = await this.client.session.transact({
|
29 | actions: [{
|
30 | account: this.client.config.daoContract,
|
31 | name: 'setavatar',
|
32 | authorization,
|
33 | data: {
|
34 | account: this.client.session.actor,
|
35 | asset_id: asset.asset_id
|
36 | }
|
37 | }]
|
38 | });
|
39 | return response;
|
40 | }
|
41 | |
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | async getAvatar(account) {
|
48 | const response = await this.client.eos.v1.chain.get_table_rows({
|
49 | code: this.client.config.daoContract,
|
50 | scope: account,
|
51 | table: 'avatar',
|
52 | limit: 1
|
53 | });
|
54 | const [avatar] = response.rows;
|
55 | return avatar;
|
56 | }
|
57 | }
|
58 | exports.DaoService = DaoService;
|
59 |
|
\ | No newline at end of file |