From 6f15c2cddeae8a6f297551fba4355ce64686a78d Mon Sep 17 00:00:00 2001 From: arealclimber Date: Fri, 20 Oct 2023 15:02:57 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=F0=9F=92=8D=20log=20in=20updateCFD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: #1299 --- package.json | 4 ++-- src/contexts/user_context.tsx | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2dcd4b22..6845c117 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "src", - "version": "0.8.0+60.2", + "version": "0.8.0+62.1", "private": true, "scripts": { "dev": "next dev", @@ -81,4 +81,4 @@ "pre-commit": "npm run test && lint-staged" } } -} \ No newline at end of file +} diff --git a/src/contexts/user_context.tsx b/src/contexts/user_context.tsx index cf64a185..4a50525f 100644 --- a/src/contexts/user_context.tsx +++ b/src/contexts/user_context.tsx @@ -1107,6 +1107,9 @@ export const UserProvider = ({children}: IUserProvider) => { const updateCFDOrder = useCallback( async (applyUpdateCFDOrder: IApplyUpdateCFDOrder | undefined): Promise => { let result: IResult; + // Deprecated: [debug] (Shirley - 20231020) + // eslint-disable-next-line no-console + console.log('updateCFDOrder', 'applyUpdateCFDOrder', applyUpdateCFDOrder); try { if (!enableServiceTermRef.current) throw new CustomError(Code.SERVICE_TERM_DISABLE); const propertiesToCheck = ['guaranteedStopFee', 'stopLoss', 'takeProfit']; @@ -1123,13 +1126,25 @@ export const UserProvider = ({children}: IUserProvider) => { if (!applyUpdateCFDOrder || !isValidFormat) throw new CustomError(Code.INVAILD_ORDER_INPUTS); const updateAppliedCFD = getCFD(applyUpdateCFDOrder.referenceId); + // Deprecated: [debug] (Shirley - 20231020) + // eslint-disable-next-line no-console + console.log('updateCFDOrder', 'updateAppliedCFD', updateAppliedCFD); + if (!updateAppliedCFD) throw new CustomError(Code.CFD_ORDER_NOT_FOUND); if (updateAppliedCFD.state !== OrderState.OPENING) throw new CustomError(Code.CFD_ORDER_IS_ALREADY_CLOSED); const typeData = transactionEngine.transferCFDOrderToTransaction(applyUpdateCFDOrder); + // Deprecated: [debug] (Shirley - 20231020) + // eslint-disable-next-line no-console + console.log('updateCFDOrder', 'typeData', typeData); + if (!typeData) throw new CustomError(Code.FAILED_TO_CREATE_TRANSACTION); // TODO: send request to chain(use Lunar?) (20230324 - tzuhan) const signature: string = await lunar.signTypedData(typeData); + // Deprecated: [debug] (Shirley - 20231020) + // eslint-disable-next-line no-console + console.log('updateCFDOrder', 'signature', signature); + /* Info: (20230505 - Julian) 需要再驗證一次簽名是否正確 */ const success = lunar.verifyTypedData(typeData, signature); // Deprecated: [debug] (20230509 - Tzuhan)