Skip to main content

Integrating Router Pay into your dApp

note

You can find the API swagger here

Any dApp can integrate Router Pay to provide it's users a no sign-up UX. This can be easily done by integrating Router Pay APIs. Integration of Router Pay is a 2 step process -

  1. Generation of deposit address: API to generate a deposit address where user will send their funds to. Relayer will use the funds sent to this address to execute the transaction on behalf of the user.
  2. Check status: API to check the status of the transaction.

Generate Deposit Address

The below end point will generate the deposit address where the end user can send funds to. By default the expiry time for an address is 10 mins. Any amount sent to the address post 10 mins can be refunded back to the user in a trustless way.

Endpoint: POST /generate-deposit-address Content-Type: application/json

Request Body

ParameterTypeDescription
contractAddressOnSrcChainstringContract address on selected chain which needs to be called for execution
calldatastringCalldata for contract execution (hex)
fromTokenAddressstringThe token which user will be sending funds in
refundAddressstringAddress for potential refunds
chainIdstringChain Id on which the user will be sending funds (should be the same where the contract has to be called)
amountstringAmount to be used for executing the calldata
partnerIdnumberOPTIONAL: Partner identification number
bufferTimeInSecnumberOPTIONAL: In case a custom expiration time is needed for the generated address

Sample Request

{
"contractAddressOnSrcChain": "0x1396f41d89b96eaf29a7ef9ee01ad36e452235ae",
"calldata": "0xddddd",
"fromTokenAddress": "0xAF82969ECF299c1f1Bb5e1D12dDAcc9027431160",
"refundAddress": "0xf79D7E74304AF49748A4d77d4B64eeEE84d131cf",
"chainId": "43113",
"amount": "100000000000000023001",
"partnerId": 12,
"bufferTimeInSec": 2000
}

Check Status

The API will provide the status of the transaction for a particular deposit address.

Endpoint: GET /get-status-by-deposit-address

Query Parameters

ParameterTypeDescription
depositAddressstringThe deposit address to check the status for
chainIdnumberChain Id where deposit was made
limitnumberNumber of transactions per page
pagenumberPage number for pagination

Sample Request

GET /get-status-by-deposit-address?depositAddress=0x55E0213D2C0dFf7A42b6F2Bf05B636e2605eD990&chainId=56&limit=20&page=1

Transaction Statuses

StatusDescription
PENDINGWaiting for funds to be deposited
SUCCESSFunds deposited, relaying in progress
FAILEDSimulation failed or transaction receipt failed
NOT_FOUNDNo funds sent before address expiration
REVERTEDTransaction reverted