Files
xahau.js/packages/xrpl/test/integration/transactions/ammClawback.test.ts
Omar Khan 35e40d9d71 feat: add AMMClawback support (#2893)
* 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
2025-02-11 19:00:51 -05:00

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)
})
})