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

Remove deprecated flag has_public_transfer #18

Merged
merged 4 commits into from
Nov 8, 2024
Merged
Changes from 3 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
80 changes: 32 additions & 48 deletions crates/iota-rust-sdk/src/types/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@ pub struct MoveStruct {
serde(with = "::serde_with::As::<serialization::BinaryMoveStructType>")
)]
pub type_: StructTag,
/// DEPRECATED this field is no longer used to determine whether a tx can
/// transfer this object. Instead, it is always calculated from the
/// objects type when loaded in execution
pub has_public_transfer: bool,
/// Number that increases each time a tx takes this object as a mutable
/// input This is a lamport timestamp, not a sequentially increasing
/// version
Expand Down Expand Up @@ -321,7 +317,6 @@ mod serialization {
name: Identifier::new("foo").unwrap(),
type_params: Vec::new(),
},
has_public_transfer: true,
version: 12,
contents: ObjectId::ZERO.into(),
}),
Expand Down Expand Up @@ -564,7 +559,6 @@ mod serialization {
schemars(rename = "MoveStruct")
)]
struct ReadableMoveStruct {
has_public_transfer: bool,
#[serde(with = "::serde_with::As::<crate::_serde::Base64Encoded>")]
#[cfg_attr(feature = "schemars", schemars(with = "crate::_schemars::Base64"))]
contents: Vec<u8>,
Expand All @@ -574,7 +568,6 @@ mod serialization {
fn readable_object_data(&self) -> ReadableObjectData {
match &self.data {
ObjectData::Struct(struct_) => ReadableObjectData::Move(ReadableMoveStruct {
has_public_transfer: struct_.has_public_transfer,
contents: struct_.contents.clone(),
}),
ObjectData::Package(package) => ReadableObjectData::Package(ReadablePackage {
Expand Down Expand Up @@ -649,10 +642,7 @@ mod serialization {
}),
(
ObjectType::Struct(type_),
ReadableObjectData::Move(ReadableMoveStruct {
has_public_transfer,
contents,
}),
ReadableObjectData::Move(ReadableMoveStruct { contents }),
) => {
// check id matches in contents
if !id_opt(&contents).is_some_and(|id| id == object_id) {
Expand All @@ -661,7 +651,6 @@ mod serialization {

ObjectData::Struct(MoveStruct {
type_,
has_public_transfer,
version,
contents,
})
Expand Down Expand Up @@ -740,7 +729,6 @@ mod serialization {
fn readable_object_data(&self) -> ReadableObjectData {
match &self.data {
ObjectData::Struct(struct_) => ReadableObjectData::Move(ReadableMoveStruct {
has_public_transfer: struct_.has_public_transfer,
contents: struct_.contents.clone(),
}),
ObjectData::Package(package) => ReadableObjectData::Package(ReadablePackage {
Expand Down Expand Up @@ -808,10 +796,7 @@ mod serialization {
}),
(
ObjectType::Struct(type_),
ReadableObjectData::Move(ReadableMoveStruct {
has_public_transfer,
contents,
}),
ReadableObjectData::Move(ReadableMoveStruct { contents }),
) => {
// check id matches in contents
if !id_opt(&contents).is_some_and(|id| id == object_id) {
Expand All @@ -820,7 +805,6 @@ mod serialization {

ObjectData::Struct(MoveStruct {
type_,
has_public_transfer,
version,
contents,
})
Expand Down Expand Up @@ -848,50 +832,50 @@ mod serialization {
#[test]
fn object_fixture() {
const IOTA_COIN: &[u8] = &[
0, 1, 1, 32, 79, 43, 0, 0, 0, 0, 0, 40, 35, 95, 175, 213, 151, 87, 206, 190, 35,
131, 79, 35, 254, 22, 15, 181, 40, 108, 28, 77, 68, 229, 107, 254, 191, 160, 196,
186, 42, 2, 122, 53, 52, 133, 199, 58, 0, 0, 0, 0, 0, 79, 255, 208, 0, 85, 34, 190,
75, 192, 41, 114, 76, 127, 15, 110, 215, 9, 58, 107, 243, 160, 155, 144, 230, 47,
97, 220, 21, 24, 30, 26, 62, 32, 17, 197, 192, 38, 64, 173, 142, 143, 49, 111, 15,
211, 92, 84, 48, 160, 243, 102, 229, 253, 251, 137, 210, 101, 119, 173, 228, 51,
141, 20, 15, 85, 96, 19, 15, 0, 0, 0, 0, 0,
0, 1, 32, 79, 43, 0, 0, 0, 0, 0, 40, 35, 95, 175, 213, 151, 87, 206, 190, 35, 131,
79, 35, 254, 22, 15, 181, 40, 108, 28, 77, 68, 229, 107, 254, 191, 160, 196, 186,
42, 2, 122, 53, 52, 133, 199, 58, 0, 0, 0, 0, 0, 79, 255, 208, 0, 85, 34, 190, 75,
192, 41, 114, 76, 127, 15, 110, 215, 9, 58, 107, 243, 160, 155, 144, 230, 47, 97,
220, 21, 24, 30, 26, 62, 32, 17, 197, 192, 38, 64, 173, 142, 143, 49, 111, 15, 211,
92, 84, 48, 160, 243, 102, 229, 253, 251, 137, 210, 101, 119, 173, 228, 51, 141,
20, 15, 85, 96, 19, 15, 0, 0, 0, 0, 0,
];

const IOTA_STAKE: &[u8] = &[
0, 2, 1, 154, 1, 52, 5, 0, 0, 0, 0, 80, 3, 112, 71, 231, 166, 234, 205, 164, 99,
237, 29, 56, 97, 170, 21, 96, 105, 158, 227, 122, 22, 251, 60, 162, 12, 97, 151,
218, 71, 253, 231, 239, 116, 138, 12, 233, 128, 195, 128, 77, 33, 38, 122, 77, 53,
154, 197, 198, 75, 212, 12, 182, 163, 224, 42, 82, 123, 69, 248, 40, 207, 143, 211,
13, 106, 1, 0, 0, 0, 0, 0, 0, 59, 81, 183, 246, 112, 0, 0, 0, 0, 79, 255, 208, 0,
85, 34, 190, 75, 192, 41, 114, 76, 127, 15, 110, 215, 9, 58, 107, 243, 160, 155,
144, 230, 47, 97, 220, 21, 24, 30, 26, 62, 32, 247, 239, 248, 71, 247, 102, 190,
149, 232, 153, 138, 67, 169, 209, 203, 29, 255, 215, 223, 57, 159, 44, 40, 218,
166, 13, 80, 71, 14, 188, 232, 68, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 154, 1, 52, 5, 0, 0, 0, 0, 80, 3, 112, 71, 231, 166, 234, 205, 164, 99, 237,
29, 56, 97, 170, 21, 96, 105, 158, 227, 122, 22, 251, 60, 162, 12, 97, 151, 218,
71, 253, 231, 239, 116, 138, 12, 233, 128, 195, 128, 77, 33, 38, 122, 77, 53, 154,
197, 198, 75, 212, 12, 182, 163, 224, 42, 82, 123, 69, 248, 40, 207, 143, 211, 13,
106, 1, 0, 0, 0, 0, 0, 0, 59, 81, 183, 246, 112, 0, 0, 0, 0, 79, 255, 208, 0, 85,
34, 190, 75, 192, 41, 114, 76, 127, 15, 110, 215, 9, 58, 107, 243, 160, 155, 144,
230, 47, 97, 220, 21, 24, 30, 26, 62, 32, 247, 239, 248, 71, 247, 102, 190, 149,
232, 153, 138, 67, 169, 209, 203, 29, 255, 215, 223, 57, 159, 44, 40, 218, 166, 13,
80, 71, 14, 188, 232, 68, 0, 0, 0, 0, 0, 0, 0, 0,
];

const NFT: &[u8] = &[
0, 0, 97, 201, 195, 159, 216, 97, 133, 173, 96, 215, 56, 212, 229, 43, 208, 139,
218, 7, 29, 54, 106, 205, 224, 126, 7, 195, 145, 106, 45, 117, 168, 22, 12, 100,
105, 115, 116, 114, 105, 98, 117, 116, 105, 111, 110, 11, 68, 69, 69, 80, 87, 114,
97, 112, 112, 101, 114, 0, 0, 124, 24, 223, 4, 0, 0, 0, 0, 40, 31, 8, 18, 84, 38,
164, 252, 84, 115, 250, 246, 137, 132, 128, 186, 156, 36, 62, 18, 140, 21, 4, 90,
209, 105, 85, 84, 92, 214, 97, 81, 207, 64, 194, 198, 208, 21, 0, 0, 0, 0, 79, 255,
208, 0, 85, 34, 190, 75, 192, 41, 114, 76, 127, 15, 110, 215, 9, 58, 107, 243, 160,
155, 144, 230, 47, 97, 220, 21, 24, 30, 26, 62, 32, 170, 4, 94, 114, 207, 155, 31,
80, 62, 254, 220, 206, 240, 218, 83, 54, 204, 197, 255, 239, 41, 66, 199, 150, 56,
189, 86, 217, 166, 216, 128, 241, 64, 205, 21, 0, 0, 0, 0, 0,
97, 112, 112, 101, 114, 0, 124, 24, 223, 4, 0, 0, 0, 0, 40, 31, 8, 18, 84, 38, 164,
252, 84, 115, 250, 246, 137, 132, 128, 186, 156, 36, 62, 18, 140, 21, 4, 90, 209,
105, 85, 84, 92, 214, 97, 81, 207, 64, 194, 198, 208, 21, 0, 0, 0, 0, 79, 255, 208,
0, 85, 34, 190, 75, 192, 41, 114, 76, 127, 15, 110, 215, 9, 58, 107, 243, 160, 155,
144, 230, 47, 97, 220, 21, 24, 30, 26, 62, 32, 170, 4, 94, 114, 207, 155, 31, 80,
62, 254, 220, 206, 240, 218, 83, 54, 204, 197, 255, 239, 41, 66, 199, 150, 56, 189,
86, 217, 166, 216, 128, 241, 64, 205, 21, 0, 0, 0, 0, 0,
];

const FUD_COIN: &[u8] = &[
0, 3, 7, 118, 203, 129, 155, 1, 171, 237, 80, 43, 238, 138, 112, 43, 76, 45, 84,
117, 50, 193, 47, 37, 0, 28, 157, 234, 121, 90, 94, 99, 28, 38, 241, 3, 102, 117,
100, 3, 70, 85, 68, 0, 1, 193, 89, 252, 3, 0, 0, 0, 0, 40, 33, 214, 90, 11, 56,
243, 115, 10, 250, 121, 250, 28, 34, 237, 104, 130, 148, 40, 130, 29, 248, 137,
244, 27, 138, 94, 150, 28, 182, 104, 162, 185, 0, 152, 247, 62, 93, 1, 0, 0, 0, 42,
95, 32, 226, 13, 31, 128, 91, 188, 127, 235, 12, 75, 73, 116, 112, 3, 227, 244,
126, 59, 81, 214, 118, 144, 243, 195, 17, 82, 216, 119, 170, 32, 239, 247, 71, 249,
241, 98, 133, 53, 46, 37, 100, 242, 94, 231, 241, 184, 8, 69, 192, 69, 67, 1, 116,
251, 229, 226, 99, 119, 79, 255, 71, 43, 64, 242, 19, 0, 0, 0, 0, 0,
100, 3, 70, 85, 68, 0, 193, 89, 252, 3, 0, 0, 0, 0, 40, 33, 214, 90, 11, 56, 243,
115, 10, 250, 121, 250, 28, 34, 237, 104, 130, 148, 40, 130, 29, 248, 137, 244, 27,
138, 94, 150, 28, 182, 104, 162, 185, 0, 152, 247, 62, 93, 1, 0, 0, 0, 42, 95, 32,
226, 13, 31, 128, 91, 188, 127, 235, 12, 75, 73, 116, 112, 3, 227, 244, 126, 59,
81, 214, 118, 144, 243, 195, 17, 82, 216, 119, 170, 32, 239, 247, 71, 249, 241, 98,
133, 53, 46, 37, 100, 242, 94, 231, 241, 184, 8, 69, 192, 69, 67, 1, 116, 251, 229,
226, 99, 119, 79, 255, 71, 43, 64, 242, 19, 0, 0, 0, 0, 0,
];

const BULLSHARK_PACKAGE: &[u8] = &[
Expand Down
Loading