From eafd6e7fe97933f52bbc5b424b49e5737ab3fb28 Mon Sep 17 00:00:00 2001 From: xBalbinus Date: Tue, 3 Sep 2024 08:29:39 -0700 Subject: [PATCH 01/11] feat: add filecoinAddressToETHAddressV1 docs --- reference/json-rpc/eth.md | 35 ++++++++++++++++++++++++++++++---- reference/json-rpc/filecoin.md | 33 +++++++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/reference/json-rpc/eth.md b/reference/json-rpc/eth.md index cc410a79b..fe74f5481 100644 --- a/reference/json-rpc/eth.md +++ b/reference/json-rpc/eth.md @@ -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 diff --git a/reference/json-rpc/filecoin.md b/reference/json-rpc/filecoin.md index 828b14d9c..66c09b8e2 100644 --- a/reference/json-rpc/filecoin.md +++ b/reference/json-rpc/filecoin.md @@ -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" +``` From b3f76e37284d9e0df133c9d11177556b1c80cc66 Mon Sep 17 00:00:00 2001 From: xBalbinus Date: Tue, 3 Sep 2024 08:32:04 -0700 Subject: [PATCH 02/11] Trigger build From a14eaa80f1514621a12a479478376ce684471c06 Mon Sep 17 00:00:00 2001 From: xBalbinus Date: Tue, 3 Sep 2024 08:56:20 -0700 Subject: [PATCH 03/11] Trigger build From bec13fc7c6607df0e84582c4cb5338fdaffb10a7 Mon Sep 17 00:00:00 2001 From: xBalbinus Date: Tue, 3 Sep 2024 13:58:03 -0700 Subject: [PATCH 04/11] Trigger build From 395e52df03094fa4bb99ff1cc32fa6a7f0b81a60 Mon Sep 17 00:00:00 2001 From: xBalbinus Date: Tue, 3 Sep 2024 14:59:50 -0700 Subject: [PATCH 05/11] Trigger build From 11d24772f24c7aefc498a1a366b5125ac98e96a9 Mon Sep 17 00:00:00 2001 From: xBalbinus Date: Thu, 5 Sep 2024 07:48:36 -0700 Subject: [PATCH 06/11] revert on changes on eth.md namespace ) --- reference/json-rpc/eth.md | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/reference/json-rpc/eth.md b/reference/json-rpc/eth.md index fe74f5481..1579209b3 100644 --- a/reference/json-rpc/eth.md +++ b/reference/json-rpc/eth.md @@ -18,46 +18,19 @@ Response: ["0x5cbeecf99d3fdb3f25e309cc264f240bb0664031"] ``` -## FilecoinAddressToEthAddress +## EthAddressToFilecoinAddress -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. +EthAddressToFilecoinAddress converts an EthAddress into an f410 Filecoin Address Perms: read Inputs: ```json -["f01234", "finalized"] +["0x5cbeecf99d3fdb3f25e309cc264f240bb0664031"] ``` -Response: - -```json -"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031" -``` +Response: `"f01234"` ## EthBlockNumber @@ -850,4 +823,4 @@ Inputs: ["0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"] ``` -Response: `true` +Response: `true` \ No newline at end of file From 92e4a4a27291f205ab6fed1b3f8dde645e94a21f Mon Sep 17 00:00:00 2001 From: xBalbinus Date: Thu, 5 Sep 2024 08:11:36 -0700 Subject: [PATCH 07/11] revised copy: fil to eth addr --- reference/json-rpc/eth.md | 47 +++++++++++++++++++++++++++++++++- reference/json-rpc/filecoin.md | 42 ------------------------------ 2 files changed, 46 insertions(+), 43 deletions(-) delete mode 100644 reference/json-rpc/filecoin.md diff --git a/reference/json-rpc/eth.md b/reference/json-rpc/eth.md index 1579209b3..8c85e2729 100644 --- a/reference/json-rpc/eth.md +++ b/reference/json-rpc/eth.md @@ -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 @@ -48,7 +93,7 @@ Perms: read Inputs: -```json +```jsona [ { "from": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031", diff --git a/reference/json-rpc/filecoin.md b/reference/json-rpc/filecoin.md deleted file mode 100644 index 66c09b8e2..000000000 --- a/reference/json-rpc/filecoin.md +++ /dev/null @@ -1,42 +0,0 @@ -# Filecoin - -## FilecoinAddressToEthAddress - -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", "finalized"] -``` - -Response: - -```json -"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031" -``` From 973a74a72049be269a61fcd77f2a2fb5170d0f4e Mon Sep 17 00:00:00 2001 From: Xiangan He <76530366+xBalbinus@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:18:13 -0400 Subject: [PATCH 08/11] Update reference/json-rpc/eth.md Co-authored-by: longfeiW <34025001+longfeiWan9@users.noreply.github.com> --- reference/json-rpc/eth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/json-rpc/eth.md b/reference/json-rpc/eth.md index 8c85e2729..8187528d6 100644 --- a/reference/json-rpc/eth.md +++ b/reference/json-rpc/eth.md @@ -38,7 +38,7 @@ FilecoinAddressToEthAddress converts any Filecoin address to an EthAddress. This method supports all Filecoin address types: -- f0 and f4 addresses: Converted directly. +- `f0` and `f4` addresses: Converted directly. - f1/f2/f3 addresses: First converted to their corresponding f0 ID address, then to an EthAddress. > **Note:** From 0d0e7b777fa016c66332661de83471a9870f62b4 Mon Sep 17 00:00:00 2001 From: Xiangan He <76530366+xBalbinus@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:18:19 -0400 Subject: [PATCH 09/11] Update reference/json-rpc/eth.md Co-authored-by: longfeiW <34025001+longfeiWan9@users.noreply.github.com> --- reference/json-rpc/eth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/json-rpc/eth.md b/reference/json-rpc/eth.md index 8187528d6..9ae7fe52e 100644 --- a/reference/json-rpc/eth.md +++ b/reference/json-rpc/eth.md @@ -39,7 +39,7 @@ 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. +- `f1/f2/f3` addresses: First converted to their corresponding `f0` ID address, then to an `0x` EthAddress. > **Note:** > From 720a8e5b6c51096702330ae6b8c981224379affb Mon Sep 17 00:00:00 2001 From: Xiangan He <76530366+xBalbinus@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:18:25 -0400 Subject: [PATCH 10/11] Update reference/json-rpc/eth.md Co-authored-by: longfeiW <34025001+longfeiWan9@users.noreply.github.com> --- reference/json-rpc/eth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/json-rpc/eth.md b/reference/json-rpc/eth.md index 9ae7fe52e..d6bdea034 100644 --- a/reference/json-rpc/eth.md +++ b/reference/json-rpc/eth.md @@ -50,7 +50,7 @@ This method supports all Filecoin address types: 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. +- 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: From 27564851dc8b28268acc347388ae9ead833f8425 Mon Sep 17 00:00:00 2001 From: xBalbinus Date: Mon, 9 Sep 2024 20:57:34 -0700 Subject: [PATCH 11/11] fix: separate input entries for examples --- reference/json-rpc/eth.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/reference/json-rpc/eth.md b/reference/json-rpc/eth.md index d6bdea034..b9942c088 100644 --- a/reference/json-rpc/eth.md +++ b/reference/json-rpc/eth.md @@ -61,20 +61,28 @@ Parameters: Perms: read -Inputs: +Input: ```json -["f410", "finalized"] - -["f1", "safe"] +["t410fghja63ghyzd54cbswfapglsutx5e64xnm7mazwi"] ``` Response: ```json -"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031" +"0x31d20f6cc7c647de0832b140f32e549dfa4f72ed" +``` + +Input: + +```json +["t15xwdubazj7aft6ylmiw54fa27zyyl3rpc6olgcy", "safe"] +``` -"0x1234567890abcdef1234567890abcdef12345678" +Response: + +```json +"0xff00000000000000000000000000000000000064" ``` ## EthBlockNumber