Skip to content

Commit 14bbfab

Browse files
committed
refactor: remove Default trait from BuildData and UpgradeInfo structs; update EVM client to use UpgradeInfo directly
1 parent 511b487 commit 14bbfab

3 files changed

Lines changed: 6 additions & 16 deletions

File tree

src/did/src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use candid::CandidType;
22
use serde::{Deserialize, Serialize};
33

44
/// Contains the build data.
5-
#[derive(Debug, Clone, Serialize, Deserialize, CandidType, Default)]
5+
#[derive(Debug, Clone, Serialize, Deserialize, CandidType)]
66
pub struct BuildData {
77
pub cargo_target_triple: String,
88
pub cargo_features: String,

src/did/src/upgrade_info.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use serde::Deserialize;
77
use crate::build::BuildData;
88

99
/// Historical information about the canister
10-
#[derive(CandidType, Deserialize, Clone, Default, Debug)]
10+
#[derive(CandidType, Deserialize, Clone, Debug)]
1111
pub struct UpgradeInfo {
1212
/// The build data of the canister
1313
pub build_data: BuildData,
@@ -28,9 +28,3 @@ impl Storable for UpgradeInfo {
2828
Decode!(&bytes, UpgradeInfo).expect("Failed to decode UpgradeInfo")
2929
}
3030
}
31-
32-
#[derive(CandidType, Deserialize, Clone, Debug)]
33-
pub struct PaginatedUpgradeInfo {
34-
pub info: Vec<UpgradeInfo>,
35-
pub total_count: u64,
36-
}

src/evm-canister-client/src/client.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use did::send_raw_transaction::SendRawTransactionRequest;
99
use did::state::BasicAccount;
1010
use did::transaction::StorableExecutionResult;
1111
use did::unsafe_blocks::ValidateUnsafeBlockArgs;
12-
use did::upgrade_info::PaginatedUpgradeInfo;
12+
use did::upgrade_info::UpgradeInfo;
1313
use did::{
1414
Block, BlockConfirmationData, BlockConfirmationResult, BlockConfirmationStrategy, BlockNumber,
1515
BlockchainBlockInfo, BlockchainStorageLimits, Bytes, EstimateGasRequest, EvmStats, FeeHistory,
@@ -928,14 +928,10 @@ impl<C: CanisterClient> EvmCanisterClient<C> {
928928
self.client.query("get_blockchain_block_info", ()).await
929929
}
930930

931-
/// Returns the upgrade info paginated by count and offset
932-
pub async fn get_upgrade_info_paginated(
933-
&self,
934-
count: u64,
935-
offset: usize,
936-
) -> CanisterClientResult<PaginatedUpgradeInfo> {
931+
/// Returns the upgrade info for the canister of the last `count` entries
932+
pub async fn get_upgrade_info(&self, count: u64) -> CanisterClientResult<UpgradeInfo> {
937933
self.client
938-
.query("get_upgrade_info_paginated", (count, offset))
934+
.query("get_upgrade_info_paginated", (count,))
939935
.await
940936
}
941937
}

0 commit comments

Comments
 (0)