Skip to content

Commit 2a90f9b

Browse files
committed
Include signers in getSettings
1 parent f42dafd commit 2a90f9b

File tree

4 files changed

+55
-9
lines changed

4 files changed

+55
-9
lines changed

src/ledger/parse/fields.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ function parseFields(data: Object): Object {
2828
settings.regularKey = data.RegularKey
2929
}
3030

31-
// TODO: this isn't implemented in rippled yet, may have to change this later
32-
if (data.SignerQuorum || data.SignerEntries) {
31+
// Since an account can own at most one SignerList,
32+
// this array must have exactly one member if it is present.
33+
if (data.signer_lists && data.signer_lists.length === 1) {
3334
settings.signers = {}
34-
if (data.SignerQuorum) {
35-
settings.signers.threshold = data.SignerQuorum
35+
if (data.signer_lists[0].SignerQuorum) {
36+
settings.signers.threshold = data.signer_lists[0].SignerQuorum
3637
}
37-
if (data.SignerEntries) {
38-
settings.signers.weights = _.map(data.SignerEntries, entry => {
38+
if (data.signer_lists[0].SignerEntries) {
39+
settings.signers.weights = _.map(data.signer_lists[0].SignerEntries, entry => {
3940
return {
4041
address: entry.SignerEntry.Account,
4142
weight: entry.SignerEntry.SignerWeight

src/ledger/settings.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ function getSettings(address: string, options: SettingsOptions = {}
5252
const request = {
5353
command: 'account_info',
5454
account: address,
55-
ledger_index: options.ledgerVersion || 'validated'
55+
ledger_index: options.ledgerVersion || 'validated',
56+
signer_lists: true
5657
}
5758

5859
return this.connection.request(request).then(formatSettings)

test/fixtures/responses/get-settings.json

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,20 @@
33
"disallowIncomingXRP": true,
44
"emailHash": "23463B99B62A72F26ED677CC556C44E8",
55
"domain": "example.com",
6-
"transferRate": 1.002
6+
"transferRate": 1.002,
7+
"signers": {
8+
"threshold": 3,
9+
"weights": [
10+
{
11+
"address": "rpHit3GvUR1VSGh2PXcaaZKEEUnCVxWU2i",
12+
"weight": 1
13+
}, {
14+
"address": "rN4oCm1c6BQz6nru83H52FBSpNbC9VQcRc",
15+
"weight": 1
16+
}, {
17+
"address": "rJ8KhCi67VgbapiKCQN3r1ZA6BMUxUvvnD",
18+
"weight": 1
19+
}
20+
]
21+
}
722
}

test/fixtures/rippled/account-info.json

+30-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,36 @@
1717
"TransferRate": 1002000000,
1818
"WalletLocator": "00000000000000000000000000000000000000000000000000000000DEADBEEF",
1919
"index": "396400950EA27EB5710C0D5BE1D2B4689139F168AC5D07C13B8140EC3F82AE71",
20-
"urlgravatar": "http://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8"
20+
"urlgravatar": "http://www.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8",
21+
"signer_lists": [
22+
{
23+
"Flags": 0,
24+
"LedgerEntryType": "SignerList",
25+
"OwnerNode": "0000000000000000",
26+
"PreviousTxnID": "D2707DE50E1244B2C2AAEBC78C82A19ABAE0599D29362C16F1B8458EB65CCFE4",
27+
"PreviousTxnLgrSeq": 3131157,
28+
"SignerEntries": [
29+
{
30+
"SignerEntry": {
31+
"Account": "rpHit3GvUR1VSGh2PXcaaZKEEUnCVxWU2i",
32+
"SignerWeight": 1
33+
}
34+
}, {
35+
"SignerEntry": {
36+
"Account": "rN4oCm1c6BQz6nru83H52FBSpNbC9VQcRc",
37+
"SignerWeight": 1
38+
}
39+
}, {
40+
"SignerEntry": {
41+
"Account": "rJ8KhCi67VgbapiKCQN3r1ZA6BMUxUvvnD",
42+
"SignerWeight": 1
43+
}
44+
}],
45+
"SignerListID": 0,
46+
"SignerQuorum": 3,
47+
"index": "5A9373E02D1DEF7EC9204DEB4819BA42D6AA6BCD878DC8C853062E9DD9708D11"
48+
}
49+
]
2150
},
2251
"ledger_index": 9592219
2352
}

0 commit comments

Comments
 (0)