Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
49 changes: 47 additions & 2 deletions reference/json-rpc/eth.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,51 @@ Inputs:

Response: `"f01234"`

## FilecoinAddressToEthAddress

FilecoinAddressToEthAddress converts any Filecoin address to an EthAddress.

This method supports all Filecoin address types:

- f0 and f4 addresses: Converted directly.
- f1/f2/f3 addresses: First converted to their corresponding f0 ID address, then to an EthAddress.

> **Note:**
>
> f0 ID addresses are not permanent and can be affected by chain reorganizations. To account for this,
> the API includes a `blkNum` parameter, which specifies the block number that is used to determine the tipset state to use for converting an
> f1/f2/f3 address to an f0 address. This parameter functions similarly to the `blkNum` parameter in the existing `EthGetBlockByNumber` API.
> See [Alchemy Docs - eth_getBlockByNumber](https://docs.alchemy.com/reference/eth-getblockbynumber) for more details.

Requirements:

- For f1/f2/f3 addresses, they must be instantiated on-chain, as f0 ID addresses are only assigned to actors when they are created on-chain.
The simplest way to instantiate an address on chain is to send a transaction to the address.

Parameters:

- filecoinAddress: The Filecoin address to convert.
- blkNum: The block number or state for the conversion. Defaults to "finalized" for maximum safety.
Possible values: "pending", "latest", "finalized", "safe", or a specific block number represented as hex.

Perms: read

Inputs:

```json
["f410", "finalized"]

["f1", "safe"]
```

Response:

```json
"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031"

"0x1234567890abcdef1234567890abcdef12345678"
```

## EthBlockNumber

EthBlockNumber returns the height of the latest (heaviest) TipSet
Expand All @@ -48,7 +93,7 @@ Perms: read

Inputs:

```json
```jsona
[
{
"from": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
Expand Down Expand Up @@ -823,4 +868,4 @@ Inputs:
["0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"]
```

Response: `true`
Response: `true`
15 changes: 0 additions & 15 deletions reference/json-rpc/filecoin.md

This file was deleted.

Loading