From f0ccdeb2ba279eacd8663a562fc564ba89bbfae8 Mon Sep 17 00:00:00 2001 From: Vardominator Date: Tue, 27 Aug 2024 21:48:21 +0000 Subject: [PATCH 1/5] chore: update deprecated endpoints --- src/client/general.rs | 8 ++--- src/models/general.rs | 73 ++++++++++++++++++++++++++----------------- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/client/general.rs b/src/client/general.rs index 4aed104..5c52ab5 100644 --- a/src/client/general.rs +++ b/src/client/general.rs @@ -1,7 +1,7 @@ use super::maestro::Maestro; use crate::models::{ common::BasicResponse, - general::{ChainTip, EraHistory, ProtocolParameters}, + general::{ChainTip, EraSummaries, ProtocolParameters}, }; use std::error::Error; @@ -13,15 +13,15 @@ impl Maestro { Ok(chain_tip) } - pub async fn era_history(&self) -> Result> { - let url = "/era-history"; + pub async fn era_history(&self) -> Result> { + let url = "/era-summaries"; let resp = self.get(url).await?; let era_history = serde_json::from_str(&resp).map_err(|e| Box::new(e) as Box)?; Ok(era_history) } pub async fn protocol_parameters(&self) -> Result> { - let url = "/protocol-params"; + let url = "/protocol-parameters"; let resp = self.get(url).await?; let protocol_params = serde_json::from_str(&resp).map_err(|e| Box::new(e) as Box)?; diff --git a/src/models/general.rs b/src/models/general.rs index e08af62..6dabc06 100644 --- a/src/models/general.rs +++ b/src/models/general.rs @@ -36,57 +36,74 @@ pub struct Era { } #[derive(Deserialize, Debug, Clone)] -pub struct EraHistory { +pub struct EraSummaries { pub data: Vec, pub last_updated: utils::LastUpdated, } #[derive(Deserialize, Debug, Clone)] pub struct ProtocolParameters { - pub data: ProtocolParams, + pub data: ProtocolParametersData, pub last_updated: utils::LastUpdated, } +#[derive(Deserialize, Debug, Clone)] +pub struct Bytes { + pub bytes: u64, +} + #[derive(Deserialize, Debug, Clone)] pub struct ExUnits { - pub memory: i64, - pub steps: i64, + pub memory: u64, + pub cpu: u64, } #[derive(Deserialize, Debug, Clone)] -pub struct StringExUnits { - pub memory: String, - pub steps: String, +pub struct LovelaceAmount { + pub lovelace: u64, } #[derive(Deserialize, Debug, Clone)] pub struct ProtocolVersion { - pub major: i64, - pub minor: i64, + pub major: u64, + pub minor: u64, +} + +#[derive(Deserialize, Debug, Clone)] +pub struct PlutusCostModels { + pub plutus_v1: Vec, + pub plutus_v2: Vec, +} + +#[derive(Deserialize, Debug, Clone)] +pub struct ScriptExecutionPrices { + pub memory: String, + pub cpu: String, } #[derive(Deserialize, Debug, Clone)] -pub struct ProtocolParams { - pub coins_per_utxo_byte: i64, - pub collateral_percentage: i64, - pub cost_models: serde_json::Value, - pub desired_number_of_pools: i64, - pub max_block_body_size: i64, - pub max_block_header_size: i64, - pub max_collateral_inputs: i64, +pub struct ProtocolParametersData { + pub collateral_percentage: u64, + pub desired_number_of_stake_pools: u64, + pub max_block_body_size: Bytes, + pub max_block_header_size: Bytes, + pub max_collateral_inputs: u64, pub max_execution_units_per_block: ExUnits, pub max_execution_units_per_transaction: ExUnits, - pub max_tx_size: i64, - pub max_value_size: i64, - pub min_fee_coefficient: i64, - pub min_fee_constant: i64, - pub min_pool_cost: i64, + pub max_transaction_size: Bytes, + pub max_value_size: Bytes, + pub min_fee_coefficient: u64, + pub min_fee_constant: LovelaceAmount, + pub min_stake_pool_cost: LovelaceAmount, + pub min_utxo_deposit_coefficient: u64, + pub min_utxo_deposit_constant: LovelaceAmount, pub monetary_expansion: String, - pub pool_deposit: i64, - pub pool_influence: String, - pub pool_retirement_epoch_bound: i64, - pub prices: StringExUnits, - pub protocol_version: ProtocolVersion, - pub stake_key_deposit: i64, + pub plutus_cost_models: PlutusCostModels, + pub script_execution_prices: ScriptExecutionPrices, + pub stake_credential_deposit: LovelaceAmount, + pub stake_pool_deposit: LovelaceAmount, + pub stake_pool_pledge_influence: String, + pub stake_pool_retirement_epoch_bound: u64, pub treasury_expansion: String, + pub version: ProtocolVersion, } From 3281281f5f619851c9af1348266489364685f9b6 Mon Sep 17 00:00:00 2001 From: Vardominator Date: Tue, 27 Aug 2024 21:48:55 +0000 Subject: [PATCH 2/5] bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3193cb3..62de58a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "maestro-rust-sdk" -version = "1.1.3" +version = "1.2.0" description = "Rust SDK for the Maestro Dapp Platform" repository = "https://github.com/maestro-org/rust-sdk" documentation = "https://docs.gomaestro.org/" From e73e7586ff9e1ff8d72e8bde778972f01fc786e6 Mon Sep 17 00:00:00 2001 From: Vardominator Date: Wed, 28 Aug 2024 15:29:49 +0000 Subject: [PATCH 3/5] add more conway support --- src/models/pools.rs | 2 -- src/models/scripts.rs | 1 + src/models/transactions.rs | 24 ++++++++++++++++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/models/pools.rs b/src/models/pools.rs index 4e3d791..5a42f6a 100644 --- a/src/models/pools.rs +++ b/src/models/pools.rs @@ -33,7 +33,6 @@ pub struct PoolMintedBlocks { #[derive(Deserialize, Debug, Clone)] pub struct StakePoolDelegator { - pub active_epoch_no: i64, pub amount: String, pub latest_delegation_tx_hash: String, pub stake_address: String, @@ -79,7 +78,6 @@ pub struct Relay { #[derive(Deserialize, Debug, Clone)] pub struct StakePoolDetails { - pub active_epoch_no: i64, pub active_stake: i64, pub block_count: i64, pub fixed_cost: i64, diff --git a/src/models/scripts.rs b/src/models/scripts.rs index bb2520d..a7641e4 100644 --- a/src/models/scripts.rs +++ b/src/models/scripts.rs @@ -6,6 +6,7 @@ use serde::Serialize; pub enum ScriptVersion { PlutusV1, PlutusV2, + PlutusV3, } #[derive(Serialize, Deserialize, Debug, Clone)] diff --git a/src/models/transactions.rs b/src/models/transactions.rs index 92daae4..3a6ee67 100644 --- a/src/models/transactions.rs +++ b/src/models/transactions.rs @@ -5,12 +5,24 @@ use super::{addresses::Utxo, scripts::Script}; #[derive(Deserialize, Debug, Clone)] pub struct Certificates { + pub auth_committee_hot_certs: Vec, pub mir_transfers: Vec, pub pool_registrations: Vec, pub pool_retirements: Vec, + pub reg_certs: Vec, + pub reg_drep_certs: Vec, + pub resign_committee_cold_certs: Vec, pub stake_delegations: Vec, pub stake_deregistrations: Vec, - pub stake_registrations_reserves: Vec, + pub stake_reg_delegations: Vec, + pub stake_registrations: Vec, + pub stake_vote_delegations: Vec, + pub stake_vote_reg_delegations: Vec, + pub unreg_certs: Vec, + pub unreg_drep_certs: Vec, + pub update_drep_certs: Vec, + pub vote_delegations: Vec, + pub vote_reg_delegations: Vec, } #[derive(Deserialize, Debug, Clone)] @@ -19,6 +31,14 @@ pub struct Redeemers { pub mints: Vec, pub spends: Vec, pub withdrawals: Vec, + pub votes: Vec, + pub proposals: Vec, +} + +#[derive(Deserialize, Debug, Clone)] +pub struct MintAsset { + pub unit: String, + pub amount: serde_json::Value, } #[derive(Deserialize, Debug, Clone)] @@ -38,7 +58,7 @@ pub struct TransactionDetail { pub invalid_before: i64, pub invalid_hereafter: i64, pub metadata: serde_json::Value, - pub mint: Vec, + pub mint: Vec, pub outputs: Vec, pub redeemers: Vec, pub reference_inputs: Vec, From 417fa272409cfaa50c1395863ea9bdb4b5cedbe5 Mon Sep 17 00:00:00 2001 From: Vardominator Date: Wed, 28 Aug 2024 15:37:41 +0000 Subject: [PATCH 4/5] yank --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 62de58a..605d27d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "maestro-rust-sdk" -version = "1.2.0" +version = "1.2.1" description = "Rust SDK for the Maestro Dapp Platform" repository = "https://github.com/maestro-org/rust-sdk" documentation = "https://docs.gomaestro.org/" From bac548a3433007e9fd3a28ffef307529951f28dc Mon Sep 17 00:00:00 2001 From: Vardominator Date: Wed, 28 Aug 2024 15:41:02 +0000 Subject: [PATCH 5/5] fix build --- .github/workflows/main.yml | 1 + Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3ecf503..4aab0a0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,7 @@ jobs: - name: Build run: cargo build --verbose - name: Publish to crates.io + if: github.event_name == 'push' && github.ref == 'refs/heads/main' run: cargo publish --token ${CRATES_TOKEN} env: CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index 605d27d..f30c3f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "maestro-rust-sdk" -version = "1.2.1" +version = "1.2.2" description = "Rust SDK for the Maestro Dapp Platform" repository = "https://github.com/maestro-org/rust-sdk" documentation = "https://docs.gomaestro.org/"