Swap tokens
Line 1: | Line 1: | ||
− | '''swap tokens''' is a command that allows you to swap | + | '''swap tokens''' is a command that allows you to swap one token for another using a decentralized exchange. |
− | + | This command is beneficial for users who wish to exchange one type of token for another via protocols like Uniswap, PancakeSwap, etc. | |
== Parameters == | == Parameters == | ||
+ | |||
+ | '''Exchange:''' The decentralized exchange where the tokens will be swapped. | ||
− | ''' | + | '''Token In ID''': The token you wish to exchange/sell. |
− | '''Token | + | '''Token Out ID''': The token you wish to get/buy. |
− | ''' | + | '''Amount:''' The quantity of the 'Token In ID' you wish to swap. |
− | + | '''Transaction Info Variable:''' (Advanced, Optional) This variable is used to retrieve the transaction information after the execution. The default value for this variable is '#txinfo'. | |
− | + | ||
− | '''Transaction Info Variable:''' ( | + | |
== Example == | == Example == | ||
+ | |||
<pre> | <pre> | ||
− | swap tokens("PancakeSwap", " | + | config defi wallet("your private key") |
− | + | swap tokens("PancakeSwap","BTC","ETH","0.01","#txOutput") | |
+ | log object(#txOutput) | ||
</pre> | </pre> | ||
− | + | Please replace "your private key" with your actual DeFi wallet's private key. | |
+ | |||
+ | Be mindful when you are handling your private key. It's a sensitive piece of data that allows full control over your funds in your DeFi wallet. Therefore, never share this key publicly or with anyone. | ||
+ | |||
+ | This code snippet would swap 0.01 BTC for ETH on PancakeSwap and log the transaction details. | ||
− | + | Note: Always ensure you have enough balance and correct token ID before moving forward with the swap, because once the transaction is confirmed, it cannot be reversed. Also, consider blockchain network fees while estimating your transaction. |
Revision as of 20:03, 4 July 2023
swap tokens is a command that allows you to swap one token for another using a decentralized exchange.
This command is beneficial for users who wish to exchange one type of token for another via protocols like Uniswap, PancakeSwap, etc.
Parameters
Exchange: The decentralized exchange where the tokens will be swapped.
Token In ID: The token you wish to exchange/sell.
Token Out ID: The token you wish to get/buy.
Amount: The quantity of the 'Token In ID' you wish to swap.
Transaction Info Variable: (Advanced, Optional) This variable is used to retrieve the transaction information after the execution. The default value for this variable is '#txinfo'.
Example
config defi wallet("your private key") swap tokens("PancakeSwap","BTC","ETH","0.01","#txOutput") log object(#txOutput)
Please replace "your private key" with your actual DeFi wallet's private key.
Be mindful when you are handling your private key. It's a sensitive piece of data that allows full control over your funds in your DeFi wallet. Therefore, never share this key publicly or with anyone.
This code snippet would swap 0.01 BTC for ETH on PancakeSwap and log the transaction details.
Note: Always ensure you have enough balance and correct token ID before moving forward with the swap, because once the transaction is confirmed, it cannot be reversed. Also, consider blockchain network fees while estimating your transaction.