Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/api-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ transaction hash confirming the token transfer.

- Each address is subject to rate limiting to prevent abuse.
- This API only distributes Calibnet `tFIL` and `tUSDFC` tokens.
- For native token claims, the API returns the Ethereum transaction hash if
resolvable via `Filecoin.EthGetTransactionHashByCid`; otherwise, it returns
the CID.

---

Expand Down
11 changes: 8 additions & 3 deletions src/faucet/server_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,16 @@ async fn handle_native_claim(
{
Ok(LotusJson(smsg)) => {
let cid = rpc.mpool_push(smsg).await.map_err(ServerFnError::new)?;
let tx_hash = rpc
Ok(rpc
.eth_get_transaction_hash_by_cid(cid)
.await
.map_err(ServerFnError::new)?;
Ok(tx_hash.to_string())
.map(|tx_hash| tx_hash.to_string())
.unwrap_or_else(|err| {
log::warn!(
"Failed to resolve tx hash for CID {cid}: {err}. Returning CID instead."
);
cid.to_string()
}))
}
Err(err) => Err(handle_faucet_error(err)),
}
Expand Down
Loading