remove ledger signature

This commit is contained in:
TheJuze
2024-06-06 11:05:43 +03:00
parent c73a41be3f
commit d36d616f46
6 changed files with 11 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
import { ethers } from 'ethers';
import type { ethers } from 'ethers';
import CANCEL_ORDER_TYPES from '../constants/cancelOrderTypes.js';
import type { CancelOrderRequest, SignedCancelOrderRequest, SupportedChainId } from '../types.js';
import getDomainData from './getDomainData.js';
@@ -20,15 +20,9 @@ const signCancelOrder = async (
cancelOrderRequest,
);
// https://github.com/poap-xyz/poap-fun/pull/62#issue-928290265
// "Signature's v was always send as 27 or 28, but from Ledger was 0 or 1"
const fixedSignature = ethers.Signature.from(signature).serialized;
// if (!fixedSignature) throw new Error("Can't sign order cancel");
const signedCancelOrderReqeust: SignedCancelOrderRequest = {
...cancelOrderRequest,
signature: fixedSignature,
signature,
};
return signedCancelOrderReqeust;
};

View File

@@ -1,5 +1,6 @@
import { BigNumber } from 'bignumber.js';
import { ethers, keccak256 } from 'ethers';
import type { ethers } from 'ethers';
import { keccak256 } from 'ethers';
import { INTERNAL_PROTOCOL_PRECISION } from '../constants';
import { CROSS_CHAIN_ORDER_TYPES } from '../constants/orderTypes/orderTypes';
import type { Order, SignedCrossChainOrder, SupportedChainId } from '../types.js';
@@ -87,14 +88,9 @@ export const signCrossChainOrder = async ({
crossChainOrder
);
// https://github.com/poap-xyz/poap-fun/pull/62#issue-928290265
// "Signature's v was always send as 27 or 28, but from Ledger was 0 or 1"
const fixedSignature = ethers.Signature.from(signature).serialized;
// if (!fixedSignature) throw new Error("Can't sign order");
const signedOrderWithoutId: Omit<SignedCrossChainOrder, 'id'> = {
...order,
signature: fixedSignature,
signature,
secret,
secretHash,
targetChainId: Number(targetChainId),

View File

@@ -50,15 +50,9 @@ export const signLockOrder = async ({
order,
);
// https://github.com/poap-xyz/poap-fun/pull/62#issue-928290265
// "Signature's v was always send as 27 or 28, but from Ledger was 0 or 1"
const fixedSignature = ethers.Signature.from(signature).serialized;
// if (!fixedSignature) throw new Error("Can't sign order");
const signedOrder: SignedLockOrder = {
...order,
signature: fixedSignature,
signature,
secret,
secretHash
};

View File

@@ -1,5 +1,5 @@
import { BigNumber } from 'bignumber.js';
import { ethers } from 'ethers';
import type { ethers } from 'ethers';
import { INTERNAL_PROTOCOL_PRECISION, ORDER_TYPES } from '../constants';
import type { Order, SignedOrder, SupportedChainId } from '../types.js';
import normalizeNumber from '../utils/normalizeNumber.js';
@@ -70,16 +70,10 @@ export const signOrder = async ({
order,
);
// https://github.com/poap-xyz/poap-fun/pull/62#issue-928290265
// "Signature's v was always send as 27 or 28, but from Ledger was 0 or 1"
const fixedSignature = ethers.Signature.from(signature).serialized;
// if (!fixedSignature) throw new Error("Can't sign order");
const signedOrder: SignedOrder = {
...order,
id: hashOrder(order),
signature: fixedSignature,
signature,
};
return signedOrder;
};