Fill Order

This function fills an order with a specified amount using the Limit Order SDK.

Example:

import { uint256 } from "starknet";
import { LimitOrder, fillOrderResponse } from "../../src";

async function fillOrder(
    order_hash: string,
    fill_amount?: string
  ): Promise<fillOrderResponse> {
    const limitOrder = new LimitOrder()
    
    const response: fillOrderResponse = await limitOrder.fillOrder(order_hash, fill_amount);
    
    return response;
}
const fill_amount = uint256.bnToUint256(1000000000000000000);
fillOrder("order_hash", fill_amount.toString());

Parameters:

Parameter
Type
Description

order_hash

string

The hash of the order that you want to fill.

fill_amount

string

(Optional) The amount of the order to fill, specified as a string. If not provided and the order allows partial fills, the entire order will be filled. If not provided and the order does not allow partial fills, the function will throw an error. If provided, the specified amount will be filled. If the order allows partial fills and fill_amount is provided, it must be less than or equal to the maker_amount. If the order does not allow partial fills and fill_amount is provided, it must be zero or equal to the maker_amount.

Response:

Property
Type
Description

status

string

Status of the response.

code

number

Status code of the response.

data

string[]

An array of strings, each representing a piece of calldata necessary for the order's execution. Calldata typically includes encoded information required for the transaction, such as function signatures and parameters in a format that smart contracts or trading systems can interpret.

Last updated