mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
* update definitions and package.json * update rippled.cfg * add AMMClawback transaction with unit test * switch to rippled v2.3.1 * Revert "switch to rippled v2.3.1" This reverts commit d0bd3bdae97fc82240d5dd18732fa301255dc26a. * update definitions * add integ test * resolve type assertions * remove package-lock.json in sub packages * remove ts-expect-error * update integ test * console logs * fix console logs * add tfClawTwoAssets test and remove logs * fix lint error * refactor type assertions * refactor error messages * final cleanup
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import { AMMClawback, AMMDeposit, AMMDepositFlags, XRP } from 'xrpl'
|
|
|
|
import serverUrl from '../serverUrl'
|
|
import {
|
|
setupClient,
|
|
teardownClient,
|
|
type XrplIntegrationTestContext,
|
|
} from '../setup'
|
|
import { createAMMPool, testTransaction } from '../utils'
|
|
|
|
describe('AMMClawback', function () {
|
|
let testContext: XrplIntegrationTestContext
|
|
|
|
beforeAll(async () => {
|
|
testContext = await setupClient(serverUrl)
|
|
})
|
|
afterAll(async () => teardownClient(testContext))
|
|
|
|
it('base', async function () {
|
|
const ammPool = await createAMMPool(testContext.client, true)
|
|
const { issuerWallet } = ammPool
|
|
const holderWallet = ammPool.lpWallet
|
|
|
|
const asset = {
|
|
currency: 'USD',
|
|
issuer: issuerWallet.classicAddress,
|
|
}
|
|
const asset2 = {
|
|
currency: 'XRP',
|
|
} as XRP
|
|
|
|
const ammDepositTx: AMMDeposit = {
|
|
TransactionType: 'AMMDeposit',
|
|
Account: holderWallet.classicAddress,
|
|
Asset: asset,
|
|
Asset2: asset2,
|
|
Amount: {
|
|
currency: 'USD',
|
|
issuer: issuerWallet.address,
|
|
value: '10',
|
|
},
|
|
Flags: AMMDepositFlags.tfSingleAsset,
|
|
}
|
|
|
|
await testTransaction(testContext.client, ammDepositTx, holderWallet)
|
|
|
|
const ammClawback: AMMClawback = {
|
|
TransactionType: 'AMMClawback',
|
|
Account: issuerWallet.address,
|
|
Holder: holderWallet.address,
|
|
Asset: asset,
|
|
Asset2: asset2,
|
|
}
|
|
|
|
await testTransaction(testContext.client, ammClawback, issuerWallet)
|
|
})
|
|
})
|