Skip to content

Commit

Permalink
Merge 6edacf9 into d853672
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 authored Nov 20, 2024
2 parents d853672 + 6edacf9 commit e6a064b
Show file tree
Hide file tree
Showing 8 changed files with 723 additions and 174 deletions.
47 changes: 30 additions & 17 deletions filepathSlugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2856,14 +2856,6 @@
"stop-eth-fee-estimator",
"response"
],
"src/pages/komodo-defi-framework/api/v20/get_current_mtp/index.mdx": [
"get-current-mtp",
"arguments",
"response",
"examples",
"command",
"response-success"
],
"src/pages/komodo-defi-framework/api/v20/get_enabled_coins/index.mdx": [
"get-enabled-coins",
"parameters",
Expand Down Expand Up @@ -3034,15 +3026,6 @@
"command",
"response-2"
],
"src/pages/komodo-defi-framework/api/v20/peer_connection_healthcheck/index.mdx": [
"peer-connection-healthcheck",
"arguments",
"response",
"examples",
"command",
"response-peer-found",
"response-peer-not-found"
],
"src/pages/komodo-defi-framework/api/v20/recreate_swap_data/index.mdx": [
"recreate-swap-data",
"arguments",
Expand Down Expand Up @@ -3154,6 +3137,36 @@
"response-success",
"response-error-stats-collection-not-running"
],
"src/pages/komodo-defi-framework/api/v20/utils/get_current_mtp/index.mdx": [
"get-current-mtp",
"arguments",
"response",
"examples",
"command",
"response-success"
],
"src/pages/komodo-defi-framework/api/v20/utils/get_token_info/index.mdx": [
"get-token-info",
"arguments",
"response",
"examples",
"get-token-info-on-avalanche",
"response-success",
"error-responses",
"invalid-request-protocol-parent-coin-not-active"
],
"src/pages/komodo-defi-framework/api/v20/utils/index.mdx": [
"v2-utility-methods"
],
"src/pages/komodo-defi-framework/api/v20/utils/peer_connection_healthcheck/index.mdx": [
"peer-connection-healthcheck",
"arguments",
"response",
"examples",
"command",
"response-peer-found",
"response-peer-not-found"
],
"src/pages/komodo-defi-framework/api/v20/withdraw/index.mdx": [
"withdraw",
"arguments",
Expand Down
481 changes: 453 additions & 28 deletions postman/collections/komodo_defi.postman_collection.json

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions src/data/sidebar.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,21 @@
{
"title": "Utility",
"links": [
{
"title": "Overview",
"href": "/komodo-defi-framework/api/v20/utils/"
},
{
"title": "peer_connection_healthcheck",
"href": "/komodo-defi-framework/api/v20/peer_connection_healthcheck/"
"href": "/komodo-defi-framework/api/v20/utils/peer_connection_healthcheck/"
},
{
"title": "get_current_mtp",
"href": "/komodo-defi-framework/api/v20/get_current_mtp/"
"href": "/komodo-defi-framework/api/v20/utils/get_current_mtp/"
},
{
"title": "get_token_info",
"href": "/komodo-defi-framework/api/v20/utils/get_token_info/"
}
]
}
Expand Down
260 changes: 133 additions & 127 deletions src/pages/komodo-defi-framework/api/index.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
export const title = "Komodo DeFi Framework Method: Get Token Info";
export const description = "The `get_token_info` method returns the ticker and decimals values (required for activation) given a platform and contract as input.";

# get\_token\_info

The `get_token_info` method returns the ticker and decimals values (required for activation) given a platform and contract as input.
The platform parent coin (e.g. ETH, AVAX, MATIC etc) must be activated before using this method. After requesting the token info, you will be able to activate the custom token.

<Note>
Custom tokens will be `wallet_only` - i.e. you can send and recieve tokens, but will not be able to do atomic swaps.
To apply for a formal listing of the custom token, please [review the requirements](/komodo-defi-framework/tutorials/listing-a-new-coin/) in our "coins" github repository, and get in our with our team on the [KomodoPlatform Discord](https://komodoplatform.com/discord).
</Note>

## Arguments

| Structure | Type | Description |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| protocol.type | string | Token type - e.g `ERC20` for tokens on the Ethereum network |
| protocol.protocol\_data | object | Required for tokens only. |
| protocol.protocol\_data.platform | string | The parent coin of the token's platform - e.g `MATIC` for PLG20 tokens |
| protocol.protocol\_data.contract\_address | string | **Must be mixed case** The identifying hex string for the token's contract. Can be found on sites like [EthScan](https://etherscan.io/), [BscScan](https://bscscan.com/) & [PolygonScan](https://polygonscan.com/) |

### Response

| Structure | Type | Description |
| ------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type | string | Token type - e.g `PLG20` for tokens on the Polygon network |
| info.symbol | string | The ticker of the token linked to the contract address and network requested |
| info.decimals | integer | Defines the number of digits after the decimal point that should be used to display the orderbook amounts, balance, and the value of inputs to be used in the case of order creation or a `withdraw` transaction. The default value used for a UTXO type coin (Bitcoin Protocol) is `8` and the default value used for a ERC20 Token is `18`. It is **very important** for this value to be set correctly. For example, if this value was set as `9` for BTC, a command to withdraw `1 BTC` tries to withdraw `10^9` satoshis of Bitcoin, i.e., `10 BTC` |

### 📌 Examples

#### Get Token Info on Avalanche

<CodeGroup title="Get Token Info" tag="POST" label="get_token_info" mm2MethodDecorate="true">
```json
{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "get_token_info",
"params": {
"protocol": {
"type": "ERC20",
"protocol_data": {
"platform": "AVAX",
"contract_address": "0x4f3c5C53279536fFcfe8bCafb78E612E933D53c6"
}
}
}
}
```
</CodeGroup>

<CollapsibleSection expandedText="Hide Response" collapsedText="Show Response">
#### Response (success)

```json
{
"mmrpc": "2.0",
"result": {
"type": "ERC20",
"info": {
"symbol": "PNIC",
"decimals": 18
}
},
"id": null
}
```
</CollapsibleSection>

### Error Responses

#### InvalidRequest: Protocol parent coin not active

```json
{
"mmrpc": "2.0",
"error": "No such coin AVAX",
"error_path": "tokens.lp_coins",
"error_trace": "tokens:68] lp_coins:4744]",
"error_type": "NoSuchCoin",
"error_data": {
"coin": "AVAX"
},
"id": null
}
```
9 changes: 9 additions & 0 deletions src/pages/komodo-defi-framework/api/v20/utils/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const title = "Komodo DeFi Framework Method: v2 Utilities";
export const description =
"This section includes utility methods for the Komodo DeFi Framework.";

# v2 Utility Methods

* [get\_current\_mtp](/komodo-defi-framework/api/v20/utils/get_current_mtp/)
* [get\_token\_info](/komodo-defi-framework/api/v20/utils/get_token_info/)
* [peer\_connection\_healthcheck](/komodo-defi-framework/api/v20/utils/peer_connection_healthcheck/)

0 comments on commit e6a064b

Please sign in to comment.