Skip to main content
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,
});

ModifyOrderInput fields

FieldTypeRequiredDescription
idstringYesOrder ID to modify
pricestringNoNew limit price
sizestringNoNew order size
triggerPricestringNoNew trigger price (for trigger orders)
limitPricestringNoNew limit price for trigger execution
API Reference: POST /actions