nem-voting
Version:
31 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("./utils");
const nem_library_1 = require("nem-library");
const constants_1 = require("./constants");
const getAllOfficialPolls = () => {
return utils_1.getOutgoingTransactionsWithString("poll:", new nem_library_1.Address(constants_1.PollConstants.OFFICAL_POLL_ACCOUNT)).map((transactions) => {
const headers = transactions.map((transaction) => {
try {
if (transaction.type !== nem_library_1.TransactionTypes.TRANSFER || !transaction.signer) {
return null;
}
const header = JSON.parse(transaction.message.plain().replace("poll:", ""));
return {
title: header.title,
type: header.type,
doe: header.doe,
address: new nem_library_1.Address(header.address),
creator: transaction.signer.address,
whitelist: header.whitelist,
};
}
catch (err) {
return null;
}
}).filter((h) => h !== null).map((h) => h);
return headers;
});
};
exports.getAllOfficialPolls = getAllOfficialPolls;
//# sourceMappingURL=official.js.map