Safle Swaps
Last updated
Safle enables decentralised swaps via the in house built swaps SDK. The SDK exposes set of functionalities required to execute a swap. Currently 1inch DEX is integrated on safle swaps.
The SDK has a modular architecture where a dedicated controller for each DEX can be plugged in with just a few lines of code
dex
- The name of DEX using which you want to swap tokens.
rpcURL
- The rpc url to connect to a blockchain node.
chain
- The chain name of the blockchain. Supported for now - ethereum
User selects chain, wallet, source token, destination token and source token amount
Get Supported Tokens: This method returns list of tokens supported on the dex to be populated.
Get Exchange Rates: This method returns exchange rates for a token pair
Exchange rates, estimated slippage and estimated gas fees is displayed to user
Get Estimated Gas: This method returns estimated gas for the swap transaction
User confirms exchange rates
Get Raw Transaction: This method returns the raw transaction
User continues to sign transaction. Enters vault pin to proceed
Application calls vault method to sign raw transaction and enters pin
Returns the signed transaction string
chain
- The chain for which the transaction is to be signed.
rawTx
- The raw transaction object to be signed
pin
- The pin to access the vault's private functions.
Signed transaction broadcasted by client application