Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ibc withdraw method #284

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
12 changes: 12 additions & 0 deletions filepathSlugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3090,6 +3090,7 @@
"response-success-6",
"withdraw-qrc-20-coins-with-gas-limit",
"withdraw-tendermint-coins-with-a-memo-and-custom-gas-fee",
"withdraw-tendermint-ibc-coins",
"error-responses",
"invalid-request-unknown-fee-type",
"invalid-request-wrong-parameter-type",
Expand Down Expand Up @@ -3880,6 +3881,17 @@
"src/pages/komodo-wallet/desktop/view-your-wallet-address/index.mdx": [
"viewing-your-wallet-address-in-komodo-wallet-desktop"
],
"src/pages/komodo-wallet/guides/how-to-find-the-right-ibc-channel-for-transfers/index.mdx": [
"how-to-find-the-right-ibc-channel-for-transfers-on-komodo-wallet",
"understanding-ibc-channels",
"sources-to-find-the-ibc-channel-information",
"example-transferring-from-iris-to-osmosis",
"verifying-transfers",
"staying-updated"
],
"src/pages/komodo-wallet/guides/index.mdx": [
"komodo-wallet-general-guides"
],
"src/pages/komodo-wallet/index.mdx": [
"komodo-wallet-guides"
],
Expand Down
3,778 changes: 3,163 additions & 615 deletions postman/collections/komodo_defi.postman_collection.json

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/data/sidebar.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@
"titleLink": "/komodo-wallet/",
"links": []
},
{
"title": "User Guides (Web)",
"links": [
{
"title": "Introduction",
"href": "/komodo-wallet/guides/"
},
{
"title": "Finding IBC Channels for Transfers",
"href": "/komodo-wallet/guides/how-to-find-the-right-ibc-channel-for-transfers/"
}
]
},
{
"title": "User Guides (Mobile)",
"links": [
Expand Down
Binary file added src/images/api-images/ibc-channels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 79 additions & 9 deletions src/pages/komodo-defi-framework/api/v20/withdraw/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ This method generates a raw transaction which should then be broadcast using [se

## Arguments

| Structure | Type | Description |
| --------- | ---------------- | ---------------------------------------------------------------------------------------------------------- |
| coin | string | The name of the coin the user desires to withdraw |
| to | string | Coins are withdrawn to this address |
| amount | string (numeric) | The amount the user desires to withdraw, ignored when `max=true` |
| memo | string | Optional. Adds a transaction memo for compatible coins (e.g. Tendermint ecosystem). |
| max | bool | Withdraw the maximum available amount |
| fee | object | A standard [FeeInfo](/komodo-defi-framework/api/v20/#fee-info) object. |
| from | object | HD wallets only. A standard [WithdrawFromInfo](/komodo-defi-framework/api/v20/#withdraw-from-info) object. |
| Structure | Type | Description |
| -------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| coin | string | The name of the coin the user desires to withdraw. |
| to | string | Coins are withdrawn to this address. |
| amount | string (numeric) | The amount the user desires to withdraw, ignored when `max=true`. |
| memo | string | Optional. Adds a transaction memo for compatible coins (e.g. Tendermint ecosystem). |
| max | bool | Optional. Withdraw the maximum available amount. |
| fee | object | Optional. A standard [FeeInfo](/komodo-defi-framework/api/v20/#fee-info) object. |
| from | object | HD wallets only. A standard [WithdrawFromInfo](/komodo-defi-framework/api/v20/#withdraw-from-info) object. |
| ibc\_source\_channel | string | Optional, [IBC](https://tutorials.cosmos.network/academy/3-ibc/1-what-is-ibc.html) coins only. The source channel for the IBC transaction. This is only required if the \['chain\_registry\_name`value](https://github.com/KomodoPlatform/coins/blob/14bfd0ab59118ea1048eaaffba14f3270b2ab17b/coins#L14654) is not present in your`coins\` file. |

### Response

Expand Down Expand Up @@ -561,6 +562,75 @@ This method generates a raw transaction which should then be broadcast using [se
You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6)
</CollapsibleSection>

##### Withdraw Tendermint IBC coins

Using the Cosmos [Ecosystem IBC protocol](https://everstake.one/blog/cosmos-ibc-breaking-down-the-walls-between-blockchains), you can withdraw coins from one chain to another. This example shows a withdrawal from Cosmos to Osmosis.

<CodeGroup title="Withdraw" tag="POST" label="withdraw" mm2MethodDecorate="true">
```json
{
"mmrpc": "2.0",
"userpass": "RPC_UserP@SSW0RD",
"method": "withdraw",
"params": {
"coin": "ATOM",
"to": "osmo16drqvl3u8sukfsu4lm3qsk28jr3fahjac4rdw4",
"amount": 0.1,
"memo": "In the blackest of your moments, wait with no fear.",
"ibc_source_channel": "channel-141",
"fee": {
"type": "CosmosGas",
"gas_price": 0.05,
"gas_limit": 150000
}
},
"id": 0
}
```
</CodeGroup>

<Note>
Though the `ibc_source_channel` is optional, the default may not always be functional. It is recommended to provide the source channel where possible.
For more information, see our guide to [finding the right IBC channel](/komodo-wallet/guides/how-to-find-the-right-ibc-channel-for-transfers/).
</Note>

<CollapsibleSection expandedText="Hide Response" collapsedText="Show Response">
```json
{
"mmrpc": "2.0",
"result": {
"tx_hex": "0af9010abc010a292f6962632e6170706c69636174696f6e732e7472616e736665722e76312e4d73675472616e73666572128e010a087472616e73666572120b6368616e6e656c2d3134311a0f0a057561746f6d1206313030303030222d636f736d6f733136647271766c33753873756b667375346c6d3371736b32386a72336661686a617377736163382a2b6f736d6f3136647271766c33753873756b667375346c6d3371736b32386a72336661686a6163347264773438a6c5b9a089f29efa171233496e2074686520626c61636b657374206f6620796f7572206d6f6d656e74732c20776169742077697468206e6f20666561722e188df8c70a12680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801180b12140a0e0a057561746f6d1205313733353910e0c65b1a40042c4fa45d77405ee94e737a000b146f5019137d5a2d3275849c9ad66dd8ef1d0f087fb584f34b1ebcf7989e41bc0675e96c83f0eec4ffe355e078b6615d7a72",
"tx_hash": "06174E488B7BBC35180E841F2D170327BB7DE0A291CA69050D81F82A7CF103CB",
"from": [
"cosmos16drqvl3u8sukfsu4lm3qsk28jr3fahjaswsac8"
],
"to": [
"osmo16drqvl3u8sukfsu4lm3qsk28jr3fahjac4rdw4"
],
"total_amount": "0.1173590000000000",
"spent_by_me": "0.1173590000000000",
"received_by_me": "0",
"my_balance_change": "-0.1173590000000000",
"block_height": 0,
"timestamp": 0,
"fee_details": {
"type": "Tendermint",
"coin": "ATOM",
"amount": "0.017359",
"gas_limit": 1500000
},
"coin": "ATOM",
"internal_id": "06174e488b7bbc35180e841f2d170327bb7de0a291ca69050d81f82a7cf103cb",
"transaction_type": "TendermintIBCTransfer",
"memo": "In the blackest of your moments, wait with no fear."
},
"id": null
}
```

You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6)
</CollapsibleSection>

### Error Responses

#### InvalidRequest: Unknown fee type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ The token's contract **must** have `approve` and `transferFrom` methods. Additio
* Protocol `"type"` field: `"ETH"` or `"ERC20"`
* Protocol `"protocol_data"` field (ERC20 only): `"platform"` - `"ETH"`, `"ETC"` or other Ethereum forks. `"contract_address"` - ERC20 token [checksummed](https://coincodex.com/article/2078/ethereum-address-checksum-explained/) smart contract address.

| Parameter | Type | Description |
| ----------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| chain\_id | integer | To find the EVM chain ID, see [Chainlist](https://chainlist.org/) |
| Parameter | Type | Description |
| ----------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| chain\_id | integer | To find the EVM chain ID, see [Chainlist](https://chainlist.org/) |
| gas\_limit | object | Optional, required for tokens only. Defines more precise gas prices for swap or transaction operations. Some tokens are called over proxy contracts which often require more gas, though users may be able to choose higher/lower values than the default where required. See the `Gas Limit Options` table below for more information. |
| protocol.type | string | Platform / protocol - e.g `ETH` for Ethereum, `ERC20` for ERC20 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/) |
| protocol.type | string | Platform / protocol - e.g `ETH` for Ethereum, `ERC20` for ERC20 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/) |

### Gas Limit Options

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
export const title = "How to find the right IBC channel for transfers on Komodo Wallet";
export const description = "This guide describes how to activate coins in Komodo Wallet.";

import ibcChannels from "@/public/images/docs/api-images/ibc-channels.png";

# How to find the right IBC channel for transfers on Komodo Wallet

This guide will help you find the correct IBC channel for making transfers using Komodo Wallet.

<Note type="warning">
IBC transfer is an advanced feature. Due to the possibility of expired clients
or network changes, users should approach IBC transfers carefully and ensure
they are using the most up-to-date channels.
</Note>

## Understanding IBC Channels

### Sources to Find the IBC Channel information

* [https://ibc.iobscan.io/relayers](https://ibc.iobscan.io/relayers)
* [https://www.mintscan.io/cosmos/relayers?sector=networks](https://www.mintscan.io/cosmos/relayers?sector=networks)

### Example: Transferring from IRIS to OSMOSIS

<OptimizedImage title="IBC channel information" src={ibcChannels} classNaming="w-full" alt="IBC channel information" />

1. In Komodo Wallet, select IRIS and open the withdraw form.
2. Enter the amount and an OSMOSIS address as the destination.
3. Toggle on the "Set IBC channel" option.
4. Set the `ibc_source_channel` value to `channel-3` (the channel for IRIS in the above image alongside OSMOSIS).
5. Send your funds.

<Note type="info">
Channel IDs are specific to each chain pair and direction. The channel for
sending from Chain A to Chain B may be different from the channel for sending
from Chain B to Chain A.
</Note>

## Verifying Transfers

After initiating a transfer:

1. Note the transaction hash provided by Komodo Wallet.
2. Use a block explorer for either the sending or receiving chain to track the transaction status.
3. Allow some time for the transfer to complete, as IBC transfers may take longer than on-chain transactions.

## Staying Updated

* Regularly check for updates to the Komodo Wallet application.
* Join official [Komodo community channels](https://komodoplatform.com/discord) to stay informed about any changes to IBC functionality or recommended practices.

By following these steps, you can ensure you're using the correct IBC channel for your transfers on Komodo Wallet, minimizing the risk of failed transactions or lost funds.

To see the API method used behind the scenes for IBC transfers, refer to the [withdraw (v2)](/komodo-defi-framework/api/v20/withdraw/) method.
9 changes: 9 additions & 0 deletions src/pages/komodo-wallet/guides/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const title = "Komodo Wallet General Guides";
export const description =
"This section contains tutorials to perform various tasks in the Komodo Wallet apps.";

# Komodo Wallet General Guides

This section contains tutorials to perform various tasks in the Komodo Wallet apps.

<TocForIndex />
1 change: 1 addition & 0 deletions src/pages/komodo-wallet/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export const description = "This section of the documentation contains end user

This section of the documentation contains end user guides for the Komodo Wallet on all platforms:

* (General)\[/komodo-wallet/guides/]
* (Mobile)\[/komodo-wallet/mobile/]
* (Desktop)\[/komodo-wallet/desktop/]
Loading