Skip to content

Commit

Permalink
fix: enable the removal of a signer list (XRPLF#2377)
Browse files Browse the repository at this point in the history
`SignerQuorum` field has to be 0 and the `SignerEntrys` field has to be `undefined`

Co-authored-by: Caleb Kniffen <[email protected]>
  • Loading branch information
2 people authored and dangell7 committed Jul 19, 2023
1 parent be156c9 commit 2a35ac2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/xrpl/src/models/transactions/signerListSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface SignerListSet extends BaseTransaction {
* more than 32 members. No address may appear more than once in the list, nor
* may the Account submitting the transaction appear in the list.
*/
SignerEntries: SignerEntry[]
SignerEntries?: SignerEntry[]
}

const MAX_SIGNERS = 32
Expand All @@ -36,6 +36,7 @@ const HEX_WALLET_LOCATOR_REGEX = /^[0-9A-Fa-f]{64}$/u
* @param tx - An SignerListSet Transaction.
* @throws When the SignerListSet is Malformed.
*/
// eslint-disable-next-line complexity -- validation can be complex
export function validateSignerListSet(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)

Expand All @@ -47,6 +48,11 @@ export function validateSignerListSet(tx: Record<string, unknown>): void {
throw new ValidationError('SignerListSet: invalid SignerQuorum')
}

// All other checks are for if SignerQuorum is greater than 0
if (tx.SignerQuorum === 0) {
return
}

if (tx.SignerEntries === undefined) {
throw new ValidationError('SignerListSet: missing field SignerEntries')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ describe('SignerListSet', function () {
})
afterEach(async () => teardownClient(testContext))

// Add signerlist
it(
'base',
'add',
async () => {
const tx: SignerListSet = {
TransactionType: 'SignerListSet',
Expand All @@ -44,4 +45,18 @@ describe('SignerListSet', function () {
},
TIMEOUT,
)

// Remove signerlist
it(
'remove',
async () => {
const tx: SignerListSet = {
TransactionType: 'SignerListSet',
Account: testContext.wallet.classicAddress,
SignerQuorum: 0,
}
await testTransaction(testContext.client, tx, testContext.wallet)
},
TIMEOUT,
)
})

0 comments on commit 2a35ac2

Please sign in to comment.