Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
} else {
txDetails.extraData = options.data;
}
}
if (txDetails.fee == 0 && this.getRemainingFreeTransactionsFor(txDetails.sender) == 0) {
this.theWrapper.callbacks.error("TransactionHelper:sendTransaction", NimiqWrapper.ERROR_MESSAGES.FREE_TX_LIMIT);
} else {
let tx = null;
if (txDetails.extraData) {
tx = new Nimiq.ExtendedTransaction(
txDetails.sender.address,
Nimiq.Account.Type.BASIC,
txDetails.recipient,
Nimiq.Account.Type.BASIC,
txDetails.value,
txDetails.fee,
txDetails.validity,
Nimiq.Transaction.Flag.NONE,
txDetails.extraData
);
let keyPair = txDetails.sender._keyPair;
let signature = Nimiq.Signature.create(
keyPair.privateKey,
keyPair.publicKey,
tx.serializeContent()
);
let proof = Nimiq.SignatureProof.singleSig(keyPair.publicKey, signature);
tx.proof = proof.serialize();
} else {if (options.data.trim().length > 0) {
txDetails.extraData = Nimiq.BufferUtils.fromAscii(options.data.trim());
}
} else {
txDetails.extraData = options.data;
}
}
if (txDetails.fee == 0 && this.getRemainingFreeTransactionsFor(txDetails.sender) == 0) {
this.theWrapper.callbacks.error("TransactionHelper:sendTransaction", NimiqWrapper.ERROR_MESSAGES.FREE_TX_LIMIT);
} else {
let tx = null;
if (txDetails.extraData) {
tx = new Nimiq.ExtendedTransaction(
txDetails.sender.address,
Nimiq.Account.Type.BASIC,
txDetails.recipient,
Nimiq.Account.Type.BASIC,
txDetails.value,
txDetails.fee,
txDetails.validity,
Nimiq.Transaction.Flag.NONE,
txDetails.extraData
);
let keyPair = txDetails.sender._keyPair;
let signature = Nimiq.Signature.create(
keyPair.privateKey,
keyPair.publicKey,
tx.serializeContent()
);
let proof = Nimiq.SignatureProof.singleSig(keyPair.publicKey, signature);