Repository: OneKeyHQ/app-monorepo
Pull request #6872: Fix/add 1inch fusion provider
Author: login: ezailWang
Created: 2025-03-13T07:57:08Z | Merged: 2025-03-13T08:29:52Z



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - Integrated support for an additional order type, enhancing the swap transaction signing process.
  - Improved transaction history with updated order ID retrieval for clearer transaction details.

- **Chores**
  - Updated API endpoint configurations for more flexible URL handling.
  - Modified swap service settings in the test environment.

These updates enhance overall swap service efficiency and flexibility.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/packages/kit/src/views/Swap/hooks/useSwapBuiltTx.ts b/packages/kit/src/views/Swap/hooks/useSwapBuiltTx.ts
index 09cc542abbb0..dc773f488f72 100644
--- a/packages/kit/src/views/Swap/hooks/useSwapBuiltTx.ts
+++ b/packages/kit/src/views/Swap/hooks/useSwapBuiltTx.ts
@@ -38,6 +38,7 @@ import { swapApproveResetValue } from '@onekeyhq/shared/types/swap/SwapProvider.
 import type {
   IFetchLimitOrderRes,
   IFetchQuoteResult,
+  IOneInchOrderStruct,
   ISwapToken,
   ISwapTxInfo,
 } from '@onekeyhq/shared/types/swap/types';
@@ -432,21 +433,29 @@ export function useSwapBuildTx() {
           selectQuoteRes.swapShouldSignedData &&
           swapFromAddressInfo.accountInfo?.account?.id
         ) {
-          const { unSignedInfo, unSignedMessage, unSignedData } =
-            selectQuoteRes.swapShouldSignedData;
-          const unSignedOrder: {
-            sellTokenBalance: string;
-            buyTokenBalance: string;
-            validTo: number;
-            appData: string;
-            receiver: string;
-            buyAmount: string;
-            sellAmount: string;
-            partiallyFillable: boolean;
-          } =
+          const {
+            unSignedInfo,
+            unSignedMessage,
+            unSignedData,
+            oneInchFusionOrder,
+          } = selectQuoteRes.swapShouldSignedData;
+          if (
+            (unSignedMessage || unSignedData) &&
             // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
-            selectQuoteRes.quoteResultCtx?.cowSwapUnSignedOrder;
-          if ((unSignedMessage || unSignedData) && unSignedOrder) {
+            selectQuoteRes.quoteResultCtx?.cowSwapUnSignedOrder
+          ) {
+            const unSignedOrder: {
+              sellTokenBalance: string;
+              buyTokenBalance: string;
+              validTo: number;
+              appData: string;
+              receiver: string;
+              buyAmount: string;
+              sellAmount: string;
+              partiallyFillable: boolean;
+            } =
+              // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+              selectQuoteRes.quoteResultCtx?.cowSwapUnSignedOrder;
             unSignedOrder.receiver = swapToAddressInfo.address;
             let dataMessage = unSignedMessage;
             if (!dataMessage && unSignedData) {
@@ -617,6 +626,93 @@ export function useSwapBuildTx() {
                 };
               }
             }
+          } else if (oneInchFusionOrder) {
+            const { makerAddress, typedData } = oneInchFusionOrder;
+            const onInchFusionOrderInfo: {
+              orderStruct: IOneInchOrderStruct;
+              extension: string;
+              quoteId: string;
+              signature?: string;
+              orderHash: string;
+              // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+            } = selectQuoteRes.quoteResultCtx?.oneInchFusionOrderCtx;
+            if (makerAddress && typedData && onInchFusionOrderInfo) {
+              const swapInfo: ISwapTxInfo = {
+                protocol: selectQuoteRes.protocol ?? EProtocolOfExchange.SWAP,
+                sender: {
+                  amount: onInchFusionOrderInfo.orderStruct.makingAmount,
+                  token: fromToken,
+                  accountInfo: {
+                    accountId: swapFromAddressInfo.accountInfo?.account?.id,
+                    networkId: fromToken.networkId,
+                  },
+                },
+                receiver: {
+                  amount: onInchFusionOrderInfo.orderStruct.takingAmount,
+                  token: toToken,
+                  accountInfo: {
+                    accountId: swapToAddressInfo.accountInfo?.account?.id,
+                    networkId: toToken.networkId,
+                  },
+                },
+                accountAddress: swapFromAddressInfo.address,
+                receivingAddress: swapToAddressInfo.address,
+                swapBuildResData: {
+                  result: {
+                    ...selectQuoteRes,
+                  },
+                },
+              };
+              const dataMessage = JSON.stringify(typedData);
+              const signHash = await new Promise<string>((resolve, reject) => {
+                if (
+                  dataMessage &&
+                  swapFromAddressInfo.address &&
+                  swapFromAddressInfo.networkId
+                ) {
+                  navigationToMessageConfirm({
+                    accountId:
+                      swapFromAddressInfo.accountInfo?.account?.id ?? '',
+                    networkId: swapFromAddressInfo.networkId,
+                    swapInfo,
+                    unsignedMessage: {
+                      type:
+                        unSignedInfo.signedType ??
+                        EMessageTypesEth.TYPED_DATA_V4,
+                      message: dataMessage,
+                      payload: [makerAddress.toLowerCase(), dataMessage],
+                    },
+                    walletInternalSign: true,
+                    onSuccess: (result: string) => {
+                      resolve(result);
+                    },
+                    onFail: (error: Error) => {
+                      reject(error);
+                    },
+                    onCancel: () => {
+                      reject(new Error('user cancel'));
+                    },
+                  });
+                } else {
+                  reject(
+                    new Error(
+                      `missing data: dataMessage: ${
+                        dataMessage ?? ''
+                      }, address: ${
+                        swapFromAddressInfo.address ?? ''
+                      }, networkId: ${swapFromAddressInfo.networkId ?? ''}`,
+                    ),
+                  );
+                }
+              });
+              if (signHash) {
+                // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+                selectQuoteRes.quoteResultCtx.oneInchFusionOrderCtx = {
+                  ...onInchFusionOrderInfo,
+                  signature: signHash,
+                };
+              }
+            }
           }
         }
         const checkRes = await checkOtherFee(selectQuoteRes);
@@ -715,7 +811,12 @@ export function useSwapBuildTx() {
               encodedTx = res.tx as string;
             }
             // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
-          } else if (res?.ctx.cowSwapOrderId) {
+          } else if (
+            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+            res?.ctx.cowSwapOrderId ||
+            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+            res?.ctx.oneInchFusionOrderHash
+          ) {
             skipSendTransAction = true;
             void Toast.success({
               title: intl.formatMessage({
diff --git a/packages/kit/src/views/Swap/hooks/useSwapTxHistory.ts b/packages/kit/src/views/Swap/hooks/useSwapTxHistory.ts
index b6942a64034c..59574b2e91c2 100644
--- a/packages/kit/src/views/Swap/hooks/useSwapTxHistory.ts
+++ b/packages/kit/src/views/Swap/hooks/useSwapTxHistory.ts
@@ -41,6 +41,12 @@ export function useSwapTxHistoryActions() {
         (swapTxInfo.protocol === EProtocolOfExchange.SWAP ||
           swapTxInfo.swapBuildResData.result.isWrapped)
       ) {
+        const useOrderId = Boolean(
+          // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+          swapTxInfo.swapBuildResData.ctx?.cowSwapOrderId ||
+            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+            swapTxInfo.swapBuildResData.ctx?.oneInchFusionOrderHash,
+        );
         const swapHistoryItem: ISwapTxHistory = {
           status: ESwapTxHistoryStatus.PENDING,
           currency: settingsAtom.currencyInfo?.symbol,
@@ -68,14 +74,15 @@ export function useSwapTxHistoryActions() {
           },
           txInfo: {
             txId,
-            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
-            useOrderId: !!swapTxInfo.swapBuildResData.ctx?.cowSwapOrderId,
+            useOrderId,
             gasFeeFiatValue,
             gasFeeInNative,
             orderId:
               swapTxInfo.swapBuildResData.swftOrder?.orderId ??
               // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
-              swapTxInfo.swapBuildResData.ctx?.cowSwapOrderId,
+              swapTxInfo.swapBuildResData.ctx?.cowSwapOrderId ??
+              // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+              swapTxInfo.swapBuildResData.ctx?.oneInchFusionOrderHash,
             sender: swapTxInfo.accountAddress,
             receiver: swapTxInfo.receivingAddress,
           },
diff --git a/packages/shared/types/swap/types.ts b/packages/shared/types/swap/types.ts
index 2bd2efba0a51..35d89f11ed05 100644
--- a/packages/shared/types/swap/types.ts
+++ b/packages/shared/types/swap/types.ts
@@ -293,6 +293,45 @@ export interface IFetchLimitMarketPrice {
   price: string;
 }
 
+export interface IEIP712TypedData {
+  types: IEIP712Types;
+  domain: IEIP712Object;
+  message: IEIP712Object;
+  primaryType: string;
+}
+export interface IEIP712Types {
+  [key: string]: IEIP712Parameter[];
+}
+export interface IEIP712Parameter {
+  name: string;
+  type: string;
+}
+export declare type IEIP712ObjectValue =
+  | string
+  | bigint
+  | number
+  | IEIP712Object;
+export interface IEIP712Object {
+  [key: string]: IEIP712ObjectValue;
+}
+export type IEIP712DomainType = {
+  name: string;
+  version: string;
+  chainId: number;
+  verifyingContract: string;
+};
+
+export type IOneInchOrderStruct = {
+  salt: string;
+  maker: string;
+  receiver: string;
+  makerAsset: string;
+  takerAsset: string;
+  makingAmount: string;
+  takingAmount: string;
+  makerTraits: string;
+};
+
 export interface IFetchQuoteResult {
   quoteId?: string;
   eventId?: string;
@@ -344,6 +383,10 @@ export interface IFetchQuoteResult {
       scope: string;
       signedType: EMessageTypesEth;
     };
+    oneInchFusionOrder?: {
+      makerAddress: string;
+      typedData: IEIP712TypedData;
+    };
   };
   protocolNoRouterInfo?: string;
   supportUrl?: string;


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 4**

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: ASSERTIVE**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 33c968612fad2fc3952a81ed76e7c8bb1c702d0c and 50b436ecdf6400943a6dc62268a76e39251cca82.

</details>

<details>
<summary>📒 Files selected for processing (5)</summary>

* `packages/kit/src/views/Swap/hooks/useSwapBuiltTx.ts` (4 hunks)
* `packages/kit/src/views/Swap/hooks/useSwapTxHistory.ts` (2 hunks)
* `packages/shared/src/appApiClient/appApiClient.ts` (1 hunks)
* `packages/shared/src/config/endpointsMap.ts` (1 hunks)
* `packages/shared/types/swap/types.ts` (2 hunks)

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (3)</summary>

* GitHub Check: lint (20.x)
* GitHub Check: unittest (20.x)
* GitHub Check: Analyze (javascript-typescript)

</details>

<details>
<summary>🔇 Additional comments (3)</summary><blockquote>

<details>
<summary>packages/shared/types/swap/types.ts (3)</summary>

`296-322`: **Well-structured EIP-712 type definitions**

These interfaces implement the EIP-712 standard for typed structured data signing in Ethereum. The type hierarchy is clear and follows TypeScript best practices.

---

`324-334`: **Clear 1inch Fusion order structure**

The `IOneInchOrderStruct` type properly defines all required fields for 1inch Fusion orders. The field names are descriptive and follow the expected structure needed for this order type.

---

`386-389`: **Good integration of 1inch Fusion order support**

The addition to `IFetchQuoteResult` properly extends the interface to support 1inch Fusion orders. This matches the PR objective to add 1inch Fusion provider support.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-13T08:02:23Z
user: login: originalix
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-13T08:29:29Z
user: login: weatherstar
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-13T08:29:50Z

Review comments:
diff_hunk: @@ -40,9 +40,9 @@ const getBasicClient = async ({
   if (!endpoint || !name) {
     throw new OneKeyError('Invalid endpoint name.');
   }
-  if (!endpoint.startsWith('https://')) {
-    throw new OneKeyError('Invalid endpoint, https only');
-  }
+  // if (!endpoint.startsWith('https://')) {
+  //   throw new OneKeyError('Invalid endpoint, https only');
+  // }
path: packages/shared/src/appApiClient/appApiClient.ts
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Removing HTTPS validation can harm security.**

You removed the HTTPS check. This can expose users to man-in-the-middle attacks if used outside a test environment. Consider restoring or limiting it to dev environments.



```diff
-  // if (!endpoint.startsWith('https://')) {
-  //   throw new OneKeyError('Invalid endpoint, https only');
-  // }
+  if (!platformEnv.isDev && !endpoint.startsWith('https://')) {
+    throw new OneKeyError('Non-HTTPS endpoint is not allowed in production.');
+  }
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  if (!platformEnv.isDev && !endpoint.startsWith('https://')) {
    throw new OneKeyError('Non-HTTPS endpoint is not allowed in production.');
  }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T08:02:22Z
author_association: CONTRIBUTOR
diff_hunk: @@ -14,10 +14,7 @@ export const endpointsMap: Record<IEndpointEnv, IServiceEndpoint> = {
       serviceName: EServiceEndpointEnum.Wallet,
       env: 'test',
     }),
-    swap: buildServiceEndpoint({
-      serviceName: EServiceEndpointEnum.Swap,
-      env: 'test',
-    }),
+    swap: 'http://192.168.5.193:7001',
path: packages/shared/src/config/endpointsMap.ts
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**Use caution with non-HTTPS test endpoints.**

Hardcoding an HTTP address, even for testing, can cause confusion if accidentally carried to production. Mark it clearly as a test-only endpoint.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T08:02:22Z
author_association: CONTRIBUTOR
diff_hunk: @@ -41,6 +41,12 @@ export function useSwapTxHistoryActions() {
         (swapTxInfo.protocol === EProtocolOfExchange.SWAP ||
           swapTxInfo.swapBuildResData.result.isWrapped)
       ) {
+        const useOrderId = Boolean(
+          // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+          swapTxInfo.swapBuildResData.ctx?.cowSwapOrderId ||
+            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+            swapTxInfo.swapBuildResData.ctx?.oneInchFusionOrderHash,
+        );
path: packages/kit/src/views/Swap/hooks/useSwapTxHistory.ts
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**Rely on typed properties instead of disabling ESLint.**

You use `@typescript-eslint/no-unsafe-member-access` directives. Prefer strong typing to avoid these rules. This ensures safer and more transparent code.




Also applies to: 83-85

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T08:02:22Z
author_association: CONTRIBUTOR
diff_hunk: @@ -617,6 +626,93 @@ export function useSwapBuildTx() {
                 };
               }
             }
+          } else if (oneInchFusionOrder) {
+            const { makerAddress, typedData } = oneInchFusionOrder;
+            const onInchFusionOrderInfo: {
+              orderStruct: IOneInchOrderStruct;
+              extension: string;
+              quoteId: string;
+              signature?: string;
+              orderHash: string;
+              // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+            } = selectQuoteRes.quoteResultCtx?.oneInchFusionOrderCtx;
+            if (makerAddress && typedData && onInchFusionOrderInfo) {
+              const swapInfo: ISwapTxInfo = {
+                protocol: selectQuoteRes.protocol ?? EProtocolOfExchange.SWAP,
+                sender: {
+                  amount: onInchFusionOrderInfo.orderStruct.makingAmount,
+                  token: fromToken,
+                  accountInfo: {
+                    accountId: swapFromAddressInfo.accountInfo?.account?.id,
+                    networkId: fromToken.networkId,
+                  },
+                },
+                receiver: {
+                  amount: onInchFusionOrderInfo.orderStruct.takingAmount,
+                  token: toToken,
+                  accountInfo: {
+                    accountId: swapToAddressInfo.accountInfo?.account?.id,
+                    networkId: toToken.networkId,
+                  },
+                },
+                accountAddress: swapFromAddressInfo.address,
+                receivingAddress: swapToAddressInfo.address,
+                swapBuildResData: {
+                  result: {
+                    ...selectQuoteRes,
+                  },
+                },
+              };
+              const dataMessage = JSON.stringify(typedData);
+              const signHash = await new Promise<string>((resolve, reject) => {
+                if (
+                  dataMessage &&
+                  swapFromAddressInfo.address &&
+                  swapFromAddressInfo.networkId
+                ) {
+                  navigationToMessageConfirm({
+                    accountId:
+                      swapFromAddressInfo.accountInfo?.account?.id ?? '',
+                    networkId: swapFromAddressInfo.networkId,
+                    swapInfo,
+                    unsignedMessage: {
+                      type:
+                        unSignedInfo.signedType ??
+                        EMessageTypesEth.TYPED_DATA_V4,
+                      message: dataMessage,
+                      payload: [makerAddress.toLowerCase(), dataMessage],
+                    },
+                    walletInternalSign: true,
+                    onSuccess: (result: string) => {
+                      resolve(result);
+                    },
+                    onFail: (error: Error) => {
+                      reject(error);
+                    },
+                    onCancel: () => {
+                      reject(new Error('user cancel'));
+                    },
+                  });
+                } else {
+                  reject(
+                    new Error(
+                      `missing data: dataMessage: ${
+                        dataMessage ?? ''
+                      }, address: ${
+                        swapFromAddressInfo.address ?? ''
+                      }, networkId: ${swapFromAddressInfo.networkId ?? ''}`,
+                    ),
+                  );
+                }
+              });
+              if (signHash) {
+                // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+                selectQuoteRes.quoteResultCtx.oneInchFusionOrderCtx = {
+                  ...onInchFusionOrderInfo,
+                  signature: signHash,
+                };
+              }
+            }
path: packages/kit/src/views/Swap/hooks/useSwapBuiltTx.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Refactor duplicated typed-data signing blocks.**

The oneInchFusion flow duplicates much of the cowSwap logic. Extract a shared helper for typed-data signing to simplify and reduce future errors.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T08:02:22Z
author_association: CONTRIBUTOR

PR comments:
user: login: codesandbox[bot]
created_at: 2025-03-13T07:57:12Z
body: #### Review or Edit in CodeSandbox

Open the branch in <a href="https://codesandbox.io/p/github/OneKeyHQ/app-monorepo/fix/add-1inch-fusion-provider?mode=review&utm_source=gh_app">Web Editor</a> &bull; <a href="https://codesandbox.io/p/vscode?owner=OneKeyHQ&repo=app-monorepo&branch=fix/add-1inch-fusion-provider&utm_source=gh_app">VS Code</a> &bull; <a href="https://codesandbox.io/p/vscode?owner=OneKeyHQ&repo=app-monorepo&branch=fix/add-1inch-fusion-provider&insiders=true&utm_source=gh_app">Insiders</a><br>
Open <a href="https://codesandbox.io/p/devtool/preview/OneKeyHQ/app-monorepo/fix/add-1inch-fusion-provider?task=preview&port=51423&redirect=true&utm_source=gh_app">Preview</a>

<!-- open-in-codesandbox:complete -->

author_association: NONE
user: login: coderabbitai[bot]
created_at: 2025-03-13T07:57:16Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough
This update adds support for a new order type in the swap transaction processes. The swap hooks now check for a new `oneInchFusionOrder` and process it by constructing the swap info and signing the order similarly to the existing flow. The order history generation now picks the order ID from either the cowSwap order or one-inch fusion order. In addition, endpoint configuration changes remove HTTPS validation from the basic client and set a specific test endpoint URL. New EIP-712 related types and an order structure are introduced to support these updates.

## Changes

| File(s) | Change Summary |
|---------|----------------|
| `packages/kit/src/views/Swap/hooks/useSwapBuiltTx.ts`<br>`packages/kit/src/views/Swap/hooks/useSwapTxHistory.ts` | Updated swap hooks to add support for a new `oneInchFusionOrder`. Modified extraction, signing, and history tracking logic for the new order type. |
| `packages/shared/src/appApiClient/appApiClient.ts`<br>`packages/shared/src/config/endpointsMap.ts` | Removed HTTPS endpoint validation and replaced the swap endpoint configuration for the test environment with a direct URL assignment. |
| `packages/shared/src/types/swap/types.ts` | Added multiple EIP-712 interfaces/types and the new `IOneInchOrderStruct` type. Updated the quote result interface to include the new one-inch fusion order details. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant U as useSwapBuiltTx
    participant O as Order Data
    participant S as Signer
    participant C as Quote Result Context

    U->>O: Extract unsigned order details
    alt oneInchFusionOrder exists
        O-->>U: Provide oneInchFusionOrder (makerAddress, typedData)
        U->>S: Sign the oneInchFusionOrder typedData
        S-->>U: Return signHash
        U->>C: Update context with oneInchFusionOrder signature
    else Standard order
        U->>S: Sign standard order data
        S-->>U: Return signHash
        U->>C: Update context with standard order signature
    end
```

<!-- walkthrough_end -->

<!-- announcements_start -->

> [!TIP]
> <details>
> <summary>⚡🧪 Multi-step agentic review comment chat (experimental)</summary>
> 
> - We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
> 						- To enable this feature, set early_access to true under in the settings.
> 
> </details>

<!-- announcements_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEejqANiS4AxeAA8A9Glr0AjPAwNYkAGbZEeHwsXnw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FrzoEIEYQF96JCQHzL4qxNyDzXz75zQ9z4KKCfynCXCkdxIzzA0Utp80sbyIK7zoLHzr425vMFUzSkKzQ9yKLus250KejokAA1IxXw6ZQCoNS8/C0CxfcC2EYimBUijcy/LcqUHc5Cj88KVC78o8yI6JAC3C4CmfSCn4efQSmClzMi4MKi98mzSExijIGYrYjAeYnCi8tSkC2fMC9S6Be84SyExCvSrMAy79ByVycElMcyoC7iqy1S/i1S+yqAbIImEmGS6wcMOU3ABUjGZUrGHERSiyq86yvi2yxfe8/DcmC8PU4Ig0+yI0/ySIAAfi4AAG8u4mTGokIuALCpwABuL/Eg9SLgQylQpqtABqgAXwfMzQQUMAMHmDl2WTQDwDWDKxJkQ12C4EOE3zOFYSuDGGUFuCmAeFmAGtqFAPUAAH0IhEAtq1swQ6AtqRFPzHhBredRcBAAAWQXJIUQWgXwJIK68XNnG6tAJIWgBgJIDIDIVINANIO6wXDnXnNwA8NAFIT/M6jaw8ba3a/akgUEJ1WgLa+oGYPQIAA== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=OneKeyHQ/app-monorepo&utm_content=6872):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` or `Summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR