fix build and types

This commit is contained in:
TheJuze
2024-01-19 12:35:58 +03:00
parent 0d9d19b116
commit 2079e49a04
4 changed files with 8 additions and 7 deletions

View File

@@ -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,

View File

@@ -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)
}