diff --git a/packages/xrpl/src/models/transactions/trustSet.ts b/packages/xrpl/src/models/transactions/trustSet.ts index e27ca43306..11ef1fb7c9 100644 --- a/packages/xrpl/src/models/transactions/trustSet.ts +++ b/packages/xrpl/src/models/transactions/trustSet.ts @@ -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, @@ -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 diff --git a/packages/xrpl/test/integration/transactions/trustSet.test.ts b/packages/xrpl/test/integration/transactions/trustSet.test.ts index 2ae977e9d2..14d059ba00 100644 --- a/packages/xrpl/test/integration/transactions/trustSet.test.ts +++ b/packages/xrpl/test/integration/transactions/trustSet.test.ts @@ -1,6 +1,6 @@ import { assert } from 'chai' -import { TrustSet, percentToQuality, Wallet } from '../../../src' +import { TrustSet, percentToQuality, Wallet, TrustSetFlags } from '../../../src' import serverUrl from '../serverUrl' import { setupClient, @@ -8,7 +8,7 @@ import { 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 @@ -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, @@ -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, )