Closed DimitarNestorov closed 3 years ago
Hey, thanks for raising this! This is something I will get round to supporting soon but it's a bit further down the list at the moment.. once supported il comment back on here with the version number.
Hey this has now been added to the sdk. 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 :+1:
Let me know if you bump into any issues! Closing as it should be resolved.
Currently the trade function only supports specifying the FROM token amount.