Skip to content

Commit 9762e9e

Browse files
committed
proto: implement json rendering of move values
Using the move layout Visitor infrastructure, implement json rendering of arbitrary move values which can then be embedded in protobuf messages using google.protobuf.Value.
1 parent 9f55489 commit 9762e9e

File tree

5 files changed

+923
-1
lines changed

5 files changed

+923
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/sui-types/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ async-trait.workspace = true
1414
anemo.workspace = true
1515
anyhow.workspace = true
1616
bincode.workspace = true
17+
base64.workspace = true
1718
bcs.workspace = true
1819
byteorder.workspace = true
1920
bytes.workspace = true
@@ -26,6 +27,7 @@ nonempty.workspace = true
2627
once_cell.workspace = true
2728
prometheus.workspace = true
2829
prost.workspace = true
30+
prost-types.workspace = true
2931
rand.workspace = true
3032
serde.workspace = true
3133
serde-name.workspace = true

crates/sui-types/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub mod nitro_attestation;
7373
pub mod object;
7474
pub mod passkey_authenticator;
7575
pub mod programmable_transaction_builder;
76+
pub mod proto_value;
7677
pub mod quorum_driver_types;
7778
pub mod randomness_state;
7879
pub mod signature;

crates/sui-types/src/object/bounded_visitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ pub(crate) mod tests {
557557
}
558558

559559
/// BCS encode Move value.
560-
fn serialize(value: A::MoveValue) -> Vec<u8> {
560+
pub(crate) fn serialize(value: A::MoveValue) -> Vec<u8> {
561561
value.clone().undecorate().simple_serialize().unwrap()
562562
}
563563
}

0 commit comments

Comments
 (0)