-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
packages/xrpl/test/integration/transactions/ammClawback.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { AMMClawback, AMMDeposit, AMMDepositFlags } 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 { asset, asset2, issuerWallet } = ammPool | ||
const holderWallet = ammPool.lpWallet | ||
|
||
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, | ||
// @ts-expect-error -- this is an IssuedCurrency | ||
Asset: asset, | ||
Asset2: asset2, | ||
} | ||
|
||
await testTransaction(testContext.client, ammClawback, issuerWallet) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters