Skip to content

Commit

Permalink
fix build and types
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJuze committed Jan 19, 2024
1 parent 0d9d19b commit 2079e49
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/crypt/signOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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)
}

Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2079e49

Please sign in to comment.