From ba2f2901009185a57e450dcc3399f486c184db62 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Thu, 23 May 2013 15:33:33 -0700 Subject: [PATCH] Add support for AccountSet and account_root flags. --- src/js/ripple/remote.js | 23 +++++++++++++++++++++++ src/js/ripple/transaction.js | 10 ++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/js/ripple/remote.js b/src/js/ripple/remote.js index 72cdb099..61099b3c 100644 --- a/src/js/ripple/remote.js +++ b/src/js/ripple/remote.js @@ -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'); diff --git a/src/js/ripple/transaction.js b/src/js/ripple/transaction.js index c7408f41..3d8a08a1 100644 --- a/src/js/ripple/transaction.js +++ b/src/js/ripple/transaction.js @@ -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