Add unit test for submit

This commit is contained in:
Chris Clark
2015-06-09 14:52:00 -07:00
parent 82ed402b16
commit 97cea2ce4d
7 changed files with 76 additions and 41 deletions

View File

@@ -49,7 +49,7 @@ function computeSignature(txJSON, keypair) {
/*:: type TxJSON = {Account: string; SigningPubKey: string,
TxnSignature: string};
type Signed = {tx_blob: string; hash: string}; */
type Signed = {signedTransaction: string; id: string}; */
function sign(txJSON: TxJSON, secret: string): Signed {
validate.txJSON(txJSON);
validate.addressAndSecret({address: txJSON.Account, secret: secret});
@@ -61,8 +61,8 @@ function sign(txJSON: TxJSON, secret: string): Signed {
txJSON.TxnSignature = computeSignature(txJSON, keypair);
const serialized = serialize(txJSON);
return {
tx_blob: serialized.to_hex(),
hash: hashSerialization(serialized, HASH_TX_ID)
signedTransaction: serialized.to_hex(),
id: hashSerialization(serialized, HASH_TX_ID)
};
}

View File

@@ -9,7 +9,7 @@ function submit(tx_blob: string, callback: Callback): void {
validate.blob(tx_blob);
const request = new ripple.Request(this.remote, 'submit');
request.message.tx_blob = tx_blob;
request.request(callback);
request.request(null, callback);
}
module.exports = submit;