diff --git a/Cargo.toml b/Cargo.toml
index 30a4e83c..9df668c4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,7 @@
[workspace]
members = [
+ "fil_actor_decoder",
+ "fil_actor_json_derive",
"fil_actors_shared",
"fil_actors_test_utils",
"actors/account",
@@ -86,6 +88,7 @@ fil_actor_cron_state = { version = "24.1.3", path = "./actors/cron" }
fil_actor_datacap_state = { version = "24.1.3", path = "./actors/datacap" }
fil_actor_evm_state = { version = "24.1.3", path = "./actors/evm" }
fil_actor_init_state = { version = "24.1.3", path = "./actors/init" }
+fil_actor_json_derive = { version = "0.1.0", path = "./fil_actor_json_derive" }
fil_actor_market_state = { version = "24.1.3", path = "./actors/market" }
fil_actor_miner_state = { version = "24.1.3", path = "./actors/miner" }
fil_actor_multisig_state = { version = "24.1.3", path = "./actors/multisig" }
diff --git a/actors/datacap/Cargo.toml b/actors/datacap/Cargo.toml
index 2258c1f5..969bd700 100644
--- a/actors/datacap/Cargo.toml
+++ b/actors/datacap/Cargo.toml
@@ -22,3 +22,14 @@ lazy_static = { workspace = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
serde = { workspace = true }
+
+# Optional: JSON value conversion
+fil_actor_json_derive = { workspace = true, optional = true }
+serde_json = { workspace = true, optional = true }
+
+[dev-dependencies]
+serde_json = { workspace = true }
+
+[features]
+default = []
+json = ["dep:fil_actor_json_derive", "dep:serde_json", "fil_actors_shared/json"]
diff --git a/actors/datacap/src/v10/types.rs b/actors/datacap/src/v10/types.rs
index 4fa3c5e6..fcd2af8f 100644
--- a/actors/datacap/src/v10/types.rs
+++ b/actors/datacap/src/v10/types.rs
@@ -5,6 +5,7 @@ use fvm_ipld_encoding::tuple::*;
use fvm_shared3::address::Address;
use fvm_shared3::econ::TokenAmount;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct MintParams {
// Recipient of the newly minted tokens.
@@ -15,12 +16,14 @@ pub struct MintParams {
pub operators: Vec
,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
pub amount: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GranularityReturn {
diff --git a/actors/datacap/src/v11/types.rs b/actors/datacap/src/v11/types.rs
index d45a6512..db4e3f05 100644
--- a/actors/datacap/src/v11/types.rs
+++ b/actors/datacap/src/v11/types.rs
@@ -5,66 +5,77 @@ use fvm_ipld_encoding::tuple::*;
use fvm_shared3::address::Address;
use fvm_shared3::econ::TokenAmount;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub governor: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct NameReturn {
pub name: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SymbolReturn {
pub symbol: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct TotalSupplyReturn {
pub supply: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceParams {
pub address: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceReturn {
pub balance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GetAllowanceReturn {
pub allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct IncreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct DecreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RevokeAllowanceReturn {
pub old_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct MintParams {
// Recipient of the newly minted tokens.
@@ -75,12 +86,14 @@ pub struct MintParams {
pub operators: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
pub amount: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GranularityReturn {
diff --git a/actors/datacap/src/v12/types.rs b/actors/datacap/src/v12/types.rs
index 00b95e9f..5ad6ef78 100644
--- a/actors/datacap/src/v12/types.rs
+++ b/actors/datacap/src/v12/types.rs
@@ -5,66 +5,77 @@ use fvm_ipld_encoding::tuple::*;
use fvm_shared4::address::Address;
use fvm_shared4::econ::TokenAmount;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub governor: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct NameReturn {
pub name: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SymbolReturn {
pub symbol: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct TotalSupplyReturn {
pub supply: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceParams {
pub address: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceReturn {
pub balance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GetAllowanceReturn {
pub allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct IncreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct DecreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RevokeAllowanceReturn {
pub old_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct MintParams {
// Recipient of the newly minted tokens.
@@ -75,12 +86,14 @@ pub struct MintParams {
pub operators: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
pub amount: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GranularityReturn {
diff --git a/actors/datacap/src/v13/types.rs b/actors/datacap/src/v13/types.rs
index 56374f24..44376e1b 100644
--- a/actors/datacap/src/v13/types.rs
+++ b/actors/datacap/src/v13/types.rs
@@ -2,66 +2,77 @@ use fvm_ipld_encoding::tuple::*;
use fvm_shared4::address::Address;
use fvm_shared4::econ::TokenAmount;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub governor: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct NameReturn {
pub name: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SymbolReturn {
pub symbol: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct TotalSupplyReturn {
pub supply: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceParams {
pub address: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceReturn {
pub balance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GetAllowanceReturn {
pub allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct IncreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct DecreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RevokeAllowanceReturn {
pub old_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct MintParams {
// Recipient of the newly minted tokens.
@@ -72,12 +83,14 @@ pub struct MintParams {
pub operators: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
pub amount: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GranularityReturn {
diff --git a/actors/datacap/src/v14/types.rs b/actors/datacap/src/v14/types.rs
index 56374f24..44376e1b 100644
--- a/actors/datacap/src/v14/types.rs
+++ b/actors/datacap/src/v14/types.rs
@@ -2,66 +2,77 @@ use fvm_ipld_encoding::tuple::*;
use fvm_shared4::address::Address;
use fvm_shared4::econ::TokenAmount;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub governor: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct NameReturn {
pub name: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SymbolReturn {
pub symbol: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct TotalSupplyReturn {
pub supply: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceParams {
pub address: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceReturn {
pub balance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GetAllowanceReturn {
pub allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct IncreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct DecreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RevokeAllowanceReturn {
pub old_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct MintParams {
// Recipient of the newly minted tokens.
@@ -72,12 +83,14 @@ pub struct MintParams {
pub operators: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
pub amount: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GranularityReturn {
diff --git a/actors/datacap/src/v15/types.rs b/actors/datacap/src/v15/types.rs
index 56374f24..44376e1b 100644
--- a/actors/datacap/src/v15/types.rs
+++ b/actors/datacap/src/v15/types.rs
@@ -2,66 +2,77 @@ use fvm_ipld_encoding::tuple::*;
use fvm_shared4::address::Address;
use fvm_shared4::econ::TokenAmount;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub governor: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct NameReturn {
pub name: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SymbolReturn {
pub symbol: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct TotalSupplyReturn {
pub supply: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceParams {
pub address: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceReturn {
pub balance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GetAllowanceReturn {
pub allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct IncreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct DecreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RevokeAllowanceReturn {
pub old_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct MintParams {
// Recipient of the newly minted tokens.
@@ -72,12 +83,14 @@ pub struct MintParams {
pub operators: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
pub amount: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GranularityReturn {
diff --git a/actors/datacap/src/v16/types.rs b/actors/datacap/src/v16/types.rs
index 56374f24..44376e1b 100644
--- a/actors/datacap/src/v16/types.rs
+++ b/actors/datacap/src/v16/types.rs
@@ -2,66 +2,77 @@ use fvm_ipld_encoding::tuple::*;
use fvm_shared4::address::Address;
use fvm_shared4::econ::TokenAmount;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub governor: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct NameReturn {
pub name: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SymbolReturn {
pub symbol: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct TotalSupplyReturn {
pub supply: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceParams {
pub address: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceReturn {
pub balance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GetAllowanceReturn {
pub allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct IncreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct DecreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RevokeAllowanceReturn {
pub old_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct MintParams {
// Recipient of the newly minted tokens.
@@ -72,12 +83,14 @@ pub struct MintParams {
pub operators: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
pub amount: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GranularityReturn {
diff --git a/actors/datacap/src/v17/types.rs b/actors/datacap/src/v17/types.rs
index 56374f24..44376e1b 100644
--- a/actors/datacap/src/v17/types.rs
+++ b/actors/datacap/src/v17/types.rs
@@ -2,66 +2,77 @@ use fvm_ipld_encoding::tuple::*;
use fvm_shared4::address::Address;
use fvm_shared4::econ::TokenAmount;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub governor: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct NameReturn {
pub name: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SymbolReturn {
pub symbol: String,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct TotalSupplyReturn {
pub supply: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceParams {
pub address: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct BalanceReturn {
pub balance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GetAllowanceReturn {
pub allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct IncreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct DecreaseAllowanceReturn {
pub new_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RevokeAllowanceReturn {
pub old_allowance: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct MintParams {
// Recipient of the newly minted tokens.
@@ -72,12 +83,14 @@ pub struct MintParams {
pub operators: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
pub amount: TokenAmount,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct GranularityReturn {
diff --git a/actors/datacap/src/v9/types.rs b/actors/datacap/src/v9/types.rs
index 6ffaa903..e8a020e6 100644
--- a/actors/datacap/src/v9/types.rs
+++ b/actors/datacap/src/v9/types.rs
@@ -2,6 +2,7 @@ use fvm_ipld_encoding::tuple::*;
use fvm_shared::address::Address;
use fvm_shared::econ::TokenAmount;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct MintParams {
// Recipient of the newly minted tokens.
@@ -12,6 +13,7 @@ pub struct MintParams {
pub operators: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
diff --git a/actors/datacap/tests/json_value_tests.rs b/actors/datacap/tests/json_value_tests.rs
new file mode 100644
index 00000000..fa9e9e3a
--- /dev/null
+++ b/actors/datacap/tests/json_value_tests.rs
@@ -0,0 +1,180 @@
+#![cfg(feature = "json")]
+
+//! Unit tests for `to_json_value()` on datacap types across all versions.
+//! These test the derive macro output directly, independent of the decoder.
+
+use serde_json::Value;
+
+/// Generate tests for a datacap version that has MintParams and DestroyParams.
+/// All versions (v9-v17) have these two types.
+macro_rules! test_mint_destroy {
+ ($mod_name:ident, $version:ident, $addr_new_id:path, $token_from_atto:path) => {
+ mod $mod_name {
+ use super::*;
+
+ #[test]
+ fn mint_params_produces_named_fields() {
+ let params = fil_actor_datacap_state::$version::MintParams {
+ to: $addr_new_id(1234),
+ amount: $token_from_atto(5_000_000),
+ operators: vec![$addr_new_id(5678), $addr_new_id(9999)],
+ };
+ let json = params.to_json_value();
+ let obj = json.as_object().expect("expected JSON object");
+ assert_eq!(obj.len(), 3);
+ assert!(obj.contains_key("to"));
+ assert!(obj.contains_key("amount"));
+ assert!(obj.contains_key("operators"));
+ assert_eq!(obj["to"], Value::String("f01234".into()));
+ assert_eq!(obj["amount"], Value::String("5000000".into()));
+ let ops = obj["operators"].as_array().unwrap();
+ assert_eq!(ops.len(), 2);
+ assert_eq!(ops[0], Value::String("f05678".into()));
+ }
+
+ #[test]
+ fn destroy_params_produces_named_fields() {
+ let params = fil_actor_datacap_state::$version::DestroyParams {
+ owner: $addr_new_id(42),
+ amount: $token_from_atto(999),
+ };
+ let json = params.to_json_value();
+ let obj = json.as_object().unwrap();
+ assert_eq!(obj["owner"], Value::String("f042".into()));
+ assert_eq!(obj["amount"], Value::String("999".into()));
+ }
+ }
+ };
+}
+
+/// Generate tests for versions that have the full type set (v12-v17).
+/// Adds transparent type tests and cross-version equivalence.
+macro_rules! test_full_types {
+ ($mod_name:ident, $version:ident) => {
+ mod $mod_name {
+ use super::*;
+ use fil_actor_datacap_state::$version;
+ use fvm_shared4::address::Address;
+ use fvm_shared4::econ::TokenAmount;
+
+ #[test]
+ fn transparent_constructor() {
+ let p = $version::ConstructorParams {
+ governor: Address::new_id(100),
+ };
+ assert_eq!(p.to_json_value(), Value::String("f0100".into()));
+ }
+
+ #[test]
+ fn transparent_name_return() {
+ let r = $version::NameReturn {
+ name: "DataCap".into(),
+ };
+ assert_eq!(r.to_json_value(), Value::String("DataCap".into()));
+ }
+
+ #[test]
+ fn transparent_granularity_return() {
+ let r = $version::GranularityReturn { granularity: 42 };
+ assert_eq!(r.to_json_value(), serde_json::json!(42));
+ }
+
+ #[test]
+ fn transparent_token_amount_types() {
+ let r = $version::TotalSupplyReturn {
+ supply: TokenAmount::from_atto(1_000_000_000),
+ };
+ assert_eq!(r.to_json_value(), Value::String("1000000000".into()));
+
+ let r = $version::BalanceReturn {
+ balance: TokenAmount::from_atto(0),
+ };
+ assert_eq!(r.to_json_value(), Value::String("0".into()));
+ }
+ }
+ };
+}
+
+// v9-v11 use fvm_shared v2/v3 types — tested via decoder snapshot tests.
+// v12+ use fvm_shared4 types and can be tested directly here.
+test_mint_destroy!(
+ v12,
+ v12,
+ fvm_shared4::address::Address::new_id,
+ fvm_shared4::econ::TokenAmount::from_atto
+);
+test_mint_destroy!(
+ v13,
+ v13,
+ fvm_shared4::address::Address::new_id,
+ fvm_shared4::econ::TokenAmount::from_atto
+);
+test_mint_destroy!(
+ v14,
+ v14,
+ fvm_shared4::address::Address::new_id,
+ fvm_shared4::econ::TokenAmount::from_atto
+);
+test_mint_destroy!(
+ v15,
+ v15,
+ fvm_shared4::address::Address::new_id,
+ fvm_shared4::econ::TokenAmount::from_atto
+);
+test_mint_destroy!(
+ v16,
+ v16,
+ fvm_shared4::address::Address::new_id,
+ fvm_shared4::econ::TokenAmount::from_atto
+);
+test_mint_destroy!(
+ v17,
+ v17,
+ fvm_shared4::address::Address::new_id,
+ fvm_shared4::econ::TokenAmount::from_atto
+);
+
+// v11 has full types but uses fvm_shared3 — can't construct with fvm_shared4 types.
+// Full type tests for v12-v17 (fvm_shared4, have ConstructorParams, NameReturn, etc.)
+test_full_types!(v12_full, v12);
+test_full_types!(v13_full, v13);
+test_full_types!(v14_full, v14);
+test_full_types!(v15_full, v15);
+test_full_types!(v16_full, v16);
+test_full_types!(v17_full, v17);
+
+/// Cross-version equivalence: all versions produce the same JSON for MintParams.
+#[test]
+fn all_versions_produce_same_mint_output() {
+ use fvm_shared4::address::Address;
+ use fvm_shared4::econ::TokenAmount;
+
+ let expected = fil_actor_datacap_state::v17::MintParams {
+ to: Address::new_id(1234),
+ amount: TokenAmount::from_atto(5_000_000),
+ operators: vec![Address::new_id(5678)],
+ }
+ .to_json_value();
+
+ // v12-v16 use fvm_shared4 — construct directly
+ macro_rules! assert_mint_eq {
+ ($ver:ident) => {
+ let p = fil_actor_datacap_state::$ver::MintParams {
+ to: Address::new_id(1234),
+ amount: TokenAmount::from_atto(5_000_000),
+ operators: vec![Address::new_id(5678)],
+ };
+ assert_eq!(
+ p.to_json_value(),
+ expected,
+ "v{} mismatch",
+ stringify!($ver)
+ );
+ };
+ }
+ assert_mint_eq!(v12);
+ assert_mint_eq!(v13);
+ assert_mint_eq!(v14);
+ assert_mint_eq!(v15);
+ assert_mint_eq!(v16);
+}
diff --git a/actors/verifreg/Cargo.toml b/actors/verifreg/Cargo.toml
index 725d1b5a..58ad30ba 100644
--- a/actors/verifreg/Cargo.toml
+++ b/actors/verifreg/Cargo.toml
@@ -28,3 +28,15 @@ log = { workspace = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
serde = { workspace = true }
+
+# Optional: JSON value conversion
+fil_actor_json_derive = { workspace = true, optional = true }
+serde_json = { workspace = true, optional = true }
+
+[dev-dependencies]
+fil_actors_shared = { workspace = true, features = ["json"] }
+serde_json = { workspace = true }
+
+[features]
+default = []
+json = ["dep:fil_actor_json_derive", "dep:serde_json", "fil_actors_shared/json"]
diff --git a/actors/verifreg/src/v10/state.rs b/actors/verifreg/src/v10/state.rs
index dc0f9d79..55d04ad1 100644
--- a/actors/verifreg/src/v10/state.rs
+++ b/actors/verifreg/src/v10/state.rs
@@ -219,6 +219,7 @@ impl State {
Ok(())
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Claim {
// The provider storing the data (from allocation).
@@ -239,6 +240,7 @@ pub struct Claim {
pub sector: SectorNumber,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Allocation {
// The verified client which allocated the DataCap.
diff --git a/actors/verifreg/src/v10/types.rs b/actors/verifreg/src/v10/types.rs
index c55085a5..3425ca36 100644
--- a/actors/verifreg/src/v10/types.rs
+++ b/actors/verifreg/src/v10/types.rs
@@ -18,6 +18,7 @@ use super::Claim;
pub type AllocationID = u64;
pub type ClaimID = u64;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -35,6 +36,7 @@ pub type DataCap = StoragePower;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -44,12 +46,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -57,11 +61,13 @@ pub struct RemoveDataCapReturn {
pub data_cap_removed: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposalID {
pub id: u64,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
@@ -88,6 +94,7 @@ impl AddrPairKey {
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsParams {
// Client for which to remove expired allocations.
@@ -97,6 +104,7 @@ pub struct RemoveExpiredAllocationsParams {
pub allocation_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsReturn {
// Ids of the allocations that were either specified by the caller or discovered to be expired.
@@ -108,6 +116,7 @@ pub struct RemoveExpiredAllocationsReturn {
pub datacap_recovered: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorAllocationClaim {
pub client: ActorID,
@@ -118,12 +127,14 @@ pub struct SectorAllocationClaim {
pub sector_expiry: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
pub sectors: Vec,
pub all_or_nothing: bool,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
pub batch_info: BatchReturn,
@@ -131,6 +142,7 @@ pub struct ClaimAllocationsReturn {
pub claimed_space: BigInt,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimTerm {
pub provider: ActorID,
@@ -138,6 +150,7 @@ pub struct ClaimTerm {
pub term_max: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ExtendClaimTermsParams {
pub terms: Vec,
@@ -151,6 +164,7 @@ pub type ExtendClaimTermsReturn = BatchReturn;
// A request to create an allocation with datacap tokens.
// See Allocation state for description of field semantics.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: ActorID,
@@ -162,6 +176,7 @@ pub struct AllocationRequest {
}
// A request to extend the term of an existing claim with datacap tokens.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimExtensionRequest {
pub provider: ActorID,
@@ -171,6 +186,7 @@ pub struct ClaimExtensionRequest {
/// Operator-data payload for a datacap token transfer receiver hook specifying an allocation.
/// The implied client is the sender of the datacap.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequests {
pub allocations: Vec,
@@ -178,6 +194,7 @@ pub struct AllocationRequests {
}
/// Recipient data payload in response to a datacap token transfer.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
// Result for each allocation request.
@@ -188,18 +205,21 @@ pub struct AllocationsResponse {
pub new_allocations: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsParams {
pub provider: ActorID,
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsReturn {
pub batch_info: BatchReturn,
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsParams {
// Provider to clean up (need not be the caller)
@@ -209,6 +229,7 @@ pub struct RemoveExpiredClaimsParams {
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsReturn {
// Ids of the claims that were either specified by the caller or discovered to be expired.
diff --git a/actors/verifreg/src/v11/state.rs b/actors/verifreg/src/v11/state.rs
index 310299b7..573f0b68 100644
--- a/actors/verifreg/src/v11/state.rs
+++ b/actors/verifreg/src/v11/state.rs
@@ -219,6 +219,7 @@ impl State {
Ok(())
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Claim {
// The provider storing the data (from allocation).
@@ -239,6 +240,7 @@ pub struct Claim {
pub sector: SectorNumber,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Allocation {
// The verified client which allocated the DataCap.
diff --git a/actors/verifreg/src/v11/types.rs b/actors/verifreg/src/v11/types.rs
index 7b5579af..b55d7689 100644
--- a/actors/verifreg/src/v11/types.rs
+++ b/actors/verifreg/src/v11/types.rs
@@ -18,12 +18,14 @@ use super::Claim;
pub type AllocationID = u64;
pub type ClaimID = u64;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub root_key: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -35,6 +37,7 @@ pub type AddVerifierParams = VerifierParams;
pub type AddVerifiedClientParams = VerifierParams;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RemoveVerifierParams {
@@ -47,6 +50,7 @@ pub type DataCap = StoragePower;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -56,12 +60,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -69,11 +75,13 @@ pub struct RemoveDataCapReturn {
pub data_cap_removed: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposalID {
pub id: u64,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
@@ -100,6 +108,7 @@ impl AddrPairKey {
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsParams {
// Client for which to remove expired allocations.
@@ -109,6 +118,7 @@ pub struct RemoveExpiredAllocationsParams {
pub allocation_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsReturn {
// Ids of the allocations that were either specified by the caller or discovered to be expired.
@@ -120,6 +130,7 @@ pub struct RemoveExpiredAllocationsReturn {
pub datacap_recovered: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorAllocationClaim {
pub client: ActorID,
@@ -130,12 +141,14 @@ pub struct SectorAllocationClaim {
pub sector_expiry: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
pub sectors: Vec,
pub all_or_nothing: bool,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
pub batch_info: BatchReturn,
@@ -143,6 +156,7 @@ pub struct ClaimAllocationsReturn {
pub claimed_space: BigInt,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimTerm {
pub provider: ActorID,
@@ -150,6 +164,7 @@ pub struct ClaimTerm {
pub term_max: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ExtendClaimTermsParams {
pub terms: Vec,
@@ -163,6 +178,7 @@ pub type ExtendClaimTermsReturn = BatchReturn;
// A request to create an allocation with datacap tokens.
// See Allocation state for description of field semantics.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: ActorID,
@@ -174,6 +190,7 @@ pub struct AllocationRequest {
}
// A request to extend the term of an existing claim with datacap tokens.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimExtensionRequest {
pub provider: ActorID,
@@ -183,6 +200,7 @@ pub struct ClaimExtensionRequest {
/// Operator-data payload for a datacap token transfer receiver hook specifying an allocation.
/// The implied client is the sender of the datacap.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequests {
pub allocations: Vec,
@@ -190,6 +208,7 @@ pub struct AllocationRequests {
}
/// Recipient data payload in response to a datacap token transfer.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
// Result for each allocation request.
@@ -200,18 +219,21 @@ pub struct AllocationsResponse {
pub new_allocations: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsParams {
pub provider: ActorID,
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsReturn {
pub batch_info: BatchReturn,
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsParams {
// Provider to clean up (need not be the caller)
@@ -221,6 +243,7 @@ pub struct RemoveExpiredClaimsParams {
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsReturn {
// Ids of the claims that were either specified by the caller or discovered to be expired.
diff --git a/actors/verifreg/src/v12/state.rs b/actors/verifreg/src/v12/state.rs
index 6101acdb..8f79c6cb 100644
--- a/actors/verifreg/src/v12/state.rs
+++ b/actors/verifreg/src/v12/state.rs
@@ -23,6 +23,7 @@ pub const DATACAP_MAP_CONFIG: Config = DEFAULT_HAMT_CONFIG;
pub type RemoveDataCapProposalMap = Map2;
pub const REMOVE_DATACAP_PROPOSALS_CONFIG: Config = DEFAULT_HAMT_CONFIG;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone)]
pub struct State {
pub root_key: Address,
@@ -199,6 +200,7 @@ impl State {
Ok(())
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Claim {
// The provider storing the data (from allocation).
@@ -219,6 +221,7 @@ pub struct Claim {
pub sector: SectorNumber,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Allocation {
// The verified client which allocated the DataCap.
diff --git a/actors/verifreg/src/v12/types.rs b/actors/verifreg/src/v12/types.rs
index f7edc7d7..4413762d 100644
--- a/actors/verifreg/src/v12/types.rs
+++ b/actors/verifreg/src/v12/types.rs
@@ -19,12 +19,14 @@ use crate::v12::Claim;
pub type AllocationID = u64;
pub type ClaimID = u64;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub root_key: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -36,6 +38,7 @@ pub type AddVerifierParams = VerifierParams;
pub type AddVerifiedClientParams = VerifierParams;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RemoveVerifierParams {
@@ -48,6 +51,7 @@ pub type DataCap = StoragePower;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -57,12 +61,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -70,11 +76,13 @@ pub struct RemoveDataCapReturn {
pub data_cap_removed: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposalID {
pub id: u64,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
@@ -113,6 +121,7 @@ impl MapKey for AddrPairKey {
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsParams {
// Client for which to remove expired allocations.
@@ -122,6 +131,7 @@ pub struct RemoveExpiredAllocationsParams {
pub allocation_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsReturn {
// Ids of the allocations that were either specified by the caller or discovered to be expired.
@@ -133,6 +143,7 @@ pub struct RemoveExpiredAllocationsReturn {
pub datacap_recovered: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorAllocationClaims {
pub sector: SectorNumber,
@@ -140,6 +151,7 @@ pub struct SectorAllocationClaims {
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationClaim {
pub client: ActorID,
@@ -148,6 +160,7 @@ pub struct AllocationClaim {
pub size: PaddedPieceSize,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
/// Allocations to claim, grouped by sector.
@@ -158,6 +171,7 @@ pub struct ClaimAllocationsParams {
pub all_or_nothing: bool,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorClaimSummary {
@@ -165,6 +179,7 @@ pub struct SectorClaimSummary {
pub claimed_space: BigInt,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
/// Status of each sector grouping of claims.
@@ -173,6 +188,7 @@ pub struct ClaimAllocationsReturn {
pub sector_claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimTerm {
pub provider: ActorID,
@@ -180,6 +196,7 @@ pub struct ClaimTerm {
pub term_max: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ExtendClaimTermsParams {
pub terms: Vec,
@@ -193,6 +210,7 @@ pub type ExtendClaimTermsReturn = BatchReturn;
// A request to create an allocation with datacap tokens.
// See Allocation state for description of field semantics.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: ActorID,
@@ -204,6 +222,7 @@ pub struct AllocationRequest {
}
// A request to extend the term of an existing claim with datacap tokens.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimExtensionRequest {
pub provider: ActorID,
@@ -213,6 +232,7 @@ pub struct ClaimExtensionRequest {
/// Operator-data payload for a datacap token transfer receiver hook specifying an allocation.
/// The implied client is the sender of the datacap.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequests {
pub allocations: Vec,
@@ -220,6 +240,7 @@ pub struct AllocationRequests {
}
/// Recipient data payload in response to a datacap token transfer.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
// Result for each allocation request.
@@ -230,18 +251,21 @@ pub struct AllocationsResponse {
pub new_allocations: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsParams {
pub provider: ActorID,
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsReturn {
pub batch_info: BatchReturn,
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsParams {
// Provider to clean up (need not be the caller)
@@ -251,6 +275,7 @@ pub struct RemoveExpiredClaimsParams {
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsReturn {
// Ids of the claims that were either specified by the caller or discovered to be expired.
diff --git a/actors/verifreg/src/v13/state.rs b/actors/verifreg/src/v13/state.rs
index 22126014..445777c1 100644
--- a/actors/verifreg/src/v13/state.rs
+++ b/actors/verifreg/src/v13/state.rs
@@ -23,6 +23,7 @@ pub const DATACAP_MAP_CONFIG: Config = DEFAULT_HAMT_CONFIG;
pub type RemoveDataCapProposalMap = Map2;
pub const REMOVE_DATACAP_PROPOSALS_CONFIG: Config = DEFAULT_HAMT_CONFIG;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone)]
pub struct State {
pub root_key: Address,
@@ -199,6 +200,7 @@ impl State {
Ok(())
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Claim {
// The provider storing the data (from allocation).
@@ -219,6 +221,7 @@ pub struct Claim {
pub sector: SectorNumber,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Allocation {
// The verified client which allocated the DataCap.
diff --git a/actors/verifreg/src/v13/types.rs b/actors/verifreg/src/v13/types.rs
index bcf8b09f..10d2f4ee 100644
--- a/actors/verifreg/src/v13/types.rs
+++ b/actors/verifreg/src/v13/types.rs
@@ -19,12 +19,14 @@ use crate::v13::Claim;
pub type AllocationID = u64;
pub type ClaimID = u64;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub root_key: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -36,6 +38,7 @@ pub type AddVerifierParams = VerifierParams;
pub type AddVerifiedClientParams = VerifierParams;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RemoveVerifierParams {
@@ -48,6 +51,7 @@ pub type DataCap = StoragePower;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -57,12 +61,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -70,11 +76,13 @@ pub struct RemoveDataCapReturn {
pub data_cap_removed: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposalID {
pub id: u64,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
@@ -113,6 +121,7 @@ impl MapKey for AddrPairKey {
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsParams {
// Client for which to remove expired allocations.
@@ -122,6 +131,7 @@ pub struct RemoveExpiredAllocationsParams {
pub allocation_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsReturn {
// Ids of the allocations that were either specified by the caller or discovered to be expired.
@@ -133,6 +143,7 @@ pub struct RemoveExpiredAllocationsReturn {
pub datacap_recovered: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorAllocationClaims {
pub sector: SectorNumber,
@@ -140,6 +151,7 @@ pub struct SectorAllocationClaims {
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationClaim {
pub client: ActorID,
@@ -148,6 +160,7 @@ pub struct AllocationClaim {
pub size: PaddedPieceSize,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
/// Allocations to claim, grouped by sector.
@@ -158,6 +171,7 @@ pub struct ClaimAllocationsParams {
pub all_or_nothing: bool,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorClaimSummary {
@@ -165,6 +179,7 @@ pub struct SectorClaimSummary {
pub claimed_space: BigInt,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
/// Status of each sector grouping of claims.
@@ -173,6 +188,7 @@ pub struct ClaimAllocationsReturn {
pub sector_claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimTerm {
pub provider: ActorID,
@@ -180,6 +196,7 @@ pub struct ClaimTerm {
pub term_max: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ExtendClaimTermsParams {
pub terms: Vec,
@@ -193,6 +210,7 @@ pub type ExtendClaimTermsReturn = BatchReturn;
// A request to create an allocation with datacap tokens.
// See Allocation state for description of field semantics.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: ActorID,
@@ -204,6 +222,7 @@ pub struct AllocationRequest {
}
// A request to extend the term of an existing claim with datacap tokens.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimExtensionRequest {
pub provider: ActorID,
@@ -213,6 +232,7 @@ pub struct ClaimExtensionRequest {
/// Operator-data payload for a datacap token transfer receiver hook specifying an allocation.
/// The implied client is the sender of the datacap.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequests {
pub allocations: Vec,
@@ -220,6 +240,7 @@ pub struct AllocationRequests {
}
/// Recipient data payload in response to a datacap token transfer.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
// Result for each allocation request.
@@ -230,18 +251,21 @@ pub struct AllocationsResponse {
pub new_allocations: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsParams {
pub provider: ActorID,
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsReturn {
pub batch_info: BatchReturn,
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsParams {
// Provider to clean up (need not be the caller)
@@ -251,6 +275,7 @@ pub struct RemoveExpiredClaimsParams {
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsReturn {
// Ids of the claims that were either specified by the caller or discovered to be expired.
diff --git a/actors/verifreg/src/v14/state.rs b/actors/verifreg/src/v14/state.rs
index 6a753d86..e0b8157f 100644
--- a/actors/verifreg/src/v14/state.rs
+++ b/actors/verifreg/src/v14/state.rs
@@ -24,6 +24,7 @@ pub const DATACAP_MAP_CONFIG: Config = DEFAULT_HAMT_CONFIG;
pub type RemoveDataCapProposalMap = Map2;
pub const REMOVE_DATACAP_PROPOSALS_CONFIG: Config = DEFAULT_HAMT_CONFIG;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone)]
pub struct State {
pub root_key: Address,
@@ -200,6 +201,7 @@ impl State {
Ok(())
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Claim {
// The provider storing the data (from allocation).
@@ -220,6 +222,7 @@ pub struct Claim {
pub sector: SectorNumber,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Allocation {
// The verified client which allocated the DataCap.
diff --git a/actors/verifreg/src/v14/types.rs b/actors/verifreg/src/v14/types.rs
index 668dc027..2d0d5da1 100644
--- a/actors/verifreg/src/v14/types.rs
+++ b/actors/verifreg/src/v14/types.rs
@@ -19,12 +19,14 @@ use crate::v14::Claim;
pub type AllocationID = u64;
pub type ClaimID = u64;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub root_key: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -36,6 +38,7 @@ pub type AddVerifierParams = VerifierParams;
pub type AddVerifiedClientParams = VerifierParams;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RemoveVerifierParams {
@@ -48,6 +51,7 @@ pub type DataCap = StoragePower;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -57,12 +61,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -70,11 +76,13 @@ pub struct RemoveDataCapReturn {
pub data_cap_removed: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposalID {
pub id: u64,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
@@ -113,6 +121,7 @@ impl MapKey for AddrPairKey {
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsParams {
// Client for which to remove expired allocations.
@@ -122,6 +131,7 @@ pub struct RemoveExpiredAllocationsParams {
pub allocation_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsReturn {
// Ids of the allocations that were either specified by the caller or discovered to be expired.
@@ -133,6 +143,7 @@ pub struct RemoveExpiredAllocationsReturn {
pub datacap_recovered: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorAllocationClaims {
pub sector: SectorNumber,
@@ -140,6 +151,7 @@ pub struct SectorAllocationClaims {
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationClaim {
pub client: ActorID,
@@ -148,6 +160,7 @@ pub struct AllocationClaim {
pub size: PaddedPieceSize,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
/// Allocations to claim, grouped by sector.
@@ -158,6 +171,7 @@ pub struct ClaimAllocationsParams {
pub all_or_nothing: bool,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorClaimSummary {
@@ -165,6 +179,7 @@ pub struct SectorClaimSummary {
pub claimed_space: BigInt,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
/// Status of each sector grouping of claims.
@@ -173,6 +188,7 @@ pub struct ClaimAllocationsReturn {
pub sector_claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimTerm {
pub provider: ActorID,
@@ -180,6 +196,7 @@ pub struct ClaimTerm {
pub term_max: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ExtendClaimTermsParams {
pub terms: Vec,
@@ -193,6 +210,7 @@ pub type ExtendClaimTermsReturn = BatchReturn;
// A request to create an allocation with datacap tokens.
// See Allocation state for description of field semantics.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: ActorID,
@@ -204,6 +222,7 @@ pub struct AllocationRequest {
}
// A request to extend the term of an existing claim with datacap tokens.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimExtensionRequest {
pub provider: ActorID,
@@ -213,6 +232,7 @@ pub struct ClaimExtensionRequest {
/// Operator-data payload for a datacap token transfer receiver hook specifying an allocation.
/// The implied client is the sender of the datacap.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequests {
pub allocations: Vec,
@@ -220,6 +240,7 @@ pub struct AllocationRequests {
}
/// Recipient data payload in response to a datacap token transfer.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
// Result for each allocation request.
@@ -230,18 +251,21 @@ pub struct AllocationsResponse {
pub new_allocations: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsParams {
pub provider: ActorID,
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsReturn {
pub batch_info: BatchReturn,
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsParams {
// Provider to clean up (need not be the caller)
@@ -251,6 +275,7 @@ pub struct RemoveExpiredClaimsParams {
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsReturn {
// Ids of the claims that were either specified by the caller or discovered to be expired.
diff --git a/actors/verifreg/src/v15/state.rs b/actors/verifreg/src/v15/state.rs
index 901da797..5fae3413 100644
--- a/actors/verifreg/src/v15/state.rs
+++ b/actors/verifreg/src/v15/state.rs
@@ -23,6 +23,7 @@ pub const DATACAP_MAP_CONFIG: Config = DEFAULT_HAMT_CONFIG;
pub type RemoveDataCapProposalMap = Map2;
pub const REMOVE_DATACAP_PROPOSALS_CONFIG: Config = DEFAULT_HAMT_CONFIG;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone)]
pub struct State {
pub root_key: Address,
@@ -199,6 +200,7 @@ impl State {
Ok(())
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Claim {
// The provider storing the data (from allocation).
@@ -219,6 +221,7 @@ pub struct Claim {
pub sector: SectorNumber,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Allocation {
// The verified client which allocated the DataCap.
diff --git a/actors/verifreg/src/v15/types.rs b/actors/verifreg/src/v15/types.rs
index 0186e001..7fe129e4 100644
--- a/actors/verifreg/src/v15/types.rs
+++ b/actors/verifreg/src/v15/types.rs
@@ -19,12 +19,14 @@ use crate::v15::Claim;
pub type AllocationID = u64;
pub type ClaimID = u64;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub root_key: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -36,6 +38,7 @@ pub type AddVerifierParams = VerifierParams;
pub type AddVerifiedClientParams = VerifierParams;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RemoveVerifierParams {
@@ -48,6 +51,7 @@ pub type DataCap = StoragePower;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -57,12 +61,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -70,11 +76,13 @@ pub struct RemoveDataCapReturn {
pub data_cap_removed: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposalID {
pub id: u64,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
@@ -113,6 +121,7 @@ impl MapKey for AddrPairKey {
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsParams {
// Client for which to remove expired allocations.
@@ -122,6 +131,7 @@ pub struct RemoveExpiredAllocationsParams {
pub allocation_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsReturn {
// Ids of the allocations that were either specified by the caller or discovered to be expired.
@@ -133,6 +143,7 @@ pub struct RemoveExpiredAllocationsReturn {
pub datacap_recovered: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorAllocationClaims {
pub sector: SectorNumber,
@@ -140,6 +151,7 @@ pub struct SectorAllocationClaims {
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationClaim {
pub client: ActorID,
@@ -148,6 +160,7 @@ pub struct AllocationClaim {
pub size: PaddedPieceSize,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
/// Allocations to claim, grouped by sector.
@@ -158,6 +171,7 @@ pub struct ClaimAllocationsParams {
pub all_or_nothing: bool,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorClaimSummary {
@@ -165,6 +179,7 @@ pub struct SectorClaimSummary {
pub claimed_space: BigInt,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
/// Status of each sector grouping of claims.
@@ -173,6 +188,7 @@ pub struct ClaimAllocationsReturn {
pub sector_claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimTerm {
pub provider: ActorID,
@@ -180,6 +196,7 @@ pub struct ClaimTerm {
pub term_max: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ExtendClaimTermsParams {
pub terms: Vec,
@@ -193,6 +210,7 @@ pub type ExtendClaimTermsReturn = BatchReturn;
// A request to create an allocation with datacap tokens.
// See Allocation state for description of field semantics.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: ActorID,
@@ -204,6 +222,7 @@ pub struct AllocationRequest {
}
// A request to extend the term of an existing claim with datacap tokens.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimExtensionRequest {
pub provider: ActorID,
@@ -213,6 +232,7 @@ pub struct ClaimExtensionRequest {
/// Operator-data payload for a datacap token transfer receiver hook specifying an allocation.
/// The implied client is the sender of the datacap.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequests {
pub allocations: Vec,
@@ -220,6 +240,7 @@ pub struct AllocationRequests {
}
/// Recipient data payload in response to a datacap token transfer.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
// Result for each allocation request.
@@ -230,18 +251,21 @@ pub struct AllocationsResponse {
pub new_allocations: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsParams {
pub provider: ActorID,
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsReturn {
pub batch_info: BatchReturn,
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsParams {
// Provider to clean up (need not be the caller)
@@ -251,6 +275,7 @@ pub struct RemoveExpiredClaimsParams {
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsReturn {
// Ids of the claims that were either specified by the caller or discovered to be expired.
diff --git a/actors/verifreg/src/v16/state.rs b/actors/verifreg/src/v16/state.rs
index 09f37e2a..41519a8b 100644
--- a/actors/verifreg/src/v16/state.rs
+++ b/actors/verifreg/src/v16/state.rs
@@ -200,6 +200,7 @@ impl State {
Ok(())
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Claim {
// The provider storing the data (from allocation).
@@ -220,6 +221,7 @@ pub struct Claim {
pub sector: SectorNumber,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Allocation {
// The verified client which allocated the DataCap.
diff --git a/actors/verifreg/src/v16/types.rs b/actors/verifreg/src/v16/types.rs
index fc56f6b2..4245191c 100644
--- a/actors/verifreg/src/v16/types.rs
+++ b/actors/verifreg/src/v16/types.rs
@@ -19,12 +19,14 @@ use crate::v16::Claim;
pub type AllocationID = u64;
pub type ClaimID = u64;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub root_key: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -36,6 +38,7 @@ pub type AddVerifierParams = VerifierParams;
pub type AddVerifiedClientParams = VerifierParams;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RemoveVerifierParams {
@@ -48,6 +51,7 @@ pub type DataCap = StoragePower;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -57,12 +61,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -70,11 +76,13 @@ pub struct RemoveDataCapReturn {
pub data_cap_removed: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposalID {
pub id: u64,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
@@ -113,6 +121,7 @@ impl MapKey for AddrPairKey {
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsParams {
// Client for which to remove expired allocations.
@@ -122,6 +131,7 @@ pub struct RemoveExpiredAllocationsParams {
pub allocation_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsReturn {
// Ids of the allocations that were either specified by the caller or discovered to be expired.
@@ -133,6 +143,7 @@ pub struct RemoveExpiredAllocationsReturn {
pub datacap_recovered: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorAllocationClaims {
pub sector: SectorNumber,
@@ -140,6 +151,7 @@ pub struct SectorAllocationClaims {
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationClaim {
pub client: ActorID,
@@ -148,6 +160,7 @@ pub struct AllocationClaim {
pub size: PaddedPieceSize,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
/// Allocations to claim, grouped by sector.
@@ -158,6 +171,7 @@ pub struct ClaimAllocationsParams {
pub all_or_nothing: bool,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorClaimSummary {
@@ -165,6 +179,7 @@ pub struct SectorClaimSummary {
pub claimed_space: BigInt,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
/// Status of each sector grouping of claims.
@@ -173,6 +188,7 @@ pub struct ClaimAllocationsReturn {
pub sector_claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimTerm {
pub provider: ActorID,
@@ -180,6 +196,7 @@ pub struct ClaimTerm {
pub term_max: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ExtendClaimTermsParams {
pub terms: Vec,
@@ -193,6 +210,7 @@ pub type ExtendClaimTermsReturn = BatchReturn;
// A request to create an allocation with datacap tokens.
// See Allocation state for description of field semantics.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: ActorID,
@@ -204,6 +222,7 @@ pub struct AllocationRequest {
}
// A request to extend the term of an existing claim with datacap tokens.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimExtensionRequest {
pub provider: ActorID,
@@ -213,6 +232,7 @@ pub struct ClaimExtensionRequest {
/// Operator-data payload for a datacap token transfer receiver hook specifying an allocation.
/// The implied client is the sender of the datacap.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequests {
pub allocations: Vec,
@@ -220,6 +240,7 @@ pub struct AllocationRequests {
}
/// Recipient data payload in response to a datacap token transfer.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
// Result for each allocation request.
@@ -230,18 +251,21 @@ pub struct AllocationsResponse {
pub new_allocations: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsParams {
pub provider: ActorID,
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsReturn {
pub batch_info: BatchReturn,
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsParams {
// Provider to clean up (need not be the caller)
@@ -251,6 +275,7 @@ pub struct RemoveExpiredClaimsParams {
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsReturn {
// Ids of the claims that were either specified by the caller or discovered to be expired.
diff --git a/actors/verifreg/src/v17/state.rs b/actors/verifreg/src/v17/state.rs
index 0510b538..e38cc2a9 100644
--- a/actors/verifreg/src/v17/state.rs
+++ b/actors/verifreg/src/v17/state.rs
@@ -200,6 +200,7 @@ impl State {
Ok(())
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Claim {
// The provider storing the data (from allocation).
@@ -220,6 +221,7 @@ pub struct Claim {
pub sector: SectorNumber,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Allocation {
// The verified client which allocated the DataCap.
diff --git a/actors/verifreg/src/v17/types.rs b/actors/verifreg/src/v17/types.rs
index 382dbff8..de7b523d 100644
--- a/actors/verifreg/src/v17/types.rs
+++ b/actors/verifreg/src/v17/types.rs
@@ -19,12 +19,14 @@ use crate::v17::Claim;
pub type AllocationID = u64;
pub type ClaimID = u64;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub root_key: Address,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -36,6 +38,7 @@ pub type AddVerifierParams = VerifierParams;
pub type AddVerifiedClientParams = VerifierParams;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct RemoveVerifierParams {
@@ -48,6 +51,7 @@ pub type DataCap = StoragePower;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -57,12 +61,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -70,11 +76,13 @@ pub struct RemoveDataCapReturn {
pub data_cap_removed: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposalID {
pub id: u64,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
@@ -113,6 +121,7 @@ impl MapKey for AddrPairKey {
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsParams {
// Client for which to remove expired allocations.
@@ -122,6 +131,7 @@ pub struct RemoveExpiredAllocationsParams {
pub allocation_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsReturn {
// Ids of the allocations that were either specified by the caller or discovered to be expired.
@@ -133,6 +143,7 @@ pub struct RemoveExpiredAllocationsReturn {
pub datacap_recovered: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorAllocationClaims {
pub sector: SectorNumber,
@@ -140,6 +151,7 @@ pub struct SectorAllocationClaims {
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationClaim {
pub client: ActorID,
@@ -148,6 +160,7 @@ pub struct AllocationClaim {
pub size: PaddedPieceSize,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
/// Allocations to claim, grouped by sector.
@@ -158,6 +171,7 @@ pub struct ClaimAllocationsParams {
pub all_or_nothing: bool,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorClaimSummary {
@@ -165,6 +179,7 @@ pub struct SectorClaimSummary {
pub claimed_space: BigInt,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
/// Status of each sector grouping of claims.
@@ -173,6 +188,7 @@ pub struct ClaimAllocationsReturn {
pub sector_claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimTerm {
pub provider: ActorID,
@@ -180,6 +196,7 @@ pub struct ClaimTerm {
pub term_max: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ExtendClaimTermsParams {
pub terms: Vec,
@@ -193,6 +210,7 @@ pub type ExtendClaimTermsReturn = BatchReturn;
// A request to create an allocation with datacap tokens.
// See Allocation state for description of field semantics.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: ActorID,
@@ -204,6 +222,7 @@ pub struct AllocationRequest {
}
// A request to extend the term of an existing claim with datacap tokens.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimExtensionRequest {
pub provider: ActorID,
@@ -213,6 +232,7 @@ pub struct ClaimExtensionRequest {
/// Operator-data payload for a datacap token transfer receiver hook specifying an allocation.
/// The implied client is the sender of the datacap.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequests {
pub allocations: Vec,
@@ -220,6 +240,7 @@ pub struct AllocationRequests {
}
/// Recipient data payload in response to a datacap token transfer.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
// Result for each allocation request.
@@ -230,18 +251,21 @@ pub struct AllocationsResponse {
pub new_allocations: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsParams {
pub provider: ActorID,
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsReturn {
pub batch_info: BatchReturn,
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsParams {
// Provider to clean up (need not be the caller)
@@ -251,6 +275,7 @@ pub struct RemoveExpiredClaimsParams {
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsReturn {
// Ids of the claims that were either specified by the caller or discovered to be expired.
diff --git a/actors/verifreg/src/v8/types.rs b/actors/verifreg/src/v8/types.rs
index 7b52a833..02c7893d 100644
--- a/actors/verifreg/src/v8/types.rs
+++ b/actors/verifreg/src/v8/types.rs
@@ -8,6 +8,7 @@ use fvm_shared::crypto::signature::Signature;
use fvm_shared::sector::StoragePower;
use serde::{Deserialize, Serialize};
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -23,6 +24,7 @@ pub type AddVerifierClientParams = VerifierParams;
/// We can introduce policy changes and replace this in the future.
pub type DataCap = StoragePower;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Serialize_tuple, Deserialize_tuple)]
pub struct BytesParams {
/// Address of verified client.
@@ -37,6 +39,7 @@ pub type RestoreBytesParams = BytesParams;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -46,12 +49,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -63,6 +68,14 @@ pub struct RemoveDataCapReturn {
#[serde(transparent)]
pub struct RemoveDataCapProposalID(pub u64);
+#[cfg(feature = "json")]
+impl fil_actors_shared::json_field::JsonField for RemoveDataCapProposalID {
+ fn to_json_field(&self) -> serde_json::Value {
+ serde_json::json!(self.0)
+ }
+}
+
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
diff --git a/actors/verifreg/src/v9/state.rs b/actors/verifreg/src/v9/state.rs
index 342869e0..570c9901 100644
--- a/actors/verifreg/src/v9/state.rs
+++ b/actors/verifreg/src/v9/state.rs
@@ -215,6 +215,7 @@ impl State {
Ok(())
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, Eq, PartialEq)]
pub struct Claim {
// The provider storing the data (from allocation).
@@ -235,6 +236,7 @@ pub struct Claim {
pub sector: SectorNumber,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Serialize_tuple, Deserialize_tuple, Clone, Debug, PartialEq, Eq)]
pub struct Allocation {
// The verified client which allocated the DataCap.
diff --git a/actors/verifreg/src/v9/types.rs b/actors/verifreg/src/v9/types.rs
index abacd59e..5fa0f4d2 100644
--- a/actors/verifreg/src/v9/types.rs
+++ b/actors/verifreg/src/v9/types.rs
@@ -18,6 +18,7 @@ use super::Claim;
pub type AllocationID = u64;
pub type ClaimID = u64;
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct VerifierParams {
pub address: Address,
@@ -35,6 +36,7 @@ pub type DataCap = StoragePower;
pub const SIGNATURE_DOMAIN_SEPARATION_REMOVE_DATA_CAP: &[u8] = b"fil_removedatacap:";
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapParams {
pub verified_client_to_remove: Address,
@@ -44,12 +46,14 @@ pub struct RemoveDataCapParams {
pub verifier_request_2: RemoveDataCapRequest,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapRequest {
pub verifier: Address,
pub signature: Signature,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapReturn {
pub verified_client: Address,
@@ -57,11 +61,13 @@ pub struct RemoveDataCapReturn {
pub data_cap_removed: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposalID {
pub id: u64,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveDataCapProposal {
pub verified_client: Address,
@@ -88,6 +94,7 @@ impl AddrPairKey {
}
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsParams {
// Client for which to remove expired allocations.
@@ -97,6 +104,7 @@ pub struct RemoveExpiredAllocationsParams {
pub allocation_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredAllocationsReturn {
// Ids of the allocations that were either specified by the caller or discovered to be expired.
@@ -108,6 +116,7 @@ pub struct RemoveExpiredAllocationsReturn {
pub datacap_recovered: DataCap,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorAllocationClaim {
pub client: ActorID,
@@ -118,12 +127,14 @@ pub struct SectorAllocationClaim {
pub sector_expiry: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
pub sectors: Vec,
pub all_or_nothing: bool,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
pub batch_info: BatchReturn,
@@ -131,6 +142,7 @@ pub struct ClaimAllocationsReturn {
pub claimed_space: BigInt,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimTerm {
pub provider: ActorID,
@@ -138,6 +150,7 @@ pub struct ClaimTerm {
pub term_max: ChainEpoch,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ExtendClaimTermsParams {
pub terms: Vec,
@@ -151,6 +164,7 @@ pub type ExtendClaimTermsReturn = BatchReturn;
// A request to create an allocation with datacap tokens.
// See Allocation state for description of field semantics.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequest {
pub provider: Address,
@@ -162,6 +176,7 @@ pub struct AllocationRequest {
}
// A request to extend the term of an existing claim with datacap tokens.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimExtensionRequest {
pub provider: Address,
@@ -171,6 +186,7 @@ pub struct ClaimExtensionRequest {
/// Operator-data payload for a datacap token transfer receiver hook specifying an allocation.
/// The implied client is the sender of the datacap.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationRequests {
pub allocations: Vec,
@@ -178,6 +194,7 @@ pub struct AllocationRequests {
}
/// Recipient data payload in response to a datacap token transfer.
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct AllocationsResponse {
// Result for each allocation request.
@@ -188,18 +205,21 @@ pub struct AllocationsResponse {
pub new_allocations: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsParams {
pub provider: ActorID,
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct GetClaimsReturn {
pub batch_info: BatchReturn,
pub claims: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsParams {
// Provider to clean up (need not be the caller)
@@ -209,6 +229,7 @@ pub struct RemoveExpiredClaimsParams {
pub claim_ids: Vec,
}
+#[cfg_attr(feature = "json", derive(fil_actor_json_derive::IntoJsonValue))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct RemoveExpiredClaimsReturn {
// Ids of the claims that were either specified by the caller or discovered to be expired.
diff --git a/actors/verifreg/tests/json_value_tests.rs b/actors/verifreg/tests/json_value_tests.rs
new file mode 100644
index 00000000..31af7587
--- /dev/null
+++ b/actors/verifreg/tests/json_value_tests.rs
@@ -0,0 +1,202 @@
+#![cfg(feature = "json")]
+
+//! Unit tests for `to_json_value()` on verifreg types across all versions.
+//! These test the derive macro output directly, independent of the decoder.
+
+use cid::Cid;
+use fvm_shared4::piece::PaddedPieceSize;
+use serde_json::Value;
+
+fn test_cid() -> Cid {
+ "bafkqaaa".parse::().unwrap()
+}
+
+/// Generate core verifreg tests for a version that has Allocation, Claim, and common types.
+/// Covers: field names, Cid→string, PaddedPieceSize→u64, ActorID→number, BigInt→string.
+macro_rules! test_verifreg_core {
+ ($mod_name:ident, $version:ident) => {
+ mod $mod_name {
+ use super::*;
+ use fil_actor_verifreg_state::$version;
+
+ #[test]
+ fn allocation_produces_named_fields() {
+ let alloc = $version::Allocation {
+ client: 1001,
+ provider: 2002,
+ data: test_cid(),
+ size: PaddedPieceSize(1 << 30),
+ term_min: 518400,
+ term_max: 1555200,
+ expiration: 4000000,
+ };
+ let json = alloc.to_json_value();
+ let obj = json.as_object().expect("expected JSON object");
+ assert_eq!(obj.len(), 7);
+ assert_eq!(obj["client"], serde_json::json!(1001));
+ assert_eq!(obj["provider"], serde_json::json!(2002));
+ assert!(obj["data"].is_string()); // Cid → string
+ assert_eq!(obj["size"], serde_json::json!(1 << 30)); // PaddedPieceSize → u64
+ }
+
+ #[test]
+ fn claim_produces_named_fields() {
+ let claim = $version::Claim {
+ provider: 3003,
+ client: 1001,
+ data: test_cid(),
+ size: PaddedPieceSize(1 << 20),
+ term_min: 518400,
+ term_max: 1555200,
+ term_start: 100000,
+ sector: 42,
+ };
+ let json = claim.to_json_value();
+ let obj = json.as_object().unwrap();
+ assert_eq!(obj.len(), 8);
+ assert_eq!(obj["sector"], serde_json::json!(42));
+ }
+
+ #[test]
+ fn extend_claim_terms_nested_vec() {
+ let params = $version::ExtendClaimTermsParams {
+ terms: vec![$version::ClaimTerm {
+ provider: 100,
+ claim_id: 1,
+ term_max: 999999,
+ }],
+ };
+ let json = params.to_json_value();
+ let terms = json.as_object().unwrap()["terms"].as_array().unwrap();
+ assert_eq!(terms.len(), 1);
+ let t0 = terms[0].as_object().unwrap();
+ assert_eq!(t0["provider"], serde_json::json!(100));
+ }
+ }
+ };
+}
+
+/// Test BigInt fields (VerifierParams.allowance has #[serde(with = "bigint_ser")])
+macro_rules! test_verifreg_bigint {
+ ($mod_name:ident, $version:ident) => {
+ mod $mod_name {
+ use super::*;
+ use fil_actor_verifreg_state::$version;
+ use fvm_shared4::bigint::BigInt;
+
+ #[test]
+ fn verifier_params_bigint_field() {
+ let params = $version::VerifierParams {
+ address: fvm_shared4::address::Address::new_id(555),
+ allowance: BigInt::from(1_000_000_000_000i64),
+ };
+ let json = params.to_json_value();
+ let obj = json.as_object().unwrap();
+ assert_eq!(obj["address"], Value::String("f0555".into()));
+ assert_eq!(obj["allowance"], Value::String("1000000000000".into()));
+ }
+
+ #[test]
+ fn sector_claim_summary_transparent_bigint() {
+ let summary = $version::SectorClaimSummary {
+ claimed_space: BigInt::from(34359738368i64),
+ };
+ assert_eq!(summary.to_json_value(), Value::String("34359738368".into()));
+ }
+ }
+ };
+}
+
+/// Test BatchReturn integration (nested in AllocationsResponse)
+macro_rules! test_verifreg_batch_return {
+ ($mod_name:ident, $version:ident, $shared_version:ident) => {
+ mod $mod_name {
+ use fil_actor_verifreg_state::$version;
+ use fil_actors_shared::$shared_version::BatchReturn;
+
+ #[test]
+ fn batch_return_nested_in_response() {
+ let resp = $version::AllocationsResponse {
+ allocation_results: BatchReturn::ok(3),
+ extension_results: BatchReturn::ok(0),
+ new_allocations: vec![10, 11, 12],
+ };
+ let json = resp.to_json_value();
+ let obj = json.as_object().unwrap();
+ let alloc_results = obj["allocation_results"].as_object().unwrap();
+ assert_eq!(alloc_results["success_count"], serde_json::json!(3));
+ assert!(alloc_results["fail_codes"].as_array().unwrap().is_empty());
+ let allocs = obj["new_allocations"].as_array().unwrap();
+ assert_eq!(
+ allocs,
+ &[
+ serde_json::json!(10),
+ serde_json::json!(11),
+ serde_json::json!(12)
+ ]
+ );
+ }
+ }
+ };
+}
+
+// v9-v11 use fvm_shared v2/v3 PaddedPieceSize — tested via decoder snapshot tests.
+// v12+ use fvm_shared4 types and can be tested directly here.
+test_verifreg_core!(v12_core, v12);
+test_verifreg_core!(v13_core, v13);
+test_verifreg_core!(v14_core, v14);
+test_verifreg_core!(v15_core, v15);
+test_verifreg_core!(v16_core, v16);
+test_verifreg_core!(v17_core, v17);
+
+// BigInt tests only for v12+ (v9-v11 VerifierParams use different fvm_shared Address types)
+test_verifreg_bigint!(v12_bigint, v12);
+test_verifreg_bigint!(v13_bigint, v13);
+test_verifreg_bigint!(v14_bigint, v14);
+test_verifreg_bigint!(v15_bigint, v15);
+test_verifreg_bigint!(v16_bigint, v16);
+test_verifreg_bigint!(v17_bigint, v17);
+
+// BatchReturn tests — v9-v11 use fvm_shared v2/v3, tested via decoder snapshots.
+test_verifreg_batch_return!(v12_batch, v12, v12);
+test_verifreg_batch_return!(v13_batch, v13, v13);
+test_verifreg_batch_return!(v14_batch, v14, v14);
+test_verifreg_batch_return!(v15_batch, v15, v15);
+test_verifreg_batch_return!(v16_batch, v16, v16);
+test_verifreg_batch_return!(v17_batch, v17, v17);
+
+/// Cross-version equivalence for v12-v17 (all CBOR-identical)
+#[test]
+fn v12_through_v17_allocation_produce_same_output() {
+ let cid = test_cid();
+ let expected = fil_actor_verifreg_state::v17::Allocation {
+ client: 1001,
+ provider: 2002,
+ data: cid,
+ size: PaddedPieceSize(1 << 30),
+ term_min: 518400,
+ term_max: 1555200,
+ expiration: 4000000,
+ }
+ .to_json_value();
+
+ macro_rules! assert_alloc_eq {
+ ($ver:ident) => {
+ let a = fil_actor_verifreg_state::$ver::Allocation {
+ client: 1001,
+ provider: 2002,
+ data: cid,
+ size: PaddedPieceSize(1 << 30),
+ term_min: 518400,
+ term_max: 1555200,
+ expiration: 4000000,
+ };
+ assert_eq!(a.to_json_value(), expected, "{} mismatch", stringify!($ver));
+ };
+ }
+ assert_alloc_eq!(v12);
+ assert_alloc_eq!(v13);
+ assert_alloc_eq!(v14);
+ assert_alloc_eq!(v15);
+ assert_alloc_eq!(v16);
+}
diff --git a/fil_actor_decoder/Cargo.toml b/fil_actor_decoder/Cargo.toml
new file mode 100644
index 00000000..e0cf043f
--- /dev/null
+++ b/fil_actor_decoder/Cargo.toml
@@ -0,0 +1,30 @@
+[package]
+name = "fil_actor_decoder"
+version = "0.1.0"
+edition.workspace = true
+license.workspace = true
+repository.workspace = true
+description = "Decode Filecoin built-in actor params and returns from raw CBOR bytes to JSON"
+
+[dependencies]
+anyhow = { workspace = true }
+base64 = { workspace = true }
+cid = { workspace = true }
+clap = { version = "4", features = ["derive"] }
+frc42_dispatch = { workspace = true }
+fvm_ipld_encoding = { workspace = true }
+fvm_shared4 = { workspace = true }
+hex = "0.4"
+num-bigint = { workspace = true }
+serde_json = { workspace = true }
+
+fil_actor_datacap_state = { workspace = true, features = ["json"] }
+fil_actor_verifreg_state = { workspace = true, features = ["json"] }
+fil_actors_shared = { workspace = true, features = ["json"] }
+
+[dev-dependencies]
+insta = { version = "1", features = ["json"] }
+
+[[bin]]
+name = "fil-decode"
+path = "src/bin/fil_decode.rs"
diff --git a/fil_actor_decoder/README.md b/fil_actor_decoder/README.md
new file mode 100644
index 00000000..45a3c056
--- /dev/null
+++ b/fil_actor_decoder/README.md
@@ -0,0 +1,131 @@
+# fil_actor_decoder
+
+Decode Filecoin built-in actor params and returns from raw CBOR to JSON.
+
+Supports **datacap** (f07) and **verifreg** (f06) actors across all versions (v9-v17).
+
+## CLI
+
+```
+fil-decode
+
+Commands:
+ params Decode method params
+ return Decode method return value
+```
+
+### Examples
+
+Decode by explicit version:
+
+```sh
+fil-decode params \
+ --actor verifreg --method 4 --version v17 \
+ --hex 825501eb50a2528a325eadc4bb68d975a4d1700c9eeaa3480001900000000000
+```
+
+```json
+{
+ "address": "f15nikeuukgjpk3rf3ndmxljgroagj52vdgznkcwy",
+ "allowance": "439804651110400"
+}
+```
+
+Resolve version from network + epoch:
+
+```sh
+fil-decode params \
+ --actor verifreg --method 4 \
+ --network mainnet --epoch 5844742 \
+ --hex 825501eb50a2528a325eadc4bb68d975a4d1700c9eeaa3480001900000000000
+```
+
+Decode params with a different actor and method:
+
+```sh
+fil-decode params \
+ --actor verifreg --method 8 --version v17 \
+ --hex 821a00303d2980
+```
+
+```json
+{
+ "allocation_ids": [],
+ "client": 3161385
+}
+```
+
+### Sourcing CBOR hex
+
+From Filecoin JSON-RPC (`Filecoin.ChainGetMessage` for params, `Filecoin.StateReplay` for returns):
+
+```sh
+curl -s -X POST https://filfox.info/rpc/v1 \
+ -H 'Content-Type: application/json' \
+ -d '{"jsonrpc":"2.0","method":"Filecoin.ChainGetMessage","params":[{"/":"bafy2bzacebr2jvq..."}],"id":1}'
+```
+
+The `Params` field in the response is base64-encoded CBOR.
+
+## Library API (unstable)
+
+> **Note:** This is a POC. The library API is not stable and should not be depended on yet.
+> Use the CLI for now; the Rust API will be finalized in a later iteration.
+
+```rust
+use fil_actor_decoder::{ActorType, ActorVersion, decode_params, decode_return};
+
+let json = decode_params(
+ ActorType::VerifiedRegistry,
+ ActorVersion::V17,
+ 4, // method number
+ &cbor_bytes,
+)?;
+```
+
+Network/epoch resolution:
+
+```rust
+use fil_actor_decoder::network::{Network, resolve_actor_version};
+
+let version = resolve_actor_version(Network::Mainnet, 5_844_742)?;
+```
+
+## Version support
+
+| Actor | Versions | Method numbers |
+|-------|----------|---------------|
+| datacap (f07) | v9: legacy (Mint=2..Allowance=21) | v10+: FRC-0042 hashes |
+| verifreg (f06) | v9+: numeric + FRC-0042 | v12+: nested SectorAllocationClaims |
+
+Key structural differences between versions:
+- **datacap v9** has only MintParams/DestroyParams; v10 adds GranularityReturn; v12+ has full type set
+- **verifreg v9** uses flat `SectorAllocationClaim` and `Address`-based providers
+- **verifreg v10-v11** uses flat `SectorAllocationClaim` with `ActorID`-based providers
+- **verifreg v12+** uses nested `SectorAllocationClaims` (CBOR-identical across v12-v17)
+
+## Directory structure
+
+```
+fil_actor_decoder/
+ src/
+ actors/ # Per-actor decoders (datacap, verifreg) with version dispatch
+ bin/ # CLI binary
+ tests/
+ fixtures/ # Large CBOR hex fixtures
+ snapshots/ # Insta snapshot files
+```
+
+## Development
+
+All tasks are wired through [mise](https://mise.jdx.dev/). Run from the workspace root (`fil-actor-states/`):
+
+```sh
+mise run decoder:test # unit + snapshot tests
+mise run decoder:test-all # above + type-level JSON tests across all actor versions
+mise run decoder:clippy # lint decoder + shared crates
+mise run decoder:snap-review # review pending snapshot changes
+mise run decoder:snap-accept # accept all pending snapshot changes
+```
+
+Snapshot tests use both real on-chain CBOR (sourced via filfox RPC) and synthetic data constructed from actual Filecoin types.
diff --git a/fil_actor_decoder/src/actors/datacap.rs b/fil_actor_decoder/src/actors/datacap.rs
new file mode 100644
index 00000000..47de0d48
--- /dev/null
+++ b/fil_actor_decoder/src/actors/datacap.rs
@@ -0,0 +1,495 @@
+//! DataCap actor (f07) param and return decoder.
+//!
+//! Supports all actor versions:
+//! - v9: legacy method numbers (Mint=2, ..., Allowance=21), only MintParams/DestroyParams types
+//! - v10-v11: FRC-0042 method hashes, MintParams/DestroyParams/GranularityReturn
+//! - v12-v17: FRC-0042 method hashes, full type set (13 structs, CBOR-identical across versions)
+
+use crate::ActorVersion;
+use crate::actors::{cbor_to_json, decode_empty_param};
+use anyhow::{Result, bail};
+use fvm_ipld_encoding::RawBytes;
+use fvm_shared4::address::Address;
+use fvm_shared4::econ::TokenAmount;
+use serde_json::{Value, json};
+
+// ---------------------------------------------------------------------------
+// JSON helpers for frc46_token types (external — no to_json_value())
+// ---------------------------------------------------------------------------
+
+fn addr_json(a: &Address) -> Value {
+ Value::String(a.to_string())
+}
+
+fn token_json(t: &TokenAmount) -> Value {
+ Value::String(t.atto().to_string())
+}
+
+fn raw_bytes_json(rb: &RawBytes) -> Value {
+ use base64::Engine;
+ Value::String(base64::engine::general_purpose::STANDARD.encode(rb.bytes()))
+}
+
+fn try_decode_nested(payload_type: &str, rb: &RawBytes) -> Value {
+ if rb.bytes().is_empty() {
+ return json!("");
+ }
+ if let Ok(decoded) = crate::actors::verifreg::decode_nested_payload(payload_type, rb.bytes()) {
+ return decoded;
+ }
+ raw_bytes_json(rb)
+}
+
+// ---------------------------------------------------------------------------
+// Method numbers
+// ---------------------------------------------------------------------------
+
+/// FRC-0042 method numbers (v10+)
+mod methods {
+ pub const CONSTRUCTOR: u64 = 1;
+ pub const MINT: u64 = frc42_dispatch::method_hash!("Mint");
+ pub const DESTROY: u64 = frc42_dispatch::method_hash!("Destroy");
+ pub const NAME: u64 = frc42_dispatch::method_hash!("Name");
+ pub const SYMBOL: u64 = frc42_dispatch::method_hash!("Symbol");
+ pub const GRANULARITY: u64 = frc42_dispatch::method_hash!("Granularity");
+ pub const TOTAL_SUPPLY: u64 = frc42_dispatch::method_hash!("TotalSupply");
+ pub const BALANCE: u64 = frc42_dispatch::method_hash!("Balance");
+ pub const TRANSFER: u64 = frc42_dispatch::method_hash!("Transfer");
+ pub const TRANSFER_FROM: u64 = frc42_dispatch::method_hash!("TransferFrom");
+ pub const INCREASE_ALLOWANCE: u64 = frc42_dispatch::method_hash!("IncreaseAllowance");
+ pub const DECREASE_ALLOWANCE: u64 = frc42_dispatch::method_hash!("DecreaseAllowance");
+ pub const REVOKE_ALLOWANCE: u64 = frc42_dispatch::method_hash!("RevokeAllowance");
+ pub const BURN: u64 = frc42_dispatch::method_hash!("Burn");
+ pub const BURN_FROM: u64 = frc42_dispatch::method_hash!("BurnFrom");
+ pub const ALLOWANCE: u64 = frc42_dispatch::method_hash!("Allowance");
+}
+
+/// Legacy method numbers (v9 only)
+mod v9_methods {
+ pub const CONSTRUCTOR: u64 = 0;
+ pub const MINT: u64 = 2;
+ pub const DESTROY: u64 = 3;
+ pub const NAME: u64 = 10;
+ pub const SYMBOL: u64 = 11;
+ pub const TOTAL_SUPPLY: u64 = 12;
+ pub const BALANCE_OF: u64 = 13;
+ pub const TRANSFER: u64 = 14;
+ pub const TRANSFER_FROM: u64 = 15;
+ pub const INCREASE_ALLOWANCE: u64 = 16;
+ pub const DECREASE_ALLOWANCE: u64 = 17;
+ pub const REVOKE_ALLOWANCE: u64 = 18;
+ pub const BURN: u64 = 19;
+ pub const BURN_FROM: u64 = 20;
+ pub const ALLOWANCE: u64 = 21;
+}
+
+// ---------------------------------------------------------------------------
+// frc46_token type decoders (external — no derive)
+// ---------------------------------------------------------------------------
+
+fn decode_transfer_params(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::TransferParams;
+ let p: TransferParams = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({
+ "to": addr_json(&p.to),
+ "amount": token_json(&p.amount),
+ "operator_data": try_decode_nested("allocation-requests", &p.operator_data),
+ }))
+}
+
+fn decode_transfer_from_params(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::TransferFromParams;
+ let p: TransferFromParams = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({
+ "from": addr_json(&p.from),
+ "to": addr_json(&p.to),
+ "amount": token_json(&p.amount),
+ "operator_data": try_decode_nested("allocation-requests", &p.operator_data),
+ }))
+}
+
+fn decode_increase_allowance_params(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::IncreaseAllowanceParams;
+ let p: IncreaseAllowanceParams = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({
+ "operator": addr_json(&p.operator),
+ "increase": token_json(&p.increase),
+ }))
+}
+
+fn decode_decrease_allowance_params(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::DecreaseAllowanceParams;
+ let p: DecreaseAllowanceParams = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({
+ "operator": addr_json(&p.operator),
+ "decrease": token_json(&p.decrease),
+ }))
+}
+
+fn decode_revoke_allowance_params(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::RevokeAllowanceParams;
+ let p: RevokeAllowanceParams = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({ "operator": addr_json(&p.operator) }))
+}
+
+fn decode_burn_params(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::BurnParams;
+ let p: BurnParams = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({ "amount": token_json(&p.amount) }))
+}
+
+fn decode_burn_from_params(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::BurnFromParams;
+ let p: BurnFromParams = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({
+ "owner": addr_json(&p.owner),
+ "amount": token_json(&p.amount),
+ }))
+}
+
+fn decode_get_allowance_params(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::GetAllowanceParams;
+ let p: GetAllowanceParams = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({
+ "owner": addr_json(&p.owner),
+ "operator": addr_json(&p.operator),
+ }))
+}
+
+fn decode_transfer_return(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::TransferReturn;
+ let r: TransferReturn = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({
+ "from_balance": token_json(&r.from_balance),
+ "to_balance": token_json(&r.to_balance),
+ "recipient_data": try_decode_nested("allocations-response", &r.recipient_data),
+ }))
+}
+
+fn decode_transfer_from_return(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::TransferFromReturn;
+ let r: TransferFromReturn = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({
+ "from_balance": token_json(&r.from_balance),
+ "to_balance": token_json(&r.to_balance),
+ "allowance": token_json(&r.allowance),
+ "recipient_data": try_decode_nested("allocations-response", &r.recipient_data),
+ }))
+}
+
+fn decode_burn_return(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::BurnReturn;
+ let r: BurnReturn = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({ "balance": token_json(&r.balance) }))
+}
+
+fn decode_burn_from_return(bytes: &[u8]) -> Result {
+ use fil_actors_shared::frc46_token::token::types::BurnFromReturn;
+ let r: BurnFromReturn = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({
+ "balance": token_json(&r.balance),
+ "allowance": token_json(&r.allowance),
+ }))
+}
+
+fn decode_allowance_return(bytes: &[u8]) -> Result {
+ let r: TokenAmount = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!({ "allowance": token_json(&r) }))
+}
+
+// ---------------------------------------------------------------------------
+// Version-specific dispatch helpers
+// ---------------------------------------------------------------------------
+
+/// Decode params for v9 (legacy method numbers, only MintParams/DestroyParams types).
+fn decode_params_v9(method_num: u64, bytes: &[u8]) -> Result {
+ use v9_methods::*;
+ match method_num {
+ MINT => cbor_to_json!(fil_actor_datacap_state::v9::MintParams, bytes),
+ DESTROY => cbor_to_json!(fil_actor_datacap_state::v9::DestroyParams, bytes),
+ // frc46_token types (shared across versions)
+ TRANSFER => decode_transfer_params(bytes),
+ TRANSFER_FROM => decode_transfer_from_params(bytes),
+ INCREASE_ALLOWANCE => decode_increase_allowance_params(bytes),
+ DECREASE_ALLOWANCE => decode_decrease_allowance_params(bytes),
+ REVOKE_ALLOWANCE => decode_revoke_allowance_params(bytes),
+ BURN => decode_burn_params(bytes),
+ BURN_FROM => decode_burn_from_params(bytes),
+ ALLOWANCE => decode_get_allowance_params(bytes),
+ BALANCE_OF => {
+ // v9 BalanceOf takes a raw Address (no wrapper type)
+ let addr: fvm_shared4::address::Address = fvm_ipld_encoding::from_slice(bytes)?;
+ Ok(json!(addr.to_string()))
+ }
+ CONSTRUCTOR | NAME | SYMBOL | TOTAL_SUPPLY => decode_empty_param(bytes),
+ _ => bail!("Unknown datacap v9 method number: {method_num}"),
+ }
+}
+
+/// Decode returns for v9 (legacy method numbers).
+fn decode_return_v9(method_num: u64, bytes: &[u8]) -> Result {
+ use v9_methods::*;
+ match method_num {
+ TRANSFER => decode_transfer_return(bytes),
+ TRANSFER_FROM => decode_transfer_from_return(bytes),
+ BURN => decode_burn_return(bytes),
+ BURN_FROM => decode_burn_from_return(bytes),
+ INCREASE_ALLOWANCE | DECREASE_ALLOWANCE | REVOKE_ALLOWANCE | ALLOWANCE => {
+ decode_allowance_return(bytes)
+ }
+ // v9 has no typed returns for Name/Symbol/TotalSupply/Balance — raw value
+ MINT | DESTROY | CONSTRUCTOR | NAME | SYMBOL | TOTAL_SUPPLY | BALANCE_OF => {
+ decode_empty_param(bytes)
+ }
+ _ => bail!("Return decoding not implemented for datacap v9 method {method_num}"),
+ }
+}
+
+/// Decode params for v10-v11 (FRC-0042 hashes, limited types).
+/// MintParams/DestroyParams available; other typed params don't exist yet.
+fn decode_params_v10(method_num: u64, bytes: &[u8]) -> Result {
+ use methods::*;
+ match method_num {
+ // v10 has MintParams, DestroyParams (CBOR-identical to v12+)
+ MINT => cbor_to_json!(fil_actor_datacap_state::v10::MintParams, bytes),
+ DESTROY => cbor_to_json!(fil_actor_datacap_state::v10::DestroyParams, bytes),
+ // frc46_token types (shared across versions)
+ TRANSFER => decode_transfer_params(bytes),
+ TRANSFER_FROM => decode_transfer_from_params(bytes),
+ INCREASE_ALLOWANCE => decode_increase_allowance_params(bytes),
+ DECREASE_ALLOWANCE => decode_decrease_allowance_params(bytes),
+ REVOKE_ALLOWANCE => decode_revoke_allowance_params(bytes),
+ BURN => decode_burn_params(bytes),
+ BURN_FROM => decode_burn_from_params(bytes),
+ ALLOWANCE => decode_get_allowance_params(bytes),
+ // v10-v11 has no ConstructorParams, BalanceParams — treat as raw
+ CONSTRUCTOR | BALANCE | NAME | SYMBOL | TOTAL_SUPPLY | GRANULARITY => {
+ decode_empty_param(bytes)
+ }
+ _ => bail!("Unknown datacap v10 method number: {method_num}"),
+ }
+}
+
+/// Decode returns for v10-v11 (FRC-0042 hashes, limited return types).
+fn decode_return_v10(method_num: u64, bytes: &[u8]) -> Result {
+ use methods::*;
+ match method_num {
+ // v10 added GranularityReturn
+ GRANULARITY => cbor_to_json!(fil_actor_datacap_state::v10::GranularityReturn, bytes),
+ TRANSFER => decode_transfer_return(bytes),
+ TRANSFER_FROM => decode_transfer_from_return(bytes),
+ BURN => decode_burn_return(bytes),
+ BURN_FROM => decode_burn_from_return(bytes),
+ INCREASE_ALLOWANCE | DECREASE_ALLOWANCE | REVOKE_ALLOWANCE | ALLOWANCE => {
+ decode_allowance_return(bytes)
+ }
+ // v10-v11 has no NameReturn/SymbolReturn/etc. — treat as raw
+ MINT | DESTROY | CONSTRUCTOR | NAME | SYMBOL | TOTAL_SUPPLY | BALANCE => {
+ decode_empty_param(bytes)
+ }
+ _ => bail!("Return decoding not implemented for datacap v10 method {method_num}"),
+ }
+}
+
+/// Decode params for v12+ (FRC-0042 hashes, full type set).
+/// v12-v17 types are CBOR-identical; we use v17 types for all.
+fn decode_params_v12plus(method_num: u64, bytes: &[u8]) -> Result {
+ use methods::*;
+ match method_num {
+ CONSTRUCTOR => cbor_to_json!(fil_actor_datacap_state::v17::ConstructorParams, bytes),
+ BALANCE => cbor_to_json!(fil_actor_datacap_state::v17::BalanceParams, bytes),
+ MINT => cbor_to_json!(fil_actor_datacap_state::v17::MintParams, bytes),
+ DESTROY => cbor_to_json!(fil_actor_datacap_state::v17::DestroyParams, bytes),
+ TRANSFER => decode_transfer_params(bytes),
+ TRANSFER_FROM => decode_transfer_from_params(bytes),
+ INCREASE_ALLOWANCE => decode_increase_allowance_params(bytes),
+ DECREASE_ALLOWANCE => decode_decrease_allowance_params(bytes),
+ REVOKE_ALLOWANCE => decode_revoke_allowance_params(bytes),
+ BURN => decode_burn_params(bytes),
+ BURN_FROM => decode_burn_from_params(bytes),
+ ALLOWANCE => decode_get_allowance_params(bytes),
+ NAME | SYMBOL | TOTAL_SUPPLY | GRANULARITY => decode_empty_param(bytes),
+ _ => bail!("Unknown datacap method number: {method_num}"),
+ }
+}
+
+/// Decode returns for v12+ (FRC-0042 hashes, full return types).
+fn decode_return_v12plus(method_num: u64, bytes: &[u8]) -> Result {
+ use methods::*;
+ match method_num {
+ NAME => cbor_to_json!(fil_actor_datacap_state::v17::NameReturn, bytes),
+ SYMBOL => cbor_to_json!(fil_actor_datacap_state::v17::SymbolReturn, bytes),
+ TOTAL_SUPPLY => cbor_to_json!(fil_actor_datacap_state::v17::TotalSupplyReturn, bytes),
+ BALANCE => cbor_to_json!(fil_actor_datacap_state::v17::BalanceReturn, bytes),
+ GRANULARITY => cbor_to_json!(fil_actor_datacap_state::v17::GranularityReturn, bytes),
+ TRANSFER => decode_transfer_return(bytes),
+ TRANSFER_FROM => decode_transfer_from_return(bytes),
+ BURN => decode_burn_return(bytes),
+ BURN_FROM => decode_burn_from_return(bytes),
+ MINT | DESTROY | CONSTRUCTOR => decode_empty_param(bytes),
+ INCREASE_ALLOWANCE | DECREASE_ALLOWANCE | REVOKE_ALLOWANCE | ALLOWANCE => {
+ decode_allowance_return(bytes)
+ }
+ _ => bail!("Return decoding not implemented for datacap method {method_num}"),
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Public API
+// ---------------------------------------------------------------------------
+
+pub fn decode_params(version: ActorVersion, method_num: u64, bytes: &[u8]) -> Result {
+ match version {
+ ActorVersion::V9 => decode_params_v9(method_num, bytes),
+ ActorVersion::V10 => decode_params_v10(method_num, bytes),
+ // v11+ has the full type set; CBOR encoding is version-independent
+ ActorVersion::V11
+ | ActorVersion::V12
+ | ActorVersion::V13
+ | ActorVersion::V14
+ | ActorVersion::V15
+ | ActorVersion::V16
+ | ActorVersion::V17 => decode_params_v12plus(method_num, bytes),
+ }
+}
+
+pub fn decode_return(version: ActorVersion, method_num: u64, bytes: &[u8]) -> Result {
+ match version {
+ ActorVersion::V9 => decode_return_v9(method_num, bytes),
+ ActorVersion::V10 => decode_return_v10(method_num, bytes),
+ ActorVersion::V11
+ | ActorVersion::V12
+ | ActorVersion::V13
+ | ActorVersion::V14
+ | ActorVersion::V15
+ | ActorVersion::V16
+ | ActorVersion::V17 => decode_return_v12plus(method_num, bytes),
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Method name lookup
+// ---------------------------------------------------------------------------
+
+pub fn method_name(method_num: u64) -> &'static str {
+ match method_num {
+ // Legacy v9 method numbers
+ v9_methods::CONSTRUCTOR => "Constructor",
+ v9_methods::MINT => "Mint",
+ v9_methods::DESTROY => "Destroy",
+ v9_methods::NAME => "Name",
+ v9_methods::SYMBOL => "Symbol",
+ v9_methods::TOTAL_SUPPLY => "TotalSupply",
+ v9_methods::BALANCE_OF => "BalanceOf",
+ v9_methods::TRANSFER => "Transfer",
+ v9_methods::TRANSFER_FROM => "TransferFrom",
+ v9_methods::INCREASE_ALLOWANCE => "IncreaseAllowance",
+ v9_methods::DECREASE_ALLOWANCE => "DecreaseAllowance",
+ v9_methods::REVOKE_ALLOWANCE => "RevokeAllowance",
+ v9_methods::BURN => "Burn",
+ v9_methods::BURN_FROM => "BurnFrom",
+ v9_methods::ALLOWANCE => "Allowance",
+ // v10+ constructor
+ methods::CONSTRUCTOR => "Constructor",
+ // FRC-0042 method hashes
+ m if m == methods::MINT => "Mint",
+ m if m == methods::DESTROY => "Destroy",
+ m if m == methods::NAME => "Name",
+ m if m == methods::SYMBOL => "Symbol",
+ m if m == methods::GRANULARITY => "Granularity",
+ m if m == methods::TOTAL_SUPPLY => "TotalSupply",
+ m if m == methods::BALANCE => "Balance",
+ m if m == methods::TRANSFER => "Transfer",
+ m if m == methods::TRANSFER_FROM => "TransferFrom",
+ m if m == methods::INCREASE_ALLOWANCE => "IncreaseAllowance",
+ m if m == methods::DECREASE_ALLOWANCE => "DecreaseAllowance",
+ m if m == methods::REVOKE_ALLOWANCE => "RevokeAllowance",
+ m if m == methods::BURN => "Burn",
+ m if m == methods::BURN_FROM => "BurnFrom",
+ m if m == methods::ALLOWANCE => "Allowance",
+ _ => "Unknown",
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use fvm_ipld_encoding::to_vec;
+
+ #[test]
+ fn test_decode_mint_params_v17() {
+ let params = fil_actor_datacap_state::v17::MintParams {
+ to: Address::new_id(1234),
+ amount: TokenAmount::from_atto(1_000_000_000_000_000_000_i64),
+ operators: vec![Address::new_id(5678)],
+ };
+ let cbor = to_vec(¶ms).unwrap();
+ let result = decode_params(ActorVersion::V17, methods::MINT, &cbor).unwrap();
+ assert_eq!(result["to"], "f01234");
+ assert_eq!(result["amount"], "1000000000000000000");
+ assert_eq!(result["operators"][0], "f05678");
+ }
+
+ #[test]
+ fn test_decode_mint_params_v9() {
+ // v9 uses fvm_shared v2 Address — construct via cbor roundtrip from v17
+ let params_v17 = fil_actor_datacap_state::v17::MintParams {
+ to: Address::new_id(1234),
+ amount: TokenAmount::from_atto(1_000_000_000_000_000_000_i64),
+ operators: vec![Address::new_id(5678)],
+ };
+ // CBOR encoding is identical between v9 and v17 MintParams
+ let cbor = to_vec(¶ms_v17).unwrap();
+ let result = decode_params(ActorVersion::V9, v9_methods::MINT, &cbor).unwrap();
+ assert_eq!(result["to"], "f01234");
+ }
+
+ #[test]
+ fn test_decode_destroy_params() {
+ let params = fil_actor_datacap_state::v17::DestroyParams {
+ owner: Address::new_id(100),
+ amount: TokenAmount::from_atto(500),
+ };
+ let cbor = to_vec(¶ms).unwrap();
+ let result = decode_params(ActorVersion::V17, methods::DESTROY, &cbor).unwrap();
+ assert_eq!(result["owner"], "f0100");
+ assert_eq!(result["amount"], "500");
+ }
+
+ #[test]
+ fn test_decode_empty_params() {
+ let result = decode_params(ActorVersion::V17, methods::NAME, &[]).unwrap();
+ assert_eq!(result, json!({}));
+ }
+
+ #[test]
+ fn test_decode_balance_params() {
+ let params = fil_actor_datacap_state::v17::BalanceParams {
+ address: Address::new_id(42),
+ };
+ let cbor = to_vec(¶ms).unwrap();
+ let result = decode_params(ActorVersion::V17, methods::BALANCE, &cbor).unwrap();
+ assert_eq!(result, json!("f042"));
+ }
+
+ #[test]
+ fn test_v12_uses_v12plus_dispatch() {
+ // v12 should use the same dispatch as v17
+ let result = decode_params(ActorVersion::V12, methods::NAME, &[]).unwrap();
+ assert_eq!(result, json!({}));
+ }
+
+ #[test]
+ fn test_unknown_method_error() {
+ assert!(decode_params(ActorVersion::V17, 99999, &[]).is_err());
+ }
+
+ #[test]
+ fn test_method_name() {
+ assert_eq!(method_name(methods::TRANSFER), "Transfer");
+ assert_eq!(method_name(methods::MINT), "Mint");
+ assert_eq!(method_name(v9_methods::MINT), "Mint");
+ assert_eq!(method_name(v9_methods::BALANCE_OF), "BalanceOf");
+ assert_eq!(method_name(99999), "Unknown");
+ }
+}
diff --git a/fil_actor_decoder/src/actors/mod.rs b/fil_actor_decoder/src/actors/mod.rs
new file mode 100644
index 00000000..7c5857b0
--- /dev/null
+++ b/fil_actor_decoder/src/actors/mod.rs
@@ -0,0 +1,22 @@
+pub mod datacap;
+pub mod verifreg;
+
+use anyhow::Result;
+use serde_json::{Value, json};
+
+macro_rules! cbor_to_json {
+ ($ty:ty, $bytes:expr) => {{
+ let val: $ty = fvm_ipld_encoding::from_slice($bytes)?;
+ Ok(val.to_json_value())
+ }};
+}
+pub(crate) use cbor_to_json;
+
+pub(crate) fn decode_empty_param(bytes: &[u8]) -> Result {
+ if bytes.is_empty() {
+ Ok(json!({}))
+ } else {
+ use base64::Engine;
+ Ok(json!({ "raw": base64::engine::general_purpose::STANDARD.encode(bytes) }))
+ }
+}
diff --git a/fil_actor_decoder/src/actors/verifreg.rs b/fil_actor_decoder/src/actors/verifreg.rs
new file mode 100644
index 00000000..c5f9b36b
--- /dev/null
+++ b/fil_actor_decoder/src/actors/verifreg.rs
@@ -0,0 +1,382 @@
+//! Verified Registry actor (f06) param and return decoder.
+//!
+//! Supports all actor versions:
+//! - v9: numeric + FRC-0042 methods, flat SectorAllocationClaim, Address-based provider
+//! - v10-v11: same methods, flat SectorAllocationClaim, ActorID-based provider
+//! - v12-v17: same methods, nested SectorAllocationClaims (CBOR-identical across v12-v17)
+
+use crate::ActorVersion;
+use crate::actors::{cbor_to_json, decode_empty_param};
+use anyhow::{Result, bail};
+use serde_json::Value;
+
+// ---------------------------------------------------------------------------
+// Method numbers (shared across v9-v17)
+// ---------------------------------------------------------------------------
+
+mod methods {
+ pub const CONSTRUCTOR: u64 = 0;
+ pub const ADD_VERIFIER: u64 = 2;
+ pub const REMOVE_VERIFIER: u64 = 3;
+ pub const ADD_VERIFIED_CLIENT: u64 = 4;
+ pub const REMOVE_VERIFIED_CLIENT_DATA_CAP: u64 = 7;
+ pub const REMOVE_EXPIRED_ALLOCATIONS: u64 = 8;
+ pub const CLAIM_ALLOCATIONS: u64 = 9;
+ pub const GET_CLAIMS: u64 = 10;
+ pub const EXTEND_CLAIM_TERMS: u64 = 11;
+ pub const REMOVE_EXPIRED_CLAIMS: u64 = 12;
+
+ // FRC-0042 exported methods
+ pub const ADD_VERIFIED_CLIENT_EXPORTED: u64 = frc42_dispatch::method_hash!("AddVerifiedClient");
+ pub const REMOVE_EXPIRED_ALLOCATIONS_EXPORTED: u64 =
+ frc42_dispatch::method_hash!("RemoveExpiredAllocations");
+ pub const GET_CLAIMS_EXPORTED: u64 = frc42_dispatch::method_hash!("GetClaims");
+ pub const EXTEND_CLAIM_TERMS_EXPORTED: u64 = frc42_dispatch::method_hash!("ExtendClaimTerms");
+ pub const REMOVE_EXPIRED_CLAIMS_EXPORTED: u64 =
+ frc42_dispatch::method_hash!("RemoveExpiredClaims");
+ pub const UNIVERSAL_RECEIVER_HOOK: u64 = frc42_dispatch::method_hash!("Receive");
+}
+
+/// Decode nested payloads found inside operator_data / recipient_data.
+/// Uses v17 types (CBOR-identical for v12+; v9-v11 have different AllocationRequests
+/// but we attempt v17 first and fall back gracefully in the caller).
+pub fn decode_nested_payload(payload_type: &str, bytes: &[u8]) -> Result {
+ match payload_type {
+ "allocation-requests" => {
+ cbor_to_json!(fil_actor_verifreg_state::v17::AllocationRequests, bytes)
+ }
+ "allocations-response" => {
+ cbor_to_json!(fil_actor_verifreg_state::v17::AllocationsResponse, bytes)
+ }
+ _ => bail!("Unknown nested payload type: {payload_type}"),
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Version-specific dispatch: params
+// ---------------------------------------------------------------------------
+
+/// Shared params that are identical across v9-v17 (same CBOR layout).
+fn decode_shared_params(method_num: u64, bytes: &[u8]) -> Result