Skip to content

Commit

Permalink
add logger
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJuze committed Jan 23, 2024
1 parent 009f4f9 commit a5ab496
Show file tree
Hide file tree
Showing 4 changed files with 335 additions and 330 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.20.42-rc11",
"version": "0.20.42-rc12",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",
Expand Down
8 changes: 7 additions & 1 deletion src/crypt/signLockOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type LockOrderProps = {
signer: ethers.Signer
chainId: SupportedChainId
targetChainId: SupportedChainId
logger?: (message: string) => void
}

export const signLockOrder = async ({
Expand All @@ -29,7 +30,8 @@ export const signLockOrder = async ({
chainId,
targetChainId,
asset,
signer
signer,
logger
}: LockOrderProps) => {
const nonce = Date.now();
const expiration = nonce + DEFAULT_EXPIRATION;
Expand All @@ -49,19 +51,23 @@ export const signLockOrder = async ({
targetChainId,
secretHash,
};
logger?.('❌ test1');

// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const typedDataSigner = signer as SignerWithTypedDataSign;
logger?.('❌ test2');

const signature = await typedDataSigner.signTypedData(
getDomainData(chainId),
ORDER_TYPES,
order,
);
logger?.('❌ test3');

// 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;
logger?.('❌ test4');

// if (!fixedSignature) throw new Error("Can't sign order");

Expand Down
Loading

0 comments on commit a5ab496

Please sign in to comment.