Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
35 changes: 31 additions & 4 deletions reference/json-rpc/eth.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,46 @@ Response:
["0x5cbeecf99d3fdb3f25e309cc264f240bb0664031"]
```

## EthAddressToFilecoinAddress
## FilecoinAddressToEthAddress

EthAddressToFilecoinAddress converts an EthAddress into an f410 Filecoin Address
FilecoinAddressToEthAddress converts any Filecoin address to an EthAddress.

This method supports all Filecoin address types:

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

Requirements:

- For "f1", "f2", and "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.

Note on chain reorganizations:
"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 https://docs.alchemy.com/reference/eth-getblockbynumber for more details.

Parameters:

- ctx: The context for the API call.
- 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
["0x5cbeecf99d3fdb3f25e309cc264f240bb0664031"]
["f01234", "finalized"]
```

Response: `"f01234"`
Response:

```json
"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031"
```

## EthBlockNumber

Expand Down
33 changes: 30 additions & 3 deletions reference/json-rpc/filecoin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,41 @@

## FilecoinAddressToEthAddress

FilecoinAddressToEthAddress converts an f410 or f0 Filecoin Address to an EthAddress
FilecoinAddressToEthAddress converts any Filecoin address to an EthAddress.

This method supports all Filecoin address types:

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

Requirements:

- For "f1", "f2", and "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.

Note on chain reorganizations:
"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 https://docs.alchemy.com/reference/eth-getblockbynumber for more details.

Parameters:

- ctx: The context for the API call.
- 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
["f01234"]
["f01234", "finalized"]
```

Response: `"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031"`
Response:

```json
"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031"
```
Loading