We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 35f4301 + 074bd92 commit 5b3bd79Copy full SHA for 5b3bd79
Cargo.lock
Cargo.toml
@@ -35,6 +35,7 @@ members = [
35
"processes/replayer", # All-inclusive process to replay messages
36
"processes/golden_tests", # All-inclusive golden tests process
37
"processes/tx_submitter_cli", # CLI wrapper for TX submitter
38
+ "processes/indexer", # Minimal example indexer
39
]
40
resolver = "2"
41
common/Cargo.toml
@@ -29,6 +29,7 @@ regex = "1"
29
serde = { workspace = true, features = ["rc"] }
30
serde_json = { workspace = true }
31
serde_with = { workspace = true, features = ["base64"] }
32
+tempfile = "3"
33
tokio = { workspace = true }
34
tracing = { workspace = true }
futures = "0.3.31"
common/src/commands/chain_sync.rs
@@ -0,0 +1,6 @@
1
+use crate::{BlockHash, Slot};
2
+
3
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
4
+pub enum ChainSyncCommand {
5
+ FindIntersect { slot: Slot, hash: BlockHash },
6
+}
common/src/commands/mod.rs
@@ -1 +1,2 @@
+pub mod chain_sync;
pub mod transactions;
common/src/messages.rs
@@ -3,6 +3,7 @@
// We don't use these messages in the acropolis_common crate itself
#![allow(dead_code)]
+use crate::commands::chain_sync::ChainSyncCommand;
7
use crate::commands::transactions::{TransactionsCommand, TransactionsCommandResponse};
8
use crate::genesis_values::GenesisValues;
9
use crate::ledger_state::SPOState;
@@ -453,6 +454,7 @@ pub enum StateQueryResponse {
453
454
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
455
pub enum Command {
456
Transactions(TransactionsCommand),
457
+ ChainSync(ChainSyncCommand),
458
}
459
460
common/src/queries/assets.rs
@@ -1,7 +1,7 @@
use crate::queries::errors::QueryError;
use crate::{
- AssetAddressEntry, AssetInfoRecord, AssetMintRecord, AssetName, PolicyAsset, PolicyId,
- TxIdentifier,
+ AssetAddressEntry, AssetInfoRecord, AssetMetadata, AssetMintRecord, AssetName, NativeAssets,
+ PolicyAsset, PolicyId, TxIdentifier,
};
pub const DEFAULT_ASSETS_QUERY_TOPIC: (&str, &str) =
@@ -27,6 +27,7 @@ pub enum AssetsStateQuery {
27
GetPolicyIdAssets { policy: PolicyId },
28
GetAssetAddresses { policy: PolicyId, name: AssetName },
GetAssetTransactions { policy: PolicyId, name: AssetName },
+ GetAssetsMetadata { assets: NativeAssets },
@@ -37,5 +38,6 @@ pub enum AssetsStateQueryResponse {
AssetAddresses(AssetAddresses),
AssetTransactions(AssetTransactions),
PolicyIdAssets(PolicyAssets),
+ AssetsMetadata(Vec<AssetMetadata>),
42
Error(QueryError),
43
common/src/types.rs
@@ -2121,8 +2121,15 @@ pub struct TxCertificateWithPos {
2121
pub struct AssetInfoRecord {
2122
pub initial_mint_tx: TxIdentifier,
2123
pub mint_or_burn_count: u64,
2124
- pub onchain_metadata: Option<Vec<u8>>,
2125
- pub metadata_standard: Option<AssetMetadataStandard>,
+ pub metadata: AssetMetadata,
2126
2127
+#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
2128
+pub struct AssetMetadata {
2129
+ pub cip25_metadata: Option<Vec<u8>>,
2130
+ pub cip25_version: Option<AssetMetadataStandard>,
2131
+ pub cip68_metadata: Option<Vec<u8>>,
2132
+ pub cip68_version: Option<AssetMetadataStandard>,
2133
2134
2135
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
modules/assets_state/src/assets_state.rs
@@ -443,6 +443,18 @@ impl AssetsState {
443
)),
444
445
446
+ AssetsStateQuery::GetAssetsMetadata { assets } => {
447
+ let reg = registry.lock().await;
448
+ match state.get_assets_metadata(assets, ®) {
449
+ Ok(Some(assets)) => AssetsStateQueryResponse::AssetsMetadata(assets),
450
+ Ok(None) => AssetsStateQueryResponse::Error(QueryError::not_found(
451
+ "One or more assets not found in registry".to_string(),
452
+ )),
+ Err(e) => AssetsStateQueryResponse::Error(QueryError::internal_error(
+ e.to_string(),
+ }
Arc::new(Message::StateQueryResponse(StateQueryResponse::Assets(
response,
0 commit comments