Skip to content

Commit

Permalink
add error responses for 1inch methods
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 committed Dec 15, 2024
1 parent 61e009e commit eddd0df
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,38 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen
}
```
</CollapsibleSection>


<CollapsibleSection expandedText="Hide Error Responses" collapsedText="Show Error Responses">

#### 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
}
```

</CollapsibleSection>
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,24 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen
}
```
</CollapsibleSection>


<CollapsibleSection expandedText="Hide Error Responses" collapsedText="Show Error Responses">

#### 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
}
```

</CollapsibleSection>
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,45 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen
}
```
</CollapsibleSection>


<CollapsibleSection expandedText="Hide Error Responses" collapsedText="Show Error Responses">

#### 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
}
```
</CollapsibleSection>
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,45 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen
}
```
</CollapsibleSection>


<CollapsibleSection expandedText="Hide Error Responses" collapsedText="Show Error Responses">

#### 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
}
```
</CollapsibleSection>
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,45 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen
}
```
</CollapsibleSection>


<CollapsibleSection expandedText="Hide Error Responses" collapsedText="Show Error Responses">

#### 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
}
```
</CollapsibleSection>
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,5 @@ Refer to the [1inch Classic Swap documentation](https://portal.1inch.dev/documen
}
```
</CollapsibleSection>


0 comments on commit eddd0df

Please sign in to comment.