diff --git a/src/ledger/parse/fields.js b/src/ledger/parse/fields.js index 9991468bb7..211d212fbe 100644 --- a/src/ledger/parse/fields.js +++ b/src/ledger/parse/fields.js @@ -28,14 +28,15 @@ function parseFields(data: Object): Object { settings.regularKey = data.RegularKey } - // TODO: this isn't implemented in rippled yet, may have to change this later - if (data.SignerQuorum || data.SignerEntries) { + // Since an account can own at most one SignerList, + // this array must have exactly one member if it is present. + if (data.signer_lists && data.signer_lists.length === 1) { settings.signers = {} - if (data.SignerQuorum) { - settings.signers.threshold = data.SignerQuorum + if (data.signer_lists[0].SignerQuorum) { + settings.signers.threshold = data.signer_lists[0].SignerQuorum } - if (data.SignerEntries) { - settings.signers.weights = _.map(data.SignerEntries, entry => { + if (data.signer_lists[0].SignerEntries) { + settings.signers.weights = _.map(data.signer_lists[0].SignerEntries, entry => { return { address: entry.SignerEntry.Account, weight: entry.SignerEntry.SignerWeight diff --git a/src/ledger/settings.js b/src/ledger/settings.js index 25246ea664..760c490480 100644 --- a/src/ledger/settings.js +++ b/src/ledger/settings.js @@ -52,7 +52,8 @@ function getSettings(address: string, options: SettingsOptions = {} const request = { command: 'account_info', account: address, - ledger_index: options.ledgerVersion || 'validated' + ledger_index: options.ledgerVersion || 'validated', + signer_lists: true } return this.connection.request(request).then(formatSettings) diff --git a/test/fixtures/responses/get-settings.json b/test/fixtures/responses/get-settings.json index 2071e0ea25..a0215311ac 100644 --- a/test/fixtures/responses/get-settings.json +++ b/test/fixtures/responses/get-settings.json @@ -3,5 +3,20 @@ "disallowIncomingXRP": true, "emailHash": "23463B99B62A72F26ED677CC556C44E8", "domain": "example.com", - "transferRate": 1.002 + "transferRate": 1.002, + "signers": { + "threshold": 3, + "weights": [ + { + "address": "rpHit3GvUR1VSGh2PXcaaZKEEUnCVxWU2i", + "weight": 1 + }, { + "address": "rN4oCm1c6BQz6nru83H52FBSpNbC9VQcRc", + "weight": 1 + }, { + "address": "rJ8KhCi67VgbapiKCQN3r1ZA6BMUxUvvnD", + "weight": 1 + } + ] + } } diff --git a/test/fixtures/rippled/account-info.json b/test/fixtures/rippled/account-info.json index c6c17ae8db..3042200500 100644 --- a/test/fixtures/rippled/account-info.json +++ b/test/fixtures/rippled/account-info.json @@ -17,7 +17,36 @@ "TransferRate": 1002000000, "WalletLocator": "00000000000000000000000000000000000000000000000000000000DEADBEEF", "index": "396400950EA27EB5710C0D5BE1D2B4689139F168AC5D07C13B8140EC3F82AE71", - "urlgravatar": "http://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8" + "urlgravatar": "http://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8", + "signer_lists": [ + { + "Flags": 0, + "LedgerEntryType": "SignerList", + "OwnerNode": "0000000000000000", + "PreviousTxnID": "D2707DE50E1244B2C2AAEBC78C82A19ABAE0599D29362C16F1B8458EB65CCFE4", + "PreviousTxnLgrSeq": 3131157, + "SignerEntries": [ + { + "SignerEntry": { + "Account": "rpHit3GvUR1VSGh2PXcaaZKEEUnCVxWU2i", + "SignerWeight": 1 + } + }, { + "SignerEntry": { + "Account": "rN4oCm1c6BQz6nru83H52FBSpNbC9VQcRc", + "SignerWeight": 1 + } + }, { + "SignerEntry": { + "Account": "rJ8KhCi67VgbapiKCQN3r1ZA6BMUxUvvnD", + "SignerWeight": 1 + } + }], + "SignerListID": 0, + "SignerQuorum": 3, + "index": "5A9373E02D1DEF7EC9204DEB4819BA42D6AA6BCD878DC8C853062E9DD9708D11" + } + ] }, "ledger_index": 9592219 }