From eddd0dfa422d052fecd553a0f3e9f787e6e1cdd0 Mon Sep 17 00:00:00 2001 From: smk762 Date: Sun, 15 Dec 2024 17:04:35 +0800 Subject: [PATCH] add error responses for 1inch methods --- .../api/v20-dev/approve_token/index.mdx | 35 ++++++++++++++++ .../api/v20-dev/get_token_allowance/index.mdx | 21 ++++++++++ .../index.mdx | 42 +++++++++++++++++++ .../index.mdx | 42 +++++++++++++++++++ .../index.mdx | 42 +++++++++++++++++++ .../index.mdx | 2 + 6 files changed, 184 insertions(+) diff --git a/src/pages/komodo-defi-framework/api/v20-dev/approve_token/index.mdx b/src/pages/komodo-defi-framework/api/v20-dev/approve_token/index.mdx index 6f90c808..2c092707 100644 --- a/src/pages/komodo-defi-framework/api/v20-dev/approve_token/index.mdx +++ b/src/pages/komodo-defi-framework/api/v20-dev/approve_token/index.mdx @@ -52,3 +52,38 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen } ``` + + + + +#### Error: Token config not activated + +```json +{ + "mmrpc": "2.0", + "error": "No such coin USDT-ERC20", + "error_path": "tokens", + "error_trace": "tokens:171]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "USDT-ERC20" + }, + "id": null +} +``` + +#### Error: Insufficient funds + +```json +{ + "mmrpc": "2.0", + "error": "Transaction error mm2src/coins/eth.rs:4834] eth:4720] Transport(\"request MethodCall(MethodCall { jsonrpc: Some(V2), method: \\\"eth_estimateGas\\\", params: Array([Object({\\\"from\\\": String(\\\"0x083c32b38e8050473f6999e22f670d1404235592\\\"), \\\"to\\\": String(\\\"0xd6df932a45c0f255f85145f286ea0b292b21c90b\\\"), \\\"gasPrice\\\": String(\\\"0x6fc23a56a\\\"), \\\"value\\\": String(\\\"0x0\\\"), \\\"data\\\": String(\\\"0x095ea7b3000000000000000000000000083c32b38e8050473f6999e22f670d14042355920000000000000000000000000000000000000000000000001111d67bb1bb0000\\\")})]), id: Num(1) }) failed: Invalid response: Server: 'https://electrum3.cipig.net:18755/', error: RPC error: Error { code: ServerError(-32000), message: \\\"insufficient funds for transfer\\\", data: None }\")", + "error_path": "tokens", + "error_trace": "tokens:161]", + "error_type": "TransactionError", + "error_data": "mm2src/coins/eth.rs:4834] eth:4720] Transport(\"request MethodCall(MethodCall { jsonrpc: Some(V2), method: \\\"eth_estimateGas\\\", params: Array([Object({\\\"from\\\": String(\\\"0x083c32b38e8050473f6999e22f670d1404235592\\\"), \\\"to\\\": String(\\\"0xd6df932a45c0f255f85145f286ea0b292b21c90b\\\"), \\\"gasPrice\\\": String(\\\"0x6fc23a56a\\\"), \\\"value\\\": String(\\\"0x0\\\"), \\\"data\\\": String(\\\"0x095ea7b3000000000000000000000000083c32b38e8050473f6999e22f670d14042355920000000000000000000000000000000000000000000000001111d67bb1bb0000\\\")})]), id: Num(1) }) failed: Invalid response: Server: 'https://electrum3.cipig.net:18755/', error: RPC error: Error { code: ServerError(-32000), message: \\\"insufficient funds for transfer\\\", data: None }\")", + "id": null +} +``` + + \ No newline at end of file diff --git a/src/pages/komodo-defi-framework/api/v20-dev/get_token_allowance/index.mdx b/src/pages/komodo-defi-framework/api/v20-dev/get_token_allowance/index.mdx index 8944209c..651a9c80 100644 --- a/src/pages/komodo-defi-framework/api/v20-dev/get_token_allowance/index.mdx +++ b/src/pages/komodo-defi-framework/api/v20-dev/get_token_allowance/index.mdx @@ -50,3 +50,24 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen } ``` + + + + +#### Error: Token config not activated + +```json +{ + "mmrpc": "2.0", + "error": "No such coin USDT-ERC20", + "error_path": "tokens", + "error_trace": "tokens:171]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "USDT-ERC20" + }, + "id": null +} +``` + + \ No newline at end of file diff --git a/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_create/index.mdx b/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_create/index.mdx index 3329d189..ac6789dc 100644 --- a/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_create/index.mdx +++ b/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_create/index.mdx @@ -167,3 +167,45 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen } ``` + + + + +#### Error: Configuration missing + +The `1inch_api` url not set in your [MM2.json file](/komodo-defi-framework/setup/configure-mm2-json/). + +```json +{ + "mmrpc": "2.0", + "error": "No API config param", + "error_path": "rpcs.client", + "error_trace": "rpcs:137] client:105]", + "error_type": "InvalidParam", + "error_data": "No API config param", + "id": null +} +``` + +#### Error: Authentication failure + +`ONE_INCH_API_TEST_AUTH` environment variable not set, or incorrect. + +```json +{ + "mmrpc": "2.0", + "error": "1inch API error: General API error: Unauthorized description: ", + "error_path": "rpcs.client", + "error_trace": "rpcs:140] client:152]", + "error_type": "OneInchError", + "error_data": { + "GeneralApiError": { + "error_msg": "Unauthorized", + "description": "", + "status_code": 401 + } + }, + "id": null +} +``` + \ No newline at end of file diff --git a/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_liquidity_sources/index.mdx b/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_liquidity_sources/index.mdx index 593196ee..b53f79a6 100644 --- a/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_liquidity_sources/index.mdx +++ b/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_liquidity_sources/index.mdx @@ -76,3 +76,45 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen } ``` + + + + +#### Error: Configuration missing + +The `1inch_api` url not set in your [MM2.json file](/komodo-defi-framework/setup/configure-mm2-json/). + +```json +{ + "mmrpc": "2.0", + "error": "No API config param", + "error_path": "rpcs.client", + "error_trace": "rpcs:137] client:105]", + "error_type": "InvalidParam", + "error_data": "No API config param", + "id": null +} +``` + +#### Error: Authentication failure + +`ONE_INCH_API_TEST_AUTH` environment variable not set, or incorrect. + +```json +{ + "mmrpc": "2.0", + "error": "1inch API error: General API error: Unauthorized description: ", + "error_path": "rpcs.client", + "error_trace": "rpcs:140] client:152]", + "error_type": "OneInchError", + "error_data": { + "GeneralApiError": { + "error_msg": "Unauthorized", + "description": "", + "status_code": 401 + } + }, + "id": null +} +``` + \ No newline at end of file diff --git a/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_quote/index.mdx b/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_quote/index.mdx index b84f7cac..bf3e7b65 100644 --- a/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_quote/index.mdx +++ b/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_quote/index.mdx @@ -148,3 +148,45 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen } ``` + + + + +#### Error: Configuration missing + +The `1inch_api` url not set in your [MM2.json file](/komodo-defi-framework/setup/configure-mm2-json/). + +```json +{ + "mmrpc": "2.0", + "error": "No API config param", + "error_path": "rpcs.client", + "error_trace": "rpcs:137] client:105]", + "error_type": "InvalidParam", + "error_data": "No API config param", + "id": null +} +``` + +#### Error: Authentication failure + +`ONE_INCH_API_TEST_AUTH` environment variable not set, or incorrect. + +```json +{ + "mmrpc": "2.0", + "error": "1inch API error: General API error: Unauthorized description: ", + "error_path": "rpcs.client", + "error_trace": "rpcs:140] client:152]", + "error_type": "OneInchError", + "error_data": { + "GeneralApiError": { + "error_msg": "Unauthorized", + "description": "", + "status_code": 401 + } + }, + "id": null +} +``` + \ No newline at end of file diff --git a/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_tokens/index.mdx b/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_tokens/index.mdx index bba057ef..7d4a7c0e 100644 --- a/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_tokens/index.mdx +++ b/src/pages/komodo-defi-framework/api/v20-dev/one_inch_v6_0_classic_swap_tokens/index.mdx @@ -110,3 +110,5 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen } ``` + +