Sign Message

This function signs a message, typically an order, using the Limit Order SDK.

Example:

import { LimitOrder, Order, signMessageResponse } from "../../src";import { mockOrder } from "./mockData";

export const mockOrder :Order = {
    signer: "YOUR_WALLET_ADDRESS",
    maker_asset: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
    taker_asset: "0x03e85bfbb8e2a42b7bead9e88e9a1b19dbccf661471061807292120462396ec9",
    maker_amount: 1000000000000000000,
    taker_amount: 1000000000000000000,
    order_price:  5000000000000000000000,
    expiration:convertDateToUnixTimestamp({ days: 1 }),
    use_solver: false,
    partial_fill: true,
  };

async function signMessage(
  order: Order
): Promise<signMessageResponse> {
  const limitOrder = new LimitOrder();
  
  const signedMessage: signMessageResponse = await limitOrder.signMessage(
    order
  );
 
  return signedMessage;
}


signMessage(mockOrder);

Order:

Response:

export const types = {
  StarkNetDomain: [
    { name: "name", type: "felt" },
    { name: "version", type: "felt" },
    { name: "chainId", type: "felt" },
  ],
  Order: [
    { name: "signer", type: "ContractAddress" },
    { name: "makerAsset", type: "ContractAddress" },
    { name: "takerAsset", type: "ContractAddress" },
    { name: "makerAmount", type: "u256" },
    { name: "takerAmount", type: "u256" },
    { name: "orderPrice", type: "u256" },
    { name: "useSolver", type: "bool" },
    { name: "partialFill", type: "bool" },
    { name: "expiration", type: "u64" },
    { name: "nonce", type: "u64" },
  ],
  u256: [
    { name: "low", type: "felt" },
    { name: "high", type: "felt" },
  ],
};

Last updated