mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-05 21:35:49 +00:00
Co-authored-by: Chenna Keshava B S <21219765+ckeshava@users.noreply.github.com> Co-authored-by: Denis Angell <dangell@transia.co>
This commit is contained in:
@@ -63,11 +63,6 @@ online_delete=256
|
|||||||
[debug_logfile]
|
[debug_logfile]
|
||||||
/var/log/rippled/debug.log
|
/var/log/rippled/debug.log
|
||||||
|
|
||||||
[sntp_servers]
|
|
||||||
time.windows.com
|
|
||||||
time.apple.com
|
|
||||||
time.nist.gov
|
|
||||||
pool.ntp.org
|
|
||||||
|
|
||||||
[ips]
|
[ips]
|
||||||
r.ripple.com 51235
|
r.ripple.com 51235
|
||||||
@@ -167,6 +162,7 @@ fixXahauV1
|
|||||||
fixXahauV2
|
fixXahauV2
|
||||||
fixXahauV3
|
fixXahauV3
|
||||||
PaychanAndEscrowForTokens
|
PaychanAndEscrowForTokens
|
||||||
|
DeepFreeze
|
||||||
Clawback
|
Clawback
|
||||||
|
|
||||||
[network_id]
|
[network_id]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
* parseTransactionFlags as a utility function in the xrpl package to streamline transactions flags-to-map conversion
|
* parseTransactionFlags as a utility function in the xrpl package to streamline transactions flags-to-map conversion
|
||||||
|
* Support for XLS-77d Deep-Freeze amendment
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* `TransactionStream` model supports APIv2
|
* `TransactionStream` model supports APIv2
|
||||||
|
|||||||
@@ -77,4 +77,8 @@ export enum RippleStateFlags {
|
|||||||
lsfHighFreeze = 0x00800000,
|
lsfHighFreeze = 0x00800000,
|
||||||
// True, trust line to AMM. Used by client apps to identify payments via AMM.
|
// True, trust line to AMM. Used by client apps to identify payments via AMM.
|
||||||
lsfAMMNode = 0x01000000,
|
lsfAMMNode = 0x01000000,
|
||||||
|
// True, low side has set deep freeze flag
|
||||||
|
lsfLowDeepFreeze = 0x02000000,
|
||||||
|
// True, high side has set deep freeze flag
|
||||||
|
lsfHighDeepFreeze = 0x04000000,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ export enum TrustSetFlags {
|
|||||||
tfSetFreeze = 0x00100000,
|
tfSetFreeze = 0x00100000,
|
||||||
/** Unfreeze the trust line. */
|
/** Unfreeze the trust line. */
|
||||||
tfClearFreeze = 0x00200000,
|
tfClearFreeze = 0x00200000,
|
||||||
|
/** Deep-Freeze the trustline -- disallow sending and receiving 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 trustline */
|
||||||
|
tfClearDeepFreeze = 0x00800000,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,6 +94,11 @@ export interface TrustSetFlagsInterface extends GlobalFlags {
|
|||||||
tfSetFreeze?: boolean
|
tfSetFreeze?: boolean
|
||||||
/** Unfreeze the trust line. */
|
/** Unfreeze the trust line. */
|
||||||
tfClearFreeze?: boolean
|
tfClearFreeze?: boolean
|
||||||
|
/** Deep-Freeze the trustline -- disallow sending and receiving 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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,24 +1,36 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { OfferCreate } from '../../../src'
|
import { OfferCreate, TrustSet, Wallet } from '../../../src'
|
||||||
import serverUrl from '../serverUrl'
|
import serverUrl from '../serverUrl'
|
||||||
import {
|
import {
|
||||||
setupClient,
|
setupClient,
|
||||||
teardownClient,
|
teardownClient,
|
||||||
type XrplIntegrationTestContext,
|
type XrplIntegrationTestContext,
|
||||||
} from '../setup'
|
} from '../setup'
|
||||||
import { testTransaction } from '../utils'
|
import {
|
||||||
|
testTransaction,
|
||||||
|
generateFundedWallet,
|
||||||
|
submitTransaction,
|
||||||
|
} from '../utils'
|
||||||
|
|
||||||
// how long before each test case times out
|
// how long before each test case times out
|
||||||
const TIMEOUT = 20000
|
const TIMEOUT = 20000
|
||||||
|
|
||||||
describe('OfferCreate', function () {
|
describe('OfferCreate', function () {
|
||||||
let testContext: XrplIntegrationTestContext
|
let testContext: XrplIntegrationTestContext
|
||||||
|
let wallet_deep_freeze_trustline: Wallet | undefined
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
testContext = await setupClient(serverUrl)
|
testContext = await setupClient(serverUrl)
|
||||||
|
if (!wallet_deep_freeze_trustline) {
|
||||||
|
// eslint-disable-next-line require-atomic-updates -- race condition doesn't really matter
|
||||||
|
wallet_deep_freeze_trustline = await generateFundedWallet(
|
||||||
|
testContext.client,
|
||||||
|
)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
afterEach(async () => teardownClient(testContext))
|
|
||||||
|
afterAll(async () => teardownClient(testContext))
|
||||||
|
|
||||||
it(
|
it(
|
||||||
'base',
|
'base',
|
||||||
@@ -49,4 +61,52 @@ describe('OfferCreate', function () {
|
|||||||
},
|
},
|
||||||
TIMEOUT,
|
TIMEOUT,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
it(
|
||||||
|
'OfferCreate with Deep-Frozen trustline must fail',
|
||||||
|
async () => {
|
||||||
|
assert(wallet_deep_freeze_trustline != null)
|
||||||
|
|
||||||
|
// deep-freeze the trust line
|
||||||
|
const trust_set_tx: TrustSet = {
|
||||||
|
TransactionType: 'TrustSet',
|
||||||
|
Account: testContext.wallet.classicAddress,
|
||||||
|
LimitAmount: {
|
||||||
|
currency: 'USD',
|
||||||
|
issuer: wallet_deep_freeze_trustline.classicAddress,
|
||||||
|
value: '10',
|
||||||
|
},
|
||||||
|
Flags: {
|
||||||
|
tfSetFreeze: true,
|
||||||
|
tfSetDeepFreeze: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
await testTransaction(
|
||||||
|
testContext.client,
|
||||||
|
trust_set_tx,
|
||||||
|
testContext.wallet,
|
||||||
|
)
|
||||||
|
|
||||||
|
const offer_create_tx: OfferCreate = {
|
||||||
|
TransactionType: 'OfferCreate',
|
||||||
|
Account: testContext.wallet.classicAddress,
|
||||||
|
TakerGets: '13100000',
|
||||||
|
TakerPays: {
|
||||||
|
currency: 'USD',
|
||||||
|
issuer: wallet_deep_freeze_trustline.classicAddress,
|
||||||
|
value: '10',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await submitTransaction({
|
||||||
|
client: testContext.client,
|
||||||
|
transaction: offer_create_tx,
|
||||||
|
wallet: testContext.wallet,
|
||||||
|
})
|
||||||
|
|
||||||
|
assert.equal(response.result.engine_result, 'tecFROZEN')
|
||||||
|
},
|
||||||
|
TIMEOUT,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { TrustSet, percentToQuality, Wallet } from '../../../src'
|
import { TrustSet, percentToQuality, Wallet } from '../../../src'
|
||||||
|
import { RippleState } from '../../../src/models/ledger/index'
|
||||||
|
import { RippleStateFlags } from '../../../src/models/ledger/RippleState'
|
||||||
import serverUrl from '../serverUrl'
|
import serverUrl from '../serverUrl'
|
||||||
import {
|
import {
|
||||||
setupClient,
|
setupClient,
|
||||||
@@ -85,4 +87,60 @@ describe('TrustSet', function () {
|
|||||||
},
|
},
|
||||||
TIMEOUT,
|
TIMEOUT,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
it(
|
||||||
|
'Create a Deep-Frozen trustline',
|
||||||
|
async () => {
|
||||||
|
assert(wallet2 != null)
|
||||||
|
// deep-freeze a trustline with the specified counter-party/currency-code
|
||||||
|
const tx: TrustSet = {
|
||||||
|
TransactionType: 'TrustSet',
|
||||||
|
Account: testContext.wallet.classicAddress,
|
||||||
|
LimitAmount: {
|
||||||
|
currency: 'USD',
|
||||||
|
issuer: wallet2.classicAddress,
|
||||||
|
value: '10',
|
||||||
|
},
|
||||||
|
Flags: {
|
||||||
|
tfSetFreeze: true,
|
||||||
|
tfSetDeepFreeze: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await testTransaction(
|
||||||
|
testContext.client,
|
||||||
|
tx,
|
||||||
|
testContext.wallet,
|
||||||
|
)
|
||||||
|
assert.equal(response.result.engine_result, 'tesSUCCESS')
|
||||||
|
|
||||||
|
// assert that the trustline is frozen
|
||||||
|
const trustLine = await testContext.client.request({
|
||||||
|
command: 'account_lines',
|
||||||
|
account: testContext.wallet.classicAddress,
|
||||||
|
})
|
||||||
|
assert.equal(trustLine.result.lines[0].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,
|
||||||
|
})
|
||||||
|
|
||||||
|
const rippleState = account_objects.result
|
||||||
|
.account_objects[0] as RippleState
|
||||||
|
|
||||||
|
// Depending on the pseudo-random generation of accounts,
|
||||||
|
// either of the below leger-object flags must be set
|
||||||
|
|
||||||
|
const hasDeepFreeze =
|
||||||
|
// eslint-disable-next-line no-bitwise -- required to validate flag
|
||||||
|
(rippleState.Flags & RippleStateFlags.lsfHighDeepFreeze) |
|
||||||
|
// eslint-disable-next-line no-bitwise -- required to validate flag
|
||||||
|
(rippleState.Flags & RippleStateFlags.lsfLowDeepFreeze)
|
||||||
|
assert.isTrue(hasDeepFreeze !== 0)
|
||||||
|
},
|
||||||
|
TIMEOUT,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ describe('TrustSet', function () {
|
|||||||
},
|
},
|
||||||
QualityIn: 1234,
|
QualityIn: 1234,
|
||||||
QualityOut: 4321,
|
QualityOut: 4321,
|
||||||
|
// an example of deep-frozen trustline
|
||||||
|
Flags: {
|
||||||
|
tfSetFreeze: true,
|
||||||
|
tfSetDeepFreeze: true,
|
||||||
|
},
|
||||||
} as any
|
} as any
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user