mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 14:12:35 +03:00
Fix isReversedOrder
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.19.20",
|
||||
"version": "0.19.21",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -27,7 +27,6 @@ export const signOrder = async (
|
||||
usePersonalSign: boolean,
|
||||
signer: ethers.Signer,
|
||||
chainId: SupportedChainId,
|
||||
isReversedOrder = false
|
||||
) => {
|
||||
const nonce = Date.now();
|
||||
const expiration = nonce + DEFAULT_EXPIRATION;
|
||||
@@ -57,7 +56,6 @@ export const signOrder = async (
|
||||
expiration,
|
||||
buySide: side === 'BUY' ? 1 : 0,
|
||||
isPersonalSign: usePersonalSign,
|
||||
isReversedOrder
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
|
||||
@@ -182,6 +182,7 @@ class Aggregator {
|
||||
signedOrder: SignedOrder,
|
||||
isCreateInternalOrder: boolean,
|
||||
partnerId?: string,
|
||||
isReversedOrder?: boolean,
|
||||
) => {
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -189,8 +190,13 @@ class Aggregator {
|
||||
...(partnerId !== undefined) && { 'X-Partner-Id': partnerId },
|
||||
};
|
||||
|
||||
const url = new URL(`${this.apiUrl}/api/v1/order/${isCreateInternalOrder ? 'internal' : ''}`);
|
||||
|
||||
if (isReversedOrder ?? false) {
|
||||
url.searchParams.append('reversed', 'true');
|
||||
}
|
||||
return fetchWithValidation(
|
||||
`${this.apiUrl}/api/v1/order/${isCreateInternalOrder ? 'internal' : ''}`,
|
||||
url.toString(),
|
||||
z.object({
|
||||
orderId: z.string(),
|
||||
placementRequests: z.array(
|
||||
|
||||
@@ -71,7 +71,6 @@ export type Order = {
|
||||
expiration: number // uint64
|
||||
buySide: 0 | 1 // uint8, 1=buy, 0=sell
|
||||
isPersonalSign: boolean // bool
|
||||
isReversedOrder?: boolean | undefined // bool
|
||||
}
|
||||
|
||||
export type CFDOrder = {
|
||||
|
||||
Reference in New Issue
Block a user