See the canonical spec:
.TypeScriptimport { Client, Wallet } from 'xrpl'; async function withdrawAMM(): Promise<void> { const client = new Client('wss://honeycluster.dev'); await client.connect(); const wallet = Wallet.fromSeed('s...'); const prepared = await client.autofill({ TransactionType: 'AMMWithdraw', Account: wallet.address, LPTokenIn: { currency: 'XRP', value: '1000' }, Flags: 0, }); const signed = wallet.sign(prepared); const res = await client.submitAndWait(signed.tx_blob); console.log(res); await client.disconnect(); } withdrawAMM().catch(console.error);
| Field | Type | Required | Description |
|---|---|---|---|
Account | String | Yes | The address of the account withdrawing from the AMM |
Asset | Object | Yes | The first asset to withdraw |
Asset2 | String/Object | Yes | The second asset to withdraw |
Amount | String/Object | No | Amount of the first asset to withdraw |
Amount2 | String/Object | No | Amount of the second asset to withdraw |
EPrice | String | No | The effective price for the withdrawal |
Asset/Asset2:
For XRP: "0"
For issued currency: {"currency": "USD", "issuer": "r...", "value": "0"}
Amount/Amount2:
For XRP: "1000000" (drops)
For issued currency: {"currency": "USD", "issuer": "r...", "value": "100"}
EPrice:
Optional effective price for the withdrawal
If not specified, the current AMM price is used
Removes liquidity from an AMM pool by burning LP tokens
Can withdraw one or both assets from the pool
Amount withdrawn is proportional to your LP token share
Always use autofill to set fees and sequence safely when using the XRPL client library