Modify existing orders in-place without cancelling and re-placing them.
The examples on this page use Hyperliquid (provider: 'hyperliquid'). Replace the provider value with any supported DEX from getProviders().
USER_AGENT mode (automatic signing)
const result = await perps.modifyOrders({
provider: 'hyperliquid',
address: userAddress,
modifications: [
{ id: '12345678', price: '94500.00', size: '0.2' },
],
});
console.log(result.results);
// [{ action: 'modifyOrder', success: true }]
USER mode (manual signing)
import { createAction, executeAction } from '@lifi/perps-sdk';
// Step 1: Build modify payloads
const { actions } = await createAction(client, {
provider: 'hyperliquid',
address: userAddress,
action: 'modifyOrder',
params: {
modifications: [
{ id: '12345678', price: '94500.00' },
],
},
});
// Step 2: Sign and submit
const signedActions = await Promise.all(
actions.map(async (a) => ({
action: a.action,
typedData: a.typedData,
signature: await walletClient.signTypedData({ ...a.typedData }),
}))
);
await executeAction(client, {
provider: 'hyperliquid',
address: userAddress,
action: 'modifyOrder',
actions: signedActions,
});
| Field | Type | Required | Description |
|---|
id | string | Yes | Order ID to modify |
price | string | No | New limit price |
size | string | No | New order size |
triggerPrice | string | No | New trigger price (for trigger orders) |
limitPrice | string | No | New limit price for trigger execution |
API Reference: POST /actions