Users need to sign up to Automate before they can use it. They should be redirected to the special link https://automate.chronologic.network/?utm_source=xfai
where they will be guided through the signup and setup process. Once done, they will be directed back to XFai.
To detect if user is connected to Automate RPC, you can send a special eth_call
request:
async function isConnectedToAutomate() {
const res = await window.ethereum.request({
method: 'eth_call',
params: [
{
from: '0x0000000000000000000000000000000000000000',
// md5 hash of 'automate'
to: '0x00000000e7fdc80c0728d856260f92fde10af019',
},
],
});
return res.client === 'automate';
}
To get an estimate of how much a user can save on gas fees, call the following endpoint:
GET https://automate-api.chronologic.network/ethereum/estimateGasSavings
And the response will be:
{ "savingsPercent": 82.14 }
The endpoint compares the current network gas prices with historical gas prices from past few days to come up with the result. The result is an ideal-case scenario and actual savings might be different.
To get data on how many transactions a given address has pending and completed, as well as total savings in USD, call this endpoint:
GET https://automate-api.chronologic.network/stats/:address
(e.g. GET https://automate-api.chronologic.network/stats/0x0000000000000000000000000000000000000000
)
And the response will be:
{
"pending": 1,
"completed": 2,
"savingsUsd": 13.37
}
Automate will send updates to the XFai webhook for the following events:
- transaction scheduled
- transaction executed
Only transactions involving XFai contracts will be reported.
The events will be sent via POST
request and the data shape will be:
{
"event": "scheduled", // scheduled/executed
"email": "[email protected]",
"txHash": "0x123...",
"gasPaidUsd": 3.21,
"gasSavedUsd": 13.37
}