update lockOrder types

This commit is contained in:
TheJuze
2024-01-23 17:21:43 +03:00
parent a2cdadfa09
commit 74b2e44432
3 changed files with 12 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.42-rc9",
"version": "0.20.42-rc10",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -4,6 +4,9 @@ import ORDER_TYPES from '../constants/orderTypes.js';
import type { LockOrder, SignedLockOrder, SupportedChainId } from '../types.js';
import getDomainData from './getDomainData.js';
import generateSecret from '../utils/generateSecret';
import { BigNumber } from 'bignumber.js';
import normalizeNumber from '../utils/normalizeNumber';
import { INTERNAL_PROTOCOL_PRECISION } from '../constants';
const DEFAULT_EXPIRATION = 29 * 24 * 60 * 60 * 1000; // 29 days
@@ -13,7 +16,7 @@ export type LockOrderProps = {
userAddress: string // адрес юзера который хочет сделать лок
senderAddress: string // broker
asset: string
amount: ethers.BigNumberish
amount: BigNumber.Value
signer: ethers.Signer
chainId: SupportedChainId
targetChainId: SupportedChainId
@@ -38,7 +41,11 @@ export const signLockOrder = async ({
sender: senderAddress,
expiration,
asset,
amount,
amount: Number(normalizeNumber(
amount,
INTERNAL_PROTOCOL_PRECISION,
BigNumber.ROUND_FLOOR,
)),
targetChainId,
secretHash,
};

View File

@@ -5,7 +5,6 @@ import type subOrderStatuses from './constants/subOrderStatuses.js';
import type positionStatuses from './constants/positionStatuses.js';
import type { knownEnvs } from './config/schemas';
import type getHistory from './Orion/bridge/getHistory.js';
import type { ethers } from 'ethers';
import type { networkCodes } from './constants';
export type DeepPartial<T> = T extends object ? {
@@ -59,9 +58,9 @@ export type CrossOrder = Order & {
export type LockOrder = {
user: string // address // адрес юзера который хочет сделать лок
sender: string // address // broker
expiration: ethers.BigNumberish // uint64
expiration: number // uint64
asset: string // address(?)
amount: ethers.BigNumberish // uint64
amount: number // uint64
targetChainId: SupportedChainId // uint64
secretHash: string // uint64
}