Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: use base64 for display #20488

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/sui-json-rpc-types/src/sui_event.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use fastcrypto::encoding::{Base58, Base64};
use fastcrypto::encoding::Base64;
use move_core_types::annotated_value::MoveDatatypeLayout;
use move_core_types::identifier::Identifier;
use move_core_types::language_storage::StructTag;
Expand Down Expand Up @@ -51,9 +51,9 @@ pub struct SuiEvent {
pub type_: StructTag,
/// Parsed json value of the event
pub parsed_json: Value,
#[serde_as(as = "Base58")]
#[schemars(with = "Base58")]
/// Base 58 encoded bcs bytes of the move event
#[serde_as(as = "Base64")]
#[schemars(with = "Base64")]
/// Base64 encoded bcs bytes of the move event
pub bcs: Vec<u8>,
/// UTC timestamp in milliseconds since epoch (1/1/1970)
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
12 changes: 6 additions & 6 deletions crates/sui-open-rpc/spec/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3553,7 +3553,7 @@
"type": "0x0000000000000000000000000000000000000000000000000000000000000009::test::TestField",
"value": "some_value"
},
"bcsName": "2F1KQ3miNpBx1RzoRr1MVYMraK7RV",
"bcsName": "FDB4OTo6dGVzdDo6VGVzdEZpZWxk",
"type": "DynamicField",
"objectType": "test",
"objectId": "0x82b2fd67344691abd0efc771941b948ad35360b08e449fbbc28b0641175bf60b",
Expand All @@ -3565,7 +3565,7 @@
"type": "0x0000000000000000000000000000000000000000000000000000000000000009::test::TestField",
"value": "some_value"
},
"bcsName": "2F1KQ3miNpBx1RzoRr1MVYMraK7RV",
"bcsName": "FDB4OTo6dGVzdDo6VGVzdEZpZWxk",
"type": "DynamicField",
"objectType": "test",
"objectId": "0x21564fc5a68ace997461b098c1d1f3ccbde241d8fdf562db36bc1423ee10cecb",
Expand All @@ -3577,7 +3577,7 @@
"type": "0x0000000000000000000000000000000000000000000000000000000000000009::test::TestField",
"value": "some_value"
},
"bcsName": "2F1KQ3miNpBx1RzoRr1MVYMraK7RV",
"bcsName": "FDB4OTo6dGVzdDo6VGVzdEZpZWxk",
"type": "DynamicField",
"objectType": "test",
"objectId": "0x7e00acf5386662fa062483ba507b1e9e3039750f0a270f2e12441ad7f611a5f7",
Expand Down Expand Up @@ -5960,7 +5960,7 @@
],
"properties": {
"bcsName": {
"$ref": "#/components/schemas/Base58"
"$ref": "#/components/schemas/Base64"
},
"digest": {
"$ref": "#/components/schemas/ObjectDigest"
Expand Down Expand Up @@ -6079,10 +6079,10 @@
],
"properties": {
"bcs": {
"description": "Base 58 encoded bcs bytes of the move event",
"description": "Base64 encoded bcs bytes of the move event",
"allOf": [
{
"$ref": "#/components/schemas/Base58"
"$ref": "#/components/schemas/Base64"
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-types/src/dynamic_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::storage::ObjectStore;
use crate::sui_serde::Readable;
use crate::sui_serde::SuiTypeTag;
use crate::{MoveTypeTagTrait, ObjectID, SequenceNumber, SUI_FRAMEWORK_ADDRESS};
use fastcrypto::encoding::Base58;
use fastcrypto::encoding::Base64;
use fastcrypto::hash::HashFunction;
use move_core_types::annotated_value::{MoveStruct, MoveValue};
use move_core_types::ident_str;
Expand Down Expand Up @@ -65,8 +65,8 @@ where
#[serde(rename_all = "camelCase")]
pub struct DynamicFieldInfo {
pub name: DynamicFieldName,
#[schemars(with = "Base58")]
#[serde_as(as = "Readable<Base58, _>")]
#[schemars(with = "Base64")]
#[serde_as(as = "Readable<Base64, _>")]
pub bcs_name: Vec<u8>,
pub type_: DynamicFieldType,
pub object_type: String,
Expand Down
Loading