sui_rpc/proto/sui/rpc/v2/
move_package_service.rs1use bytes::Bytes;
2use sui_sdk_types::Address;
3
4use super::*;
5
6impl GetPackageRequest {
7 pub fn new(package_id: &Address) -> Self {
8 Self {
9 package_id: Some(package_id.to_string()),
10 selector: None,
11 }
12 }
13}
14
15impl GetPackageResponse {
16 pub fn new(package: Package) -> Self {
17 Self {
18 package: Some(package),
19 }
20 }
21}
22
23impl GetDatatypeRequest {
24 pub fn new(package_id: &Address, module: &str, name: &str) -> Self {
25 Self {
26 package_id: Some(package_id.to_string()),
27 module_name: Some(module.into()),
28 name: Some(name.into()),
29 }
30 }
31}
32
33impl GetDatatypeResponse {
34 pub fn new(datatype: DatatypeDescriptor) -> Self {
35 Self {
36 datatype: Some(datatype),
37 }
38 }
39}
40
41impl GetFunctionRequest {
42 pub fn new(package_id: &Address, module: &str, name: &str) -> Self {
43 Self {
44 package_id: Some(package_id.to_string()),
45 module_name: Some(module.into()),
46 name: Some(name.into()),
47 }
48 }
49}
50
51impl GetFunctionResponse {
52 pub fn new(function: FunctionDescriptor) -> Self {
53 Self {
54 function: Some(function),
55 }
56 }
57}
58
59impl ListPackageVersionsRequest {
60 pub fn new(package_id: &Address) -> Self {
61 Self {
62 package_id: Some(package_id.to_string()),
63 page_size: None,
64 page_token: None,
65 options: None,
66 start_version: None,
67 end_version: None,
68 start_checkpoint: None,
69 end_checkpoint: None,
70 }
71 }
72}
73
74impl ListPackageVersionsResponse {
75 pub fn new(versions: Vec<PackageVersion>, next_page_token: Option<Bytes>) -> Self {
76 Self {
77 versions,
78 next_page_token,
79 end: None,
80 }
81 }
82}
83
84impl ListSystemPackagesRequest {
85 pub fn new(at_checkpoint: u64) -> Self {
87 Self {
88 at_checkpoint: Some(at_checkpoint),
89 }
90 }
91
92 pub fn latest() -> Self {
94 Self {
95 at_checkpoint: None,
96 }
97 }
98}
99
100impl ListSystemPackagesResponse {
101 pub fn new(system_packages: Vec<PackageVersion>) -> Self {
102 Self { system_packages }
103 }
104}
105
106impl PackageVersion {
107 pub fn new(package_id: &Address, version: u64) -> Self {
108 Self {
109 package_id: Some(package_id.to_string()),
110 version: Some(version),
111 checkpoint: None,
112 cursor: None,
113 original_id: None,
114 }
115 }
116}