External Usage

How to use the SIO Router outside the extension.

To use the SIO Router for a transaction outside the extension, whether it is a swap/multi-swap or a send/multi-send, you need to call the contract's fallback function with the appropriate arguments. These arguments can be generated using JavaScript with the ethers.js library by calling the solidityPacked function with the following parameters:

  • uint8

This argument represents the length of the transaction array.

and foreach transaction:

  • address

This argument represents the token if it's a swap, or the receiver if it's a send.

  • uint256

This argument represents the amount—how much ETH to buy a token / how many coins to sell a token / how much ETH to send to a receiver.

  • uint8

This argument represents the transaction type.

Types: 0 = BUY, 1 = SELL, 2 = SEND

Transaction Data Example:

0x01d29da236dd4aac627346e1bba06a619e8c22d7c50000000000000000000000000000000000000000000000000de0b6b3a764000000

(1 transaction of type BUY)

0x02Ab8483F64d9C6d1EcF9b849Ae677dD3315835cb20000000000000000000000000000000000000000000000000de0b6b3a76400000278731D3Ca6b7E34aC0F824c42a7cC18A495cabaB0000000000000000000000000000000000000000000000000de0b6b3a764000002

(2 transactions of type SEND)

Last updated