update signOrder types

This commit is contained in:
TheJuze
2024-05-28 18:30:05 +03:00
parent 7cbf81eb77
commit ef5ef4f97e
4 changed files with 10 additions and 7 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@orionprotocol/sdk",
"version": "0.22.0-rc2",
"version": "0.22.0-rc3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@orionprotocol/sdk",
"version": "0.22.0-rc2",
"version": "0.22.0-rc3",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {

View File

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

View File

@@ -1,5 +1,5 @@
const ORDER_TYPES = {
Order: [
CrossChainOrder: [
{ name: 'limitOrder', type: 'bytes32' },
{ name: 'chainId', type: 'uint24' },
{ name: 'secretHash', type: 'bytes32' },

View File

@@ -99,7 +99,7 @@ export const signOrder = async ({
const crossChainOrder = {
limitOrder: limitOrderHash,
chainId,
chainId: Number(chainId),
secretHash,
lockOrderExpiration: expiration
}
@@ -114,7 +114,10 @@ export const signOrder = async ({
const signature = await signer.signTypedData(
getDomainData(chainId),
ORDER_TYPES,
crossChainOrder,
{
order,
...crossChainOrder,
}
);
// https://github.com/poap-xyz/poap-fun/pull/62#issue-928290265
@@ -128,7 +131,7 @@ export const signOrder = async ({
...order,
id: limitOrderHash, // TODO: change to orderHash
signature: fixedSignature,
...(isCrossChain ? { secret, secretHash, targetChainId } : {})
...(isCrossChain ? { secret, secretHash, targetChainId: Number(targetChainId) } : {})
};
return signedOrder;
};