diff --git a/Cargo.lock b/Cargo.lock index d66bc7a96..b9565ad40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9658,6 +9658,7 @@ dependencies = [ "thiserror 1.0.68", "tokio", "tokio-stream", + "url", ] [[package]] @@ -9782,6 +9783,8 @@ dependencies = [ "tari_crypto", "tari_dan_common_types", "tari_dan_storage", + "tari_engine_types", + "tari_template_lib", "tari_utilities", "thiserror 1.0.68", ] @@ -10560,6 +10563,7 @@ dependencies = [ "tari_template_lib", "tari_transaction", "tari_transaction_manifest", + "thiserror 1.0.68", ] [[package]] diff --git a/applications/tari_dan_app_utilities/Cargo.toml b/applications/tari_dan_app_utilities/Cargo.toml index 2f33963c3..9208deead 100644 --- a/applications/tari_dan_app_utilities/Cargo.toml +++ b/applications/tari_dan_app_utilities/Cargo.toml @@ -58,3 +58,4 @@ tokio = { workspace = true, features = [ ] } tokio-stream = { workspace = true, features = ["sync"] } config = { workspace = true } +url = { workspace = true } diff --git a/applications/tari_dan_app_utilities/src/base_layer_scanner.rs b/applications/tari_dan_app_utilities/src/base_layer_scanner.rs index 0452c0309..9d407a121 100644 --- a/applications/tari_dan_app_utilities/src/base_layer_scanner.rs +++ b/applications/tari_dan_app_utilities/src/base_layer_scanner.rs @@ -23,6 +23,7 @@ use std::time::Duration; use log::*; +use reqwest::Url; use tari_base_node_client::{ grpc::GrpcBaseNodeClient, types::{BaseLayerMetadata, BlockInfo}, @@ -61,14 +62,15 @@ use tari_dan_storage::{ StorageError, }; use tari_dan_storage_sqlite::{error::SqliteStorageError, global::SqliteGlobalDbAdapter}; -use tari_engine_types::{confidential::UnclaimedConfidentialOutput, substate::SubstateId}; +use tari_engine_types::{confidential::UnclaimedConfidentialOutput, substate::SubstateId, TemplateAddress}; use tari_epoch_manager::{base_layer::EpochManagerHandle, EpochManagerError, EpochManagerReader}; use tari_shutdown::ShutdownSignal; use tari_state_store_sqlite::SqliteStateStore; -use tari_template_lib::models::{EncryptedData, TemplateAddress, UnclaimedConfidentialOutputAddress}; +use tari_template_lib::models::{EncryptedData, UnclaimedConfidentialOutputAddress}; use tokio::{task, task::JoinHandle, time}; +use url::ParseError; -use crate::template_manager::interface::{TemplateManagerError, TemplateManagerHandle, TemplateRegistration}; +use crate::template_manager::interface::{TemplateExecutable, TemplateManagerError, TemplateManagerHandle}; const LOG_TARGET: &str = "tari::dan::base_layer_scanner"; @@ -76,30 +78,31 @@ pub fn spawn( global_db: GlobalDb>, base_node_client: GrpcBaseNodeClient, epoch_manager: EpochManagerHandle, - template_manager: TemplateManagerHandle, shutdown: ShutdownSignal, consensus_constants: ConsensusConstants, shard_store: SqliteStateStore, scan_base_layer: bool, base_layer_scanning_interval: Duration, validator_node_sidechain_id: Option, - template_sidechain_id: Option, burnt_utxo_sidechain_id: Option, + // TODO: remove when base layer template registration is removed too + template_manager: TemplateManagerHandle, + template_sidechain_id: Option, ) -> JoinHandle> { task::spawn(async move { let base_layer_scanner = BaseLayerScanner::new( global_db, base_node_client, epoch_manager, - template_manager, shutdown, consensus_constants, shard_store, scan_base_layer, base_layer_scanning_interval, validator_node_sidechain_id, - template_sidechain_id, burnt_utxo_sidechain_id, + template_manager, + template_sidechain_id, ); base_layer_scanner.start().await?; @@ -116,7 +119,6 @@ pub struct BaseLayerScanner { next_block_hash: Option, base_node_client: GrpcBaseNodeClient, epoch_manager: EpochManagerHandle, - template_manager: TemplateManagerHandle, shutdown: ShutdownSignal, consensus_constants: ConsensusConstants, state_store: SqliteStateStore, @@ -124,8 +126,10 @@ pub struct BaseLayerScanner { base_layer_scanning_interval: Duration, has_attempted_scan: bool, validator_node_sidechain_id: Option, - template_sidechain_id: Option, burnt_utxo_sidechain_id: Option, + // TODO: remove template related data, when removed base layer template registration support + template_manager: TemplateManagerHandle, + template_sidechain_id: Option, } impl BaseLayerScanner { @@ -133,15 +137,15 @@ impl BaseLayerScanner { global_db: GlobalDb>, base_node_client: GrpcBaseNodeClient, epoch_manager: EpochManagerHandle, - template_manager: TemplateManagerHandle, shutdown: ShutdownSignal, consensus_constants: ConsensusConstants, state_store: SqliteStateStore, scan_base_layer: bool, base_layer_scanning_interval: Duration, validator_node_sidechain_id: Option, - template_sidechain_id: Option, burnt_utxo_sidechain_id: Option, + template_manager: TemplateManagerHandle, + template_sidechain_id: Option, ) -> Self { Self { global_db, @@ -152,7 +156,6 @@ impl BaseLayerScanner { next_block_hash: None, base_node_client, epoch_manager, - template_manager, shutdown, consensus_constants, state_store, @@ -160,8 +163,9 @@ impl BaseLayerScanner { base_layer_scanning_interval, has_attempted_scan: false, validator_node_sidechain_id, - template_sidechain_id, burnt_utxo_sidechain_id, + template_manager, + template_sidechain_id, } } @@ -344,14 +348,14 @@ impl BaseLayerScanner { if sidechain_feature.sidechain_public_key() != self.validator_node_sidechain_id.as_ref() { debug!( target: LOG_TARGET, - "Ignoring code template registration for sidechain ID {:?}. Local node's sidechain ID: {:?}", + "Ignoring code template registration for sidechain ID {:?}.", sidechain_feature.sidechain_public_key(), - self.template_sidechain_id, ); continue; } trace!(target: LOG_TARGET, "New validator node registration scanned: {reg:?}"); }, + // TODO: remove completely SideChainFeature::CodeTemplateRegistration at some point SideChainFeatureData::CodeTemplateRegistration(reg) => { if sidechain_feature.sidechain_public_key() != self.template_sidechain_id.as_ref() { debug!( @@ -460,6 +464,32 @@ impl BaseLayerScanner { Ok(()) } + async fn register_code_template_registration( + &mut self, + template_name: String, + template_address: TemplateAddress, + registration: CodeTemplateRegistration, + block_info: &BlockInfo, + ) -> Result<(), BaseLayerScannerError> { + info!( + target: LOG_TARGET, + "🌠 new template found with address {} at height {}", template_address, block_info.height + ); + self.template_manager + .add_template( + registration.author_public_key, + template_address, + TemplateExecutable::DownloadableWasm( + Url::parse(registration.binary_url.as_str())?, + registration.binary_sha, + ), + Some(template_name), + ) + .await?; + + Ok(()) + } + async fn update_validators(&mut self, epoch: Epoch) -> Result<(), BaseLayerScannerError> { info!( target: LOG_TARGET, @@ -508,8 +538,8 @@ impl BaseLayerScanner { ) -> Result<(), BaseLayerScannerError> { let commitment_address = UnclaimedConfidentialOutputAddress::try_from_commitment(output.commitment.as_bytes()) .map_err(|e| - // Technically impossible, but anyway - BaseLayerScannerError::InvalidSideChainUtxoResponse(format!("Invalid commitment: {}", e)))?; + // Technically impossible, but anyway + BaseLayerScannerError::InvalidSideChainUtxoResponse(format!("Invalid commitment: {}", e)))?; let substate_id = SubstateId::UnclaimedConfidentialOutput(commitment_address); let consensus_constants = self.epoch_manager.get_base_layer_consensus_constants().await?; let epoch = consensus_constants.height_to_epoch(block_info.height); @@ -605,29 +635,6 @@ impl BaseLayerScanner { Ok(()) } - async fn register_code_template_registration( - &mut self, - template_name: String, - template_address: TemplateAddress, - registration: CodeTemplateRegistration, - block_info: &BlockInfo, - ) -> Result<(), BaseLayerScannerError> { - info!( - target: LOG_TARGET, - "🌠 new template found with address {} at height {}", template_address, block_info.height - ); - let template = TemplateRegistration { - template_name, - template_address, - registration, - mined_height: block_info.height, - mined_hash: block_info.hash, - }; - self.template_manager.add_template(template).await?; - - Ok(()) - } - fn set_last_scanned_block(&mut self, tip: FixedHash, block_info: &BlockInfo) -> Result<(), BaseLayerScannerError> { let mut tx = self.global_db.create_transaction()?; let mut metadata = self.global_db.metadata(&mut tx); @@ -652,8 +659,6 @@ pub enum BaseLayerScannerError { SqliteStorageError(#[from] SqliteStorageError), #[error("Epoch manager error: {0}")] EpochManagerError(#[from] EpochManagerError), - #[error("Template manager error: {0}")] - TemplateManagerError(#[from] TemplateManagerError), #[error("Base node client error: {0}")] BaseNodeError(#[from] BaseNodeClientError), #[error("Invalid side chain utxo response: {0}")] @@ -667,6 +672,10 @@ pub enum BaseLayerScannerError { PublicKeyConversion(ByteArrayError), #[error("GRPC conversion error: {0}")] GrpcConversion(String), + #[error("Template manager error: {0}")] + TemplateManagerError(#[from] TemplateManagerError), + #[error("URL parse error: {0}")] + UrlParse(#[from] ParseError), } enum BlockchainProgression { diff --git a/applications/tari_dan_app_utilities/src/template_manager/implementation/downloader.rs b/applications/tari_dan_app_utilities/src/template_manager/implementation/downloader.rs index 7325cd422..1109507ff 100644 --- a/applications/tari_dan_app_utilities/src/template_manager/implementation/downloader.rs +++ b/applications/tari_dan_app_utilities/src/template_manager/implementation/downloader.rs @@ -20,6 +20,9 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// TODO: rewrite downloader to get template from other peer(s) OR completely drop this concept and implement somewhere +// else + use bytes::Bytes; use futures::{future::BoxFuture, stream::FuturesUnordered}; use prost::bytes; diff --git a/applications/tari_dan_app_utilities/src/template_manager/implementation/manager.rs b/applications/tari_dan_app_utilities/src/template_manager/implementation/manager.rs index 1583a0320..f65504c63 100644 --- a/applications/tari_dan_app_utilities/src/template_manager/implementation/manager.rs +++ b/applications/tari_dan_app_utilities/src/template_manager/implementation/manager.rs @@ -24,7 +24,8 @@ use std::{collections::HashMap, convert::TryFrom, fs, sync::Arc}; use chrono::Utc; use log::*; -use tari_core::transactions::transaction_components::TemplateType; +use tari_common_types::types::{FixedHash, PublicKey}; +use tari_crypto::tari_utilities::ByteArray; use tari_dan_common_types::{optional::Optional, services::template_provider::TemplateProvider, NodeAddressable}; use tari_dan_engine::{ flow::FlowFactory, @@ -34,19 +35,19 @@ use tari_dan_engine::{ }; use tari_dan_storage::global::{DbTemplate, DbTemplateType, DbTemplateUpdate, GlobalDb, TemplateStatus}; use tari_dan_storage_sqlite::global::SqliteGlobalDbAdapter; -use tari_engine_types::calculate_template_binary_hash; +use tari_engine_types::{calculate_template_binary_hash, hashing::template_hasher32}; use tari_template_builtin::{ get_template_builtin, ACCOUNT_NFT_TEMPLATE_ADDRESS, ACCOUNT_TEMPLATE_ADDRESS, FAUCET_TEMPLATE_ADDRESS, }; -use tari_template_lib::models::TemplateAddress; +use tari_template_lib::{models::TemplateAddress, Hash}; use super::TemplateConfig; use crate::template_manager::{ implementation::cmap_semaphore, - interface::{Template, TemplateExecutable, TemplateManagerError, TemplateMetadata, TemplateRegistration}, + interface::{Template, TemplateExecutable, TemplateManagerError, TemplateMetadata}, }; const LOG_TARGET: &str = "tari::validator_node::template_manager"; @@ -118,9 +119,7 @@ impl TemplateManager { metadata: TemplateMetadata { name: name.to_string(), address, - url: "".to_string(), binary_sha, - height: 0, }, executable: TemplateExecutable::CompiledWasm(compiled_code), } @@ -186,28 +185,70 @@ impl TemplateManager { Ok(templates) } - pub(super) fn add_template(&self, template: TemplateRegistration) -> Result<(), TemplateManagerError> { + pub(super) fn add_template( + &self, + author_public_key: PublicKey, + template_address: tari_engine_types::TemplateAddress, + template: TemplateExecutable, + template_name: Option, + template_status: Option, + ) -> Result<(), TemplateManagerError> { + enum TemplateHash { + Hash(Hash), + FixedHash(FixedHash), + } + + let mut compiled_code = None; + let mut flow_json = None; + let mut manifest = None; + let mut template_type = DbTemplateType::Wasm; + let template_hash: TemplateHash; + let mut template_name = template_name.unwrap_or(String::from("default")); + let mut template_url = None; + match template { + TemplateExecutable::CompiledWasm(binary) => { + let loaded_template = WasmModule::load_template_from_code(binary.as_slice())?; + template_hash = TemplateHash::Hash(template_hasher32().chain(binary.as_slice()).result()); + compiled_code = Some(binary); + template_name = loaded_template.template_name().to_string(); + }, + TemplateExecutable::Manifest(curr_manifest) => { + template_hash = TemplateHash::Hash(template_hasher32().chain(curr_manifest.as_str()).result()); + manifest = Some(curr_manifest); + template_type = DbTemplateType::Manifest; + }, + TemplateExecutable::Flow(curr_flow_json) => { + template_hash = TemplateHash::Hash(template_hasher32().chain(curr_flow_json.as_str()).result()); + flow_json = Some(curr_flow_json); + template_type = DbTemplateType::Flow; + }, + TemplateExecutable::DownloadableWasm(url, hash) => { + template_url = Some(url.to_string()); + template_type = DbTemplateType::Wasm; + template_hash = TemplateHash::FixedHash(hash); + }, + } + let template = DbTemplate { - template_name: template.template_name, - template_address: template.template_address.into_array().into(), - expected_hash: template.registration.binary_sha.as_ref().try_into()?, - url: template.registration.binary_url.into_string(), - height: template.mined_height, - status: TemplateStatus::New, - compiled_code: None, - added_at: Utc::now().naive_utc(), - template_type: match template.registration.template_type { - TemplateType::Wasm { .. } => DbTemplateType::Wasm, - TemplateType::Flow { .. } => DbTemplateType::Flow, - TemplateType::Manifest { .. } => DbTemplateType::Manifest, + author_public_key: FixedHash::try_from(author_public_key.to_vec().as_slice())?, + template_name, + template_address, + expected_hash: match template_hash { + TemplateHash::Hash(hash) => FixedHash::from(hash.into_array()), + TemplateHash::FixedHash(hash) => hash, }, - flow_json: None, - manifest: None, + status: template_status.unwrap_or(TemplateStatus::New), + compiled_code, + added_at: Utc::now().naive_utc(), + template_type, + flow_json, + manifest, + url: template_url, }; let mut tx = self.global_db.create_transaction()?; let mut templates_db = self.global_db.templates(&mut tx); - if templates_db.get_template(&*template.template_address)?.is_some() { + if templates_db.get_template(&template.template_address)?.is_some() { return Ok(()); } templates_db.insert_template(template)?; @@ -275,12 +316,31 @@ impl TemplateProvider for Templa let factory = FlowFactory::try_create::(definition)?; LoadedTemplate::Flow(factory) }, + TemplateExecutable::DownloadableWasm(_, _) => { + // impossible case, since there is no separate downloadable wasm type in DB level + return Err(Self::Error::UnsupportedTemplateType); + }, }; self.cache.insert(*address, loaded.clone()); Ok(Some(loaded)) } + + fn add_wasm_template( + &self, + author_public_key: PublicKey, + template_address: tari_engine_types::TemplateAddress, + template: &[u8], + ) -> Result<(), Self::Error> { + self.add_template( + author_public_key, + template_address, + TemplateExecutable::CompiledWasm(template.to_vec()), + None, + Some(TemplateStatus::Active), + ) + } } impl Clone for TemplateManager { diff --git a/applications/tari_dan_app_utilities/src/template_manager/implementation/service.rs b/applications/tari_dan_app_utilities/src/template_manager/implementation/service.rs index 60d46690b..b588968cb 100644 --- a/applications/tari_dan_app_utilities/src/template_manager/implementation/service.rs +++ b/applications/tari_dan_app_utilities/src/template_manager/implementation/service.rs @@ -20,11 +20,11 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::convert::TryFrom; +// TODO: rewrite downloader to get template from other peer(s) OR completely drop this concept and implement somewhere +// else use log::*; -use tari_common_types::types::FixedHash; -use tari_core::transactions::transaction_components::TemplateType; +use tari_common_types::types::PublicKey; use tari_dan_common_types::{services::template_provider::TemplateProvider, NodeAddressable}; use tari_dan_engine::function_definitions::FlowFunctionDefinition; use tari_dan_storage::global::{DbTemplateType, DbTemplateUpdate, TemplateStatus}; @@ -41,7 +41,7 @@ use super::{ downloader::{DownloadRequest, DownloadResult}, TemplateManager, }; -use crate::template_manager::interface::{TemplateManagerError, TemplateManagerRequest, TemplateRegistration}; +use crate::template_manager::interface::{TemplateExecutable, TemplateManagerError, TemplateManagerRequest}; const LOG_TARGET: &str = "tari::template_manager"; @@ -101,9 +101,9 @@ impl TemplateManagerService { .download_queue .send(DownloadRequest { template_type: template.template_type, - address: Hash::try_from(template.template_address.as_slice()).unwrap(), - url: template.url.clone(), + address: Hash::from(template.template_address.into_array()), expected_binary_hash: template.expected_hash, + url: template.url.unwrap(), }) .await; info!( @@ -119,8 +119,18 @@ impl TemplateManagerService { #[allow(clippy::enum_glob_use)] use TemplateManagerRequest::*; match req { - AddTemplate { template, reply } => { - handle(reply, self.handle_add_template(*template).await); + AddTemplate { + author_public_key, + template_address, + template, + template_name, + reply, + } => { + handle( + reply, + self.handle_add_template(author_public_key, template_address, template, template_name) + .await, + ); }, GetTemplate { address, reply } => { handle(reply, self.manager.fetch_template(&address)); @@ -227,33 +237,46 @@ impl TemplateManagerService { Ok(()) } - async fn handle_add_template(&mut self, template: TemplateRegistration) -> Result<(), TemplateManagerError> { - let address = template.template_address; - let url = template.registration.binary_url.to_string(); - let template_type = match template.registration.template_type { - TemplateType::Wasm { .. } => DbTemplateType::Wasm, - TemplateType::Flow => DbTemplateType::Flow, - TemplateType::Manifest => DbTemplateType::Manifest, + async fn handle_add_template( + &mut self, + author_public_key: PublicKey, + template_address: tari_engine_types::TemplateAddress, + template: TemplateExecutable, + template_name: Option, + ) -> Result<(), TemplateManagerError> { + let template_status = if matches!(template, TemplateExecutable::DownloadableWasm(_, _)) { + TemplateStatus::New + } else { + TemplateStatus::Active }; - let expected_binary_hash = FixedHash::try_from(template.registration.binary_sha.as_ref()) - .map_err(|_| TemplateManagerError::InvalidBaseLayerTemplate)?; - self.manager.add_template(template)?; - // We could queue this up much later, at which point we'd update to pending - self.manager.update_template(address, DbTemplateUpdate { - status: Some(TemplateStatus::Pending), - ..Default::default() - })?; + self.manager.add_template( + author_public_key, + template_address, + template.clone(), + template_name, + Some(template_status), + )?; + + // TODO: remove when we remove support for base layer template registration + // update template status and add to download queue if it's a downloadable template + if let TemplateExecutable::DownloadableWasm(url, expected_binary_hash) = template { + // We could queue this up much later, at which point we'd update to pending + self.manager.update_template(template_address, DbTemplateUpdate { + status: Some(TemplateStatus::Pending), + ..Default::default() + })?; + + let _ignore = self + .download_queue + .send(DownloadRequest { + address: template_address, + template_type: DbTemplateType::Wasm, + url: url.to_string(), + expected_binary_hash, + }) + .await; + } - let _ignore = self - .download_queue - .send(DownloadRequest { - template_type, - address, - url, - expected_binary_hash, - }) - .await; - info!(target: LOG_TARGET, "⏳️️ Template {} queued for download", address); Ok(()) } } diff --git a/applications/tari_dan_app_utilities/src/template_manager/interface/handle.rs b/applications/tari_dan_app_utilities/src/template_manager/interface/handle.rs index 703611c60..a62244a56 100644 --- a/applications/tari_dan_app_utilities/src/template_manager/interface/handle.rs +++ b/applications/tari_dan_app_utilities/src/template_manager/interface/handle.rs @@ -20,13 +20,12 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use tari_common_types::types::FixedHash; -use tari_core::transactions::transaction_components::CodeTemplateRegistration; +use tari_common_types::types::PublicKey; use tari_template_lib::models::TemplateAddress; use tari_validator_node_client::types::TemplateAbi; use tokio::sync::{mpsc, oneshot}; -use super::{types::TemplateManagerRequest, Template, TemplateManagerError, TemplateMetadata}; +use super::{types::TemplateManagerRequest, Template, TemplateExecutable, TemplateManagerError, TemplateMetadata}; #[derive(Debug, Clone)] pub struct TemplateManagerHandle { @@ -38,18 +37,6 @@ impl TemplateManagerHandle { Self { request_tx } } - pub async fn add_template(&self, template: TemplateRegistration) -> Result<(), TemplateManagerError> { - let (tx, rx) = oneshot::channel(); - self.request_tx - .send(TemplateManagerRequest::AddTemplate { - template: Box::new(template), - reply: tx, - }) - .await - .map_err(|_| TemplateManagerError::ChannelClosed)?; - rx.await.map_err(|_| TemplateManagerError::ChannelClosed)? - } - pub async fn get_template(&self, address: TemplateAddress) -> Result { let (tx, rx) = oneshot::channel(); self.request_tx @@ -76,13 +63,25 @@ impl TemplateManagerHandle { .map_err(|_| TemplateManagerError::ChannelClosed)?; rx.await.map_err(|_| TemplateManagerError::ChannelClosed)? } -} -#[derive(Debug, Clone)] -pub struct TemplateRegistration { - pub template_name: String, - pub template_address: TemplateAddress, - pub registration: CodeTemplateRegistration, - pub mined_height: u64, - pub mined_hash: FixedHash, + pub async fn add_template( + &self, + author_public_key: PublicKey, + template_address: TemplateAddress, + template: TemplateExecutable, + template_name: Option, + ) -> Result<(), TemplateManagerError> { + let (tx, rx) = oneshot::channel(); + self.request_tx + .send(TemplateManagerRequest::AddTemplate { + author_public_key, + template_address, + template, + template_name, + reply: tx, + }) + .await + .map_err(|_| TemplateManagerError::ChannelClosed)?; + rx.await.map_err(|_| TemplateManagerError::ChannelClosed)? + } } diff --git a/applications/tari_dan_app_utilities/src/template_manager/interface/mod.rs b/applications/tari_dan_app_utilities/src/template_manager/interface/mod.rs index 1dd5e3db5..d51d11bda 100644 --- a/applications/tari_dan_app_utilities/src/template_manager/interface/mod.rs +++ b/applications/tari_dan_app_utilities/src/template_manager/interface/mod.rs @@ -25,5 +25,5 @@ mod handle; mod types; pub use error::TemplateManagerError; -pub use handle::{TemplateManagerHandle, TemplateRegistration}; +pub use handle::TemplateManagerHandle; pub use types::{Template, TemplateExecutable, TemplateManagerRequest, TemplateMetadata}; diff --git a/applications/tari_dan_app_utilities/src/template_manager/interface/types.rs b/applications/tari_dan_app_utilities/src/template_manager/interface/types.rs index e92ebec37..08f3a60dd 100644 --- a/applications/tari_dan_app_utilities/src/template_manager/interface/types.rs +++ b/applications/tari_dan_app_utilities/src/template_manager/interface/types.rs @@ -20,38 +20,21 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use tari_common_types::types::FixedHash; +use reqwest::Url; +use tari_common_types::types::{FixedHash, PublicKey}; use tari_dan_storage::global::{DbTemplate, DbTemplateType}; use tari_template_lib::models::TemplateAddress; use tari_validator_node_client::types::TemplateAbi; use tokio::sync::oneshot; -use super::{TemplateManagerError, TemplateRegistration}; +use super::TemplateManagerError; #[derive(Debug, Clone)] pub struct TemplateMetadata { pub name: String, pub address: TemplateAddress, - // this must be in the form of "https://example.com/my_template.wasm" - pub url: String, /// SHA hash of binary pub binary_sha: FixedHash, - /// Block height in which the template was published - pub height: u64, -} - -impl From for TemplateMetadata { - fn from(reg: TemplateRegistration) -> Self { - TemplateMetadata { - name: reg.template_name, - address: reg.template_address, - url: reg.registration.binary_url.into_string(), - binary_sha: FixedHash::try_from(reg.registration.binary_sha.as_ref()) - // TODO: impl Fallible conversion - .expect("binary_sha must be 32 bytes long"), - height: reg.mined_height, - } - } } // TODO: Allow fetching of just the template metadata without the compiled code @@ -59,10 +42,8 @@ impl From for TemplateMetadata { fn from(record: DbTemplate) -> Self { TemplateMetadata { name: record.template_name, - address: (*record.template_address).into(), - url: record.url, + address: record.template_address, binary_sha: FixedHash::zero(), - height: record.height, } } } @@ -72,6 +53,9 @@ pub enum TemplateExecutable { CompiledWasm(Vec), Manifest(String), Flow(String), + // TODO: remove this when base layer template registration is removed + /// WASM binary download URL and binary hash + DownloadableWasm(Url, FixedHash), } #[derive(Debug, Clone)] @@ -87,11 +71,9 @@ impl From for Template { metadata: TemplateMetadata { name: record.template_name, // TODO: this will change when common engine types are moved around - address: (*record.template_address).into(), - url: record.url, + address: record.template_address, // TODO: add field to db binary_sha: FixedHash::zero(), - height: record.height, }, executable: match record.template_type { DbTemplateType::Wasm => TemplateExecutable::CompiledWasm(record.compiled_code.unwrap()), @@ -105,7 +87,10 @@ impl From for Template { #[derive(Debug)] pub enum TemplateManagerRequest { AddTemplate { - template: Box, + author_public_key: PublicKey, + template_address: tari_engine_types::TemplateAddress, + template: TemplateExecutable, + template_name: Option, reply: oneshot::Sender>, }, GetTemplate { diff --git a/applications/tari_dan_wallet_cli/src/command/transaction.rs b/applications/tari_dan_wallet_cli/src/command/transaction.rs index 3929e8bdb..0d53eb86b 100644 --- a/applications/tari_dan_wallet_cli/src/command/transaction.rs +++ b/applications/tari_dan_wallet_cli/src/command/transaction.rs @@ -542,6 +542,9 @@ pub fn print_substate_diff(diff: &SubstateDiff) { to_hex(fee_claim.validator_public_key.as_bytes()) ); }, + SubstateValue::Template(_) => { + println!(" ▶ Template: {}", address); + }, } println!(); } @@ -834,6 +837,7 @@ impl CliArg { SubstateId::NonFungibleIndex(v) => arg!(v), SubstateId::TransactionReceipt(v) => arg!(v), SubstateId::FeeClaim(v) => arg!(v), + SubstateId::Template(v) => arg!(v), }, CliArg::TemplateAddress(v) => arg!(v), CliArg::NonFungibleId(v) => arg!(v), diff --git a/applications/tari_indexer/src/bootstrap.rs b/applications/tari_indexer/src/bootstrap.rs index e0458f766..b1c415d97 100644 --- a/applications/tari_indexer/src/bootstrap.rs +++ b/applications/tari_indexer/src/bootstrap.rs @@ -151,7 +151,6 @@ pub async fn spawn_services( global_db, base_node_client.clone(), epoch_manager.clone(), - template_manager_service.clone(), shutdown.clone(), consensus_constants, // TODO: Remove coupling between scanner and shard store @@ -162,8 +161,9 @@ pub async fn spawn_services( true, config.indexer.base_layer_scanning_interval, config.indexer.sidechain_id.clone(), - config.indexer.templates_sidechain_id.clone(), config.indexer.burnt_utxo_sidechain_id.clone(), + template_manager_service, + config.indexer.templates_sidechain_id.clone(), ); // Save final node identity after comms has initialized. This is required because the public_address can be diff --git a/applications/tari_indexer/src/json_rpc/handlers.rs b/applications/tari_indexer/src/json_rpc/handlers.rs index 171400499..3f0cfcf89 100644 --- a/applications/tari_indexer/src/json_rpc/handlers.rs +++ b/applications/tari_indexer/src/json_rpc/handlers.rs @@ -586,7 +586,10 @@ impl JsonRpcHandlers { TemplateExecutable::CompiledWasm(code) => WasmModule::from_code(code) .load_template() .map_err(|e| Self::internal_error(answer_id, format!("Error loading template: {}", e)))?, - TemplateExecutable::Manifest(_) | TemplateExecutable::Flow(_) => { + // TemplateExecutable::DownloadableWasm is never returned ad there is no DB type for that + TemplateExecutable::DownloadableWasm(_, _) | + TemplateExecutable::Manifest(_) | + TemplateExecutable::Flow(_) => { return Err(JsonRpcResponse::error( answer_id, JsonRpcError::new( @@ -618,9 +621,7 @@ impl JsonRpcHandlers { .map(|t| TemplateMetadata { name: t.name, address: t.address, - url: t.url, binary_sha: to_hex(t.binary_sha.as_slice()), - height: t.height, }) .collect(), })) diff --git a/applications/tari_swarm_daemon/src/process_manager/handle.rs b/applications/tari_swarm_daemon/src/process_manager/handle.rs index 11d9488c6..03a28880a 100644 --- a/applications/tari_swarm_daemon/src/process_manager/handle.rs +++ b/applications/tari_swarm_daemon/src/process_manager/handle.rs @@ -66,7 +66,8 @@ pub struct TemplateData { pub name: String, pub version: u32, pub contents_hash: FixedHash, - pub contents_url: Url, + // TODO: remove when base layer registration removed + pub contents_url: Option, } pub struct InstanceInfo { diff --git a/applications/tari_swarm_daemon/src/process_manager/manager.rs b/applications/tari_swarm_daemon/src/process_manager/manager.rs index c0943e3a8..a501a4bdd 100644 --- a/applications/tari_swarm_daemon/src/process_manager/manager.rs +++ b/applications/tari_swarm_daemon/src/process_manager/manager.rs @@ -4,16 +4,15 @@ use std::{ collections::{HashMap, HashSet}, fs::File, + net::SocketAddr, path::PathBuf, - str::FromStr, time::Duration, }; use anyhow::{anyhow, Context}; use log::info; -use minotari_node_grpc_client::grpc; +use minotari_wallet_grpc_client::grpc; use tari_common_types::types::FixedHash; -use tari_crypto::tari_utilities::ByteArray; use tari_dan_engine::wasm::WasmModule; use tari_engine_types::{calculate_template_binary_hash, TemplateAddress}; use tari_shutdown::ShutdownSignal; @@ -62,7 +61,10 @@ impl ProcessManager { shutdown_signal, disable_template_auto_register: !config.auto_register_previous_templates, base_dir: config.base_dir.clone(), - web_server_port: config.webserver.bind_address.port(), + web_server_port: match config.webserver.bind_address { + SocketAddr::V4(addr) => addr.port(), + SocketAddr::V6(addr) => addr.port(), + }, }; (this, ProcessManagerHandle::new(tx_request)) } @@ -140,7 +142,7 @@ impl ProcessManager { if let Some(extension) = dir_entry.path().extension() { if extension == "wasm" { let file_name = dir_entry.file_name(); - let file_name = file_name.to_str().ok_or(anyhow!("Can't get file name!"))?; + let file_name = file_name.to_str().unwrap(); let file_content = tokio::fs::read(dir_entry.path()).await?; let loaded = WasmModule::load_template_from_code(file_content.as_slice())?; let name = loaded.template_def().template_name().to_string(); @@ -149,10 +151,9 @@ impl ProcessManager { name, version: 0, contents_hash: hash, - contents_url: Url::parse(&format!( - "http://localhost:{}/templates/{}", - self.web_server_port, file_name - ))?, + contents_url: Some(Url::parse( + format!("http://localhost:{}/templates/{}", self.web_server_port, file_name).as_str(), + )?), }) } } @@ -176,22 +177,11 @@ impl ProcessManager { .await? .templates .iter() - .map(|metadata| { - let url = if let Ok(url) = Url::from_str(metadata.url.as_str()) { - url - } else { - Url::parse(&format!( - "http://localhost:{}/templates/{}", - self.web_server_port, metadata.name - )) - .unwrap() - }; - TemplateData { - name: metadata.name.clone(), - version: 0, - contents_hash: FixedHash::try_from(metadata.binary_sha.as_slice()).unwrap_or_default(), - contents_url: url, - } + .map(|metadata| TemplateData { + name: metadata.name.clone(), + version: 0, + contents_hash: FixedHash::try_from(metadata.binary_sha.as_slice()).unwrap_or_default(), + contents_url: None, }) .collect()) } @@ -532,7 +522,10 @@ impl ProcessManager { commit_hash: vec![], }), binary_sha: data.contents_hash.to_vec(), - binary_url: data.contents_url.to_string(), + binary_url: data + .contents_url + .ok_or(anyhow!("WASM download URL is missing!"))? + .to_string(), sidechain_deployment_key: vec![], }) .await? diff --git a/applications/tari_swarm_daemon/src/webserver/templates.rs b/applications/tari_swarm_daemon/src/webserver/templates.rs index d3b720470..bfd25a382 100644 --- a/applications/tari_swarm_daemon/src/webserver/templates.rs +++ b/applications/tari_swarm_daemon/src/webserver/templates.rs @@ -94,7 +94,7 @@ pub async fn upload( name, version: 0, contents_hash: hash, - contents_url: template_url.clone(), + contents_url: Some(template_url.clone()), }; return match context.process_manager().register_template(data).await { diff --git a/applications/tari_validator_node/src/bootstrap.rs b/applications/tari_validator_node/src/bootstrap.rs index 2e4186823..d7c07d807 100644 --- a/applications/tari_validator_node/src/bootstrap.rs +++ b/applications/tari_validator_node/src/bootstrap.rs @@ -353,15 +353,15 @@ pub async fn spawn_services( global_db.clone(), base_node_client.clone(), epoch_manager.clone(), - template_manager_service.clone(), shutdown.clone(), consensus_constants, state_store.clone(), config.validator_node.scan_base_layer, config.validator_node.base_layer_scanning_interval, config.validator_node.validator_node_sidechain_id.clone(), - config.validator_node.template_sidechain_id.clone(), config.validator_node.burnt_utxo_sidechain_id.clone(), + template_manager_service.clone(), + config.validator_node.template_sidechain_id.clone(), ); handles.push(join_handle); diff --git a/applications/tari_validator_node/src/dan_node.rs b/applications/tari_validator_node/src/dan_node.rs index f9b498945..270fdb1a5 100644 --- a/applications/tari_validator_node/src/dan_node.rs +++ b/applications/tari_validator_node/src/dan_node.rs @@ -22,7 +22,15 @@ use log::*; use tari_consensus::hotstuff::HotstuffEvent; -use tari_dan_storage::{consensus_models::Block, StateStore}; +use tari_dan_app_utilities::template_manager::interface::TemplateExecutable; +use tari_dan_storage::{ + consensus_models::{Block, Decision}, + StateStore, +}; +use tari_engine_types::{ + commit_result::TransactionResult, + substate::{SubstateId, SubstateValue}, +}; use tari_epoch_manager::{EpochManagerEvent, EpochManagerReader}; use tari_networking::NetworkingService; use tari_shutdown::ShutdownSignal; @@ -85,6 +93,59 @@ impl DanNode { Ok(()) } + /// Handles template publishes, adds all the committed templates to template manager + /// from the given block. + async fn handle_template_publishes(&self, block: &Block) -> Result<(), anyhow::Error> { + // add wasm templates to template manager if available in any of the new block's transactions + let templates = self + .services + .state_store + .with_read_tx(|tx| block.get_transactions(tx))? + .into_iter() + .filter(|record| matches!(record.final_decision, Some(Decision::Commit))) + .filter_map(|record| { + let result = record.execution_result?; + let TransactionResult::Accept(diff) = result.finalize.result else { + return None; + }; + let tx_signature = record.transaction.signatures().first()?; + let signer_pub_key = tx_signature.public_key().clone(); + Some((signer_pub_key, diff)) + }) + .flat_map(|(signer_pub_key, diff)| { + let mut templates = vec![]; + for (substate_id, substate) in diff.into_up_iter() { + if let SubstateId::Template(template_address) = substate_id { + let template_address_hash = template_address.as_hash(); + if let SubstateValue::Template(template) = substate.into_substate_value() { + templates.push(( + signer_pub_key.clone(), + template_address_hash, + TemplateExecutable::CompiledWasm(template.binary), + )); + } + } + } + templates + }); + + // adding templates to template manager + let mut template_counter = 0; + for (author_pub_key, template_address, template) in templates { + self.services + .template_manager + .add_template(author_pub_key, template_address, template, None) + .await?; + template_counter += 1; + } + + if template_counter > 0 { + info!(target: LOG_TARGET, "🏁 {} new template(s) have been persisted locally.", template_counter); + } + + Ok(()) + } + async fn handle_hotstuff_event(&self, event: HotstuffEvent) -> Result<(), anyhow::Error> { info!(target: LOG_TARGET, "🔥 consensus event: {event}"); @@ -93,7 +154,11 @@ impl DanNode { }; let block = self.services.state_store.with_read_tx(|tx| Block::get(tx, &block_id))?; + info!(target: LOG_TARGET, "🏁 Block {} committed", block); + + self.handle_template_publishes(&block).await?; + let committed_transactions = block .commands() .iter() diff --git a/applications/tari_validator_node/src/json_rpc/handlers.rs b/applications/tari_validator_node/src/json_rpc/handlers.rs index 4be691868..9df4ea4cc 100644 --- a/applications/tari_validator_node/src/json_rpc/handlers.rs +++ b/applications/tari_validator_node/src/json_rpc/handlers.rs @@ -479,9 +479,7 @@ impl JsonRpcHandlers { .map(|t| TemplateMetadata { name: t.name, address: t.address, - url: t.url, binary_sha: t.binary_sha.to_vec(), - height: t.height, }) .collect(), })) @@ -507,9 +505,7 @@ impl JsonRpcHandlers { registration_metadata: TemplateMetadata { name: template.metadata.name, address: template.metadata.address, - url: template.metadata.url, binary_sha: template.metadata.binary_sha.to_vec(), - height: template.metadata.height, }, abi, })) diff --git a/applications/tari_validator_node_cli/src/command/template.rs b/applications/tari_validator_node_cli/src/command/template.rs index 2c6673ba6..594ead6fb 100644 --- a/applications/tari_validator_node_cli/src/command/template.rs +++ b/applications/tari_validator_node_cli/src/command/template.rs @@ -52,10 +52,7 @@ async fn handle_get(template_address: TemplateAddress, mut client: ValidatorNode registration_metadata, abi, } = client.get_template(GetTemplateRequest { template_address }).await?; - println!( - "Template {} | Mined at {}", - registration_metadata.address, registration_metadata.height - ); + println!("Template {}", registration_metadata.address); println!(); let mut table = Table::new(); @@ -80,17 +77,9 @@ async fn handle_list(mut client: ValidatorNodeClient) -> Result<(), anyhow::Erro let templates = client.get_active_templates(GetTemplatesRequest { limit: 10 }).await?; let mut table = Table::new(); - table - .set_titles(vec!["Name", "Address", "Download Url", "Mined Height", "Status"]) - .enable_row_count(); + table.set_titles(vec!["Name", "Address", "Status"]).enable_row_count(); for template in templates.templates { - table.add_row(table_row![ - template.name, - template.address, - template.url, - template.height, - "Active" - ]); + table.add_row(table_row![template.name, template.address, "Active"]); } table.print_stdout(); Ok(()) diff --git a/applications/tari_validator_node_cli/src/command/transaction.rs b/applications/tari_validator_node_cli/src/command/transaction.rs index cf795baae..b488251e8 100644 --- a/applications/tari_validator_node_cli/src/command/transaction.rs +++ b/applications/tari_validator_node_cli/src/command/transaction.rs @@ -391,6 +391,9 @@ fn print_substate_diff(diff: &SubstateDiff) { println!(" ▶ amount: {}", fee_claim.amount); println!(" ▶ recipient: {}", fee_claim.validator_public_key); }, + SubstateValue::Template(_) => { + println!(" ▶ Template: {}", address); + }, } println!(); } @@ -718,6 +721,7 @@ impl CliArg { SubstateId::NonFungibleIndex(v) => arg!(v), SubstateId::TransactionReceipt(v) => arg!(v), SubstateId::FeeClaim(v) => arg!(v), + SubstateId::Template(v) => arg!(v), }, CliArg::TemplateAddress(v) => arg!(v), CliArg::NonFungibleId(v) => arg!(v), diff --git a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Templates.tsx b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Templates.tsx index 13d0d32cd..4b0e560ed 100644 --- a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Templates.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Templates.tsx @@ -20,9 +20,9 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import { useEffect, useState } from "react"; -import { getTemplates } from "../../../utils/json_rpc"; -import { shortenString } from "./helpers"; +import {useEffect, useState} from "react"; +import {getTemplates} from "../../../utils/json_rpc"; +import {shortenString} from "./helpers"; import "./Templates.css"; import Table from "@mui/material/Table"; import TableBody from "@mui/material/TableBody"; @@ -30,8 +30,8 @@ import TableCell from "@mui/material/TableCell"; import TableContainer from "@mui/material/TableContainer"; import TableHead from "@mui/material/TableHead"; import TableRow from "@mui/material/TableRow"; -import { DataTableCell, BoxHeading2 } from "../../../Components/StyledComponents"; -import { Link } from "react-router-dom"; +import {BoxHeading2, DataTableCell} from "../../../Components/StyledComponents"; +import {Link} from "react-router-dom"; import CopyToClipboard from "../../../Components/CopyToClipboard"; import IconButton from "@mui/material/IconButton"; import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight"; @@ -42,208 +42,152 @@ import TablePagination from "@mui/material/TablePagination"; import SearchFilter from "../../../Components/SearchFilter"; import Typography from "@mui/material/Typography"; import Fade from "@mui/material/Fade"; -import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined"; -import { emptyRows } from "../../../utils/helpers"; -import type { TemplateMetadata } from "@tari-project/typescript-bindings"; +import {emptyRows} from "../../../utils/helpers"; +import type {TemplateMetadata} from "@tari-project/typescript-bindings"; type ColumnKey = keyof TemplateMetadata; function Templates() { - const [templates, setTemplates] = useState([]); - const [lastSort, setLastSort] = useState({ column: "", order: -1 }); + const [templates, setTemplates] = useState([]); + const [lastSort, setLastSort] = useState({column: "", order: -1}); - useEffect(() => { - getTemplates({ limit: 10 }).then((response) => { - setTemplates(response.templates.slice().sort((a: TemplateMetadata, b: TemplateMetadata) => b.height - a.height)); - }); - }, []); + useEffect(() => { + getTemplates({limit: 10}).then((response) => { + setTemplates(response.templates.slice()); + }); + }, []); - const sort = (column: ColumnKey, order: number) => { - // let order = 1; - // if (lastSort.column === column) { - // order = -lastSort.order; - // } - if (column) { - setTemplates( - [...templates].sort((r0, r1) => (r0[column] > r1[column] ? order : r0[column] < r1[column] ? -order : 0)), - ); - setLastSort({ column, order }); - } - }; + const sort = (column: ColumnKey, order: number) => { + // let order = 1; + // if (lastSort.column === column) { + // order = -lastSort.order; + // } + if (column) { + setTemplates( + [...templates].sort((r0, r1) => (r0[column] > r1[column] ? order : r0[column] < r1[column] ? -order : 0)), + ); + setLastSort({column, order}); + } + }; - const [page, setPage] = useState(0); - const [rowsPerPage, setRowsPerPage] = useState(10); + const [page, setPage] = useState(0); + const [rowsPerPage, setRowsPerPage] = useState(10); - // Avoid a layout jump when reaching the last page with empty rows. - const emptyRowsCnt = emptyRows(page, rowsPerPage, templates); + // Avoid a layout jump when reaching the last page with empty rows. + const emptyRowsCnt = emptyRows(page, rowsPerPage, templates); - const handleChangePage = (_event: unknown, newPage: number) => { - setPage(newPage); - }; + const handleChangePage = (_event: unknown, newPage: number) => { + setPage(newPage); + }; - const handleChangeRowsPerPage = (event: React.ChangeEvent) => { - setRowsPerPage(parseInt(event.target.value, 10)); - setPage(0); - }; + const handleChangeRowsPerPage = (event: React.ChangeEvent) => { + setRowsPerPage(parseInt(event.target.value, 10)); + setPage(0); + }; - return ( - <> - - - row.address.toLowerCase().includes(value.toLowerCase()), - }, - { - title: "Mined Height", - value: "height", - filterFn: (value: string, row: TemplateMetadata) => row.height.toString().includes(value), - }, - ]} - placeholder="Search for Templates" - /> - - - - - - - sort("id" as ColumnKey, 1), - icon: , - }, - { - title: "Sort Descending", - fn: () => sort("id" as ColumnKey, -1), - icon: , - }, - ]} - showArrow - lastSort={lastSort} - columnName="id" - sortFunction={sort} + return ( + <> + + + row.address.toLowerCase().includes(value.toLowerCase()), + }, + ]} + placeholder="Search for Templates" /> - - Name - Download URL - - sort("height", 1), - icon: , - }, - { - title: "Sort Descending", - fn: () => sort("height", -1), - icon: , - }, - ]} - showArrow - lastSort={lastSort} - columnName="height" - sortFunction={sort} + + +
+ + + + sort("id" as ColumnKey, 1), + icon: , + }, + { + title: "Sort Descending", + fn: () => sort("id" as ColumnKey, -1), + icon: , + }, + ]} + showArrow + lastSort={lastSort} + columnName="id" + sortFunction={sort} + /> + + Name + Status + Functions + + + + {templates + .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) + .map(({address, binary_sha, name}, i) => ( + + + + {shortenString(address)} + + + + {name} + Active + + + + + + + + + ))} + {templates.length === 0 && ( + + + + No results found + + + + )} + {emptyRowsCnt > 0 && ( + + + + )} + +
+ - - Status - Functions - - - - {templates - .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) - .map(({ address, binary_sha, height, url, name }, i) => ( - - - - {shortenString(address)} - - - - {name} - - {url && ( - <> - - Download - - - - - - )} - - {height} - Active - - - - - - - - - ))} - {templates.length === 0 && ( - - - - No results found - - - - )} - {emptyRowsCnt > 0 && ( - - - - )} - - - -
- - ); + + + ); } export default Templates; diff --git a/bindings/dist/index.d.ts b/bindings/dist/index.d.ts index 4ca5f8260..7e3e7cf5b 100644 --- a/bindings/dist/index.d.ts +++ b/bindings/dist/index.d.ts @@ -2,25 +2,25 @@ export * from "./types/AbortReason"; export * from "./types/AccessRule"; export * from "./types/Account"; export * from "./types/Amount"; -export * from "./types/ArgDef"; export * from "./types/Arg"; +export * from "./types/ArgDef"; export * from "./types/AuthHook"; -export * from "./types/BlockHeader"; export * from "./types/Block"; +export * from "./types/BlockHeader"; export * from "./types/BucketId"; export * from "./types/Claims"; export * from "./types/Command"; +export * from "./types/Committee"; export * from "./types/CommitteeInfo"; export * from "./types/CommitteeShardInfo"; -export * from "./types/Committee"; export * from "./types/ComponentAccessRules"; export * from "./types/ComponentAddress"; export * from "./types/ComponentBody"; export * from "./types/ComponentHeader"; export * from "./types/ComponentKey"; export * from "./types/ConfidentialClaim"; -export * from "./types/ConfidentialOutputStatement"; export * from "./types/ConfidentialOutput"; +export * from "./types/ConfidentialOutputStatement"; export * from "./types/ConfidentialStatement"; export * from "./types/ConfidentialTransferInputSelection"; export * from "./types/ConfidentialWithdrawProof"; @@ -32,12 +32,12 @@ export * from "./types/Era"; export * from "./types/Event"; export * from "./types/EvictNodeAtom"; export * from "./types/Evidence"; -export * from "./types/ExecutedTransaction"; export * from "./types/ExecuteResult"; +export * from "./types/ExecutedTransaction"; export * from "./types/ExtraData"; export * from "./types/FeeBreakdown"; -export * from "./types/FeeClaimAddress"; export * from "./types/FeeClaim"; +export * from "./types/FeeClaimAddress"; export * from "./types/FeeCostBreakdown"; export * from "./types/FeeReceipt"; export * from "./types/FeeSource"; @@ -46,10 +46,10 @@ export * from "./types/ForeignProposalAtom"; export * from "./types/FunctionDef"; export * from "./types/IndexedValue"; export * from "./types/IndexedWellKnownTypes"; -export * from "./types/InstructionResult"; export * from "./types/Instruction"; -export * from "./types/JrpcPermissions"; +export * from "./types/InstructionResult"; export * from "./types/JrpcPermission"; +export * from "./types/JrpcPermissions"; export * from "./types/LeaderFee"; export * from "./types/LockFlag"; export * from "./types/LogEntry"; @@ -58,67 +58,69 @@ export * from "./types/Metadata"; export * from "./types/MintConfidentialOutputAtom"; export * from "./types/NetworkCommitteeInfo"; export * from "./types/NodeHeight"; -export * from "./types/NonFungibleAddressContents"; +export * from "./types/NonFungible"; export * from "./types/NonFungibleAddress"; +export * from "./types/NonFungibleAddressContents"; export * from "./types/NonFungibleContainer"; export * from "./types/NonFungibleId"; -export * from "./types/NonFungibleIndexAddress"; export * from "./types/NonFungibleIndex"; +export * from "./types/NonFungibleIndexAddress"; export * from "./types/NonFungibleToken"; -export * from "./types/NonFungible"; export * from "./types/NumPreshards"; export * from "./types/Ordering"; export * from "./types/OwnerRule"; export * from "./types/PeerAddress"; export * from "./types/ProofId"; +export * from "./types/PublishedTemplate"; +export * from "./types/PublishedTemplateAddress"; export * from "./types/QuorumCertificate"; export * from "./types/QuorumDecision"; export * from "./types/RejectReason"; export * from "./types/RequireRule"; +export * from "./types/Resource"; export * from "./types/ResourceAccessRules"; export * from "./types/ResourceAddress"; export * from "./types/ResourceContainer"; -export * from "./types/Resource"; export * from "./types/ResourceType"; export * from "./types/RestrictedAccessRule"; export * from "./types/ResumeNodeAtom"; export * from "./types/RuleRequirement"; +export * from "./types/Shard"; export * from "./types/ShardEvidence"; -export * from "./types/ShardGroupEvidence"; export * from "./types/ShardGroup"; -export * from "./types/Shard"; +export * from "./types/ShardGroupEvidence"; +export * from "./types/Substate"; export * from "./types/SubstateAddress"; export * from "./types/SubstateDestroyed"; export * from "./types/SubstateDiff"; export * from "./types/SubstateId"; export * from "./types/SubstateLockType"; export * from "./types/SubstateRecord"; -export * from "./types/SubstateRequirementLockIntent"; export * from "./types/SubstateRequirement"; -export * from "./types/Substate"; +export * from "./types/SubstateRequirementLockIntent"; export * from "./types/SubstateType"; export * from "./types/SubstateValue"; export * from "./types/SuspendNodeAtom"; export * from "./types/TemplateDef"; export * from "./types/TemplateDefV1"; +export * from "./types/Transaction"; export * from "./types/TransactionAtom"; export * from "./types/TransactionPoolRecord"; export * from "./types/TransactionPoolStage"; -export * from "./types/TransactionReceiptAddress"; export * from "./types/TransactionReceipt"; +export * from "./types/TransactionReceiptAddress"; export * from "./types/TransactionResult"; export * from "./types/TransactionSignature"; export * from "./types/TransactionStatus"; -export * from "./types/Transaction"; export * from "./types/Type"; -export * from "./types/UnclaimedConfidentialOutputAddress"; export * from "./types/UnclaimedConfidentialOutput"; +export * from "./types/UnclaimedConfidentialOutputAddress"; export * from "./types/UnsignedTransaction"; export * from "./types/ValidatorSignature"; -export * from "./types/VaultId"; export * from "./types/Vault"; -export * from "./types/VersionedSubstateIdLockIntent"; +export * from "./types/VaultId"; export * from "./types/VersionedSubstateId"; +export * from "./types/VersionedSubstateIdLockIntent"; export * from "./types/ViewableBalanceProof"; export * from "./base-node-client"; export * from "./tari-indexer-client"; diff --git a/bindings/dist/index.js b/bindings/dist/index.js index 4dfb6fe4b..ebd36777e 100644 --- a/bindings/dist/index.js +++ b/bindings/dist/index.js @@ -4,25 +4,25 @@ export * from "./types/AbortReason"; export * from "./types/AccessRule"; export * from "./types/Account"; export * from "./types/Amount"; -export * from "./types/ArgDef"; export * from "./types/Arg"; +export * from "./types/ArgDef"; export * from "./types/AuthHook"; -export * from "./types/BlockHeader"; export * from "./types/Block"; +export * from "./types/BlockHeader"; export * from "./types/BucketId"; export * from "./types/Claims"; export * from "./types/Command"; +export * from "./types/Committee"; export * from "./types/CommitteeInfo"; export * from "./types/CommitteeShardInfo"; -export * from "./types/Committee"; export * from "./types/ComponentAccessRules"; export * from "./types/ComponentAddress"; export * from "./types/ComponentBody"; export * from "./types/ComponentHeader"; export * from "./types/ComponentKey"; export * from "./types/ConfidentialClaim"; -export * from "./types/ConfidentialOutputStatement"; export * from "./types/ConfidentialOutput"; +export * from "./types/ConfidentialOutputStatement"; export * from "./types/ConfidentialStatement"; export * from "./types/ConfidentialTransferInputSelection"; export * from "./types/ConfidentialWithdrawProof"; @@ -34,12 +34,12 @@ export * from "./types/Era"; export * from "./types/Event"; export * from "./types/EvictNodeAtom"; export * from "./types/Evidence"; -export * from "./types/ExecutedTransaction"; export * from "./types/ExecuteResult"; +export * from "./types/ExecutedTransaction"; export * from "./types/ExtraData"; export * from "./types/FeeBreakdown"; -export * from "./types/FeeClaimAddress"; export * from "./types/FeeClaim"; +export * from "./types/FeeClaimAddress"; export * from "./types/FeeCostBreakdown"; export * from "./types/FeeReceipt"; export * from "./types/FeeSource"; @@ -48,10 +48,10 @@ export * from "./types/ForeignProposalAtom"; export * from "./types/FunctionDef"; export * from "./types/IndexedValue"; export * from "./types/IndexedWellKnownTypes"; -export * from "./types/InstructionResult"; export * from "./types/Instruction"; -export * from "./types/JrpcPermissions"; +export * from "./types/InstructionResult"; export * from "./types/JrpcPermission"; +export * from "./types/JrpcPermissions"; export * from "./types/LeaderFee"; export * from "./types/LockFlag"; export * from "./types/LogEntry"; @@ -60,67 +60,69 @@ export * from "./types/Metadata"; export * from "./types/MintConfidentialOutputAtom"; export * from "./types/NetworkCommitteeInfo"; export * from "./types/NodeHeight"; -export * from "./types/NonFungibleAddressContents"; +export * from "./types/NonFungible"; export * from "./types/NonFungibleAddress"; +export * from "./types/NonFungibleAddressContents"; export * from "./types/NonFungibleContainer"; export * from "./types/NonFungibleId"; -export * from "./types/NonFungibleIndexAddress"; export * from "./types/NonFungibleIndex"; +export * from "./types/NonFungibleIndexAddress"; export * from "./types/NonFungibleToken"; -export * from "./types/NonFungible"; export * from "./types/NumPreshards"; export * from "./types/Ordering"; export * from "./types/OwnerRule"; export * from "./types/PeerAddress"; export * from "./types/ProofId"; +export * from "./types/PublishedTemplate"; +export * from "./types/PublishedTemplateAddress"; export * from "./types/QuorumCertificate"; export * from "./types/QuorumDecision"; export * from "./types/RejectReason"; export * from "./types/RequireRule"; +export * from "./types/Resource"; export * from "./types/ResourceAccessRules"; export * from "./types/ResourceAddress"; export * from "./types/ResourceContainer"; -export * from "./types/Resource"; export * from "./types/ResourceType"; export * from "./types/RestrictedAccessRule"; export * from "./types/ResumeNodeAtom"; export * from "./types/RuleRequirement"; +export * from "./types/Shard"; export * from "./types/ShardEvidence"; -export * from "./types/ShardGroupEvidence"; export * from "./types/ShardGroup"; -export * from "./types/Shard"; +export * from "./types/ShardGroupEvidence"; +export * from "./types/Substate"; export * from "./types/SubstateAddress"; export * from "./types/SubstateDestroyed"; export * from "./types/SubstateDiff"; export * from "./types/SubstateId"; export * from "./types/SubstateLockType"; export * from "./types/SubstateRecord"; -export * from "./types/SubstateRequirementLockIntent"; export * from "./types/SubstateRequirement"; -export * from "./types/Substate"; +export * from "./types/SubstateRequirementLockIntent"; export * from "./types/SubstateType"; export * from "./types/SubstateValue"; export * from "./types/SuspendNodeAtom"; export * from "./types/TemplateDef"; export * from "./types/TemplateDefV1"; +export * from "./types/Transaction"; export * from "./types/TransactionAtom"; export * from "./types/TransactionPoolRecord"; export * from "./types/TransactionPoolStage"; -export * from "./types/TransactionReceiptAddress"; export * from "./types/TransactionReceipt"; +export * from "./types/TransactionReceiptAddress"; export * from "./types/TransactionResult"; export * from "./types/TransactionSignature"; export * from "./types/TransactionStatus"; -export * from "./types/Transaction"; export * from "./types/Type"; -export * from "./types/UnclaimedConfidentialOutputAddress"; export * from "./types/UnclaimedConfidentialOutput"; +export * from "./types/UnclaimedConfidentialOutputAddress"; export * from "./types/UnsignedTransaction"; export * from "./types/ValidatorSignature"; -export * from "./types/VaultId"; export * from "./types/Vault"; -export * from "./types/VersionedSubstateIdLockIntent"; +export * from "./types/VaultId"; export * from "./types/VersionedSubstateId"; +export * from "./types/VersionedSubstateIdLockIntent"; export * from "./types/ViewableBalanceProof"; export * from "./base-node-client"; export * from "./tari-indexer-client"; diff --git a/bindings/dist/tari-indexer-client.d.ts b/bindings/dist/tari-indexer-client.d.ts index 2bc290afb..03fbfd537 100644 --- a/bindings/dist/tari-indexer-client.d.ts +++ b/bindings/dist/tari-indexer-client.d.ts @@ -1,34 +1,34 @@ -export * from "./types/tari-indexer-client/IndexerSubmitTransactionResponse"; +export * from "./types/tari-indexer-client/IndexerGetEpochManagerStatsResponse"; +export * from "./types/tari-indexer-client/IndexerAddPeerRequest"; +export * from "./types/tari-indexer-client/NonFungibleSubstate"; +export * from "./types/tari-indexer-client/GetNonFungibleCountResponse"; +export * from "./types/tari-indexer-client/ListSubstatesRequest"; +export * from "./types/tari-indexer-client/IndexerGetIdentityResponse"; export * from "./types/tari-indexer-client/GetTemplateDefinitionRequest"; -export * from "./types/tari-indexer-client/ListSubstatesResponse"; -export * from "./types/tari-indexer-client/IndexerAddPeerResponse"; -export * from "./types/tari-indexer-client/InspectSubstateRequest"; -export * from "./types/tari-indexer-client/ListSubstateItem"; +export * from "./types/tari-indexer-client/IndexerGetSubstateRequest"; +export * from "./types/tari-indexer-client/GetTemplateDefinitionResponse"; +export * from "./types/tari-indexer-client/ListTemplatesRequest"; export * from "./types/tari-indexer-client/IndexerGetAllVnsResponse"; -export * from "./types/tari-indexer-client/ListSubstatesRequest"; -export * from "./types/tari-indexer-client/GetRelatedTransactionsResponse"; -export * from "./types/tari-indexer-client/IndexerTransactionFinalizedResult"; +export * from "./types/tari-indexer-client/GetNonFungiblesRequest"; export * from "./types/tari-indexer-client/IndexerGetSubstateResponse"; +export * from "./types/tari-indexer-client/IndexerSubmitTransactionRequest"; +export * from "./types/tari-indexer-client/IndexerConnection"; +export * from "./types/tari-indexer-client/InspectSubstateResponse"; export * from "./types/tari-indexer-client/IndexerGetAllVnsRequest"; +export * from "./types/tari-indexer-client/InspectSubstateRequest"; export * from "./types/tari-indexer-client/IndexerGetCommsStatsResponse"; -export * from "./types/tari-indexer-client/IndexerConnection"; -export * from "./types/tari-indexer-client/GetNonFungiblesRequest"; -export * from "./types/tari-indexer-client/IndexerAddPeerRequest"; -export * from "./types/tari-indexer-client/GetRelatedTransactionsRequest"; -export * from "./types/tari-indexer-client/GetNonFungiblesResponse"; -export * from "./types/tari-indexer-client/GetTemplateDefinitionResponse"; +export * from "./types/tari-indexer-client/GetNonFungibleCountRequest"; +export * from "./types/tari-indexer-client/GetRelatedTransactionsResponse"; +export * from "./types/tari-indexer-client/IndexerAddPeerResponse"; export * from "./types/tari-indexer-client/IndexerGetConnectionsResponse"; -export * from "./types/tari-indexer-client/IndexerSubmitTransactionRequest"; +export * from "./types/tari-indexer-client/GetNonFungiblesResponse"; +export * from "./types/tari-indexer-client/GetRelatedTransactionsRequest"; +export * from "./types/tari-indexer-client/IndexerGetTransactionResultResponse"; export * from "./types/tari-indexer-client/ListTemplatesResponse"; -export * from "./types/tari-indexer-client/InspectSubstateResponse"; +export * from "./types/tari-indexer-client/IndexerGetTransactionResultRequest"; +export * from "./types/tari-indexer-client/ListSubstatesResponse"; +export * from "./types/tari-indexer-client/IndexerTransactionFinalizedResult"; export * from "./types/tari-indexer-client/GetNonFungibleCollectionsResponse"; -export * from "./types/tari-indexer-client/IndexerGetSubstateRequest"; -export * from "./types/tari-indexer-client/IndexerGetEpochManagerStatsResponse"; -export * from "./types/tari-indexer-client/NonFungibleSubstate"; -export * from "./types/tari-indexer-client/GetNonFungibleCountResponse"; -export * from "./types/tari-indexer-client/ListTemplatesRequest"; -export * from "./types/tari-indexer-client/IndexerGetTransactionResultResponse"; +export * from "./types/tari-indexer-client/IndexerSubmitTransactionResponse"; export * from "./types/tari-indexer-client/IndexerConnectionDirection"; -export * from "./types/tari-indexer-client/IndexerGetIdentityResponse"; -export * from "./types/tari-indexer-client/IndexerGetTransactionResultRequest"; -export * from "./types/tari-indexer-client/GetNonFungibleCountRequest"; +export * from "./types/tari-indexer-client/ListSubstateItem"; diff --git a/bindings/dist/tari-indexer-client.js b/bindings/dist/tari-indexer-client.js index d6c53a6f9..633c07b9e 100644 --- a/bindings/dist/tari-indexer-client.js +++ b/bindings/dist/tari-indexer-client.js @@ -1,36 +1,36 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -export * from "./types/tari-indexer-client/IndexerSubmitTransactionResponse"; +export * from "./types/tari-indexer-client/IndexerGetEpochManagerStatsResponse"; +export * from "./types/tari-indexer-client/IndexerAddPeerRequest"; +export * from "./types/tari-indexer-client/NonFungibleSubstate"; +export * from "./types/tari-indexer-client/GetNonFungibleCountResponse"; +export * from "./types/tari-indexer-client/ListSubstatesRequest"; +export * from "./types/tari-indexer-client/IndexerGetIdentityResponse"; export * from "./types/tari-indexer-client/GetTemplateDefinitionRequest"; -export * from "./types/tari-indexer-client/ListSubstatesResponse"; -export * from "./types/tari-indexer-client/IndexerAddPeerResponse"; -export * from "./types/tari-indexer-client/InspectSubstateRequest"; -export * from "./types/tari-indexer-client/ListSubstateItem"; +export * from "./types/tari-indexer-client/IndexerGetSubstateRequest"; +export * from "./types/tari-indexer-client/GetTemplateDefinitionResponse"; +export * from "./types/tari-indexer-client/ListTemplatesRequest"; export * from "./types/tari-indexer-client/IndexerGetAllVnsResponse"; -export * from "./types/tari-indexer-client/ListSubstatesRequest"; -export * from "./types/tari-indexer-client/GetRelatedTransactionsResponse"; -export * from "./types/tari-indexer-client/IndexerTransactionFinalizedResult"; +export * from "./types/tari-indexer-client/GetNonFungiblesRequest"; export * from "./types/tari-indexer-client/IndexerGetSubstateResponse"; +export * from "./types/tari-indexer-client/IndexerSubmitTransactionRequest"; +export * from "./types/tari-indexer-client/IndexerConnection"; +export * from "./types/tari-indexer-client/InspectSubstateResponse"; export * from "./types/tari-indexer-client/IndexerGetAllVnsRequest"; +export * from "./types/tari-indexer-client/InspectSubstateRequest"; export * from "./types/tari-indexer-client/IndexerGetCommsStatsResponse"; -export * from "./types/tari-indexer-client/IndexerConnection"; -export * from "./types/tari-indexer-client/GetNonFungiblesRequest"; -export * from "./types/tari-indexer-client/IndexerAddPeerRequest"; -export * from "./types/tari-indexer-client/GetRelatedTransactionsRequest"; -export * from "./types/tari-indexer-client/GetNonFungiblesResponse"; -export * from "./types/tari-indexer-client/GetTemplateDefinitionResponse"; +export * from "./types/tari-indexer-client/GetNonFungibleCountRequest"; +export * from "./types/tari-indexer-client/GetRelatedTransactionsResponse"; +export * from "./types/tari-indexer-client/IndexerAddPeerResponse"; export * from "./types/tari-indexer-client/IndexerGetConnectionsResponse"; -export * from "./types/tari-indexer-client/IndexerSubmitTransactionRequest"; +export * from "./types/tari-indexer-client/GetNonFungiblesResponse"; +export * from "./types/tari-indexer-client/GetRelatedTransactionsRequest"; +export * from "./types/tari-indexer-client/IndexerGetTransactionResultResponse"; export * from "./types/tari-indexer-client/ListTemplatesResponse"; -export * from "./types/tari-indexer-client/InspectSubstateResponse"; +export * from "./types/tari-indexer-client/IndexerGetTransactionResultRequest"; +export * from "./types/tari-indexer-client/ListSubstatesResponse"; +export * from "./types/tari-indexer-client/IndexerTransactionFinalizedResult"; export * from "./types/tari-indexer-client/GetNonFungibleCollectionsResponse"; -export * from "./types/tari-indexer-client/IndexerGetSubstateRequest"; -export * from "./types/tari-indexer-client/IndexerGetEpochManagerStatsResponse"; -export * from "./types/tari-indexer-client/NonFungibleSubstate"; -export * from "./types/tari-indexer-client/GetNonFungibleCountResponse"; -export * from "./types/tari-indexer-client/ListTemplatesRequest"; -export * from "./types/tari-indexer-client/IndexerGetTransactionResultResponse"; +export * from "./types/tari-indexer-client/IndexerSubmitTransactionResponse"; export * from "./types/tari-indexer-client/IndexerConnectionDirection"; -export * from "./types/tari-indexer-client/IndexerGetIdentityResponse"; -export * from "./types/tari-indexer-client/IndexerGetTransactionResultRequest"; -export * from "./types/tari-indexer-client/GetNonFungibleCountRequest"; +export * from "./types/tari-indexer-client/ListSubstateItem"; diff --git a/bindings/dist/types/IndexedWellKnownTypes.d.ts b/bindings/dist/types/IndexedWellKnownTypes.d.ts index ca17128c6..3a7b76117 100644 --- a/bindings/dist/types/IndexedWellKnownTypes.d.ts +++ b/bindings/dist/types/IndexedWellKnownTypes.d.ts @@ -3,6 +3,7 @@ import type { ComponentAddress } from "./ComponentAddress"; import type { Metadata } from "./Metadata"; import type { NonFungibleAddress } from "./NonFungibleAddress"; import type { ProofId } from "./ProofId"; +import type { PublishedTemplateAddress } from "./PublishedTemplateAddress"; import type { ResourceAddress } from "./ResourceAddress"; import type { TransactionReceiptAddress } from "./TransactionReceiptAddress"; import type { UnclaimedConfidentialOutputAddress } from "./UnclaimedConfidentialOutputAddress"; @@ -17,4 +18,5 @@ export interface IndexedWellKnownTypes { vault_ids: Array; metadata: Array; unclaimed_confidential_output_address: Array; + published_template_addresses: Array; } diff --git a/bindings/dist/types/PublishedTemplate.d.ts b/bindings/dist/types/PublishedTemplate.d.ts index 9fe2dcf83..cbd02c154 100644 --- a/bindings/dist/types/PublishedTemplate.d.ts +++ b/bindings/dist/types/PublishedTemplate.d.ts @@ -1,3 +1,3 @@ export interface PublishedTemplate { - template: Array; + binary: Array; } diff --git a/bindings/dist/types/SubstateId.d.ts b/bindings/dist/types/SubstateId.d.ts index cde31ad1c..ab9cca45d 100644 --- a/bindings/dist/types/SubstateId.d.ts +++ b/bindings/dist/types/SubstateId.d.ts @@ -2,6 +2,7 @@ import type { ComponentAddress } from "./ComponentAddress"; import type { FeeClaimAddress } from "./FeeClaimAddress"; import type { NonFungibleAddress } from "./NonFungibleAddress"; import type { NonFungibleIndexAddress } from "./NonFungibleIndexAddress"; +import type { PublishedTemplateAddress } from "./PublishedTemplateAddress"; import type { ResourceAddress } from "./ResourceAddress"; import type { TransactionReceiptAddress } from "./TransactionReceiptAddress"; import type { UnclaimedConfidentialOutputAddress } from "./UnclaimedConfidentialOutputAddress"; @@ -22,4 +23,6 @@ export type SubstateId = { TransactionReceipt: TransactionReceiptAddress; } | { FeeClaim: FeeClaimAddress; +} | { + Template: PublishedTemplateAddress; }; diff --git a/bindings/dist/types/SubstateValue.d.ts b/bindings/dist/types/SubstateValue.d.ts index 6cb2ce30d..60badd7cb 100644 --- a/bindings/dist/types/SubstateValue.d.ts +++ b/bindings/dist/types/SubstateValue.d.ts @@ -2,6 +2,7 @@ import type { ComponentHeader } from "./ComponentHeader"; import type { FeeClaim } from "./FeeClaim"; import type { NonFungibleContainer } from "./NonFungibleContainer"; import type { NonFungibleIndex } from "./NonFungibleIndex"; +import type { PublishedTemplate } from "./PublishedTemplate"; import type { Resource } from "./Resource"; import type { TransactionReceipt } from "./TransactionReceipt"; import type { UnclaimedConfidentialOutput } from "./UnclaimedConfidentialOutput"; @@ -22,4 +23,6 @@ export type SubstateValue = { TransactionReceipt: TransactionReceipt; } | { FeeClaim: FeeClaim; +} | { + Template: PublishedTemplate; }; diff --git a/bindings/dist/types/validator-node-client/TemplateMetadata.d.ts b/bindings/dist/types/validator-node-client/TemplateMetadata.d.ts index 637cdf46b..baae0a39e 100644 --- a/bindings/dist/types/validator-node-client/TemplateMetadata.d.ts +++ b/bindings/dist/types/validator-node-client/TemplateMetadata.d.ts @@ -1,7 +1,5 @@ export interface TemplateMetadata { name: string; address: string; - url: string; binary_sha: Array; - height: number; } diff --git a/bindings/dist/validator-node-client.d.ts b/bindings/dist/validator-node-client.d.ts index e6ca04d52..f78bda7bc 100644 --- a/bindings/dist/validator-node-client.d.ts +++ b/bindings/dist/validator-node-client.d.ts @@ -1,60 +1,60 @@ -export * from "./types/validator-node-client/ValidatorNodeChange"; +export * from "./types/validator-node-client/GetCommitteeRequest"; +export * from "./types/validator-node-client/GetRecentTransactionsResponse"; +export * from "./types/validator-node-client/GetRecentTransactionsRequest"; +export * from "./types/validator-node-client/GetTemplatesRequest"; +export * from "./types/validator-node-client/GetBlocksCountResponse"; +export * from "./types/validator-node-client/VNAddPeerRequest"; +export * from "./types/validator-node-client/GetCommitteeResponse"; export * from "./types/validator-node-client/VNSubmitTransactionRequest"; +export * from "./types/validator-node-client/VNConnectionDirection"; +export * from "./types/validator-node-client/VNAddPeerResponse"; +export * from "./types/validator-node-client/GetSubstatesByTransactionResponse"; +export * from "./types/validator-node-client/VNCommitteeShardInfo"; +export * from "./types/validator-node-client/VNFunctionDef"; +export * from "./types/validator-node-client/ValidatorNodeChange"; +export * from "./types/validator-node-client/VNGetValidatorFeesResponse"; +export * from "./types/validator-node-client/VNGetAllVnsResponse"; +export * from "./types/validator-node-client/TemplateAbi"; +export * from "./types/validator-node-client/GetMempoolStatsResponse"; export * from "./types/validator-node-client/TemplateMetadata"; -export * from "./types/validator-node-client/GetFilteredBlocksCountRequest"; +export * from "./types/validator-node-client/GetBlockResponse"; +export * from "./types/validator-node-client/VNLogLevel"; +export * from "./types/validator-node-client/VNGetAllVnsRequest"; +export * from "./types/validator-node-client/GetBaseLayerEpochChangesRequest"; +export * from "./types/validator-node-client/GetBaseLayerEpochChangesResponse"; export * from "./types/validator-node-client/VNLogEntry"; export * from "./types/validator-node-client/GetShardKeyRequest"; -export * from "./types/validator-node-client/VNGetTransactionResultResponse"; +export * from "./types/validator-node-client/GetBlockRequest"; export * from "./types/validator-node-client/VNSubmitTransactionResponse"; -export * from "./types/validator-node-client/GetTxPoolResponse"; -export * from "./types/validator-node-client/GetTemplateResponse"; -export * from "./types/validator-node-client/GetBlocksCountResponse"; -export * from "./types/validator-node-client/VNGetValidatorFeesRequest"; -export * from "./types/validator-node-client/GetSubstatesByTransactionResponse"; -export * from "./types/validator-node-client/VNConnectionDirection"; -export * from "./types/validator-node-client/VNAddPeerRequest"; -export * from "./types/validator-node-client/GetTemplatesResponse"; -export * from "./types/validator-node-client/GetTransactionRequest"; -export * from "./types/validator-node-client/GetStateRequest"; -export * from "./types/validator-node-client/VNGetIdentityResponse"; -export * from "./types/validator-node-client/VNFunctionDef"; -export * from "./types/validator-node-client/GetBlocksRequest"; -export * from "./types/validator-node-client/GetTemplateRequest"; -export * from "./types/validator-node-client/GetShardKeyResponse"; -export * from "./types/validator-node-client/GetBaseLayerEpochChangesResponse"; -export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; -export * from "./types/validator-node-client/VNGetCommsStatsResponse"; -export * from "./types/validator-node-client/GetTransactionResponse"; -export * from "./types/validator-node-client/GetCommitteeResponse"; -export * from "./types/validator-node-client/VNGetAllVnsRequest"; -export * from "./types/validator-node-client/GetCommitteeRequest"; export * from "./types/validator-node-client/DryRunTransactionFinalizeResult"; -export * from "./types/validator-node-client/VNGetValidatorFeesResponse"; +export * from "./types/validator-node-client/GetTransactionResponse"; export * from "./types/validator-node-client/GetStateResponse"; -export * from "./types/validator-node-client/GetBaseLayerEpochChangesRequest"; +export * from "./types/validator-node-client/VNGetSubstateRequest"; +export * from "./types/validator-node-client/VNGetSubstateResponse"; +export * from "./types/validator-node-client/ListBlocksResponse"; export * from "./types/validator-node-client/SubstateStatus"; +export * from "./types/validator-node-client/ValidatorNode"; +export * from "./types/validator-node-client/GetFilteredBlocksCountRequest"; +export * from "./types/validator-node-client/ListBlocksRequest"; +export * from "./types/validator-node-client/GetEpochManagerStatsResponse"; +export * from "./types/validator-node-client/GetTxPoolResponse"; +export * from "./types/validator-node-client/VNConnection"; export * from "./types/validator-node-client/GetConsensusStatusResponse"; -export * from "./types/validator-node-client/GetBlocksResponse"; -export * from "./types/validator-node-client/ListBlocksResponse"; -export * from "./types/validator-node-client/GetBlockRequest"; -export * from "./types/validator-node-client/VNGetTransactionResultRequest"; -export * from "./types/validator-node-client/GetRecentTransactionsRequest"; +export * from "./types/validator-node-client/GetTemplateResponse"; export * from "./types/validator-node-client/ValidatorFee"; -export * from "./types/validator-node-client/VNLogLevel"; -export * from "./types/validator-node-client/GetRecentTransactionsResponse"; -export * from "./types/validator-node-client/VNAddPeerResponse"; -export * from "./types/validator-node-client/VNConnection"; -export * from "./types/validator-node-client/ValidatorNode"; export * from "./types/validator-node-client/VNGetConnectionsResponse"; -export * from "./types/validator-node-client/ListBlocksRequest"; -export * from "./types/validator-node-client/GetNetworkCommitteeResponse"; -export * from "./types/validator-node-client/VNGetSubstateRequest"; -export * from "./types/validator-node-client/GetMempoolStatsResponse"; -export * from "./types/validator-node-client/TemplateAbi"; -export * from "./types/validator-node-client/GetTemplatesRequest"; -export * from "./types/validator-node-client/VNGetSubstateResponse"; -export * from "./types/validator-node-client/VNGetAllVnsResponse"; +export * from "./types/validator-node-client/VNGetCommsStatsResponse"; +export * from "./types/validator-node-client/GetTemplateRequest"; +export * from "./types/validator-node-client/GetStateRequest"; +export * from "./types/validator-node-client/GetBlocksRequest"; +export * from "./types/validator-node-client/VNGetTransactionResultRequest"; +export * from "./types/validator-node-client/GetTransactionRequest"; +export * from "./types/validator-node-client/GetTemplatesResponse"; +export * from "./types/validator-node-client/VNGetTransactionResultResponse"; export * from "./types/validator-node-client/VNArgDef"; -export * from "./types/validator-node-client/GetEpochManagerStatsResponse"; -export * from "./types/validator-node-client/GetBlockResponse"; -export * from "./types/validator-node-client/VNCommitteeShardInfo"; +export * from "./types/validator-node-client/GetShardKeyResponse"; +export * from "./types/validator-node-client/GetBlocksResponse"; +export * from "./types/validator-node-client/VNGetIdentityResponse"; +export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; +export * from "./types/validator-node-client/GetNetworkCommitteeResponse"; +export * from "./types/validator-node-client/VNGetValidatorFeesRequest"; diff --git a/bindings/dist/validator-node-client.js b/bindings/dist/validator-node-client.js index 5ea2ff7f9..b35af0de7 100644 --- a/bindings/dist/validator-node-client.js +++ b/bindings/dist/validator-node-client.js @@ -1,62 +1,62 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -export * from "./types/validator-node-client/ValidatorNodeChange"; +export * from "./types/validator-node-client/GetCommitteeRequest"; +export * from "./types/validator-node-client/GetRecentTransactionsResponse"; +export * from "./types/validator-node-client/GetRecentTransactionsRequest"; +export * from "./types/validator-node-client/GetTemplatesRequest"; +export * from "./types/validator-node-client/GetBlocksCountResponse"; +export * from "./types/validator-node-client/VNAddPeerRequest"; +export * from "./types/validator-node-client/GetCommitteeResponse"; export * from "./types/validator-node-client/VNSubmitTransactionRequest"; +export * from "./types/validator-node-client/VNConnectionDirection"; +export * from "./types/validator-node-client/VNAddPeerResponse"; +export * from "./types/validator-node-client/GetSubstatesByTransactionResponse"; +export * from "./types/validator-node-client/VNCommitteeShardInfo"; +export * from "./types/validator-node-client/VNFunctionDef"; +export * from "./types/validator-node-client/ValidatorNodeChange"; +export * from "./types/validator-node-client/VNGetValidatorFeesResponse"; +export * from "./types/validator-node-client/VNGetAllVnsResponse"; +export * from "./types/validator-node-client/TemplateAbi"; +export * from "./types/validator-node-client/GetMempoolStatsResponse"; export * from "./types/validator-node-client/TemplateMetadata"; -export * from "./types/validator-node-client/GetFilteredBlocksCountRequest"; +export * from "./types/validator-node-client/GetBlockResponse"; +export * from "./types/validator-node-client/VNLogLevel"; +export * from "./types/validator-node-client/VNGetAllVnsRequest"; +export * from "./types/validator-node-client/GetBaseLayerEpochChangesRequest"; +export * from "./types/validator-node-client/GetBaseLayerEpochChangesResponse"; export * from "./types/validator-node-client/VNLogEntry"; export * from "./types/validator-node-client/GetShardKeyRequest"; -export * from "./types/validator-node-client/VNGetTransactionResultResponse"; +export * from "./types/validator-node-client/GetBlockRequest"; export * from "./types/validator-node-client/VNSubmitTransactionResponse"; -export * from "./types/validator-node-client/GetTxPoolResponse"; -export * from "./types/validator-node-client/GetTemplateResponse"; -export * from "./types/validator-node-client/GetBlocksCountResponse"; -export * from "./types/validator-node-client/VNGetValidatorFeesRequest"; -export * from "./types/validator-node-client/GetSubstatesByTransactionResponse"; -export * from "./types/validator-node-client/VNConnectionDirection"; -export * from "./types/validator-node-client/VNAddPeerRequest"; -export * from "./types/validator-node-client/GetTemplatesResponse"; -export * from "./types/validator-node-client/GetTransactionRequest"; -export * from "./types/validator-node-client/GetStateRequest"; -export * from "./types/validator-node-client/VNGetIdentityResponse"; -export * from "./types/validator-node-client/VNFunctionDef"; -export * from "./types/validator-node-client/GetBlocksRequest"; -export * from "./types/validator-node-client/GetTemplateRequest"; -export * from "./types/validator-node-client/GetShardKeyResponse"; -export * from "./types/validator-node-client/GetBaseLayerEpochChangesResponse"; -export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; -export * from "./types/validator-node-client/VNGetCommsStatsResponse"; -export * from "./types/validator-node-client/GetTransactionResponse"; -export * from "./types/validator-node-client/GetCommitteeResponse"; -export * from "./types/validator-node-client/VNGetAllVnsRequest"; -export * from "./types/validator-node-client/GetCommitteeRequest"; export * from "./types/validator-node-client/DryRunTransactionFinalizeResult"; -export * from "./types/validator-node-client/VNGetValidatorFeesResponse"; +export * from "./types/validator-node-client/GetTransactionResponse"; export * from "./types/validator-node-client/GetStateResponse"; -export * from "./types/validator-node-client/GetBaseLayerEpochChangesRequest"; +export * from "./types/validator-node-client/VNGetSubstateRequest"; +export * from "./types/validator-node-client/VNGetSubstateResponse"; +export * from "./types/validator-node-client/ListBlocksResponse"; export * from "./types/validator-node-client/SubstateStatus"; +export * from "./types/validator-node-client/ValidatorNode"; +export * from "./types/validator-node-client/GetFilteredBlocksCountRequest"; +export * from "./types/validator-node-client/ListBlocksRequest"; +export * from "./types/validator-node-client/GetEpochManagerStatsResponse"; +export * from "./types/validator-node-client/GetTxPoolResponse"; +export * from "./types/validator-node-client/VNConnection"; export * from "./types/validator-node-client/GetConsensusStatusResponse"; -export * from "./types/validator-node-client/GetBlocksResponse"; -export * from "./types/validator-node-client/ListBlocksResponse"; -export * from "./types/validator-node-client/GetBlockRequest"; -export * from "./types/validator-node-client/VNGetTransactionResultRequest"; -export * from "./types/validator-node-client/GetRecentTransactionsRequest"; +export * from "./types/validator-node-client/GetTemplateResponse"; export * from "./types/validator-node-client/ValidatorFee"; -export * from "./types/validator-node-client/VNLogLevel"; -export * from "./types/validator-node-client/GetRecentTransactionsResponse"; -export * from "./types/validator-node-client/VNAddPeerResponse"; -export * from "./types/validator-node-client/VNConnection"; -export * from "./types/validator-node-client/ValidatorNode"; export * from "./types/validator-node-client/VNGetConnectionsResponse"; -export * from "./types/validator-node-client/ListBlocksRequest"; -export * from "./types/validator-node-client/GetNetworkCommitteeResponse"; -export * from "./types/validator-node-client/VNGetSubstateRequest"; -export * from "./types/validator-node-client/GetMempoolStatsResponse"; -export * from "./types/validator-node-client/TemplateAbi"; -export * from "./types/validator-node-client/GetTemplatesRequest"; -export * from "./types/validator-node-client/VNGetSubstateResponse"; -export * from "./types/validator-node-client/VNGetAllVnsResponse"; +export * from "./types/validator-node-client/VNGetCommsStatsResponse"; +export * from "./types/validator-node-client/GetTemplateRequest"; +export * from "./types/validator-node-client/GetStateRequest"; +export * from "./types/validator-node-client/GetBlocksRequest"; +export * from "./types/validator-node-client/VNGetTransactionResultRequest"; +export * from "./types/validator-node-client/GetTransactionRequest"; +export * from "./types/validator-node-client/GetTemplatesResponse"; +export * from "./types/validator-node-client/VNGetTransactionResultResponse"; export * from "./types/validator-node-client/VNArgDef"; -export * from "./types/validator-node-client/GetEpochManagerStatsResponse"; -export * from "./types/validator-node-client/GetBlockResponse"; -export * from "./types/validator-node-client/VNCommitteeShardInfo"; +export * from "./types/validator-node-client/GetShardKeyResponse"; +export * from "./types/validator-node-client/GetBlocksResponse"; +export * from "./types/validator-node-client/VNGetIdentityResponse"; +export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; +export * from "./types/validator-node-client/GetNetworkCommitteeResponse"; +export * from "./types/validator-node-client/VNGetValidatorFeesRequest"; diff --git a/bindings/dist/wallet-daemon-client.d.ts b/bindings/dist/wallet-daemon-client.d.ts index 72464d0b9..800a672e4 100644 --- a/bindings/dist/wallet-daemon-client.d.ts +++ b/bindings/dist/wallet-daemon-client.d.ts @@ -1,89 +1,89 @@ -export * from "./types/wallet-daemon-client/WalletSubstateRecord"; -export * from "./types/wallet-daemon-client/ProofsFinalizeResponse"; -export * from "./types/wallet-daemon-client/CallInstructionRequest"; -export * from "./types/wallet-daemon-client/AuthLoginAcceptResponse"; -export * from "./types/wallet-daemon-client/AccountsListRequest"; -export * from "./types/wallet-daemon-client/AuthGetAllJwtResponse"; -export * from "./types/wallet-daemon-client/AuthLoginResponse"; -export * from "./types/wallet-daemon-client/GetValidatorFeesRequest"; -export * from "./types/wallet-daemon-client/AccountGetDefaultRequest"; -export * from "./types/wallet-daemon-client/AuthGetAllJwtRequest"; -export * from "./types/wallet-daemon-client/KeyBranch"; -export * from "./types/wallet-daemon-client/AccountGetResponse"; -export * from "./types/wallet-daemon-client/SettingsSetRequest"; -export * from "./types/wallet-daemon-client/GetValidatorFeesResponse"; -export * from "./types/wallet-daemon-client/TransactionGetAllRequest"; +export * from "./types/wallet-daemon-client/AccountsListResponse"; export * from "./types/wallet-daemon-client/RevealFundsRequest"; -export * from "./types/wallet-daemon-client/AuthLoginDenyResponse"; -export * from "./types/wallet-daemon-client/AuthLoginDenyRequest"; -export * from "./types/wallet-daemon-client/TransactionSubmitResponse"; -export * from "./types/wallet-daemon-client/ProofsGenerateResponse"; -export * from "./types/wallet-daemon-client/ClaimValidatorFeesRequest"; -export * from "./types/wallet-daemon-client/AuthLoginRequest"; +export * from "./types/wallet-daemon-client/ClaimBurnResponse"; +export * from "./types/wallet-daemon-client/KeysSetActiveRequest"; +export * from "./types/wallet-daemon-client/WalletSubstateRecord"; +export * from "./types/wallet-daemon-client/AccountsGetBalancesResponse"; +export * from "./types/wallet-daemon-client/SubstatesGetResponse"; export * from "./types/wallet-daemon-client/ListAccountNftRequest"; +export * from "./types/wallet-daemon-client/RevealFundsResponse"; +export * from "./types/wallet-daemon-client/AccountSetDefaultRequest"; +export * from "./types/wallet-daemon-client/GetAccountNftRequest"; +export * from "./types/wallet-daemon-client/TransactionGetAllResponse"; export * from "./types/wallet-daemon-client/TransactionGetRequest"; -export * from "./types/wallet-daemon-client/AuthRevokeTokenResponse"; -export * from "./types/wallet-daemon-client/ProofsFinalizeRequest"; -export * from "./types/wallet-daemon-client/AccountsTransferRequest"; -export * from "./types/wallet-daemon-client/SettingsSetResponse"; -export * from "./types/wallet-daemon-client/KeysListRequest"; +export * from "./types/wallet-daemon-client/KeyBranch"; +export * from "./types/wallet-daemon-client/AuthLoginAcceptRequest"; +export * from "./types/wallet-daemon-client/AccountSetDefaultResponse"; +export * from "./types/wallet-daemon-client/SubstatesListResponse"; +export * from "./types/wallet-daemon-client/AccountGetDefaultRequest"; +export * from "./types/wallet-daemon-client/KeysListResponse"; +export * from "./types/wallet-daemon-client/ProofsGenerateResponse"; +export * from "./types/wallet-daemon-client/TransactionGetAllRequest"; export * from "./types/wallet-daemon-client/AccountsTransferResponse"; -export * from "./types/wallet-daemon-client/TransactionGetResultResponse"; +export * from "./types/wallet-daemon-client/AuthLoginResponse"; export * from "./types/wallet-daemon-client/ClaimBurnRequest"; -export * from "./types/wallet-daemon-client/KeysListResponse"; +export * from "./types/wallet-daemon-client/BalanceEntry"; +export * from "./types/wallet-daemon-client/KeysListRequest"; export * from "./types/wallet-daemon-client/SubstatesGetRequest"; -export * from "./types/wallet-daemon-client/TransactionSubmitRequest"; -export * from "./types/wallet-daemon-client/AccountsGetBalancesResponse"; -export * from "./types/wallet-daemon-client/TransactionGetAllResponse"; -export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsResponse"; -export * from "./types/wallet-daemon-client/ConfidentialTransferResponse"; -export * from "./types/wallet-daemon-client/TransactionGetResponse"; -export * from "./types/wallet-daemon-client/SubstatesGetResponse"; -export * from "./types/wallet-daemon-client/GetAccountNftRequest"; +export * from "./types/wallet-daemon-client/ProofsFinalizeResponse"; export * from "./types/wallet-daemon-client/AuthRevokeTokenRequest"; -export * from "./types/wallet-daemon-client/ProofsGenerateRequest"; -export * from "./types/wallet-daemon-client/RevealFundsResponse"; -export * from "./types/wallet-daemon-client/AccountsInvokeResponse"; -export * from "./types/wallet-daemon-client/AccountsListResponse"; +export * from "./types/wallet-daemon-client/TransactionWaitResultRequest"; +export * from "./types/wallet-daemon-client/TransactionSubmitResponse"; +export * from "./types/wallet-daemon-client/AccountsCreateRequest"; +export * from "./types/wallet-daemon-client/CallInstructionRequest"; +export * from "./types/wallet-daemon-client/WebRtcStartRequest"; export * from "./types/wallet-daemon-client/WebRtcStartResponse"; -export * from "./types/wallet-daemon-client/TransactionGetResultRequest"; +export * from "./types/wallet-daemon-client/TransactionSubmitDryRunRequest"; +export * from "./types/wallet-daemon-client/MintAccountNftResponse"; export * from "./types/wallet-daemon-client/ProofsCancelResponse"; -export * from "./types/wallet-daemon-client/AccountsCreateRequest"; -export * from "./types/wallet-daemon-client/MintAccountNftRequest"; -export * from "./types/wallet-daemon-client/TransactionClaimBurnResponse"; -export * from "./types/wallet-daemon-client/TransactionWaitResultRequest"; -export * from "./types/wallet-daemon-client/ClaimValidatorFeesResponse"; +export * from "./types/wallet-daemon-client/AccountGetResponse"; +export * from "./types/wallet-daemon-client/ClaimValidatorFeesRequest"; +export * from "./types/wallet-daemon-client/AuthRevokeTokenResponse"; +export * from "./types/wallet-daemon-client/AccountsInvokeRequest"; +export * from "./types/wallet-daemon-client/WebRtcStart"; +export * from "./types/wallet-daemon-client/TransactionWaitResultResponse"; +export * from "./types/wallet-daemon-client/GetValidatorFeesRequest"; export * from "./types/wallet-daemon-client/ConfidentialCreateOutputProofRequest"; -export * from "./types/wallet-daemon-client/KeysCreateRequest"; +export * from "./types/wallet-daemon-client/KeysCreateResponse"; +export * from "./types/wallet-daemon-client/AuthLoginDenyRequest"; +export * from "./types/wallet-daemon-client/ProofsFinalizeRequest"; +export * from "./types/wallet-daemon-client/ProofsCancelRequest"; export * from "./types/wallet-daemon-client/SettingsGetResponse"; +export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceRequest"; +export * from "./types/wallet-daemon-client/GetValidatorFeesResponse"; +export * from "./types/wallet-daemon-client/TransactionGetResponse"; +export * from "./types/wallet-daemon-client/TransactionSubmitRequest"; +export * from "./types/wallet-daemon-client/ListAccountNftResponse"; +export * from "./types/wallet-daemon-client/AccountsInvokeResponse"; +export * from "./types/wallet-daemon-client/AccountsListRequest"; +export * from "./types/wallet-daemon-client/AuthLoginAcceptResponse"; export * from "./types/wallet-daemon-client/TransactionSubmitDryRunResponse"; -export * from "./types/wallet-daemon-client/ClaimBurnResponse"; -export * from "./types/wallet-daemon-client/WebRtcStartRequest"; -export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceResponse"; -export * from "./types/wallet-daemon-client/WebRtcStart"; -export * from "./types/wallet-daemon-client/AccountSetDefaultRequest"; export * from "./types/wallet-daemon-client/ConfidentialCreateOutputProofResponse"; +export * from "./types/wallet-daemon-client/TemplatesGetRequest"; +export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceResponse"; +export * from "./types/wallet-daemon-client/SettingsSetRequest"; +export * from "./types/wallet-daemon-client/MintAccountNftRequest"; +export * from "./types/wallet-daemon-client/TransactionClaimBurnResponse"; +export * from "./types/wallet-daemon-client/AuthGetAllJwtRequest"; +export * from "./types/wallet-daemon-client/ClaimValidatorFeesResponse"; +export * from "./types/wallet-daemon-client/ConfidentialTransferResponse"; export * from "./types/wallet-daemon-client/TemplatesGetResponse"; -export * from "./types/wallet-daemon-client/ListAccountNftResponse"; -export * from "./types/wallet-daemon-client/AccountsGetBalancesRequest"; -export * from "./types/wallet-daemon-client/MintAccountNftResponse"; +export * from "./types/wallet-daemon-client/AccountsTransferRequest"; +export * from "./types/wallet-daemon-client/AuthLoginRequest"; +export * from "./types/wallet-daemon-client/AuthGetAllJwtResponse"; export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsRequest"; -export * from "./types/wallet-daemon-client/KeysCreateResponse"; +export * from "./types/wallet-daemon-client/ConfidentialTransferRequest"; +export * from "./types/wallet-daemon-client/SettingsSetResponse"; +export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsResponse"; +export * from "./types/wallet-daemon-client/AccountGetRequest"; +export * from "./types/wallet-daemon-client/KeysCreateRequest"; +export * from "./types/wallet-daemon-client/ProofsGenerateRequest"; +export * from "./types/wallet-daemon-client/TransactionGetResultResponse"; +export * from "./types/wallet-daemon-client/KeysSetActiveResponse"; +export * from "./types/wallet-daemon-client/AuthLoginDenyResponse"; +export * from "./types/wallet-daemon-client/TransactionGetResultRequest"; +export * from "./types/wallet-daemon-client/AccountsCreateResponse"; +export * from "./types/wallet-daemon-client/AccountsGetBalancesRequest"; export * from "./types/wallet-daemon-client/AccountInfo"; export * from "./types/wallet-daemon-client/SubstatesListRequest"; -export * from "./types/wallet-daemon-client/BalanceEntry"; -export * from "./types/wallet-daemon-client/TemplatesGetRequest"; -export * from "./types/wallet-daemon-client/AccountsInvokeRequest"; -export * from "./types/wallet-daemon-client/ProofsCancelRequest"; -export * from "./types/wallet-daemon-client/AccountSetDefaultResponse"; -export * from "./types/wallet-daemon-client/SubstatesListResponse"; -export * from "./types/wallet-daemon-client/KeysSetActiveResponse"; export * from "./types/wallet-daemon-client/ComponentAddressOrName"; -export * from "./types/wallet-daemon-client/AuthLoginAcceptRequest"; -export * from "./types/wallet-daemon-client/TransactionSubmitDryRunRequest"; -export * from "./types/wallet-daemon-client/KeysSetActiveRequest"; -export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceRequest"; -export * from "./types/wallet-daemon-client/ConfidentialTransferRequest"; -export * from "./types/wallet-daemon-client/AccountsCreateResponse"; -export * from "./types/wallet-daemon-client/TransactionWaitResultResponse"; -export * from "./types/wallet-daemon-client/AccountGetRequest"; diff --git a/bindings/dist/wallet-daemon-client.js b/bindings/dist/wallet-daemon-client.js index 389f4730a..e579fd71b 100644 --- a/bindings/dist/wallet-daemon-client.js +++ b/bindings/dist/wallet-daemon-client.js @@ -1,91 +1,91 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -export * from "./types/wallet-daemon-client/WalletSubstateRecord"; -export * from "./types/wallet-daemon-client/ProofsFinalizeResponse"; -export * from "./types/wallet-daemon-client/CallInstructionRequest"; -export * from "./types/wallet-daemon-client/AuthLoginAcceptResponse"; -export * from "./types/wallet-daemon-client/AccountsListRequest"; -export * from "./types/wallet-daemon-client/AuthGetAllJwtResponse"; -export * from "./types/wallet-daemon-client/AuthLoginResponse"; -export * from "./types/wallet-daemon-client/GetValidatorFeesRequest"; -export * from "./types/wallet-daemon-client/AccountGetDefaultRequest"; -export * from "./types/wallet-daemon-client/AuthGetAllJwtRequest"; -export * from "./types/wallet-daemon-client/KeyBranch"; -export * from "./types/wallet-daemon-client/AccountGetResponse"; -export * from "./types/wallet-daemon-client/SettingsSetRequest"; -export * from "./types/wallet-daemon-client/GetValidatorFeesResponse"; -export * from "./types/wallet-daemon-client/TransactionGetAllRequest"; +export * from "./types/wallet-daemon-client/AccountsListResponse"; export * from "./types/wallet-daemon-client/RevealFundsRequest"; -export * from "./types/wallet-daemon-client/AuthLoginDenyResponse"; -export * from "./types/wallet-daemon-client/AuthLoginDenyRequest"; -export * from "./types/wallet-daemon-client/TransactionSubmitResponse"; -export * from "./types/wallet-daemon-client/ProofsGenerateResponse"; -export * from "./types/wallet-daemon-client/ClaimValidatorFeesRequest"; -export * from "./types/wallet-daemon-client/AuthLoginRequest"; +export * from "./types/wallet-daemon-client/ClaimBurnResponse"; +export * from "./types/wallet-daemon-client/KeysSetActiveRequest"; +export * from "./types/wallet-daemon-client/WalletSubstateRecord"; +export * from "./types/wallet-daemon-client/AccountsGetBalancesResponse"; +export * from "./types/wallet-daemon-client/SubstatesGetResponse"; export * from "./types/wallet-daemon-client/ListAccountNftRequest"; +export * from "./types/wallet-daemon-client/RevealFundsResponse"; +export * from "./types/wallet-daemon-client/AccountSetDefaultRequest"; +export * from "./types/wallet-daemon-client/GetAccountNftRequest"; +export * from "./types/wallet-daemon-client/TransactionGetAllResponse"; export * from "./types/wallet-daemon-client/TransactionGetRequest"; -export * from "./types/wallet-daemon-client/AuthRevokeTokenResponse"; -export * from "./types/wallet-daemon-client/ProofsFinalizeRequest"; -export * from "./types/wallet-daemon-client/AccountsTransferRequest"; -export * from "./types/wallet-daemon-client/SettingsSetResponse"; -export * from "./types/wallet-daemon-client/KeysListRequest"; +export * from "./types/wallet-daemon-client/KeyBranch"; +export * from "./types/wallet-daemon-client/AuthLoginAcceptRequest"; +export * from "./types/wallet-daemon-client/AccountSetDefaultResponse"; +export * from "./types/wallet-daemon-client/SubstatesListResponse"; +export * from "./types/wallet-daemon-client/AccountGetDefaultRequest"; +export * from "./types/wallet-daemon-client/KeysListResponse"; +export * from "./types/wallet-daemon-client/ProofsGenerateResponse"; +export * from "./types/wallet-daemon-client/TransactionGetAllRequest"; export * from "./types/wallet-daemon-client/AccountsTransferResponse"; -export * from "./types/wallet-daemon-client/TransactionGetResultResponse"; +export * from "./types/wallet-daemon-client/AuthLoginResponse"; export * from "./types/wallet-daemon-client/ClaimBurnRequest"; -export * from "./types/wallet-daemon-client/KeysListResponse"; +export * from "./types/wallet-daemon-client/BalanceEntry"; +export * from "./types/wallet-daemon-client/KeysListRequest"; export * from "./types/wallet-daemon-client/SubstatesGetRequest"; -export * from "./types/wallet-daemon-client/TransactionSubmitRequest"; -export * from "./types/wallet-daemon-client/AccountsGetBalancesResponse"; -export * from "./types/wallet-daemon-client/TransactionGetAllResponse"; -export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsResponse"; -export * from "./types/wallet-daemon-client/ConfidentialTransferResponse"; -export * from "./types/wallet-daemon-client/TransactionGetResponse"; -export * from "./types/wallet-daemon-client/SubstatesGetResponse"; -export * from "./types/wallet-daemon-client/GetAccountNftRequest"; +export * from "./types/wallet-daemon-client/ProofsFinalizeResponse"; export * from "./types/wallet-daemon-client/AuthRevokeTokenRequest"; -export * from "./types/wallet-daemon-client/ProofsGenerateRequest"; -export * from "./types/wallet-daemon-client/RevealFundsResponse"; -export * from "./types/wallet-daemon-client/AccountsInvokeResponse"; -export * from "./types/wallet-daemon-client/AccountsListResponse"; +export * from "./types/wallet-daemon-client/TransactionWaitResultRequest"; +export * from "./types/wallet-daemon-client/TransactionSubmitResponse"; +export * from "./types/wallet-daemon-client/AccountsCreateRequest"; +export * from "./types/wallet-daemon-client/CallInstructionRequest"; +export * from "./types/wallet-daemon-client/WebRtcStartRequest"; export * from "./types/wallet-daemon-client/WebRtcStartResponse"; -export * from "./types/wallet-daemon-client/TransactionGetResultRequest"; +export * from "./types/wallet-daemon-client/TransactionSubmitDryRunRequest"; +export * from "./types/wallet-daemon-client/MintAccountNftResponse"; export * from "./types/wallet-daemon-client/ProofsCancelResponse"; -export * from "./types/wallet-daemon-client/AccountsCreateRequest"; -export * from "./types/wallet-daemon-client/MintAccountNftRequest"; -export * from "./types/wallet-daemon-client/TransactionClaimBurnResponse"; -export * from "./types/wallet-daemon-client/TransactionWaitResultRequest"; -export * from "./types/wallet-daemon-client/ClaimValidatorFeesResponse"; +export * from "./types/wallet-daemon-client/AccountGetResponse"; +export * from "./types/wallet-daemon-client/ClaimValidatorFeesRequest"; +export * from "./types/wallet-daemon-client/AuthRevokeTokenResponse"; +export * from "./types/wallet-daemon-client/AccountsInvokeRequest"; +export * from "./types/wallet-daemon-client/WebRtcStart"; +export * from "./types/wallet-daemon-client/TransactionWaitResultResponse"; +export * from "./types/wallet-daemon-client/GetValidatorFeesRequest"; export * from "./types/wallet-daemon-client/ConfidentialCreateOutputProofRequest"; -export * from "./types/wallet-daemon-client/KeysCreateRequest"; +export * from "./types/wallet-daemon-client/KeysCreateResponse"; +export * from "./types/wallet-daemon-client/AuthLoginDenyRequest"; +export * from "./types/wallet-daemon-client/ProofsFinalizeRequest"; +export * from "./types/wallet-daemon-client/ProofsCancelRequest"; export * from "./types/wallet-daemon-client/SettingsGetResponse"; +export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceRequest"; +export * from "./types/wallet-daemon-client/GetValidatorFeesResponse"; +export * from "./types/wallet-daemon-client/TransactionGetResponse"; +export * from "./types/wallet-daemon-client/TransactionSubmitRequest"; +export * from "./types/wallet-daemon-client/ListAccountNftResponse"; +export * from "./types/wallet-daemon-client/AccountsInvokeResponse"; +export * from "./types/wallet-daemon-client/AccountsListRequest"; +export * from "./types/wallet-daemon-client/AuthLoginAcceptResponse"; export * from "./types/wallet-daemon-client/TransactionSubmitDryRunResponse"; -export * from "./types/wallet-daemon-client/ClaimBurnResponse"; -export * from "./types/wallet-daemon-client/WebRtcStartRequest"; -export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceResponse"; -export * from "./types/wallet-daemon-client/WebRtcStart"; -export * from "./types/wallet-daemon-client/AccountSetDefaultRequest"; export * from "./types/wallet-daemon-client/ConfidentialCreateOutputProofResponse"; +export * from "./types/wallet-daemon-client/TemplatesGetRequest"; +export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceResponse"; +export * from "./types/wallet-daemon-client/SettingsSetRequest"; +export * from "./types/wallet-daemon-client/MintAccountNftRequest"; +export * from "./types/wallet-daemon-client/TransactionClaimBurnResponse"; +export * from "./types/wallet-daemon-client/AuthGetAllJwtRequest"; +export * from "./types/wallet-daemon-client/ClaimValidatorFeesResponse"; +export * from "./types/wallet-daemon-client/ConfidentialTransferResponse"; export * from "./types/wallet-daemon-client/TemplatesGetResponse"; -export * from "./types/wallet-daemon-client/ListAccountNftResponse"; -export * from "./types/wallet-daemon-client/AccountsGetBalancesRequest"; -export * from "./types/wallet-daemon-client/MintAccountNftResponse"; +export * from "./types/wallet-daemon-client/AccountsTransferRequest"; +export * from "./types/wallet-daemon-client/AuthLoginRequest"; +export * from "./types/wallet-daemon-client/AuthGetAllJwtResponse"; export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsRequest"; -export * from "./types/wallet-daemon-client/KeysCreateResponse"; +export * from "./types/wallet-daemon-client/ConfidentialTransferRequest"; +export * from "./types/wallet-daemon-client/SettingsSetResponse"; +export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsResponse"; +export * from "./types/wallet-daemon-client/AccountGetRequest"; +export * from "./types/wallet-daemon-client/KeysCreateRequest"; +export * from "./types/wallet-daemon-client/ProofsGenerateRequest"; +export * from "./types/wallet-daemon-client/TransactionGetResultResponse"; +export * from "./types/wallet-daemon-client/KeysSetActiveResponse"; +export * from "./types/wallet-daemon-client/AuthLoginDenyResponse"; +export * from "./types/wallet-daemon-client/TransactionGetResultRequest"; +export * from "./types/wallet-daemon-client/AccountsCreateResponse"; +export * from "./types/wallet-daemon-client/AccountsGetBalancesRequest"; export * from "./types/wallet-daemon-client/AccountInfo"; export * from "./types/wallet-daemon-client/SubstatesListRequest"; -export * from "./types/wallet-daemon-client/BalanceEntry"; -export * from "./types/wallet-daemon-client/TemplatesGetRequest"; -export * from "./types/wallet-daemon-client/AccountsInvokeRequest"; -export * from "./types/wallet-daemon-client/ProofsCancelRequest"; -export * from "./types/wallet-daemon-client/AccountSetDefaultResponse"; -export * from "./types/wallet-daemon-client/SubstatesListResponse"; -export * from "./types/wallet-daemon-client/KeysSetActiveResponse"; export * from "./types/wallet-daemon-client/ComponentAddressOrName"; -export * from "./types/wallet-daemon-client/AuthLoginAcceptRequest"; -export * from "./types/wallet-daemon-client/TransactionSubmitDryRunRequest"; -export * from "./types/wallet-daemon-client/KeysSetActiveRequest"; -export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceRequest"; -export * from "./types/wallet-daemon-client/ConfidentialTransferRequest"; -export * from "./types/wallet-daemon-client/AccountsCreateResponse"; -export * from "./types/wallet-daemon-client/TransactionWaitResultResponse"; -export * from "./types/wallet-daemon-client/AccountGetRequest"; diff --git a/bindings/src/index.ts b/bindings/src/index.ts index d3345a466..fadd8abd1 100644 --- a/bindings/src/index.ts +++ b/bindings/src/index.ts @@ -5,25 +5,25 @@ export * from "./types/AbortReason"; export * from "./types/AccessRule"; export * from "./types/Account"; export * from "./types/Amount"; -export * from "./types/ArgDef"; export * from "./types/Arg"; +export * from "./types/ArgDef"; export * from "./types/AuthHook"; -export * from "./types/BlockHeader"; export * from "./types/Block"; +export * from "./types/BlockHeader"; export * from "./types/BucketId"; export * from "./types/Claims"; export * from "./types/Command"; +export * from "./types/Committee"; export * from "./types/CommitteeInfo"; export * from "./types/CommitteeShardInfo"; -export * from "./types/Committee"; export * from "./types/ComponentAccessRules"; export * from "./types/ComponentAddress"; export * from "./types/ComponentBody"; export * from "./types/ComponentHeader"; export * from "./types/ComponentKey"; export * from "./types/ConfidentialClaim"; -export * from "./types/ConfidentialOutputStatement"; export * from "./types/ConfidentialOutput"; +export * from "./types/ConfidentialOutputStatement"; export * from "./types/ConfidentialStatement"; export * from "./types/ConfidentialTransferInputSelection"; export * from "./types/ConfidentialWithdrawProof"; @@ -35,12 +35,12 @@ export * from "./types/Era"; export * from "./types/Event"; export * from "./types/EvictNodeAtom"; export * from "./types/Evidence"; -export * from "./types/ExecutedTransaction"; export * from "./types/ExecuteResult"; +export * from "./types/ExecutedTransaction"; export * from "./types/ExtraData"; export * from "./types/FeeBreakdown"; -export * from "./types/FeeClaimAddress"; export * from "./types/FeeClaim"; +export * from "./types/FeeClaimAddress"; export * from "./types/FeeCostBreakdown"; export * from "./types/FeeReceipt"; export * from "./types/FeeSource"; @@ -49,10 +49,10 @@ export * from "./types/ForeignProposalAtom"; export * from "./types/FunctionDef"; export * from "./types/IndexedValue"; export * from "./types/IndexedWellKnownTypes"; -export * from "./types/InstructionResult"; export * from "./types/Instruction"; -export * from "./types/JrpcPermissions"; +export * from "./types/InstructionResult"; export * from "./types/JrpcPermission"; +export * from "./types/JrpcPermissions"; export * from "./types/LeaderFee"; export * from "./types/LockFlag"; export * from "./types/LogEntry"; @@ -61,67 +61,69 @@ export * from "./types/Metadata"; export * from "./types/MintConfidentialOutputAtom"; export * from "./types/NetworkCommitteeInfo"; export * from "./types/NodeHeight"; -export * from "./types/NonFungibleAddressContents"; +export * from "./types/NonFungible"; export * from "./types/NonFungibleAddress"; +export * from "./types/NonFungibleAddressContents"; export * from "./types/NonFungibleContainer"; export * from "./types/NonFungibleId"; -export * from "./types/NonFungibleIndexAddress"; export * from "./types/NonFungibleIndex"; +export * from "./types/NonFungibleIndexAddress"; export * from "./types/NonFungibleToken"; -export * from "./types/NonFungible"; export * from "./types/NumPreshards"; export * from "./types/Ordering"; export * from "./types/OwnerRule"; export * from "./types/PeerAddress"; export * from "./types/ProofId"; +export * from "./types/PublishedTemplate"; +export * from "./types/PublishedTemplateAddress"; export * from "./types/QuorumCertificate"; export * from "./types/QuorumDecision"; export * from "./types/RejectReason"; export * from "./types/RequireRule"; +export * from "./types/Resource"; export * from "./types/ResourceAccessRules"; export * from "./types/ResourceAddress"; export * from "./types/ResourceContainer"; -export * from "./types/Resource"; export * from "./types/ResourceType"; export * from "./types/RestrictedAccessRule"; export * from "./types/ResumeNodeAtom"; export * from "./types/RuleRequirement"; +export * from "./types/Shard"; export * from "./types/ShardEvidence"; -export * from "./types/ShardGroupEvidence"; export * from "./types/ShardGroup"; -export * from "./types/Shard"; +export * from "./types/ShardGroupEvidence"; +export * from "./types/Substate"; export * from "./types/SubstateAddress"; export * from "./types/SubstateDestroyed"; export * from "./types/SubstateDiff"; export * from "./types/SubstateId"; export * from "./types/SubstateLockType"; export * from "./types/SubstateRecord"; -export * from "./types/SubstateRequirementLockIntent"; export * from "./types/SubstateRequirement"; -export * from "./types/Substate"; +export * from "./types/SubstateRequirementLockIntent"; export * from "./types/SubstateType"; export * from "./types/SubstateValue"; export * from "./types/SuspendNodeAtom"; export * from "./types/TemplateDef"; export * from "./types/TemplateDefV1"; +export * from "./types/Transaction"; export * from "./types/TransactionAtom"; export * from "./types/TransactionPoolRecord"; export * from "./types/TransactionPoolStage"; -export * from "./types/TransactionReceiptAddress"; export * from "./types/TransactionReceipt"; +export * from "./types/TransactionReceiptAddress"; export * from "./types/TransactionResult"; export * from "./types/TransactionSignature"; export * from "./types/TransactionStatus"; -export * from "./types/Transaction"; export * from "./types/Type"; -export * from "./types/UnclaimedConfidentialOutputAddress"; export * from "./types/UnclaimedConfidentialOutput"; +export * from "./types/UnclaimedConfidentialOutputAddress"; export * from "./types/UnsignedTransaction"; export * from "./types/ValidatorSignature"; -export * from "./types/VaultId"; export * from "./types/Vault"; -export * from "./types/VersionedSubstateIdLockIntent"; +export * from "./types/VaultId"; export * from "./types/VersionedSubstateId"; +export * from "./types/VersionedSubstateIdLockIntent"; export * from "./types/ViewableBalanceProof"; export * from "./base-node-client"; export * from "./tari-indexer-client"; diff --git a/bindings/src/tari-indexer-client.ts b/bindings/src/tari-indexer-client.ts index 9d60c9416..e9782093f 100644 --- a/bindings/src/tari-indexer-client.ts +++ b/bindings/src/tari-indexer-client.ts @@ -1,37 +1,37 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -export * from "./types/tari-indexer-client/IndexerSubmitTransactionResponse"; +export * from "./types/tari-indexer-client/IndexerGetEpochManagerStatsResponse"; +export * from "./types/tari-indexer-client/IndexerAddPeerRequest"; +export * from "./types/tari-indexer-client/NonFungibleSubstate"; +export * from "./types/tari-indexer-client/GetNonFungibleCountResponse"; +export * from "./types/tari-indexer-client/ListSubstatesRequest"; +export * from "./types/tari-indexer-client/IndexerGetIdentityResponse"; export * from "./types/tari-indexer-client/GetTemplateDefinitionRequest"; -export * from "./types/tari-indexer-client/ListSubstatesResponse"; -export * from "./types/tari-indexer-client/IndexerAddPeerResponse"; -export * from "./types/tari-indexer-client/InspectSubstateRequest"; -export * from "./types/tari-indexer-client/ListSubstateItem"; +export * from "./types/tari-indexer-client/IndexerGetSubstateRequest"; +export * from "./types/tari-indexer-client/GetTemplateDefinitionResponse"; +export * from "./types/tari-indexer-client/ListTemplatesRequest"; export * from "./types/tari-indexer-client/IndexerGetAllVnsResponse"; -export * from "./types/tari-indexer-client/ListSubstatesRequest"; -export * from "./types/tari-indexer-client/GetRelatedTransactionsResponse"; -export * from "./types/tari-indexer-client/IndexerTransactionFinalizedResult"; +export * from "./types/tari-indexer-client/GetNonFungiblesRequest"; export * from "./types/tari-indexer-client/IndexerGetSubstateResponse"; +export * from "./types/tari-indexer-client/IndexerSubmitTransactionRequest"; +export * from "./types/tari-indexer-client/IndexerConnection"; +export * from "./types/tari-indexer-client/InspectSubstateResponse"; export * from "./types/tari-indexer-client/IndexerGetAllVnsRequest"; +export * from "./types/tari-indexer-client/InspectSubstateRequest"; export * from "./types/tari-indexer-client/IndexerGetCommsStatsResponse"; -export * from "./types/tari-indexer-client/IndexerConnection"; -export * from "./types/tari-indexer-client/GetNonFungiblesRequest"; -export * from "./types/tari-indexer-client/IndexerAddPeerRequest"; -export * from "./types/tari-indexer-client/GetRelatedTransactionsRequest"; -export * from "./types/tari-indexer-client/GetNonFungiblesResponse"; -export * from "./types/tari-indexer-client/GetTemplateDefinitionResponse"; +export * from "./types/tari-indexer-client/GetNonFungibleCountRequest"; +export * from "./types/tari-indexer-client/GetRelatedTransactionsResponse"; +export * from "./types/tari-indexer-client/IndexerAddPeerResponse"; export * from "./types/tari-indexer-client/IndexerGetConnectionsResponse"; -export * from "./types/tari-indexer-client/IndexerSubmitTransactionRequest"; +export * from "./types/tari-indexer-client/GetNonFungiblesResponse"; +export * from "./types/tari-indexer-client/GetRelatedTransactionsRequest"; +export * from "./types/tari-indexer-client/IndexerGetTransactionResultResponse"; export * from "./types/tari-indexer-client/ListTemplatesResponse"; -export * from "./types/tari-indexer-client/InspectSubstateResponse"; +export * from "./types/tari-indexer-client/IndexerGetTransactionResultRequest"; +export * from "./types/tari-indexer-client/ListSubstatesResponse"; +export * from "./types/tari-indexer-client/IndexerTransactionFinalizedResult"; export * from "./types/tari-indexer-client/GetNonFungibleCollectionsResponse"; -export * from "./types/tari-indexer-client/IndexerGetSubstateRequest"; -export * from "./types/tari-indexer-client/IndexerGetEpochManagerStatsResponse"; -export * from "./types/tari-indexer-client/NonFungibleSubstate"; -export * from "./types/tari-indexer-client/GetNonFungibleCountResponse"; -export * from "./types/tari-indexer-client/ListTemplatesRequest"; -export * from "./types/tari-indexer-client/IndexerGetTransactionResultResponse"; +export * from "./types/tari-indexer-client/IndexerSubmitTransactionResponse"; export * from "./types/tari-indexer-client/IndexerConnectionDirection"; -export * from "./types/tari-indexer-client/IndexerGetIdentityResponse"; -export * from "./types/tari-indexer-client/IndexerGetTransactionResultRequest"; -export * from "./types/tari-indexer-client/GetNonFungibleCountRequest"; +export * from "./types/tari-indexer-client/ListSubstateItem"; diff --git a/bindings/src/types/IndexedWellKnownTypes.ts b/bindings/src/types/IndexedWellKnownTypes.ts index 0682228bb..ff19b37f3 100644 --- a/bindings/src/types/IndexedWellKnownTypes.ts +++ b/bindings/src/types/IndexedWellKnownTypes.ts @@ -4,6 +4,7 @@ import type { ComponentAddress } from "./ComponentAddress"; import type { Metadata } from "./Metadata"; import type { NonFungibleAddress } from "./NonFungibleAddress"; import type { ProofId } from "./ProofId"; +import type { PublishedTemplateAddress } from "./PublishedTemplateAddress"; import type { ResourceAddress } from "./ResourceAddress"; import type { TransactionReceiptAddress } from "./TransactionReceiptAddress"; import type { UnclaimedConfidentialOutputAddress } from "./UnclaimedConfidentialOutputAddress"; @@ -19,4 +20,5 @@ export interface IndexedWellKnownTypes { vault_ids: Array; metadata: Array; unclaimed_confidential_output_address: Array; + published_template_addresses: Array; } diff --git a/bindings/src/types/PublishedTemplate.ts b/bindings/src/types/PublishedTemplate.ts new file mode 100644 index 000000000..0ea4c87bd --- /dev/null +++ b/bindings/src/types/PublishedTemplate.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface PublishedTemplate { + binary: Array; +} diff --git a/bindings/src/types/PublishedTemplateAddress.ts b/bindings/src/types/PublishedTemplateAddress.ts new file mode 100644 index 000000000..98f0c04a4 --- /dev/null +++ b/bindings/src/types/PublishedTemplateAddress.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type PublishedTemplateAddress = string; diff --git a/bindings/src/types/SubstateId.ts b/bindings/src/types/SubstateId.ts index 3f40e1ddf..1f691d9b1 100644 --- a/bindings/src/types/SubstateId.ts +++ b/bindings/src/types/SubstateId.ts @@ -3,6 +3,7 @@ import type { ComponentAddress } from "./ComponentAddress"; import type { FeeClaimAddress } from "./FeeClaimAddress"; import type { NonFungibleAddress } from "./NonFungibleAddress"; import type { NonFungibleIndexAddress } from "./NonFungibleIndexAddress"; +import type { PublishedTemplateAddress } from "./PublishedTemplateAddress"; import type { ResourceAddress } from "./ResourceAddress"; import type { TransactionReceiptAddress } from "./TransactionReceiptAddress"; import type { UnclaimedConfidentialOutputAddress } from "./UnclaimedConfidentialOutputAddress"; @@ -16,4 +17,5 @@ export type SubstateId = | { NonFungible: NonFungibleAddress } | { NonFungibleIndex: NonFungibleIndexAddress } | { TransactionReceipt: TransactionReceiptAddress } - | { FeeClaim: FeeClaimAddress }; + | { FeeClaim: FeeClaimAddress } + | { Template: PublishedTemplateAddress }; diff --git a/bindings/src/types/SubstateValue.ts b/bindings/src/types/SubstateValue.ts index a2ba32440..1dc608696 100644 --- a/bindings/src/types/SubstateValue.ts +++ b/bindings/src/types/SubstateValue.ts @@ -3,6 +3,7 @@ import type { ComponentHeader } from "./ComponentHeader"; import type { FeeClaim } from "./FeeClaim"; import type { NonFungibleContainer } from "./NonFungibleContainer"; import type { NonFungibleIndex } from "./NonFungibleIndex"; +import type { PublishedTemplate } from "./PublishedTemplate"; import type { Resource } from "./Resource"; import type { TransactionReceipt } from "./TransactionReceipt"; import type { UnclaimedConfidentialOutput } from "./UnclaimedConfidentialOutput"; @@ -16,4 +17,5 @@ export type SubstateValue = | { NonFungibleIndex: NonFungibleIndex } | { UnclaimedConfidentialOutput: UnclaimedConfidentialOutput } | { TransactionReceipt: TransactionReceipt } - | { FeeClaim: FeeClaim }; + | { FeeClaim: FeeClaim } + | { Template: PublishedTemplate }; diff --git a/bindings/src/types/validator-node-client/TemplateMetadata.ts b/bindings/src/types/validator-node-client/TemplateMetadata.ts index 783cbb6bc..89d2bf3e8 100644 --- a/bindings/src/types/validator-node-client/TemplateMetadata.ts +++ b/bindings/src/types/validator-node-client/TemplateMetadata.ts @@ -3,7 +3,5 @@ export interface TemplateMetadata { name: string; address: string; - url: string; binary_sha: Array; - height: number; } diff --git a/bindings/src/validator-node-client.ts b/bindings/src/validator-node-client.ts index d8d5ae0d8..79565a484 100644 --- a/bindings/src/validator-node-client.ts +++ b/bindings/src/validator-node-client.ts @@ -1,63 +1,63 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -export * from "./types/validator-node-client/ValidatorNodeChange"; +export * from "./types/validator-node-client/GetCommitteeRequest"; +export * from "./types/validator-node-client/GetRecentTransactionsResponse"; +export * from "./types/validator-node-client/GetRecentTransactionsRequest"; +export * from "./types/validator-node-client/GetTemplatesRequest"; +export * from "./types/validator-node-client/GetBlocksCountResponse"; +export * from "./types/validator-node-client/VNAddPeerRequest"; +export * from "./types/validator-node-client/GetCommitteeResponse"; export * from "./types/validator-node-client/VNSubmitTransactionRequest"; +export * from "./types/validator-node-client/VNConnectionDirection"; +export * from "./types/validator-node-client/VNAddPeerResponse"; +export * from "./types/validator-node-client/GetSubstatesByTransactionResponse"; +export * from "./types/validator-node-client/VNCommitteeShardInfo"; +export * from "./types/validator-node-client/VNFunctionDef"; +export * from "./types/validator-node-client/ValidatorNodeChange"; +export * from "./types/validator-node-client/VNGetValidatorFeesResponse"; +export * from "./types/validator-node-client/VNGetAllVnsResponse"; +export * from "./types/validator-node-client/TemplateAbi"; +export * from "./types/validator-node-client/GetMempoolStatsResponse"; export * from "./types/validator-node-client/TemplateMetadata"; -export * from "./types/validator-node-client/GetFilteredBlocksCountRequest"; +export * from "./types/validator-node-client/GetBlockResponse"; +export * from "./types/validator-node-client/VNLogLevel"; +export * from "./types/validator-node-client/VNGetAllVnsRequest"; +export * from "./types/validator-node-client/GetBaseLayerEpochChangesRequest"; +export * from "./types/validator-node-client/GetBaseLayerEpochChangesResponse"; export * from "./types/validator-node-client/VNLogEntry"; export * from "./types/validator-node-client/GetShardKeyRequest"; -export * from "./types/validator-node-client/VNGetTransactionResultResponse"; +export * from "./types/validator-node-client/GetBlockRequest"; export * from "./types/validator-node-client/VNSubmitTransactionResponse"; -export * from "./types/validator-node-client/GetTxPoolResponse"; -export * from "./types/validator-node-client/GetTemplateResponse"; -export * from "./types/validator-node-client/GetBlocksCountResponse"; -export * from "./types/validator-node-client/VNGetValidatorFeesRequest"; -export * from "./types/validator-node-client/GetSubstatesByTransactionResponse"; -export * from "./types/validator-node-client/VNConnectionDirection"; -export * from "./types/validator-node-client/VNAddPeerRequest"; -export * from "./types/validator-node-client/GetTemplatesResponse"; -export * from "./types/validator-node-client/GetTransactionRequest"; -export * from "./types/validator-node-client/GetStateRequest"; -export * from "./types/validator-node-client/VNGetIdentityResponse"; -export * from "./types/validator-node-client/VNFunctionDef"; -export * from "./types/validator-node-client/GetBlocksRequest"; -export * from "./types/validator-node-client/GetTemplateRequest"; -export * from "./types/validator-node-client/GetShardKeyResponse"; -export * from "./types/validator-node-client/GetBaseLayerEpochChangesResponse"; -export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; -export * from "./types/validator-node-client/VNGetCommsStatsResponse"; -export * from "./types/validator-node-client/GetTransactionResponse"; -export * from "./types/validator-node-client/GetCommitteeResponse"; -export * from "./types/validator-node-client/VNGetAllVnsRequest"; -export * from "./types/validator-node-client/GetCommitteeRequest"; export * from "./types/validator-node-client/DryRunTransactionFinalizeResult"; -export * from "./types/validator-node-client/VNGetValidatorFeesResponse"; +export * from "./types/validator-node-client/GetTransactionResponse"; export * from "./types/validator-node-client/GetStateResponse"; -export * from "./types/validator-node-client/GetBaseLayerEpochChangesRequest"; +export * from "./types/validator-node-client/VNGetSubstateRequest"; +export * from "./types/validator-node-client/VNGetSubstateResponse"; +export * from "./types/validator-node-client/ListBlocksResponse"; export * from "./types/validator-node-client/SubstateStatus"; +export * from "./types/validator-node-client/ValidatorNode"; +export * from "./types/validator-node-client/GetFilteredBlocksCountRequest"; +export * from "./types/validator-node-client/ListBlocksRequest"; +export * from "./types/validator-node-client/GetEpochManagerStatsResponse"; +export * from "./types/validator-node-client/GetTxPoolResponse"; +export * from "./types/validator-node-client/VNConnection"; export * from "./types/validator-node-client/GetConsensusStatusResponse"; -export * from "./types/validator-node-client/GetBlocksResponse"; -export * from "./types/validator-node-client/ListBlocksResponse"; -export * from "./types/validator-node-client/GetBlockRequest"; -export * from "./types/validator-node-client/VNGetTransactionResultRequest"; -export * from "./types/validator-node-client/GetRecentTransactionsRequest"; +export * from "./types/validator-node-client/GetTemplateResponse"; export * from "./types/validator-node-client/ValidatorFee"; -export * from "./types/validator-node-client/VNLogLevel"; -export * from "./types/validator-node-client/GetRecentTransactionsResponse"; -export * from "./types/validator-node-client/VNAddPeerResponse"; -export * from "./types/validator-node-client/VNConnection"; -export * from "./types/validator-node-client/ValidatorNode"; export * from "./types/validator-node-client/VNGetConnectionsResponse"; -export * from "./types/validator-node-client/ListBlocksRequest"; -export * from "./types/validator-node-client/GetNetworkCommitteeResponse"; -export * from "./types/validator-node-client/VNGetSubstateRequest"; -export * from "./types/validator-node-client/GetMempoolStatsResponse"; -export * from "./types/validator-node-client/TemplateAbi"; -export * from "./types/validator-node-client/GetTemplatesRequest"; -export * from "./types/validator-node-client/VNGetSubstateResponse"; -export * from "./types/validator-node-client/VNGetAllVnsResponse"; +export * from "./types/validator-node-client/VNGetCommsStatsResponse"; +export * from "./types/validator-node-client/GetTemplateRequest"; +export * from "./types/validator-node-client/GetStateRequest"; +export * from "./types/validator-node-client/GetBlocksRequest"; +export * from "./types/validator-node-client/VNGetTransactionResultRequest"; +export * from "./types/validator-node-client/GetTransactionRequest"; +export * from "./types/validator-node-client/GetTemplatesResponse"; +export * from "./types/validator-node-client/VNGetTransactionResultResponse"; export * from "./types/validator-node-client/VNArgDef"; -export * from "./types/validator-node-client/GetEpochManagerStatsResponse"; -export * from "./types/validator-node-client/GetBlockResponse"; -export * from "./types/validator-node-client/VNCommitteeShardInfo"; +export * from "./types/validator-node-client/GetShardKeyResponse"; +export * from "./types/validator-node-client/GetBlocksResponse"; +export * from "./types/validator-node-client/VNGetIdentityResponse"; +export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; +export * from "./types/validator-node-client/GetNetworkCommitteeResponse"; +export * from "./types/validator-node-client/VNGetValidatorFeesRequest"; diff --git a/bindings/src/wallet-daemon-client.ts b/bindings/src/wallet-daemon-client.ts index 7c10e0ad2..9fe3e1c56 100644 --- a/bindings/src/wallet-daemon-client.ts +++ b/bindings/src/wallet-daemon-client.ts @@ -1,92 +1,92 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -export * from "./types/wallet-daemon-client/WalletSubstateRecord"; -export * from "./types/wallet-daemon-client/ProofsFinalizeResponse"; -export * from "./types/wallet-daemon-client/CallInstructionRequest"; -export * from "./types/wallet-daemon-client/AuthLoginAcceptResponse"; -export * from "./types/wallet-daemon-client/AccountsListRequest"; -export * from "./types/wallet-daemon-client/AuthGetAllJwtResponse"; -export * from "./types/wallet-daemon-client/AuthLoginResponse"; -export * from "./types/wallet-daemon-client/GetValidatorFeesRequest"; -export * from "./types/wallet-daemon-client/AccountGetDefaultRequest"; -export * from "./types/wallet-daemon-client/AuthGetAllJwtRequest"; -export * from "./types/wallet-daemon-client/KeyBranch"; -export * from "./types/wallet-daemon-client/AccountGetResponse"; -export * from "./types/wallet-daemon-client/SettingsSetRequest"; -export * from "./types/wallet-daemon-client/GetValidatorFeesResponse"; -export * from "./types/wallet-daemon-client/TransactionGetAllRequest"; +export * from "./types/wallet-daemon-client/AccountsListResponse"; export * from "./types/wallet-daemon-client/RevealFundsRequest"; -export * from "./types/wallet-daemon-client/AuthLoginDenyResponse"; -export * from "./types/wallet-daemon-client/AuthLoginDenyRequest"; -export * from "./types/wallet-daemon-client/TransactionSubmitResponse"; -export * from "./types/wallet-daemon-client/ProofsGenerateResponse"; -export * from "./types/wallet-daemon-client/ClaimValidatorFeesRequest"; -export * from "./types/wallet-daemon-client/AuthLoginRequest"; +export * from "./types/wallet-daemon-client/ClaimBurnResponse"; +export * from "./types/wallet-daemon-client/KeysSetActiveRequest"; +export * from "./types/wallet-daemon-client/WalletSubstateRecord"; +export * from "./types/wallet-daemon-client/AccountsGetBalancesResponse"; +export * from "./types/wallet-daemon-client/SubstatesGetResponse"; export * from "./types/wallet-daemon-client/ListAccountNftRequest"; +export * from "./types/wallet-daemon-client/RevealFundsResponse"; +export * from "./types/wallet-daemon-client/AccountSetDefaultRequest"; +export * from "./types/wallet-daemon-client/GetAccountNftRequest"; +export * from "./types/wallet-daemon-client/TransactionGetAllResponse"; export * from "./types/wallet-daemon-client/TransactionGetRequest"; -export * from "./types/wallet-daemon-client/AuthRevokeTokenResponse"; -export * from "./types/wallet-daemon-client/ProofsFinalizeRequest"; -export * from "./types/wallet-daemon-client/AccountsTransferRequest"; -export * from "./types/wallet-daemon-client/SettingsSetResponse"; -export * from "./types/wallet-daemon-client/KeysListRequest"; +export * from "./types/wallet-daemon-client/KeyBranch"; +export * from "./types/wallet-daemon-client/AuthLoginAcceptRequest"; +export * from "./types/wallet-daemon-client/AccountSetDefaultResponse"; +export * from "./types/wallet-daemon-client/SubstatesListResponse"; +export * from "./types/wallet-daemon-client/AccountGetDefaultRequest"; +export * from "./types/wallet-daemon-client/KeysListResponse"; +export * from "./types/wallet-daemon-client/ProofsGenerateResponse"; +export * from "./types/wallet-daemon-client/TransactionGetAllRequest"; export * from "./types/wallet-daemon-client/AccountsTransferResponse"; -export * from "./types/wallet-daemon-client/TransactionGetResultResponse"; +export * from "./types/wallet-daemon-client/AuthLoginResponse"; export * from "./types/wallet-daemon-client/ClaimBurnRequest"; -export * from "./types/wallet-daemon-client/KeysListResponse"; +export * from "./types/wallet-daemon-client/BalanceEntry"; +export * from "./types/wallet-daemon-client/KeysListRequest"; export * from "./types/wallet-daemon-client/SubstatesGetRequest"; -export * from "./types/wallet-daemon-client/TransactionSubmitRequest"; -export * from "./types/wallet-daemon-client/AccountsGetBalancesResponse"; -export * from "./types/wallet-daemon-client/TransactionGetAllResponse"; -export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsResponse"; -export * from "./types/wallet-daemon-client/ConfidentialTransferResponse"; -export * from "./types/wallet-daemon-client/TransactionGetResponse"; -export * from "./types/wallet-daemon-client/SubstatesGetResponse"; -export * from "./types/wallet-daemon-client/GetAccountNftRequest"; +export * from "./types/wallet-daemon-client/ProofsFinalizeResponse"; export * from "./types/wallet-daemon-client/AuthRevokeTokenRequest"; -export * from "./types/wallet-daemon-client/ProofsGenerateRequest"; -export * from "./types/wallet-daemon-client/RevealFundsResponse"; -export * from "./types/wallet-daemon-client/AccountsInvokeResponse"; -export * from "./types/wallet-daemon-client/AccountsListResponse"; +export * from "./types/wallet-daemon-client/TransactionWaitResultRequest"; +export * from "./types/wallet-daemon-client/TransactionSubmitResponse"; +export * from "./types/wallet-daemon-client/AccountsCreateRequest"; +export * from "./types/wallet-daemon-client/CallInstructionRequest"; +export * from "./types/wallet-daemon-client/WebRtcStartRequest"; export * from "./types/wallet-daemon-client/WebRtcStartResponse"; -export * from "./types/wallet-daemon-client/TransactionGetResultRequest"; +export * from "./types/wallet-daemon-client/TransactionSubmitDryRunRequest"; +export * from "./types/wallet-daemon-client/MintAccountNftResponse"; export * from "./types/wallet-daemon-client/ProofsCancelResponse"; -export * from "./types/wallet-daemon-client/AccountsCreateRequest"; -export * from "./types/wallet-daemon-client/MintAccountNftRequest"; -export * from "./types/wallet-daemon-client/TransactionClaimBurnResponse"; -export * from "./types/wallet-daemon-client/TransactionWaitResultRequest"; -export * from "./types/wallet-daemon-client/ClaimValidatorFeesResponse"; +export * from "./types/wallet-daemon-client/AccountGetResponse"; +export * from "./types/wallet-daemon-client/ClaimValidatorFeesRequest"; +export * from "./types/wallet-daemon-client/AuthRevokeTokenResponse"; +export * from "./types/wallet-daemon-client/AccountsInvokeRequest"; +export * from "./types/wallet-daemon-client/WebRtcStart"; +export * from "./types/wallet-daemon-client/TransactionWaitResultResponse"; +export * from "./types/wallet-daemon-client/GetValidatorFeesRequest"; export * from "./types/wallet-daemon-client/ConfidentialCreateOutputProofRequest"; -export * from "./types/wallet-daemon-client/KeysCreateRequest"; +export * from "./types/wallet-daemon-client/KeysCreateResponse"; +export * from "./types/wallet-daemon-client/AuthLoginDenyRequest"; +export * from "./types/wallet-daemon-client/ProofsFinalizeRequest"; +export * from "./types/wallet-daemon-client/ProofsCancelRequest"; export * from "./types/wallet-daemon-client/SettingsGetResponse"; +export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceRequest"; +export * from "./types/wallet-daemon-client/GetValidatorFeesResponse"; +export * from "./types/wallet-daemon-client/TransactionGetResponse"; +export * from "./types/wallet-daemon-client/TransactionSubmitRequest"; +export * from "./types/wallet-daemon-client/ListAccountNftResponse"; +export * from "./types/wallet-daemon-client/AccountsInvokeResponse"; +export * from "./types/wallet-daemon-client/AccountsListRequest"; +export * from "./types/wallet-daemon-client/AuthLoginAcceptResponse"; export * from "./types/wallet-daemon-client/TransactionSubmitDryRunResponse"; -export * from "./types/wallet-daemon-client/ClaimBurnResponse"; -export * from "./types/wallet-daemon-client/WebRtcStartRequest"; -export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceResponse"; -export * from "./types/wallet-daemon-client/WebRtcStart"; -export * from "./types/wallet-daemon-client/AccountSetDefaultRequest"; export * from "./types/wallet-daemon-client/ConfidentialCreateOutputProofResponse"; +export * from "./types/wallet-daemon-client/TemplatesGetRequest"; +export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceResponse"; +export * from "./types/wallet-daemon-client/SettingsSetRequest"; +export * from "./types/wallet-daemon-client/MintAccountNftRequest"; +export * from "./types/wallet-daemon-client/TransactionClaimBurnResponse"; +export * from "./types/wallet-daemon-client/AuthGetAllJwtRequest"; +export * from "./types/wallet-daemon-client/ClaimValidatorFeesResponse"; +export * from "./types/wallet-daemon-client/ConfidentialTransferResponse"; export * from "./types/wallet-daemon-client/TemplatesGetResponse"; -export * from "./types/wallet-daemon-client/ListAccountNftResponse"; -export * from "./types/wallet-daemon-client/AccountsGetBalancesRequest"; -export * from "./types/wallet-daemon-client/MintAccountNftResponse"; +export * from "./types/wallet-daemon-client/AccountsTransferRequest"; +export * from "./types/wallet-daemon-client/AuthLoginRequest"; +export * from "./types/wallet-daemon-client/AuthGetAllJwtResponse"; export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsRequest"; -export * from "./types/wallet-daemon-client/KeysCreateResponse"; +export * from "./types/wallet-daemon-client/ConfidentialTransferRequest"; +export * from "./types/wallet-daemon-client/SettingsSetResponse"; +export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsResponse"; +export * from "./types/wallet-daemon-client/AccountGetRequest"; +export * from "./types/wallet-daemon-client/KeysCreateRequest"; +export * from "./types/wallet-daemon-client/ProofsGenerateRequest"; +export * from "./types/wallet-daemon-client/TransactionGetResultResponse"; +export * from "./types/wallet-daemon-client/KeysSetActiveResponse"; +export * from "./types/wallet-daemon-client/AuthLoginDenyResponse"; +export * from "./types/wallet-daemon-client/TransactionGetResultRequest"; +export * from "./types/wallet-daemon-client/AccountsCreateResponse"; +export * from "./types/wallet-daemon-client/AccountsGetBalancesRequest"; export * from "./types/wallet-daemon-client/AccountInfo"; export * from "./types/wallet-daemon-client/SubstatesListRequest"; -export * from "./types/wallet-daemon-client/BalanceEntry"; -export * from "./types/wallet-daemon-client/TemplatesGetRequest"; -export * from "./types/wallet-daemon-client/AccountsInvokeRequest"; -export * from "./types/wallet-daemon-client/ProofsCancelRequest"; -export * from "./types/wallet-daemon-client/AccountSetDefaultResponse"; -export * from "./types/wallet-daemon-client/SubstatesListResponse"; -export * from "./types/wallet-daemon-client/KeysSetActiveResponse"; export * from "./types/wallet-daemon-client/ComponentAddressOrName"; -export * from "./types/wallet-daemon-client/AuthLoginAcceptRequest"; -export * from "./types/wallet-daemon-client/TransactionSubmitDryRunRequest"; -export * from "./types/wallet-daemon-client/KeysSetActiveRequest"; -export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceRequest"; -export * from "./types/wallet-daemon-client/ConfidentialTransferRequest"; -export * from "./types/wallet-daemon-client/AccountsCreateResponse"; -export * from "./types/wallet-daemon-client/TransactionWaitResultResponse"; -export * from "./types/wallet-daemon-client/AccountGetRequest"; diff --git a/clients/tari_indexer_client/src/types.rs b/clients/tari_indexer_client/src/types.rs index 78d41592f..d2052690d 100644 --- a/clients/tari_indexer_client/src/types.rs +++ b/clients/tari_indexer_client/src/types.rs @@ -192,12 +192,8 @@ pub struct TemplateMetadata { pub name: String, #[cfg_attr(feature = "ts", ts(type = "Uint8Array"))] pub address: TemplateAddress, - pub url: String, /// SHA hash of binary pub binary_sha: String, - /// Block height in which the template was published - #[cfg_attr(feature = "ts", ts(type = "number"))] - pub height: u64, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/clients/validator_node_client/src/types.rs b/clients/validator_node_client/src/types.rs index 12b218729..bf0ddeabb 100644 --- a/clients/validator_node_client/src/types.rs +++ b/clients/validator_node_client/src/types.rs @@ -178,12 +178,8 @@ pub struct TemplateMetadata { #[cfg_attr(feature = "ts", ts(type = "string"))] #[serde(with = "serde_with::string")] pub address: TemplateAddress, - pub url: String, /// SHA hash of binary pub binary_sha: Vec, - /// Block height in which the template was published - #[cfg_attr(feature = "ts", ts(type = "number"))] - pub height: u64, } /// A request to submit a transaction diff --git a/dan_layer/common_types/src/services/template_provider.rs b/dan_layer/common_types/src/services/template_provider.rs index 629bdbfab..684092e6c 100644 --- a/dan_layer/common_types/src/services/template_provider.rs +++ b/dan_layer/common_types/src/services/template_provider.rs @@ -1,6 +1,7 @@ // Copyright 2022 The Tari Project // SPDX-License-Identifier: BSD-3-Clause +use tari_common_types::types::PublicKey; use tari_engine_types::TemplateAddress; pub trait TemplateProvider: Send + Sync + Clone + 'static { @@ -8,4 +9,11 @@ pub trait TemplateProvider: Send + Sync + Clone + 'static { type Error: std::error::Error + Sync + Send + 'static; fn get_template_module(&self, id: &TemplateAddress) -> Result, Self::Error>; + + fn add_wasm_template( + &self, + author_public_key: PublicKey, + template_address: TemplateAddress, + template: &[u8], + ) -> Result<(), Self::Error>; } diff --git a/dan_layer/consensus_tests/src/support/epoch_manager.rs b/dan_layer/consensus_tests/src/support/epoch_manager.rs index e1ef8c357..ace705aff 100644 --- a/dan_layer/consensus_tests/src/support/epoch_manager.rs +++ b/dan_layer/consensus_tests/src/support/epoch_manager.rs @@ -179,7 +179,7 @@ impl EpochManagerReader for TestEpochManager { Ok(CommitteeInfo::new( TEST_NUM_PRESHARDS, num_shard_group_members as u32, - num_committees as u32, + num_committees, sg, )) } diff --git a/dan_layer/engine/src/runtime/impl.rs b/dan_layer/engine/src/runtime/impl.rs index 71ea417a2..911b748ae 100644 --- a/dan_layer/engine/src/runtime/impl.rs +++ b/dan_layer/engine/src/runtime/impl.rs @@ -34,10 +34,12 @@ use tari_engine_types::{ confidential::{get_commitment_factory, get_range_proof_service, ConfidentialClaim, ConfidentialOutput}, entity_id_provider::EntityIdProvider, events::Event, + hashing::{hasher32, template_hasher32, EngineHashDomainLabel}, indexed_value::IndexedValue, instruction_result::InstructionResult, lock::LockFlag, logs::LogEntry, + published_template::{PublishedTemplate, PublishedTemplateAddress}, resource::Resource, resource_container::ResourceContainer, substate::{SubstateId, SubstateValue}, @@ -2342,6 +2344,26 @@ impl> RuntimeInte Ok(InvokeResult::encode(&address)?) } + + fn publish_template(&self, template: Vec) -> Result<(), RuntimeError> { + self.tracker.write_with(|state| { + let binary_hash = template_hasher32().chain(&template).result(); + let template_address = PublishedTemplateAddress::from_hash( + hasher32(EngineHashDomainLabel::TemplateAddress) + .chain(&self.transaction_signer_public_key) + .chain(&binary_hash) + .result(), + ); + state.new_substate( + template_address, + SubstateValue::Template(PublishedTemplate { binary: template }), + )?; + let scope_mut = state.current_call_scope_mut()?; + scope_mut.move_node_to_owned(&template_address.into())?; + + Ok(()) + }) + } } fn validate_component_access_rule_methods( diff --git a/dan_layer/engine/src/runtime/mod.rs b/dan_layer/engine/src/runtime/mod.rs index 8130d4ef4..f8f630a12 100644 --- a/dan_layer/engine/src/runtime/mod.rs +++ b/dan_layer/engine/src/runtime/mod.rs @@ -180,6 +180,8 @@ pub trait RuntimeInterface: Send + Sync { fn push_call_frame(&self, frame: PushCallFrame) -> Result<(), RuntimeError>; fn pop_call_frame(&self) -> Result<(), RuntimeError>; + + fn publish_template(&self, template: Vec) -> Result<(), RuntimeError>; } #[derive(Clone)] diff --git a/dan_layer/engine/src/transaction/error.rs b/dan_layer/engine/src/transaction/error.rs index c4f03d5fd..343dad66e 100644 --- a/dan_layer/engine/src/transaction/error.rs +++ b/dan_layer/engine/src/transaction/error.rs @@ -21,7 +21,7 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. use tari_engine_types::indexed_value::IndexedValueError; -use tari_template_lib::models::TemplateAddress; +use tari_template_lib::{models::TemplateAddress, HashParseError}; use crate::{runtime::RuntimeError, template::TemplateLoaderError, wasm::WasmExecutionError}; @@ -49,4 +49,8 @@ pub enum TransactionError { LoadTemplate(#[from] TemplateLoaderError), #[error("WASM binary too big! {0} bytes are greater than allowed maximum {1} bytes.")] WasmBinaryTooBig(usize, usize), + #[error("Template provider error: {0}")] + TemplateProvider(String), + #[error("Converting to hash error: {0}")] + HashConversion(#[from] HashParseError), } diff --git a/dan_layer/engine/src/transaction/processor.rs b/dan_layer/engine/src/transaction/processor.rs index 33050e68f..f6663c404 100644 --- a/dan_layer/engine/src/transaction/processor.rs +++ b/dan_layer/engine/src/transaction/processor.rs @@ -42,7 +42,7 @@ use tari_template_builtin::ACCOUNT_TEMPLATE_ADDRESS; use tari_template_lib::{ arg, args, - args::{Arg, LogLevel, WorkspaceAction}, + args::{Arg, WorkspaceAction}, auth::OwnerRule, crypto::RistrettoPublicKeyBytes, invoke_args, @@ -365,7 +365,7 @@ impl + 'static> T Ok(()) } - /// Load, validate template binary and adds to the cache of TemplateProvider. + /// Load, validate template binary and adds it to TemplateProvider. pub fn publish_template( config: &TransactionProcessorConfig, runtime: &Runtime, @@ -377,13 +377,13 @@ impl + 'static> T config.template_binary_max_size_bytes, )); } - let template = WasmModule::load_template_from_code(binary.as_slice())?; - // TODO: delete debug log when implemented - runtime.interface().emit_log( - LogLevel::Debug, - format!("Template name: \"{}\"", template.template_name()), - )?; - // TODO: implement + + // validate binary + WasmModule::load_template_from_code(binary.as_slice())?; + + // creating new substate + runtime.interface().publish_template(binary)?; + Ok(InstructionResult::empty()) } diff --git a/dan_layer/engine/src/wasm/module.rs b/dan_layer/engine/src/wasm/module.rs index d4d422292..fac2436ae 100644 --- a/dan_layer/engine/src/wasm/module.rs +++ b/dan_layer/engine/src/wasm/module.rs @@ -87,6 +87,10 @@ impl WasmModule { &self.code } + pub fn into_code(self) -> Vec { + self.code + } + fn create_engine() -> Engine { const MEMORY_PAGE_LIMIT: Pages = Pages(32); // 2MiB = 32 * 65,536 let base = BaseTunables::for_target(&Target::default()); diff --git a/dan_layer/engine/tests/publish_template.rs b/dan_layer/engine/tests/publish_template.rs new file mode 100644 index 000000000..1a5d46b2e --- /dev/null +++ b/dan_layer/engine/tests/publish_template.rs @@ -0,0 +1,110 @@ +// Copyright 2024 The Tari Project +// SPDX-License-Identifier: BSD-3-Clause + +use std::iter; + +use rand::random; +use tari_dan_engine::wasm::compile::compile_template; +use tari_engine_types::{ + commit_result::{RejectReason, TransactionResult}, + hashing::{hasher32, template_hasher32, EngineHashDomainLabel}, + published_template::PublishedTemplateAddress, + substate::{SubstateId, SubstateValue}, +}; +use tari_template_lib::models::Amount; +use tari_template_test_tooling::TemplateTest; +use tari_transaction::Transaction; + +#[test] +fn publish_template_success() { + let mut test = TemplateTest::new(Vec::::new()); + let (account_address, owner_proof, account_key, public_key) = test.create_custom_funded_account(Amount(250_000)); + let template = compile_template("tests/templates/hello_world", &[]).unwrap(); + let expected_binary_hash = template_hasher32().chain(template.code()).result(); + let expected_template_address = PublishedTemplateAddress::from_hash( + hasher32(EngineHashDomainLabel::TemplateAddress) + .chain(&public_key) + .chain(&expected_binary_hash) + .result(), + ); + + let result = test.execute_expect_success( + Transaction::builder() + .fee_transaction_pay_from_component(account_address, Amount(200_000)) + .publish_template(template.code().to_vec()) + .sign(&account_key) + .build(), + vec![owner_proof], + ); + + assert!(matches!(result.finalize.result, TransactionResult::Accept(_))); + + let mut template_found = false; + if let TransactionResult::Accept(diff) = result.finalize.result { + diff.up_iter().for_each(|(substate_id, substate)| { + if let SubstateValue::Template(curr_template) = substate.substate_value() { + if curr_template.binary.as_slice() == template.code() { + template_found = true; + assert!(matches!(substate_id, SubstateId::Template(_))); + if let SubstateId::Template(curr_template_addr) = substate_id { + assert_eq!(expected_template_address, *curr_template_addr); + } + } + } + }); + } + + assert!(template_found); +} + +#[test] +fn publish_template_invalid_binary() { + let mut test = TemplateTest::new(Vec::::new()); + let (account_address, owner_proof, account_key, _) = test.create_custom_funded_account(Amount(250_000)); + let result = test.execute_expect_failure( + Transaction::builder() + .fee_transaction_pay_from_component(account_address, Amount(200_000)) + .publish_template(vec![1, 2, 3]) + .sign(&account_key) + .build(), + vec![owner_proof], + ); + + assert!(matches!(result, RejectReason::ExecutionFailure(_))); + + if let RejectReason::ExecutionFailure(error) = result { + assert!(error.starts_with("Load template error:")); + } +} + +#[test] +fn publish_template_too_big_binary() { + let mut test = TemplateTest::new(Vec::::new()); + let (account_address, owner_proof, account_key, _) = test.create_custom_funded_account(Amount(250_000)); + let random_wasm_binary = generate_random_binary(6 * 1000 * 1000); // 6 MB + let wasm_binary_size = random_wasm_binary.len(); + let result = test.execute_expect_failure( + Transaction::builder() + .fee_transaction_pay_from_component(account_address, Amount(200_000)) + .publish_template(random_wasm_binary) + .sign(&account_key) + .build(), + vec![owner_proof], + ); + + assert!(matches!(result, RejectReason::ExecutionFailure(_))); + + if let RejectReason::ExecutionFailure(error) = result { + assert_eq!( + error, + format!( + "WASM binary too big! {} bytes are greater than allowed maximum 5000000 bytes.", + wasm_binary_size + ) + ); + } +} + +fn generate_random_binary(size_in_bytes: usize) -> Vec { + iter::repeat_with(random).take(size_in_bytes).collect() +} diff --git a/dan_layer/engine/tests/test.rs b/dan_layer/engine/tests/test.rs index a581e8676..0c2bfdffd 100644 --- a/dan_layer/engine/tests/test.rs +++ b/dan_layer/engine/tests/test.rs @@ -115,8 +115,8 @@ fn state_create_multiple_in_one_call() { fn test_composed() { let mut template_test = TemplateTest::new(vec!["tests/templates/state", "tests/templates/hello_world"]); - let functions = template_test - .get_module("HelloWorld") + let module = template_test.get_module("HelloWorld"); + let functions = module .template_def() .functions() .iter() @@ -124,8 +124,8 @@ fn test_composed() { .collect::>(); assert_eq!(functions, vec!["greet", "new", "custom_greeting"]); - let functions = template_test - .get_module("State") + let module = template_test.get_module("State"); + let functions = module .template_def() .functions() .iter() @@ -197,8 +197,8 @@ fn test_private_function() { let mut template_test = TemplateTest::new(vec!["tests/templates/private_function"]); // check that the private method and function are not exported - let functions = template_test - .get_module("PrivateCounter") + let module = template_test.get_module("PrivateCounter"); + let functions = module .template_def() .functions() .iter() diff --git a/dan_layer/engine_types/src/argument_parser.rs b/dan_layer/engine_types/src/argument_parser.rs index 3b3b5467e..b9934e69e 100644 --- a/dan_layer/engine_types/src/argument_parser.rs +++ b/dan_layer/engine_types/src/argument_parser.rs @@ -104,14 +104,14 @@ fn try_parse_special_string_arg(s: &str) -> Result, ArgParseError> return Ok(ParsedArg::Workspace(contents.as_bytes().to_vec())); } - if let Ok(address) = SubstateId::from_str(s) { - return Ok(ParsedArg::SubstateId(address)); - } - if let Some(address) = parse_template_address(s) { return Ok(ParsedArg::TemplateAddress(address)); } + if let Ok(address) = SubstateId::from_str(s) { + return Ok(ParsedArg::SubstateId(address)); + } + if let Ok(metadata) = Metadata::from_str(s) { return Ok(ParsedArg::Metadata(metadata)); } @@ -164,6 +164,7 @@ impl From> for Arg { SubstateId::NonFungibleIndex(v) => arg!(v), SubstateId::TransactionReceipt(v) => arg!(v), SubstateId::FeeClaim(v) => arg!(v), + SubstateId::Template(v) => arg!(v), }, ParsedArg::TemplateAddress(v) => arg!(v), ParsedArg::UnsignedInteger(v) => arg!(v), @@ -201,6 +202,7 @@ fn convert_to_cbor(value: json::Value) -> tari_bor::Value { SubstateId::NonFungibleIndex(id) => to_value(&id).unwrap(), SubstateId::TransactionReceipt(id) => to_value(&id).unwrap(), SubstateId::FeeClaim(id) => to_value(&id).unwrap(), + SubstateId::Template(id) => to_value(&id).unwrap(), }, ParsedArg::TemplateAddress(address) => to_value(&address).unwrap(), ParsedArg::UnsignedInteger(i) => tari_bor::Value::Integer(i.into()), @@ -395,12 +397,12 @@ mod tests { #[test] fn it_parses_template_addresses() { // valid template addreses are parsed - let valid_template_address = "template_a9c017256ed22cb004c001b0db965a40b91ad557e1ace408ce306227d95f0f1c"; + let valid_template_address = "template_d7e6f5cd2b717c83c86d3b3abf046a4caa0947e04b4e88de97a94a63ad19e382"; let a = parse_arg(valid_template_address).unwrap(); assert_eq!( a, arg!( - TemplateAddress::from_str("a9c017256ed22cb004c001b0db965a40b91ad557e1ace408ce306227d95f0f1c").unwrap() + TemplateAddress::from_str("d7e6f5cd2b717c83c86d3b3abf046a4caa0947e04b4e88de97a94a63ad19e382").unwrap() ) ); diff --git a/dan_layer/engine_types/src/hashing.rs b/dan_layer/engine_types/src/hashing.rs index 9b0c93226..445cf4059 100644 --- a/dan_layer/engine_types/src/hashing.rs +++ b/dan_layer/engine_types/src/hashing.rs @@ -180,6 +180,7 @@ pub enum EngineHashDomainLabel { ComponentAddress, TransactionReceipt, FeeClaimAddress, + TemplateAddress, QuorumCertificate, SubstateValue, ViewKey, @@ -206,6 +207,7 @@ impl EngineHashDomainLabel { Self::QuorumCertificate => "QuorumCertificate", Self::SubstateValue => "SubstateValue", Self::ViewKey => "ViewKey", + Self::TemplateAddress => "TemplateAddress", } } } diff --git a/dan_layer/engine_types/src/indexed_value.rs b/dan_layer/engine_types/src/indexed_value.rs index cc0698222..bf8902ea5 100644 --- a/dan_layer/engine_types/src/indexed_value.rs +++ b/dan_layer/engine_types/src/indexed_value.rs @@ -24,6 +24,7 @@ use ts_rs::TS; use crate::{ fee_claim::FeeClaimAddress, + published_template::PublishedTemplateAddress, serde_with, substate::SubstateId, transaction_receipt::TransactionReceiptAddress, @@ -140,6 +141,7 @@ pub struct IndexedWellKnownTypes { vault_ids: Vec, metadata: Vec, unclaimed_confidential_output_address: Vec, + published_template_addresses: Vec, } impl IndexedWellKnownTypes { @@ -154,6 +156,7 @@ impl IndexedWellKnownTypes { vault_ids: vec![], metadata: vec![], unclaimed_confidential_output_address: vec![], + published_template_addresses: vec![], } } @@ -175,6 +178,7 @@ impl IndexedWellKnownTypes { vault_ids: visitor.vault_ids, metadata: visitor.metadata, unclaimed_confidential_output_address: visitor.unclaimed_confidential_output_addresses, + published_template_addresses: visitor.published_templates, }) } @@ -206,6 +210,9 @@ impl IndexedWellKnownTypes { WellKnownTariValue::UnclaimedConfidentialOutputAddress(addr) => { found = *address == addr; }, + WellKnownTariValue::PublishedTemplateAddress(addr) => { + found = *address == addr; + }, WellKnownTariValue::BucketId(_) | WellKnownTariValue::Metadata(_) | WellKnownTariValue::ProofId(_) => {}, @@ -277,6 +284,10 @@ impl IndexedWellKnownTypes { &self.unclaimed_confidential_output_address, &other.unclaimed_confidential_output_address, ), + published_template_addresses: diff_vec( + &self.published_template_addresses, + &other.published_template_addresses, + ), } } } @@ -318,6 +329,7 @@ pub enum WellKnownTariValue { FeeClaim(FeeClaimAddress), ProofId(ProofId), UnclaimedConfidentialOutputAddress(UnclaimedConfidentialOutputAddress), + PublishedTemplateAddress(PublishedTemplateAddress), } impl FromTagAndValue for WellKnownTariValue { @@ -367,6 +379,10 @@ impl FromTagAndValue for WellKnownTariValue { let value: ObjectKey = value.deserialized().map_err(BorError::from)?; Ok(Self::UnclaimedConfidentialOutputAddress(value.into())) }, + BinaryTag::TemplateAddress => { + let value: Hash = value.deserialized().map_err(BorError::from)?; + Ok(Self::PublishedTemplateAddress(value.into())) + }, } } } @@ -382,6 +398,7 @@ pub struct IndexedValueVisitor { vault_ids: Vec, metadata: Vec, unclaimed_confidential_output_addresses: Vec, + published_templates: Vec, } impl IndexedValueVisitor { @@ -396,6 +413,7 @@ impl IndexedValueVisitor { vault_ids: vec![], metadata: vec![], unclaimed_confidential_output_addresses: vec![], + published_templates: vec![], } } } @@ -435,6 +453,9 @@ impl ValueVisitor for IndexedValueVisitor { WellKnownTariValue::FeeClaim(_) => { // Do nothing }, + WellKnownTariValue::PublishedTemplateAddress(template) => { + self.published_templates.push(template); + }, } Ok(ControlFlow::Continue(())) } diff --git a/dan_layer/engine_types/src/lib.rs b/dan_layer/engine_types/src/lib.rs index d3afecb6c..a6b24881f 100644 --- a/dan_layer/engine_types/src/lib.rs +++ b/dan_layer/engine_types/src/lib.rs @@ -33,6 +33,7 @@ pub mod entity_id_provider; pub mod id_provider; mod argument_parser; +pub mod published_template; pub use argument_parser::parse_arg; diff --git a/dan_layer/engine_types/src/published_template.rs b/dan_layer/engine_types/src/published_template.rs new file mode 100644 index 000000000..408ef5165 --- /dev/null +++ b/dan_layer/engine_types/src/published_template.rs @@ -0,0 +1,74 @@ +// Copyright 2024 The Tari Project +// SPDX-License-Identifier: BSD-3-Clause + +use std::{ + fmt, + fmt::{Display, Formatter}, + str::FromStr, +}; + +use tari_bor::{BorTag, Deserialize, Serialize}; +use tari_template_lib::{ + models::{BinaryTag, KeyParseError, ObjectKey}, + Hash, +}; + +const TAG: u64 = BinaryTag::TemplateAddress.as_u64(); + +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +#[cfg_attr( + feature = "ts", + derive(ts_rs::TS), + ts(export, export_to = "../../bindings/src/types/") +)] +pub struct PublishedTemplateAddress(#[cfg_attr(feature = "ts", ts(type = "string"))] BorTag); + +impl PublishedTemplateAddress { + pub const fn from_hash(hash: Hash) -> Self { + let key = ObjectKey::from_array(hash.into_array()); + Self(BorTag::new(key)) + } + + pub fn as_object_key(&self) -> &ObjectKey { + self.0.inner() + } + + pub fn from_hex(hex: &str) -> Result { + Ok(Self(BorTag::new(ObjectKey::from_hex(hex)?))) + } + + pub fn as_hash(&self) -> Hash { + Hash::from_array(self.as_object_key().into_array()) + } +} + +impl> From for PublishedTemplateAddress { + fn from(address: T) -> Self { + Self::from_hash(address.into()) + } +} + +impl Display for PublishedTemplateAddress { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + write!(f, "template_{}", self.as_object_key()) + } +} + +impl FromStr for PublishedTemplateAddress { + type Err = KeyParseError; + + fn from_str(s: &str) -> Result { + let s = s.strip_prefix("template_").unwrap_or(s); + Self::from_hex(s) + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr( + feature = "ts", + derive(ts_rs::TS), + ts(export, export_to = "../../bindings/src/types/") +)] +pub struct PublishedTemplate { + pub binary: Vec, +} diff --git a/dan_layer/engine_types/src/substate.rs b/dan_layer/engine_types/src/substate.rs index 49d61822e..040e1cb21 100644 --- a/dan_layer/engine_types/src/substate.rs +++ b/dan_layer/engine_types/src/substate.rs @@ -51,6 +51,7 @@ use crate::{ hashing::{hasher32, substate_value_hasher32, EngineHashDomainLabel}, non_fungible::NonFungibleContainer, non_fungible_index::NonFungibleIndex, + published_template::{PublishedTemplate, PublishedTemplateAddress}, resource::Resource, serde_with, transaction_receipt::{TransactionReceipt, TransactionReceiptAddress}, @@ -118,6 +119,7 @@ pub enum SubstateId { NonFungibleIndex(#[serde(with = "serde_with::string")] NonFungibleIndexAddress), TransactionReceipt(#[serde(with = "serde_with::string")] TransactionReceiptAddress), FeeClaim(#[serde(with = "serde_with::string")] FeeClaimAddress), + Template(#[serde(with = "serde_with::string")] PublishedTemplateAddress), } impl SubstateId { @@ -149,6 +151,13 @@ impl SubstateId { } } + pub fn as_template(&self) -> Option { + match self { + Self::Template(address) => Some(*address), + _ => None, + } + } + /// Returns true for any substate that has is "versionable" i.e. can have a version > 0, otherwise false. pub fn is_versioned(&self) -> bool { match self { @@ -156,6 +165,7 @@ impl SubstateId { SubstateId::Resource(_) | SubstateId::Vault(_) | SubstateId::NonFungibleIndex(_) | + SubstateId::Template(_) | SubstateId::NonFungible(_) => true, SubstateId::UnclaimedConfidentialOutput(_) | SubstateId::TransactionReceipt(_) | @@ -198,6 +208,7 @@ impl SubstateId { SubstateId::UnclaimedConfidentialOutput(addr) => *addr.as_object_key(), SubstateId::TransactionReceipt(addr) => *addr.as_object_key(), SubstateId::FeeClaim(addr) => *addr.as_object_key(), + SubstateId::Template(addr) => *addr.as_object_key(), } } @@ -315,6 +326,12 @@ impl From for SubstateId { } } +impl From for SubstateId { + fn from(address: PublishedTemplateAddress) -> Self { + Self::Template(address) + } +} + impl TryFrom for ComponentAddress { type Error = SubstateId; @@ -337,6 +354,7 @@ impl Display for SubstateId { SubstateId::UnclaimedConfidentialOutput(commitment_address) => write!(f, "{}", commitment_address), SubstateId::TransactionReceipt(addr) => write!(f, "{}", addr), SubstateId::FeeClaim(addr) => write!(f, "{}", addr), + SubstateId::Template(addr) => write!(f, "{}", addr), } } } @@ -388,6 +406,10 @@ impl FromStr for SubstateId { let addr = Hash::from_hex(addr).map_err(|_| InvalidSubstateIdFormat(addr.to_string()))?; Ok(SubstateId::FeeClaim(addr.into())) }, + Some(("template", addr)) => { + let addr = Hash::from_hex(addr).map_err(|_| InvalidSubstateIdFormat(addr.to_string()))?; + Ok(SubstateId::Template(addr.into())) + }, Some(_) | None => Err(InvalidSubstateIdFormat(s.to_string())), } } @@ -417,6 +439,7 @@ impl_partial_eq!(UnclaimedConfidentialOutputAddress, UnclaimedConfidentialOutput impl_partial_eq!(NonFungibleAddress, NonFungible); impl_partial_eq!(TransactionReceiptAddress, TransactionReceipt); impl_partial_eq!(FeeClaimAddress, FeeClaim); +impl_partial_eq!(PublishedTemplateAddress, Template); #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] @@ -429,6 +452,7 @@ pub enum SubstateValue { UnclaimedConfidentialOutput(UnclaimedConfidentialOutput), TransactionReceipt(TransactionReceipt), FeeClaim(FeeClaim), + Template(PublishedTemplate), } impl SubstateValue { @@ -453,6 +477,13 @@ impl SubstateValue { } } + pub fn published_template(&self) -> Option<&PublishedTemplate> { + match self { + SubstateValue::Template(template) => Some(template), + _ => None, + } + } + pub fn into_vault(self) -> Option { match self { SubstateValue::Vault(vault) => Some(vault), @@ -643,6 +674,12 @@ impl From for SubstateValue { } } +impl From for SubstateValue { + fn from(template: PublishedTemplate) -> Self { + Self::Template(template) + } +} + impl Display for SubstateValue { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { // TODO: improve output @@ -655,6 +692,7 @@ impl Display for SubstateValue { SubstateValue::UnclaimedConfidentialOutput(commitment) => write!(f, "{:?}", commitment), SubstateValue::TransactionReceipt(tx_receipt) => write!(f, "{:?}", tx_receipt), SubstateValue::FeeClaim(fee_claim) => write!(f, "{:?}", fee_claim), + SubstateValue::Template(template) => write!(f, "{:?}", template), } } } @@ -749,13 +787,17 @@ mod tests { SubstateId::from_str( "nft_a7cf4fd18ada7f367b1c102a9c158abc3754491665033231c5eb907fffffffff_uuid_7f19c3fe5fa13ff66a0d379fe5f9e3508acbd338db6bedd7350d8d565b2c5d32", ) - .unwrap() - .as_non_fungible_address() - .unwrap(); + .unwrap() + .as_non_fungible_address() + .unwrap(); SubstateId::from_str("nftindex_7cbfe29101c24924b1b6ccefbfff98986d648622272ae24f7585dab5ffffffff_0") .unwrap() .as_non_fungible_index_address() .unwrap(); + SubstateId::from_str("template_7cbfe29101c24924b1b6ccefbfff98986d648622272ae24f7585dab5ffffffff") + .unwrap() + .as_template() + .unwrap(); } #[test] @@ -775,6 +817,7 @@ mod tests { check("feeclaim_7cbfe29101c24924b1b6ccefbfff98986d648622272ae24f7585dab5ffffffff"); check("txreceipt_7cbfe29101c24924b1b6ccefbfff98986d648622272ae24f7585dab5ffffffff"); check("commitment_7cbfe29101c24924b1b6ccefbfff98986d648622272ae24f7585dab5ffffffff"); + check("template_7cbfe29101c24924b1b6ccefbfff98986d648622272ae24f7585dab5ffffffff"); } } } diff --git a/dan_layer/storage/src/global/template_db.rs b/dan_layer/storage/src/global/template_db.rs index 6a7fddcb2..0295fe751 100644 --- a/dan_layer/storage/src/global/template_db.rs +++ b/dan_layer/storage/src/global/template_db.rs @@ -24,6 +24,7 @@ use std::str::FromStr; use chrono::NaiveDateTime; use tari_common_types::types::FixedHash; +use tari_engine_types::TemplateAddress; use crate::global::GlobalDbAdapter; @@ -64,16 +65,15 @@ impl<'a, 'tx, TGlobalDbAdapter: GlobalDbAdapter> TemplateDb<'a, 'tx, TGlobalDbAd #[derive(Debug, Clone)] pub struct DbTemplate { + pub author_public_key: FixedHash, + pub template_address: TemplateAddress, pub template_name: String, - // TODO: change to TemplateAddress type - pub template_address: FixedHash, pub expected_hash: FixedHash, - pub url: String, - pub height: u64, pub template_type: DbTemplateType, pub compiled_code: Option>, pub flow_json: Option, pub manifest: Option, + pub url: Option, pub status: TemplateStatus, pub added_at: NaiveDateTime, } diff --git a/dan_layer/storage_sqlite/Cargo.toml b/dan_layer/storage_sqlite/Cargo.toml index 28adb3406..87dcb4b20 100644 --- a/dan_layer/storage_sqlite/Cargo.toml +++ b/dan_layer/storage_sqlite/Cargo.toml @@ -11,6 +11,8 @@ tari_common_types = { workspace = true } tari_dan_common_types = { workspace = true } tari_utilities = { workspace = true } tari_dan_storage = { workspace = true } +tari_engine_types = { workspace = true } +tari_template_lib = { workspace = true } diesel = { workspace = true, default-features = false, features = ["sqlite", "chrono"] } diesel_migrations = { workspace = true } diff --git a/dan_layer/storage_sqlite/migrations/2024-12-06-134951_templates_on_chain_updates/down.sql b/dan_layer/storage_sqlite/migrations/2024-12-06-134951_templates_on_chain_updates/down.sql new file mode 100644 index 000000000..e2cd4e22d --- /dev/null +++ b/dan_layer/storage_sqlite/migrations/2024-12-06-134951_templates_on_chain_updates/down.sql @@ -0,0 +1,8 @@ +ALTER TABLE templates DROP COLUMN author_public_key; +ALTER TABLE templates DROP COLUMN url; + +ALTER TABLE templates ADD COLUMN wasm_path VARCHAR(255) NULL; +ALTER TABLE templates ADD COLUMN url TEXT NOT NULL; +ALTER TABLE templates ADD COLUMN height bigint NOT NULL; + + diff --git a/dan_layer/storage_sqlite/migrations/2024-12-06-134951_templates_on_chain_updates/up.sql b/dan_layer/storage_sqlite/migrations/2024-12-06-134951_templates_on_chain_updates/up.sql new file mode 100644 index 000000000..5b5067905 --- /dev/null +++ b/dan_layer/storage_sqlite/migrations/2024-12-06-134951_templates_on_chain_updates/up.sql @@ -0,0 +1,6 @@ +ALTER TABLE templates DROP COLUMN wasm_path; +ALTER TABLE templates DROP COLUMN url; +ALTER TABLE templates DROP COLUMN height; + +ALTER TABLE templates ADD COLUMN author_public_key BLOB NOT NULL; +ALTER TABLE templates ADD COLUMN url TEXT NULL; diff --git a/dan_layer/storage_sqlite/src/error.rs b/dan_layer/storage_sqlite/src/error.rs index b547a85f8..1a6f2bc52 100644 --- a/dan_layer/storage_sqlite/src/error.rs +++ b/dan_layer/storage_sqlite/src/error.rs @@ -26,6 +26,7 @@ use diesel; use tari_common_types::types::FixedHashSizeError; use tari_dan_common_types::optional::IsNotFoundError; use tari_dan_storage::StorageError; +use tari_template_lib::HashParseError; use thiserror::Error; #[derive(Debug, Error)] @@ -69,6 +70,8 @@ pub enum SqliteStorageError { item: &'static str, details: String, }, + #[error("Hash parsing error: {0}")] + HashParse(#[from] HashParseError), } impl From for StorageError { diff --git a/dan_layer/storage_sqlite/src/global/backend_adapter.rs b/dan_layer/storage_sqlite/src/global/backend_adapter.rs index b6a8caa05..e301954ac 100644 --- a/dan_layer/storage_sqlite/src/global/backend_adapter.rs +++ b/dan_layer/storage_sqlite/src/global/backend_adapter.rs @@ -65,6 +65,7 @@ use tari_dan_storage::{ }, AtomicDb, }; +use tari_engine_types::TemplateAddress; use tari_utilities::ByteArray; use super::{models, models::DbValidatorNode}; @@ -215,16 +216,15 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { match template { Some(t) => Ok(Some(DbTemplate { + author_public_key: FixedHash::try_from(t.author_public_key.as_slice())?, template_name: t.template_name, - expected_hash: t.expected_hash.try_into()?, template_address: t.template_address.try_into()?, - url: t.url, - height: t.height as u64, template_type: t.template_type.parse().expect("DB template type corrupted"), compiled_code: t.compiled_code, flow_json: t.flow_json, manifest: t.manifest, + url: t.url, status: t.status.parse().expect("DB status corrupted"), added_at: t.added_at, })), @@ -253,15 +253,15 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { .into_iter() .map(|t| { Ok(DbTemplate { + author_public_key: FixedHash::try_from(t.author_public_key.as_slice())?, template_name: t.template_name, expected_hash: t.expected_hash.try_into()?, - template_address: t.template_address.try_into()?, - url: t.url, - height: t.height as u64, + template_address: TemplateAddress::try_from_vec(t.template_address)?, template_type: t.template_type.parse().expect("DB template type corrupted"), compiled_code: t.compiled_code, flow_json: t.flow_json, manifest: t.manifest, + url: t.url, status: t.status.parse().expect("DB status corrupted"), added_at: t.added_at, }) @@ -288,15 +288,15 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { .into_iter() .map(|t| { Ok(DbTemplate { + author_public_key: t.author_public_key.try_into()?, template_name: t.template_name, expected_hash: t.expected_hash.try_into()?, - template_address: t.template_address.try_into()?, - url: t.url, - height: t.height as u64, + template_address: TemplateAddress::try_from_vec(t.template_address)?, template_type: t.template_type.parse().expect("DB template type corrupted"), compiled_code: t.compiled_code, flow_json: t.flow_json, manifest: t.manifest, + url: t.url, status: t.status.parse().expect("DB status corrupted"), added_at: t.added_at, }) @@ -306,17 +306,15 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { fn insert_template(&self, tx: &mut Self::DbTransaction<'_>, item: DbTemplate) -> Result<(), Self::Error> { let new_template = NewTemplateModel { + author_public_key: item.author_public_key.to_vec(), template_name: item.template_name, expected_hash: item.expected_hash.to_vec(), template_address: item.template_address.to_vec(), - url: item.url.to_string(), - height: item.height as i64, template_type: item.template_type.as_str().to_string(), compiled_code: item.compiled_code, flow_json: item.flow_json, status: item.status.as_str().to_string(), - wasm_path: None, - manifest: None, + manifest: item.manifest, }; diesel::insert_into(templates::table) .values(new_template) diff --git a/dan_layer/storage_sqlite/src/global/models/template.rs b/dan_layer/storage_sqlite/src/global/models/template.rs index 79c5f012a..d60b174dc 100644 --- a/dan_layer/storage_sqlite/src/global/models/template.rs +++ b/dan_layer/storage_sqlite/src/global/models/template.rs @@ -28,33 +28,30 @@ use crate::global::schema::*; #[diesel(table_name = templates)] pub struct TemplateModel { pub id: i32, + pub author_public_key: Vec, + pub template_address: Vec, pub template_name: String, pub expected_hash: Vec, - pub template_address: Vec, - pub url: String, - pub height: i64, pub template_type: String, pub compiled_code: Option>, pub flow_json: Option, - pub status: String, - pub wasm_path: Option, pub manifest: Option, + pub url: Option, + pub status: String, pub added_at: NaiveDateTime, } #[derive(Debug, Insertable)] #[diesel(table_name = templates)] pub struct NewTemplateModel { + pub author_public_key: Vec, + pub template_address: Vec, pub template_name: String, pub expected_hash: Vec, - pub template_address: Vec, - pub url: String, - pub height: i64, pub template_type: String, pub compiled_code: Option>, pub flow_json: Option, pub status: String, - pub wasm_path: Option, pub manifest: Option, } diff --git a/dan_layer/storage_sqlite/src/global/schema.rs b/dan_layer/storage_sqlite/src/global/schema.rs index ac98da8e3..182f34916 100644 --- a/dan_layer/storage_sqlite/src/global/schema.rs +++ b/dan_layer/storage_sqlite/src/global/schema.rs @@ -52,17 +52,16 @@ diesel::table! { diesel::table! { templates (id) { id -> Integer, + author_public_key -> Binary, + template_address -> Binary, template_name -> Text, expected_hash -> Binary, - template_address -> Binary, - url -> Text, - height -> BigInt, template_type -> Text, compiled_code -> Nullable, flow_json -> Nullable, - status -> Text, - wasm_path -> Nullable, manifest -> Nullable, + url -> Nullable, + status -> Text, added_at -> Timestamp, } } diff --git a/dan_layer/template_lib/src/models/binary_tag.rs b/dan_layer/template_lib/src/models/binary_tag.rs index ae1f61b8b..733225c73 100644 --- a/dan_layer/template_lib/src/models/binary_tag.rs +++ b/dan_layer/template_lib/src/models/binary_tag.rs @@ -34,6 +34,7 @@ pub enum BinaryTag { FeeClaim = 135, ProofId = 136, UnclaimedConfidentialOutputAddress = 137, + TemplateAddress = 138, } impl BinaryTag { @@ -48,6 +49,8 @@ impl BinaryTag { 134 => Some(Self::TransactionReceipt), 135 => Some(Self::FeeClaim), 136 => Some(Self::ProofId), + 137 => Some(Self::UnclaimedConfidentialOutputAddress), + 138 => Some(Self::TemplateAddress), _ => None, } } @@ -73,6 +76,8 @@ mod tests { BinaryTag::TransactionReceipt, BinaryTag::FeeClaim, BinaryTag::ProofId, + BinaryTag::UnclaimedConfidentialOutputAddress, + BinaryTag::TemplateAddress, ]; for case in cases { diff --git a/dan_layer/template_test_tooling/Cargo.toml b/dan_layer/template_test_tooling/Cargo.toml index 6685a47a6..df3b96788 100644 --- a/dan_layer/template_test_tooling/Cargo.toml +++ b/dan_layer/template_test_tooling/Cargo.toml @@ -22,5 +22,6 @@ tari_bor = { workspace = true, default-features = true } tari_dan_wallet_crypto = { workspace = true } anyhow = { workspace = true } +thiserror = { workspace = true } serde = { workspace = true, features = ["default", "derive"] } rand = { workspace = true } diff --git a/dan_layer/template_test_tooling/src/package_builder.rs b/dan_layer/template_test_tooling/src/package_builder.rs index 8cec7a816..4c171df12 100644 --- a/dan_layer/template_test_tooling/src/package_builder.rs +++ b/dan_layer/template_test_tooling/src/package_builder.rs @@ -1,21 +1,27 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -use std::{collections::HashMap, convert::Infallible, path::Path}; +use std::{ + collections::HashMap, + path::Path, + sync::{Arc, Mutex}, +}; +use tari_common_types::types::PublicKey; use tari_dan_common_types::services::template_provider::TemplateProvider; use tari_dan_engine::{ abi::TemplateDef, - template::{LoadedTemplate, TemplateModuleLoader}, + template::{LoadedTemplate, TemplateLoaderError, TemplateModuleLoader}, wasm::{compile::compile_template, WasmModule}, }; use tari_engine_types::hashing::template_hasher32; use tari_template_builtin::get_template_builtin; use tari_template_lib::models::TemplateAddress; +use thiserror::Error; #[derive(Debug, Clone)] pub struct Package { - templates: HashMap, + templates: Arc>>, } impl Package { @@ -23,23 +29,25 @@ impl Package { PackageBuilder::new() } - pub fn get_template_by_address(&self, addr: &TemplateAddress) -> Option<&LoadedTemplate> { - self.templates.get(addr) + pub fn get_template_by_address(&self, addr: &TemplateAddress) -> Option { + self.templates.lock().unwrap().get(addr).cloned() } pub fn get_template_defs(&self) -> HashMap { self.templates + .lock() + .unwrap() .iter() .map(|(addr, template)| (*addr, template.template_def().clone())) .collect() } pub fn total_code_byte_size(&self) -> usize { - self.templates.values().map(|t| t.code_size()).sum() + self.templates.lock().unwrap().values().map(|t| t.code_size()).sum() } - pub fn iter(&self) -> impl Iterator { - self.templates.iter() + pub fn templates(&self) -> HashMap { + self.templates.lock().unwrap().clone() } } @@ -82,19 +90,37 @@ impl PackageBuilder { pub fn build(&mut self) -> Package { Package { - templates: self.templates.drain().collect(), + templates: Arc::new(Mutex::new(self.templates.drain().collect())), } } } +#[derive(Error, Debug)] +pub enum PackageError { + #[error("Template load error: {0}")] + TemplateLoad(#[from] TemplateLoaderError), +} impl TemplateProvider for Package { - type Error = Infallible; + type Error = PackageError; type Template = LoadedTemplate; fn get_template_module( &self, id: &tari_engine_types::TemplateAddress, ) -> Result, Self::Error> { - Ok(self.templates.get(id).cloned()) + Ok(self.templates.lock().unwrap().get(id).cloned()) + } + + fn add_wasm_template( + &self, + _author_public_key: PublicKey, + template_address: tari_engine_types::TemplateAddress, + template: &[u8], + ) -> Result<(), Self::Error> { + self.templates + .lock() + .unwrap() + .insert(template_address, WasmModule::load_template_from_code(template)?); + Ok(()) } } diff --git a/dan_layer/template_test_tooling/src/template_test.rs b/dan_layer/template_test_tooling/src/template_test.rs index c4bc4fe37..2b6791bcb 100644 --- a/dan_layer/template_test_tooling/src/template_test.rs +++ b/dan_layer/template_test_tooling/src/template_test.rs @@ -89,7 +89,7 @@ impl TemplateTest { let package = builder.build(); let mut test = Self::from_package(package); - test.bootstrap_state(100_000.into()); + test.bootstrap_state(1_000_000.into()); test } @@ -101,7 +101,7 @@ impl TemplateTest { let mut name_to_template = HashMap::new(); - for (addr, template) in package.iter() { + for (addr, template) in &package.templates() { if name_to_template .insert(template.template_name().to_string(), *addr) .is_some() @@ -255,7 +255,7 @@ impl TemplateTest { } } - pub fn get_module(&self, module_name: &str) -> &LoadedWasmTemplate { + pub fn get_module(&self, module_name: &str) -> LoadedWasmTemplate { let addr = self.name_to_template.get(module_name).unwrap(); match self.package.get_template_by_address(addr).unwrap() { LoadedTemplate::Wasm(wasm) => wasm, @@ -409,15 +409,23 @@ impl TemplateTest { (component, owner_proof, secret_key) } - pub fn create_custom_funded_account(&mut self) -> (ComponentAddress, NonFungibleAddress, RistrettoSecretKey) { + pub fn create_custom_funded_account( + &mut self, + amount: Amount, + ) -> ( + ComponentAddress, + NonFungibleAddress, + RistrettoSecretKey, + RistrettoPublicKey, + ) { let (owner_proof, public_key, secret_key) = self.create_owner_proof(); let old_fail_fees = self.enable_fees; self.enable_fees = false; let result = self.execute_expect_success( Transaction::builder() - .call_method(test_faucet_component(), "take_free_coins", args![]) + .call_method(test_faucet_component(), "take_free_coins_custom", args![amount]) .put_last_instruction_output_on_workspace("bucket") - .create_account_with_bucket(public_key, "bucket") + .create_account_with_bucket(public_key.clone(), "bucket") .sign(&secret_key) .build(), vec![owner_proof.clone()], @@ -428,7 +436,7 @@ impl TemplateTest { .unwrap(); self.enable_fees = old_fail_fees; - (component, owner_proof, secret_key) + (component, owner_proof, secret_key, public_key) } fn next_key_seed(&mut self) -> u8 { diff --git a/dan_layer/template_test_tooling/templates/faucet/Cargo.lock b/dan_layer/template_test_tooling/templates/faucet/Cargo.lock index 0c0ba9d29..40ecd9982 100644 --- a/dan_layer/template_test_tooling/templates/faucet/Cargo.lock +++ b/dan_layer/template_test_tooling/templates/faucet/Cargo.lock @@ -25,9 +25,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.13.1" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bumpalo" @@ -138,6 +138,12 @@ dependencies = [ "serde", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "faucet2" version = "0.1.0" @@ -163,6 +169,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + [[package]] name = "hex" version = "0.4.3" @@ -205,7 +217,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +dependencies = [ + "equivalent", + "hashbrown 0.15.2", "serde", ] @@ -242,6 +265,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d36047f46c69ef97b60e7b069a26ce9a15cd8a7852eddb6991ea94a83ba36a78" +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-traits" version = "0.2.17" @@ -320,15 +349,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "2.3.3" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" dependencies = [ "base64", "chrono", "hex", - "indexmap", + "indexmap 1.9.3", + "indexmap 2.7.0", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -336,9 +367,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "2.3.3" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" dependencies = [ "darling", "proc-macro2", @@ -416,12 +447,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -436,10 +468,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ + "num-conv", "time-core", ] diff --git a/dan_layer/template_test_tooling/templates/faucet/src/lib.rs b/dan_layer/template_test_tooling/templates/faucet/src/lib.rs index 5d3a1a1f8..645c1a7ab 100644 --- a/dan_layer/template_test_tooling/templates/faucet/src/lib.rs +++ b/dan_layer/template_test_tooling/templates/faucet/src/lib.rs @@ -43,8 +43,8 @@ mod faucet_template { Component::new(Self { vault: Vault::from_bucket(coins), }) - .with_access_rules(AccessRules::allow_all()) - .create() + .with_access_rules(AccessRules::allow_all()) + .create() } pub fn take_free_coins(&mut self) -> Bucket { @@ -52,6 +52,11 @@ mod faucet_template { self.vault.withdraw(Amount(1000)) } + pub fn take_free_coins_custom(&mut self, amount: Amount) -> Bucket { + debug!("Withdrawing {} coins from faucet", amount); + self.vault.withdraw(amount) + } + pub fn take_free_coins_confidential(&mut self, proof: ConfidentialWithdrawProof) -> Bucket { debug!("Withdrawing coins from faucet"); self.vault.withdraw_confidential(proof) diff --git a/dan_layer/transaction/src/builder.rs b/dan_layer/transaction/src/builder.rs index b28cd12a8..3669370f6 100644 --- a/dan_layer/transaction/src/builder.rs +++ b/dan_layer/transaction/src/builder.rs @@ -135,10 +135,8 @@ impl TransactionBuilder { } /// Publishing a WASM template. - pub fn publish_template>(self, binary: T) -> Self { - self.add_instruction(Instruction::PublishTemplate { - binary: binary.as_ref().to_vec(), - }) + pub fn publish_template(self, binary: Vec) -> Self { + self.add_instruction(Instruction::PublishTemplate { binary }) } pub fn claim_burn(self, claim: ConfidentialClaim) -> Self { diff --git a/dan_layer/transaction_manifest/src/generator.rs b/dan_layer/transaction_manifest/src/generator.rs index 1e35ce95d..8a5a0c102 100644 --- a/dan_layer/transaction_manifest/src/generator.rs +++ b/dan_layer/transaction_manifest/src/generator.rs @@ -166,6 +166,7 @@ impl ManifestInstructionGenerator { SubstateId::UnclaimedConfidentialOutput(addr) => Ok(arg!(*addr)), SubstateId::NonFungibleIndex(addr) => Ok(arg!(addr)), SubstateId::FeeClaim(addr) => Ok(arg!(*addr)), + SubstateId::Template(addr) => Ok(arg!(*addr)), }, ManifestValue::Literal(lit) => lit_to_arg(lit), ManifestValue::NonFungibleId(id) => Ok(arg!(id.clone())), diff --git a/dan_layer/wallet/sdk/src/apis/substate.rs b/dan_layer/wallet/sdk/src/apis/substate.rs index 6658342b9..28c2244da 100644 --- a/dan_layer/wallet/sdk/src/apis/substate.rs +++ b/dan_layer/wallet/sdk/src/apis/substate.rs @@ -145,6 +145,7 @@ where }, SubstateValue::UnclaimedConfidentialOutput(_) => {}, SubstateValue::FeeClaim(_) => {}, + SubstateValue::Template(_) => {}, } }, } diff --git a/integration_tests/src/validator_node_cli.rs b/integration_tests/src/validator_node_cli.rs index 5fe7d44d4..a7c946f1f 100644 --- a/integration_tests/src/validator_node_cli.rs +++ b/integration_tests/src/validator_node_cli.rs @@ -135,7 +135,7 @@ pub async fn create_component( pub(crate) fn add_substate_ids(world: &mut TariWorld, outputs_name: String, diff: &SubstateDiff) { let outputs = world.outputs.entry(outputs_name).or_default(); - let mut counters = [0usize, 0, 0, 0, 0, 0, 0, 0, 0]; + let mut counters = [0usize, 0, 0, 0, 0, 0, 0, 0, 0, 0]; for (addr, data) in diff.up_iter() { match addr { SubstateId::Component(_) => { @@ -195,6 +195,13 @@ pub(crate) fn add_substate_ids(world: &mut TariWorld, outputs_name: String, diff }); counters[7] += 1; }, + SubstateId::Template(_) => { + outputs.insert(format!("published_template/{}", counters[8]), SubstateRequirement { + substate_id: addr.clone(), + version: Some(data.version()), + }); + counters[8] += 1; + }, } } }