You can now get quotes from input and output directions
You can get quotes from input and output directions. You use the same interface to execute the quote but we have an optional parameter now which allows you to pass in a different direction.
/**
* Generate trade - this will return amount but you still need to send the transaction
* if you want it to be executed on the blockchain
* @param amount The amount you want to swap formatted. Aka if you want to swap 1 AAVE you pass in 1
* @param direction The direction you want to get the quote from
*/
async trade(amount: string, direction: TradeDirection = TradeDirection.input): Promise<TradeContext>
This will generate all the same stuff it did before but it have properties like maximumSent defined instead of minAmountConvertQuote. The transaction would all of been built for you as a different output direction takes you down a different contract call. So all in all it should be very easy to quote both ways now without any changes to the interface!
Package has been deployed in 2.3.0 👍