Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const createRawVoteTX = (senderPublicKey, recipientId, votedList, unvotedList) => {
const transaction = {
type: transactionTypes.vote,
amount: '0',
fee: Lisk.transaction.constants.VOTE_FEE.toString(),
senderPublicKey,
recipientId,
timestamp: Lisk.transaction.utils.getTimeFromBlockchainEpoch() - 100,
asset: { votes: concatVoteLists(votedList, unvotedList) },
};
return transaction;
};
// eslint-disable-next-line max-len
export const createRawVoteTX = (senderPublicKey, recipientId, votedList, unvotedList) => {
const transaction = {
type: transactionTypes.vote,
amount: '0',
fee: Lisk.transaction.constants.VOTE_FEE.toString(),
senderPublicKey,
recipientId,
timestamp: Lisk.transaction.utils.getTimeFromBlockchainEpoch() - 100,
asset: { votes: concatVoteLists(votedList, unvotedList) },
};
return transaction;
};
// eslint-disable-next-line max-len
return new Promise((resolve, reject) => {
const transaction = Lisk.transaction.registerDelegate({ ...data });
liskAPIClient.transactions
.broadcast(transaction)
.then(() => {
resolve(transaction);
})
.catch(reject);
});
};
export const getTimeOffset = state => (
state.blocks && state.blocks.latestBlocks[0] && state.blocks.latestBlocks[0].timestamp
? state.blocks.latestBlocks[0].timestamp - Lisk.transaction.utils.getTimeFromBlockchainEpoch()
: 0
);
.map(({ votes, unvotes }) => (Lisk.transaction.castVotes(
{
votes,
unvotes,
passphrase,
secondPassphrase,
timeOffset,
},
))))
);
export const create = (transaction, transactionType) => new Promise((resolve, reject) => {
try {
const tx = Lisk.transaction[transactionType](transaction);
resolve(tx);
} catch (error) {
reject(error);
}
});
export const getTransactionBytes = transaction => Lisk.transaction.utils.getTransactionBytes(transaction);
new Promise((resolve, reject) => {
const txId = Lisk.transaction.transfer({
amount,
data,
passphrase,
recipientId,
secondPassphrase,
timeOffset,
});
getAPIClient(networkConfig).transactions.broadcast(txId)
.then(resolve(txId))
.catch(reject);
});
export const calculateTxId = transaction => Lisk.transaction.utils.getTransactionId(transaction);