Skip to content

Conversation

@TheAlonze01
Copy link

@TheAlonze01 TheAlonze01 commented Dec 20, 2025

Adds a small CLI-style example that:

  • reads config from PRIVATE_KEY, EXCHANGE_ADDRESS and CHAIN_ID,
  • creates and signs a single limit order,
  • prints the signed order JSON.

Includes an npm script:
npm run example:create-order


Note

Adds a CLI-style example (examples/create-order.ts) and npm script to create and sign a limit order from env vars and print the signed JSON.

  • Examples:
    • Add examples/create-order.ts that reads PRIVATE_KEY, EXCHANGE_ADDRESS, and CHAIN_ID, validates CHAIN_ID, creates a limit order via createLimitOrder, signs it with signOrder, and prints the signed JSON.
  • Scripts:
    • Add npm run example:create-order to execute the example.

Written by Cursor Bugbot for commit f3370ca. This will update automatically on new commits. Configure here.

@TheAlonze01 TheAlonze01 requested a review from a team as a code owner December 20, 2025 10:11
price: "0.5",
size: "1",
side: "buy",
maker: exchangeAddress,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong address used as order maker

The maker field is set to exchangeAddress, but according to the OrderData model, maker represents "the source of funds for the order" — which is the user's address derived from the private key, not the exchange contract address. The ExchangeOrderBuilder.buildOrder() method validates that the signer matches the maker address, so using the exchange contract address here would either cause signature validation to fail or produce an invalid order that cannot be executed on-chain.

Fix in Cursor Fix in Web

@@ -0,0 +1,44 @@
import "dotenv/config";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing dotenv dependency prevents example from running

The example imports dotenv/config to load environment variables, but dotenv is not listed in package.json as a dependency or devDependency. Running npm run example:create-order will fail with a "Cannot find module 'dotenv'" error because the package isn't installed.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant