Add CLI example for creating and signing CLOB orders#17
Add CLI example for creating and signing CLOB orders#17TheAlonze01 wants to merge 2 commits intoPolymarket:mainfrom
Conversation
| price: "0.5", | ||
| size: "1", | ||
| side: "buy", | ||
| maker: exchangeAddress, |
There was a problem hiding this comment.
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.
| @@ -0,0 +1,44 @@ | |||
| import "dotenv/config"; | |||
There was a problem hiding this comment.
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.
Adds a small CLI-style example that:
PRIVATE_KEY,EXCHANGE_ADDRESSandCHAIN_ID,Includes an npm script:
npm run example:create-orderNote
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/create-order.tsthat readsPRIVATE_KEY,EXCHANGE_ADDRESS, andCHAIN_ID, validatesCHAIN_ID, creates a limit order viacreateLimitOrder, signs it withsignOrder, and prints the signed JSON.npm run example:create-orderto execute the example.Written by Cursor Bugbot for commit f3370ca. This will update automatically on new commits. Configure here.