Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
SigningPubKey: keypair.publicKey,
TxnSignature: computeSignature(
txToSignAndEncode,
keypair.privateKey,
options.signAs
)
}
txToSignAndEncode.Signers = [{Signer: signer}]
} else {
txToSignAndEncode.TxnSignature = computeSignature(
txToSignAndEncode,
keypair.privateKey
)
}
const serialized = binaryCodec.encode(txToSignAndEncode)
checkTxSerialization(serialized, tx)
return {
signedTransaction: serialized,
id: computeBinaryTransactionHash(serialized)
}
}
export const computeTransactionHash = (txJSON: any): string => {
return computeBinaryTransactionHash(encode(txJSON))
}
return co(function *() {
if (!params.txHex) {
throw new Error('missing required param txHex');
}
let transaction;
let txHex;
try {
transaction = rippleBinaryCodec.decode(params.txHex);
txHex = params.txHex;
} catch (e) {
try {
transaction = JSON.parse(params.txHex);
txHex = rippleBinaryCodec.encode(transaction);
} catch (e) {
throw new Error('txHex needs to be either hex or JSON string for XRP');
}
}
const id = computeBinaryTransactionHash(txHex);
const address = transaction.Destination + ((transaction.DestinationTag >= 0) ? '?dt=' + transaction.DestinationTag : '');
return {
displayOrder: ['id', 'outputAmount', 'changeAmount', 'outputs', 'changeOutputs', 'fee'],
id: id,
changeOutputs: [],
outputAmount: transaction.Amount,
changeAmount: 0,
outputs: [
{
address,
amount: transaction.Amount
function verifyManifest(manifest) {
const signature = manifest.MasterSignature;
delete manifest.Signature;
delete manifest.MasterSignature;
const manifest_data = new Buffer('MAN\0').toJSON().data.concat(toBytes(binary.encode(manifest)));
let master_public_bytes = toBytes(manifest.PublicKey);
master_public_bytes.shift();
return Ed25519.verify(manifest_data, toBytes(signature), master_public_bytes);
}
Transaction.prototype.serialize = function() {
return binary.encode(this.tx_json);
};
function to_hex(input){
return binary.encode(input);
}
module.exports.toHex = function (input) {
return binary.encode(input);
}