n8n-nodes-wax
Version:
n8n Community Node Package for the WAX Blockchain
65 lines • 2.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Wax = void 0;
const resources_1 = require("./resources");
const subtitle = `={{ ( { ${Object.entries(resources_1.properties.reduce((acc, prop) => {
var _a;
if (prop.name === 'operation') {
(_a = prop.options) === null || _a === void 0 ? void 0 : _a.forEach(option => {
const value = option.value;
if (value)
acc[String(value)] = option.name;
});
}
return acc;
}, {}))
.map(([key, value]) => `"${key}": "${value}"`)
.join(', ')} } )[$parameter["operation"]] }}`;
class Wax {
constructor() {
this.description = {
displayName: 'WAX',
name: 'wax',
icon: 'file:wax.svg',
group: ['transform'],
version: 1,
subtitle,
description: 'Interact with the WAX blockchain',
defaults: {
name: 'WAX',
},
inputs: ['main'],
outputs: ['main'],
outputNames: ['data'],
credentials: [
{
name: 'waxPrivateKeyApi',
required: false,
},
],
properties: resources_1.properties,
};
}
async execute() {
const items = this.getInputData();
const returnData = [];
for (let i = 0; i < items.length; i++) {
try {
const result = await resources_1.executeOperation.call(this, items, i);
if (result === null || result === void 0 ? void 0 : result.returnData) {
returnData.push(result.returnData);
}
}
catch (error) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
throw error;
}
}
return [returnData];
}
}
exports.Wax = Wax;
//# sourceMappingURL=Wax.node.js.map