Skip to content

Commit

Permalink
update sign cross-chain order types
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJuze committed Jun 3, 2024
1 parent 517f127 commit ab4a674
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.22.0-rc16",
"version": "0.22.0-rc19",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/constants/orderTypes/orderTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
]
Expand Down
6 changes: 3 additions & 3 deletions src/crypt/hashOrders/hashCrossChainOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -48,7 +48,7 @@ export function getOrderHash(order: CrossChainOrder, chainId: SupportedChainId)
[
CROSS_CHAIN_ORDER_TYPEHASH,
limitOrderHash,
Number(chainId),
Number(targetChainId),
order.secretHash,
order.lockOrderExpiration,
]
Expand Down
6 changes: 3 additions & 3 deletions src/crypt/signCrossChainOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type SignCrossChainOrderProps = {
serviceFeeAssetAddress: string
signer: ethers.Signer
chainId: SupportedChainId
targetChainId?: SupportedChainId
targetChainId: SupportedChainId
}

export const signCrossChainOrder = async ({
Expand Down Expand Up @@ -76,7 +76,7 @@ export const signCrossChainOrder = async ({

const crossChainOrder = {
limitOrder: order,
chainId: Number(targetChainId),
targetChainId: Number(targetChainId),
secretHash,
lockOrderExpiration
}
Expand All @@ -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,
Expand Down

0 comments on commit ab4a674

Please sign in to comment.