The endpoint provides an API for client to request to get fund from the faucet contract.
npm install
npm run build
npm run serve
npm run dev
Note: The faucet contract is supported to be deployed to multiple chains.
The contract address which manages the fund on the EVM-compatible blockchain is an environment variable created in the following format:
FAUCET_CONTRACT_ADDRESS_{chain_id}={address}
chain_id
: The ID of the chain in decimal (eg. Ethereum ID = 1, ..). See https://chainlist.org/.address
: The address of the contract on the chain.
It could be defined in the .env
file.
The contract owner's address is an environment variable created in the following format:
FAUCET_CONTRACT_OWNER_PRIVATE_KEY_{chain_id}={address}
chain_id
: The ID of the chain in decimal (eg. Ethereum ID = 1, ..). See https://chainlist.org/.address
: The address of the owner of the contract on the chain.
It could be defined in the .env
file.
The contract ABI is stored in src/app/data/contract-abi.json
.
The list of supported chain RPCs is stored in src/app/data/supported-chains.json
with the following format:
{
"{chain_id}": {
"rpc": "{rpc_url}"
},
...
}
There is only an API provided:
POST /claim
Body params:
chainId
: The ID of the chain in decimal (eg. Ethereum ID = 1, ..). See https://chainlist.org/.address
: The address where the faucet should send the fund to.
<Contract> <Owner>
\ /
+----------+
Client ---(request Claim API)---> | Endpoint |---(make a transaction from owner to contract)--+
/ \ +----------+ |
<Chain> <Address> |
\ / |
\ / |
User <---(send fund, fee paid by owner)--- Smartcontract <---(call function)--- Chain RPC <--+