Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"bundle": "yarn redocly bundle -o ./blockfrost-openapi.yaml src/definitions.yaml && yarn openapi-merge-cli && yarn redocly bundle -o ./openapi.json ./openapi.yaml && yarn copy-spec && yarn build:midnight-docs",
"build:midnight-docs": "yarn spectaql ./spectaql.yaml && cp ./midnight-indexer-api.graphql ./docs/midnight/midnight-indexer-api.graphql",
"generate-types": "yarn openapi-typescript ./openapi.yaml --output ./src/generated-types.ts",
"generate-types:rust": "openapi-generator-cli generate -i openapi.yaml -g rust -o ./rust -c rust/openapi-generator.json -t rust/templates --global-property models,modelDocs=false,apis=false,apiDocs=false,supportingFiles && node rust/fix-cargo.js",
"generate-types:rust": "rimraf ./rust/src/models && openapi-generator-cli generate -i openapi.yaml -g rust -o ./rust -c rust/openapi-generator.json -t rust/templates --global-property models,modelDocs=false,apis=false,apiDocs=false,supportingFiles && node rust/fix-cargo.js",
"generate-json-schema": "node lib/scripts/generate-json-schema.js > json-schema.json",
"sync-version": "ts-node ./src/scripts/sync-version.ts",
"test": "vitest",
Expand Down
2 changes: 1 addition & 1 deletion rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blockfrost-openapi"
version = "0.1.88"
version = "0.1.90"
authors = ["contact@blockfrost.io"]
description = "Blockfrost OpenAPI types for Cardano"
license = "MIT"
Expand Down
8 changes: 5 additions & 3 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ For more information, please visit [https://blockfrost.io](https://blockfrost.io

This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.

- API version: 0.1.88
- Package version: 0.1.88
- API version: 0.1.90
- Package version: 0.1.90
- Generator version: 7.20.0
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`

Expand Down Expand Up @@ -322,10 +322,11 @@ Class | Method | HTTP request | Description
- [Drep](docs/Drep.md)
- [DrepDelegatorsInner](docs/DrepDelegatorsInner.md)
- [DrepMetadata](docs/DrepMetadata.md)
- [DrepMetadataError](docs/DrepMetadataError.md)
- [DrepUpdatesInner](docs/DrepUpdatesInner.md)
- [DrepVotesInner](docs/DrepVotesInner.md)
- [DrepsInner](docs/DrepsInner.md)
- [DrepsInnerMetadata](docs/DrepsInnerMetadata.md)
- [DrepsInnerMetadataError](docs/DrepsInnerMetadataError.md)
- [EpochContent](docs/EpochContent.md)
- [EpochParamContent](docs/EpochParamContent.md)
- [EpochSettingsMessage](docs/EpochSettingsMessage.md)
Expand Down Expand Up @@ -398,6 +399,7 @@ Class | Method | HTTP request | Description
- [ScriptDatumCbor](docs/ScriptDatumCbor.md)
- [ScriptJson](docs/ScriptJson.md)
- [ScriptRedeemersInner](docs/ScriptRedeemersInner.md)
- [ScriptUtxosInner](docs/ScriptUtxosInner.md)
- [ScriptsInner](docs/ScriptsInner.md)
- [Signer](docs/Signer.md)
- [SignerRegistrationsListItemMessage](docs/SignerRegistrationsListItemMessage.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct PoolsPoolIdMetadataGet200Response {
#[serde(rename = "hash", deserialize_with = "Option::deserialize")]
pub hash: Option<String>,
#[serde(rename = "error", skip_serializing_if = "Option::is_none")]
pub error: Option<Box<models::DrepMetadataError>>,
pub error: Option<Box<models::DrepsInnerMetadataError>>,
/// Ticker of the stake pool
#[serde(rename = "ticker", deserialize_with = "Option::deserialize")]
pub ticker: Option<String>,
Expand Down
4 changes: 2 additions & 2 deletions rust/src/models/drep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ pub struct Drep {
/// Epoch of the most recent registration
#[serde(rename = "active_epoch", deserialize_with = "Option::deserialize")]
pub active_epoch: Option<i32>,
/// Flag which shows if this DRep credentials are a script hash
/// Flag indicating whether this DRep's credential is a script hash
#[serde(rename = "has_script")]
pub has_script: bool,
/// Registration state of the DRep. Set to `true` if the DRep has been deregistered; otherwise, `false`.
#[serde(rename = "retired")]
pub retired: bool,
/// Whether the DRep has been inactive for a consecutive number of epochs (determined by a epoch parameter `drep_activity`)
/// Whether the DRep has been inactive for a consecutive number of epochs (determined by an epoch parameter `drep_activity`)
#[serde(rename = "expired")]
pub expired: bool,
/// Epoch of the most recent action - registration, update, deregistration or voting
Expand Down
2 changes: 1 addition & 1 deletion rust/src/models/drep_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct DrepMetadata {
#[serde(rename = "bytes", deserialize_with = "Option::deserialize")]
pub bytes: Option<String>,
#[serde(rename = "error", skip_serializing_if = "Option::is_none")]
pub error: Option<Box<models::DrepMetadataError>>,
pub error: Option<Box<models::DrepsInnerMetadataError>>,
}

impl DrepMetadata {
Expand Down
25 changes: 24 additions & 1 deletion rust/src/models/dreps_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,36 @@ pub struct DrepsInner {
/// The raw bytes of the DRep
#[serde(rename = "hex")]
pub hex: String,
/// The total amount of voting power this DRep is delegated.
#[serde(rename = "amount")]
pub amount: String,
/// Flag indicating whether this DRep's credential is a script hash
#[serde(rename = "has_script")]
pub has_script: bool,
/// Registration state of the DRep. Set to `true` if the DRep has been deregistered; otherwise, `false`.
#[serde(rename = "retired")]
pub retired: bool,
/// Whether the DRep has been inactive for a consecutive number of epochs (determined by an epoch parameter `drep_activity`)
#[serde(rename = "expired")]
pub expired: bool,
/// Epoch of the most recent action - registration, update, deregistration or voting
#[serde(rename = "last_active_epoch", deserialize_with = "Option::deserialize")]
pub last_active_epoch: Option<i32>,
#[serde(rename = "metadata", deserialize_with = "Option::deserialize")]
pub metadata: Option<Box<models::DrepsInnerMetadata>>,
}

impl DrepsInner {
pub fn new(drep_id: String, hex: String) -> DrepsInner {
pub fn new(drep_id: String, hex: String, amount: String, has_script: bool, retired: bool, expired: bool, last_active_epoch: Option<i32>, metadata: Option<models::DrepsInnerMetadata>) -> DrepsInner {
DrepsInner {
drep_id,
hex,
amount,
has_script,
retired,
expired,
last_active_epoch,
metadata: if let Some(x) = metadata {Some(Box::new(x))} else {None},
}
}
}
Expand Down
35 changes: 35 additions & 0 deletions rust/src/models/dreps_inner_metadata.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use crate::models;
use serde::{Deserialize, Serialize};

/// DrepsInnerMetadata : Off-chain metadata associated with the DRep's latest registration. `null` when the DRep has no registration anchor (e.g. special DReps such as `drep_always_abstain` / `drep_always_no_confidence`). When an anchor exists but the off-chain content could not be fetched or validated, `error` is populated and `json_metadata` / `bytes` are `null`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DrepsInnerMetadata {
/// URL to the drep metadata
#[serde(rename = "url")]
pub url: String,
/// Hash of the metadata file
#[serde(rename = "hash")]
pub hash: String,
/// Content of the JSON metadata (validated CIP-119)
#[serde(rename = "json_metadata", deserialize_with = "Option::deserialize")]
pub json_metadata: Option<serde_json::Value>,
/// Content of the metadata (raw)
#[serde(rename = "bytes", deserialize_with = "Option::deserialize")]
pub bytes: Option<String>,
#[serde(rename = "error", skip_serializing_if = "Option::is_none")]
pub error: Option<Box<models::DrepsInnerMetadataError>>,
}

impl DrepsInnerMetadata {
/// Off-chain metadata associated with the DRep's latest registration. `null` when the DRep has no registration anchor (e.g. special DReps such as `drep_always_abstain` / `drep_always_no_confidence`). When an anchor exists but the off-chain content could not be fetched or validated, `error` is populated and `json_metadata` / `bytes` are `null`.
pub fn new(url: String, hash: String, json_metadata: Option<serde_json::Value>, bytes: Option<String>) -> DrepsInnerMetadata {
DrepsInnerMetadata {
url,
hash,
json_metadata,
bytes,
error: None,
}
}
}

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::models;
use serde::{Deserialize, Serialize};
Comment on lines +1 to +2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems valid, why is it not a compilation error?


/// DrepMetadataError : Present when metadata could not be fetched or validated.
/// DrepsInnerMetadataError : Present when metadata could not be fetched or validated.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DrepMetadataError {
pub struct DrepsInnerMetadataError {
/// Stable machine-readable error code.
#[serde(rename = "code")]
pub code: Code,
Expand All @@ -12,10 +12,10 @@ pub struct DrepMetadataError {
pub message: String,
}

impl DrepMetadataError {
impl DrepsInnerMetadataError {
/// Present when metadata could not be fetched or validated.
pub fn new(code: Code, message: String) -> DrepMetadataError {
DrepMetadataError {
pub fn new(code: Code, message: String) -> DrepsInnerMetadataError {
DrepsInnerMetadataError {
code,
message,
}
Expand Down
8 changes: 6 additions & 2 deletions rust/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ pub mod drep_delegators_inner;
pub use self::drep_delegators_inner::DrepDelegatorsInner;
pub mod drep_metadata;
pub use self::drep_metadata::DrepMetadata;
pub mod drep_metadata_error;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You remove mod drep_metadata_error from the compilation's module tree, but it's still on disk:

https://github.com/blockfrost/openapi/blob/7e39cf2396afecd5d74779a25b7de7f4ad15c25d/rust/src/models/drep_metadata_error.rs

Perhaps we need to add a dead code check?

pub use self::drep_metadata_error::DrepMetadataError;
pub mod drep_updates_inner;
pub use self::drep_updates_inner::DrepUpdatesInner;
pub mod drep_votes_inner;
pub use self::drep_votes_inner::DrepVotesInner;
pub mod dreps_inner;
pub use self::dreps_inner::DrepsInner;
pub mod dreps_inner_metadata;
pub use self::dreps_inner_metadata::DrepsInnerMetadata;
pub mod dreps_inner_metadata_error;
pub use self::dreps_inner_metadata_error::DrepsInnerMetadataError;
pub mod epoch_content;
pub use self::epoch_content::EpochContent;
pub mod epoch_param_content;
Expand Down Expand Up @@ -268,6 +270,8 @@ pub mod script_json;
pub use self::script_json::ScriptJson;
pub mod script_redeemers_inner;
pub use self::script_redeemers_inner::ScriptRedeemersInner;
pub mod script_utxos_inner;
pub use self::script_utxos_inner::ScriptUtxosInner;
pub mod scripts_inner;
pub use self::scripts_inner::ScriptsInner;
pub mod signer;
Expand Down
2 changes: 1 addition & 1 deletion rust/src/models/pool_list_extended_inner_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct PoolListExtendedInnerMetadata {
#[serde(rename = "hash", deserialize_with = "Option::deserialize")]
pub hash: Option<String>,
#[serde(rename = "error", skip_serializing_if = "Option::is_none")]
pub error: Option<Box<models::DrepMetadataError>>,
pub error: Option<Box<models::DrepsInnerMetadataError>>,
/// Ticker of the stake pool
#[serde(rename = "ticker", deserialize_with = "Option::deserialize")]
pub ticker: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion rust/src/models/pool_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct PoolMetadata {
#[serde(rename = "hash", deserialize_with = "Option::deserialize")]
pub hash: Option<String>,
#[serde(rename = "error", skip_serializing_if = "Option::is_none")]
pub error: Option<Box<models::DrepMetadataError>>,
pub error: Option<Box<models::DrepsInnerMetadataError>>,
/// Ticker of the stake pool
#[serde(rename = "ticker", deserialize_with = "Option::deserialize")]
pub ticker: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion rust/src/models/proposal_metadata_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct ProposalMetadataV2 {
#[serde(rename = "bytes", deserialize_with = "Option::deserialize")]
pub bytes: Option<String>,
#[serde(rename = "error", skip_serializing_if = "Option::is_none")]
pub error: Option<Box<models::DrepMetadataError>>,
pub error: Option<Box<models::DrepsInnerMetadataError>>,
}

impl ProposalMetadataV2 {
Expand Down
Loading
Loading