diff --git a/package.json b/package.json index aefac436..c0e12f13 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.20.42-rc7", + "version": "0.20.42-rc6", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/crypt/signOrder.ts b/src/crypt/signOrder.ts index 04ce1580..046e6bcf 100644 --- a/src/crypt/signOrder.ts +++ b/src/crypt/signOrder.ts @@ -3,7 +3,7 @@ import { BigNumber } from 'bignumber.js'; import { ethers } from 'ethers'; import { INTERNAL_PROTOCOL_PRECISION } from '../constants'; import ORDER_TYPES from '../constants/orderTypes.js'; -import type { Order, SignedOrder, SupportedChainId } from '../types.js'; +import type { CrossOrder, Order, SignedOrder, SupportedChainId } from '../types.js'; import normalizeNumber from '../utils/normalizeNumber.js'; import getDomainData from './getDomainData.js'; import hashOrder from './hashOrder.js'; @@ -34,7 +34,7 @@ export const signOrder = async ( const isCrossChain = targetChainId === undefined || targetChainId === chainId; - const order: Order = { + const order: Order | CrossOrder = { senderAddress, matcherAddress, baseAsset: baseAssetAddr, diff --git a/src/types.ts b/src/types.ts index 304315b9..4e72128c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -50,8 +50,10 @@ export type Order = { nonce: number // uint64 expiration: number // uint64 buySide: 0 | 1 // uint8, 1=buy, 0=sell - secretHash?: string // uint64 - targetChainId?: SupportedChainId // uint64 +} +export type CrossOrder = Order & { + secretHash: string // uint64 + targetChainId: SupportedChainId // uint64 } export type LockOrder = { @@ -71,7 +73,7 @@ type SignedOrderAdditionalProps = { needWithdraw?: boolean // bool (not supported yet by smart-contract) } -export type SignedOrder = SignedOrderAdditionalProps & Order & { +export type SignedOrder = SignedOrderAdditionalProps & (Order | CrossOrder) & { id: string // hash of Order (it's not part of order structure in smart-contract) } diff --git a/tsconfig.json b/tsconfig.json index 6b2298e4..8e321136 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,7 +23,6 @@ "noUnusedParameters": true /* Raise an error when a function parameter isn't read */, "noUncheckedIndexedAccess": true, "skipLibCheck": true, /* Skip type checking all .d.ts files. */ - "exactOptionalPropertyTypes": false, /* allow ? in interfaces */ }, "ts-node": { // Tell ts-node CLI to install the --loader automatically, explained below