sui_rpc/proto/sui/rpc/v2beta2/
move_package_service.rs

1use 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        }
11    }
12}
13
14impl GetPackageResponse {
15    pub fn new(package: Package) -> Self {
16        Self {
17            package: Some(package),
18        }
19    }
20}
21
22impl GetDatatypeRequest {
23    pub fn new(package_id: &Address, module: &str, name: &str) -> Self {
24        Self {
25            package_id: Some(package_id.to_string()),
26            module_name: Some(module.into()),
27            name: Some(name.into()),
28        }
29    }
30}
31
32impl GetDatatypeResponse {
33    pub fn new(datatype: DatatypeDescriptor) -> Self {
34        Self {
35            datatype: Some(datatype),
36        }
37    }
38}
39
40impl GetFunctionRequest {
41    pub fn new(package_id: &Address, module: &str, name: &str) -> Self {
42        Self {
43            package_id: Some(package_id.to_string()),
44            module_name: Some(module.into()),
45            name: Some(name.into()),
46        }
47    }
48}
49
50impl GetFunctionResponse {
51    pub fn new(function: FunctionDescriptor) -> Self {
52        Self {
53            function: Some(function),
54        }
55    }
56}
57
58impl ListPackageVersionsRequest {
59    pub fn new(package_id: &Address) -> Self {
60        Self {
61            package_id: Some(package_id.to_string()),
62            page_size: None,
63            page_token: None,
64        }
65    }
66}
67
68impl ListPackageVersionsResponse {
69    pub fn new(versions: Vec<PackageVersion>, next_page_token: Option<Bytes>) -> Self {
70        Self {
71            versions,
72            next_page_token,
73        }
74    }
75}
76
77impl PackageVersion {
78    pub fn new(package_id: &Address, version: u64) -> Self {
79        Self {
80            package_id: Some(package_id.to_string()),
81            version: Some(version),
82        }
83    }
84}