diff --git a/src/js/ripple/transaction.js b/src/js/ripple/transaction.js index 0645ed47..1a9e4524 100644 --- a/src/js/ripple/transaction.js +++ b/src/js/ripple/transaction.js @@ -132,6 +132,7 @@ Transaction.set_clear_flags = { asfRequireAuth: 2, asfDisallowXRP: 3, asfDisableMaster: 4, + asfAccountTxnID: 5, asfNoFreeze: 6, asfGlobalFreeze: 7 } @@ -859,6 +860,15 @@ Transaction.prototype.addMemo = function(memoType, memoFormat, memoData) { return this; }; +Transaction.prototype.setAccountTxnID = +Transaction.prototype.accountTxnID = function(id) { + if (typeof id === 'string') { + this.tx_json.AccountTxnID = id; + } + + return this; +}; + /** * Construct an 'AccountSet' transaction * diff --git a/test/transaction-test.js b/test/transaction-test.js index e662f690..67eeeab0 100644 --- a/test/transaction-test.js +++ b/test/transaction-test.js @@ -1215,14 +1215,15 @@ describe('Transaction', function() { ]); }); - it('Construct AccountSet transaction', function() { - var transaction = new Transaction().accountSet('rsLEU1TPdCJPPysqhWYw9jD97xtG5WqSJm'); - + it('Set AccountTxnID', function() { + var transaction = new Transaction(); assert(transaction instanceof Transaction); + + transaction.accountTxnID('75C5A92212AA82A89C3824F6F071FE49C95C45DE9113EB51763A217DBACB5B4F'); + assert.deepEqual(transaction.tx_json, { Flags: 0, - TransactionType: 'AccountSet', - Account: 'rsLEU1TPdCJPPysqhWYw9jD97xtG5WqSJm' + AccountTxnID: '75C5A92212AA82A89C3824F6F071FE49C95C45DE9113EB51763A217DBACB5B4F' }); }); @@ -1239,6 +1240,18 @@ describe('Transaction', function() { }); }); + it('Construct AccountSet transaction - with AccountTxnID SetFlag', function() { + var transaction = new Transaction().accountSet('rsLEU1TPdCJPPysqhWYw9jD97xtG5WqSJm', 'asfAccountTxnID'); + + assert(transaction instanceof Transaction); + assert.deepEqual(transaction.tx_json, { + Flags: 0, + SetFlag: 5, + TransactionType: 'AccountSet', + Account: 'rsLEU1TPdCJPPysqhWYw9jD97xtG5WqSJm' + }); + }); + it('Construct AccountSet transaction - params object', function() { var transaction = new Transaction().accountSet({ account: 'rsLEU1TPdCJPPysqhWYw9jD97xtG5WqSJm',