Merge pull request #62 from orionprotocol/OP-3615-stop-limit

OP-3615 stop limit
This commit is contained in:
Mikhail Gladchenko
2023-03-03 08:11:28 +00:00
committed by GitHub
4 changed files with 8 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.17.24",
"version": "0.17.25-rc.9",
"description": "Orion Protocol SDK",
"main": "./lib/esm/index.js",
"module": "./lib/esm/index.js",

View File

@@ -25,6 +25,7 @@ export const signCFDOrder = async (
usePersonalSign: boolean,
signer: ethers.Signer,
chainId: SupportedChainId,
stopPrice: BigNumber.Value | undefined,
) => {
const nonce = Date.now();
const expiration = nonce + DEFAULT_EXPIRATION;
@@ -51,6 +52,9 @@ export const signCFDOrder = async (
nonce,
expiration,
buySide: side === 'BUY' ? 1 : 0,
stopPrice: stopPrice !== undefined
? new BigNumber(stopPrice).toNumber()
: undefined,
isPersonalSign: usePersonalSign,
};

View File

@@ -69,6 +69,7 @@ export const fullOrderSchema = z.object({
F: z.string(), // fee asset
f: z.number(), // fee
l: z.boolean().optional(), // is liquidation order
L: z.number().optional(), // stop limit price,
o: z.boolean(), // internal only
S: z.enum(orderStatuses), // status
T: z.number(), // creation time / unix timestamp
@@ -84,6 +85,7 @@ export const fullOrderSchema = z.object({
feeAsset: o.F,
fee: o.f,
liquidated: o.l,
stopPrice: o.L,
status: o.S,
date: o.T,
clientOrdId: o.O,

View File

@@ -82,6 +82,7 @@ export type CFDOrder = {
nonce: number // uint64
expiration: number // uint64
buySide: 0 | 1 // uint8, 1=buy, 0=sell
stopPrice?: number | undefined // uint64
isPersonalSign: boolean // bool
}