mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
Add new stop limit schemas
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.17.24",
|
||||
"version": "0.17.25-rc.1",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -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,13 @@ export const signCFDOrder = async (
|
||||
nonce,
|
||||
expiration,
|
||||
buySide: side === 'BUY' ? 1 : 0,
|
||||
stopPrice: stopPrice !== undefined
|
||||
? normalizeNumber(
|
||||
stopPrice,
|
||||
INTERNAL_ORION_PRECISION,
|
||||
BigNumber.ROUND_FLOOR,
|
||||
).toNumber()
|
||||
: undefined,
|
||||
isPersonalSign: usePersonalSign,
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ export const orderUpdateSchema = z.object({
|
||||
A: z.number(), // settled amount
|
||||
S: z.enum(orderStatuses), // status
|
||||
l: z.boolean().optional(), // is liquidation order
|
||||
L: z.number().optional(), // stop limit price,
|
||||
t: z.number(), // update time
|
||||
c: subOrderSchema.array(),
|
||||
})
|
||||
@@ -45,6 +46,7 @@ export const orderUpdateSchema = z.object({
|
||||
settledAmount: o.A,
|
||||
status: o.S,
|
||||
liquidated: o.l,
|
||||
stopPrice: o.L,
|
||||
subOrders: o.c.map((so) => ({
|
||||
pair: so.P,
|
||||
exchange: so.e,
|
||||
@@ -69,6 +71,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 +87,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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user