Skip to content

Commit

Permalink
changelog and test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
achowdhry-ripple committed Nov 13, 2024
1 parent 95f46ce commit 0f3e67d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
3 changes: 3 additions & 0 deletions packages/xrpl/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xrpl-announce) for release announcements. We recommend that xrpl.js (ripple-lib) users stay up-to-date with the latest stable release.

## Unreleased Changes
* Fix for parseTransactionFlags to no longer modify a passed in transaction when returning a parsed mapping
* Remove setTransactionFlagsToNumber
* Add convertTxFlagsToNumber as a utility function in xrpl to return the number conversion of a transaction's flags

### Added
* parseTransactionFlags as a utility function in the xrpl package to streamline transactions flags-to-map conversion
Expand Down
22 changes: 11 additions & 11 deletions packages/xrpl/test/models/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { AccountRootFlags } from '../../src/models/ledger'
import { isFlagEnabled } from '../../src/models/utils'
import {
setTransactionFlagsToNumber,
convertTxFlagsToNumber,
parseAccountRootFlags,
parseTransactionFlags,
} from '../../src/models/utils/flags'
Expand Down Expand Up @@ -71,8 +71,8 @@ describe('Models Utils', function () {
const { tfPassive, tfFillOrKill } = OfferCreateFlags
const expected: number = tfPassive | tfFillOrKill

setTransactionFlagsToNumber(tx)
assert.strictEqual(tx.Flags, expected)
const flagNum = convertTxFlagsToNumber(tx)
assert.strictEqual(flagNum, expected)
})

it('sets PaymentChannelClaimFlags to its numeric value', function () {
Expand All @@ -90,8 +90,8 @@ describe('Models Utils', function () {
const { tfRenew } = PaymentChannelClaimFlags
const expected: number = tfRenew

setTransactionFlagsToNumber(tx)
assert.strictEqual(tx.Flags, expected)
const flagNum = convertTxFlagsToNumber(tx)
assert.strictEqual(flagNum, expected)
})

it('sets PaymentTransactionFlags to its numeric value', function () {
Expand All @@ -110,8 +110,8 @@ describe('Models Utils', function () {
const { tfPartialPayment, tfLimitQuality } = PaymentFlags
const expected: number = tfPartialPayment | tfLimitQuality

setTransactionFlagsToNumber(tx)
assert.strictEqual(tx.Flags, expected)
const flagNum = convertTxFlagsToNumber(tx)
assert.strictEqual(flagNum, expected)
})

it('sets TrustSetFlags to its numeric value', function () {
Expand All @@ -137,8 +137,8 @@ describe('Models Utils', function () {
const { tfSetfAuth, tfClearNoRipple, tfClearFreeze } = TrustSetFlags
const expected: number = tfSetfAuth | tfClearNoRipple | tfClearFreeze

setTransactionFlagsToNumber(tx)
assert.strictEqual(tx.Flags, expected)
const flagNum = convertTxFlagsToNumber(tx)
assert.strictEqual(flagNum, expected)
})

it('sets other transaction types flags to its numeric value', function () {
Expand All @@ -148,8 +148,8 @@ describe('Models Utils', function () {
Flags: {},
}

setTransactionFlagsToNumber(tx)
assert.strictEqual(tx.Flags, 0)
const flagNum = convertTxFlagsToNumber(tx)
assert.strictEqual(flagNum, 0)
})

// eslint-disable-next-line complexity -- Simpler to list them all out at once.
Expand Down

0 comments on commit 0f3e67d

Please sign in to comment.