Add AccountTxnID flag and setter

This commit is contained in:
wltsmrz
2014-12-16 13:25:32 -08:00
parent 9e89904f03
commit 2dde114d3d
2 changed files with 28 additions and 5 deletions

View File

@@ -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
*

View File

@@ -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',