Add support for AccountSet and account_root flags.

This commit is contained in:
Arthur Britto
2013-05-23 15:33:33 -07:00
parent 337bb03a00
commit ba2f290100
2 changed files with 33 additions and 0 deletions

View File

@@ -370,6 +370,16 @@ var Remote = function (opts, trace) {
util.inherits(Remote, EventEmitter);
// Flags for ledger entries. In support of account_root().
Remote.flags = {
'account_root' : {
'PasswordSpent' : 0x00010000,
'RequireDestTag' : 0x00020000,
'RequireAuth' : 0x00040000,
'DisallowXRP' : 0x00080000,
}
};
Remote.from_config = function (obj, trace) {
var serverConfig = 'string' === typeof obj ? config.servers[obj] : obj;
@@ -1013,6 +1023,19 @@ Remote.prototype.request_account_balance = function (account, current) {
});
};
// Return a request to return the account flags.
Remote.prototype.request_account_flags = function (account, current) {
var request = this.request_ledger_entry('account_root');
return request
.account_root(account)
.ledger_choose(current)
.on('success', function (message) {
// If the caller also waits for 'success', they might run before this.
request.emit('account_flags', message.node.Flags);
});
};
// Return a request to emit the owner count.
Remote.prototype.request_owner_count = function (account, current) {
var request = this.request_ledger_entry('account_root');

View File

@@ -112,6 +112,15 @@ Transaction.fees = {
};
Transaction.flags = {
'AccountSet' : {
'RequireDestTag' : 0x00010000,
'OptionalDestTag' : 0x00020000,
'RequireAuth' : 0x00040000,
'OptionalAuth' : 0x00080000,
'DisallowXRP' : 0x00100000,
'AllowXRP' : 0x00200000,
},
'OfferCreate' : {
'Passive' : 0x00010000,
'ImmediateOrCancel' : 0x00020000,
@@ -545,6 +554,7 @@ Transaction.prototype._account_secret = function (account) {
// Options:
// .domain() NYI
// .flags()
// .message_key() NYI
// .transfer_rate()
// .wallet_locator() NYI