Skip to content

Commit e9d0200

Browse files
feat: add filecoinAddressToETHAddressV1 docs (#2306)
* feat: add filecoinAddressToETHAddressV1 docs * Trigger build * Trigger build * Trigger build * Trigger build * revert on changes on eth.md namespace ) * revised copy: fil to eth addr * Update reference/json-rpc/eth.md Co-authored-by: longfeiW <[email protected]> * Update reference/json-rpc/eth.md Co-authored-by: longfeiW <[email protected]> * Update reference/json-rpc/eth.md Co-authored-by: longfeiW <[email protected]> * fix: separate input entries for examples --------- Co-authored-by: longfeiW <[email protected]>
1 parent f2626af commit e9d0200

File tree

2 files changed

+55
-17
lines changed

2 files changed

+55
-17
lines changed

reference/json-rpc/eth.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,59 @@ Inputs:
3232

3333
Response: `"f01234"`
3434

35+
## FilecoinAddressToEthAddress
36+
37+
FilecoinAddressToEthAddress converts any Filecoin address to an EthAddress.
38+
39+
This method supports all Filecoin address types:
40+
41+
- `f0` and `f4` addresses: Converted directly.
42+
- `f1/f2/f3` addresses: First converted to their corresponding `f0` ID address, then to an `0x` EthAddress.
43+
44+
> **Note:**
45+
>
46+
> f0 ID addresses are not permanent and can be affected by chain reorganizations. To account for this,
47+
> the API includes a `blkNum` parameter, which specifies the block number that is used to determine the tipset state to use for converting an
48+
> f1/f2/f3 address to an f0 address. This parameter functions similarly to the `blkNum` parameter in the existing `EthGetBlockByNumber` API.
49+
> See [Alchemy Docs - eth_getBlockByNumber](https://docs.alchemy.com/reference/eth-getblockbynumber) for more details.
50+
51+
Requirements:
52+
53+
- 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.
54+
The simplest way to instantiate an address on chain is to send a transaction to the address.
55+
56+
Parameters:
57+
58+
- filecoinAddress: The Filecoin address to convert.
59+
- blkNum: The block number or state for the conversion. Defaults to "finalized" for maximum safety.
60+
Possible values: "pending", "latest", "finalized", "safe", or a specific block number represented as hex.
61+
62+
Perms: read
63+
64+
Input:
65+
66+
```json
67+
["t410fghja63ghyzd54cbswfapglsutx5e64xnm7mazwi"]
68+
```
69+
70+
Response:
71+
72+
```json
73+
"0x31d20f6cc7c647de0832b140f32e549dfa4f72ed"
74+
```
75+
76+
Input:
77+
78+
```json
79+
["t15xwdubazj7aft6ylmiw54fa27zyyl3rpc6olgcy", "safe"]
80+
```
81+
82+
Response:
83+
84+
```json
85+
"0xff00000000000000000000000000000000000064"
86+
```
87+
3588
## EthBlockNumber
3689

3790
EthBlockNumber returns the height of the latest (heaviest) TipSet
@@ -48,7 +101,7 @@ Perms: read
48101

49102
Inputs:
50103

51-
```json
104+
```jsona
52105
[
53106
{
54107
"from": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
@@ -823,4 +876,4 @@ Inputs:
823876
["0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"]
824877
```
825878

826-
Response: `true`
879+
Response: `true`

reference/json-rpc/filecoin.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)