"@predictdotfun/sdk": "^1.0.0"
).yarn add @predictdotfun/sdk ethers
npm install @predictdotfun/sdk ethers
OrderBuilder
class for more in-depth details on each function.ConditionalTokens
) and ERC-20 (USDB
). This can be achieved by sending a transaction to the respective contracts (see the How to interface with contracts section) and approving both the CTF_EXCHANGE
and the NEG_RISK_CTF_EXCHANGE
or via the SDK utils.Constants.ts
file or in the Deployed Contracts documentation.
OrderBuilder
: Instantiate the OrderBuilder
class by calling OrderBuilder.make
.predictAccount
address, which is also known as the deposit address.getLimitOrderAmounts
to calculate order amounts.buildOrder
to generate a LIMIT
strategy order.feeRateBps
via the GET /markets
endpoint on the REST APIsigner
and maker
to the predictAccount
address, NOT the signer/privy wallet address.buildTypedData
to generate typed data for the order.SignedOrder
object by calling signTypedDataOrder
.buildTypedDataHash
.
LIMIT
strategy buy order:OrderBuilder
: Instantiate the OrderBuilder
class by calling OrderBuilder.make
.getLimitOrderAmounts
to calculate order amounts.buildOrder
to generate a LIMIT
strategy order.feeRateBps
via the GET /markets
endpoint on the REST APIbuildTypedData
to generate typed data for the order.SignedOrder
object by calling signTypedDataOrder
.buildTypedDataHash
.
MARKET
sell order:OrderBuilder
: Instantiate the OrderBuilder
class by calling OrderBuilder.make
.getMarketOrderAmounts
to calculate order amounts.buildOrder
to generate a MARKET
strategy order.feeRateBps
via the GET /markets
endpoint on the REST APIbuildTypedData
to create typed data for the order.SignedOrder
object by calling signTypedDataOrder
.buildTypedDataHash
.
GET /orders
.isNegRisk
: Separate orders based on the isNegRisk
property.isNegRisk
).