Skip to content

Commit

Permalink
Merge pull request #284 from KomodoPlatform/add/ibc_withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
gcharang authored Nov 17, 2024
2 parents 18f702b + 6e404b7 commit 55af7bb
Show file tree
Hide file tree
Showing 8 changed files with 2,072 additions and 295 deletions.
12 changes: 12 additions & 0 deletions filepathSlugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3142,6 +3142,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 @@ -3925,6 +3926,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
2,185 changes: 1,902 additions & 283 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 (General)",
"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.
87 changes: 78 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 | Tendermint IBC transfers only. The source channel for the [IBC](https://tutorials.cosmos.network/academy/3-ibc/1-what-is-ibc.html) transaction. |

### Response

Expand Down Expand Up @@ -561,6 +562,74 @@ 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>
The `ibc_source_channel` value above is for demonstration only. For more information regarding how to set a valid value, 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
@@ -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 />
7 changes: 4 additions & 3 deletions src/pages/komodo-wallet/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ 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:

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

0 comments on commit 55af7bb

Please sign in to comment.