Skip to content

Commit be20c12

Browse files
committed
chore(gRPC): adapt to new iota-sdk-types
1 parent c7a3e4b commit be20c12

File tree

15 files changed

+83
-107
lines changed

15 files changed

+83
-107
lines changed

Cargo.lock

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

crates/iota-grpc-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ anyhow.workspace = true
1515
base64.workspace = true
1616
futures.workspace = true
1717
http.workspace = true
18-
iota-sdk2.workspace = true
18+
iota-sdk-types.workspace = true
1919
serde_json.workspace = true
2020
tap.workspace = true
2121
tonic = { workspace = true, features = ["tls-ring"] }

crates/iota-grpc-client/src/response_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Modifications Copyright (c) 2025 IOTA Stiftung
33
// SPDX-License-Identifier: Apache-2.0
44
use iota_grpc_types::headers;
5-
use iota_sdk2::types::Digest;
5+
use iota_sdk_types::Digest;
66

77
/// Extension trait used to facilitate retrieval of IOTA specific data from
88
/// responses

crates/iota-grpc-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async-stream = "0.3"
1616
async-trait.workspace = true
1717
bcs.workspace = true
1818
futures.workspace = true
19-
iota-sdk2.workspace = true
19+
iota-sdk-types.workspace = true
2020
prost.workspace = true
2121
prost-types.workspace = true
2222
serde.workspace = true

crates/iota-grpc-server/src/ledger_service/get_objects.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ fn get_object_impl(
138138
.ok_or_else(|| ObjectNotFoundError::new(object_id))?
139139
};
140140

141-
// Convert to iota_sdk2 type
142-
// TODO: Remove this conversion when we migrate iota-types to iota_sdk2 types
141+
// Convert to iota_sdk_types type
142+
// TODO: Remove this conversion when we migrate iota-types to iota_sdk_types types
143143
let sdk_object = object
144144
.try_into()
145145
.map_err(|e: SdkTypeConversionError| anyhow::Error::msg(e.to_string()))?;

crates/iota-grpc-server/src/transaction_execution_service/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,25 +211,25 @@ pub async fn execute_transaction(
211211
let checkpoint = None;
212212
let timestamp_ms = None;
213213

214-
// Convert iota_types to iota_sdk2 types for external compatibility
215-
// TODO: Remove this conversion when we migrate iota-types to iota_sdk2 types
216-
let sdk_transaction: iota_sdk2::types::SignedTransaction =
214+
// Convert iota_types to iota_sdk_types types for external compatibility
215+
// TODO: Remove this conversion when we migrate iota-types to iota_sdk_types types
216+
let sdk_transaction: iota_sdk_types::SignedTransaction =
217217
signed_transaction.clone().try_into().map_err(|e| {
218218
RpcError::new(
219219
tonic::Code::Internal,
220220
format!("failed to convert transaction to SDK type: {e}"),
221221
)
222222
})?;
223223

224-
let sdk_effects: iota_sdk2::types::TransactionEffects =
224+
let sdk_effects: iota_sdk_types::TransactionEffects =
225225
effects.clone().try_into().map_err(|e| {
226226
RpcError::new(
227227
tonic::Code::Internal,
228228
format!("failed to convert effects to SDK type: {e}"),
229229
)
230230
})?;
231231

232-
let sdk_events: Option<iota_sdk2::types::TransactionEvents> = events
232+
let sdk_events: Option<iota_sdk_types::TransactionEvents> = events
233233
.as_ref()
234234
.map(|e| e.clone().try_into())
235235
.transpose()
@@ -240,7 +240,7 @@ pub async fn execute_transaction(
240240
)
241241
})?;
242242

243-
let sdk_input_objects: Option<Vec<iota_sdk2::types::object::Object>> = input_objects
243+
let sdk_input_objects: Option<Vec<iota_sdk_types::object::Object>> = input_objects
244244
.map(|objects| {
245245
objects
246246
.into_iter()
@@ -255,7 +255,7 @@ pub async fn execute_transaction(
255255
)
256256
})?;
257257

258-
let sdk_output_objects: Option<Vec<iota_sdk2::types::object::Object>> = output_objects
258+
let sdk_output_objects: Option<Vec<iota_sdk_types::object::Object>> = output_objects
259259
.map(|objects| {
260260
objects
261261
.into_iter()
@@ -270,7 +270,7 @@ pub async fn execute_transaction(
270270
)
271271
})?;
272272

273-
let sdk_digest: iota_sdk2::types::TransactionDigest = digest.into();
273+
let sdk_digest: iota_sdk_types::Digest = digest.into();
274274

275275
// Build the response using merge
276276
let mut executed_transaction = ExecutedTransaction::default();

crates/iota-grpc-server/src/transaction_execution_service/simulate.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,17 @@ pub async fn simulate_transaction(
211211
let input_objects = simulation_result.input_objects;
212212
let output_objects = simulation_result.output_objects;
213213

214-
// Convert iota_types to iota_sdk2 types for external compatibility
215-
// TODO: Remove this conversion when we migrate iota-types to iota_sdk2 types
216-
let sdk_effects: iota_sdk2::types::TransactionEffects =
214+
// Convert iota_types to iota_sdk_types types for external compatibility
215+
// TODO: Remove this conversion when we migrate iota-types to iota_sdk_types types
216+
let sdk_effects: iota_sdk_types::TransactionEffects =
217217
effects.clone().try_into().map_err(|e| {
218218
RpcError::new(
219219
tonic::Code::Internal,
220220
format!("failed to convert effects to SDK type: {e}"),
221221
)
222222
})?;
223223

224-
let sdk_events: Option<iota_sdk2::types::TransactionEvents> = events
224+
let sdk_events: Option<iota_sdk_types::TransactionEvents> = events
225225
.as_ref()
226226
.map(|e| e.clone().try_into())
227227
.transpose()
@@ -233,7 +233,7 @@ pub async fn simulate_transaction(
233233
})?;
234234

235235
// Convert input objects to SDK2 types
236-
let sdk_input_objects: Option<Vec<iota_sdk2::types::object::Object>> =
236+
let sdk_input_objects: Option<Vec<iota_sdk_types::object::Object>> =
237237
if !input_objects.is_empty() {
238238
Some(
239239
input_objects
@@ -252,7 +252,7 @@ pub async fn simulate_transaction(
252252
};
253253

254254
// Convert output objects to SDK2 types
255-
let sdk_output_objects: Option<Vec<iota_sdk2::types::object::Object>> =
255+
let sdk_output_objects: Option<Vec<iota_sdk_types::object::Object>> =
256256
if !output_objects.is_empty() {
257257
Some(
258258
output_objects
@@ -277,7 +277,7 @@ pub async fn simulate_transaction(
277277
if let Some(tx_mask) = read_mask.subtree(SimulateTransactionResponse::TRANSACTION_FIELD.name) {
278278
// Convert transaction_data to sdk2 types for merge
279279
// This includes the updated gas budget if estimation was requested
280-
let sdk_transaction: iota_sdk2::types::SignedTransaction =
280+
let sdk_transaction: iota_sdk_types::SignedTransaction =
281281
iota_types::transaction::Transaction::from_data(transaction_data.clone(), vec![])
282282
.try_into()
283283
.map_err(|e| {
@@ -288,7 +288,7 @@ pub async fn simulate_transaction(
288288
})?;
289289

290290
let digest = transaction_data.digest();
291-
let sdk_digest: iota_sdk2::types::TransactionDigest = digest.into();
291+
let sdk_digest: iota_sdk_types::Digest = digest.into();
292292

293293
// Create a source for the merge
294294
let source = TransactionReadSource {

crates/iota-grpc-types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ workspace = true
1212
[dependencies]
1313
# external dependencies
1414
bcs.workspace = true
15-
iota-sdk2.workspace = true
15+
iota-sdk-types.workspace = true
1616
prost.workspace = true
1717
prost-types.workspace = true
1818
serde.workspace = true

crates/iota-grpc-types/src/proto/iota/grpc/v0/checkpoint.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ use crate::{field::FieldMaskTree, merge::Merge, proto::TryFromProtoError, v0::bc
1111
// CheckpointSummary
1212
//
1313

14-
impl From<iota_sdk2::types::CheckpointSummary> for CheckpointSummary {
15-
fn from(summary: iota_sdk2::types::CheckpointSummary) -> Self {
14+
impl From<iota_sdk_types::CheckpointSummary> for CheckpointSummary {
15+
fn from(summary: iota_sdk_types::CheckpointSummary) -> Self {
1616
Self::merge_from(summary, &FieldMaskTree::new_wildcard())
1717
}
1818
}
1919

20-
impl Merge<iota_sdk2::types::CheckpointSummary> for CheckpointSummary {
21-
fn merge(&mut self, source: iota_sdk2::types::CheckpointSummary, mask: &FieldMaskTree) {
20+
impl Merge<iota_sdk_types::CheckpointSummary> for CheckpointSummary {
21+
fn merge(&mut self, source: iota_sdk_types::CheckpointSummary, mask: &FieldMaskTree) {
2222
if mask.contains(Self::BCS_FIELD.name) {
2323
self.bcs = Some(BcsData::serialize(&source).unwrap());
2424
}
@@ -43,7 +43,7 @@ impl Merge<&CheckpointSummary> for CheckpointSummary {
4343
}
4444
}
4545

46-
impl TryFrom<&CheckpointSummary> for iota_sdk2::types::CheckpointSummary {
46+
impl TryFrom<&CheckpointSummary> for iota_sdk_types::CheckpointSummary {
4747
type Error = TryFromProtoError;
4848

4949
fn try_from(
@@ -60,14 +60,14 @@ impl TryFrom<&CheckpointSummary> for iota_sdk2::types::CheckpointSummary {
6060
// CheckpointContents
6161
//
6262

63-
impl From<iota_sdk2::types::CheckpointContents> for CheckpointContents {
64-
fn from(value: iota_sdk2::types::CheckpointContents) -> Self {
63+
impl From<iota_sdk_types::CheckpointContents> for CheckpointContents {
64+
fn from(value: iota_sdk_types::CheckpointContents) -> Self {
6565
Self::merge_from(value, &FieldMaskTree::new_wildcard())
6666
}
6767
}
6868

69-
impl Merge<iota_sdk2::types::CheckpointContents> for CheckpointContents {
70-
fn merge(&mut self, source: iota_sdk2::types::CheckpointContents, mask: &FieldMaskTree) {
69+
impl Merge<iota_sdk_types::CheckpointContents> for CheckpointContents {
70+
fn merge(&mut self, source: iota_sdk_types::CheckpointContents, mask: &FieldMaskTree) {
7171
if mask.contains(Self::BCS_FIELD.name) {
7272
self.bcs = Some(BcsData::serialize(&source).unwrap());
7373
}
@@ -92,7 +92,7 @@ impl Merge<&CheckpointContents> for CheckpointContents {
9292
}
9393
}
9494

95-
impl TryFrom<&CheckpointContents> for iota_sdk2::types::CheckpointContents {
95+
impl TryFrom<&CheckpointContents> for iota_sdk_types::CheckpointContents {
9696
type Error = TryFromProtoError;
9797

9898
fn try_from(value: &CheckpointContents) -> Result<Self, Self::Error> {
@@ -108,8 +108,8 @@ impl TryFrom<&CheckpointContents> for iota_sdk2::types::CheckpointContents {
108108
// Checkpoint
109109
//
110110

111-
impl Merge<&iota_sdk2::types::CheckpointSummary> for Checkpoint {
112-
fn merge(&mut self, source: &iota_sdk2::types::CheckpointSummary, mask: &FieldMaskTree) {
111+
impl Merge<&iota_sdk_types::CheckpointSummary> for Checkpoint {
112+
fn merge(&mut self, source: &iota_sdk_types::CheckpointSummary, mask: &FieldMaskTree) {
113113
if mask.contains(Self::SEQUENCE_NUMBER_FIELD.name) {
114114
self.sequence_number = Some(source.sequence_number);
115115
}
@@ -120,10 +120,10 @@ impl Merge<&iota_sdk2::types::CheckpointSummary> for Checkpoint {
120120
}
121121
}
122122

123-
impl Merge<iota_sdk2::types::ValidatorAggregatedSignature> for Checkpoint {
123+
impl Merge<iota_sdk_types::ValidatorAggregatedSignature> for Checkpoint {
124124
fn merge(
125125
&mut self,
126-
source: iota_sdk2::types::ValidatorAggregatedSignature,
126+
source: iota_sdk_types::ValidatorAggregatedSignature,
127127
mask: &FieldMaskTree,
128128
) {
129129
if mask.contains(Self::SIGNATURE_FIELD.name) {
@@ -132,8 +132,8 @@ impl Merge<iota_sdk2::types::ValidatorAggregatedSignature> for Checkpoint {
132132
}
133133
}
134134

135-
impl Merge<iota_sdk2::types::CheckpointContents> for Checkpoint {
136-
fn merge(&mut self, source: iota_sdk2::types::CheckpointContents, mask: &FieldMaskTree) {
135+
impl Merge<iota_sdk_types::CheckpointContents> for Checkpoint {
136+
fn merge(&mut self, source: iota_sdk_types::CheckpointContents, mask: &FieldMaskTree) {
137137
if let Some(submask) = mask.subtree(Self::CONTENTS_FIELD.name) {
138138
self.contents = Some(CheckpointContents::merge_from(source, &submask));
139139
}

crates/iota-grpc-types/src/proto/iota/grpc/v0/epoch.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ use crate::{field::FieldMaskTree, merge::Merge, proto::TryFromProtoError};
1313
// ValidatorCommitteeMember
1414
//
1515

16-
impl From<iota_sdk2::types::ValidatorCommitteeMember> for ValidatorCommitteeMember {
17-
fn from(value: iota_sdk2::types::ValidatorCommitteeMember) -> Self {
16+
impl From<iota_sdk_types::ValidatorCommitteeMember> for ValidatorCommitteeMember {
17+
fn from(value: iota_sdk_types::ValidatorCommitteeMember) -> Self {
1818
Self {
1919
public_key: Some(value.public_key.as_bytes().to_vec().into()),
2020
weight: Some(value.stake),
2121
}
2222
}
2323
}
2424

25-
impl TryFrom<&ValidatorCommitteeMember> for iota_sdk2::types::ValidatorCommitteeMember {
25+
impl TryFrom<&ValidatorCommitteeMember> for iota_sdk_types::ValidatorCommitteeMember {
2626
type Error = TryFromProtoError;
2727

2828
fn try_from(
@@ -34,7 +34,7 @@ impl TryFrom<&ValidatorCommitteeMember> for iota_sdk2::types::ValidatorCommittee
3434
TryFromProtoError::missing(ValidatorCommitteeMember::PUBLIC_KEY_FIELD.name)
3535
})?
3636
.as_ref()
37-
.pipe(iota_sdk2::types::Bls12381PublicKey::from_bytes)
37+
.pipe(iota_sdk_types::Bls12381PublicKey::from_bytes)
3838
.map_err(|e| {
3939
TryFromProtoError::invalid(ValidatorCommitteeMember::PUBLIC_KEY_FIELD, e)
4040
})?;
@@ -49,8 +49,8 @@ impl TryFrom<&ValidatorCommitteeMember> for iota_sdk2::types::ValidatorCommittee
4949
// ValidatorCommittee
5050
//
5151

52-
impl From<iota_sdk2::types::ValidatorCommittee> for ValidatorCommittee {
53-
fn from(value: iota_sdk2::types::ValidatorCommittee) -> Self {
52+
impl From<iota_sdk_types::ValidatorCommittee> for ValidatorCommittee {
53+
fn from(value: iota_sdk_types::ValidatorCommittee) -> Self {
5454
Self {
5555
epoch: Some(value.epoch),
5656
members: Some(ValidatorCommitteeMembers {
@@ -60,7 +60,7 @@ impl From<iota_sdk2::types::ValidatorCommittee> for ValidatorCommittee {
6060
}
6161
}
6262

63-
impl TryFrom<&ValidatorCommittee> for iota_sdk2::types::ValidatorCommittee {
63+
impl TryFrom<&ValidatorCommittee> for iota_sdk_types::ValidatorCommittee {
6464
type Error = TryFromProtoError;
6565

6666
fn try_from(value: &ValidatorCommittee) -> Result<Self, Self::Error> {

0 commit comments

Comments
 (0)