diff --git a/applications/tari_dan_wallet_daemon/src/handlers/accounts.rs b/applications/tari_dan_wallet_daemon/src/handlers/accounts.rs index b1e886dc84..0cd6a156a2 100644 --- a/applications/tari_dan_wallet_daemon/src/handlers/accounts.rs +++ b/applications/tari_dan_wallet_daemon/src/handlers/accounts.rs @@ -676,7 +676,9 @@ async fn finish_claiming( }); } else { instructions.push(Instruction::CreateAccount { - owner_public_key: account_public_key.clone(), + public_key_address: account_public_key.clone(), + owner_rule: None, + access_rules: None, workspace_bucket: Some("bucket".to_string()), }); } @@ -884,7 +886,9 @@ pub async fn handle_transfer( inputs.push(address); } else { instructions.push(Instruction::CreateAccount { - owner_public_key: req.destination_public_key, + public_key_address: req.destination_public_key, + owner_rule: None, + access_rules: None, workspace_bucket: None, }); } diff --git a/applications/tari_indexer/src/event_scanner.rs b/applications/tari_indexer/src/event_scanner.rs index 20da8e6e9e..26556435ea 100644 --- a/applications/tari_indexer/src/event_scanner.rs +++ b/applications/tari_indexer/src/event_scanner.rs @@ -26,11 +26,11 @@ use futures::StreamExt; use log::*; use tari_bor::decode; use tari_common::configuration::Network; -use tari_crypto::tari_utilities::message_format::MessageFormat; +use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::message_format::MessageFormat}; use tari_dan_app_utilities::consensus_constants::ConsensusConstants; use tari_dan_common_types::{committee::Committee, Epoch, NumPreshards, PeerAddress, ShardGroup}; use tari_dan_p2p::proto::rpc::{GetTransactionResultRequest, PayloadResultStatus, SyncBlocksRequest}; -use tari_dan_storage::consensus_models::{Block, BlockId, Decision, TransactionRecord}; +use tari_dan_storage::consensus_models::{Block, BlockError, BlockId, Decision, TransactionRecord}; use tari_engine_types::{ commit_result::{ExecuteResult, TransactionResult}, events::Event, @@ -96,6 +96,7 @@ struct TransactionMetadata { pub struct EventScanner { network: Network, + sidechain_id: Option, epoch_manager: Box>, client_factory: TariValidatorNodeRpcClientFactory, substate_store: SqliteSubstateStore, @@ -105,6 +106,7 @@ pub struct EventScanner { impl EventScanner { pub fn new( network: Network, + sidechain_id: Option, epoch_manager: Box>, client_factory: TariValidatorNodeRpcClientFactory, substate_store: SqliteSubstateStore, @@ -112,6 +114,7 @@ impl EventScanner { ) -> Self { Self { network, + sidechain_id, epoch_manager, client_factory, substate_store, @@ -447,10 +450,10 @@ impl EventScanner { .collect() } - fn build_genesis_block_id(&self, num_preshards: NumPreshards) -> BlockId { + fn build_genesis_block_id(&self, num_preshards: NumPreshards) -> Result { // TODO: this should return the actual genesis for the shard group and epoch - let start_block = Block::zero_block(self.network, num_preshards); - *start_block.id() + let start_block = Block::zero_block(self.network, num_preshards, self.sidechain_id.clone())?; + Ok(*start_block.id()) } async fn get_oldest_scanned_epoch(&self) -> Result, anyhow::Error> { @@ -470,10 +473,14 @@ impl EventScanner { let start_block_id = self .substate_store .with_read_tx(|tx| tx.get_last_scanned_block_id(epoch, shard_group))?; - let start_block_id = start_block_id.unwrap_or_else(|| { - let consensus_constants = ConsensusConstants::from(self.network); - self.build_genesis_block_id(consensus_constants.num_preshards) - }); + + let start_block_id = match start_block_id { + Some(block_id) => block_id, + None => { + let consensus_constants = ConsensusConstants::from(self.network); + self.build_genesis_block_id(consensus_constants.num_preshards)? + }, + }; committee.shuffle(); let mut last_block_id = start_block_id; diff --git a/applications/tari_indexer/src/lib.rs b/applications/tari_indexer/src/lib.rs index d45c1a0206..6b3aab8180 100644 --- a/applications/tari_indexer/src/lib.rs +++ b/applications/tari_indexer/src/lib.rs @@ -181,6 +181,7 @@ pub async fn run_indexer(config: ApplicationConfig, mut shutdown_signal: Shutdow .map_err(|e| ExitError::new(ExitCode::ConfigError, format!("Invalid event filters: {}", e)))?; let event_scanner = Arc::new(EventScanner::new( config.network, + config.indexer.sidechain_id, Box::new(services.epoch_manager.clone()), services.validator_node_client_factory.clone(), services.substate_store.clone(), diff --git a/applications/tari_validator_node/src/bootstrap.rs b/applications/tari_validator_node/src/bootstrap.rs index 5e0ad8ffcc..63d95cbfa5 100644 --- a/applications/tari_validator_node/src/bootstrap.rs +++ b/applications/tari_validator_node/src/bootstrap.rs @@ -38,7 +38,7 @@ use tari_common::{ #[cfg(not(feature = "metrics"))] use tari_consensus::traits::hooks::NoopHooks; use tari_core::transactions::transaction_components::ValidatorNodeSignature; -use tari_crypto::tari_utilities::ByteArray; +use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; use tari_dan_app_utilities::{ base_layer_scanner, consensus_constants::ConsensusConstants, @@ -191,7 +191,15 @@ pub async fn spawn_services( // Connect to shard db let state_store = SqliteStateStore::connect(&format!("sqlite://{}", config.validator_node.state_db_path().display()))?; - state_store.with_write_tx(|tx| bootstrap_state(tx, config.network, consensus_constants.num_preshards))?; + let sidechain_id = config.validator_node.validator_node_sidechain_id.clone(); + state_store.with_write_tx(|tx| { + bootstrap_state( + tx, + config.network, + consensus_constants.num_preshards, + sidechain_id.clone(), + ) + })?; info!(target: LOG_TARGET, "Epoch manager initializing"); let epoch_manager_config = EpochManagerConfig { @@ -265,6 +273,7 @@ pub async fn spawn_services( let signing_service = consensus::TariSignatureService::new(keypair.clone()); let (consensus_join_handle, consensus_handle) = consensus::spawn( config.network, + sidechain_id, state_store.clone(), local_address, signing_service, @@ -450,7 +459,12 @@ async fn spawn_p2p_rpc( Ok(()) } -fn bootstrap_state(tx: &mut TTx, network: Network, num_preshards: NumPreshards) -> Result<(), StorageError> +fn bootstrap_state( + tx: &mut TTx, + network: Network, + num_preshards: NumPreshards, + sidechain_id: Option, +) -> Result<(), StorageError> where TTx: StateStoreWriteTransaction + Deref, TTx::Target: StateStoreReadTransaction, @@ -473,7 +487,14 @@ where None, None, ); - create_substate(tx, network, num_preshards, PUBLIC_IDENTITY_RESOURCE_ADDRESS, value)?; + create_substate( + tx, + network, + num_preshards, + &sidechain_id, + PUBLIC_IDENTITY_RESOURCE_ADDRESS, + value, + )?; let mut xtr_resource = Resource::new( ResourceType::Confidential, @@ -498,7 +519,14 @@ where state: cbor!({"vault" => XTR_FAUCET_VAULT_ADDRESS}).unwrap(), }, }; - create_substate(tx, network, num_preshards, XTR_FAUCET_COMPONENT_ADDRESS, value)?; + create_substate( + tx, + network, + num_preshards, + &sidechain_id, + XTR_FAUCET_COMPONENT_ADDRESS, + value, + )?; xtr_resource.increase_total_supply(Amount::MAX); let value = Vault::new(ResourceContainer::Confidential { @@ -509,13 +537,21 @@ where locked_revealed_amount: Default::default(), }); - create_substate(tx, network, num_preshards, XTR_FAUCET_VAULT_ADDRESS, value)?; + create_substate( + tx, + network, + num_preshards, + &sidechain_id, + XTR_FAUCET_VAULT_ADDRESS, + value, + )?; } create_substate( tx, network, num_preshards, + &sidechain_id, CONFIDENTIAL_TARI_RESOURCE_ADDRESS, xtr_resource, )?; @@ -527,6 +563,7 @@ fn create_substate( tx: &mut TTx, network: Network, num_preshards: NumPreshards, + sidechain_id: &Option, substate_id: TId, value: TVal, ) -> Result<(), StorageError> @@ -537,7 +574,12 @@ where TId: Into, TVal: Into, { - let genesis_block = Block::genesis(network, Epoch(0), ShardGroup::all_shards(num_preshards)); + let genesis_block = Block::genesis( + network, + Epoch(0), + ShardGroup::all_shards(num_preshards), + sidechain_id.clone(), + )?; let substate_id = substate_id.into(); let id = VersionedSubstateId::new(substate_id, 0); SubstateRecord { diff --git a/applications/tari_validator_node/src/consensus/mod.rs b/applications/tari_validator_node/src/consensus/mod.rs index 0576672af6..84733ff78e 100644 --- a/applications/tari_validator_node/src/consensus/mod.rs +++ b/applications/tari_validator_node/src/consensus/mod.rs @@ -7,6 +7,7 @@ use tari_consensus::{ hotstuff::{ConsensusWorker, ConsensusWorkerContext, HotstuffConfig, HotstuffWorker}, traits::ConsensusSpec, }; +use tari_crypto::ristretto::RistrettoPublicKey; use tari_dan_app_utilities::{ consensus_constants::ConsensusConstants, template_manager::implementation::TemplateManager, @@ -60,6 +61,7 @@ pub type ConsensusTransactionValidator = BoxedValidator, store: SqliteStateStore, local_addr: PeerAddress, signing_service: TariSignatureService, @@ -83,6 +85,7 @@ pub async fn spawn( let hs_config = HotstuffConfig { network, + sidechain_id, max_base_layer_blocks_behind: consensus_constants.max_base_layer_blocks_behind, max_base_layer_blocks_ahead: consensus_constants.max_base_layer_blocks_ahead, num_preshards: consensus_constants.num_preshards, diff --git a/applications/tari_validator_node_cli/src/command/account.rs b/applications/tari_validator_node_cli/src/command/account.rs index f5ad33ad56..b8555dac28 100644 --- a/applications/tari_validator_node_cli/src/command/account.rs +++ b/applications/tari_validator_node_cli/src/command/account.rs @@ -69,7 +69,9 @@ pub async fn handle_create( .ok_or_else(|| anyhow::anyhow!("No active key"))?; let instruction = Instruction::CreateAccount { - owner_public_key: key.public_key, + public_key_address: key.public_key, + owner_rule: None, + access_rules: None, workspace_bucket: None, }; diff --git a/bindings/dist/index.d.ts b/bindings/dist/index.d.ts index 2bdfef775b..6e3b58bc25 100644 --- a/bindings/dist/index.d.ts +++ b/bindings/dist/index.d.ts @@ -1,24 +1,24 @@ 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/Block"; 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"; @@ -28,11 +28,12 @@ export * from "./types/EntityId"; export * from "./types/Epoch"; export * from "./types/Event"; 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"; @@ -41,10 +42,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"; @@ -53,14 +54,14 @@ 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"; @@ -70,47 +71,47 @@ 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/RuleRequirement"; +export * from "./types/Shard"; export * from "./types/ShardEvidence"; export * from "./types/ShardGroup"; -export * from "./types/Shard"; +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/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 5ae5372842..1defd5c793 100644 --- a/bindings/dist/index.js +++ b/bindings/dist/index.js @@ -3,24 +3,24 @@ 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/Block"; 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"; @@ -30,11 +30,12 @@ export * from "./types/EntityId"; export * from "./types/Epoch"; export * from "./types/Event"; 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"; @@ -43,10 +44,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"; @@ -55,14 +56,14 @@ 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"; @@ -72,47 +73,47 @@ 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/RuleRequirement"; +export * from "./types/Shard"; export * from "./types/ShardEvidence"; export * from "./types/ShardGroup"; -export * from "./types/Shard"; +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/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 2bc290afbc..03fbfd5375 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 d6c53a6f9d..633c07b9ee 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/Block.d.ts b/bindings/dist/types/Block.d.ts index 4c04f70feb..5ac2b4aca6 100644 --- a/bindings/dist/types/Block.d.ts +++ b/bindings/dist/types/Block.d.ts @@ -1,5 +1,6 @@ import type { Command } from "./Command"; import type { Epoch } from "./Epoch"; +import type { ExtraData } from "./ExtraData"; import type { NodeHeight } from "./NodeHeight"; import type { QuorumCertificate } from "./QuorumCertificate"; import type { Shard } from "./Shard"; @@ -29,4 +30,5 @@ export interface Block { timestamp: number; base_layer_block_height: number; base_layer_block_hash: string; + extra_data: ExtraData | null; } diff --git a/bindings/dist/types/ExtraData.d.ts b/bindings/dist/types/ExtraData.d.ts new file mode 100644 index 0000000000..85d9982c80 --- /dev/null +++ b/bindings/dist/types/ExtraData.d.ts @@ -0,0 +1 @@ +export type ExtraData = string; diff --git a/bindings/dist/types/ExtraData.js b/bindings/dist/types/ExtraData.js new file mode 100644 index 0000000000..e5b481d1ea --- /dev/null +++ b/bindings/dist/types/ExtraData.js @@ -0,0 +1,2 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +export {}; diff --git a/bindings/dist/validator-node-client.d.ts b/bindings/dist/validator-node-client.d.ts index 46ef6ce68a..cfd8756059 100644 --- a/bindings/dist/validator-node-client.d.ts +++ b/bindings/dist/validator-node-client.d.ts @@ -1,56 +1,56 @@ +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/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/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/DryRunTransactionFinalizeResult"; +export * from "./types/validator-node-client/GetTransactionResponse"; +export * from "./types/validator-node-client/GetStateResponse"; +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/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/ValidatorFee"; +export * from "./types/validator-node-client/VNGetConnectionsResponse"; +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/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/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/GetShardKeyResponse"; -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/GetStateResponse"; -export * from "./types/validator-node-client/SubstateStatus"; 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/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/VNGetIdentityResponse"; +export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; 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/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/VNGetValidatorFeesRequest"; diff --git a/bindings/dist/validator-node-client.js b/bindings/dist/validator-node-client.js index 89eb92b006..477e5dd455 100644 --- a/bindings/dist/validator-node-client.js +++ b/bindings/dist/validator-node-client.js @@ -1,58 +1,58 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause +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/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/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/DryRunTransactionFinalizeResult"; +export * from "./types/validator-node-client/GetTransactionResponse"; +export * from "./types/validator-node-client/GetStateResponse"; +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/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/ValidatorFee"; +export * from "./types/validator-node-client/VNGetConnectionsResponse"; +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/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/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/GetShardKeyResponse"; -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/GetStateResponse"; -export * from "./types/validator-node-client/SubstateStatus"; 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/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/VNGetIdentityResponse"; +export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; 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/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/VNGetValidatorFeesRequest"; diff --git a/bindings/dist/wallet-daemon-client.d.ts b/bindings/dist/wallet-daemon-client.d.ts index 6e37656aef..0a00af2bbc 100644 --- a/bindings/dist/wallet-daemon-client.d.ts +++ b/bindings/dist/wallet-daemon-client.d.ts @@ -1,87 +1,87 @@ -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/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/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/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/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/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 3c54e676a7..776d38ec12 100644 --- a/bindings/dist/wallet-daemon-client.js +++ b/bindings/dist/wallet-daemon-client.js @@ -1,89 +1,89 @@ // 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/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/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/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/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/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 20589d2740..453d48483e 100644 --- a/bindings/src/index.ts +++ b/bindings/src/index.ts @@ -4,24 +4,24 @@ 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/Block"; 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"; @@ -31,11 +31,12 @@ export * from "./types/EntityId"; export * from "./types/Epoch"; export * from "./types/Event"; 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"; @@ -44,10 +45,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"; @@ -56,14 +57,14 @@ 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"; @@ -73,47 +74,47 @@ 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/RuleRequirement"; +export * from "./types/Shard"; export * from "./types/ShardEvidence"; export * from "./types/ShardGroup"; -export * from "./types/Shard"; +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/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 9d60c94165..e9782093f5 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/Block.ts b/bindings/src/types/Block.ts index 9495e6faa7..ef612eb0a7 100644 --- a/bindings/src/types/Block.ts +++ b/bindings/src/types/Block.ts @@ -1,6 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Command } from "./Command"; import type { Epoch } from "./Epoch"; +import type { ExtraData } from "./ExtraData"; import type { NodeHeight } from "./NodeHeight"; import type { QuorumCertificate } from "./QuorumCertificate"; import type { Shard } from "./Shard"; @@ -28,4 +29,5 @@ export interface Block { timestamp: number; base_layer_block_height: number; base_layer_block_hash: string; + extra_data: ExtraData | null; } diff --git a/bindings/src/types/ExtraData.ts b/bindings/src/types/ExtraData.ts new file mode 100644 index 0000000000..7854af3abc --- /dev/null +++ b/bindings/src/types/ExtraData.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 ExtraData = string; diff --git a/bindings/src/types/Instruction.ts b/bindings/src/types/Instruction.ts index 1ef5766829..4a1a0fd752 100644 --- a/bindings/src/types/Instruction.ts +++ b/bindings/src/types/Instruction.ts @@ -1,13 +1,22 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Amount } from "./Amount"; import type { Arg } from "./Arg"; +import type { ComponentAccessRules } from "./ComponentAccessRules"; import type { ComponentAddress } from "./ComponentAddress"; import type { ConfidentialClaim } from "./ConfidentialClaim"; import type { LogLevel } from "./LogLevel"; +import type { OwnerRule } from "./OwnerRule"; import type { ResourceAddress } from "./ResourceAddress"; export type Instruction = - | { CreateAccount: { owner_public_key: string; workspace_bucket: string | null } } + | { + CreateAccount: { + public_key_address: string; + owner_rule: OwnerRule | null; + access_rules: ComponentAccessRules | null; + workspace_bucket: string | null; + }; + } | { CallFunction: { template_address: Uint8Array; function: string; args: Array } } | { CallMethod: { component_address: ComponentAddress; method: string; args: Array } } | { PutLastInstructionOutputOnWorkspace: { key: Array } } diff --git a/bindings/src/validator-node-client.ts b/bindings/src/validator-node-client.ts index 37a2d665c0..989140390d 100644 --- a/bindings/src/validator-node-client.ts +++ b/bindings/src/validator-node-client.ts @@ -1,59 +1,59 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause +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/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/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/DryRunTransactionFinalizeResult"; +export * from "./types/validator-node-client/GetTransactionResponse"; +export * from "./types/validator-node-client/GetStateResponse"; +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/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/ValidatorFee"; +export * from "./types/validator-node-client/VNGetConnectionsResponse"; +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/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/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/GetShardKeyResponse"; -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/GetStateResponse"; -export * from "./types/validator-node-client/SubstateStatus"; 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/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/VNGetIdentityResponse"; +export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; 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/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/VNGetValidatorFeesRequest"; diff --git a/bindings/src/wallet-daemon-client.ts b/bindings/src/wallet-daemon-client.ts index 140f651419..d23e8f6cd8 100644 --- a/bindings/src/wallet-daemon-client.ts +++ b/bindings/src/wallet-daemon-client.ts @@ -1,90 +1,90 @@ // 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/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/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/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/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/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/dan_layer/common_types/src/bytes.rs b/dan_layer/common_types/src/bytes.rs new file mode 100644 index 0000000000..e6e5b374ba --- /dev/null +++ b/dan_layer/common_types/src/bytes.rs @@ -0,0 +1,94 @@ +// Copyright 2024, The Tari Project +// +// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +// following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following +// disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the +// following disclaimer in the documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote +// products derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// 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::{cmp, convert::TryFrom, ops::Deref}; + +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Default, Deserialize, Serialize)] +pub struct MaxSizeBytes { + inner: Vec, +} + +impl MaxSizeBytes { + pub fn into_vec(self) -> Vec { + self.inner + } + + pub fn from_bytes_checked>(bytes: T) -> Option { + let b = bytes.as_ref(); + if b.len() > MAX { + None + } else { + Some(Self { inner: b.to_vec() }) + } + } + + pub fn from_bytes_truncate>(bytes: T) -> Self { + let b = bytes.as_ref(); + let len = cmp::min(b.len(), MAX); + Self { + inner: b[..len].to_vec(), + } + } +} + +impl From> for Vec { + fn from(value: MaxSizeBytes) -> Self { + value.inner + } +} + +impl TryFrom> for MaxSizeBytes { + type Error = MaxSizeBytesError; + + fn try_from(value: Vec) -> Result { + if value.len() > MAX { + Err(MaxSizeBytesError::MaxSizeBytesLengthError { + expected: MAX, + actual: value.len(), + }) + } else { + Ok(MaxSizeBytes { inner: value }) + } + } +} + +impl AsRef<[u8]> for MaxSizeBytes { + fn as_ref(&self) -> &[u8] { + &self.inner + } +} + +impl Deref for MaxSizeBytes { + type Target = [u8]; + + fn deref(&self) -> &Self::Target { + &self.inner + } +} + +#[derive(Debug, thiserror::Error)] +pub enum MaxSizeBytesError { + #[error("Invalid Bytes length: expected {expected}, got {actual}")] + MaxSizeBytesLengthError { expected: usize, actual: usize }, +} diff --git a/dan_layer/common_types/src/extra_data.rs b/dan_layer/common_types/src/extra_data.rs new file mode 100644 index 0000000000..9afe71bec2 --- /dev/null +++ b/dan_layer/common_types/src/extra_data.rs @@ -0,0 +1,69 @@ +// Copyright 2024. The Tari Project +// +// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +// following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following +// disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the +// following disclaimer in the documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote +// products derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// 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::collections::BTreeMap; + +use serde::{Deserialize, Serialize}; +use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; +#[cfg(feature = "ts")] +use ts_rs::TS; + +use crate::{MaxSizeBytes, MaxSizeBytesError}; + +const MAX_DATA_SIZE: usize = 256; +type ExtraFieldValue = MaxSizeBytes; + +#[repr(u8)] +#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Serialize, Deserialize)] +pub enum ExtraFieldKey { + SidechainId = 0x00, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct ExtraData(#[cfg_attr(feature = "ts", ts(type = "string"))] BTreeMap); + +impl ExtraData { + pub const fn new() -> Self { + Self(BTreeMap::new()) + } + + pub fn insert>(&mut self, key: ExtraFieldKey, value: V) -> &mut Self { + let value = value.into(); + self.0.insert(key, value); + self + } + + pub fn insert_sidechain_id(&mut self, sidechain_id: RistrettoPublicKey) -> Result<&mut Self, MaxSizeBytesError> { + self.0 + .insert(ExtraFieldKey::SidechainId, sidechain_id.as_bytes().to_vec().try_into()?); + Ok(self) + } + + pub fn get(&self, key: &ExtraFieldKey) -> Option<&ExtraFieldValue> { + self.0.get(key) + } + + pub fn contains_key(&self, key: &ExtraFieldKey) -> bool { + self.0.contains_key(key) + } +} diff --git a/dan_layer/common_types/src/lib.rs b/dan_layer/common_types/src/lib.rs index 688249ba02..2437144a6c 100644 --- a/dan_layer/common_types/src/lib.rs +++ b/dan_layer/common_types/src/lib.rs @@ -1,12 +1,18 @@ // Copyright 2022 The Tari Project // SPDX-License-Identifier: BSD-3-Clause +mod bytes; +pub use bytes::{MaxSizeBytes, MaxSizeBytesError}; + pub mod crypto; mod epoch; pub use epoch::Epoch; +mod extra_data; +pub use extra_data::{ExtraData, ExtraFieldKey}; + pub mod committee; pub mod hasher; pub mod hashing; diff --git a/dan_layer/consensus/src/block_validations.rs b/dan_layer/consensus/src/block_validations.rs index 88ea5f1acc..506682bb91 100644 --- a/dan_layer/consensus/src/block_validations.rs +++ b/dan_layer/consensus/src/block_validations.rs @@ -2,7 +2,8 @@ // SPDX-License-Identifier: BSD-3-Clause use tari_common::configuration::Network; -use tari_dan_common_types::{committee::Committee, DerivableFromPublicKey}; +use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; +use tari_dan_common_types::{committee::Committee, DerivableFromPublicKey, ExtraFieldKey}; use tari_dan_storage::consensus_models::Block; use tari_epoch_manager::EpochManagerReader; @@ -23,6 +24,7 @@ pub async fn check_proposal( // tip. Without this, the check has a race condition between the base layer scanner and consensus. // check_base_layer_block_hash::(block, epoch_manager, config).await?; check_network(block, config.network)?; + check_sidechain_id(block, config)?; check_hash_and_height(block)?; let committee_for_block = epoch_manager .get_committee_by_validator_public_key(block.epoch(), block.proposed_by()) @@ -218,3 +220,46 @@ pub async fn check_quorum_certificate( } Ok(()) } + +pub fn check_sidechain_id(candidate_block: &Block, config: &HotstuffConfig) -> Result<(), HotStuffError> { + // We only require the sidechain id on the genesis block + if !candidate_block.is_genesis() { + return Ok(()); + } + + // If we are using a sidechain id in the network, we need to check it matches the candidate block one + if let Some(expected_sidechain_id) = &config.sidechain_id { + // Extract the sidechain id from the candidate block + let extra_data = candidate_block.extra_data().ok_or::( + ProposalValidationError::MissingSidechainId { + block_id: *candidate_block.id(), + } + .into(), + )?; + let sidechain_id_bytes = extra_data.get(&ExtraFieldKey::SidechainId).ok_or::( + ProposalValidationError::InvalidSidechainId { + block_id: *candidate_block.id(), + reason: "SidechainId key not present".to_owned(), + } + .into(), + )?; + let sidechain_id = RistrettoPublicKey::from_canonical_bytes(sidechain_id_bytes).map_err(|e| { + ProposalValidationError::InvalidSidechainId { + block_id: *candidate_block.id(), + reason: e.to_string(), + } + })?; + + // The sidechain id must match the sidechain of the current network + if sidechain_id != *expected_sidechain_id { + return Err(ProposalValidationError::MismatchedSidechainId { + block_id: *candidate_block.id(), + expected_sidechain_id: expected_sidechain_id.clone(), + sidechain_id, + } + .into()); + } + } + + Ok(()) +} diff --git a/dan_layer/consensus/src/hotstuff/config.rs b/dan_layer/consensus/src/hotstuff/config.rs index b51e78d12c..72c7d36912 100644 --- a/dan_layer/consensus/src/hotstuff/config.rs +++ b/dan_layer/consensus/src/hotstuff/config.rs @@ -4,6 +4,7 @@ use std::time::Duration; use tari_common::configuration::Network; +use tari_crypto::ristretto::RistrettoPublicKey; use tari_dan_common_types::NumPreshards; #[derive(Debug, Clone)] @@ -13,4 +14,5 @@ pub struct HotstuffConfig { pub max_base_layer_blocks_behind: u64, pub num_preshards: NumPreshards, pub pacemaker_max_base_time: Duration, + pub sidechain_id: Option, } diff --git a/dan_layer/consensus/src/hotstuff/error.rs b/dan_layer/consensus/src/hotstuff/error.rs index 717f0ddd92..2daa7b677b 100644 --- a/dan_layer/consensus/src/hotstuff/error.rs +++ b/dan_layer/consensus/src/hotstuff/error.rs @@ -2,9 +2,10 @@ // SPDX-License-Identifier: BSD-3-Clause use tari_common_types::types::FixedHash; +use tari_crypto::ristretto::RistrettoPublicKey; use tari_dan_common_types::{Epoch, NodeHeight, VersionedSubstateIdError}; use tari_dan_storage::{ - consensus_models::{BlockId, LeafBlock, LockedBlock, QuorumCertificate, TransactionPoolError}, + consensus_models::{BlockError, BlockId, LeafBlock, LockedBlock, QuorumCertificate, TransactionPoolError}, StorageError, }; use tari_epoch_manager::EpochManagerError; @@ -103,6 +104,8 @@ pub enum HotStuffError { foreign_block_id: BlockId, transaction_id: TransactionId, }, + #[error("Block building error: {0}")] + BlockBuildingError(#[from] BlockError), } impl From for HotStuffError { @@ -235,4 +238,17 @@ pub enum ProposalValidationError { node" )] NoTransactionsInCommittee { block_id: BlockId }, + #[error("Foreign node submitted an foreign proposal {block_id} that did not contain a sidechain ID")] + MissingSidechainId { block_id: BlockId }, + #[error("Foreign node submitted an foreign proposal {block_id} with an invalid sidechain ID: {reason}")] + InvalidSidechainId { block_id: BlockId, reason: String }, + #[error( + "Foreign node submitted an foreign proposal {block_id} with a mistmatched sidechain ID: expected \ + {expected_sidechain_id} but got {sidechain_id}" + )] + MismatchedSidechainId { + block_id: BlockId, + expected_sidechain_id: RistrettoPublicKey, + sidechain_id: RistrettoPublicKey, + }, } diff --git a/dan_layer/consensus/src/hotstuff/on_ready_to_vote_on_local_block.rs b/dan_layer/consensus/src/hotstuff/on_ready_to_vote_on_local_block.rs index 10c386ba63..ef6a5641f6 100644 --- a/dan_layer/consensus/src/hotstuff/on_ready_to_vote_on_local_block.rs +++ b/dan_layer/consensus/src/hotstuff/on_ready_to_vote_on_local_block.rs @@ -937,6 +937,8 @@ where TConsensusSpec: ConsensusSpec let execution = self.execute_transaction(tx, block.id(), block.epoch(), tx_rec.transaction_id())?; let mut execution = execution.into_transaction_execution(); + // TODO: check the diff is valid against the provided input evidence (correct locks etc). + // TODO: can we modify the locks at this point? For multi-shard input transactions, we locked all inputs // as Read due to lack of information. We now know what locks are necessary, and this // block has the correct evidence (TODO: verify the atom) so this should be fine. diff --git a/dan_layer/consensus_tests/src/support/validator/builder.rs b/dan_layer/consensus_tests/src/support/validator/builder.rs index f90bcb0b64..edb72e708f 100644 --- a/dan_layer/consensus_tests/src/support/validator/builder.rs +++ b/dan_layer/consensus_tests/src/support/validator/builder.rs @@ -132,6 +132,7 @@ impl ValidatorBuilder { max_base_layer_blocks_behind: 5, network: Network::LocalNet, pacemaker_max_base_time: Duration::from_secs(10), + sidechain_id: None, }, self.address.clone(), inbound_messaging, diff --git a/dan_layer/engine/src/transaction/processor.rs b/dan_layer/engine/src/transaction/processor.rs index 6df7174ec5..b6bfaa81e7 100644 --- a/dan_layer/engine/src/transaction/processor.rs +++ b/dan_layer/engine/src/transaction/processor.rs @@ -43,10 +43,11 @@ use tari_template_lib::{ arg, args, args::{Arg, WorkspaceAction}, + auth::OwnerRule, crypto::RistrettoPublicKeyBytes, invoke_args, - models::{ComponentAddress, NonFungibleAddress}, - prelude::TemplateAddress, + models::{Bucket, ComponentAddress, NonFungibleAddress}, + prelude::{AccessRules, TemplateAddress}, }; use tari_transaction::Transaction; use tari_utilities::ByteArray; @@ -70,6 +71,7 @@ use crate::{ const LOG_TARGET: &str = "tari::dan::engine::instruction_processor"; pub const MAX_CALL_DEPTH: usize = 10; +const ACCOUNT_CONSTRUCTOR_FUNCTION: &str = "create"; pub struct TransactionProcessor { template_provider: Arc, @@ -240,9 +242,18 @@ impl + 'static> T debug!(target: LOG_TARGET, "instruction = {:?}", instruction); match instruction { Instruction::CreateAccount { - owner_public_key, + public_key_address, + owner_rule, + access_rules, workspace_bucket, - } => Self::create_account(template_provider, runtime, &owner_public_key, workspace_bucket), + } => Self::create_account( + template_provider, + runtime, + &public_key_address, + owner_rule, + access_rules, + workspace_bucket, + ), Instruction::CallFunction { template_address, function, @@ -312,7 +323,9 @@ impl + 'static> T pub fn create_account( template_provider: &TTemplateProvider, runtime: &Runtime, - owner_public_key: &PublicKey, + public_key_address: &PublicKey, + owner_rule: Option, + access_rules: Option, workspace_bucket: Option, ) -> Result { let template = template_provider @@ -325,23 +338,42 @@ impl + 'static> T address: ACCOUNT_TEMPLATE_ADDRESS, })?; - let function = if workspace_bucket.is_some() { - "create_with_bucket" + let function_def = template + .template_def() + .get_function(ACCOUNT_CONSTRUCTOR_FUNCTION) + .cloned() + .ok_or_else(|| TransactionError::FunctionNotFound { + name: ACCOUNT_CONSTRUCTOR_FUNCTION.to_string(), + })?; + + let account_address = new_component_address_from_public_key(&ACCOUNT_TEMPLATE_ADDRESS, public_key_address); + + // the publick key is the first argument of the Account template constructor + let public_key = RistrettoPublicKeyBytes::from_bytes(public_key_address.as_bytes()).unwrap(); + let mut args = args![NonFungibleAddress::from_public_key(public_key)]; + + // add the optional owner rule if specified + if let Some(owner_rule) = owner_rule { + args.push(arg![Literal(owner_rule)]); } else { - "create" - }; + let none: Option = None; + args.push(arg![Literal(none)]); + } - let function_def = template.template_def().get_function(function).cloned().ok_or_else(|| { - TransactionError::FunctionNotFound { - name: function.to_string(), - } - })?; - let owner_pk = RistrettoPublicKeyBytes::from_bytes(owner_public_key.as_bytes()).unwrap(); - let account_address = new_component_address_from_public_key(&ACCOUNT_TEMPLATE_ADDRESS, owner_public_key); + // add the optional access rules if specified + if let Some(access_rules) = access_rules { + args.push(arg![Literal(access_rules)]); + } else { + let none: Option = None; + args.push(arg![Literal(none)]); + } - let mut args = args![NonFungibleAddress::from_public_key(owner_pk)]; + // add the optional workspace bucket with the initial funds of the account if let Some(workspace_bucket) = workspace_bucket { args.push(arg![Workspace(workspace_bucket)]); + } else { + let none: Option = None; + args.push(arg![Literal(none)]); } let args = runtime.resolve_args(args)?; diff --git a/dan_layer/engine/tests/account.rs b/dan_layer/engine/tests/account.rs index fad265693d..63cbc415dd 100644 --- a/dan_layer/engine/tests/account.rs +++ b/dan_layer/engine/tests/account.rs @@ -1,16 +1,19 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -use tari_crypto::{keys::PublicKey, ristretto::RistrettoPublicKey}; +use tari_crypto::{keys::PublicKey, ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; use tari_dan_engine::runtime::{ActionIdent, RuntimeError}; use tari_engine_types::instruction::Instruction; use tari_template_lib::{ args, + auth::AccessRule, constants::XTR, models::{Amount, ComponentAddress, ResourceAddress}, + prelude::AccessRules, }; use tari_template_test_tooling::{ support::assert_error::{assert_access_denied_for_action, assert_reject_reason}, + test_faucet_component, TemplateTest, }; use tari_transaction::Transaction; @@ -252,3 +255,50 @@ fn gasless() { let balance = result.expect_return::>(3); assert_eq!(balance[0].1, 100); } + +#[test] +fn custom_access_rules() { + let mut template_test = TemplateTest::new::<_, &str>([]); + + // First we create a account with a custom rule that anyone can withdraw + let (owner_proof, public_key, secret_key) = template_test.create_owner_proof(); + + let access_rules = AccessRules::new() + .add_method_rule("balance", AccessRule::AllowAll) + .add_method_rule("get_balances", AccessRule::AllowAll) + .add_method_rule("deposit", AccessRule::AllowAll) + .add_method_rule("deposit_all", AccessRule::AllowAll) + .add_method_rule("get_non_fungible_ids", AccessRule::AllowAll) + // We are going to make it so anyone can withdraw + .default(AccessRule::AllowAll); + + let result = template_test.execute_expect_success( + Transaction::builder() + .call_method(test_faucet_component(), "take_free_coins", args![]) + .put_last_instruction_output_on_workspace("bucket") + // Create component with the same ID + .create_account_with_custom_rules( + public_key, + None, + Some(access_rules), + Some("bucket"), + ) + // Signed by source account so that it can pay the fees for the new account creation + .sign(&secret_key) + .build(), + vec![owner_proof], + ); + let user_account = result.finalize.execution_results[2].decode().unwrap(); + + // We create another account and we we will withdraw from the custom one + let (user2_account, user2_account_proof, user2_secret_key) = template_test.create_funded_account(); + template_test.execute_expect_success( + Transaction::builder() + .call_method(user_account, "withdraw", args![XTR, Amount(100)]) + .put_last_instruction_output_on_workspace("b") + .call_method(user2_account, "deposit", args![Workspace("b")]) + .build() + .sign(&user2_secret_key), + vec![user2_account_proof], + ); +} diff --git a/dan_layer/engine/tests/airdrop.rs b/dan_layer/engine/tests/airdrop.rs index 152bc198b0..06ae9aa78b 100644 --- a/dan_layer/engine/tests/airdrop.rs +++ b/dan_layer/engine/tests/airdrop.rs @@ -32,7 +32,9 @@ fn airdrop() { let instructions = iter::repeat_with(|| { let (_, owner_public_key, _) = template_test.create_owner_proof(); Instruction::CreateAccount { - owner_public_key, + public_key_address: owner_public_key, + owner_rule: None, + access_rules: None, workspace_bucket: None, } }) diff --git a/dan_layer/engine_types/src/instruction.rs b/dan_layer/engine_types/src/instruction.rs index 470a8e7e74..d65b5c021c 100644 --- a/dan_layer/engine_types/src/instruction.rs +++ b/dan_layer/engine_types/src/instruction.rs @@ -8,8 +8,9 @@ use tari_common_types::types::PublicKey; use tari_crypto::tari_utilities::hex::Hex; use tari_template_lib::{ args::{Arg, LogLevel}, + auth::OwnerRule, models::{ComponentAddress, ResourceAddress, TemplateAddress}, - prelude::Amount, + prelude::{AccessRules, Amount}, }; #[cfg(feature = "ts")] use ts_rs::TS; @@ -21,7 +22,9 @@ use crate::{confidential::ConfidentialClaim, serde_with}; pub enum Instruction { CreateAccount { #[cfg_attr(feature = "ts", ts(type = "string"))] - owner_public_key: PublicKey, + public_key_address: PublicKey, + owner_rule: Option, + access_rules: Option, #[cfg_attr(feature = "ts", ts(type = "string | null"))] workspace_bucket: Option, }, @@ -71,10 +74,16 @@ impl Display for Instruction { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { Self::CreateAccount { - owner_public_key, + public_key_address, + owner_rule, + access_rules, workspace_bucket, } => { - write!(f, "CreateAccount {{ owner_public_key: {}, bucket: ", owner_public_key,)?; + write!( + f, + "CreateAccount {{ public_key_address: {}, owner_rule: {:?}, acces_rules: {:?}, bucket: ", + public_key_address, owner_rule, access_rules + )?; match workspace_bucket { Some(bucket) => write!(f, "{}", bucket)?, None => write!(f, "None")?, diff --git a/dan_layer/p2p/proto/consensus.proto b/dan_layer/p2p/proto/consensus.proto index e60fd6021c..e533c2adba 100644 --- a/dan_layer/p2p/proto/consensus.proto +++ b/dan_layer/p2p/proto/consensus.proto @@ -98,6 +98,11 @@ message Block { uint64 base_layer_block_height = 14; bytes base_layer_block_hash = 15; bool is_dummy = 16; + ExtraData extra_data = 17; +} + +message ExtraData { + bytes encoded_extra_data = 1; } message LeaderFee { diff --git a/dan_layer/p2p/proto/transaction.proto b/dan_layer/p2p/proto/transaction.proto index fa28d630df..8712942927 100644 --- a/dan_layer/p2p/proto/transaction.proto +++ b/dan_layer/p2p/proto/transaction.proto @@ -72,14 +72,17 @@ message Instruction { bytes claim_validator_fees_validator_public_key = 15; uint64 claim_validator_fees_epoch = 16; - bytes create_account_owner_public_key = 17; - string create_account_workspace_bucket = 18; + bytes create_account_public_key = 17; + OwnerRule create_account_owner_rule = 18; + AccessRules create_account_access_rules = 19; + string create_account_workspace_bucket = 20; // AssertBucketContains - bytes resource_address = 19; - int64 min_amount = 20; + bytes resource_address = 21; + int64 min_amount = 22; } + message Arg { enum ArgType { LITERAL = 0; @@ -136,3 +139,11 @@ message ViewableBalanceProof { bytes s_m = 7; bytes s_r = 8; } + +message OwnerRule { + bytes encoded_owner_rule = 1; +} + +message AccessRules { + bytes encoded_access_rules = 1; +} \ No newline at end of file diff --git a/dan_layer/p2p/src/conversions/consensus.rs b/dan_layer/p2p/src/conversions/consensus.rs index 13bf6e5410..99237365fc 100644 --- a/dan_layer/p2p/src/conversions/consensus.rs +++ b/dan_layer/p2p/src/conversions/consensus.rs @@ -41,6 +41,7 @@ use tari_crypto::tari_utilities::ByteArray; use tari_dan_common_types::{ shard::Shard, Epoch, + ExtraData, NodeHeight, ShardGroup, SubstateLockType, @@ -461,6 +462,7 @@ impl From<&tari_dan_storage::consensus_models::Block> for proto::consensus::Bloc base_layer_block_height: value.base_layer_block_height(), base_layer_block_hash: value.base_layer_block_hash().as_bytes().to_vec(), is_dummy: value.is_dummy(), + extra_data: value.extra_data().map(Into::into), } } } @@ -483,6 +485,8 @@ impl TryFrom for tari_dan_storage::consensus_models::Bl .ok_or_else(|| anyhow!("Block conversion: QC not provided"))? .try_into()?; + let extra_data = value.extra_data.map(TryInto::try_into).transpose()?; + if value.is_dummy { Ok(Self::dummy_block( network, @@ -518,11 +522,30 @@ impl TryFrom for tari_dan_storage::consensus_models::Bl value.timestamp, value.base_layer_block_height, value.base_layer_block_hash.try_into()?, + extra_data, )) } } } +//---------------------------------- Evidence --------------------------------------------// + +impl From<&ExtraData> for proto::consensus::ExtraData { + fn from(value: &ExtraData) -> Self { + Self { + encoded_extra_data: encode(value).unwrap(), + } + } +} + +impl TryFrom for ExtraData { + type Error = anyhow::Error; + + fn try_from(value: proto::consensus::ExtraData) -> Result { + Ok(decode_exact(&value.encoded_extra_data)?) + } +} + //---------------------------------- Command --------------------------------------------// impl From<&Command> for proto::consensus::Command { diff --git a/dan_layer/p2p/src/conversions/transaction.rs b/dan_layer/p2p/src/conversions/transaction.rs index 0246c52aee..251d79d740 100644 --- a/dan_layer/p2p/src/conversions/transaction.rs +++ b/dan_layer/p2p/src/conversions/transaction.rs @@ -23,13 +23,14 @@ use std::convert::{TryFrom, TryInto}; use anyhow::anyhow; -use tari_bor::decode_exact; +use tari_bor::{decode_exact, encode}; use tari_common_types::types::{Commitment, PrivateKey, PublicKey}; use tari_crypto::{ristretto::RistrettoComSig, tari_utilities::ByteArray}; use tari_dan_common_types::{Epoch, SubstateRequirement, VersionedSubstateId}; use tari_engine_types::{confidential::ConfidentialClaim, instruction::Instruction, substate::SubstateId}; use tari_template_lib::{ args::Arg, + auth::OwnerRule, crypto::{BalanceProofSignature, PedersonCommitmentBytes, RistrettoPublicKeyBytes}, models::{ Amount, @@ -40,6 +41,7 @@ use tari_template_lib::{ ObjectKey, ViewableBalanceProof, }, + prelude::AccessRules, }; use tari_transaction::{Transaction, UnsignedTransaction}; @@ -193,8 +195,10 @@ impl TryFrom for Instruction { InstructionType::try_from(request.instruction_type).map_err(|e| anyhow!("invalid instruction_type {e}"))?; let instruction = match instruction_type { InstructionType::CreateAccount => Instruction::CreateAccount { - owner_public_key: PublicKey::from_canonical_bytes(&request.create_account_owner_public_key) - .map_err(|e| anyhow!("create_account_owner_public_key: {}", e))?, + public_key_address: PublicKey::from_canonical_bytes(&request.create_account_public_key) + .map_err(|e| anyhow!("create_account_public_key: {}", e))?, + owner_rule: request.create_account_owner_rule.map(TryInto::try_into).transpose()?, + access_rules: request.create_account_access_rules.map(TryInto::try_into).transpose()?, workspace_bucket: Some(request.create_account_workspace_bucket).filter(|s| !s.is_empty()), }, InstructionType::Function => { @@ -267,11 +271,15 @@ impl From for proto::transaction::Instruction { match instruction { Instruction::CreateAccount { - owner_public_key, + public_key_address, + owner_rule, + access_rules, workspace_bucket, } => { result.instruction_type = InstructionType::CreateAccount as i32; - result.create_account_owner_public_key = owner_public_key.to_vec(); + result.create_account_public_key = public_key_address.to_vec(); + result.create_account_owner_rule = owner_rule.map(Into::into); + result.create_account_access_rules = access_rules.map(Into::into); result.create_account_workspace_bucket = workspace_bucket.unwrap_or_default(); }, Instruction::CallFunction { @@ -597,3 +605,39 @@ impl From for proto::transaction::ViewableBalanceProof { } } } + +// -------------------------------- OwnerRule -------------------------------- // + +impl From for proto::transaction::OwnerRule { + fn from(value: OwnerRule) -> Self { + Self { + encoded_owner_rule: encode(&value).unwrap(), + } + } +} + +impl TryFrom for OwnerRule { + type Error = anyhow::Error; + + fn try_from(value: proto::transaction::OwnerRule) -> Result { + Ok(decode_exact(&value.encoded_owner_rule)?) + } +} + +// -------------------------------- AccessRules -------------------------------- // + +impl From for proto::transaction::AccessRules { + fn from(value: AccessRules) -> Self { + Self { + encoded_access_rules: encode(&value).unwrap(), + } + } +} + +impl TryFrom for AccessRules { + type Error = anyhow::Error; + + fn try_from(value: proto::transaction::AccessRules) -> Result { + Ok(decode_exact(&value.encoded_access_rules)?) + } +} diff --git a/dan_layer/state_store_sqlite/migrations/2023-06-08-091819_create_state_store/up.sql b/dan_layer/state_store_sqlite/migrations/2023-06-08-091819_create_state_store/up.sql index d9d8527c0a..ee481d7ce8 100644 --- a/dan_layer/state_store_sqlite/migrations/2023-06-08-091819_create_state_store/up.sql +++ b/dan_layer/state_store_sqlite/migrations/2023-06-08-091819_create_state_store/up.sql @@ -35,6 +35,7 @@ create table blocks timestamp bigint not NULL, base_layer_block_height bigint not NULL, base_layer_block_hash text not NULL, + extra_data text NULL, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (qc_id) REFERENCES quorum_certificates (qc_id) ); @@ -64,6 +65,7 @@ create table parked_blocks base_layer_block_height bigint not NULL, base_layer_block_hash text not NULL, foreign_proposals text not NULL, + extra_data text NULL, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ); @@ -394,6 +396,7 @@ CREATE TABLE foreign_proposals proposed_in_block text NULL REFERENCES blocks (block_id), proposed_in_block_height bigint NULL, status text not NULL, + extra_data text NULL, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE (block_id) ); diff --git a/dan_layer/state_store_sqlite/src/schema.rs b/dan_layer/state_store_sqlite/src/schema.rs index f3f9357cf3..5d3d03641b 100644 --- a/dan_layer/state_store_sqlite/src/schema.rs +++ b/dan_layer/state_store_sqlite/src/schema.rs @@ -38,6 +38,7 @@ diesel::table! { timestamp -> BigInt, base_layer_block_height -> BigInt, base_layer_block_hash -> Text, + extra_data -> Nullable, created_at -> Timestamp, } } @@ -110,6 +111,7 @@ diesel::table! { proposed_in_block -> Nullable, proposed_in_block_height -> Nullable, status -> Text, + extra_data -> Nullable, created_at -> Timestamp, } } @@ -261,6 +263,7 @@ diesel::table! { base_layer_block_height -> BigInt, base_layer_block_hash -> Text, foreign_proposals -> Text, + extra_data -> Nullable, created_at -> Timestamp, } } diff --git a/dan_layer/state_store_sqlite/src/sql_models/block.rs b/dan_layer/state_store_sqlite/src/sql_models/block.rs index 346750565b..d03394ae4a 100644 --- a/dan_layer/state_store_sqlite/src/sql_models/block.rs +++ b/dan_layer/state_store_sqlite/src/sql_models/block.rs @@ -38,6 +38,7 @@ pub struct Block { pub timestamp: i64, pub base_layer_block_height: i64, pub base_layer_block_hash: String, + pub extra_data: Option, pub created_at: PrimitiveDateTime, } @@ -81,6 +82,7 @@ impl Block { self.timestamp as u64, self.base_layer_block_height as u64, deserialize_hex_try_from(&self.base_layer_block_hash)?, + self.extra_data.map(|val| deserialize_json(&val)).transpose()?, )) } } @@ -106,6 +108,7 @@ pub struct ParkedBlock { pub base_layer_block_height: i64, pub base_layer_block_hash: String, pub foreign_proposals: String, + pub extra_data: Option, pub created_at: PrimitiveDateTime, } @@ -151,6 +154,7 @@ impl TryFrom for (consensus_models::Block, Vec, pub proposed_in_block_height: Option, pub status: String, + pub extra_data: Option, pub created_at: PrimitiveDateTime, } @@ -84,6 +85,7 @@ impl ForeignProposal { self.timestamp as u64, self.base_layer_block_height as u64, deserialize_hex_try_from(&self.base_layer_block_hash)?, + self.extra_data.map(|val| deserialize_json(&val)).transpose()?, ); let status = consensus_models::ForeignProposalStatus::from_str(&self.status)?; diff --git a/dan_layer/state_store_sqlite/src/writer.rs b/dan_layer/state_store_sqlite/src/writer.rs index 03fd2bc19c..3dba0e19d7 100644 --- a/dan_layer/state_store_sqlite/src/writer.rs +++ b/dan_layer/state_store_sqlite/src/writer.rs @@ -187,6 +187,7 @@ impl<'a, TAddr: NodeAddressable> SqliteStateStoreWriteTransaction<'a, TAddr> { parked_blocks::base_layer_block_height.eq(block.base_layer_block_height() as i64), parked_blocks::base_layer_block_hash.eq(serialize_hex(block.base_layer_block_hash())), parked_blocks::foreign_proposals.eq(serialize_json(foreign_proposals)?), + parked_blocks::extra_data.eq(block.extra_data().map(serialize_json).transpose()?), ); diesel::insert_into(parked_blocks::table) @@ -239,6 +240,7 @@ impl<'tx, TAddr: NodeAddressable + 'tx> StateStoreWriteTransaction for SqliteSta blocks::timestamp.eq(block.timestamp() as i64), blocks::base_layer_block_height.eq(block.base_layer_block_height() as i64), blocks::base_layer_block_hash.eq(serialize_hex(block.base_layer_block_hash())), + blocks::extra_data.eq(block.extra_data().map(serialize_json).transpose()?), ); diesel::insert_into(blocks::table) @@ -592,6 +594,7 @@ impl<'tx, TAddr: NodeAddressable + 'tx> StateStoreWriteTransaction for SqliteSta foreign_proposals::justify_qc_id.eq(serialize_hex(foreign_proposal.justify_qc().id())), foreign_proposals::block_pledge.eq(serialize_json(foreign_proposal.block_pledge())?), foreign_proposals::status.eq(ForeignProposalStatus::New.to_string()), + foreign_proposals::extra_data.eq(foreign_proposal.block().extra_data().map(serialize_json).transpose()?), ); diesel::insert_into(foreign_proposals::table) diff --git a/dan_layer/state_store_sqlite/tests/tests.rs b/dan_layer/state_store_sqlite/tests/tests.rs index 0c73bf891b..ae511a8e5f 100644 --- a/dan_layer/state_store_sqlite/tests/tests.rs +++ b/dan_layer/state_store_sqlite/tests/tests.rs @@ -47,7 +47,7 @@ mod confirm_all_transitions { let atom3 = create_tx_atom(); let network = Default::default(); - let zero_block = Block::zero_block(network, NumPreshards::P64); + let zero_block = Block::zero_block(network, NumPreshards::P64, None).unwrap(); zero_block.insert(&mut tx).unwrap(); let block1 = Block::new( network, @@ -67,6 +67,7 @@ mod confirm_all_transitions { EpochTime::now().as_u64(), 0, FixedHash::zero(), + None, ); block1.insert(&mut tx).unwrap(); diff --git a/dan_layer/storage/src/consensus_models/block.rs b/dan_layer/storage/src/consensus_models/block.rs index 82595ba861..322c3efc88 100644 --- a/dan_layer/storage/src/consensus_models/block.rs +++ b/dan_layer/storage/src/consensus_models/block.rs @@ -13,7 +13,7 @@ use log::*; use serde::{Deserialize, Serialize}; use tari_common::configuration::Network; use tari_common_types::types::{FixedHash, FixedHashSizeError, PublicKey}; -use tari_crypto::tari_utilities::epoch_time::EpochTime; +use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::epoch_time::EpochTime}; use tari_dan_common_types::{ committee::CommitteeInfo, hashing, @@ -21,6 +21,8 @@ use tari_dan_common_types::{ serde_with, shard::Shard, Epoch, + ExtraData, + MaxSizeBytesError, NodeAddressable, NodeHeight, NumPreshards, @@ -68,6 +70,12 @@ use crate::{ const LOG_TARGET: &str = "tari::dan::storage::consensus_models::block"; +#[derive(Debug, thiserror::Error)] +pub enum BlockError { + #[error("Extra data size error: {0}")] + ExtraDataSizeError(#[from] MaxSizeBytesError), +} + #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Block { @@ -114,6 +122,7 @@ pub struct Block { base_layer_block_height: u64, #[cfg_attr(feature = "ts", ts(type = "string"))] base_layer_block_hash: FixedHash, + extra_data: Option, } impl Block { @@ -134,6 +143,7 @@ impl Block { timestamp: u64, base_layer_block_height: u64, base_layer_block_hash: FixedHash, + extra_data: Option, ) -> Self { let mut block = Self { id: BlockId::zero(), @@ -157,6 +167,7 @@ impl Block { timestamp, base_layer_block_height, base_layer_block_hash, + extra_data, }; block.id = block.calculate_hash().into(); block @@ -185,6 +196,7 @@ impl Block { timestamp: u64, base_layer_block_height: u64, base_layer_block_hash: FixedHash, + extra_data: Option, ) -> Self { Self { id, @@ -208,11 +220,17 @@ impl Block { timestamp, base_layer_block_height, base_layer_block_hash, + extra_data, } } - pub fn genesis(network: Network, epoch: Epoch, shard_group: ShardGroup) -> Self { - Self::new( + pub fn genesis( + network: Network, + epoch: Epoch, + shard_group: ShardGroup, + sidechain_id: Option, + ) -> Result { + Ok(Self::new( network, BlockId::zero(), QuorumCertificate::genesis(epoch, shard_group), @@ -229,12 +247,17 @@ impl Block { 0, 0, FixedHash::zero(), - ) + Self::extra_data_from_sidechain_id(sidechain_id)?, + )) } /// This is the parent block for all genesis blocks. Its block ID is always zero. - pub fn zero_block(network: Network, num_preshards: NumPreshards) -> Self { - Self { + pub fn zero_block( + network: Network, + num_preshards: NumPreshards, + sidechain_id: Option, + ) -> Result { + Ok(Self { network, id: BlockId::zero(), parent: BlockId::zero(), @@ -256,7 +279,8 @@ impl Block { timestamp: EpochTime::now().as_u64(), base_layer_block_height: 0, base_layer_block_hash: FixedHash::zero(), - } + extra_data: Self::extra_data_from_sidechain_id(sidechain_id)?, + }) } pub fn dummy_block( @@ -294,12 +318,20 @@ impl Block { timestamp: parent_timestamp, base_layer_block_height: parent_base_layer_block_height, base_layer_block_hash: parent_base_layer_block_hash, + extra_data: None, }; block.id = block.calculate_hash().into(); block.is_justified = false; block } + fn extra_data_from_sidechain_id(sidechain_id: Option) -> Result, BlockError> { + let extra_data = sidechain_id + .map(|id| ExtraData::new().insert_sidechain_id(id).cloned()) + .transpose()?; + Ok(extra_data) + } + pub fn calculate_hash(&self) -> FixedHash { // Hash is created from the hash of the "body" and // then hashed with the parent, so that you can @@ -330,6 +362,7 @@ impl Block { .chain(&self.timestamp) .chain(&self.base_layer_block_height) .chain(&self.base_layer_block_hash) + .chain(&self.extra_data) .result(); hashing::block_hasher().chain(&self.parent).chain(&inner_hash).result() @@ -543,6 +576,10 @@ impl Block { pub fn base_layer_block_hash(&self) -> &FixedHash { &self.base_layer_block_hash } + + pub fn extra_data(&self) -> Option<&ExtraData> { + self.extra_data.as_ref() + } } impl Block { diff --git a/dan_layer/storage/src/error.rs b/dan_layer/storage/src/error.rs index 4e50058bd0..fb9fc003f8 100644 --- a/dan_layer/storage/src/error.rs +++ b/dan_layer/storage/src/error.rs @@ -23,6 +23,8 @@ use tari_common_types::types::FixedHashSizeError; use tari_dan_common_types::optional::IsNotFoundError; +use crate::consensus_models::BlockError; + #[derive(Debug, thiserror::Error)] pub enum StorageError { #[error("Could not connect to storage:{reason}")] @@ -60,6 +62,8 @@ pub enum StorageError { DataInconsistency { details: String }, #[error("General storage error: {details}")] General { details: String }, + #[error("Block creation error: {0}")] + BlockError(#[from] BlockError), } impl IsNotFoundError for StorageError { diff --git a/dan_layer/template_builtin/templates/account/src/lib.rs b/dan_layer/template_builtin/templates/account/src/lib.rs index 49a445c685..e349778631 100644 --- a/dan_layer/template_builtin/templates/account/src/lib.rs +++ b/dan_layer/template_builtin/templates/account/src/lib.rs @@ -33,31 +33,27 @@ mod account_template { } impl Account { - pub fn create(owner_token: NonFungibleAddress) -> Component { - Self::internal_create(owner_token, None) - } - - pub fn create_with_bucket(owner_token: NonFungibleAddress, bucket: Bucket) -> Component { - Self::internal_create(owner_token, Some(bucket)) - } - - fn internal_create(owner_token: NonFungibleAddress, bucket: Option) -> Component { + pub fn create(public_key_token: NonFungibleAddress, owner_rule: Option, access_rules: Option, bucket: Option) -> Component { // extract the public key from the token - // we only allow owner tokens that correspond to public keys - let public_key = owner_token + // we only allow tokens that correspond to public keys + let public_key = public_key_token .to_public_key() - .unwrap_or_else(|| panic!("owner_token is not a valid public key: {}", owner_token)); - - // only the owner of the token will be able to withdraw funds from the account - let withdraw_rule = - AccessRule::Restricted(RestrictedAccessRule::Require(RequireRule::Require(owner_token.into()))); - let rules = AccessRules::new() - .add_method_rule("balance", AccessRule::AllowAll) - .add_method_rule("get_balances", AccessRule::AllowAll) - .add_method_rule("deposit", AccessRule::AllowAll) - .add_method_rule("deposit_all", AccessRule::AllowAll) - .add_method_rule("get_non_fungible_ids", AccessRule::AllowAll) - .default(withdraw_rule); + .unwrap_or_else(|| panic!("public_key_token is not a valid public key: {}", public_key_token)); + + let owner_rule = owner_rule.unwrap_or( + OwnerRule::ByPublicKey(public_key) + ); + + let access_rules = access_rules.unwrap_or( + AccessRules::new() + .add_method_rule("balance", AccessRule::AllowAll) + .add_method_rule("get_balances", AccessRule::AllowAll) + .add_method_rule("deposit", AccessRule::AllowAll) + .add_method_rule("deposit_all", AccessRule::AllowAll) + .add_method_rule("get_non_fungible_ids", AccessRule::AllowAll) + // By defaul, only the owner of the token will be able to withdraw funds from the account + .default(AccessRule::Restricted(RestrictedAccessRule::Require(RequireRule::Require(public_key_token.into())))) + ); // add the funds from the (optional) bucket let mut vaults = BTreeMap::new(); @@ -66,9 +62,9 @@ mod account_template { } Component::new(Self { vaults }) - .with_access_rules(rules) + .with_access_rules(access_rules) .with_public_key_address(public_key) - .with_owner_rule(OwnerRule::ByPublicKey(public_key)) + .with_owner_rule(owner_rule) .create() } diff --git a/dan_layer/template_lib/src/auth/owner_rule.rs b/dan_layer/template_lib/src/auth/owner_rule.rs index 70c243fbd2..f5dde459a0 100644 --- a/dan_layer/template_lib/src/auth/owner_rule.rs +++ b/dan_layer/template_lib/src/auth/owner_rule.rs @@ -12,7 +12,7 @@ pub struct Ownership<'a> { } /// An enum for all possible ways to specify ownership of values -#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize, PartialEq)] #[cfg_attr( feature = "ts", derive(ts_rs::TS), diff --git a/dan_layer/template_test_tooling/src/template_test.rs b/dan_layer/template_test_tooling/src/template_test.rs index 0816fd0d8d..c42a050b26 100644 --- a/dan_layer/template_test_tooling/src/template_test.rs +++ b/dan_layer/template_test_tooling/src/template_test.rs @@ -296,7 +296,9 @@ impl TemplateTest { let result = self .execute_and_commit( vec![Instruction::CreateAccount { - owner_public_key, + public_key_address: owner_public_key, + owner_rule: None, + access_rules: None, workspace_bucket, }], proofs, @@ -419,6 +421,28 @@ impl TemplateTest { (component, owner_proof, secret_key) } + pub fn create_custom_funded_account(&mut self) -> (ComponentAddress, NonFungibleAddress, RistrettoSecretKey) { + 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![]) + .put_last_instruction_output_on_workspace("bucket") + .create_account_with_bucket(public_key, "bucket") + .sign(&secret_key) + .build(), + vec![owner_proof.clone()], + ); + + let component = result.finalize.execution_results[2] + .decode::() + .unwrap(); + + self.enable_fees = old_fail_fees; + (component, owner_proof, secret_key) + } + fn next_key_seed(&mut self) -> u8 { let seed = self.key_seed; self.key_seed += 1; diff --git a/dan_layer/transaction/src/builder.rs b/dan_layer/transaction/src/builder.rs index b61e30e342..d62a9a5a7e 100644 --- a/dan_layer/transaction/src/builder.rs +++ b/dan_layer/transaction/src/builder.rs @@ -7,7 +7,9 @@ use tari_engine_types::{confidential::ConfidentialClaim, instruction::Instructio use tari_template_lib::{ args, args::Arg, + auth::OwnerRule, models::{Amount, ComponentAddress, ConfidentialWithdrawProof, ResourceAddress}, + prelude::AccessRules, }; use crate::{unsigned_transaction::UnsignedTransaction, Transaction, TransactionSignature}; @@ -62,18 +64,37 @@ impl TransactionBuilder { pub fn create_account(self, owner_public_key: PublicKey) -> Self { self.add_instruction(Instruction::CreateAccount { - owner_public_key, + public_key_address: owner_public_key, + owner_rule: None, + access_rules: None, workspace_bucket: None, }) } pub fn create_account_with_bucket>(self, owner_public_key: PublicKey, workspace_bucket: T) -> Self { self.add_instruction(Instruction::CreateAccount { - owner_public_key, + public_key_address: owner_public_key, + owner_rule: None, + access_rules: None, workspace_bucket: Some(workspace_bucket.into()), }) } + pub fn create_account_with_custom_rules>( + self, + public_key_address: PublicKey, + owner_rule: Option, + access_rules: Option, + workspace_bucket: Option, + ) -> Self { + self.add_instruction(Instruction::CreateAccount { + public_key_address, + owner_rule, + access_rules, + workspace_bucket: workspace_bucket.map(|b| b.into()), + }) + } + pub fn call_function(self, template_address: TemplateAddress, function: &str, args: Vec) -> Self { self.add_instruction(Instruction::CallFunction { template_address, diff --git a/integration_tests/src/helpers.rs b/integration_tests/src/helpers.rs index 890deea812..411a396461 100644 --- a/integration_tests/src/helpers.rs +++ b/integration_tests/src/helpers.rs @@ -7,8 +7,12 @@ use std::{ time::Duration, }; +use tari_dan_common_types::SubstateRequirement; +use tari_engine_types::substate::SubstateId; use tokio::{io::AsyncWriteExt, task::JoinHandle}; +use crate::TariWorld; + pub fn get_os_assigned_port() -> u16 { let listener = TcpListener::bind("127.0.0.1:0").unwrap(); listener.local_addr().unwrap().port() @@ -117,3 +121,37 @@ pub async fn check_join_handle( }, } } + +pub fn get_address_from_output(world: &TariWorld, output_ref: String) -> &SubstateId { + world + .outputs + .iter() + .find_map(|(parent_name, outputs)| { + outputs + .iter() + .find(|(child_name, _)| { + let fqn = format!("{}/{}", parent_name, child_name); + fqn == output_ref + }) + .map(|(_, addr)| &addr.substate_id) + }) + .unwrap_or_else(|| panic!("Output not found: {}", output_ref)) +} + +pub fn get_component_from_namespace(world: &TariWorld, fq_component_name: String) -> SubstateRequirement { + let (input_group, component_name) = fq_component_name.split_once('/').unwrap_or_else(|| { + panic!( + "Component name must be in the format '{{group}}/components/{{template_name}}', got {}", + fq_component_name + ) + }); + + world + .outputs + .get(input_group) + .unwrap_or_else(|| panic!("No outputs found with name {}", input_group)) + .iter() + .find(|(name, _)| **name == component_name) + .map(|(_, data)| data.clone()) + .unwrap_or_else(|| panic!("No component named {}", component_name)) +} diff --git a/integration_tests/src/indexer.rs b/integration_tests/src/indexer.rs index 7b3166fb47..1563aaa0b0 100644 --- a/integration_tests/src/indexer.rs +++ b/integration_tests/src/indexer.rs @@ -49,7 +49,7 @@ use tari_template_lib::models::ObjectKey; use tokio::task; use crate::{ - helpers::{check_join_handle, get_os_assigned_ports, wait_listener_on_local_port}, + helpers::{check_join_handle, get_address_from_output, get_os_assigned_ports, wait_listener_on_local_port}, logging::get_base_dir_for_scenario, TariWorld, }; @@ -142,22 +142,6 @@ impl IndexerProcess { } } -fn get_address_from_output(world: &TariWorld, output_ref: String) -> &SubstateId { - world - .outputs - .iter() - .find_map(|(name, outputs)| { - outputs - .iter() - .find(|(child_name, _)| { - let fqn = format!("{}/{}", name, child_name); - fqn == output_ref - }) - .map(|(_, addr)| &addr.substate_id) - }) - .unwrap() -} - pub async fn spawn_indexer(world: &mut TariWorld, indexer_name: String, base_node_name: String) { // each spawned indexer will use different ports let (port, json_rpc_port) = get_os_assigned_ports(); diff --git a/integration_tests/src/miner.rs b/integration_tests/src/miner.rs index f190bd942c..99d1b3ba73 100644 --- a/integration_tests/src/miner.rs +++ b/integration_tests/src/miner.rs @@ -115,10 +115,6 @@ async fn mine_block_without_wallet_with_template(base_client: &mut BaseNodeClien // We don't need to mine, as Localnet blocks have difficulty 1s let _submit_res = base_client.submit_block(block).await.unwrap(); - println!( - "Block successfully mined at height {:?}", - block_template.header.unwrap().height - ); } async fn create_block_template_with_coinbase( diff --git a/integration_tests/src/validator_node_cli.rs b/integration_tests/src/validator_node_cli.rs index 68f6074ac4..5fe7d44d40 100644 --- a/integration_tests/src/validator_node_cli.rs +++ b/integration_tests/src/validator_node_cli.rs @@ -19,7 +19,7 @@ use tari_validator_node_cli::{ }; use tari_validator_node_client::{types::SubmitTransactionResponse, ValidatorNodeClient}; -use crate::{logging::get_base_dir_for_scenario, TariWorld}; +use crate::{helpers::get_component_from_namespace, logging::get_base_dir_for_scenario, TariWorld}; fn get_key_manager(world: &mut TariWorld) -> KeyManager { let path = get_cli_data_dir(world); @@ -206,29 +206,12 @@ pub async fn concurrent_call_method( method_call: String, times: usize, ) -> Result { - let vn_data_dir = get_cli_data_dir(world); - let (input_group, component_name) = fq_component_name.split_once('/').unwrap_or_else(|| { - panic!( - "Component name must be in the format '{{group}}/components/{{template_name}}', got {}", - fq_component_name - ) - }); - - let vn_client = world.get_validator_node(&vn_name).get_client(); - - let mut component = world - .outputs - .get(input_group) - .unwrap_or_else(|| panic!("No outputs found with name {}", input_group)) - .iter() - .find(|(name, _)| **name == component_name) - .map(|(_, data)| data.clone()) - .unwrap_or_else(|| panic!("No component named {}", component_name)); + let mut component = get_component_from_namespace(world, fq_component_name); // For concurrent transactions we DO NOT specify the versions component.version = None; - // call_method_inner(vn_client.clone(), vn_data_dir.clone(), component.clone(), method_call.clone()).await - + let vn_data_dir = get_cli_data_dir(world); + let vn_client = world.get_validator_node(&vn_name).get_client(); let mut handles = Vec::new(); for _ in 0..times { let handle = tokio::spawn(call_method_inner( @@ -268,47 +251,9 @@ pub async fn call_method( method_call: String, ) -> Result { let data_dir = get_cli_data_dir(world); - let (input_group, component_name) = fq_component_name.split_once('/').unwrap_or_else(|| { - panic!( - "Component name must be in the format '{{group}}/components/{{template_name}}', got {}", - fq_component_name - ) - }); - let component = world - .outputs - .get(input_group) - .unwrap_or_else(|| panic!("No outputs found with name {}", input_group)) - .iter() - .find(|(name, _)| **name == component_name) - .map(|(_, data)| data.clone()) - .unwrap_or_else(|| panic!("No component named {}", component_name)); - - let instruction = CliInstruction::CallMethod { - component_address: component.substate_id.clone(), - // TODO: actually parse the method call for arguments - method_name: method_call, - args: vec![], - }; - - println!("Inputs: {}", component); - let args = SubmitArgs { - instruction, - common: CommonSubmitArgs { - wait_for_result: true, - wait_for_result_timeout: Some(60), - inputs: vec![component], - version: None, - dump_outputs_into: None, - account_template_address: None, - dry_run: false, - }, - }; - let mut client = world.get_validator_node(&vn_name).get_client(); - let resp = handle_submit(args, data_dir, &mut client).await.unwrap(); - - if let Some(failure) = resp.dry_run_result.as_ref().unwrap().finalize.full_reject() { - return Err(failure.clone()); - } + let component = get_component_from_namespace(world, fq_component_name); + let vn_client = world.get_validator_node(&vn_name).get_client(); + let resp = call_method_inner(vn_client, data_dir, component, method_call).await?; // store the account component address and other substate ids for later reference add_substate_ids( diff --git a/integration_tests/src/wallet_daemon_cli.rs b/integration_tests/src/wallet_daemon_cli.rs index f272906b9b..a8cdef1149 100644 --- a/integration_tests/src/wallet_daemon_cli.rs +++ b/integration_tests/src/wallet_daemon_cli.rs @@ -22,6 +22,7 @@ use std::{collections::HashMap, str::FromStr, time::Duration}; +use anyhow::bail; use base64::{engine::general_purpose::STANDARD as BASE64, Engine}; use serde_json::json; use tari_crypto::{ @@ -30,7 +31,10 @@ use tari_crypto::{ tari_utilities::ByteArray, }; use tari_dan_common_types::{Epoch, SubstateRequirement}; -use tari_dan_wallet_sdk::apis::confidential_transfer::ConfidentialTransferInputSelection; +use tari_dan_wallet_sdk::{ + apis::confidential_transfer::ConfidentialTransferInputSelection, + models::{Account, NonFungibleToken}, +}; use tari_engine_types::instruction::Instruction; use tari_template_lib::{ args, @@ -39,7 +43,7 @@ use tari_template_lib::{ prelude::{ComponentAddress, ResourceAddress}, resource::TOKEN_SYMBOL, }; -use tari_transaction::Transaction; +use tari_transaction::{Transaction, UnsignedTransaction}; use tari_transaction_manifest::{parse_manifest, ManifestValue}; use tari_validator_node_cli::command::transaction::CliArg; use tari_wallet_daemon_client::{ @@ -55,6 +59,7 @@ use tari_wallet_daemon_client::{ ClaimValidatorFeesRequest, ClaimValidatorFeesResponse, ConfidentialTransferRequest, + ListAccountNftRequest, MintAccountNftRequest, ProofsGenerateRequest, RevealFundsRequest, @@ -67,7 +72,7 @@ use tari_wallet_daemon_client::{ }; use tokio::time::timeout; -use crate::{validator_node_cli::add_substate_ids, TariWorld}; +use crate::{helpers::get_address_from_output, validator_node_cli::add_substate_ids, TariWorld}; pub async fn claim_burn( world: &mut TariWorld, @@ -146,7 +151,6 @@ pub async fn reveal_burned_funds(world: &mut TariWorld, account_name: String, am assert!(wait_resp.result.unwrap().result.is_accept()); } -#[allow(clippy::too_many_arguments)] pub async fn transfer_confidential( world: &mut TariWorld, source_account_name: String, @@ -318,7 +322,7 @@ pub async fn create_account_with_free_coins( pub async fn mint_new_nft_on_account( world: &mut TariWorld, - _nft_name: String, + nft_name: String, account_name: String, wallet_daemon_name: String, existing_nft_component: Option, @@ -328,7 +332,7 @@ pub async fn mint_new_nft_on_account( let metadata = metadata.unwrap_or_else(|| { serde_json::json!({ - TOKEN_SYMBOL: "MY_NFT", + TOKEN_SYMBOL: nft_name, "name": "TariProject", "departure": "Now", "landing_on": "Moon" @@ -363,6 +367,26 @@ pub async fn mint_new_nft_on_account( ); } +pub async fn list_account_nfts( + world: &mut TariWorld, + account_name: String, + wallet_daemon_name: String, +) -> Vec { + let mut client = get_auth_wallet_daemon_client(world, &wallet_daemon_name).await; + + let request = ListAccountNftRequest { + account: Some(ComponentAddressOrName::Name(account_name.clone())), + limit: 100, + offset: 0, + }; + let submit_resp = client + .list_account_nfts(request) + .await + .expect("Failed to list account NFTs"); + + submit_resp.nfts +} + pub async fn get_balance(world: &mut TariWorld, account_name: &str, wallet_daemon_name: &str) -> i64 { let account_name = ComponentAddressOrName::Name(account_name.to_string()); let get_balance_req = AccountsGetBalancesRequest { @@ -513,7 +537,8 @@ pub async fn submit_manifest( .map(|(_, addr)| addr.clone()) .collect::>(); - let instructions = parse_manifest(&manifest_content, globals, HashMap::new()).unwrap(); + let instructions = parse_manifest(&manifest_content, globals, HashMap::new()) + .unwrap_or_else(|_| panic!("Attempted to parse manifest but failed")); let transaction_submit_req = TransactionSubmitRequest { transaction: None, @@ -605,7 +630,12 @@ pub async fn create_component( let template_address = world .templates .get(&template_name) - .unwrap_or_else(|| panic!("Template not found with name {}", template_name)) + .unwrap_or_else(|| { + panic!( + "Create component failed, template not found with name {}", + template_name + ) + }) .address; let args = args.iter().map(|a| CliArg::from_str(a).unwrap().into_arg()).collect(); let AccountGetResponse { account, .. } = client @@ -656,6 +686,99 @@ pub async fn create_component( ); } +pub async fn call_component( + world: &mut TariWorld, + account_name: String, + output_ref: String, + wallet_daemon_name: String, + function_call: String, +) -> anyhow::Result { + let mut client = get_auth_wallet_daemon_client(world, &wallet_daemon_name).await; + + let source_component_address = get_address_from_output(world, output_ref.clone()) + .as_component_address() + .expect("Failed to get component address from output"); + + let account = get_account_from_name(&mut client, account_name).await; + let account_component_address = account + .address + .as_component_address() + .expect("Failed to get account component address"); + + let tx = Transaction::builder() + .fee_transaction_pay_from_component(account_component_address, Amount(1)) + .call_method(source_component_address, &function_call, vec![]) + .build_unsigned_transaction(); + + let resp = submit_unsigned_tx_and_wait_for_response(client, tx, vec![], account).await; + + add_substate_ids( + world, + output_ref, + &resp + .as_ref() + .unwrap() + .clone() + .result + .expect("Call component transaction has timed out") + .result + .expect("Call component transaction has failed"), + ); + + resp +} + +pub async fn concurrent_call_component( + world: &mut TariWorld, + account_name: String, + output_ref: String, + wallet_daemon_name: String, + function_call: String, + times: usize, +) -> anyhow::Result<()> { + let mut client = get_auth_wallet_daemon_client(world, &wallet_daemon_name).await; + + let source_component_address = get_address_from_output(world, output_ref.clone()) + .as_component_address() + .expect("Failed to get component address from output"); + + let account = get_account_from_name(&mut client, account_name).await; + let account_component_address = account + .address + .as_component_address() + .expect("Failed to get account component address"); + + let mut handles = Vec::new(); + for _ in 0..times { + let acc = account.clone(); + let clt = client.clone(); + let tx = Transaction::builder() + .fee_transaction_pay_from_component(account_component_address, Amount(1)) + .call_method(source_component_address, &function_call, vec![]) + .build_unsigned_transaction(); + let handle = tokio::spawn(submit_unsigned_tx_and_wait_for_response(clt, tx, vec![], acc)); + handles.push(handle); + } + + let mut last_resp = None; + for handle in handles { + let result = handle.await.map_err(|e| e.to_string()); + if result.is_err() { + bail!("{}", result.as_ref().unwrap_err()); + } + match result { + Ok(response) => last_resp = Some(response), + Err(e) => bail!("Failed to get response from handler: {}", e), + } + } + + if last_resp.is_none() { + bail!("No responses from any of the wallet daemon concurrent calls"); + } + + Ok(()) +} + pub async fn transfer( world: &mut TariWorld, account_name: String, @@ -721,3 +844,55 @@ pub async fn get_auth_wallet_daemon_client(world: &TariWorld, wallet_daemon_name .get_authed_client() .await } + +async fn get_account_from_name(client: &mut WalletDaemonClient, account_name: String) -> Account { + let source_account_name = ComponentAddressOrName::Name(account_name.clone()); + let AccountGetResponse { account, .. } = + client + .accounts_get(source_account_name.clone()) + .await + .unwrap_or_else(|e| { + panic!( + "Failed to get account with name {}. Error: {:?}", + source_account_name, e + ) + }); + account +} + +async fn submit_unsigned_tx_and_wait_for_response( + mut client: WalletDaemonClient, + tx: UnsignedTransaction, + inputs: Vec, + account: Account, +) -> anyhow::Result { + let submit_req = TransactionSubmitRequest { + transaction: Some(tx), + signing_key_index: Some(account.key_index), + inputs, + override_inputs: false, + is_dry_run: false, + proof_ids: vec![], + // TODO: remove + fee_instructions: vec![], + instructions: vec![], + min_epoch: None, + max_epoch: None, + }; + + let submit_resp = client.submit_transaction(submit_req).await?; + let wait_req = TransactionWaitResultRequest { + transaction_id: submit_resp.transaction_id, + timeout_secs: Some(120), + }; + let resp = client + .wait_transaction_result(wait_req) + .await + .map_err(|e| anyhow::Error::msg(e.to_string()))?; + + if let Some(reason) = resp.result.as_ref().and_then(|finalize| finalize.reject()) { + bail!("Calling component result rejected: {}", reason); + } + + Ok(resp) +} diff --git a/integration_tests/tests/cucumber.rs b/integration_tests/tests/cucumber.rs index f278b96d1f..50abc04d5e 100644 --- a/integration_tests/tests/cucumber.rs +++ b/integration_tests/tests/cucumber.rs @@ -155,6 +155,30 @@ async fn call_template_constructor_via_wallet_daemon( // tokio::time::sleep(Duration::from_secs(4)).await; } +#[when( + expr = r#"I call function "{word}" on template "{word}" using account {word} to pay fees via wallet daemon {word} named "{word}""# +)] +async fn call_template_constructor_via_wallet_daemon_no_args( + world: &mut TariWorld, + function_call: String, + template_name: String, + account_name: String, + wallet_daemon_name: String, + outputs_name: String, +) { + wallet_daemon_cli::create_component( + world, + outputs_name, + template_name, + account_name, + wallet_daemon_name, + function_call, + vec![], + None, + None, + ) + .await; +} #[when(expr = r#"I call function "{word}" on template "{word}" on {word} with args "{word}" named "{word}""#)] async fn call_template_constructor( world: &mut TariWorld, @@ -302,6 +326,75 @@ async fn call_component_method_and_check_result( // tokio::time::sleep(Duration::from_secs(4)).await; } +#[when( + expr = r#"I invoke on wallet daemon {word} on account {word} on component {word} the method call "{word}" the result is "{word}""# +)] +async fn call_wallet_daemon_method_and_check_result( + world: &mut TariWorld, + wallet_daemon_name: String, + account_name: String, + output_ref: String, + method_call: String, + expected_result: String, +) -> anyhow::Result<()> { + let resp = + wallet_daemon_cli::call_component(world, account_name, output_ref, wallet_daemon_name, method_call).await?; + + let finalize_result = resp + .result + .clone() + .unwrap_or_else(|| panic!("Failed to unwrap result from response: {:?}", resp)); + let result = finalize_result + .execution_results + .first() + .unwrap_or_else(|| panic!("Failed to call first() on results: {:?}", resp)); + match result.return_type { + Type::U32 => { + let u32_result: u32 = result.decode().unwrap(); + assert_eq!(u32_result.to_string(), expected_result); + }, + _ => todo!(), + }; + + Ok(()) +} + +#[when(expr = r#"I invoke on wallet daemon {word} on account {word} on component {word} the method call "{word}""#)] +async fn call_wallet_daemon_method( + world: &mut TariWorld, + wallet_daemon_name: String, + account_name: String, + output_ref: String, + method_call: String, +) -> anyhow::Result<()> { + wallet_daemon_cli::call_component(world, account_name, output_ref, wallet_daemon_name, method_call).await?; + + Ok(()) +} + +#[when( + expr = r#"I invoke on wallet daemon {word} on account {word} on component {word} the method call "{word}" concurrently {int} times"# +)] +async fn call_wallet_daemon_method_concurrently( + world: &mut TariWorld, + wallet_daemon_name: String, + account_name: String, + output_ref: String, + method_call: String, + times: usize, +) { + wallet_daemon_cli::concurrent_call_component( + world, + account_name, + output_ref, + wallet_daemon_name, + method_call, + times, + ) + .await + .unwrap_or_else(|e| panic!("Concurrent wallet daemon call failed: {:?}", e)); +} + #[when( expr = "I invoke on all validator nodes on component {word} the method call \"{word}\" the result is \"{word}\"" )] @@ -433,6 +526,12 @@ async fn mint_new_nft_on_account( wallet_daemon_cli::mint_new_nft_on_account(world, nft_name, account_name, wallet_daemon_name, None, None).await; } +#[when(expr = r#"I list all non fungible tokens on {word} using wallet daemon {word} the amount is {word}"#)] +async fn list_nfts_on_account(world: &mut TariWorld, account_name: String, wallet_daemon_name: String, amount: usize) { + let nfts = wallet_daemon_cli::list_account_nfts(world, account_name, wallet_daemon_name).await; + assert_eq!(amount, nfts.len()); +} + #[when(expr = "I mint a new non fungible token {word} on {word} using wallet daemon with metadata {word}")] async fn mint_new_nft_on_account_with_metadata( world: &mut TariWorld, diff --git a/integration_tests/tests/features/concurrency.feature.ignore b/integration_tests/tests/features/concurrency.feature.ignore index 71b6e8483c..5a094f0b0c 100644 --- a/integration_tests/tests/features/concurrency.feature.ignore +++ b/integration_tests/tests/features/concurrency.feature.ignore @@ -1,46 +1,51 @@ # Copyright 2024 The Tari Project # SPDX-License-Identifier: BSD-3-Clause -@concurrency +@concurrency @doit Feature: Concurrency @serial Scenario: Concurrent calls to the Counter template - Given fees are disabled + + ##### Setup # Initialize a base node, wallet, miner and VN + Given fees are disabled Given a base node BASE Given a wallet WALLET connected to base node BASE Given a miner MINER connected to base node BASE and wallet WALLET - # Initialize a VN - Given a validator node VAL_1 connected to base node BASE and wallet daemon WALLET_D + # Initialize a validator node + Given a validator node VN connected to base node BASE and wallet daemon WALLET_D - # The wallet must have some funds before the VN sends transactions - When miner MINER mines 6 new blocks - When wallet WALLET has at least 20 T + # Fund wallet to send VN registration tx + When miner MINER mines 10 new blocks + When wallet WALLET has at least 2000 T + When validator node VN sends a registration transaction to base wallet WALLET + When miner MINER mines 16 new blocks + Then the validator node VN is listed as registered - # VN registration - When validator node VAL_1 sends a registration transaction to base wallet WALLET + # Initialize indexer and connect wallet daemon + Given an indexer IDX connected to base node BASE + Given a wallet daemon WALLET_D connected to indexer IDX # Register the "counter" template When base wallet WALLET registers the template "counter" - When miner MINER mines 13 new blocks - Then VAL_1 has scanned to height 16 - Then the validator node VAL_1 is listed as registered - Then the template "counter" is listed as registered by the validator node VAL_1 + When miner MINER mines 20 new blocks + Then VN has scanned to height 43 - # A file-base CLI account must be created to sign future calls - When I use an account key named K1 + # Create the sender account + When I create an account ACC via the wallet daemon WALLET_D with 10000 free coins - # Create a new Counter component - When I create a component COUNTER_1 of template "counter" on VAL_1 using "new" - When I print the cucumber world + ##### Scenario + # The initial value of the counter must be 0 + When I call function "new" on template "counter" using account ACC to pay fees via wallet daemon WALLET_D named "COUNTER" + When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "value" the result is "0" # Send multiple concurrent transactions to increase the counter - # TODO: when concurrency is fully working, call it with "2 times" or higher - When I invoke on VAL_1 on component COUNTER_1/components/Counter the method call "increase" concurrently 1 times - When I print the cucumber world + # Currently there is a lock bug where the subsequent transactions executed are being rejected, should be tested later after engine changes: + # Reject(FailedToLockInputs("Failed to Write lock substate component_459d...4443c:1 due to conflict with existing Write lock")) + When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "increase" concurrently 2 times # Check that the counter has been increased - # TODO: uncomment when concurrency is fully working - # When I invoke on VAL_1 on component TX1/components/Counter the method call "value" the result is "2" \ No newline at end of file + # Note: this is currently not working together with the previous test case when times > 1, only the first transaction is being executed properly + When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "value" the result is "2" diff --git a/integration_tests/tests/features/counter.feature b/integration_tests/tests/features/counter.feature new file mode 100644 index 0000000000..e93f75ee06 --- /dev/null +++ b/integration_tests/tests/features/counter.feature @@ -0,0 +1,50 @@ +# Copyright 2024 The Tari Project +# SPDX-License-Identifier: BSD-3-Clause + +@counter +Feature: Counter template + + @serial + Scenario: Counter template registration and invocation + + # Initialize a base node, wallet, miner and VN + Given fees are disabled + Given a base node BASE + Given a wallet WALLET connected to base node BASE + Given a miner MINER connected to base node BASE and wallet WALLET + + # Initialize a validator node + Given a validator node VN connected to base node BASE and wallet daemon WALLET_D + + # Fund wallet to send VN registration tx + When miner MINER mines 10 new blocks + When wallet WALLET has at least 2000 T + When validator node VN sends a registration transaction to base wallet WALLET + When miner MINER mines 16 new blocks + Then the validator node VN is listed as registered + + # Initialize indexer and connect wallet daemon + Given an indexer IDX connected to base node BASE + Given a wallet daemon WALLET_D connected to indexer IDX + + # Register the "counter" template + When base wallet WALLET registers the template "counter" + When miner MINER mines 20 new blocks + Then VN has scanned to height 43 + + # Create the sender account + When I create an account ACC via the wallet daemon WALLET_D with 10000 free coins + + # The initial value of the counter must be 0 + When I call function "new" on template "counter" using account ACC to pay fees via wallet daemon WALLET_D named "COUNTER" + When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "value" the result is "0" + + # Increase the counter + When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "increase" + + # Check that the counter has been increased + When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "value" the result is "1" + +# Uncomment the following lines to stop execution for manual inspection of the nodes +# When I print the cucumber world +# When I wait 5000 seconds diff --git a/integration_tests/tests/features/counter.feature.ignore b/integration_tests/tests/features/counter.feature.ignore deleted file mode 100644 index 50a42d086e..0000000000 --- a/integration_tests/tests/features/counter.feature.ignore +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2022 The Tari Project -# SPDX-License-Identifier: BSD-3-Clause - - # TODO: Ignored, no inputs - replace with wallet daemon calls -@counter -Feature: Counter template - - @serial - Scenario: Counter template registration and invocation - Given fees are disabled - # Initialize a base node, wallet, miner and VN - Given a base node BASE - Given a wallet WALLET connected to base node BASE - Given a miner MINER connected to base node BASE and wallet WALLET - - # Initialize a VN - Given a validator node VAL_1 connected to base node BASE and wallet daemon WALLET_D - - # The wallet must have some funds before the VN sends transactions - When miner MINER mines 6 new blocks - When wallet WALLET has at least 20 T - - # VN registration - When validator node VAL_1 sends a registration transaction to base wallet WALLET - - # Register the "counter" template - When base wallet WALLET registers the template "counter" - When miner MINER mines 13 new blocks - Then VAL_1 has scanned to height 16 - Then the validator node VAL_1 is listed as registered - Then the template "counter" is listed as registered by the validator node VAL_1 - - # A file-base CLI account must be created to sign future calls - When I use an account key named K1 - - # Create a new Counter component - When I create a component COUNTER_1 of template "counter" on VAL_1 using "new" - When I print the cucumber world - - # The initial value of the counter must be 0 - When I invoke on VAL_1 on component COUNTER_1/components/Counter the method call "value" the result is "0" - When I print the cucumber world - - # Increase the counter - When I invoke on VAL_1 on component COUNTER_1/components/Counter the method call "increase" named "TX1" - When I print the cucumber world - - # Check that the counter has been increased - When I invoke on VAL_1 on component TX1/components/Counter the method call "value" the result is "1" -# When I print the cucumber world - -# Uncomment the following lines to stop execution for manual inspection of the nodes -# When I print the cucumber world -# When I wait 5000 seconds - - diff --git a/integration_tests/tests/features/fungible.feature b/integration_tests/tests/features/fungible.feature new file mode 100644 index 0000000000..a9bbbe91fc --- /dev/null +++ b/integration_tests/tests/features/fungible.feature @@ -0,0 +1,68 @@ +# Copyright 2024 The Tari Project +# SPDX-License-Identifier: BSD-3-Clause + +@fungible +Feature: Fungible tokens + + @serial + Scenario: Mint fungible tokens + + ##### Setup + # Initialize a base node, wallet, miner and VN + Given fees are disabled + Given a base node BASE + Given a wallet WALLET connected to base node BASE + Given a miner MINER connected to base node BASE and wallet WALLET + + # Initialize a validator node + Given a validator node VN connected to base node BASE and wallet daemon WALLET_D + + # Fund wallet to send VN registration tx + When miner MINER mines 10 new blocks + When wallet WALLET has at least 2000 T + When validator node VN sends a registration transaction to base wallet WALLET + When miner MINER mines 16 new blocks + Then the validator node VN is listed as registered + + # Initialize indexer and connect wallet daemon + Given an indexer IDX connected to base node BASE + Given a wallet daemon WALLET_D connected to indexer IDX + + # Register the "faucet" template + When base wallet WALLET registers the template "faucet" + When miner MINER mines 20 new blocks + Then VN has scanned to height 43 + Then the template "faucet" is listed as registered by the validator node VN + + ##### Scenario + # Create two accounts to test deposit the tokens + When I create an account ACC1 via the wallet daemon WALLET_D with 10000 free coins + When I create an account ACC2 via the wallet daemon WALLET_D with 10000 free coins + + # Create a new Faucet component + When I call function "mint" on template "faucet" using account ACC1 to pay fees via wallet daemon WALLET_D with args "amount_10000" named "FAUCET" + + # Deposit tokens in first account + When I submit a transaction manifest via wallet daemon WALLET_D with inputs "FAUCET, ACC1" named "TX1" + ``` + let faucet = global!["FAUCET/components/TestFaucet"]; + let mut acc1 = global!["ACC1/components/Account"]; + + // get tokens from the faucet + let faucet_bucket = faucet.take_free_coins(); + acc1.deposit(faucet_bucket); + ``` + + # Move tokens from first to second account + When I submit a transaction manifest via wallet daemon WALLET_D with inputs "FAUCET, TX1, ACC2" named "TX2" + ``` + let mut acc1 = global!["TX1/components/Account"]; + let mut acc2 = global!["ACC2/components/Account"]; + let faucet_resource = global!["FAUCET/resources/0"]; + + // Withdraw 50 of the tokens and send them to acc2 + let tokens = acc1.withdraw(faucet_resource, Amount(50)); + acc2.deposit(tokens); + acc2.balance(faucet_resource); + acc1.balance(faucet_resource); + ``` diff --git a/integration_tests/tests/features/fungible.feature.ignore b/integration_tests/tests/features/fungible.feature.ignore deleted file mode 100644 index 8b19ef0bf0..0000000000 --- a/integration_tests/tests/features/fungible.feature.ignore +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2022 The Tari Project -# SPDX-License-Identifier: BSD-3-Clause - - # TODO: Ignored, no inputs - replace with wallet daemon calls -@fungible -Feature: Fungible tokens - - @serial - Scenario: Mint fungible tokens - Given fees are disabled - # Initialize a base node, wallet, miner and VN - Given a base node BASE - Given a wallet WALLET connected to base node BASE - Given a miner MINER connected to base node BASE and wallet WALLET - - # Initialize a VN - Given a validator node VN connected to base node BASE and wallet daemon WALLET_D - When miner MINER mines 6 new blocks - When wallet WALLET has at least 10000 T - When validator node VN sends a registration transaction to base wallet WALLET - # Register the "faucet" template - When base wallet WALLET registers the template "faucet" - # Mine some blocks until the UTXOs are scanned - When miner MINER mines 14 new blocks - Then VN has scanned to height 17 - Then the validator node VN is listed as registered - Then the template "faucet" is listed as registered by the validator node VN - - # A file-base CLI account must be created to sign future calls - When I use an account key named K1 - - # Create a new Faucet component - When I call function "mint" on template "faucet" on VN with args "amount_10000" named "FAUCET" - - # Create two accounts to test sending the tokens - When I create an account ACC_1 on VN - When I create an account ACC_2 on VN - - # Submit a transaction manifest - # When I print the cucumber world - When I submit a transaction manifest on VN with inputs "FAUCET, ACC_1" named "TX1" signed with key ACC_1 - ``` - let faucet = global!["FAUCET/components/TestFaucet"]; - let mut acc1 = global!["ACC_1/components/Account"]; - - // get tokens from the faucet - let faucet_bucket = faucet.take_free_coins(); - acc1.deposit(faucet_bucket); - ``` - # When I print the cucumber world - # Submit a transaction manifest - When I submit a transaction manifest on VN with inputs "FAUCET, TX1, ACC_2" named "TX2" signed with key ACC_1 -``` -let mut acc1 = global!["TX1/components/Account"]; -let mut acc2 = global!["ACC_2/components/Account"]; -let faucet_resource = global!["FAUCET/resources/0"]; - -// Withdraw 50 of the tokens and send them to acc2 -let tokens = acc1.withdraw(faucet_resource, Amount(50)); -acc2.deposit(tokens); -acc2.balance(faucet_resource); -acc1.balance(faucet_resource); -``` diff --git a/integration_tests/tests/features/nft.feature.ignore b/integration_tests/tests/features/nft.feature similarity index 58% rename from integration_tests/tests/features/nft.feature.ignore rename to integration_tests/tests/features/nft.feature index 17f80a0a49..742f40b68c 100644 --- a/integration_tests/tests/features/nft.feature.ignore +++ b/integration_tests/tests/features/nft.feature @@ -1,4 +1,4 @@ -# Copyright 2022 The Tari Project +# Copyright 2024 The Tari Project # SPDX-License-Identifier: BSD-3-Clause @nft @@ -6,41 +6,51 @@ Feature: NFTs @serial Scenario: Mint, mutate and burn non fungible tokens - Given fees are disabled + + ###### Setup # Initialize a base node, wallet, miner and VN + Given fees are disabled Given a base node BASE Given a wallet WALLET connected to base node BASE Given a miner MINER connected to base node BASE and wallet WALLET - # Initialize a VN + # Initialize a validator node Given a validator node VN connected to base node BASE and wallet daemon WALLET_D - # The wallet must have some funds before the VN sends transactions - When miner MINER mines 7 new blocks - When wallet WALLET has at least 10000 T - - # VN registration + # Fund wallet to send VN registration tx + When miner MINER mines 10 new blocks + When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET + When miner MINER mines 16 new blocks + Then the validator node VN is listed as registered + + # Initialize indexer and connect wallet daemon + Given an indexer IDX connected to base node BASE + Given a wallet daemon WALLET_D connected to indexer IDX # Register the "basic_nft" template When base wallet WALLET registers the template "basic_nft" - When miner MINER mines 13 new blocks - Then VN has scanned to height 17 - Then the validator node VN is listed as registered + When miner MINER mines 20 new blocks + Then VN has scanned to height 43 Then the template "basic_nft" is listed as registered by the validator node VN - # A file-base CLI account must be created to sign future calls - When I use an account key named K1 + ###### Scenario + # Create two accounts to deposit the minted NFTs + When I create an account ACC1 via the wallet daemon WALLET_D with 10000 free coins + When I create an account ACC2 via the wallet daemon WALLET_D with 10000 free coins + + # Mint a basic NFT + When I mint a new non fungible token NFT_X on ACC1 using wallet daemon WALLET_D - # Create an account to deposit the minted nfts - When I create an account ACC1 on VN - When I create an account ACC2 on VN + # Check that a new NFT_X has been minted for ACC1 + # TODO: investigate flaky test + #When I list all non fungible tokens on ACC1 using wallet daemon WALLET_D the amount is 1 - # Create a new BasicNft component - When I call function "new" on template "basic_nft" on VN named "NFT" + # Create instance of the basic NFT template + When I call function "new" on template "basic_nft" using account ACC1 to pay fees via wallet daemon WALLET_D named "NFT" # Submit a transaction with NFT operations - When I submit a transaction manifest on VN with inputs "NFT, ACC1, ACC2" named "TX1" signed with key ACC1 + When I submit a transaction manifest via wallet daemon WALLET_D with inputs "NFT, ACC1, ACC2" named "TX1" ``` let sparkle_nft = global!["NFT/components/SparkleNft"]; let sparkle_res = global!["NFT/resources/0"]; @@ -68,42 +78,49 @@ Feature: NFTs let acc_bucket = acc1.withdraw_non_fungible(sparkle_res, NonFungibleId("Burn!")); sparkle_nft.burn(acc_bucket); ``` - When I print the cucumber world @serial Scenario: Create resource and mint in one transaction - Given fees are disabled + + ##### Setup # Initialize a base node, wallet, miner and VN + Given fees are disabled Given a base node BASE Given a wallet WALLET connected to base node BASE Given a miner MINER connected to base node BASE and wallet WALLET - # Initialize a VN + # Initialize a validator node Given a validator node VN connected to base node BASE and wallet daemon WALLET_D - # The wallet must have some funds before the VN sends transactions - When miner MINER mines 7 new blocks - When wallet WALLET has at least 10000 T - - # VN registration + # Fund wallet to send VN registration tx + When miner MINER mines 10 new blocks + When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET + When miner MINER mines 16 new blocks + Then the validator node VN is listed as registered + + # Initialize indexer and connect wallet daemon + Given an indexer IDX connected to base node BASE + Given a wallet daemon WALLET_D connected to indexer IDX + # Register the "basic_nft" template When base wallet WALLET registers the template "basic_nft" - When miner MINER mines 13 new blocks - Then VN has scanned to height 17 - Then the validator node VN is listed as registered + When miner MINER mines 20 new blocks + Then VN has scanned to height 43 Then the template "basic_nft" is listed as registered by the validator node VN - # A file-base CLI account must be created to sign future calls - When I use an account key named K1 - # Create a new BasicNft component and mint in the same transaction - When I call function "new_with_initial_nft" on template "basic_nft" on VN with args "nft_str:1000" named "NFT" + ###### Scenario + # Create an account to deposit the minted NFT + When I create an account ACC1 via the wallet daemon WALLET_D with 10000 free coins + + # Create a new BasicNft component and mint in the same transaction. + # Note the updated NFT address format or parsing the manifest will fail. + When I call function "new_with_initial_nft" on template "basic_nft" using account ACC1 to pay fees via wallet daemon WALLET_D with args "nft_str_1000" named "NFT" # Check that the initial NFT was actually minted by trying to deposit it into an account - When I create an account ACC1 on VN - When I submit a transaction manifest on VN with inputs "NFT, ACC1" named "TX1" signed with key ACC1 + When I submit a transaction manifest via wallet daemon WALLET_D with inputs "NFT, ACC1" named "TX1" ``` let sparkle_nft = global!["NFT/components/SparkleNft"]; let mut acc1 = global!["ACC1/components/Account"]; @@ -112,6 +129,3 @@ Feature: NFTs let nft_bucket = sparkle_nft.take_initial_nft(); acc1.deposit(nft_bucket); ``` - - When I print the cucumber world -