Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ckeshava committed Jan 31, 2025
1 parent bb1463b commit c9ecd33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions packages/xrpl/src/models/transactions/trustSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export enum TrustSetFlags {
/** Unfreeze the trust line. */
tfClearFreeze = 0x00200000,
/** Deep-Freeze the trust line -- disallow sending and recieving the said IssuedCurrency */
/** Allowed only if the trustline is already regularly frozen, or if tfSetFreeze is set in the same transaction. */
tfSetDeepFreeze = 0x00400000,
/** Clear a Deep-Frozen trust line */
tfClearDeepFreeze = 0x00800000,
Expand Down Expand Up @@ -94,6 +95,7 @@ export interface TrustSetFlagsInterface extends GlobalFlags {
/** Unfreeze the trust line. */
tfClearFreeze?: boolean
/** Deep-Freeze the trust line -- disallow sending and recieving the said IssuedCurrency */
/** Allowed only if the trustline is already regularly frozen, or if tfSetFreeze is set in the same transaction. */
tfSetDeepFreeze?: boolean
/** Clear a Deep-Frozen trust line */
tfClearDeepFreeze?: boolean
Expand Down
20 changes: 12 additions & 8 deletions packages/xrpl/test/integration/transactions/trustSet.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { assert } from 'chai'

import { TrustSet, percentToQuality, Wallet } from '../../../src'
import { TrustSet, percentToQuality, Wallet, TrustSetFlags } from '../../../src'
import serverUrl from '../serverUrl'
import {
setupClient,
teardownClient,
type XrplIntegrationTestContext,
} from '../setup'
import { generateFundedWallet, testTransaction } from '../utils'

import RippleState from '../../../src/models/ledger/RippleState'
// how long before each test case times out
const TIMEOUT = 20000

Expand Down Expand Up @@ -90,7 +90,7 @@ describe('TrustSet', function () {
'Create a Deep-Frozen trustline',
async () => {
assert(wallet2 != null)
// preemptively deep-freeze a trustline with the specified counter-party/currency-code
// deep-freeze a trustline with the specified counter-party/currency-code
const tx: TrustSet = {
TransactionType: 'TrustSet',
Account: testContext.wallet.classicAddress,
Expand All @@ -112,17 +112,21 @@ describe('TrustSet', function () {
)
assert.equal(response.result.engine_result, 'tesSUCCESS')

// assert that the trustline is deep-frozen
// assert that the trustline is frozen
const trustLine = await testContext.client.request({
command: 'account_lines',
account: testContext.wallet.classicAddress,
})

// assert that the trustLine is deep-frozen
assert.equal(trustLine.result.lines[0].freeze, true)

// Keshava: ensure that account_lines RPC response contains a deep_freeze flag
// assert.equal(trustLine.result.lines[0].deep_freeze, true)
// verify that the trust-line is deep-frozen
// this operation cannot be done with the account_lines RPC
const account_objects = await testContext.client.request({
command: 'account_objects',
account: testContext.wallet.classicAddress,
})
assert.isTrue(((account_objects.result.account_objects[0] as RippleState).Flags & TrustSetFlags.tfSetDeepFreeze) != 0)

},
TIMEOUT,
)
Expand Down

0 comments on commit c9ecd33

Please sign in to comment.