The 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
Trade 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.
tois the recipient's address.
valueis the amount of ETH that must be included as the
msg.valuein the transaction.