Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports.accountTxLedgerResponse = function(request) {
return JSON.stringify({
id: request.id,
status: 'success',
type: 'response',
result: {
account: addresses.VALID,
ledger_index_max: request.ledger_index_min,
ledger_index_min: request.ledger_index_max,
limit: request.limit,
transactions: [
{
ledger_index: LEDGER,
meta: SerializedObject.from_json(METADATA).to_hex(),
tx_blob: SerializedObject.from_json(BINARY_TRANSACTION).to_hex(),
validated: true
}
]
}
});
};
module.exports.transactionResponse = function(request) {
return JSON.stringify({
id: request.id,
status: 'success',
type: 'response',
result: _.extend({
meta: SerializedObject.from_json(METADATA).to_hex(),
tx: SerializedObject.from_json(BINARY_TRANSACTION).to_hex()
}, BINARY_TRANSACTION_SYNTH)
});
};
module.exports.transactionResponse = function(request) {
return JSON.stringify({
id: request.id,
status: 'success',
type: 'response',
result: _.extend({
meta: SerializedObject.from_json(METADATA).to_hex(),
tx: SerializedObject.from_json(BINARY_TRANSACTION).to_hex()
}, BINARY_TRANSACTION_SYNTH)
});
};
module.exports.accountTxPreviousResponse = function(request) {
return JSON.stringify({
id: request.id,
status: 'success',
type: 'response',
result: {
account: addresses.VALID,
ledger_index_max: request.ledger_index_min,
ledger_index_min: request.ledger_index_max,
limit: request.limit,
forward: request.forward,
transactions: [
{
ledger_index: request.ledger_index_max - 2,
meta: SerializedObject.from_json(METADATA).to_hex(),
tx_blob: SerializedObject.from_json(_.extend({}, TRANSACTION, {
Destination: addresses.VALID
})).to_hex(),
validated: true
}
]
}
});
};
module.exports.transactionResponse = function(request, options) {
options = options || {};
_.defaults(options, {
memos: [],
hash: module.exports.VALID_TRANSACTION_HASH,
validated: true
});
return JSON.stringify({
id: request.id,
status: 'success',
type: 'response',
result: _.extend({
meta: SerializedObject.from_json(METADATA).to_hex(),
tx: SerializedObject.from_json(module.exports.binaryTransaction(options)).to_hex()
}, module.exports.binaryTransactionSynth(options))
});
};
function to_hex(input){
hex = new SerializedObject.from_json(input).to_hex();
return hex;
}
function serialize(txJSON) {
return SerializedObject.from_json(txJSON);
}