Version: V1
Execute Trade
#
IntroductionThe SDK is designed to make things simpler and accessible. It however cannot execute trades or send transactions. With its robust functionality, the SDK calculates data required to interact with the DMM. Please note that the SDK cannot execute trades or send transactions on your behalf. Rather, it offers utility classes and functions which make it easy to calculate the data required to safely interact with DMM. You will have to construct the transaction yourself, just use the SDK to get the inputs needed.
The example below focuses exclusively on sending a transaction to the DMM router
#
Sending a Transaction to the RouterTrade 1 WETH for DAI:
Now, we have constructed the trade entity, lets now put in other parameters to send the transaction:
- minimumAmountOut is the minimum amount of DAI you receive before the trade reverts.
to
is the recipient's address.value
is the amount of ETH that must be included as themsg.value
in the transaction.