@aut-labs/sdk
Version:
The TS/JS SDK package aims to make it easy for frontends/backends to integrate with Aut Smart Contracts
48 lines • 2 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskFactoryContract = void 0;
const abi_types_1 = require("@aut-labs/abi-types");
const base_contract_1 = __importDefault(require("./base.contract"));
const response_1 = require("../models/response");
const find_event_1 = require("../utils/find-event");
class TaskFactoryContract extends base_contract_1.default {
constructor(address, multiSigner, biconomyWrapper) {
super(address, multiSigner, biconomyWrapper, abi_types_1.Web3TaskFactoryProvider);
}
async createContribution(contribution, overrides) {
try {
const tx = await (await this.functions.createContribution(contribution, overrides)).wait();
const event = (0, find_event_1.findLogEvent)(tx, abi_types_1.TaskFactoryContractEventType.CreateContribution);
return new response_1.SDKContractGenericResponse({
isSuccess: true,
event,
data: event?.args?.contributionId?.toString()
});
}
catch (error) {
return new response_1.SDKContractGenericResponse({
error
});
}
}
async createContributions(contributions) {
try {
const tx = await (await this.functions.createContributions(contributions)).wait();
const event = (0, find_event_1.findLogEvent)(tx, abi_types_1.TaskFactoryContractEventType.CreateContribution);
return new response_1.SDKContractGenericResponse({
isSuccess: true,
event
});
}
catch (error) {
return new response_1.SDKContractGenericResponse({
error
});
}
}
}
exports.TaskFactoryContract = TaskFactoryContract;
//# sourceMappingURL=task-factory.contract.js.map