@effectai/effect-js
Version:
Effect Network Javscript/Typescript SDK (for [https://effect.network](https://effect.network))
80 lines • 3.06 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionService = void 0;
const antelope_1 = require("@wharfkit/antelope");
class ActionService {
constructor(client) {
this.client = client;
this.makeBatchAction = async (initBatch, hash) => {
const { force_vaccount_id } = await this.client.tasks.getForceSettings();
return {
account: this.client.config.tasksContract,
name: 'mkbatch',
authorization: [{
actor: this.client.session.actor,
permission: this.client.session.permission,
}],
data: {
id: force_vaccount_id,
campaign_id: initBatch.campaign_id,
content: { field_0: 0, field_1: hash },
repetitions: initBatch.repetitions,
payer: this.client.session.actor,
sig: null,
},
};
};
this.vTransferAction = async (vacc, batchPrice) => {
const settings = await this.client.tasks.getForceSettings();
return {
account: this.client.config.vaccountContract,
name: 'vtransfer',
authorization: [{
actor: this.client.session.actor,
permission: this.client.session.permission,
}],
data: {
from_id: vacc.id,
to_id: settings.force_vaccount_id,
quantity: {
quantity: batchPrice,
contract: this.client.config.tokenContract,
},
memo: '',
payer: this.client.session.actor,
sig: null,
fee: null,
},
};
};
this.publishBatchAction = (batchId, numTasks) => ({
account: this.client.config.tasksContract,
name: 'publishbatch',
authorization: [{
actor: this.client.session.actor,
permission: this.client.session.permission,
}],
data: {
batch_id: batchId,
num_tasks: numTasks,
sig: null,
}
});
this.depositAction = (amount, vacc) => ({
account: this.client.config.tokenContract,
name: 'transfer',
authorization: [{
actor: this.client.session.actor,
permission: this.client.session.permission,
}],
data: {
from: this.client.session.actor,
to: this.client.config.vaccountContract,
quantity: antelope_1.Asset.from(amount, '4,EFX'),
memo: `${vacc.id}`,
},
});
}
}
exports.ActionService = ActionService;
//# sourceMappingURL=actions.js.map