From ab4a6745d7819128915b74e8c4e5f11622ff2bab Mon Sep 17 00:00:00 2001 From: TheJuze Date: Mon, 3 Jun 2024 10:21:25 +0300 Subject: [PATCH] update sign cross-chain order types --- package-lock.json | 4 ++-- package.json | 2 +- src/constants/orderTypes/orderTypes.ts | 2 +- src/crypt/hashOrders/hashCrossChainOrder.ts | 6 +++--- src/crypt/signCrossChainOrder.ts | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5ea4c395..68984f8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@orionprotocol/sdk", - "version": "0.22.0-rc16", + "version": "0.22.0-rc19", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@orionprotocol/sdk", - "version": "0.22.0-rc16", + "version": "0.22.0-rc19", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 34eca883..f16a176f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.22.0-rc16", + "version": "0.22.0-rc19", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/constants/orderTypes/orderTypes.ts b/src/constants/orderTypes/orderTypes.ts index c265a2d9..1751c276 100644 --- a/src/constants/orderTypes/orderTypes.ts +++ b/src/constants/orderTypes/orderTypes.ts @@ -20,7 +20,7 @@ export const CROSS_CHAIN_ORDER_TYPES = { Order: ORDER_TYPE, CrossChainOrder: [ { name: 'limitOrder', type: 'Order' }, - { name: 'chainId', type: 'uint24' }, + { name: 'targetChainId', type: 'uint24' }, { name: 'secretHash', type: 'bytes32' }, { name: 'lockOrderExpiration', type: 'uint64' }, ] diff --git a/src/crypt/hashOrders/hashCrossChainOrder.ts b/src/crypt/hashOrders/hashCrossChainOrder.ts index ac074ae8..e089f087 100644 --- a/src/crypt/hashOrders/hashCrossChainOrder.ts +++ b/src/crypt/hashOrders/hashCrossChainOrder.ts @@ -4,9 +4,9 @@ import type { SupportedChainId, CrossChainOrder } from '../../types'; const ORDER_TYPEHASH = '0xb5132db62dfceb466f2f8aee7a039db36a99772e5a9771d28388a5f9baad7c54'; const CROSS_CHAIN_ORDER_TYPEHASH = - '0xc4666edeecc42a94cf6b87f39e1ca967792e6d738224365e54d7d06ec632b05c'; + '0xb0edab98a08b4f5ce4f349d7cb1622bde999112acf1ac4a30cc9f394bd7809a6'; -export function getOrderHash(order: CrossChainOrder, chainId: SupportedChainId) { +export function getOrderHash(order: CrossChainOrder, targetChainId: SupportedChainId) { const abiCoder = ethers.AbiCoder.defaultAbiCoder(); // Generate the orderParamsHash @@ -48,7 +48,7 @@ export function getOrderHash(order: CrossChainOrder, chainId: SupportedChainId) [ CROSS_CHAIN_ORDER_TYPEHASH, limitOrderHash, - Number(chainId), + Number(targetChainId), order.secretHash, order.lockOrderExpiration, ] diff --git a/src/crypt/signCrossChainOrder.ts b/src/crypt/signCrossChainOrder.ts index e4a98249..8d65d4ca 100644 --- a/src/crypt/signCrossChainOrder.ts +++ b/src/crypt/signCrossChainOrder.ts @@ -24,7 +24,7 @@ export type SignCrossChainOrderProps = { serviceFeeAssetAddress: string signer: ethers.Signer chainId: SupportedChainId - targetChainId?: SupportedChainId + targetChainId: SupportedChainId } export const signCrossChainOrder = async ({ @@ -76,7 +76,7 @@ export const signCrossChainOrder = async ({ const crossChainOrder = { limitOrder: order, - chainId: Number(targetChainId), + targetChainId: Number(targetChainId), secretHash, lockOrderExpiration } @@ -100,7 +100,7 @@ export const signCrossChainOrder = async ({ targetChainId: Number(targetChainId), lockOrderExpiration } - const orderHash = getOrderHash(signedOrderWithoutId, chainId); + const orderHash = getOrderHash(signedOrderWithoutId, targetChainId); const signedCrossChainOrder: SignedCrossChainOrder = { ...signedOrderWithoutId,