diff --git a/.prettierrc b/.prettierrc index e5356537f3..b302ba926d 100644 --- a/.prettierrc +++ b/.prettierrc @@ -8,5 +8,5 @@ "bracketSpacing": true, "bracketSameLine": false, "arrowParens": "always", - "endOfLine": "lf" + "endOfLine": "auto" } diff --git a/Cargo.lock b/Cargo.lock index f37f52a4b8..c040383910 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9128,6 +9128,7 @@ dependencies = [ "tari_crypto", "tari_engine_types", "tari_mmr", + "ts-rs", ] [[package]] @@ -9202,6 +9203,7 @@ dependencies = [ "tari_transaction", "thiserror", "time", + "ts-rs", ] [[package]] @@ -9337,6 +9339,7 @@ dependencies = [ "tari_utilities", "tempfile", "thiserror", + "ts-rs", "zeroize", ] @@ -9382,6 +9385,7 @@ dependencies = [ "tari_template_lib", "tari_utilities", "thiserror", + "ts-rs", ] [[package]] @@ -9473,6 +9477,7 @@ dependencies = [ "tari_engine_types", "tari_transaction", "thiserror", + "ts-rs", ] [[package]] @@ -9796,6 +9801,7 @@ dependencies = [ "hashbrown 0.13.2", "serde", "tari_bor", + "ts-rs", ] [[package]] @@ -9816,6 +9822,7 @@ dependencies = [ "tari_bor", "tari_template_abi", "tari_template_macros", + "ts-rs", ] [[package]] @@ -9874,6 +9881,7 @@ dependencies = [ "tari_engine_types", "tari_template_lib", "thiserror", + "ts-rs", ] [[package]] @@ -10013,6 +10021,7 @@ dependencies = [ "tari_engine_types", "tari_transaction", "thiserror", + "ts-rs", ] [[package]] @@ -10051,6 +10060,7 @@ dependencies = [ "tari_template_lib", "tari_transaction", "thiserror", + "ts-rs", ] [[package]] @@ -10678,6 +10688,31 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "ts-rs" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2cae1fc5d05d47aa24b64f9a4f7cba24cdc9187a2084dd97ac57bef5eccae6" +dependencies = [ + "chrono", + "indexmap 2.1.0", + "thiserror", + "ts-rs-macros", +] + +[[package]] +name = "ts-rs-macros" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f7f9b821696963053a89a7bd8b292dc34420aea8294d7b225274d488f3ec92" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn 2.0.48", + "termcolor", +] + [[package]] name = "tui" version = "0.16.0" diff --git a/Cargo.toml b/Cargo.toml index 4e8acb65e4..73a16511ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -214,6 +214,11 @@ tower = "0.4" tower-http = { version = "0.3.5", default-features = false } tower-layer = "0.3" tracing = "0.1.40" +ts-rs = { version = "7.1", features = [ + "chrono-impl", + "no-serde-warnings", + "indexmap-impl", +] } url = "2.4.1" wasmer = "2.3.0" wasmer-middlewares = "2.3.0" diff --git a/applications/tari_dan_wallet_daemon/Cargo.toml b/applications/tari_dan_wallet_daemon/Cargo.toml index 82493dbc1d..c7747408cf 100644 --- a/applications/tari_dan_wallet_daemon/Cargo.toml +++ b/applications/tari_dan_wallet_daemon/Cargo.toml @@ -70,3 +70,6 @@ ignored = [ # Want to enable some log4rs features "log4rs", ] + +[features] +ts = [] # this is just for the build script to skip the build diff --git a/applications/tari_dan_wallet_daemon/build.rs b/applications/tari_dan_wallet_daemon/build.rs index bab680544b..2c8c1f8f74 100644 --- a/applications/tari_dan_wallet_daemon/build.rs +++ b/applications/tari_dan_wallet_daemon/build.rs @@ -20,11 +20,17 @@ // 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::process::Command; +use std::{env, process::Command}; fn main() -> Result<(), Box> { println!("cargo:rerun-if-changed=../tari_dan_wallet_web_ui/src"); println!("cargo:rerun-if-changed=../tari_dan_wallet_web_ui/public"); + + if env::var_os("CARGO_FEATURE_TS").is_some() { + println!("cargo:warning=The web ui is not being compiled when we are generating typescript types/interfaces."); + return Ok(()); + } + let npm = if cfg!(windows) { "npm.cmd" } else { "npm" }; if let Err(error) = Command::new(npm) diff --git a/applications/tari_dan_wallet_web_ui/dist/.gitkeep b/applications/tari_dan_wallet_web_ui/dist/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/tari_dan_wallet_web_ui/public/.gitkeep b/applications/tari_dan_wallet_web_ui/public/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/tari_indexer/Cargo.toml b/applications/tari_indexer/Cargo.toml index 5f58f32db8..8d9ed14511 100644 --- a/applications/tari_indexer/Cargo.toml +++ b/applications/tari_indexer/Cargo.toml @@ -74,3 +74,6 @@ ignored = [ # Want to enable some log4rs features "log4rs", ] + +[features] +ts = [] # this is just for the build script to skip the build diff --git a/applications/tari_indexer/build.rs b/applications/tari_indexer/build.rs index ddef153817..a499abcc1c 100644 --- a/applications/tari_indexer/build.rs +++ b/applications/tari_indexer/build.rs @@ -20,11 +20,17 @@ // 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::process::Command; +use std::{env, process::Command}; fn main() -> Result<(), Box> { println!("cargo:rerun-if-changed=../tari_indexer_web_ui/src"); println!("cargo:rerun-if-changed=../tari_indexer_web_ui/public"); + + if env::var_os("CARGO_FEATURE_TS").is_some() { + println!("cargo:warning=The web ui is not being compiled when we are generating typescript types/interfaces."); + return Ok(()); + } + let npm = if cfg!(windows) { "npm.cmd" } else { "npm" }; if let Err(error) = Command::new(npm) diff --git a/applications/tari_indexer_web_ui/.gitignore b/applications/tari_indexer_web_ui/.gitignore index 4d29575de8..7839353416 100644 --- a/applications/tari_indexer_web_ui/.gitignore +++ b/applications/tari_indexer_web_ui/.gitignore @@ -9,7 +9,8 @@ /coverage # production -/build +build/* +!build/.gitkeep # misc .DS_Store diff --git a/applications/tari_indexer_web_ui/build/.gitkeep b/applications/tari_indexer_web_ui/build/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/tari_indexer_web_ui/public/.gitkeep b/applications/tari_indexer_web_ui/public/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/tari_validator_node/Cargo.toml b/applications/tari_validator_node/Cargo.toml index 3e1cea4d89..cd8d49bf7d 100644 --- a/applications/tari_validator_node/Cargo.toml +++ b/applications/tari_validator_node/Cargo.toml @@ -13,7 +13,9 @@ minotari_app_utilities = { workspace = true } minotari_wallet_grpc_client = { workspace = true } tari_common = { workspace = true } tari_common_types = { workspace = true } -tari_core = { workspace = true, default-features = false, features = ["transactions"] } +tari_core = { workspace = true, default-features = false, features = [ + "transactions", +] } tari_crypto = { workspace = true } tari_validator_node_rpc = { workspace = true } tari_dan_app_utilities = { workspace = true } @@ -86,3 +88,6 @@ ignored = [ # Want to enable some log4rs features "log4rs", ] + +[features] +ts = [] # this is just for the build script to skip the build diff --git a/applications/tari_validator_node/build.rs b/applications/tari_validator_node/build.rs index 969dff2349..2496912538 100644 --- a/applications/tari_validator_node/build.rs +++ b/applications/tari_validator_node/build.rs @@ -20,11 +20,17 @@ // 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::process::Command; +use std::{env, process::Command}; fn main() -> Result<(), Box> { println!("cargo:rerun-if-changed=../tari_validator_node_web_ui/src"); println!("cargo:rerun-if-changed=../tari_validator_node_web_ui/public"); + + if env::var_os("CARGO_FEATURE_TS").is_some() { + println!("cargo:warning=The web ui is not being compiled when we are generating typescript types/interfaces."); + return Ok(()); + } + let npm = if cfg!(windows) { "npm.cmd" } else { "npm" }; if let Err(error) = Command::new(npm) diff --git a/applications/tari_validator_node_web_ui/build/.gitkeep b/applications/tari_validator_node_web_ui/build/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/tari_validator_node_web_ui/public/.gitkeep b/applications/tari_validator_node_web_ui/public/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bindings/build.sh b/bindings/build.sh new file mode 100644 index 0000000000..03770ce132 --- /dev/null +++ b/bindings/build.sh @@ -0,0 +1,31 @@ +cargo test --workspace --exclude integration_tests export_bindings --features ts +shx mv ../dan_layer/bindings/src/types/* ./src/types/ +shx rm -rf ../dan_layer/bindings/ +DIRECTORY_PATH="./src/types" # replace with your directory path +HELPERS_PATH="./src/helpers" # replace with your directory path +INDEX_FILE="./index.ts" + +# Remove the index file if it exists +if [ -f "$INDEX_FILE" ]; then + rm "$INDEX_FILE" +fi + +# Generate the index file +for file in $(find $DIRECTORY_PATH -name "*.ts"); do + FILE_NAME=$(basename $file) + if [ "$FILE_NAME" != "index.ts" ]; then + MODULE_NAME="${FILE_NAME%.*}" + echo "export * from '$DIRECTORY_PATH/$MODULE_NAME';" >> $INDEX_FILE + fi +done + +# Add helpers +for file in $(find $HELPERS_PATH -name "*.ts"); do + FILE_NAME=$(basename $file) + if [ "$FILE_NAME" != "index.ts" ]; then + MODULE_NAME="${FILE_NAME%.*}" + echo "export * from '$HELPERS_PATH/$MODULE_NAME';" >> $INDEX_FILE + fi +done + +npx prettier --write "./**/*.{ts,tsx,css,json}" --log-level=warn diff --git a/bindings/index.ts b/bindings/index.ts new file mode 100644 index 0000000000..7a7dba5780 --- /dev/null +++ b/bindings/index.ts @@ -0,0 +1,233 @@ +export * from "./src/types/AccessRule"; +export * from "./src/types/Account"; +export * from "./src/types/AccountGetDefaultRequest"; +export * from "./src/types/AccountGetRequest"; +export * from "./src/types/AccountGetResponse"; +export * from "./src/types/AccountInfo"; +export * from "./src/types/AccountNftInfo"; +export * from "./src/types/AccountsCreateFreeTestCoinsRequest"; +export * from "./src/types/AccountsCreateFreeTestCoinsResponse"; +export * from "./src/types/AccountsCreateRequest"; +export * from "./src/types/AccountsCreateResponse"; +export * from "./src/types/AccountSetDefaultRequest"; +export * from "./src/types/AccountSetDefaultResponse"; +export * from "./src/types/AccountsGetBalancesRequest"; +export * from "./src/types/AccountsGetBalancesResponse"; +export * from "./src/types/AccountsInvokeRequest"; +export * from "./src/types/AccountsInvokeResponse"; +export * from "./src/types/AccountsListRequest"; +export * from "./src/types/AccountsListResponse"; +export * from "./src/types/AddAddressRequest"; +export * from "./src/types/AddPeerRequest"; +export * from "./src/types/AddPeerResponse"; +export * from "./src/types/Amount"; +export * from "./src/types/Arg"; +export * from "./src/types/ArgDef"; +export * from "./src/types/AuthGetAllJwtRequest"; +export * from "./src/types/AuthGetAllJwtResponse"; +export * from "./src/types/AuthLoginAcceptRequest"; +export * from "./src/types/AuthLoginAcceptResponse"; +export * from "./src/types/AuthLoginDenyRequest"; +export * from "./src/types/AuthLoginDenyResponse"; +export * from "./src/types/AuthLoginRequest"; +export * from "./src/types/AuthLoginResponse"; +export * from "./src/types/AuthRevokeTokenRequest"; +export * from "./src/types/AuthRevokeTokenResponse"; +export * from "./src/types/BalanceEntry"; +export * from "./src/types/BalanceProofSignature"; +export * from "./src/types/Block"; +export * from "./src/types/BlockId"; +export * from "./src/types/BucketId"; +export * from "./src/types/CallInstructionRequest"; +export * from "./src/types/ClaimBurnRequest"; +export * from "./src/types/ClaimBurnResponse"; +export * from "./src/types/Claims"; +export * from "./src/types/ClaimValidatorFeesRequest"; +export * from "./src/types/ClaimValidatorFeesResponse"; +export * from "./src/types/Command"; +export * from "./src/types/CommitteeShard"; +export * from "./src/types/CommitteeShardInfo"; +export * from "./src/types/ComponentAccessRules"; +export * from "./src/types/ComponentAddress"; +export * from "./src/types/ComponentAddressOrName"; +export * from "./src/types/ComponentBody"; +export * from "./src/types/ComponentHeader"; +export * from "./src/types/ConfidentialClaim"; +export * from "./src/types/ConfidentialCreateOutputProofRequest"; +export * from "./src/types/ConfidentialCreateOutputProofResponse"; +export * from "./src/types/ConfidentialOutput"; +export * from "./src/types/ConfidentialOutputProof"; +export * from "./src/types/ConfidentialStatement"; +export * from "./src/types/ConfidentialTransferRequest"; +export * from "./src/types/ConfidentialTransferResponse"; +export * from "./src/types/ConfidentialWithdrawProof"; +export * from "./src/types/Connection"; +export * from "./src/types/ConnectionDirection"; +export * from "./src/types/Decision"; +export * from "./src/types/DeleteAddressRequest"; +export * from "./src/types/DryRunTransactionFinalizeResult"; +export * from "./src/types/EncryptedData"; +export * from "./src/types/Epoch"; +export * from "./src/types/Event"; +export * from "./src/types/Evidence"; +export * from "./src/types/ExecutedTransaction"; +export * from "./src/types/ExecuteResult"; +export * from "./src/types/FeeClaim"; +export * from "./src/types/FeeClaimAddress"; +export * from "./src/types/FeeCostBreakdown"; +export * from "./src/types/FeeReceipt"; +export * from "./src/types/FeeSource"; +export * from "./src/types/FinalizeResult"; +export * from "./src/types/ForeignProposal"; +export * from "./src/types/ForeignProposalState"; +export * from "./src/types/FunctionDef"; +export * from "./src/types/GetAccountNftRequest"; +export * from "./src/types/GetBlockRequest"; +export * from "./src/types/GetBlockResponse"; +export * from "./src/types/GetBlocksCountResponse"; +export * from "./src/types/GetBlocksRequest"; +export * from "./src/types/GetBlocksResponse"; +export * from "./src/types/GetCommitteeRequest"; +export * from "./src/types/GetConnectionsResponse"; +export * from "./src/types/GetEpochManagerStatsResponse"; +export * from "./src/types/GetIdentityResponse"; +export * from "./src/types/GetNetworkCommitteeResponse"; +export * from "./src/types/GetNonFungibleCountRequest"; +export * from "./src/types/GetNonFungiblesRequest"; +export * from "./src/types/GetNonFungiblesResponse"; +export * from "./src/types/GetRecentTransactionsRequest"; +export * from "./src/types/GetRecentTransactionsResponse"; +export * from "./src/types/GetRelatedTransactionsRequest"; +export * from "./src/types/GetRelatedTransactionsResponse"; +export * from "./src/types/GetShardKey"; +export * from "./src/types/GetStateRequest"; +export * from "./src/types/GetStateResponse"; +export * from "./src/types/GetSubstateRequest"; +export * from "./src/types/GetSubstateResponse"; +export * from "./src/types/GetSubstatesByTransactionRequest"; +export * from "./src/types/GetSubstatesByTransactionResponse"; +export * from "./src/types/GetTemplateRequest"; +export * from "./src/types/GetTemplateResponse"; +export * from "./src/types/GetTemplatesRequest"; +export * from "./src/types/GetTemplatesResponse"; +export * from "./src/types/GetTransactionRequest"; +export * from "./src/types/GetTransactionResponse"; +export * from "./src/types/GetTransactionResultRequest"; +export * from "./src/types/GetTransactionResultResponse"; +export * from "./src/types/GetValidatorFeesRequest"; +export * from "./src/types/GetValidatorFeesResponse"; +export * from "./src/types/Hash"; +export * from "./src/types/IndexedValue"; +export * from "./src/types/IndexedWellKnownTypes"; +export * from "./src/types/IndexerTransactionFinalizedResult"; +export * from "./src/types/InspectSubstateRequest"; +export * from "./src/types/InspectSubstateResponse"; +export * from "./src/types/Instruction"; +export * from "./src/types/InstructionResult"; +export * from "./src/types/JrpcPermission"; +export * from "./src/types/JrpcPermissions"; +export * from "./src/types/KeysCreateRequest"; +export * from "./src/types/KeysCreateResponse"; +export * from "./src/types/KeysListRequest"; +export * from "./src/types/KeysListResponse"; +export * from "./src/types/KeysSetActiveRequest"; +export * from "./src/types/KeysSetActiveResponse"; +export * from "./src/types/ListAccountNftRequest"; +export * from "./src/types/ListAccountNftResponse"; +export * from "./src/types/ListBlocksRequest"; +export * from "./src/types/ListBlocksResponse"; +export * from "./src/types/LockFlag"; +export * from "./src/types/LogEntry"; +export * from "./src/types/LogLevel"; +export * from "./src/types/Metadata"; +export * from "./src/types/MintAccountNftRequest"; +export * from "./src/types/MintAccountNftResponse"; +export * from "./src/types/NodeHeight"; +export * from "./src/types/NonFungible"; +export * from "./src/types/NonFungibleAddress"; +export * from "./src/types/NonFungibleAddressContents"; +export * from "./src/types/NonFungibleContainer"; +export * from "./src/types/NonFungibleId"; +export * from "./src/types/NonFungibleIndex"; +export * from "./src/types/NonFungibleIndexAddress"; +export * from "./src/types/NonFungibleSubstate"; +export * from "./src/types/Ordering"; +export * from "./src/types/OwnerRule"; +export * from "./src/types/PedersonCommitmentBytes"; +export * from "./src/types/ProofId"; +export * from "./src/types/ProofsCancelRequest"; +export * from "./src/types/ProofsCancelResponse"; +export * from "./src/types/ProofsFinalizeRequest"; +export * from "./src/types/ProofsFinalizeResponse"; +export * from "./src/types/ProofsGenerateRequest"; +export * from "./src/types/ProofsGenerateResponse"; +export * from "./src/types/QcId"; +export * from "./src/types/QuorumCertificate"; +export * from "./src/types/QuorumDecision"; +export * from "./src/types/RegisterValidatorNodeRequest"; +export * from "./src/types/RegisterValidatorNodeResponse"; +export * from "./src/types/RejectReason"; +export * from "./src/types/RequireRule"; +export * from "./src/types/Resource"; +export * from "./src/types/ResourceAccessRules"; +export * from "./src/types/ResourceAddress"; +export * from "./src/types/ResourceContainer"; +export * from "./src/types/ResourceType"; +export * from "./src/types/RestrictedAccessRule"; +export * from "./src/types/RevealFundsRequest"; +export * from "./src/types/RevealFundsResponse"; +export * from "./src/types/RistrettoPublicKeyBytes"; +export * from "./src/types/RuleRequirement"; +export * from "./src/types/SettingsGetResponse"; +export * from "./src/types/SettingsSetRequest"; +export * from "./src/types/SettingsSetResponse"; +export * from "./src/types/Shard"; +export * from "./src/types/ShardEvidence"; +export * from "./src/types/SubmitTransactionRequest"; +export * from "./src/types/SubmitTransactionResponse"; +export * from "./src/types/Substate"; +export * from "./src/types/SubstateAddress"; +export * from "./src/types/SubstateDestroyed"; +export * from "./src/types/SubstateDiff"; +export * from "./src/types/SubstateId"; +export * from "./src/types/SubstateRecord"; +export * from "./src/types/SubstateRequirement"; +export * from "./src/types/SubstateStatus"; +export * from "./src/types/SubstateValue"; +export * from "./src/types/TemplateAbi"; +export * from "./src/types/TemplateMetadata"; +export * from "./src/types/TemplateRegistrationRequest"; +export * from "./src/types/TemplateRegistrationResponse"; +export * from "./src/types/Transaction"; +export * from "./src/types/TransactionAtom"; +export * from "./src/types/TransactionClaimBurnResponse"; +export * from "./src/types/TransactionGetAllRequest"; +export * from "./src/types/TransactionGetAllResponse"; +export * from "./src/types/TransactionGetRequest"; +export * from "./src/types/TransactionGetResponse"; +export * from "./src/types/TransactionGetResultRequest"; +export * from "./src/types/TransactionGetResultResponse"; +export * from "./src/types/TransactionId"; +export * from "./src/types/TransactionReceipt"; +export * from "./src/types/TransactionReceiptAddress"; +export * from "./src/types/TransactionResult"; +export * from "./src/types/TransactionSignature"; +export * from "./src/types/TransactionStatus"; +export * from "./src/types/TransactionSubmitRequest"; +export * from "./src/types/TransactionSubmitResponse"; +export * from "./src/types/TransactionWaitResultRequest"; +export * from "./src/types/TransactionWaitResultResponse"; +export * from "./src/types/TransferRequest"; +export * from "./src/types/TransferResponse"; +export * from "./src/types/Type"; +export * from "./src/types/UnclaimedConfidentialOutput"; +export * from "./src/types/UnclaimedConfidentialOutputAddress"; +export * from "./src/types/ValidatorFee"; +export * from "./src/types/ValidatorNode"; +export * from "./src/types/ValidatorSignature"; +export * from "./src/types/Vault"; +export * from "./src/types/VaultId"; +export * from "./src/types/WebRtcStart"; +export * from "./src/types/WebRtcStartRequest"; +export * from "./src/types/WebRtcStartResponse"; +export * from "./src/helpers/helpers"; diff --git a/bindings/package-lock.json b/bindings/package-lock.json new file mode 100644 index 0000000000..5f151ec095 --- /dev/null +++ b/bindings/package-lock.json @@ -0,0 +1,247 @@ +{ + "name": "bindings", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "bindings", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "shx": "^0.3.4" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "dev": true, + "dependencies": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + }, + "bin": { + "shx": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + } + } +} diff --git a/bindings/package.json b/bindings/package.json new file mode 100644 index 0000000000..59e7c1a288 --- /dev/null +++ b/bindings/package.json @@ -0,0 +1,14 @@ +{ + "name": "tari-bindings", + "version": "1.0.0", + "description": "", + "main": "index.ts", + "scripts": { + "build": "sh build.sh" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "shx": "^0.3.4" + } +} diff --git a/bindings/src/helpers/helpers.ts b/bindings/src/helpers/helpers.ts new file mode 100644 index 0000000000..1f645d8b95 --- /dev/null +++ b/bindings/src/helpers/helpers.ts @@ -0,0 +1,105 @@ +import { JrpcPermission } from "../types/JrpcPermission"; +import { RejectReason } from "../types/RejectReason"; +import { SubstateDiff } from "../types/SubstateDiff"; +import { SubstateId } from "../types/SubstateId"; +import { TransactionResult } from "../types/TransactionResult"; + +export function substateIdToString(substateId: SubstateId | null): string { + if (substateId === null) { + return ""; + } + if ("Component" in substateId) { + return substateId.Component; + } + if ("Resource" in substateId) { + return substateId.Resource; + } + if ("Vault" in substateId) { + return substateId.Vault; + } + if ("UnclaimedConfidentialOutput" in substateId) { + return substateId.UnclaimedConfidentialOutput; + } + if ("NonFungible" in substateId) { + return substateId.NonFungible; + } + if ("NonFungibleIndex" in substateId) { + return `${substateId.NonFungibleIndex.resource_address}:${substateId.NonFungibleIndex.index}`; + } + if ("TransactionReceipt" in substateId) { + return substateId.TransactionReceipt; + } + if ("FeeClaim" in substateId) { + return substateId.FeeClaim; + } + console.error("Unknown substate id", substateId); + return "Unknown"; +} + +export function rejectReasonToString(reason: RejectReason | null): string { + if (reason === null) { + return ""; + } + if (typeof reason === "string") { + return reason; + } + if ("ShardsNotPledged" in reason) { + return `ShardsNotPledged(${reason.ShardsNotPledged})`; + } + if ("ExecutionFailure" in reason) { + return `ExecutionFailure(${reason.ExecutionFailure})`; + } + if ("ShardPledgedToAnotherPayload" in reason) { + return `ShardPledgedToAnotherPayload(${reason.ShardPledgedToAnotherPayload})`; + } + if ("ShardRejected" in reason) { + return `ShardRejected(${reason.ShardRejected})`; + } + if ("FeesNotPaid" in reason) { + return `FeesNotPaid(${reason.FeesNotPaid})`; + } + console.error("Unknown reason", reason); + return "Unknown"; +} + +export function getSubstateDiffFromTransactionResult(result: TransactionResult): SubstateDiff | null { + if ("Accept" in result) { + return result.Accept; + } + if ("AcceptFeeRejectRest" in result) { + return result.AcceptFeeRejectRest[0]; + } + return null; +} + +export function getRejectReasonFromTransactionResult(result: TransactionResult): RejectReason | null { + if ("Reject" in result) { + return result.Reject; + } + if ("AcceptFeeRejectRest" in result) { + return result.AcceptFeeRejectRest[1]; + } + return null; +} + +export function jrpcPermissionToString(jrpcPermission: JrpcPermission): string { + if (typeof jrpcPermission === "string") { + return jrpcPermission; + } + if ("NftGetOwnershipProof" in jrpcPermission) { + return `NftGetOwnershipProof(${jrpcPermission.NftGetOwnershipProof})`; + } + if ("AccountBalance" in jrpcPermission) { + return `AccountBalance(${substateIdToString(jrpcPermission.AccountBalance)})`; + } + if ("AccountList" in jrpcPermission) { + return `AccountList(${jrpcPermission.AccountList})`; + } + if ("TransactionSend" in jrpcPermission) { + return `TransactionSend(${jrpcPermission.TransactionSend})`; + } + if ("GetNft" in jrpcPermission) { + return `GetNft(${substateIdToString(jrpcPermission.GetNft[0])}, ${jrpcPermission.GetNft[1]})`; + } + return "Unknown"; +} diff --git a/bindings/src/types/AccessRule.ts b/bindings/src/types/AccessRule.ts new file mode 100644 index 0000000000..445f01aab4 --- /dev/null +++ b/bindings/src/types/AccessRule.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { RestrictedAccessRule } from "./RestrictedAccessRule"; + +export type AccessRule = "AllowAll" | "DenyAll" | { Restricted: RestrictedAccessRule }; diff --git a/bindings/src/types/Account.ts b/bindings/src/types/Account.ts new file mode 100644 index 0000000000..ab5adb79bb --- /dev/null +++ b/bindings/src/types/Account.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; + +export interface Account { + name: string | null; + address: SubstateId; + key_index: number; + is_default: boolean; +} diff --git a/bindings/src/types/AccountGetDefaultRequest.ts b/bindings/src/types/AccountGetDefaultRequest.ts new file mode 100644 index 0000000000..bc436edc54 --- /dev/null +++ b/bindings/src/types/AccountGetDefaultRequest.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 AccountGetDefaultRequest = Record; diff --git a/bindings/src/types/AccountGetRequest.ts b/bindings/src/types/AccountGetRequest.ts new file mode 100644 index 0000000000..6fc79f1f68 --- /dev/null +++ b/bindings/src/types/AccountGetRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddressOrName } from "./ComponentAddressOrName"; + +export interface AccountGetRequest { + name_or_address: ComponentAddressOrName; +} diff --git a/bindings/src/types/AccountGetResponse.ts b/bindings/src/types/AccountGetResponse.ts new file mode 100644 index 0000000000..3bf3663b1f --- /dev/null +++ b/bindings/src/types/AccountGetResponse.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Account } from "./Account"; + +export interface AccountGetResponse { + account: Account; + public_key: string; +} diff --git a/bindings/src/types/AccountInfo.ts b/bindings/src/types/AccountInfo.ts new file mode 100644 index 0000000000..c9a75870e2 --- /dev/null +++ b/bindings/src/types/AccountInfo.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Account } from "./Account"; + +export interface AccountInfo { + account: Account; + public_key: string; +} diff --git a/bindings/src/types/AccountNftInfo.ts b/bindings/src/types/AccountNftInfo.ts new file mode 100644 index 0000000000..6ffd65f116 --- /dev/null +++ b/bindings/src/types/AccountNftInfo.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface AccountNftInfo { + metadata: any; + is_burned: boolean; +} diff --git a/bindings/src/types/AccountSetDefaultRequest.ts b/bindings/src/types/AccountSetDefaultRequest.ts new file mode 100644 index 0000000000..3878cf0ecc --- /dev/null +++ b/bindings/src/types/AccountSetDefaultRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddressOrName } from "./ComponentAddressOrName"; + +export interface AccountSetDefaultRequest { + account: ComponentAddressOrName; +} diff --git a/bindings/src/types/AccountSetDefaultResponse.ts b/bindings/src/types/AccountSetDefaultResponse.ts new file mode 100644 index 0000000000..ec4c0c8574 --- /dev/null +++ b/bindings/src/types/AccountSetDefaultResponse.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 AccountSetDefaultResponse = Record; diff --git a/bindings/src/types/AccountsCreateFreeTestCoinsRequest.ts b/bindings/src/types/AccountsCreateFreeTestCoinsRequest.ts new file mode 100644 index 0000000000..750ca5f16e --- /dev/null +++ b/bindings/src/types/AccountsCreateFreeTestCoinsRequest.ts @@ -0,0 +1,10 @@ +// 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 { ComponentAddressOrName } from "./ComponentAddressOrName"; + +export interface AccountsCreateFreeTestCoinsRequest { + account: ComponentAddressOrName | null; + amount: Amount; + max_fee: Amount | null; + key_id: number | null; +} diff --git a/bindings/src/types/AccountsCreateFreeTestCoinsResponse.ts b/bindings/src/types/AccountsCreateFreeTestCoinsResponse.ts new file mode 100644 index 0000000000..c3b206447e --- /dev/null +++ b/bindings/src/types/AccountsCreateFreeTestCoinsResponse.ts @@ -0,0 +1,12 @@ +// 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 { FinalizeResult } from "./FinalizeResult"; +import type { TransactionId } from "./TransactionId"; + +export interface AccountsCreateFreeTestCoinsResponse { + transaction_id: TransactionId; + amount: Amount; + fee: Amount; + result: FinalizeResult; + public_key: string; +} diff --git a/bindings/src/types/AccountsCreateRequest.ts b/bindings/src/types/AccountsCreateRequest.ts new file mode 100644 index 0000000000..246c6d77c3 --- /dev/null +++ b/bindings/src/types/AccountsCreateRequest.ts @@ -0,0 +1,11 @@ +// 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 { ComponentAccessRules } from "./ComponentAccessRules"; + +export interface AccountsCreateRequest { + account_name: string | null; + custom_access_rules: ComponentAccessRules | null; + max_fee: Amount | null; + is_default: boolean; + key_id: bigint | null; +} diff --git a/bindings/src/types/AccountsCreateResponse.ts b/bindings/src/types/AccountsCreateResponse.ts new file mode 100644 index 0000000000..d6842c9dc3 --- /dev/null +++ b/bindings/src/types/AccountsCreateResponse.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { FinalizeResult } from "./FinalizeResult"; +import type { SubstateId } from "./SubstateId"; + +export interface AccountsCreateResponse { + address: SubstateId; + public_key: string; + result: FinalizeResult; +} diff --git a/bindings/src/types/AccountsGetBalancesRequest.ts b/bindings/src/types/AccountsGetBalancesRequest.ts new file mode 100644 index 0000000000..fcfa8b99d0 --- /dev/null +++ b/bindings/src/types/AccountsGetBalancesRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddressOrName } from "./ComponentAddressOrName"; + +export interface AccountsGetBalancesRequest { + account: ComponentAddressOrName | null; + refresh: boolean; +} diff --git a/bindings/src/types/AccountsGetBalancesResponse.ts b/bindings/src/types/AccountsGetBalancesResponse.ts new file mode 100644 index 0000000000..42038ba125 --- /dev/null +++ b/bindings/src/types/AccountsGetBalancesResponse.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BalanceEntry } from "./BalanceEntry"; +import type { SubstateId } from "./SubstateId"; + +export interface AccountsGetBalancesResponse { + address: SubstateId; + balances: Array; +} diff --git a/bindings/src/types/AccountsInvokeRequest.ts b/bindings/src/types/AccountsInvokeRequest.ts new file mode 100644 index 0000000000..fef6794dfb --- /dev/null +++ b/bindings/src/types/AccountsInvokeRequest.ts @@ -0,0 +1,11 @@ +// 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 { ComponentAddressOrName } from "./ComponentAddressOrName"; + +export interface AccountsInvokeRequest { + account: ComponentAddressOrName | null; + method: string; + args: Array; + max_fee: Amount | null; +} diff --git a/bindings/src/types/AccountsInvokeResponse.ts b/bindings/src/types/AccountsInvokeResponse.ts new file mode 100644 index 0000000000..c6880e4951 --- /dev/null +++ b/bindings/src/types/AccountsInvokeResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstructionResult } from "./InstructionResult"; + +export interface AccountsInvokeResponse { + result: InstructionResult | null; +} diff --git a/bindings/src/types/AccountsListRequest.ts b/bindings/src/types/AccountsListRequest.ts new file mode 100644 index 0000000000..39ab4ea3a4 --- /dev/null +++ b/bindings/src/types/AccountsListRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface AccountsListRequest { + offset: number; + limit: number; +} diff --git a/bindings/src/types/AccountsListResponse.ts b/bindings/src/types/AccountsListResponse.ts new file mode 100644 index 0000000000..d786c27648 --- /dev/null +++ b/bindings/src/types/AccountsListResponse.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AccountInfo } from "./AccountInfo"; + +export interface AccountsListResponse { + accounts: Array; + total: bigint; +} diff --git a/bindings/src/types/AddAddressRequest.ts b/bindings/src/types/AddAddressRequest.ts new file mode 100644 index 0000000000..e7a45892f9 --- /dev/null +++ b/bindings/src/types/AddAddressRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; + +export interface AddAddressRequest { + address: SubstateId; +} diff --git a/bindings/src/types/AddPeerRequest.ts b/bindings/src/types/AddPeerRequest.ts new file mode 100644 index 0000000000..c95eae8dcd --- /dev/null +++ b/bindings/src/types/AddPeerRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface AddPeerRequest { + public_key: string; + addresses: Array; + wait_for_dial: boolean; +} diff --git a/bindings/src/types/AddPeerResponse.ts b/bindings/src/types/AddPeerResponse.ts new file mode 100644 index 0000000000..2f3c13dbe4 --- /dev/null +++ b/bindings/src/types/AddPeerResponse.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 AddPeerResponse = Record; diff --git a/bindings/src/types/Amount.ts b/bindings/src/types/Amount.ts new file mode 100644 index 0000000000..07f91ec68a --- /dev/null +++ b/bindings/src/types/Amount.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 Amount = number; diff --git a/bindings/src/types/Arg.ts b/bindings/src/types/Arg.ts new file mode 100644 index 0000000000..ef1428921c --- /dev/null +++ b/bindings/src/types/Arg.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 Arg = { Workspace: Array } | { Literal: Array }; diff --git a/bindings/src/types/ArgDef.ts b/bindings/src/types/ArgDef.ts new file mode 100644 index 0000000000..f8b3b7cf92 --- /dev/null +++ b/bindings/src/types/ArgDef.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface ArgDef { + name: string; + arg_type: string; +} diff --git a/bindings/src/types/AuthGetAllJwtRequest.ts b/bindings/src/types/AuthGetAllJwtRequest.ts new file mode 100644 index 0000000000..e98b4ae2cb --- /dev/null +++ b/bindings/src/types/AuthGetAllJwtRequest.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 AuthGetAllJwtRequest = Record; diff --git a/bindings/src/types/AuthGetAllJwtResponse.ts b/bindings/src/types/AuthGetAllJwtResponse.ts new file mode 100644 index 0000000000..bbf866499f --- /dev/null +++ b/bindings/src/types/AuthGetAllJwtResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Claims } from "./Claims"; + +export interface AuthGetAllJwtResponse { + jwt: Array; +} diff --git a/bindings/src/types/AuthLoginAcceptRequest.ts b/bindings/src/types/AuthLoginAcceptRequest.ts new file mode 100644 index 0000000000..b19c497569 --- /dev/null +++ b/bindings/src/types/AuthLoginAcceptRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface AuthLoginAcceptRequest { + auth_token: string; + name: string; +} diff --git a/bindings/src/types/AuthLoginAcceptResponse.ts b/bindings/src/types/AuthLoginAcceptResponse.ts new file mode 100644 index 0000000000..87fdbde2b2 --- /dev/null +++ b/bindings/src/types/AuthLoginAcceptResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface AuthLoginAcceptResponse { + permissions_token: string; +} diff --git a/bindings/src/types/AuthLoginDenyRequest.ts b/bindings/src/types/AuthLoginDenyRequest.ts new file mode 100644 index 0000000000..6cd275f017 --- /dev/null +++ b/bindings/src/types/AuthLoginDenyRequest.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface AuthLoginDenyRequest { + auth_token: string; +} diff --git a/bindings/src/types/AuthLoginDenyResponse.ts b/bindings/src/types/AuthLoginDenyResponse.ts new file mode 100644 index 0000000000..9feb6a1c4f --- /dev/null +++ b/bindings/src/types/AuthLoginDenyResponse.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 AuthLoginDenyResponse = Record; diff --git a/bindings/src/types/AuthLoginRequest.ts b/bindings/src/types/AuthLoginRequest.ts new file mode 100644 index 0000000000..fd1de9232e --- /dev/null +++ b/bindings/src/types/AuthLoginRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface AuthLoginRequest { + permissions: Array; + duration: string | null; +} diff --git a/bindings/src/types/AuthLoginResponse.ts b/bindings/src/types/AuthLoginResponse.ts new file mode 100644 index 0000000000..c48a127738 --- /dev/null +++ b/bindings/src/types/AuthLoginResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface AuthLoginResponse { + auth_token: string; +} diff --git a/bindings/src/types/AuthRevokeTokenRequest.ts b/bindings/src/types/AuthRevokeTokenRequest.ts new file mode 100644 index 0000000000..c4e0667c9c --- /dev/null +++ b/bindings/src/types/AuthRevokeTokenRequest.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface AuthRevokeTokenRequest { + permission_token_id: number; +} diff --git a/bindings/src/types/AuthRevokeTokenResponse.ts b/bindings/src/types/AuthRevokeTokenResponse.ts new file mode 100644 index 0000000000..2786750995 --- /dev/null +++ b/bindings/src/types/AuthRevokeTokenResponse.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 AuthRevokeTokenResponse = Record; diff --git a/bindings/src/types/BalanceEntry.ts b/bindings/src/types/BalanceEntry.ts new file mode 100644 index 0000000000..35d70ab5e7 --- /dev/null +++ b/bindings/src/types/BalanceEntry.ts @@ -0,0 +1,14 @@ +// 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 { ResourceAddress } from "./ResourceAddress"; +import type { ResourceType } from "./ResourceType"; +import type { SubstateId } from "./SubstateId"; + +export interface BalanceEntry { + vault_address: SubstateId; + resource_address: ResourceAddress; + balance: Amount; + resource_type: ResourceType; + confidential_balance: Amount; + token_symbol: string | null; +} diff --git a/bindings/src/types/BalanceProofSignature.ts b/bindings/src/types/BalanceProofSignature.ts new file mode 100644 index 0000000000..0efd5da591 --- /dev/null +++ b/bindings/src/types/BalanceProofSignature.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 BalanceProofSignature = Array; diff --git a/bindings/src/types/Block.ts b/bindings/src/types/Block.ts new file mode 100644 index 0000000000..08e6354663 --- /dev/null +++ b/bindings/src/types/Block.ts @@ -0,0 +1,25 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BlockId } from "./BlockId"; +import type { Command } from "./Command"; +import type { Epoch } from "./Epoch"; +import type { NodeHeight } from "./NodeHeight"; +import type { QuorumCertificate } from "./QuorumCertificate"; +import type { Shard } from "./Shard"; + +export interface Block { + id: BlockId; + parent: BlockId; + justify: QuorumCertificate; + height: NodeHeight; + epoch: Epoch; + proposed_by: string; + total_leader_fee: bigint; + merkle_root: string; + commands: Array; + is_dummy: boolean; + is_processed: boolean; + is_committed: boolean; + foreign_indexes: Record; + stored_at: string | null; + signature: { public_nonce: string; signature: string } | null; +} diff --git a/bindings/src/types/BlockId.ts b/bindings/src/types/BlockId.ts new file mode 100644 index 0000000000..7d993fa8a2 --- /dev/null +++ b/bindings/src/types/BlockId.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 BlockId = string; diff --git a/bindings/src/types/BucketId.ts b/bindings/src/types/BucketId.ts new file mode 100644 index 0000000000..1aa1cf2406 --- /dev/null +++ b/bindings/src/types/BucketId.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 BucketId = number; diff --git a/bindings/src/types/CallInstructionRequest.ts b/bindings/src/types/CallInstructionRequest.ts new file mode 100644 index 0000000000..efe71c2b2c --- /dev/null +++ b/bindings/src/types/CallInstructionRequest.ts @@ -0,0 +1,18 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddressOrName } from "./ComponentAddressOrName"; +import type { Instruction } from "./Instruction"; +import type { SubstateRequirement } from "./SubstateRequirement"; + +export interface CallInstructionRequest { + instructions: Array; + fee_account: ComponentAddressOrName; + dump_outputs_into: ComponentAddressOrName | null; + max_fee: bigint; + inputs: Array; + override_inputs: boolean | null; + new_outputs: number | null; + is_dry_run: boolean; + proof_ids: Array; + min_epoch: bigint | null; + max_epoch: bigint | null; +} diff --git a/bindings/src/types/ClaimBurnRequest.ts b/bindings/src/types/ClaimBurnRequest.ts new file mode 100644 index 0000000000..725395d8fa --- /dev/null +++ b/bindings/src/types/ClaimBurnRequest.ts @@ -0,0 +1,10 @@ +// 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 { ComponentAddressOrName } from "./ComponentAddressOrName"; + +export interface ClaimBurnRequest { + account: ComponentAddressOrName | null; + claim_proof: string; + max_fee: Amount | null; + key_id: number | null; +} diff --git a/bindings/src/types/ClaimBurnResponse.ts b/bindings/src/types/ClaimBurnResponse.ts new file mode 100644 index 0000000000..ffad4d7112 --- /dev/null +++ b/bindings/src/types/ClaimBurnResponse.ts @@ -0,0 +1,10 @@ +// 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 { FinalizeResult } from "./FinalizeResult"; +import type { TransactionId } from "./TransactionId"; + +export interface ClaimBurnResponse { + transaction_id: TransactionId; + fee: Amount; + result: FinalizeResult; +} diff --git a/bindings/src/types/ClaimValidatorFeesRequest.ts b/bindings/src/types/ClaimValidatorFeesRequest.ts new file mode 100644 index 0000000000..5ef60f5447 --- /dev/null +++ b/bindings/src/types/ClaimValidatorFeesRequest.ts @@ -0,0 +1,12 @@ +// 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 { ComponentAddressOrName } from "./ComponentAddressOrName"; +import type { Epoch } from "./Epoch"; + +export interface ClaimValidatorFeesRequest { + account: ComponentAddressOrName | null; + max_fee: Amount | null; + validator_public_key: string; + epoch: Epoch; + dry_run: boolean; +} diff --git a/bindings/src/types/ClaimValidatorFeesResponse.ts b/bindings/src/types/ClaimValidatorFeesResponse.ts new file mode 100644 index 0000000000..c1855db1dd --- /dev/null +++ b/bindings/src/types/ClaimValidatorFeesResponse.ts @@ -0,0 +1,10 @@ +// 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 { FinalizeResult } from "./FinalizeResult"; +import type { TransactionId } from "./TransactionId"; + +export interface ClaimValidatorFeesResponse { + transaction_id: TransactionId; + fee: Amount; + result: FinalizeResult; +} diff --git a/bindings/src/types/Claims.ts b/bindings/src/types/Claims.ts new file mode 100644 index 0000000000..03c6b98d7d --- /dev/null +++ b/bindings/src/types/Claims.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { JrpcPermissions } from "./JrpcPermissions"; + +export interface Claims { + id: number; + name: string; + permissions: JrpcPermissions; + exp: number; +} diff --git a/bindings/src/types/Command.ts b/bindings/src/types/Command.ts new file mode 100644 index 0000000000..5d89974b88 --- /dev/null +++ b/bindings/src/types/Command.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ForeignProposal } from "./ForeignProposal"; +import type { TransactionAtom } from "./TransactionAtom"; + +export type Command = + | { Prepare: TransactionAtom } + | { LocalPrepared: TransactionAtom } + | { Accept: TransactionAtom } + | { ForeignProposal: ForeignProposal }; diff --git a/bindings/src/types/CommitteeShard.ts b/bindings/src/types/CommitteeShard.ts new file mode 100644 index 0000000000..2fc3eca3d4 --- /dev/null +++ b/bindings/src/types/CommitteeShard.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Shard } from "./Shard"; + +export interface CommitteeShard { + num_committees: number; + num_members: number; + shard: Shard; +} diff --git a/bindings/src/types/CommitteeShardInfo.ts b/bindings/src/types/CommitteeShardInfo.ts new file mode 100644 index 0000000000..8c67e6ca9f --- /dev/null +++ b/bindings/src/types/CommitteeShardInfo.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Shard } from "./Shard"; +import type { SubstateAddress } from "./SubstateAddress"; +import type { ValidatorNode } from "./ValidatorNode"; + +export interface CommitteeShardInfo { + shard: Shard; + substate_address_range: { start: SubstateAddress; end: SubstateAddress }; + validators: Array>; +} diff --git a/bindings/src/types/ComponentAccessRules.ts b/bindings/src/types/ComponentAccessRules.ts new file mode 100644 index 0000000000..1db3651946 --- /dev/null +++ b/bindings/src/types/ComponentAccessRules.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AccessRule } from "./AccessRule"; + +export interface ComponentAccessRules { + default: AccessRule; +} diff --git a/bindings/src/types/ComponentAddress.ts b/bindings/src/types/ComponentAddress.ts new file mode 100644 index 0000000000..321e8c197f --- /dev/null +++ b/bindings/src/types/ComponentAddress.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 ComponentAddress = string; diff --git a/bindings/src/types/ComponentAddressOrName.ts b/bindings/src/types/ComponentAddressOrName.ts new file mode 100644 index 0000000000..35dac1738a --- /dev/null +++ b/bindings/src/types/ComponentAddressOrName.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddress } from "./ComponentAddress"; + +export type ComponentAddressOrName = { ComponentAddress: ComponentAddress } | { Name: string }; diff --git a/bindings/src/types/ComponentBody.ts b/bindings/src/types/ComponentBody.ts new file mode 100644 index 0000000000..367f58919b --- /dev/null +++ b/bindings/src/types/ComponentBody.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface ComponentBody { + state: any; +} diff --git a/bindings/src/types/ComponentHeader.ts b/bindings/src/types/ComponentHeader.ts new file mode 100644 index 0000000000..f6248f3456 --- /dev/null +++ b/bindings/src/types/ComponentHeader.ts @@ -0,0 +1,14 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAccessRules } from "./ComponentAccessRules"; +import type { ComponentBody } from "./ComponentBody"; +import type { Hash } from "./Hash"; +import type { OwnerRule } from "./OwnerRule"; + +export interface ComponentHeader { + template_address: Hash; + module_name: string; + owner_key: string; + owner_rule: OwnerRule; + access_rules: ComponentAccessRules; + body: ComponentBody; +} diff --git a/bindings/src/types/ConfidentialClaim.ts b/bindings/src/types/ConfidentialClaim.ts new file mode 100644 index 0000000000..22964823de --- /dev/null +++ b/bindings/src/types/ConfidentialClaim.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ConfidentialWithdrawProof } from "./ConfidentialWithdrawProof"; +import type { UnclaimedConfidentialOutputAddress } from "./UnclaimedConfidentialOutputAddress"; + +export interface ConfidentialClaim { + public_key: string; + output_address: UnclaimedConfidentialOutputAddress; + range_proof: Array; + proof_of_knowledge: string; + withdraw_proof: ConfidentialWithdrawProof | null; +} diff --git a/bindings/src/types/ConfidentialCreateOutputProofRequest.ts b/bindings/src/types/ConfidentialCreateOutputProofRequest.ts new file mode 100644 index 0000000000..4f81f4e6a6 --- /dev/null +++ b/bindings/src/types/ConfidentialCreateOutputProofRequest.ts @@ -0,0 +1,6 @@ +// 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"; + +export interface ConfidentialCreateOutputProofRequest { + amount: Amount; +} diff --git a/bindings/src/types/ConfidentialCreateOutputProofResponse.ts b/bindings/src/types/ConfidentialCreateOutputProofResponse.ts new file mode 100644 index 0000000000..a01f311b2c --- /dev/null +++ b/bindings/src/types/ConfidentialCreateOutputProofResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ConfidentialOutputProof } from "./ConfidentialOutputProof"; + +export interface ConfidentialCreateOutputProofResponse { + proof: ConfidentialOutputProof; +} diff --git a/bindings/src/types/ConfidentialOutput.ts b/bindings/src/types/ConfidentialOutput.ts new file mode 100644 index 0000000000..0c36b52f47 --- /dev/null +++ b/bindings/src/types/ConfidentialOutput.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EncryptedData } from "./EncryptedData"; + +export interface ConfidentialOutput { + commitment: string; + stealth_public_nonce: string; + encrypted_data: EncryptedData; + minimum_value_promise: bigint; +} diff --git a/bindings/src/types/ConfidentialOutputProof.ts b/bindings/src/types/ConfidentialOutputProof.ts new file mode 100644 index 0000000000..cd52c57014 --- /dev/null +++ b/bindings/src/types/ConfidentialOutputProof.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ConfidentialStatement } from "./ConfidentialStatement"; + +export interface ConfidentialOutputProof { + output_statement: ConfidentialStatement; + change_statement: ConfidentialStatement | null; + range_proof: Array; +} diff --git a/bindings/src/types/ConfidentialStatement.ts b/bindings/src/types/ConfidentialStatement.ts new file mode 100644 index 0000000000..5e2492f8c9 --- /dev/null +++ b/bindings/src/types/ConfidentialStatement.ts @@ -0,0 +1,12 @@ +// 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 { EncryptedData } from "./EncryptedData"; +import type { RistrettoPublicKeyBytes } from "./RistrettoPublicKeyBytes"; + +export interface ConfidentialStatement { + commitment: Array; + sender_public_nonce: RistrettoPublicKeyBytes; + encrypted_data: EncryptedData; + minimum_value_promise: bigint; + revealed_amount: Amount; +} diff --git a/bindings/src/types/ConfidentialTransferRequest.ts b/bindings/src/types/ConfidentialTransferRequest.ts new file mode 100644 index 0000000000..da4b833d03 --- /dev/null +++ b/bindings/src/types/ConfidentialTransferRequest.ts @@ -0,0 +1,13 @@ +// 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 { ComponentAddressOrName } from "./ComponentAddressOrName"; +import type { ResourceAddress } from "./ResourceAddress"; + +export interface ConfidentialTransferRequest { + account: ComponentAddressOrName | null; + amount: Amount; + resource_address: ResourceAddress; + destination_public_key: string; + max_fee: Amount | null; + dry_run: boolean; +} diff --git a/bindings/src/types/ConfidentialTransferResponse.ts b/bindings/src/types/ConfidentialTransferResponse.ts new file mode 100644 index 0000000000..a0452c54f1 --- /dev/null +++ b/bindings/src/types/ConfidentialTransferResponse.ts @@ -0,0 +1,10 @@ +// 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 { FinalizeResult } from "./FinalizeResult"; +import type { TransactionId } from "./TransactionId"; + +export interface ConfidentialTransferResponse { + transaction_id: TransactionId; + fee: Amount; + result: FinalizeResult; +} diff --git a/bindings/src/types/ConfidentialWithdrawProof.ts b/bindings/src/types/ConfidentialWithdrawProof.ts new file mode 100644 index 0000000000..de624dd32a --- /dev/null +++ b/bindings/src/types/ConfidentialWithdrawProof.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BalanceProofSignature } from "./BalanceProofSignature"; +import type { ConfidentialOutputProof } from "./ConfidentialOutputProof"; +import type { PedersonCommitmentBytes } from "./PedersonCommitmentBytes"; + +export interface ConfidentialWithdrawProof { + inputs: Array; + output_proof: ConfidentialOutputProof; + balance_proof: BalanceProofSignature; +} diff --git a/bindings/src/types/Connection.ts b/bindings/src/types/Connection.ts new file mode 100644 index 0000000000..f8405c5c98 --- /dev/null +++ b/bindings/src/types/Connection.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ConnectionDirection } from "./ConnectionDirection"; + +export interface Connection { + connection_id: string; + peer_id: string; + address: string; + direction: ConnectionDirection; + age: string; + ping_latency: string | null; +} diff --git a/bindings/src/types/ConnectionDirection.ts b/bindings/src/types/ConnectionDirection.ts new file mode 100644 index 0000000000..45100c453e --- /dev/null +++ b/bindings/src/types/ConnectionDirection.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 ConnectionDirection = "Inbound" | "Outbound"; diff --git a/bindings/src/types/Decision.ts b/bindings/src/types/Decision.ts new file mode 100644 index 0000000000..a697b0f15c --- /dev/null +++ b/bindings/src/types/Decision.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 Decision = "Commit" | "Abort"; diff --git a/bindings/src/types/DeleteAddressRequest.ts b/bindings/src/types/DeleteAddressRequest.ts new file mode 100644 index 0000000000..90da954aad --- /dev/null +++ b/bindings/src/types/DeleteAddressRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; + +export interface DeleteAddressRequest { + address: SubstateId; +} diff --git a/bindings/src/types/DryRunTransactionFinalizeResult.ts b/bindings/src/types/DryRunTransactionFinalizeResult.ts new file mode 100644 index 0000000000..cf435e4b3b --- /dev/null +++ b/bindings/src/types/DryRunTransactionFinalizeResult.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { FeeCostBreakdown } from "./FeeCostBreakdown"; +import type { FinalizeResult } from "./FinalizeResult"; +import type { QuorumDecision } from "./QuorumDecision"; + +export interface DryRunTransactionFinalizeResult { + decision: QuorumDecision; + finalize: FinalizeResult; + fee_breakdown: FeeCostBreakdown | null; +} diff --git a/bindings/src/types/EncryptedData.ts b/bindings/src/types/EncryptedData.ts new file mode 100644 index 0000000000..8eb5aa818c --- /dev/null +++ b/bindings/src/types/EncryptedData.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 EncryptedData = Array; diff --git a/bindings/src/types/Epoch.ts b/bindings/src/types/Epoch.ts new file mode 100644 index 0000000000..d98ccd5f63 --- /dev/null +++ b/bindings/src/types/Epoch.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 Epoch = number; diff --git a/bindings/src/types/Event.ts b/bindings/src/types/Event.ts new file mode 100644 index 0000000000..659d5dbac7 --- /dev/null +++ b/bindings/src/types/Event.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddress } from "./ComponentAddress"; +import type { Metadata } from "./Metadata"; + +export interface Event { + component_address: ComponentAddress | null; + template_address: string; + tx_hash: string; + topic: string; + payload: Metadata; +} diff --git a/bindings/src/types/Evidence.ts b/bindings/src/types/Evidence.ts new file mode 100644 index 0000000000..10e550400a --- /dev/null +++ b/bindings/src/types/Evidence.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ShardEvidence } from "./ShardEvidence"; +import type { SubstateAddress } from "./SubstateAddress"; + +export interface Evidence { + evidence: Record; +} diff --git a/bindings/src/types/ExecuteResult.ts b/bindings/src/types/ExecuteResult.ts new file mode 100644 index 0000000000..ae236b9c37 --- /dev/null +++ b/bindings/src/types/ExecuteResult.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { FeeReceipt } from "./FeeReceipt"; +import type { FinalizeResult } from "./FinalizeResult"; + +export interface ExecuteResult { + finalize: FinalizeResult; + fee_receipt: FeeReceipt | null; +} diff --git a/bindings/src/types/ExecutedTransaction.ts b/bindings/src/types/ExecutedTransaction.ts new file mode 100644 index 0000000000..5be16ad74a --- /dev/null +++ b/bindings/src/types/ExecutedTransaction.ts @@ -0,0 +1,14 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Decision } from "./Decision"; +import type { ExecuteResult } from "./ExecuteResult"; +import type { SubstateAddress } from "./SubstateAddress"; +import type { Transaction } from "./Transaction"; + +export interface ExecutedTransaction { + transaction: Transaction; + result: ExecuteResult; + resulting_outputs: Array; + execution_time: string; + final_decision: Decision | null; + abort_details: string | null; +} diff --git a/bindings/src/types/FeeClaim.ts b/bindings/src/types/FeeClaim.ts new file mode 100644 index 0000000000..715b761925 --- /dev/null +++ b/bindings/src/types/FeeClaim.ts @@ -0,0 +1,8 @@ +// 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"; + +export interface FeeClaim { + epoch: bigint; + validator_public_key: string; + amount: Amount; +} diff --git a/bindings/src/types/FeeClaimAddress.ts b/bindings/src/types/FeeClaimAddress.ts new file mode 100644 index 0000000000..3f8a46adf3 --- /dev/null +++ b/bindings/src/types/FeeClaimAddress.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 FeeClaimAddress = string; diff --git a/bindings/src/types/FeeCostBreakdown.ts b/bindings/src/types/FeeCostBreakdown.ts new file mode 100644 index 0000000000..2c0f0566a3 --- /dev/null +++ b/bindings/src/types/FeeCostBreakdown.ts @@ -0,0 +1,8 @@ +// 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 { FeeSource } from "./FeeSource"; + +export interface FeeCostBreakdown { + total_fees_charged: Amount; + breakdown: Array<[FeeSource, bigint]>; +} diff --git a/bindings/src/types/FeeReceipt.ts b/bindings/src/types/FeeReceipt.ts new file mode 100644 index 0000000000..31feb4bebf --- /dev/null +++ b/bindings/src/types/FeeReceipt.ts @@ -0,0 +1,9 @@ +// 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 { FeeSource } from "./FeeSource"; + +export interface FeeReceipt { + total_fee_payment: Amount; + total_fees_paid: Amount; + cost_breakdown: Array<[FeeSource, bigint]>; +} diff --git a/bindings/src/types/FeeSource.ts b/bindings/src/types/FeeSource.ts new file mode 100644 index 0000000000..cb18543544 --- /dev/null +++ b/bindings/src/types/FeeSource.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 FeeSource = "Initial" | "RuntimeCall" | "Storage" | "Events" | "Logs"; diff --git a/bindings/src/types/FinalizeResult.ts b/bindings/src/types/FinalizeResult.ts new file mode 100644 index 0000000000..ae3e4c1ef0 --- /dev/null +++ b/bindings/src/types/FinalizeResult.ts @@ -0,0 +1,16 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Event } from "./Event"; +import type { FeeCostBreakdown } from "./FeeCostBreakdown"; +import type { Hash } from "./Hash"; +import type { InstructionResult } from "./InstructionResult"; +import type { LogEntry } from "./LogEntry"; +import type { TransactionResult } from "./TransactionResult"; + +export interface FinalizeResult { + transaction_hash: Hash; + events: Array; + logs: Array; + execution_results: Array; + result: TransactionResult; + cost_breakdown: FeeCostBreakdown | null; +} diff --git a/bindings/src/types/ForeignProposal.ts b/bindings/src/types/ForeignProposal.ts new file mode 100644 index 0000000000..bdadf26b42 --- /dev/null +++ b/bindings/src/types/ForeignProposal.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BlockId } from "./BlockId"; +import type { ForeignProposalState } from "./ForeignProposalState"; +import type { NodeHeight } from "./NodeHeight"; +import type { Shard } from "./Shard"; + +export interface ForeignProposal { + bucket: Shard; + block_id: BlockId; + state: ForeignProposalState; + proposed_height: NodeHeight | null; +} diff --git a/bindings/src/types/ForeignProposalState.ts b/bindings/src/types/ForeignProposalState.ts new file mode 100644 index 0000000000..a7fe60bf3d --- /dev/null +++ b/bindings/src/types/ForeignProposalState.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 ForeignProposalState = "New" | "Proposed" | "Deleted"; diff --git a/bindings/src/types/FunctionDef.ts b/bindings/src/types/FunctionDef.ts new file mode 100644 index 0000000000..2f5eaf5cc1 --- /dev/null +++ b/bindings/src/types/FunctionDef.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ArgDef } from "./ArgDef"; + +export interface FunctionDef { + name: string; + arguments: Array; + output: string; + is_mut: boolean; +} diff --git a/bindings/src/types/GetAccountNftRequest.ts b/bindings/src/types/GetAccountNftRequest.ts new file mode 100644 index 0000000000..42adee881d --- /dev/null +++ b/bindings/src/types/GetAccountNftRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NonFungibleId } from "./NonFungibleId"; + +export interface GetAccountNftRequest { + nft_id: NonFungibleId; +} diff --git a/bindings/src/types/GetBlockRequest.ts b/bindings/src/types/GetBlockRequest.ts new file mode 100644 index 0000000000..aaec6654aa --- /dev/null +++ b/bindings/src/types/GetBlockRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BlockId } from "./BlockId"; + +export interface GetBlockRequest { + block_id: BlockId; +} diff --git a/bindings/src/types/GetBlockResponse.ts b/bindings/src/types/GetBlockResponse.ts new file mode 100644 index 0000000000..1b350e5abf --- /dev/null +++ b/bindings/src/types/GetBlockResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Block } from "./Block"; + +export interface GetBlockResponse { + block: Block; +} diff --git a/bindings/src/types/GetBlocksCountResponse.ts b/bindings/src/types/GetBlocksCountResponse.ts new file mode 100644 index 0000000000..8e9a091baf --- /dev/null +++ b/bindings/src/types/GetBlocksCountResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface GetBlocksCountResponse { + count: bigint; +} diff --git a/bindings/src/types/GetBlocksRequest.ts b/bindings/src/types/GetBlocksRequest.ts new file mode 100644 index 0000000000..3890877af5 --- /dev/null +++ b/bindings/src/types/GetBlocksRequest.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Ordering } from "./Ordering"; + +export interface GetBlocksRequest { + limit: bigint; + offset: bigint; + ordering: Ordering | null; +} diff --git a/bindings/src/types/GetBlocksResponse.ts b/bindings/src/types/GetBlocksResponse.ts new file mode 100644 index 0000000000..37d06be2c2 --- /dev/null +++ b/bindings/src/types/GetBlocksResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Block } from "./Block"; + +export interface GetBlocksResponse { + blocks: Array; +} diff --git a/bindings/src/types/GetCommitteeRequest.ts b/bindings/src/types/GetCommitteeRequest.ts new file mode 100644 index 0000000000..cf496bd0f1 --- /dev/null +++ b/bindings/src/types/GetCommitteeRequest.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Epoch } from "./Epoch"; +import type { SubstateAddress } from "./SubstateAddress"; + +export interface GetCommitteeRequest { + epoch: Epoch; + substate_address: SubstateAddress; +} diff --git a/bindings/src/types/GetConnectionsResponse.ts b/bindings/src/types/GetConnectionsResponse.ts new file mode 100644 index 0000000000..87a6d892a8 --- /dev/null +++ b/bindings/src/types/GetConnectionsResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Connection } from "./Connection"; + +export interface GetConnectionsResponse { + connections: Array; +} diff --git a/bindings/src/types/GetEpochManagerStatsResponse.ts b/bindings/src/types/GetEpochManagerStatsResponse.ts new file mode 100644 index 0000000000..2f5eb1736c --- /dev/null +++ b/bindings/src/types/GetEpochManagerStatsResponse.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CommitteeShard } from "./CommitteeShard"; +import type { Epoch } from "./Epoch"; + +export interface GetEpochManagerStatsResponse { + current_epoch: Epoch; + current_block_height: bigint; + is_valid: boolean; + committee_shard: CommitteeShard | null; +} diff --git a/bindings/src/types/GetIdentityResponse.ts b/bindings/src/types/GetIdentityResponse.ts new file mode 100644 index 0000000000..0b0f977fed --- /dev/null +++ b/bindings/src/types/GetIdentityResponse.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface GetIdentityResponse { + peer_id: string; + public_key: string; + public_addresses: Array; + supported_protocols: Array; + protocol_version: string; + user_agent: string; +} diff --git a/bindings/src/types/GetNetworkCommitteeResponse.ts b/bindings/src/types/GetNetworkCommitteeResponse.ts new file mode 100644 index 0000000000..e746758b8c --- /dev/null +++ b/bindings/src/types/GetNetworkCommitteeResponse.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CommitteeShardInfo } from "./CommitteeShardInfo"; +import type { Epoch } from "./Epoch"; + +export interface GetNetworkCommitteeResponse { + current_epoch: Epoch; + committees: Array>; +} diff --git a/bindings/src/types/GetNonFungibleCountRequest.ts b/bindings/src/types/GetNonFungibleCountRequest.ts new file mode 100644 index 0000000000..b4400b81dc --- /dev/null +++ b/bindings/src/types/GetNonFungibleCountRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; + +export interface GetNonFungibleCountRequest { + address: SubstateId; +} diff --git a/bindings/src/types/GetNonFungiblesRequest.ts b/bindings/src/types/GetNonFungiblesRequest.ts new file mode 100644 index 0000000000..f95fbb836b --- /dev/null +++ b/bindings/src/types/GetNonFungiblesRequest.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; + +export interface GetNonFungiblesRequest { + address: SubstateId; + start_index: bigint; + end_index: bigint; +} diff --git a/bindings/src/types/GetNonFungiblesResponse.ts b/bindings/src/types/GetNonFungiblesResponse.ts new file mode 100644 index 0000000000..d4feee936a --- /dev/null +++ b/bindings/src/types/GetNonFungiblesResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NonFungibleSubstate } from "./NonFungibleSubstate"; + +export interface GetNonFungiblesResponse { + non_fungibles: Array; +} diff --git a/bindings/src/types/GetRecentTransactionsRequest.ts b/bindings/src/types/GetRecentTransactionsRequest.ts new file mode 100644 index 0000000000..6db8a1ceff --- /dev/null +++ b/bindings/src/types/GetRecentTransactionsRequest.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 GetRecentTransactionsRequest = Record; diff --git a/bindings/src/types/GetRecentTransactionsResponse.ts b/bindings/src/types/GetRecentTransactionsResponse.ts new file mode 100644 index 0000000000..cbf2006b0b --- /dev/null +++ b/bindings/src/types/GetRecentTransactionsResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Transaction } from "./Transaction"; + +export interface GetRecentTransactionsResponse { + transactions: Array; +} diff --git a/bindings/src/types/GetRelatedTransactionsRequest.ts b/bindings/src/types/GetRelatedTransactionsRequest.ts new file mode 100644 index 0000000000..55772a6990 --- /dev/null +++ b/bindings/src/types/GetRelatedTransactionsRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; + +export interface GetRelatedTransactionsRequest { + address: SubstateId; + version: number | null; +} diff --git a/bindings/src/types/GetRelatedTransactionsResponse.ts b/bindings/src/types/GetRelatedTransactionsResponse.ts new file mode 100644 index 0000000000..cd920c0f35 --- /dev/null +++ b/bindings/src/types/GetRelatedTransactionsResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { IndexerTransactionFinalizedResult } from "./IndexerTransactionFinalizedResult"; + +export interface GetRelatedTransactionsResponse { + transaction_results: Array; +} diff --git a/bindings/src/types/GetShardKey.ts b/bindings/src/types/GetShardKey.ts new file mode 100644 index 0000000000..7e7dab1e52 --- /dev/null +++ b/bindings/src/types/GetShardKey.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface GetShardKey { + height: bigint; + public_key: string; +} diff --git a/bindings/src/types/GetStateRequest.ts b/bindings/src/types/GetStateRequest.ts new file mode 100644 index 0000000000..ac3e373951 --- /dev/null +++ b/bindings/src/types/GetStateRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateAddress } from "./SubstateAddress"; + +export interface GetStateRequest { + address: SubstateAddress; +} diff --git a/bindings/src/types/GetStateResponse.ts b/bindings/src/types/GetStateResponse.ts new file mode 100644 index 0000000000..e20666b2e6 --- /dev/null +++ b/bindings/src/types/GetStateResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface GetStateResponse { + data: Array; +} diff --git a/bindings/src/types/GetSubstateRequest.ts b/bindings/src/types/GetSubstateRequest.ts new file mode 100644 index 0000000000..be0ab78ea8 --- /dev/null +++ b/bindings/src/types/GetSubstateRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; + +export interface GetSubstateRequest { + address: SubstateId; + version: number; +} diff --git a/bindings/src/types/GetSubstateResponse.ts b/bindings/src/types/GetSubstateResponse.ts new file mode 100644 index 0000000000..d6797f8ce4 --- /dev/null +++ b/bindings/src/types/GetSubstateResponse.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateStatus } from "./SubstateStatus"; +import type { SubstateValue } from "./SubstateValue"; +import type { TransactionId } from "./TransactionId"; + +export interface GetSubstateResponse { + value: SubstateValue | null; + created_by_tx: TransactionId | null; + status: SubstateStatus; +} diff --git a/bindings/src/types/GetSubstatesByTransactionRequest.ts b/bindings/src/types/GetSubstatesByTransactionRequest.ts new file mode 100644 index 0000000000..961e4f083a --- /dev/null +++ b/bindings/src/types/GetSubstatesByTransactionRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TransactionId } from "./TransactionId"; + +export interface GetSubstatesByTransactionRequest { + transaction_id: TransactionId; +} diff --git a/bindings/src/types/GetSubstatesByTransactionResponse.ts b/bindings/src/types/GetSubstatesByTransactionResponse.ts new file mode 100644 index 0000000000..6d27b2f9a6 --- /dev/null +++ b/bindings/src/types/GetSubstatesByTransactionResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateRecord } from "./SubstateRecord"; + +export interface GetSubstatesByTransactionResponse { + substates: Array; +} diff --git a/bindings/src/types/GetTemplateRequest.ts b/bindings/src/types/GetTemplateRequest.ts new file mode 100644 index 0000000000..62ecf4c0e3 --- /dev/null +++ b/bindings/src/types/GetTemplateRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Hash } from "./Hash"; + +export interface GetTemplateRequest { + template_address: Hash; +} diff --git a/bindings/src/types/GetTemplateResponse.ts b/bindings/src/types/GetTemplateResponse.ts new file mode 100644 index 0000000000..00f6514690 --- /dev/null +++ b/bindings/src/types/GetTemplateResponse.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TemplateAbi } from "./TemplateAbi"; +import type { TemplateMetadata } from "./TemplateMetadata"; + +export interface GetTemplateResponse { + registration_metadata: TemplateMetadata; + abi: TemplateAbi; +} diff --git a/bindings/src/types/GetTemplatesRequest.ts b/bindings/src/types/GetTemplatesRequest.ts new file mode 100644 index 0000000000..62e71deab3 --- /dev/null +++ b/bindings/src/types/GetTemplatesRequest.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface GetTemplatesRequest { + limit: bigint; +} diff --git a/bindings/src/types/GetTemplatesResponse.ts b/bindings/src/types/GetTemplatesResponse.ts new file mode 100644 index 0000000000..a2b3be8169 --- /dev/null +++ b/bindings/src/types/GetTemplatesResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TemplateMetadata } from "./TemplateMetadata"; + +export interface GetTemplatesResponse { + templates: Array; +} diff --git a/bindings/src/types/GetTransactionRequest.ts b/bindings/src/types/GetTransactionRequest.ts new file mode 100644 index 0000000000..3ce05d285b --- /dev/null +++ b/bindings/src/types/GetTransactionRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TransactionId } from "./TransactionId"; + +export interface GetTransactionRequest { + transaction_id: TransactionId; +} diff --git a/bindings/src/types/GetTransactionResponse.ts b/bindings/src/types/GetTransactionResponse.ts new file mode 100644 index 0000000000..4b3d2b29b4 --- /dev/null +++ b/bindings/src/types/GetTransactionResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ExecutedTransaction } from "./ExecutedTransaction"; + +export interface GetTransactionResponse { + transaction: ExecutedTransaction; +} diff --git a/bindings/src/types/GetTransactionResultRequest.ts b/bindings/src/types/GetTransactionResultRequest.ts new file mode 100644 index 0000000000..73b506c393 --- /dev/null +++ b/bindings/src/types/GetTransactionResultRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TransactionId } from "./TransactionId"; + +export interface GetTransactionResultRequest { + transaction_id: TransactionId; +} diff --git a/bindings/src/types/GetTransactionResultResponse.ts b/bindings/src/types/GetTransactionResultResponse.ts new file mode 100644 index 0000000000..9eadf6d40b --- /dev/null +++ b/bindings/src/types/GetTransactionResultResponse.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ExecuteResult } from "./ExecuteResult"; + +export interface GetTransactionResultResponse { + result: ExecuteResult | null; + is_finalized: boolean; + execution_time: string | null; +} diff --git a/bindings/src/types/GetValidatorFeesRequest.ts b/bindings/src/types/GetValidatorFeesRequest.ts new file mode 100644 index 0000000000..569fe078bf --- /dev/null +++ b/bindings/src/types/GetValidatorFeesRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Epoch } from "./Epoch"; + +export interface GetValidatorFeesRequest { + validator_public_key: string; + epoch: Epoch; +} diff --git a/bindings/src/types/GetValidatorFeesResponse.ts b/bindings/src/types/GetValidatorFeesResponse.ts new file mode 100644 index 0000000000..39b11ab635 --- /dev/null +++ b/bindings/src/types/GetValidatorFeesResponse.ts @@ -0,0 +1,7 @@ +// 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 { Epoch } from "./Epoch"; + +export interface GetValidatorFeesResponse { + fee_summary: Record; +} diff --git a/bindings/src/types/Hash.ts b/bindings/src/types/Hash.ts new file mode 100644 index 0000000000..3053896346 --- /dev/null +++ b/bindings/src/types/Hash.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 Hash = Array; diff --git a/bindings/src/types/IndexedValue.ts b/bindings/src/types/IndexedValue.ts new file mode 100644 index 0000000000..5c29b803e3 --- /dev/null +++ b/bindings/src/types/IndexedValue.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { IndexedWellKnownTypes } from "./IndexedWellKnownTypes"; + +export interface IndexedValue { + indexed: IndexedWellKnownTypes; + value: any; +} diff --git a/bindings/src/types/IndexedWellKnownTypes.ts b/bindings/src/types/IndexedWellKnownTypes.ts new file mode 100644 index 0000000000..8d20980c48 --- /dev/null +++ b/bindings/src/types/IndexedWellKnownTypes.ts @@ -0,0 +1,20 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BucketId } from "./BucketId"; +import type { ComponentAddress } from "./ComponentAddress"; +import type { Metadata } from "./Metadata"; +import type { NonFungibleAddress } from "./NonFungibleAddress"; +import type { ProofId } from "./ProofId"; +import type { ResourceAddress } from "./ResourceAddress"; +import type { TransactionReceiptAddress } from "./TransactionReceiptAddress"; +import type { VaultId } from "./VaultId"; + +export interface IndexedWellKnownTypes { + bucket_ids: Array; + proof_ids: Array; + component_addresses: Array; + resource_addresses: Array; + transaction_receipt_addresses: Array; + non_fungible_addresses: Array; + vault_ids: Array; + metadata: Array; +} diff --git a/bindings/src/types/IndexerTransactionFinalizedResult.ts b/bindings/src/types/IndexerTransactionFinalizedResult.ts new file mode 100644 index 0000000000..ec96ee2e89 --- /dev/null +++ b/bindings/src/types/IndexerTransactionFinalizedResult.ts @@ -0,0 +1,14 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Decision } from "./Decision"; +import type { ExecuteResult } from "./ExecuteResult"; + +export type IndexerTransactionFinalizedResult = + | "Pending" + | { + Finalized: { + final_decision: Decision; + execution_result: ExecuteResult | null; + abort_details: string | null; + json_results: Array; + }; + }; diff --git a/bindings/src/types/InspectSubstateRequest.ts b/bindings/src/types/InspectSubstateRequest.ts new file mode 100644 index 0000000000..567cd72f21 --- /dev/null +++ b/bindings/src/types/InspectSubstateRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; + +export interface InspectSubstateRequest { + address: SubstateId; + version: number | null; +} diff --git a/bindings/src/types/InspectSubstateResponse.ts b/bindings/src/types/InspectSubstateResponse.ts new file mode 100644 index 0000000000..6a30bc9d7c --- /dev/null +++ b/bindings/src/types/InspectSubstateResponse.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; +import type { TransactionId } from "./TransactionId"; + +export interface InspectSubstateResponse { + address: SubstateId; + version: number; + substate_contents: string; + created_by_transaction: TransactionId; +} diff --git a/bindings/src/types/Instruction.ts b/bindings/src/types/Instruction.ts new file mode 100644 index 0000000000..fd635d4bfd --- /dev/null +++ b/bindings/src/types/Instruction.ts @@ -0,0 +1,18 @@ +// 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 { ComponentAddress } from "./ComponentAddress"; +import type { ConfidentialClaim } from "./ConfidentialClaim"; +import type { ConfidentialOutput } from "./ConfidentialOutput"; +import type { Hash } from "./Hash"; +import type { LogLevel } from "./LogLevel"; + +export type Instruction = + | { CallFunction: { template_address: Hash; function: string; args: Array } } + | { CallMethod: { component_address: ComponentAddress; method: string; args: Array } } + | { PutLastInstructionOutputOnWorkspace: { key: Array } } + | { EmitLog: { level: LogLevel; message: string } } + | { ClaimBurn: { claim: ConfidentialClaim } } + | { ClaimValidatorFees: { epoch: bigint; validator_public_key: string } } + | "DropAllProofsInWorkspace" + | { CreateFreeTestCoins: { revealed_amount: Amount; output: ConfidentialOutput | null } }; diff --git a/bindings/src/types/InstructionResult.ts b/bindings/src/types/InstructionResult.ts new file mode 100644 index 0000000000..a73cc1fc9b --- /dev/null +++ b/bindings/src/types/InstructionResult.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { IndexedValue } from "./IndexedValue"; +import type { Type } from "./Type"; + +export interface InstructionResult { + indexed: IndexedValue; + return_type: Type; +} diff --git a/bindings/src/types/JrpcPermission.ts b/bindings/src/types/JrpcPermission.ts new file mode 100644 index 0000000000..c8ca7afe08 --- /dev/null +++ b/bindings/src/types/JrpcPermission.ts @@ -0,0 +1,16 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddress } from "./ComponentAddress"; +import type { ResourceAddress } from "./ResourceAddress"; +import type { SubstateId } from "./SubstateId"; + +export type JrpcPermission = + | "AccountInfo" + | { NftGetOwnershipProof: ResourceAddress | null } + | { AccountBalance: SubstateId } + | { AccountList: ComponentAddress | null } + | "KeyList" + | "TransactionGet" + | { TransactionSend: SubstateId | null } + | { GetNft: [SubstateId | null, ResourceAddress | null] } + | "StartWebrtc" + | "Admin"; diff --git a/bindings/src/types/JrpcPermissions.ts b/bindings/src/types/JrpcPermissions.ts new file mode 100644 index 0000000000..9c212ab4eb --- /dev/null +++ b/bindings/src/types/JrpcPermissions.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { JrpcPermission } from "./JrpcPermission"; + +export type JrpcPermissions = Array; diff --git a/bindings/src/types/KeysCreateRequest.ts b/bindings/src/types/KeysCreateRequest.ts new file mode 100644 index 0000000000..e084f475b2 --- /dev/null +++ b/bindings/src/types/KeysCreateRequest.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface KeysCreateRequest { + specific_index: number | null; +} diff --git a/bindings/src/types/KeysCreateResponse.ts b/bindings/src/types/KeysCreateResponse.ts new file mode 100644 index 0000000000..640f2410ef --- /dev/null +++ b/bindings/src/types/KeysCreateResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface KeysCreateResponse { + id: bigint; + public_key: string; +} diff --git a/bindings/src/types/KeysListRequest.ts b/bindings/src/types/KeysListRequest.ts new file mode 100644 index 0000000000..7436eda386 --- /dev/null +++ b/bindings/src/types/KeysListRequest.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 KeysListRequest = Record; diff --git a/bindings/src/types/KeysListResponse.ts b/bindings/src/types/KeysListResponse.ts new file mode 100644 index 0000000000..239dc4a2cf --- /dev/null +++ b/bindings/src/types/KeysListResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface KeysListResponse { + keys: Array<[number, string, boolean]>; +} diff --git a/bindings/src/types/KeysSetActiveRequest.ts b/bindings/src/types/KeysSetActiveRequest.ts new file mode 100644 index 0000000000..1e5db6851b --- /dev/null +++ b/bindings/src/types/KeysSetActiveRequest.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface KeysSetActiveRequest { + index: number; +} diff --git a/bindings/src/types/KeysSetActiveResponse.ts b/bindings/src/types/KeysSetActiveResponse.ts new file mode 100644 index 0000000000..0d365896aa --- /dev/null +++ b/bindings/src/types/KeysSetActiveResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface KeysSetActiveResponse { + public_key: string; +} diff --git a/bindings/src/types/ListAccountNftRequest.ts b/bindings/src/types/ListAccountNftRequest.ts new file mode 100644 index 0000000000..896c2cb960 --- /dev/null +++ b/bindings/src/types/ListAccountNftRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface ListAccountNftRequest { + limit: number; + offset: number; +} diff --git a/bindings/src/types/ListAccountNftResponse.ts b/bindings/src/types/ListAccountNftResponse.ts new file mode 100644 index 0000000000..e6805c1180 --- /dev/null +++ b/bindings/src/types/ListAccountNftResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AccountNftInfo } from "./AccountNftInfo"; + +export interface ListAccountNftResponse { + nfts: Array; +} diff --git a/bindings/src/types/ListBlocksRequest.ts b/bindings/src/types/ListBlocksRequest.ts new file mode 100644 index 0000000000..ee6cdb52cb --- /dev/null +++ b/bindings/src/types/ListBlocksRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BlockId } from "./BlockId"; + +export interface ListBlocksRequest { + from_id: BlockId | null; + limit: number; +} diff --git a/bindings/src/types/ListBlocksResponse.ts b/bindings/src/types/ListBlocksResponse.ts new file mode 100644 index 0000000000..8e56039fab --- /dev/null +++ b/bindings/src/types/ListBlocksResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Block } from "./Block"; + +export interface ListBlocksResponse { + blocks: Array; +} diff --git a/bindings/src/types/LockFlag.ts b/bindings/src/types/LockFlag.ts new file mode 100644 index 0000000000..08258cccd4 --- /dev/null +++ b/bindings/src/types/LockFlag.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 LockFlag = "Read" | "Write"; diff --git a/bindings/src/types/LogEntry.ts b/bindings/src/types/LogEntry.ts new file mode 100644 index 0000000000..6c253638f1 --- /dev/null +++ b/bindings/src/types/LogEntry.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { LogLevel } from "./LogLevel"; + +export interface LogEntry { + timestamp: number; + message: string; + level: LogLevel; +} diff --git a/bindings/src/types/LogLevel.ts b/bindings/src/types/LogLevel.ts new file mode 100644 index 0000000000..58aaf969d3 --- /dev/null +++ b/bindings/src/types/LogLevel.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 LogLevel = "Error" | "Warn" | "Info" | "Debug"; diff --git a/bindings/src/types/Metadata.ts b/bindings/src/types/Metadata.ts new file mode 100644 index 0000000000..c35ff1cded --- /dev/null +++ b/bindings/src/types/Metadata.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 Metadata = string; diff --git a/bindings/src/types/MintAccountNftRequest.ts b/bindings/src/types/MintAccountNftRequest.ts new file mode 100644 index 0000000000..4c3b3be6c7 --- /dev/null +++ b/bindings/src/types/MintAccountNftRequest.ts @@ -0,0 +1,10 @@ +// 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 { ComponentAddressOrName } from "./ComponentAddressOrName"; + +export interface MintAccountNftRequest { + account: ComponentAddressOrName; + metadata: string; + mint_fee: Amount | null; + create_account_nft_fee: Amount | null; +} diff --git a/bindings/src/types/MintAccountNftResponse.ts b/bindings/src/types/MintAccountNftResponse.ts new file mode 100644 index 0000000000..c7e9b0c63f --- /dev/null +++ b/bindings/src/types/MintAccountNftResponse.ts @@ -0,0 +1,12 @@ +// 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 { FinalizeResult } from "./FinalizeResult"; +import type { NonFungibleId } from "./NonFungibleId"; +import type { ResourceAddress } from "./ResourceAddress"; + +export interface MintAccountNftResponse { + nft_id: NonFungibleId; + resource_address: ResourceAddress; + result: FinalizeResult; + fee: Amount; +} diff --git a/bindings/src/types/NodeHeight.ts b/bindings/src/types/NodeHeight.ts new file mode 100644 index 0000000000..58a2e016dd --- /dev/null +++ b/bindings/src/types/NodeHeight.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 NodeHeight = bigint; diff --git a/bindings/src/types/NonFungible.ts b/bindings/src/types/NonFungible.ts new file mode 100644 index 0000000000..309278152e --- /dev/null +++ b/bindings/src/types/NonFungible.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface NonFungible { + data: string; + mutable_data: string; +} diff --git a/bindings/src/types/NonFungibleAddress.ts b/bindings/src/types/NonFungibleAddress.ts new file mode 100644 index 0000000000..7f6b2fe163 --- /dev/null +++ b/bindings/src/types/NonFungibleAddress.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 NonFungibleAddress = string; diff --git a/bindings/src/types/NonFungibleAddressContents.ts b/bindings/src/types/NonFungibleAddressContents.ts new file mode 100644 index 0000000000..2a30c1023e --- /dev/null +++ b/bindings/src/types/NonFungibleAddressContents.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NonFungibleId } from "./NonFungibleId"; +import type { ResourceAddress } from "./ResourceAddress"; + +export interface NonFungibleAddressContents { + resource_address: ResourceAddress; + id: NonFungibleId; +} diff --git a/bindings/src/types/NonFungibleContainer.ts b/bindings/src/types/NonFungibleContainer.ts new file mode 100644 index 0000000000..847f081128 --- /dev/null +++ b/bindings/src/types/NonFungibleContainer.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NonFungible } from "./NonFungible"; + +export type NonFungibleContainer = NonFungible | null; diff --git a/bindings/src/types/NonFungibleId.ts b/bindings/src/types/NonFungibleId.ts new file mode 100644 index 0000000000..565fdb5452 --- /dev/null +++ b/bindings/src/types/NonFungibleId.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 NonFungibleId = { U256: Array } | { String: string } | { Uint32: number } | { Uint64: bigint }; diff --git a/bindings/src/types/NonFungibleIndex.ts b/bindings/src/types/NonFungibleIndex.ts new file mode 100644 index 0000000000..ab9d49f0f8 --- /dev/null +++ b/bindings/src/types/NonFungibleIndex.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NonFungibleAddress } from "./NonFungibleAddress"; + +export interface NonFungibleIndex { + referenced_address: NonFungibleAddress; +} diff --git a/bindings/src/types/NonFungibleIndexAddress.ts b/bindings/src/types/NonFungibleIndexAddress.ts new file mode 100644 index 0000000000..4f4ab10346 --- /dev/null +++ b/bindings/src/types/NonFungibleIndexAddress.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ResourceAddress } from "./ResourceAddress"; + +export interface NonFungibleIndexAddress { + resource_address: ResourceAddress; + index: number; +} diff --git a/bindings/src/types/NonFungibleSubstate.ts b/bindings/src/types/NonFungibleSubstate.ts new file mode 100644 index 0000000000..d3a9011b7e --- /dev/null +++ b/bindings/src/types/NonFungibleSubstate.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Substate } from "./Substate"; +import type { SubstateId } from "./SubstateId"; + +export interface NonFungibleSubstate { + index: bigint; + address: SubstateId; + substate: Substate; +} diff --git a/bindings/src/types/Ordering.ts b/bindings/src/types/Ordering.ts new file mode 100644 index 0000000000..9e36dbd3d3 --- /dev/null +++ b/bindings/src/types/Ordering.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 Ordering = "Ascending" | "Descending"; diff --git a/bindings/src/types/OwnerRule.ts b/bindings/src/types/OwnerRule.ts new file mode 100644 index 0000000000..f3f0d2541d --- /dev/null +++ b/bindings/src/types/OwnerRule.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AccessRule } from "./AccessRule"; + +export type OwnerRule = "OwnedBySigner" | "None" | { ByAccessRule: AccessRule }; diff --git a/bindings/src/types/PedersonCommitmentBytes.ts b/bindings/src/types/PedersonCommitmentBytes.ts new file mode 100644 index 0000000000..e0200e6eb4 --- /dev/null +++ b/bindings/src/types/PedersonCommitmentBytes.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 PedersonCommitmentBytes = Array; diff --git a/bindings/src/types/ProofId.ts b/bindings/src/types/ProofId.ts new file mode 100644 index 0000000000..9d70f4967c --- /dev/null +++ b/bindings/src/types/ProofId.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 ProofId = number; diff --git a/bindings/src/types/ProofsCancelRequest.ts b/bindings/src/types/ProofsCancelRequest.ts new file mode 100644 index 0000000000..ecab2f6a25 --- /dev/null +++ b/bindings/src/types/ProofsCancelRequest.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface ProofsCancelRequest { + proof_id: bigint; +} diff --git a/bindings/src/types/ProofsCancelResponse.ts b/bindings/src/types/ProofsCancelResponse.ts new file mode 100644 index 0000000000..3fbcc7c781 --- /dev/null +++ b/bindings/src/types/ProofsCancelResponse.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 ProofsCancelResponse = Record; diff --git a/bindings/src/types/ProofsFinalizeRequest.ts b/bindings/src/types/ProofsFinalizeRequest.ts new file mode 100644 index 0000000000..5f72f3ad6c --- /dev/null +++ b/bindings/src/types/ProofsFinalizeRequest.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface ProofsFinalizeRequest { + proof_id: bigint; +} diff --git a/bindings/src/types/ProofsFinalizeResponse.ts b/bindings/src/types/ProofsFinalizeResponse.ts new file mode 100644 index 0000000000..5b3d38c58d --- /dev/null +++ b/bindings/src/types/ProofsFinalizeResponse.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 ProofsFinalizeResponse = Record; diff --git a/bindings/src/types/ProofsGenerateRequest.ts b/bindings/src/types/ProofsGenerateRequest.ts new file mode 100644 index 0000000000..15a4f8058f --- /dev/null +++ b/bindings/src/types/ProofsGenerateRequest.ts @@ -0,0 +1,12 @@ +// 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 { ComponentAddressOrName } from "./ComponentAddressOrName"; +import type { ResourceAddress } from "./ResourceAddress"; + +export interface ProofsGenerateRequest { + amount: Amount; + reveal_amount: Amount; + account: ComponentAddressOrName | null; + resource_address: ResourceAddress; + destination_public_key: string; +} diff --git a/bindings/src/types/ProofsGenerateResponse.ts b/bindings/src/types/ProofsGenerateResponse.ts new file mode 100644 index 0000000000..7782251b15 --- /dev/null +++ b/bindings/src/types/ProofsGenerateResponse.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ConfidentialWithdrawProof } from "./ConfidentialWithdrawProof"; + +export interface ProofsGenerateResponse { + proof_id: bigint; + proof: ConfidentialWithdrawProof; +} diff --git a/bindings/src/types/QcId.ts b/bindings/src/types/QcId.ts new file mode 100644 index 0000000000..e7591e629f --- /dev/null +++ b/bindings/src/types/QcId.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 QcId = string | null; diff --git a/bindings/src/types/QuorumCertificate.ts b/bindings/src/types/QuorumCertificate.ts new file mode 100644 index 0000000000..feb6d8405e --- /dev/null +++ b/bindings/src/types/QuorumCertificate.ts @@ -0,0 +1,18 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BlockId } from "./BlockId"; +import type { Epoch } from "./Epoch"; +import type { NodeHeight } from "./NodeHeight"; +import type { QcId } from "./QcId"; +import type { QuorumDecision } from "./QuorumDecision"; +import type { ValidatorSignature } from "./ValidatorSignature"; + +export interface QuorumCertificate { + qc_id: QcId; + block_id: BlockId; + block_height: NodeHeight; + epoch: Epoch; + signatures: Array; + merged_proof: any; + leaf_hashes: Array; + decision: QuorumDecision; +} diff --git a/bindings/src/types/QuorumDecision.ts b/bindings/src/types/QuorumDecision.ts new file mode 100644 index 0000000000..9aec4c8c50 --- /dev/null +++ b/bindings/src/types/QuorumDecision.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 QuorumDecision = "Accept" | "Reject"; diff --git a/bindings/src/types/RegisterValidatorNodeRequest.ts b/bindings/src/types/RegisterValidatorNodeRequest.ts new file mode 100644 index 0000000000..3ef1080cd7 --- /dev/null +++ b/bindings/src/types/RegisterValidatorNodeRequest.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface RegisterValidatorNodeRequest { + fee_claim_public_key: string; +} diff --git a/bindings/src/types/RegisterValidatorNodeResponse.ts b/bindings/src/types/RegisterValidatorNodeResponse.ts new file mode 100644 index 0000000000..40755f8c8e --- /dev/null +++ b/bindings/src/types/RegisterValidatorNodeResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface RegisterValidatorNodeResponse { + transaction_id: string; +} diff --git a/bindings/src/types/RejectReason.ts b/bindings/src/types/RejectReason.ts new file mode 100644 index 0000000000..f25adfe1c1 --- /dev/null +++ b/bindings/src/types/RejectReason.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type RejectReason = + | { ShardsNotPledged: string } + | { ExecutionFailure: string } + | "PreviousQcRejection" + | { ShardPledgedToAnotherPayload: string } + | { ShardRejected: string } + | "FeeTransactionFailed" + | { FeesNotPaid: string }; diff --git a/bindings/src/types/RequireRule.ts b/bindings/src/types/RequireRule.ts new file mode 100644 index 0000000000..f7eb307e2d --- /dev/null +++ b/bindings/src/types/RequireRule.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { RuleRequirement } from "./RuleRequirement"; + +export type RequireRule = + | { Require: RuleRequirement } + | { AnyOf: Array } + | { AllOf: Array }; diff --git a/bindings/src/types/Resource.ts b/bindings/src/types/Resource.ts new file mode 100644 index 0000000000..d2992b141a --- /dev/null +++ b/bindings/src/types/Resource.ts @@ -0,0 +1,15 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Metadata } from "./Metadata"; +import type { OwnerRule } from "./OwnerRule"; +import type { ResourceAccessRules } from "./ResourceAccessRules"; +import type { ResourceType } from "./ResourceType"; +import type { RistrettoPublicKeyBytes } from "./RistrettoPublicKeyBytes"; + +export interface Resource { + resource_type: ResourceType; + owner_rule: OwnerRule; + owner_key: RistrettoPublicKeyBytes; + access_rules: ResourceAccessRules; + metadata: Metadata; + total_supply: number; +} diff --git a/bindings/src/types/ResourceAccessRules.ts b/bindings/src/types/ResourceAccessRules.ts new file mode 100644 index 0000000000..ae459d2bba --- /dev/null +++ b/bindings/src/types/ResourceAccessRules.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AccessRule } from "./AccessRule"; + +export interface ResourceAccessRules { + mintable: AccessRule; + burnable: AccessRule; + recallable: AccessRule; + withdrawable: AccessRule; + depositable: AccessRule; + update_non_fungible_data: AccessRule; +} diff --git a/bindings/src/types/ResourceAddress.ts b/bindings/src/types/ResourceAddress.ts new file mode 100644 index 0000000000..906f22228e --- /dev/null +++ b/bindings/src/types/ResourceAddress.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 ResourceAddress = string; diff --git a/bindings/src/types/ResourceContainer.ts b/bindings/src/types/ResourceContainer.ts new file mode 100644 index 0000000000..7a72354492 --- /dev/null +++ b/bindings/src/types/ResourceContainer.ts @@ -0,0 +1,15 @@ +// 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 { NonFungibleId } from "./NonFungibleId"; +import type { ResourceAddress } from "./ResourceAddress"; + +export type ResourceContainer = + | { Fungible: { address: ResourceAddress; amount: Amount; locked_amount: Amount } } + | { + NonFungible: { + address: ResourceAddress; + token_ids: Array; + locked_token_ids: Array; + }; + } + | { Confidential: { address: ResourceAddress; revealed_amount: Amount; locked_revealed_amount: Amount } }; diff --git a/bindings/src/types/ResourceType.ts b/bindings/src/types/ResourceType.ts new file mode 100644 index 0000000000..84db56ac98 --- /dev/null +++ b/bindings/src/types/ResourceType.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 ResourceType = "Fungible" | "NonFungible" | "Confidential"; diff --git a/bindings/src/types/RestrictedAccessRule.ts b/bindings/src/types/RestrictedAccessRule.ts new file mode 100644 index 0000000000..a4e307c2b5 --- /dev/null +++ b/bindings/src/types/RestrictedAccessRule.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { RequireRule } from "./RequireRule"; + +export type RestrictedAccessRule = + | { Require: RequireRule } + | { AnyOf: Array } + | { AllOf: Array }; diff --git a/bindings/src/types/RevealFundsRequest.ts b/bindings/src/types/RevealFundsRequest.ts new file mode 100644 index 0000000000..46fcb1f245 --- /dev/null +++ b/bindings/src/types/RevealFundsRequest.ts @@ -0,0 +1,10 @@ +// 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 { ComponentAddressOrName } from "./ComponentAddressOrName"; + +export interface RevealFundsRequest { + account: ComponentAddressOrName | null; + amount_to_reveal: Amount; + pay_fee_from_reveal: boolean; + max_fee: Amount | null; +} diff --git a/bindings/src/types/RevealFundsResponse.ts b/bindings/src/types/RevealFundsResponse.ts new file mode 100644 index 0000000000..3d610b2870 --- /dev/null +++ b/bindings/src/types/RevealFundsResponse.ts @@ -0,0 +1,10 @@ +// 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 { FinalizeResult } from "./FinalizeResult"; +import type { TransactionId } from "./TransactionId"; + +export interface RevealFundsResponse { + transaction_id: TransactionId; + fee: Amount; + result: FinalizeResult; +} diff --git a/bindings/src/types/RistrettoPublicKeyBytes.ts b/bindings/src/types/RistrettoPublicKeyBytes.ts new file mode 100644 index 0000000000..630c16a4c2 --- /dev/null +++ b/bindings/src/types/RistrettoPublicKeyBytes.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 RistrettoPublicKeyBytes = string; diff --git a/bindings/src/types/RuleRequirement.ts b/bindings/src/types/RuleRequirement.ts new file mode 100644 index 0000000000..0446b5070c --- /dev/null +++ b/bindings/src/types/RuleRequirement.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddress } from "./ComponentAddress"; +import type { Hash } from "./Hash"; +import type { NonFungibleAddress } from "./NonFungibleAddress"; +import type { ResourceAddress } from "./ResourceAddress"; + +export type RuleRequirement = + | { Resource: ResourceAddress } + | { NonFungibleAddress: NonFungibleAddress } + | { ScopedToComponent: ComponentAddress } + | { ScopedToTemplate: Hash }; diff --git a/bindings/src/types/SettingsGetResponse.ts b/bindings/src/types/SettingsGetResponse.ts new file mode 100644 index 0000000000..7ba7469dfc --- /dev/null +++ b/bindings/src/types/SettingsGetResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface SettingsGetResponse { + indexer_url: string; +} diff --git a/bindings/src/types/SettingsSetRequest.ts b/bindings/src/types/SettingsSetRequest.ts new file mode 100644 index 0000000000..c026eebbd8 --- /dev/null +++ b/bindings/src/types/SettingsSetRequest.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface SettingsSetRequest { + indexer_url: string; +} diff --git a/bindings/src/types/SettingsSetResponse.ts b/bindings/src/types/SettingsSetResponse.ts new file mode 100644 index 0000000000..c2691f1b13 --- /dev/null +++ b/bindings/src/types/SettingsSetResponse.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 SettingsSetResponse = Record; diff --git a/bindings/src/types/Shard.ts b/bindings/src/types/Shard.ts new file mode 100644 index 0000000000..ce3f3f311c --- /dev/null +++ b/bindings/src/types/Shard.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 Shard = number; diff --git a/bindings/src/types/ShardEvidence.ts b/bindings/src/types/ShardEvidence.ts new file mode 100644 index 0000000000..5b95a344c5 --- /dev/null +++ b/bindings/src/types/ShardEvidence.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { LockFlag } from "./LockFlag"; +import type { QcId } from "./QcId"; + +export interface ShardEvidence { + qc_ids: Array; + lock: LockFlag; +} diff --git a/bindings/src/types/SubmitTransactionRequest.ts b/bindings/src/types/SubmitTransactionRequest.ts new file mode 100644 index 0000000000..4adb54db85 --- /dev/null +++ b/bindings/src/types/SubmitTransactionRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Transaction } from "./Transaction"; + +export interface SubmitTransactionRequest { + transaction: Transaction; + is_dry_run: boolean; +} diff --git a/bindings/src/types/SubmitTransactionResponse.ts b/bindings/src/types/SubmitTransactionResponse.ts new file mode 100644 index 0000000000..744da4e6dc --- /dev/null +++ b/bindings/src/types/SubmitTransactionResponse.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { DryRunTransactionFinalizeResult } from "./DryRunTransactionFinalizeResult"; +import type { TransactionId } from "./TransactionId"; + +export interface SubmitTransactionResponse { + transaction_id: TransactionId; + dry_run_result: DryRunTransactionFinalizeResult | null; +} diff --git a/bindings/src/types/Substate.ts b/bindings/src/types/Substate.ts new file mode 100644 index 0000000000..d8fe1b7371 --- /dev/null +++ b/bindings/src/types/Substate.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateValue } from "./SubstateValue"; + +export interface Substate { + substate: SubstateValue; + version: number; +} diff --git a/bindings/src/types/SubstateAddress.ts b/bindings/src/types/SubstateAddress.ts new file mode 100644 index 0000000000..3879aa84bd --- /dev/null +++ b/bindings/src/types/SubstateAddress.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 SubstateAddress = string; diff --git a/bindings/src/types/SubstateDestroyed.ts b/bindings/src/types/SubstateDestroyed.ts new file mode 100644 index 0000000000..8c37599337 --- /dev/null +++ b/bindings/src/types/SubstateDestroyed.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BlockId } from "./BlockId"; +import type { Epoch } from "./Epoch"; +import type { QcId } from "./QcId"; +import type { TransactionId } from "./TransactionId"; + +export interface SubstateDestroyed { + by_transaction: TransactionId; + justify: QcId; + by_block: BlockId; + at_epoch: Epoch; +} diff --git a/bindings/src/types/SubstateDiff.ts b/bindings/src/types/SubstateDiff.ts new file mode 100644 index 0000000000..74fc6a30de --- /dev/null +++ b/bindings/src/types/SubstateDiff.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Substate } from "./Substate"; +import type { SubstateId } from "./SubstateId"; + +export interface SubstateDiff { + up_substates: Array<[SubstateId, Substate]>; + down_substates: Array<[SubstateId, number]>; +} diff --git a/bindings/src/types/SubstateId.ts b/bindings/src/types/SubstateId.ts new file mode 100644 index 0000000000..3f40e1ddfe --- /dev/null +++ b/bindings/src/types/SubstateId.ts @@ -0,0 +1,19 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddress } from "./ComponentAddress"; +import type { FeeClaimAddress } from "./FeeClaimAddress"; +import type { NonFungibleAddress } from "./NonFungibleAddress"; +import type { NonFungibleIndexAddress } from "./NonFungibleIndexAddress"; +import type { ResourceAddress } from "./ResourceAddress"; +import type { TransactionReceiptAddress } from "./TransactionReceiptAddress"; +import type { UnclaimedConfidentialOutputAddress } from "./UnclaimedConfidentialOutputAddress"; +import type { VaultId } from "./VaultId"; + +export type SubstateId = + | { Component: ComponentAddress } + | { Resource: ResourceAddress } + | { Vault: VaultId } + | { UnclaimedConfidentialOutput: UnclaimedConfidentialOutputAddress } + | { NonFungible: NonFungibleAddress } + | { NonFungibleIndex: NonFungibleIndexAddress } + | { TransactionReceipt: TransactionReceiptAddress } + | { FeeClaim: FeeClaimAddress }; diff --git a/bindings/src/types/SubstateRecord.ts b/bindings/src/types/SubstateRecord.ts new file mode 100644 index 0000000000..2ca39e3375 --- /dev/null +++ b/bindings/src/types/SubstateRecord.ts @@ -0,0 +1,22 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BlockId } from "./BlockId"; +import type { Epoch } from "./Epoch"; +import type { NodeHeight } from "./NodeHeight"; +import type { QcId } from "./QcId"; +import type { SubstateDestroyed } from "./SubstateDestroyed"; +import type { SubstateId } from "./SubstateId"; +import type { SubstateValue } from "./SubstateValue"; +import type { TransactionId } from "./TransactionId"; + +export interface SubstateRecord { + substate_id: SubstateId; + version: number; + substate_value: SubstateValue; + state_hash: string; + created_by_transaction: TransactionId; + created_justify: QcId; + created_block: BlockId; + created_height: NodeHeight; + created_at_epoch: Epoch; + destroyed: SubstateDestroyed | null; +} diff --git a/bindings/src/types/SubstateRequirement.ts b/bindings/src/types/SubstateRequirement.ts new file mode 100644 index 0000000000..4b5851ab3c --- /dev/null +++ b/bindings/src/types/SubstateRequirement.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateId } from "./SubstateId"; + +export interface SubstateRequirement { + substate_id: SubstateId; + version: number | null; +} diff --git a/bindings/src/types/SubstateStatus.ts b/bindings/src/types/SubstateStatus.ts new file mode 100644 index 0000000000..41a04febde --- /dev/null +++ b/bindings/src/types/SubstateStatus.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 SubstateStatus = "Up" | "Down" | "DoesNotExist"; diff --git a/bindings/src/types/SubstateValue.ts b/bindings/src/types/SubstateValue.ts new file mode 100644 index 0000000000..a2ba32440d --- /dev/null +++ b/bindings/src/types/SubstateValue.ts @@ -0,0 +1,19 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentHeader } from "./ComponentHeader"; +import type { FeeClaim } from "./FeeClaim"; +import type { NonFungibleContainer } from "./NonFungibleContainer"; +import type { NonFungibleIndex } from "./NonFungibleIndex"; +import type { Resource } from "./Resource"; +import type { TransactionReceipt } from "./TransactionReceipt"; +import type { UnclaimedConfidentialOutput } from "./UnclaimedConfidentialOutput"; +import type { Vault } from "./Vault"; + +export type SubstateValue = + | { Component: ComponentHeader } + | { Resource: Resource } + | { Vault: Vault } + | { NonFungible: NonFungibleContainer } + | { NonFungibleIndex: NonFungibleIndex } + | { UnclaimedConfidentialOutput: UnclaimedConfidentialOutput } + | { TransactionReceipt: TransactionReceipt } + | { FeeClaim: FeeClaim }; diff --git a/bindings/src/types/TemplateAbi.ts b/bindings/src/types/TemplateAbi.ts new file mode 100644 index 0000000000..dc04350ce5 --- /dev/null +++ b/bindings/src/types/TemplateAbi.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { FunctionDef } from "./FunctionDef"; + +export interface TemplateAbi { + template_name: string; + functions: Array; +} diff --git a/bindings/src/types/TemplateMetadata.ts b/bindings/src/types/TemplateMetadata.ts new file mode 100644 index 0000000000..2d4f33bc52 --- /dev/null +++ b/bindings/src/types/TemplateMetadata.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Hash } from "./Hash"; + +export interface TemplateMetadata { + name: string; + address: Hash; + url: string; + binary_sha: Array; + height: bigint; +} diff --git a/bindings/src/types/TemplateRegistrationRequest.ts b/bindings/src/types/TemplateRegistrationRequest.ts new file mode 100644 index 0000000000..38d9df6d7e --- /dev/null +++ b/bindings/src/types/TemplateRegistrationRequest.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface TemplateRegistrationRequest { + template_name: string; + template_version: number; + repo_url: string; + commit_hash: Array; + binary_sha: Array; + binary_url: string; + template_type: string; +} diff --git a/bindings/src/types/TemplateRegistrationResponse.ts b/bindings/src/types/TemplateRegistrationResponse.ts new file mode 100644 index 0000000000..100aae44d6 --- /dev/null +++ b/bindings/src/types/TemplateRegistrationResponse.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface TemplateRegistrationResponse { + template_address: Array; + transaction_id: bigint; +} diff --git a/bindings/src/types/Transaction.ts b/bindings/src/types/Transaction.ts new file mode 100644 index 0000000000..3f248f7cff --- /dev/null +++ b/bindings/src/types/Transaction.ts @@ -0,0 +1,17 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Epoch } from "./Epoch"; +import type { Instruction } from "./Instruction"; +import type { SubstateAddress } from "./SubstateAddress"; +import type { TransactionSignature } from "./TransactionSignature"; + +export interface Transaction { + id: string; + fee_instructions: Array; + instructions: Array; + signature: TransactionSignature; + inputs: Array; + input_refs: Array; + filled_inputs: Array; + min_epoch: Epoch | null; + max_epoch: Epoch | null; +} diff --git a/bindings/src/types/TransactionAtom.ts b/bindings/src/types/TransactionAtom.ts new file mode 100644 index 0000000000..e72e23050f --- /dev/null +++ b/bindings/src/types/TransactionAtom.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Decision } from "./Decision"; +import type { Evidence } from "./Evidence"; +import type { TransactionId } from "./TransactionId"; + +export interface TransactionAtom { + id: TransactionId; + decision: Decision; + evidence: Evidence; + transaction_fee: bigint; + leader_fee: bigint; +} diff --git a/bindings/src/types/TransactionClaimBurnResponse.ts b/bindings/src/types/TransactionClaimBurnResponse.ts new file mode 100644 index 0000000000..bd86637f60 --- /dev/null +++ b/bindings/src/types/TransactionClaimBurnResponse.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SubstateAddress } from "./SubstateAddress"; +import type { TransactionId } from "./TransactionId"; + +export interface TransactionClaimBurnResponse { + transaction_id: TransactionId; + inputs: Array; + outputs: Array; +} diff --git a/bindings/src/types/TransactionGetAllRequest.ts b/bindings/src/types/TransactionGetAllRequest.ts new file mode 100644 index 0000000000..203a2c258b --- /dev/null +++ b/bindings/src/types/TransactionGetAllRequest.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ComponentAddress } from "./ComponentAddress"; +import type { TransactionStatus } from "./TransactionStatus"; + +export interface TransactionGetAllRequest { + status: TransactionStatus | null; + component: ComponentAddress | null; +} diff --git a/bindings/src/types/TransactionGetAllResponse.ts b/bindings/src/types/TransactionGetAllResponse.ts new file mode 100644 index 0000000000..797057e23d --- /dev/null +++ b/bindings/src/types/TransactionGetAllResponse.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { FinalizeResult } from "./FinalizeResult"; +import type { Transaction } from "./Transaction"; +import type { TransactionStatus } from "./TransactionStatus"; + +export interface TransactionGetAllResponse { + transactions: Array<[Transaction, FinalizeResult | null, TransactionStatus, string]>; +} diff --git a/bindings/src/types/TransactionGetRequest.ts b/bindings/src/types/TransactionGetRequest.ts new file mode 100644 index 0000000000..c726ca6e17 --- /dev/null +++ b/bindings/src/types/TransactionGetRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TransactionId } from "./TransactionId"; + +export interface TransactionGetRequest { + transaction_id: TransactionId; +} diff --git a/bindings/src/types/TransactionGetResponse.ts b/bindings/src/types/TransactionGetResponse.ts new file mode 100644 index 0000000000..2d475b3482 --- /dev/null +++ b/bindings/src/types/TransactionGetResponse.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { FinalizeResult } from "./FinalizeResult"; +import type { Transaction } from "./Transaction"; +import type { TransactionStatus } from "./TransactionStatus"; + +export interface TransactionGetResponse { + transaction: Transaction; + result: FinalizeResult | null; + status: TransactionStatus; + last_update_time: string; +} diff --git a/bindings/src/types/TransactionGetResultRequest.ts b/bindings/src/types/TransactionGetResultRequest.ts new file mode 100644 index 0000000000..93a8a8b0be --- /dev/null +++ b/bindings/src/types/TransactionGetResultRequest.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TransactionId } from "./TransactionId"; + +export interface TransactionGetResultRequest { + transaction_id: TransactionId; +} diff --git a/bindings/src/types/TransactionGetResultResponse.ts b/bindings/src/types/TransactionGetResultResponse.ts new file mode 100644 index 0000000000..91348f1508 --- /dev/null +++ b/bindings/src/types/TransactionGetResultResponse.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { FinalizeResult } from "./FinalizeResult"; +import type { TransactionId } from "./TransactionId"; +import type { TransactionStatus } from "./TransactionStatus"; + +export interface TransactionGetResultResponse { + transaction_id: TransactionId; + status: TransactionStatus; + result: FinalizeResult | null; + json_result: Array | null; +} diff --git a/bindings/src/types/TransactionId.ts b/bindings/src/types/TransactionId.ts new file mode 100644 index 0000000000..a140afa9bf --- /dev/null +++ b/bindings/src/types/TransactionId.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface TransactionId { + id: string; +} diff --git a/bindings/src/types/TransactionReceipt.ts b/bindings/src/types/TransactionReceipt.ts new file mode 100644 index 0000000000..e68f67601a --- /dev/null +++ b/bindings/src/types/TransactionReceipt.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Event } from "./Event"; +import type { FeeReceipt } from "./FeeReceipt"; +import type { Hash } from "./Hash"; +import type { LogEntry } from "./LogEntry"; + +export interface TransactionReceipt { + transaction_hash: Hash; + events: Array; + logs: Array; + fee_receipt: FeeReceipt; +} diff --git a/bindings/src/types/TransactionReceiptAddress.ts b/bindings/src/types/TransactionReceiptAddress.ts new file mode 100644 index 0000000000..8a7ba6c021 --- /dev/null +++ b/bindings/src/types/TransactionReceiptAddress.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 TransactionReceiptAddress = string; diff --git a/bindings/src/types/TransactionResult.ts b/bindings/src/types/TransactionResult.ts new file mode 100644 index 0000000000..4b1b22f80d --- /dev/null +++ b/bindings/src/types/TransactionResult.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { RejectReason } from "./RejectReason"; +import type { SubstateDiff } from "./SubstateDiff"; + +export type TransactionResult = + | { Accept: SubstateDiff } + | { AcceptFeeRejectRest: [SubstateDiff, RejectReason] } + | { Reject: RejectReason }; diff --git a/bindings/src/types/TransactionSignature.ts b/bindings/src/types/TransactionSignature.ts new file mode 100644 index 0000000000..ed0edef18b --- /dev/null +++ b/bindings/src/types/TransactionSignature.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface TransactionSignature { + public_key: string; + signature: string; +} diff --git a/bindings/src/types/TransactionStatus.ts b/bindings/src/types/TransactionStatus.ts new file mode 100644 index 0000000000..ab9356ff73 --- /dev/null +++ b/bindings/src/types/TransactionStatus.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type TransactionStatus = + | "New" + | "DryRun" + | "Pending" + | "Accepted" + | "Rejected" + | "InvalidTransaction" + | "OnlyFeeAccepted"; diff --git a/bindings/src/types/TransactionSubmitRequest.ts b/bindings/src/types/TransactionSubmitRequest.ts new file mode 100644 index 0000000000..19c3543629 --- /dev/null +++ b/bindings/src/types/TransactionSubmitRequest.ts @@ -0,0 +1,16 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Epoch } from "./Epoch"; +import type { Instruction } from "./Instruction"; +import type { SubstateRequirement } from "./SubstateRequirement"; + +export interface TransactionSubmitRequest { + signing_key_index: bigint | null; + fee_instructions: Array; + instructions: Array; + inputs: Array; + override_inputs: boolean; + is_dry_run: boolean; + proof_ids: Array; + min_epoch: Epoch | null; + max_epoch: Epoch | null; +} diff --git a/bindings/src/types/TransactionSubmitResponse.ts b/bindings/src/types/TransactionSubmitResponse.ts new file mode 100644 index 0000000000..50d515f626 --- /dev/null +++ b/bindings/src/types/TransactionSubmitResponse.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ExecuteResult } from "./ExecuteResult"; +import type { SubstateRequirement } from "./SubstateRequirement"; +import type { TransactionId } from "./TransactionId"; + +export interface TransactionSubmitResponse { + transaction_id: TransactionId; + inputs: Array; + result: ExecuteResult | null; + json_result: Array | null; +} diff --git a/bindings/src/types/TransactionWaitResultRequest.ts b/bindings/src/types/TransactionWaitResultRequest.ts new file mode 100644 index 0000000000..3df763358d --- /dev/null +++ b/bindings/src/types/TransactionWaitResultRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TransactionId } from "./TransactionId"; + +export interface TransactionWaitResultRequest { + transaction_id: TransactionId; + timeout_secs: bigint | null; +} diff --git a/bindings/src/types/TransactionWaitResultResponse.ts b/bindings/src/types/TransactionWaitResultResponse.ts new file mode 100644 index 0000000000..39756f410e --- /dev/null +++ b/bindings/src/types/TransactionWaitResultResponse.ts @@ -0,0 +1,14 @@ +// 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 { FinalizeResult } from "./FinalizeResult"; +import type { TransactionId } from "./TransactionId"; +import type { TransactionStatus } from "./TransactionStatus"; + +export interface TransactionWaitResultResponse { + transaction_id: TransactionId; + result: FinalizeResult | null; + json_result: Array | null; + status: TransactionStatus; + final_fee: Amount; + timed_out: boolean; +} diff --git a/bindings/src/types/TransferRequest.ts b/bindings/src/types/TransferRequest.ts new file mode 100644 index 0000000000..2be0c02663 --- /dev/null +++ b/bindings/src/types/TransferRequest.ts @@ -0,0 +1,13 @@ +// 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 { ComponentAddressOrName } from "./ComponentAddressOrName"; +import type { ResourceAddress } from "./ResourceAddress"; + +export interface TransferRequest { + account: ComponentAddressOrName | null; + amount: Amount; + resource_address: ResourceAddress; + destination_public_key: string; + max_fee: Amount | null; + dry_run: boolean; +} diff --git a/bindings/src/types/TransferResponse.ts b/bindings/src/types/TransferResponse.ts new file mode 100644 index 0000000000..5103d05d99 --- /dev/null +++ b/bindings/src/types/TransferResponse.ts @@ -0,0 +1,11 @@ +// 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 { FinalizeResult } from "./FinalizeResult"; +import type { TransactionId } from "./TransactionId"; + +export interface TransferResponse { + transaction_id: TransactionId; + fee: Amount; + fee_refunded: Amount; + result: FinalizeResult; +} diff --git a/bindings/src/types/Type.ts b/bindings/src/types/Type.ts new file mode 100644 index 0000000000..ac5048892c --- /dev/null +++ b/bindings/src/types/Type.ts @@ -0,0 +1,19 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Type = + | "Unit" + | "Bool" + | "I8" + | "I16" + | "I32" + | "I64" + | "I128" + | "U8" + | "U16" + | "U32" + | "U64" + | "U128" + | "String" + | { Vec: Type } + | { Tuple: Array } + | { Other: { name: string } }; diff --git a/bindings/src/types/UnclaimedConfidentialOutput.ts b/bindings/src/types/UnclaimedConfidentialOutput.ts new file mode 100644 index 0000000000..013b42752b --- /dev/null +++ b/bindings/src/types/UnclaimedConfidentialOutput.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EncryptedData } from "./EncryptedData"; + +export interface UnclaimedConfidentialOutput { + commitment: string; + encrypted_data: EncryptedData; +} diff --git a/bindings/src/types/UnclaimedConfidentialOutputAddress.ts b/bindings/src/types/UnclaimedConfidentialOutputAddress.ts new file mode 100644 index 0000000000..db538cd5e1 --- /dev/null +++ b/bindings/src/types/UnclaimedConfidentialOutputAddress.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 UnclaimedConfidentialOutputAddress = string; diff --git a/bindings/src/types/ValidatorFee.ts b/bindings/src/types/ValidatorFee.ts new file mode 100644 index 0000000000..e731594228 --- /dev/null +++ b/bindings/src/types/ValidatorFee.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BlockId } from "./BlockId"; +import type { Epoch } from "./Epoch"; + +export interface ValidatorFee { + validator_public_key: string; + epoch: Epoch; + block_id: BlockId; + total_fee_due: bigint; + total_transaction_fee: bigint; +} diff --git a/bindings/src/types/ValidatorNode.ts b/bindings/src/types/ValidatorNode.ts new file mode 100644 index 0000000000..21e653abe8 --- /dev/null +++ b/bindings/src/types/ValidatorNode.ts @@ -0,0 +1,13 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Epoch } from "./Epoch"; +import type { Shard } from "./Shard"; +import type { SubstateAddress } from "./SubstateAddress"; + +export interface ValidatorNode { + address: string; + public_key: string; + shard_key: SubstateAddress; + epoch: Epoch; + committee_shard: Shard | null; + fee_claim_public_key: string; +} diff --git a/bindings/src/types/ValidatorSignature.ts b/bindings/src/types/ValidatorSignature.ts new file mode 100644 index 0000000000..2e4e824718 --- /dev/null +++ b/bindings/src/types/ValidatorSignature.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface ValidatorSignature { + public_key: string; + signature: { public_nonce: string; signature: string }; +} diff --git a/bindings/src/types/Vault.ts b/bindings/src/types/Vault.ts new file mode 100644 index 0000000000..61fc56e731 --- /dev/null +++ b/bindings/src/types/Vault.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ResourceContainer } from "./ResourceContainer"; +import type { VaultId } from "./VaultId"; + +export interface Vault { + vault_id: VaultId; + resource_container: ResourceContainer; +} diff --git a/bindings/src/types/VaultId.ts b/bindings/src/types/VaultId.ts new file mode 100644 index 0000000000..781cfdc982 --- /dev/null +++ b/bindings/src/types/VaultId.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 VaultId = string; diff --git a/bindings/src/types/WebRtcStart.ts b/bindings/src/types/WebRtcStart.ts new file mode 100644 index 0000000000..f85d79058d --- /dev/null +++ b/bindings/src/types/WebRtcStart.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface WebRtcStart { + jwt: string; +} diff --git a/bindings/src/types/WebRtcStartRequest.ts b/bindings/src/types/WebRtcStartRequest.ts new file mode 100644 index 0000000000..33e7fa94a5 --- /dev/null +++ b/bindings/src/types/WebRtcStartRequest.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface WebRtcStartRequest { + signaling_server_token: string; + permissions: string; + name: string; +} diff --git a/bindings/src/types/WebRtcStartResponse.ts b/bindings/src/types/WebRtcStartResponse.ts new file mode 100644 index 0000000000..2bd57d7adb --- /dev/null +++ b/bindings/src/types/WebRtcStartResponse.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 WebRtcStartResponse = Record; diff --git a/clients/tari_indexer_client/Cargo.toml b/clients/tari_indexer_client/Cargo.toml index d474a23e4b..7263769bd4 100644 --- a/clients/tari_indexer_client/Cargo.toml +++ b/clients/tari_indexer_client/Cargo.toml @@ -21,3 +21,7 @@ serde = { workspace = true, default-features = true } serde_json = { workspace = true } serde_with = { workspace = true } thiserror = { workspace = true } +ts-rs = { workspace = true, optional = true } + +[features] +ts = ["ts-rs"] diff --git a/clients/tari_indexer_client/src/types.rs b/clients/tari_indexer_client/src/types.rs index 13beb35f8b..49f52582f1 100644 --- a/clients/tari_indexer_client/src/types.rs +++ b/clients/tari_indexer_client/src/types.rs @@ -16,8 +16,11 @@ use tari_engine_types::{ substate::{Substate, SubstateId}, }; use tari_transaction::{SubstateRequirement, Transaction, TransactionId}; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetSubstateRequest { #[serde(with = "serde_tools::string")] pub address: SubstateId, @@ -27,6 +30,7 @@ pub struct GetSubstateRequest { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetSubstateResponse { #[serde(with = "serde_tools::string")] pub address: SubstateId, @@ -37,6 +41,7 @@ pub struct GetSubstateResponse { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct InspectSubstateRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -45,15 +50,18 @@ pub struct InspectSubstateRequest { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct InspectSubstateResponse { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, pub version: u32, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub substate_contents: serde_json::Value, pub created_by_transaction: TransactionId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SubmitTransactionRequest { pub transaction: Transaction, pub required_substates: Vec, @@ -61,22 +69,26 @@ pub struct SubmitTransactionRequest { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SubmitTransactionResponse { pub transaction_id: TransactionId, pub result: IndexerTransactionFinalizedResult, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTransactionResultRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTransactionResultResponse { pub result: IndexerTransactionFinalizedResult, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum IndexerTransactionFinalizedResult { Pending, Finalized { @@ -85,19 +97,24 @@ pub enum IndexerTransactionFinalizedResult { execution_time: Duration, finalized_time: Duration, abort_details: Option, + #[cfg_attr(feature = "ts", ts(type = "Array"))] json_results: Vec, }, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetIdentityResponse { pub peer_id: String, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, + #[cfg_attr(feature = "ts", ts(type = "Array"))] pub public_addresses: Vec, } #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AddAddressRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -105,6 +122,7 @@ pub struct AddAddressRequest { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct DeleteAddressRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -112,6 +130,7 @@ pub struct DeleteAddressRequest { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetNonFungibleCountRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -119,6 +138,7 @@ pub struct GetNonFungibleCountRequest { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetNonFungiblesRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -127,12 +147,14 @@ pub struct GetNonFungiblesRequest { } #[derive(Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetNonFungiblesResponse { pub non_fungibles: Vec, } #[serde_as] #[derive(Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct NonFungibleSubstate { pub index: u64, #[serde_as(as = "DisplayFromStr")] @@ -142,6 +164,7 @@ pub struct NonFungibleSubstate { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetRelatedTransactionsRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -149,43 +172,55 @@ pub struct GetRelatedTransactionsRequest { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetRelatedTransactionsResponse { pub transaction_results: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AddPeerRequest { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, + #[cfg_attr(feature = "ts", ts(type = "Array"))] pub addresses: Vec, pub wait_for_dial: bool, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AddPeerResponse {} #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetEpochManagerStatsResponse { pub current_epoch: Epoch, pub current_block_height: u64, } #[derive(Serialize, Debug)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Connection { pub connection_id: String, pub peer_id: String, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub address: Multiaddr, pub direction: ConnectionDirection, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub age: Duration, + #[cfg_attr(feature = "ts", ts(type = "string | null"))] pub ping_latency: Option, } #[derive(Serialize, Debug)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum ConnectionDirection { Inbound, Outbound, } #[derive(Serialize, Debug)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetConnectionsResponse { pub connections: Vec, } diff --git a/clients/validator_node_client/Cargo.toml b/clients/validator_node_client/Cargo.toml index 8711155de1..64e00098be 100644 --- a/clients/validator_node_client/Cargo.toml +++ b/clients/validator_node_client/Cargo.toml @@ -19,3 +19,7 @@ multiaddr = { workspace = true } serde = { workspace = true, default-features = true } serde_json = { workspace = true } thiserror = { workspace = true } +ts-rs = { workspace = true, optional = true } + +[features] +ts = ["ts-rs"] diff --git a/clients/validator_node_client/src/types.rs b/clients/validator_node_client/src/types.rs index 99af5f6dd5..390f133cac 100644 --- a/clients/validator_node_client/src/types.rs +++ b/clients/validator_node_client/src/types.rs @@ -39,11 +39,16 @@ use tari_engine_types::{ TemplateAddress, }; use tari_transaction::{Transaction, TransactionId}; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetIdentityResponse { pub peer_id: String, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, + #[cfg_attr(feature = "ts", ts(type = "Array"))] pub public_addresses: Vec, pub supported_protocols: Vec, pub protocol_version: String, @@ -51,6 +56,7 @@ pub struct GetIdentityResponse { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TemplateRegistrationRequest { pub template_name: String, pub template_version: u16, @@ -64,6 +70,7 @@ pub struct TemplateRegistrationRequest { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TemplateRegistrationResponse { #[serde(with = "serde_with::base64")] pub template_address: Vec, @@ -71,23 +78,27 @@ pub struct TemplateRegistrationResponse { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTemplateRequest { pub template_address: TemplateAddress, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTemplateResponse { pub registration_metadata: TemplateMetadata, pub abi: TemplateAbi, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TemplateAbi { pub template_name: String, pub functions: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct FunctionDef { pub name: String, pub arguments: Vec, @@ -96,22 +107,26 @@ pub struct FunctionDef { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ArgDef { pub name: String, pub arg_type: String, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTemplatesRequest { pub limit: u64, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTemplatesResponse { pub templates: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TemplateMetadata { pub name: String, pub address: TemplateAddress, @@ -124,12 +139,14 @@ pub struct TemplateMetadata { /// A request to submit a transaction #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SubmitTransactionRequest { pub transaction: Transaction, pub is_dry_run: bool, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SubmitTransactionResponse { pub transaction_id: TransactionId, /// The result is a _dry run_ transaction. @@ -137,6 +154,7 @@ pub struct SubmitTransactionResponse { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct DryRunTransactionFinalizeResult { pub decision: QuorumDecision, pub finalize: FinalizeResult, @@ -144,47 +162,58 @@ pub struct DryRunTransactionFinalizeResult { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTransactionRequest { pub transaction_id: TransactionId, } #[derive(Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTransactionResponse { pub transaction: ExecutedTransaction, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetSubstatesByTransactionRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetSubstatesByTransactionResponse { pub substates: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTransactionResultRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetTransactionResultResponse { pub result: Option, pub final_decision: Option, + #[cfg_attr(feature = "ts", ts(type = "string | null"))] pub finalized_time: Option, + #[cfg_attr(feature = "ts", ts(type = "string | null"))] pub execution_time: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetRecentTransactionsRequest {} #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetRecentTransactionsResponse { pub transactions: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ListBlocksRequest { /// If provided, `limit` blocks from the specified block back will be returned. Otherwise `limit` blocks from the /// leaf block will be provided. @@ -193,33 +222,40 @@ pub struct ListBlocksRequest { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ListBlocksResponse { pub blocks: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetBlockResponse { pub block: Block, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetBlocksResponse { pub blocks: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetBlocksCountResponse { pub count: i64, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct LogEntry { + #[cfg_attr(feature = "ts", ts(type = "number"))] pub timestamp: u64, pub message: String, pub level: LogLevel, } #[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum LogLevel { Error, Warn, @@ -228,17 +264,20 @@ pub enum LogLevel { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetCommitteeRequest { pub epoch: Epoch, pub substate_address: SubstateAddress, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetNetworkCommitteeResponse { pub current_epoch: Epoch, pub committees: Vec>, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct CommitteeShardInfo { pub shard: Shard, pub substate_address_range: RangeInclusive, @@ -246,28 +285,34 @@ pub struct CommitteeShardInfo { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetShardKey { pub height: u64, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetStateRequest { pub address: SubstateAddress, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetStateResponse { pub data: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetSubstateRequest { pub address: SubstateId, pub version: u32, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetSubstateResponse { pub value: Option, pub created_by_tx: Option, @@ -275,6 +320,7 @@ pub struct GetSubstateResponse { } #[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum SubstateStatus { Up, Down, @@ -282,16 +328,21 @@ pub enum SubstateStatus { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AddPeerRequest { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, + #[cfg_attr(feature = "ts", ts(type = "Array"))] pub addresses: Vec, pub wait_for_dial: bool, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AddPeerResponse {} #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetEpochManagerStatsResponse { pub current_epoch: Epoch, pub current_block_height: u64, @@ -300,28 +351,37 @@ pub struct GetEpochManagerStatsResponse { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct RegisterValidatorNodeRequest { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub fee_claim_public_key: PublicKey, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct RegisterValidatorNodeResponse { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub transaction_id: TxId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetValidatorFeesRequest { pub epoch_range: RangeInclusive, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub validator_public_key: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetValidatorFeesResponse { pub fees: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ValidatorFee { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub validator_public_key: PublicKey, pub epoch: Epoch, pub block_id: BlockId, @@ -347,11 +407,13 @@ impl From for ValidatorFee { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetBlockRequest { pub block_id: BlockId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetBlocksRequest { pub limit: u64, pub offset: u64, @@ -359,22 +421,28 @@ pub struct GetBlocksRequest { } #[derive(Serialize, Debug)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Connection { pub connection_id: String, pub peer_id: String, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub address: Multiaddr, pub direction: ConnectionDirection, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub age: Duration, + #[cfg_attr(feature = "ts", ts(type = "string | null"))] pub ping_latency: Option, } #[derive(Serialize, Debug)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum ConnectionDirection { Inbound, Outbound, } #[derive(Serialize, Debug)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetConnectionsResponse { pub connections: Vec, } diff --git a/clients/wallet_daemon_client/Cargo.toml b/clients/wallet_daemon_client/Cargo.toml index b6865b0053..5bc230717f 100644 --- a/clients/wallet_daemon_client/Cargo.toml +++ b/clients/wallet_daemon_client/Cargo.toml @@ -21,3 +21,7 @@ reqwest = { workspace = true, features = ["json"] } serde = { workspace = true, default-features = true } serde_json = { workspace = true } thiserror = { workspace = true } +ts-rs = { workspace = true, optional = true } + +[features] +ts = ["ts-rs"] diff --git a/clients/wallet_daemon_client/src/lib.rs b/clients/wallet_daemon_client/src/lib.rs index a582dfb265..0dd13e3547 100644 --- a/clients/wallet_daemon_client/src/lib.rs +++ b/clients/wallet_daemon_client/src/lib.rs @@ -40,6 +40,8 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json as json; use serde_json::json; use tari_template_lib::models::ComponentAddress; +#[cfg(feature = "ts")] +use ts_rs::TS; use types::{ AccountsCreateFreeTestCoinsRequest, AccountsCreateFreeTestCoinsResponse, @@ -118,6 +120,7 @@ use crate::{ }; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum ComponentAddressOrName { ComponentAddress(ComponentAddress), Name(String), diff --git a/clients/wallet_daemon_client/src/types.rs b/clients/wallet_daemon_client/src/types.rs index 9e8c9ee4b8..a17f4ebdf2 100644 --- a/clients/wallet_daemon_client/src/types.rs +++ b/clients/wallet_daemon_client/src/types.rs @@ -45,6 +45,8 @@ use tari_template_lib::{ prelude::{ComponentAddress, ConfidentialWithdrawProof, ResourceType}, }; use tari_transaction::{SubstateRequirement, Transaction, TransactionId}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ serialize::{opt_string_or_struct, string_or_struct}, @@ -52,12 +54,14 @@ use crate::{ }; #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct CallInstructionRequest { pub instructions: Vec, #[serde(deserialize_with = "string_or_struct")] pub fee_account: ComponentAddressOrName, #[serde(default, deserialize_with = "opt_string_or_struct")] pub dump_outputs_into: Option, + #[cfg_attr(feature = "ts", ts(type = "number"))] pub max_fee: u64, #[serde(default)] pub inputs: Vec, @@ -70,12 +74,15 @@ pub struct CallInstructionRequest { #[serde(default)] pub proof_ids: Vec, #[serde(default)] + #[cfg_attr(feature = "ts", ts(type = "number | null"))] pub min_epoch: Option, #[serde(default)] + #[cfg_attr(feature = "ts", ts(type = "number | null"))] pub max_epoch: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionSubmitRequest { pub signing_key_index: Option, pub fee_instructions: Vec, @@ -89,19 +96,23 @@ pub struct TransactionSubmitRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionSubmitResponse { pub transaction_id: TransactionId, pub inputs: Vec, pub result: Option, + #[cfg_attr(feature = "ts", ts(type = "Array | null"))] pub json_result: Option>, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionGetRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionGetResponse { pub transaction: Transaction, pub result: Option, @@ -110,39 +121,47 @@ pub struct TransactionGetResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionGetAllRequest { pub status: Option, pub component: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionGetAllResponse { pub transactions: Vec<(Transaction, Option, TransactionStatus, NaiveDateTime)>, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionGetResultRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionGetResultResponse { pub transaction_id: TransactionId, pub status: TransactionStatus, pub result: Option, + #[cfg_attr(feature = "ts", ts(type = "Array | null"))] pub json_result: Option>, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionWaitResultRequest { pub transaction_id: TransactionId, pub timeout_secs: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionWaitResultResponse { pub transaction_id: TransactionId, pub result: Option, + #[cfg_attr(feature = "ts", ts(type = "Array | null"))] pub json_result: Option>, pub status: TransactionStatus, pub final_fee: Amount, @@ -150,6 +169,7 @@ pub struct TransactionWaitResultResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionClaimBurnResponse { pub transaction_id: TransactionId, pub inputs: Vec, @@ -157,36 +177,48 @@ pub struct TransactionClaimBurnResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct KeysListRequest {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct KeysListResponse { /// (index, public key, is_active) + #[cfg_attr(feature = "ts", ts(type = "Array<[number, string, boolean]>"))] pub keys: Vec<(u64, PublicKey, bool)>, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct KeysSetActiveRequest { + #[cfg_attr(feature = "ts", ts(type = "number"))] pub index: u64, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct KeysSetActiveResponse { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct KeysCreateRequest { + #[cfg_attr(feature = "ts", ts(type = "number | null"))] pub specific_index: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct KeysCreateResponse { pub id: u64, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsCreateRequest { pub account_name: Option, pub custom_access_rules: Option, @@ -196,13 +228,16 @@ pub struct AccountsCreateRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsCreateResponse { pub address: SubstateId, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, pub result: FinalizeResult, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsInvokeRequest { #[serde(deserialize_with = "opt_string_or_struct")] pub account: Option, @@ -212,29 +247,37 @@ pub struct AccountsInvokeRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsInvokeResponse { pub result: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsListRequest { + #[cfg_attr(feature = "ts", ts(type = "number"))] pub offset: u64, + #[cfg_attr(feature = "ts", ts(type = "number"))] pub limit: u64, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountInfo { pub account: Account, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsListResponse { pub accounts: Vec, pub total: u64, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsGetBalancesRequest { #[serde(deserialize_with = "opt_string_or_struct")] pub account: Option, @@ -243,12 +286,14 @@ pub struct AccountsGetBalancesRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsGetBalancesResponse { pub address: SubstateId, pub balances: Vec, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct BalanceEntry { pub vault_address: SubstateId, #[serde(with = "serde_with::string")] @@ -283,43 +328,52 @@ impl BalanceEntry { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountGetRequest { #[serde(deserialize_with = "string_or_struct")] pub name_or_address: ComponentAddressOrName, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountGetDefaultRequest { // Intentionally empty. Fields may be added in the future. } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountGetResponse { pub account: Account, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountSetDefaultRequest { #[serde(deserialize_with = "string_or_struct")] pub account: ComponentAddressOrName, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountSetDefaultResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransferRequest { #[serde(deserialize_with = "opt_string_or_struct")] pub account: Option, pub amount: Amount, pub resource_address: ResourceAddress, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub destination_public_key: PublicKey, pub max_fee: Option, pub dry_run: bool, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransferResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -328,6 +382,7 @@ pub struct TransferResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ProofsGenerateRequest { pub amount: Amount, pub reveal_amount: Amount, @@ -336,50 +391,60 @@ pub struct ProofsGenerateRequest { // TODO: #[serde(deserialize_with = "string_or_struct")] pub resource_address: ResourceAddress, // TODO: For now, we assume that this is obtained "somehow" from the destination account + #[cfg_attr(feature = "ts", ts(type = "string"))] pub destination_public_key: PublicKey, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ProofsGenerateResponse { pub proof_id: ConfidentialProofId, pub proof: ConfidentialWithdrawProof, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ProofsFinalizeRequest { pub proof_id: ConfidentialProofId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ProofsFinalizeResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ProofsCancelRequest { pub proof_id: ConfidentialProofId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ConfidentialCreateOutputProofRequest { pub amount: Amount, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ConfidentialCreateOutputProofResponse { pub proof: ConfidentialOutputProof, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ConfidentialTransferRequest { #[serde(deserialize_with = "opt_string_or_struct")] pub account: Option, pub amount: Amount, pub resource_address: ResourceAddress, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub destination_public_key: PublicKey, pub max_fee: Option, pub dry_run: bool, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ConfidentialTransferResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -387,15 +452,19 @@ pub struct ConfidentialTransferResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ClaimBurnRequest { #[serde(deserialize_with = "opt_string_or_struct")] pub account: Option, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub claim_proof: serde_json::Value, pub max_fee: Option, + #[cfg_attr(feature = "ts", ts(type = "number | null"))] pub key_id: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ClaimBurnResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -403,9 +472,11 @@ pub struct ClaimBurnResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ProofsCancelResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct RevealFundsRequest { /// Account with funds to reveal #[serde(deserialize_with = "opt_string_or_struct")] @@ -419,6 +490,7 @@ pub struct RevealFundsRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct RevealFundsResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -426,28 +498,34 @@ pub struct RevealFundsResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsCreateFreeTestCoinsRequest { pub account: Option, pub amount: Amount, pub max_fee: Option, + #[cfg_attr(feature = "ts", ts(type = "number | null"))] pub key_id: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountsCreateFreeTestCoinsResponse { pub transaction_id: TransactionId, pub amount: Amount, pub fee: Amount, pub result: FinalizeResult, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct WebRtcStart { pub jwt: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct WebRtcStartRequest { pub signaling_server_token: String, pub permissions: String, @@ -455,55 +533,68 @@ pub struct WebRtcStartRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct WebRtcStartResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthLoginRequest { pub permissions: Vec, + #[cfg_attr(feature = "ts", ts(type = "string | null"))] pub duration: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthLoginResponse { pub auth_token: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthLoginAcceptRequest { pub auth_token: String, pub name: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthLoginAcceptResponse { pub permissions_token: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthLoginDenyRequest { pub auth_token: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthLoginDenyResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthRevokeTokenRequest { pub permission_token_id: i32, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthRevokeTokenResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct MintAccountNftRequest { pub account: ComponentAddressOrName, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub metadata: serde_json::Value, pub mint_fee: Option, pub create_account_nft_fee: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct MintAccountNftResponse { pub nft_id: NonFungibleId, pub resource_address: ResourceAddress, @@ -512,60 +603,76 @@ pub struct MintAccountNftResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetAccountNftRequest { pub nft_id: NonFungibleId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AccountNftInfo { + #[cfg_attr(feature = "ts", ts(type = "any"))] pub metadata: serde_json::Value, pub is_burned: bool, } +// #[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub type GetAccountNftResponse = AccountNftInfo; #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ListAccountNftRequest { + #[cfg_attr(feature = "ts", ts(type = "number"))] pub limit: u64, + #[cfg_attr(feature = "ts", ts(type = "number"))] pub offset: u64, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ListAccountNftResponse { pub nfts: Vec, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthGetAllJwtRequest {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct AuthGetAllJwtResponse { pub jwt: Vec, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetValidatorFeesRequest { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub validator_public_key: PublicKey, // TODO: We'll probably pass in a range of epochs and get non-zero amounts for each epoch in range pub epoch: Epoch, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct GetValidatorFeesResponse { pub fee_summary: HashMap, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ClaimValidatorFeesRequest { #[serde(default, deserialize_with = "opt_string_or_struct")] pub account: Option, pub max_fee: Option, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub validator_public_key: PublicKey, pub epoch: Epoch, pub dry_run: bool, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ClaimValidatorFeesResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -573,14 +680,17 @@ pub struct ClaimValidatorFeesResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SettingsSetRequest { pub indexer_url: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SettingsSetResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SettingsGetResponse { pub indexer_url: String, } diff --git a/dan_layer/common_types/Cargo.toml b/dan_layer/common_types/Cargo.toml index a7e3dfc9c6..a60c76346a 100644 --- a/dan_layer/common_types/Cargo.toml +++ b/dan_layer/common_types/Cargo.toml @@ -14,7 +14,7 @@ tari_bor = { workspace = true, default-features = true } tari_mmr = { workspace = true } tari_core = { workspace = true, default-features = false, features = [ "transactions", - "base_node_proto" + "base_node_proto", ] } libp2p-identity = { workspace = true, features = [ @@ -30,9 +30,13 @@ prost = { workspace = true } prost-types = { workspace = true } serde = { workspace = true, default-features = true } ruint = { workspace = true } +ts-rs = { workspace = true, optional = true } [build-dependencies] tari_common = { workspace = true, features = ["build"] } [package.metadata.cargo-machete] ignored = ["prost", "prost-types"] # false positive, used in OUT_DIR structs + +[features] +ts = ["ts-rs"] diff --git a/dan_layer/common_types/src/committee.rs b/dan_layer/common_types/src/committee.rs index a22d5b7ed8..a9f6fb05f1 100644 --- a/dan_layer/common_types/src/committee.rs +++ b/dan_layer/common_types/src/committee.rs @@ -6,6 +6,8 @@ use std::{borrow::Borrow, cmp}; use rand::{rngs::OsRng, seq::SliceRandom}; use serde::{Deserialize, Serialize}; use tari_common_types::types::PublicKey; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{shard::Shard, SubstateAddress}; @@ -156,6 +158,7 @@ impl FromIterator> for Committee { /// Represents a "slice" of the 256-bit shard space #[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct CommitteeShard { num_committees: u32, num_members: u32, diff --git a/dan_layer/common_types/src/epoch.rs b/dan_layer/common_types/src/epoch.rs index 209116d9cf..0919eeada8 100644 --- a/dan_layer/common_types/src/epoch.rs +++ b/dan_layer/common_types/src/epoch.rs @@ -24,9 +24,12 @@ use std::fmt::Display; use newtype_ops::newtype_ops; use serde::{Deserialize, Serialize}; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize)] -pub struct Epoch(pub u64); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct Epoch(#[cfg_attr(feature = "ts", ts(type = "number"))] pub u64); impl Epoch { pub fn as_u64(self) -> u64 { diff --git a/dan_layer/common_types/src/node_height.rs b/dan_layer/common_types/src/node_height.rs index 0407063835..4aa915315c 100644 --- a/dan_layer/common_types/src/node_height.rs +++ b/dan_layer/common_types/src/node_height.rs @@ -7,8 +7,11 @@ use std::{ }; use serde::{Deserialize, Serialize}; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct NodeHeight(pub u64); impl NodeHeight { diff --git a/dan_layer/common_types/src/shard.rs b/dan_layer/common_types/src/shard.rs index 3ec608e51c..1cf433e070 100644 --- a/dan_layer/common_types/src/shard.rs +++ b/dan_layer/common_types/src/shard.rs @@ -4,6 +4,8 @@ use std::{fmt::Display, ops::RangeInclusive}; use serde::{Deserialize, Serialize}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ uint::{U256, U256_ONE}, @@ -12,6 +14,7 @@ use crate::{ #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] #[serde(transparent)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Shard(u32); impl Shard { diff --git a/dan_layer/common_types/src/substate_address.rs b/dan_layer/common_types/src/substate_address.rs index ff163f0786..bf8a10cbf9 100644 --- a/dan_layer/common_types/src/substate_address.rs +++ b/dan_layer/common_types/src/substate_address.rs @@ -18,11 +18,18 @@ use tari_engine_types::{ substate::SubstateId, transaction_receipt::TransactionReceiptAddress, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{shard::Shard, uint::U256}; #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)] -pub struct SubstateAddress(#[serde(with = "serde_with::hex")] pub [u8; 32]); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct SubstateAddress( + #[serde(with = "serde_with::hex")] + #[cfg_attr(feature = "ts", ts(type = "string"))] + pub [u8; 32], +); impl SubstateAddress { /// Defines the mapping of SubstateId to SubstateAddress diff --git a/dan_layer/engine_types/Cargo.toml b/dan_layer/engine_types/Cargo.toml index 8304f5ef17..d80cb16688 100644 --- a/dan_layer/engine_types/Cargo.toml +++ b/dan_layer/engine_types/Cargo.toml @@ -26,8 +26,10 @@ lazy_static = { workspace = true } serde = { workspace = true, default-features = true } serde_json = { workspace = true } thiserror = { workspace = true } +ts-rs = { workspace = true, optional = true } [features] default = ["debugging"] # Includes the ability to create free test coins debugging = [] +ts = ["ts-rs"] diff --git a/dan_layer/engine_types/src/commit_result.rs b/dan_layer/engine_types/src/commit_result.rs index 45c00d7f65..b9b46686a0 100644 --- a/dan_layer/engine_types/src/commit_result.rs +++ b/dan_layer/engine_types/src/commit_result.rs @@ -24,6 +24,8 @@ use std::fmt::{self, Display, Formatter}; use serde::{Deserialize, Serialize}; use tari_template_lib::Hash; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ events::Event, @@ -35,6 +37,7 @@ use crate::{ }; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ExecuteResult { /// The finalized result to commit. If the fee transaction succeeds but the transaction fails, this will be accept. pub finalize: FinalizeResult, @@ -93,6 +96,7 @@ impl ExecuteResult { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct FinalizeResult { #[serde(with = "serde_with::hex")] pub transaction_hash: Hash, @@ -166,6 +170,7 @@ impl FinalizeResult { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum TransactionResult { Accept(SubstateDiff), AcceptFeeRejectRest(SubstateDiff, RejectReason), @@ -233,6 +238,7 @@ impl Display for TransactionResult { } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum RejectReason { ShardsNotPledged(String), ExecutionFailure(String), diff --git a/dan_layer/engine_types/src/component.rs b/dan_layer/engine_types/src/component.rs index ef08587c9c..b44f1d46a3 100644 --- a/dan_layer/engine_types/src/component.rs +++ b/dan_layer/engine_types/src/component.rs @@ -28,6 +28,8 @@ use tari_template_lib::{ prelude::ComponentAddress, Hash, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ hashing::{hasher32, EngineHashDomainLabel}, @@ -45,11 +47,13 @@ pub fn new_component_address_from_parts(template_address: &TemplateAddress, comp } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ComponentHeader { #[serde(with = "serde_with::hex")] pub template_address: TemplateAddress, pub module_name: String, #[serde(with = "serde_with::hex")] + #[cfg_attr(feature = "ts", ts(type = "string"))] pub owner_key: RistrettoPublicKeyBytes, pub owner_rule: OwnerRule, pub access_rules: ComponentAccessRules, @@ -93,8 +97,10 @@ impl ComponentHeader { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ComponentBody { #[serde(with = "serde_with::cbor_value")] + #[cfg_attr(feature = "ts", ts(type = "any"))] pub state: tari_bor::Value, } diff --git a/dan_layer/engine_types/src/confidential/claim.rs b/dan_layer/engine_types/src/confidential/claim.rs index 86d7cff639..3d58175f01 100644 --- a/dan_layer/engine_types/src/confidential/claim.rs +++ b/dan_layer/engine_types/src/confidential/claim.rs @@ -5,12 +5,17 @@ use serde::{Deserialize, Serialize}; use tari_common_types::types::PublicKey; use tari_crypto::ristretto::RistrettoComSig; use tari_template_lib::models::{ConfidentialWithdrawProof, UnclaimedConfidentialOutputAddress}; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Deserialize, Serialize, Eq, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ConfidentialClaim { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, pub output_address: UnclaimedConfidentialOutputAddress, pub range_proof: Vec, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub proof_of_knowledge: RistrettoComSig, pub withdraw_proof: Option, } diff --git a/dan_layer/engine_types/src/confidential/unclaimed.rs b/dan_layer/engine_types/src/confidential/unclaimed.rs index 350b0469bb..5f79c18991 100644 --- a/dan_layer/engine_types/src/confidential/unclaimed.rs +++ b/dan_layer/engine_types/src/confidential/unclaimed.rs @@ -24,9 +24,13 @@ use serde::{Deserialize, Serialize}; use tari_common_types::types::Commitment; use tari_template_lib::models::EncryptedData; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct UnclaimedConfidentialOutput { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub commitment: Commitment, pub encrypted_data: EncryptedData, } diff --git a/dan_layer/engine_types/src/confidential/withdraw.rs b/dan_layer/engine_types/src/confidential/withdraw.rs index f9c13b2f46..ff913c80bf 100644 --- a/dan_layer/engine_types/src/confidential/withdraw.rs +++ b/dan_layer/engine_types/src/confidential/withdraw.rs @@ -8,6 +8,8 @@ use tari_template_lib::{ crypto::BalanceProofSignature, models::{Amount, ConfidentialWithdrawProof, EncryptedData}, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::{challenges, get_commitment_factory, validate_confidential_proof}; use crate::resource_container::ResourceError; @@ -22,8 +24,11 @@ pub struct ValidatedConfidentialWithdrawProof { } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ConfidentialOutput { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub commitment: Commitment, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub stealth_public_nonce: PublicKey, pub encrypted_data: EncryptedData, pub minimum_value_promise: u64, diff --git a/dan_layer/engine_types/src/events.rs b/dan_layer/engine_types/src/events.rs index 87fc472736..f57c919a3e 100644 --- a/dan_layer/engine_types/src/events.rs +++ b/dan_layer/engine_types/src/events.rs @@ -28,16 +28,21 @@ use tari_template_lib::{ prelude::ComponentAddress, Hash, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::serde_with; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Event { #[serde(with = "serde_with::hex::option")] component_address: Option, #[serde(with = "serde_with::hex")] + #[cfg_attr(feature = "ts", ts(type = "string"))] template_address: TemplateAddress, #[serde(with = "serde_with::hex")] + #[cfg_attr(feature = "ts", ts(type = "string"))] tx_hash: Hash, topic: String, // NOTE: We need to use an ordered map here. HashMaps are unordered, so when we pledge this state the hash diff --git a/dan_layer/engine_types/src/fee_claim.rs b/dan_layer/engine_types/src/fee_claim.rs index 5ba05d9b5d..6e67a656ae 100644 --- a/dan_layer/engine_types/src/fee_claim.rs +++ b/dan_layer/engine_types/src/fee_claim.rs @@ -7,13 +7,16 @@ use serde::{Deserialize, Serialize}; use tari_bor::BorTag; use tari_common_types::types::PublicKey; use tari_template_lib::{models::BinaryTag, prelude::Amount, Hash}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::hashing::{hasher32, EngineHashDomainLabel}; const TAG: u64 = BinaryTag::FeeClaim.as_u64(); #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] -pub struct FeeClaimAddress(BorTag); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct FeeClaimAddress(#[cfg_attr(feature = "ts", ts(type = "string"))] BorTag); impl FeeClaimAddress { pub const fn new(address: Hash) -> Self { @@ -46,8 +49,10 @@ impl Display for FeeClaimAddress { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct FeeClaim { pub epoch: u64, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub validator_public_key: PublicKey, pub amount: Amount, } diff --git a/dan_layer/engine_types/src/fees.rs b/dan_layer/engine_types/src/fees.rs index 4e55eb4f49..05cea1b06b 100644 --- a/dan_layer/engine_types/src/fees.rs +++ b/dan_layer/engine_types/src/fees.rs @@ -5,10 +5,13 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; use tari_template_lib::models::{Amount, VaultId}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::resource_container::ResourceContainer; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct FeeReceipt { /// The total amount of the fee payment(s) pub total_fee_payment: Amount, @@ -61,6 +64,7 @@ impl FeeReceipt { } #[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum FeeSource { Initial, RuntimeCall, @@ -70,6 +74,7 @@ pub enum FeeSource { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct FeeCostBreakdown { pub total_fees_charged: Amount, pub breakdown: Vec<(FeeSource, u64)>, diff --git a/dan_layer/engine_types/src/indexed_value.rs b/dan_layer/engine_types/src/indexed_value.rs index 130b528db1..9b82df8220 100644 --- a/dan_layer/engine_types/src/indexed_value.rs +++ b/dan_layer/engine_types/src/indexed_value.rs @@ -10,6 +10,8 @@ use tari_template_lib::{ prelude::{ComponentAddress, Metadata, NonFungibleAddress}, Hash, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ fee_claim::FeeClaimAddress, @@ -21,9 +23,11 @@ use crate::{ const MAX_VISITOR_DEPTH: usize = 50; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct IndexedValue { indexed: IndexedWellKnownTypes, #[serde(with = "serde_with::cbor_value")] + #[cfg_attr(feature = "ts", ts(type = "any"))] value: tari_bor::Value, } @@ -115,6 +119,7 @@ impl Default for IndexedValue { } #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct IndexedWellKnownTypes { bucket_ids: Vec, proof_ids: Vec, diff --git a/dan_layer/engine_types/src/instruction.rs b/dan_layer/engine_types/src/instruction.rs index 17e43fb819..fbaef524ed 100644 --- a/dan_layer/engine_types/src/instruction.rs +++ b/dan_layer/engine_types/src/instruction.rs @@ -10,6 +10,8 @@ use tari_template_lib::{ args::{Arg, LogLevel}, models::{Amount, ComponentAddress, TemplateAddress}, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ confidential::{ConfidentialClaim, ConfidentialOutput}, @@ -17,6 +19,7 @@ use crate::{ }; #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum Instruction { CallFunction { #[serde(with = "serde_with::hex")] @@ -44,6 +47,7 @@ pub enum Instruction { }, ClaimValidatorFees { epoch: u64, + #[cfg_attr(feature = "ts", ts(type = "string"))] validator_public_key: PublicKey, }, DropAllProofsInWorkspace, diff --git a/dan_layer/engine_types/src/instruction_result.rs b/dan_layer/engine_types/src/instruction_result.rs index 0a877baad4..aaae359f49 100644 --- a/dan_layer/engine_types/src/instruction_result.rs +++ b/dan_layer/engine_types/src/instruction_result.rs @@ -23,10 +23,13 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use tari_bor::BorError; use tari_template_abi::Type; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::indexed_value::{IndexedValue, IndexedValueError}; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct InstructionResult { pub indexed: IndexedValue, pub return_type: Type, diff --git a/dan_layer/engine_types/src/lock.rs b/dan_layer/engine_types/src/lock.rs index a4df4765cf..a0998d89d9 100644 --- a/dan_layer/engine_types/src/lock.rs +++ b/dan_layer/engine_types/src/lock.rs @@ -4,9 +4,12 @@ use std::fmt::Display; use tari_bor::{Deserialize, Serialize}; +#[cfg(feature = "ts")] +use ts_rs::TS; pub type LockId = u32; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum LockFlag { Read, Write, diff --git a/dan_layer/engine_types/src/logs.rs b/dan_layer/engine_types/src/logs.rs index edf0632304..874ba2dc74 100644 --- a/dan_layer/engine_types/src/logs.rs +++ b/dan_layer/engine_types/src/logs.rs @@ -27,9 +27,13 @@ use std::{ use serde::{Deserialize, Serialize}; pub use tari_template_lib::args::LogLevel; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct LogEntry { + #[cfg_attr(feature = "ts", ts(type = "number"))] pub timestamp: u64, pub message: String, pub level: LogLevel, diff --git a/dan_layer/engine_types/src/non_fungible.rs b/dan_layer/engine_types/src/non_fungible.rs index cb0c75b7b2..a04cae8afb 100644 --- a/dan_layer/engine_types/src/non_fungible.rs +++ b/dan_layer/engine_types/src/non_fungible.rs @@ -4,10 +4,13 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use tari_bor::{decode_exact, BorError}; use tari_template_lib::prelude::Metadata; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::serde_with; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct NonFungibleContainer(Option); impl NonFungibleContainer { @@ -37,10 +40,13 @@ impl NonFungibleContainer { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct NonFungible { #[serde(with = "serde_with::hex")] + #[cfg_attr(feature = "ts", ts(type = "string"))] data: Vec, #[serde(with = "serde_with::hex")] + #[cfg_attr(feature = "ts", ts(type = "string"))] mutable_data: Vec, } diff --git a/dan_layer/engine_types/src/non_fungible_index.rs b/dan_layer/engine_types/src/non_fungible_index.rs index 0b2297d5df..8f634f3d04 100644 --- a/dan_layer/engine_types/src/non_fungible_index.rs +++ b/dan_layer/engine_types/src/non_fungible_index.rs @@ -22,9 +22,12 @@ use serde::{Deserialize, Serialize}; use tari_template_lib::prelude::NonFungibleAddress; +#[cfg(feature = "ts")] +use ts_rs::TS; /// Holds a reference to another substate #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct NonFungibleIndex { referenced_address: NonFungibleAddress, } diff --git a/dan_layer/engine_types/src/resource.rs b/dan_layer/engine_types/src/resource.rs index bc584c7de8..97520101e7 100644 --- a/dan_layer/engine_types/src/resource.rs +++ b/dan_layer/engine_types/src/resource.rs @@ -27,14 +27,18 @@ use tari_template_lib::{ models::{Amount, Metadata}, resource::{ResourceType, TOKEN_SYMBOL}, }; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Resource { resource_type: ResourceType, owner_rule: OwnerRule, owner_key: RistrettoPublicKeyBytes, access_rules: ResourceAccessRules, metadata: Metadata, + #[cfg_attr(feature = "ts", ts(type = "number"))] total_supply: Amount, } diff --git a/dan_layer/engine_types/src/resource_container.rs b/dan_layer/engine_types/src/resource_container.rs index f4d3ab076e..48fa4a940c 100644 --- a/dan_layer/engine_types/src/resource_container.rs +++ b/dan_layer/engine_types/src/resource_container.rs @@ -23,6 +23,8 @@ use tari_template_lib::{ }, prelude::ResourceType, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ confidential::{validate_confidential_proof, validate_confidential_withdraw, ConfidentialOutput}, @@ -31,6 +33,7 @@ use crate::{ /// Instances of a single resource kept in Buckets and Vaults #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum ResourceContainer { Fungible { address: ResourceAddress, @@ -44,8 +47,10 @@ pub enum ResourceContainer { }, Confidential { address: ResourceAddress, + #[cfg_attr(feature = "ts", ts(skip))] commitments: BTreeMap, revealed_amount: Amount, + #[cfg_attr(feature = "ts", ts(skip))] locked_commitments: BTreeMap, locked_revealed_amount: Amount, }, diff --git a/dan_layer/engine_types/src/substate.rs b/dan_layer/engine_types/src/substate.rs index 9e5fda9787..6bddf498d1 100644 --- a/dan_layer/engine_types/src/substate.rs +++ b/dan_layer/engine_types/src/substate.rs @@ -39,6 +39,8 @@ use tari_template_lib::{ prelude::PUBLIC_IDENTITY_RESOURCE_ADDRESS, Hash, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ component::ComponentHeader, @@ -54,6 +56,7 @@ use crate::{ }; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Substate { substate: SubstateValue, version: u32, @@ -90,6 +93,7 @@ impl Substate { /// Base object address, version tuples #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum SubstateId { Component(#[serde(with = "serde_with::string")] ComponentAddress), Resource(#[serde(with = "serde_with::string")] ResourceAddress), @@ -384,6 +388,7 @@ impl_partial_eq!(TransactionReceiptAddress, TransactionReceipt); impl_partial_eq!(FeeClaimAddress, FeeClaim); #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum SubstateValue { Component(ComponentHeader), Resource(Resource), @@ -605,6 +610,7 @@ impl Display for SubstateValue { } #[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SubstateDiff { up_substates: Vec<(SubstateId, Substate)>, down_substates: Vec<(SubstateId, u32)>, diff --git a/dan_layer/engine_types/src/transaction_receipt.rs b/dan_layer/engine_types/src/transaction_receipt.rs index 80c9424892..9318bcd033 100644 --- a/dan_layer/engine_types/src/transaction_receipt.rs +++ b/dan_layer/engine_types/src/transaction_receipt.rs @@ -9,13 +9,16 @@ use std::{ use serde::{Deserialize, Serialize}; use tari_bor::BorTag; use tari_template_lib::{models::BinaryTag, Hash, HashParseError}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{events::Event, fees::FeeReceipt, logs::LogEntry}; const TAG: u64 = BinaryTag::TransactionReceipt.as_u64(); #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] -pub struct TransactionReceiptAddress(BorTag); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct TransactionReceiptAddress(#[cfg_attr(feature = "ts", ts(type = "string"))] BorTag); impl TransactionReceiptAddress { pub const fn new(address: Hash) -> Self { @@ -45,6 +48,7 @@ impl Display for TransactionReceiptAddress { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionReceipt { pub transaction_hash: Hash, pub events: Vec, diff --git a/dan_layer/engine_types/src/vault.rs b/dan_layer/engine_types/src/vault.rs index 3393707431..23a273ac82 100644 --- a/dan_layer/engine_types/src/vault.rs +++ b/dan_layer/engine_types/src/vault.rs @@ -29,6 +29,8 @@ use tari_template_lib::{ models::{Amount, ConfidentialWithdrawProof, NonFungibleId, ResourceAddress, VaultId}, prelude::ResourceType, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ bucket::Bucket, @@ -38,6 +40,7 @@ use crate::{ }; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Vault { vault_id: VaultId, resource_container: ResourceContainer, diff --git a/dan_layer/storage/Cargo.toml b/dan_layer/storage/Cargo.toml index 8d2ec25da7..d72b76ee51 100644 --- a/dan_layer/storage/Cargo.toml +++ b/dan_layer/storage/Cargo.toml @@ -27,3 +27,7 @@ rand = { workspace = true } thiserror = { workspace = true } serde = { workspace = true, default-features = true } time = { workspace = true, features = ["serde"] } +ts-rs = { workspace = true, optional = true } + +[features] +ts = ["ts-rs"] diff --git a/dan_layer/storage/src/consensus_models/block.rs b/dan_layer/storage/src/consensus_models/block.rs index 3830d64e83..d8bcf91d9b 100644 --- a/dan_layer/storage/src/consensus_models/block.rs +++ b/dan_layer/storage/src/consensus_models/block.rs @@ -23,6 +23,8 @@ use tari_dan_common_types::{ }; use tari_transaction::TransactionId; use time::PrimitiveDateTime; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::{ForeignProposal, ForeignSendCounters, QuorumCertificate, ValidatorSchnorrSignature}; use crate::{ @@ -48,6 +50,7 @@ use crate::{ const LOG_TARGET: &str = "tari::dan::storage::consensus_models::block"; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Block { // Header id: BlockId, @@ -55,10 +58,12 @@ pub struct Block { justify: QuorumCertificate, height: NodeHeight, epoch: Epoch, + #[cfg_attr(feature = "ts", ts(type = "string"))] proposed_by: PublicKey, total_leader_fee: u64, // Body + #[cfg_attr(feature = "ts", ts(type = "string"))] merkle_root: FixedHash, // BTreeSet is used for the deterministic block hash, that is, transactions are always ordered by TransactionId. commands: BTreeSet, @@ -72,8 +77,10 @@ pub struct Block { /// Counter for each foreign shard for reliable broadcast. foreign_indexes: IndexMap, /// Timestamp when was this stored. + #[cfg_attr(feature = "ts", ts(type = "string | null"))] stored_at: Option, /// Signature of block by the proposer. + #[cfg_attr(feature = "ts", ts(type = "{public_nonce : string, signature: string} | null"))] signature: Option, } @@ -693,7 +700,12 @@ impl Display for Block { #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] #[serde(transparent)] -pub struct BlockId(#[serde(with = "serde_with::hex")] FixedHash); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct BlockId( + #[serde(with = "serde_with::hex")] + #[cfg_attr(feature = "ts", ts(type = "string"))] + FixedHash, +); impl BlockId { pub const fn genesis() -> Self { diff --git a/dan_layer/storage/src/consensus_models/command.rs b/dan_layer/storage/src/consensus_models/command.rs index 848b863d3c..cef3f2396b 100644 --- a/dan_layer/storage/src/consensus_models/command.rs +++ b/dan_layer/storage/src/consensus_models/command.rs @@ -11,6 +11,8 @@ use serde::{Deserialize, Serialize}; use tari_dan_common_types::SubstateAddress; use tari_engine_types::lock::LockFlag; use tari_transaction::TransactionId; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::ForeignProposal; use crate::{ @@ -20,6 +22,7 @@ use crate::{ }; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Evidence { evidence: IndexMap, } @@ -98,6 +101,7 @@ impl Extend<(SubstateAddress, ShardEvidence)> for Evidence { } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ShardEvidence { pub qc_ids: IndexSet, pub lock: LockFlag, @@ -122,6 +126,7 @@ impl ShardEvidence { } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionAtom { pub id: TransactionId, pub decision: Decision, @@ -154,6 +159,7 @@ impl Display for TransactionAtom { } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum Command { /// Command to prepare a transaction. Prepare(TransactionAtom), diff --git a/dan_layer/storage/src/consensus_models/executed_transaction.rs b/dan_layer/storage/src/consensus_models/executed_transaction.rs index 417cd65093..19c1711ace 100644 --- a/dan_layer/storage/src/consensus_models/executed_transaction.rs +++ b/dan_layer/storage/src/consensus_models/executed_transaction.rs @@ -16,6 +16,8 @@ use tari_engine_types::{ lock::LockFlag, }; use tari_transaction::{Transaction, TransactionId}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ consensus_models::{Decision, Evidence, ShardEvidence, TransactionAtom, TransactionRecord}, @@ -25,10 +27,12 @@ use crate::{ }; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ExecutedTransaction { transaction: Transaction, result: ExecuteResult, resulting_outputs: Vec, + #[cfg_attr(feature = "ts", ts(type = "string"))] execution_time: Duration, final_decision: Option, finalized_time: Option, diff --git a/dan_layer/storage/src/consensus_models/foreign_proposal.rs b/dan_layer/storage/src/consensus_models/foreign_proposal.rs index 71f0be579a..e709a0dfc3 100644 --- a/dan_layer/storage/src/consensus_models/foreign_proposal.rs +++ b/dan_layer/storage/src/consensus_models/foreign_proposal.rs @@ -9,11 +9,14 @@ use std::{ use serde::{Deserialize, Serialize}; use tari_dan_common_types::{shard::Shard, NodeHeight}; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::BlockId; use crate::{StateStoreReadTransaction, StateStoreWriteTransaction, StorageError}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum ForeignProposalState { New, Proposed, @@ -44,6 +47,7 @@ impl FromStr for ForeignProposalState { } #[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize, PartialOrd, Ord)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ForeignProposal { pub bucket: Shard, pub block_id: BlockId, diff --git a/dan_layer/storage/src/consensus_models/quorum.rs b/dan_layer/storage/src/consensus_models/quorum.rs index a702b779d2..7622107725 100644 --- a/dan_layer/storage/src/consensus_models/quorum.rs +++ b/dan_layer/storage/src/consensus_models/quorum.rs @@ -4,8 +4,11 @@ use std::fmt::Display; use serde::{Deserialize, Serialize}; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum QuorumDecision { Accept, Reject, diff --git a/dan_layer/storage/src/consensus_models/quorum_certificate.rs b/dan_layer/storage/src/consensus_models/quorum_certificate.rs index 5c204a2747..c4cfdb9a1b 100644 --- a/dan_layer/storage/src/consensus_models/quorum_certificate.rs +++ b/dan_layer/storage/src/consensus_models/quorum_certificate.rs @@ -20,6 +20,8 @@ use tari_dan_common_types::{ NodeHeight, }; use tari_mmr::MergedBalancedBinaryMerkleProof; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ consensus_models::{Block, BlockId, HighQc, LastVoted, LeafBlock, QuorumDecision, ValidatorSignature}, @@ -31,14 +33,17 @@ use crate::{ const LOG_TARGET: &str = "tari::dan::storage::quorum_certificate"; #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct QuorumCertificate { qc_id: QcId, block_id: BlockId, block_height: NodeHeight, epoch: Epoch, signatures: Vec, + #[cfg_attr(feature = "ts", ts(type = "any"))] merged_proof: MergedValidatorNodeMerkleProof, #[serde(with = "serde_with::hex::vec")] + #[cfg_attr(feature = "ts", ts(type = "Array"))] leaf_hashes: Vec, decision: QuorumDecision, } @@ -248,7 +253,12 @@ impl Display for QuorumCertificate { #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] #[serde(transparent)] -pub struct QcId(#[serde(with = "serde_with::hex")] FixedHash); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct QcId( + #[serde(with = "serde_with::hex")] + #[cfg_attr(feature = "ts", ts(type = "string | null"))] + FixedHash, +); impl QcId { pub const fn genesis() -> Self { diff --git a/dan_layer/storage/src/consensus_models/substate.rs b/dan_layer/storage/src/consensus_models/substate.rs index 971b3ade3e..91aafef125 100644 --- a/dan_layer/storage/src/consensus_models/substate.rs +++ b/dan_layer/storage/src/consensus_models/substate.rs @@ -14,6 +14,8 @@ use tari_common_types::types::FixedHash; use tari_dan_common_types::{optional::Optional, Epoch, NodeHeight, SubstateAddress}; use tari_engine_types::substate::{Substate, SubstateId, SubstateValue}; use tari_transaction::TransactionId; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ consensus_models::{Block, BlockId, QcId, QuorumCertificate}, @@ -25,10 +27,12 @@ use crate::{ const LOG_TARGET: &str = "tari::dan::storage::consensus_models::substate"; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SubstateRecord { pub substate_id: SubstateId, pub version: u32, pub substate_value: SubstateValue, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub state_hash: FixedHash, pub created_by_transaction: TransactionId, pub created_justify: QcId, @@ -39,6 +43,7 @@ pub struct SubstateRecord { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SubstateDestroyed { pub by_transaction: TransactionId, pub justify: QcId, diff --git a/dan_layer/storage/src/consensus_models/transaction_decision.rs b/dan_layer/storage/src/consensus_models/transaction_decision.rs index ac549a3670..805e4a9f7e 100644 --- a/dan_layer/storage/src/consensus_models/transaction_decision.rs +++ b/dan_layer/storage/src/consensus_models/transaction_decision.rs @@ -8,8 +8,11 @@ use std::{ }; use serde::{Deserialize, Serialize}; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum Decision { /// Decision to COMMIT the transaction Commit, diff --git a/dan_layer/storage/src/consensus_models/vote_signature.rs b/dan_layer/storage/src/consensus_models/vote_signature.rs index 69c9f864ed..a515f163c3 100644 --- a/dan_layer/storage/src/consensus_models/vote_signature.rs +++ b/dan_layer/storage/src/consensus_models/vote_signature.rs @@ -6,12 +6,17 @@ use serde::{Deserialize, Serialize}; use tari_common_types::types::{PrivateKey, PublicKey}; use tari_core::transactions::transaction_components::ValidatorNodeHashDomain; use tari_crypto::{keys::PublicKey as _, signatures::SchnorrSignature}; +#[cfg(feature = "ts")] +use ts_rs::TS; pub type ValidatorSchnorrSignature = SchnorrSignature; #[derive(Clone, Debug, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ValidatorSignature { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, + #[cfg_attr(feature = "ts", ts(type = "{public_nonce : string, signature: string}"))] pub signature: ValidatorSchnorrSignature, } diff --git a/dan_layer/storage/src/global/models/validator_node.rs b/dan_layer/storage/src/global/models/validator_node.rs index 6b41bfdfc8..abbcd4413c 100644 --- a/dan_layer/storage/src/global/models/validator_node.rs +++ b/dan_layer/storage/src/global/models/validator_node.rs @@ -4,14 +4,20 @@ use serde::{Deserialize, Serialize}; use tari_common_types::types::{FixedHash, PublicKey}; use tari_dan_common_types::{shard::Shard, vn_node_hash, Epoch, NodeAddressable, SubstateAddress}; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ValidatorNode { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub address: TAddr, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub public_key: PublicKey, pub shard_key: SubstateAddress, pub epoch: Epoch, pub committee_shard: Option, + #[cfg_attr(feature = "ts", ts(type = "string"))] pub fee_claim_public_key: PublicKey, } diff --git a/dan_layer/storage/src/state_store/mod.rs b/dan_layer/storage/src/state_store/mod.rs index 506791a464..affbb4e3a3 100644 --- a/dan_layer/storage/src/state_store/mod.rs +++ b/dan_layer/storage/src/state_store/mod.rs @@ -11,6 +11,8 @@ use serde::{Deserialize, Serialize}; use tari_common_types::types::{FixedHash, PublicKey}; use tari_dan_common_types::{Epoch, NodeAddressable, NodeHeight, SubstateAddress}; use tari_transaction::{Transaction, TransactionId}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ consensus_models::{ @@ -370,6 +372,7 @@ pub trait StateStoreWriteTransaction { } #[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum Ordering { Ascending, Descending, diff --git a/dan_layer/tari_bor/Cargo.toml b/dan_layer/tari_bor/Cargo.toml index c6ffb5fba1..a4475ef57e 100644 --- a/dan_layer/tari_bor/Cargo.toml +++ b/dan_layer/tari_bor/Cargo.toml @@ -10,7 +10,10 @@ license.workspace = true [dependencies] ciborium = { workspace = true } ciborium-io = { workspace = true } -serde = { workspace = true, default-features = false, features = ["alloc", "derive"] } +serde = { workspace = true, default-features = false, features = [ + "alloc", + "derive", +] } [dev-dependencies] serde_json = { workspace = true } @@ -20,4 +23,3 @@ default = ["std"] std = ["ciborium/std", "serde/std"] alloc = ["serde/alloc", "ciborium-io/alloc"] json_encoding = [] - diff --git a/dan_layer/template_abi/Cargo.toml b/dan_layer/template_abi/Cargo.toml index 51f9cadb90..293f267e17 100644 --- a/dan_layer/template_abi/Cargo.toml +++ b/dan_layer/template_abi/Cargo.toml @@ -9,11 +9,16 @@ license.workspace = true [dependencies] tari_bor = { workspace = true, default-features = false } -serde = { workspace = true, default-features = false, features = ["alloc", "derive"] } +serde = { workspace = true, default-features = false, features = [ + "alloc", + "derive", +] } hashbrown = { workspace = true, optional = true } +ts-rs = { workspace = true, optional = true } [features] default = ["std"] std = ["tari_bor/std"] # TODO: look into how this is done properly alloc = ["hashbrown"] +ts = ["ts-rs"] diff --git a/dan_layer/template_abi/src/types.rs b/dan_layer/template_abi/src/types.rs index 6c9558ac7b..d71f477120 100644 --- a/dan_layer/template_abi/src/types.rs +++ b/dan_layer/template_abi/src/types.rs @@ -21,6 +21,8 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. use serde::{Deserialize, Serialize}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::rust::{boxed::Box, string::String, vec::Vec}; @@ -83,6 +85,7 @@ pub struct ArgDef { } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum Type { #[default] Unit, diff --git a/dan_layer/template_lib/Cargo.toml b/dan_layer/template_lib/Cargo.toml index 32b511bcdd..a02f3c5ce5 100644 --- a/dan_layer/template_lib/Cargo.toml +++ b/dan_layer/template_lib/Cargo.toml @@ -18,6 +18,8 @@ serde = { workspace = true, default-features = false, features = [ "alloc", ] } serde_with = { workspace = true } +ts-rs = { workspace = true, optional = true } + [dev-dependencies] serde_json = { workspace = true } @@ -26,3 +28,4 @@ serde_json = { workspace = true } default = ["macro", "std"] macro = ["tari_template_macros"] std = ["serde/std", "tari_bor/std"] +ts = ["ts-rs"] diff --git a/dan_layer/template_lib/src/args/arg.rs b/dan_layer/template_lib/src/args/arg.rs index 41dc1049dc..385c0d6862 100644 --- a/dan_layer/template_lib/src/args/arg.rs +++ b/dan_layer/template_lib/src/args/arg.rs @@ -22,9 +22,12 @@ use serde::{Deserialize, Serialize}; use tari_bor::encode; +#[cfg(feature = "ts")] +use ts_rs::TS; /// The possible ways to represent an instruction's argument #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum Arg { /// The argument is in the transaction execution's workspace, which means it is the result of a previous /// instruction diff --git a/dan_layer/template_lib/src/args/types.rs b/dan_layer/template_lib/src/args/types.rs index 8311a4a8e4..8aa282e143 100644 --- a/dan_layer/template_lib/src/args/types.rs +++ b/dan_layer/template_lib/src/args/types.rs @@ -27,6 +27,8 @@ use tari_template_abi::rust::{ fmt::{Display, Formatter}, str::FromStr, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ args::Arg, @@ -63,6 +65,7 @@ pub struct EmitLogArg { /// All the possible log levels #[derive(Debug, Clone, Copy, Eq, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum LogLevel { Error, Warn, diff --git a/dan_layer/template_lib/src/auth/access_rules.rs b/dan_layer/template_lib/src/auth/access_rules.rs index 80b98c4636..65f1e012ec 100644 --- a/dan_layer/template_lib/src/auth/access_rules.rs +++ b/dan_layer/template_lib/src/auth/access_rules.rs @@ -3,11 +3,14 @@ use serde::{Deserialize, Serialize}; use tari_template_abi::rust::collections::BTreeMap; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::models::{ComponentAddress, NonFungibleAddress, ResourceAddress, TemplateAddress}; /// Represents the types of possible access control rules over a component method or resource #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum AccessRule { AllowAll, DenyAll, @@ -38,6 +41,7 @@ impl AccessRule { /// An enum that represents the possible ways to restrict access to components or resources #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum RestrictedAccessRule { Require(RequireRule), AnyOf(Vec), @@ -56,6 +60,7 @@ impl RestrictedAccessRule { /// Specifies a requirement for a [RequireRule]. #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum RuleRequirement { /// Requires ownership of a specific resource Resource(ResourceAddress), @@ -93,6 +98,7 @@ impl From for RuleRequirement { /// An enum that represents the possible ways to require access to components or resources #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum RequireRule { Require(RuleRequirement), AnyOf(Vec), @@ -101,7 +107,9 @@ pub enum RequireRule { /// Information needed to specify access rules to methods of a component #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ComponentAccessRules { + #[cfg_attr(feature = "ts", ts(skip))] method_access: BTreeMap, default: AccessRule, } @@ -174,6 +182,7 @@ impl ResourceAuthAction { /// Information needed to specify access rules to a resource #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ResourceAccessRules { mintable: AccessRule, burnable: AccessRule, diff --git a/dan_layer/template_lib/src/auth/owner_rule.rs b/dan_layer/template_lib/src/auth/owner_rule.rs index 0ab862de2f..5c800faaa2 100644 --- a/dan_layer/template_lib/src/auth/owner_rule.rs +++ b/dan_layer/template_lib/src/auth/owner_rule.rs @@ -1,6 +1,9 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause +#[cfg(feature = "ts")] +use ts_rs::TS; + use crate::{auth::AccessRule, crypto::RistrettoPublicKeyBytes}; /// Data that is needed to represent ownership of a value (resource or component method). @@ -13,6 +16,7 @@ pub struct Ownership<'a> { /// An enum for all possible ways to specify ownership of values #[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum OwnerRule { #[default] OwnedBySigner, diff --git a/dan_layer/template_lib/src/crypto/balance_proof.rs b/dan_layer/template_lib/src/crypto/balance_proof.rs index f919f81b4c..65b2ecae45 100644 --- a/dan_layer/template_lib/src/crypto/balance_proof.rs +++ b/dan_layer/template_lib/src/crypto/balance_proof.rs @@ -2,6 +2,8 @@ // SPDX-License-Identifier: BSD-3-Clause use serde::{Deserialize, Serialize}; use serde_with::{serde_as, Bytes}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::crypto::InvalidByteLengthError; @@ -9,6 +11,7 @@ use crate::crypto::InvalidByteLengthError; #[serde_as] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(transparent)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct BalanceProofSignature(#[serde_as(as = "Bytes")] [u8; BalanceProofSignature::length()]); impl BalanceProofSignature { diff --git a/dan_layer/template_lib/src/crypto/commitment.rs b/dan_layer/template_lib/src/crypto/commitment.rs index be4b00826c..0fb4eca096 100644 --- a/dan_layer/template_lib/src/crypto/commitment.rs +++ b/dan_layer/template_lib/src/crypto/commitment.rs @@ -4,6 +4,8 @@ use serde::{Deserialize, Serialize}; use serde_with::{serde_as, Bytes}; use tari_template_abi::rust::fmt::{Display, Formatter}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{crypto::InvalidByteLengthError, Hash}; @@ -11,6 +13,7 @@ use crate::{crypto::InvalidByteLengthError, Hash}; #[serde_as] #[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash, Default, Serialize, Deserialize)] #[serde(transparent)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct PedersonCommitmentBytes(#[serde_as(as = "Bytes")] [u8; PedersonCommitmentBytes::length()]); impl PedersonCommitmentBytes { diff --git a/dan_layer/template_lib/src/crypto/ristretto.rs b/dan_layer/template_lib/src/crypto/ristretto.rs index 95b5d319da..282023f4f5 100644 --- a/dan_layer/template_lib/src/crypto/ristretto.rs +++ b/dan_layer/template_lib/src/crypto/ristretto.rs @@ -4,6 +4,8 @@ use serde::{Deserialize, Serialize}; use serde_with::{serde_as, Bytes}; use tari_template_abi::rust::fmt::{Display, Formatter}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{crypto::InvalidByteLengthError, models::NonFungibleAddress, Hash}; @@ -11,7 +13,12 @@ use crate::{crypto::InvalidByteLengthError, models::NonFungibleAddress, Hash}; #[serde_as] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(transparent)] -pub struct RistrettoPublicKeyBytes(#[serde_as(as = "Bytes")] [u8; RistrettoPublicKeyBytes::length()]); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct RistrettoPublicKeyBytes( + #[serde_as(as = "Bytes")] + #[cfg_attr(feature = "ts", ts(type = "string"))] + [u8; RistrettoPublicKeyBytes::length()], +); impl RistrettoPublicKeyBytes { pub const fn length() -> usize { diff --git a/dan_layer/template_lib/src/hash.rs b/dan_layer/template_lib/src/hash.rs index 60a513df55..d12281544d 100644 --- a/dan_layer/template_lib/src/hash.rs +++ b/dan_layer/template_lib/src/hash.rs @@ -30,11 +30,14 @@ use std::{ use serde::{Deserialize, Serialize}; use serde_with::{serde_as, Bytes}; +#[cfg(feature = "ts")] +use ts_rs::TS; /// Representation of a 32-byte hash value #[serde_as] #[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash, Default, Serialize, Deserialize)] #[serde(transparent)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Hash(#[serde_as(as = "Bytes")] [u8; 32]); impl Hash { diff --git a/dan_layer/template_lib/src/models/amount.rs b/dan_layer/template_lib/src/models/amount.rs index 67c4a81d41..3f7de5822d 100644 --- a/dan_layer/template_lib/src/models/amount.rs +++ b/dan_layer/template_lib/src/models/amount.rs @@ -27,11 +27,14 @@ use tari_template_abi::rust::{ iter::Sum, num::TryFromIntError, }; +#[cfg(feature = "ts")] +use ts_rs::TS; -/// Represents an integer quantity of any fungible or non-fungible resource +/// Represents an integer quantity of any fungible or non-fungible resourcecyni #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Default)] #[serde(transparent)] -pub struct Amount(pub i64); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct Amount(#[cfg_attr(feature = "ts", ts(type = "number"))] pub i64); impl Amount { pub const MAX: Amount = Amount(i64::MAX); diff --git a/dan_layer/template_lib/src/models/bucket.rs b/dan_layer/template_lib/src/models/bucket.rs index d2aff84b39..5cc8e12d1b 100644 --- a/dan_layer/template_lib/src/models/bucket.rs +++ b/dan_layer/template_lib/src/models/bucket.rs @@ -23,6 +23,8 @@ use serde::{Deserialize, Serialize}; use tari_bor::BorTag; use tari_template_abi::{call_engine, rust::fmt, EngineOp}; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::{NonFungible, NonFungibleId}; use crate::{ @@ -35,7 +37,8 @@ const TAG: u64 = BinaryTag::BucketId.as_u64(); /// A bucket's unique identification during the transaction execution #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd, Hash)] -pub struct BucketId(BorTag); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct BucketId(#[cfg_attr(feature = "ts", ts(type = "number"))] BorTag); impl From for BucketId { fn from(value: u32) -> Self { diff --git a/dan_layer/template_lib/src/models/component.rs b/dan_layer/template_lib/src/models/component.rs index 5ccd74a83a..eb63954469 100644 --- a/dan_layer/template_lib/src/models/component.rs +++ b/dan_layer/template_lib/src/models/component.rs @@ -26,6 +26,8 @@ use std::{ }; use tari_bor::BorTag; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::BinaryTag; use crate::{hash::HashParseError, newtype_struct_serde_impl, Hash}; @@ -34,7 +36,8 @@ const TAG: u64 = BinaryTag::ComponentAddress.as_u64(); /// A component's unique identification in the Tari network #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)] -pub struct ComponentAddress(BorTag); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct ComponentAddress(#[cfg_attr(feature = "ts", ts(type = "string"))] BorTag); impl ComponentAddress { pub const fn new(address: Hash) -> Self { diff --git a/dan_layer/template_lib/src/models/confidential_proof.rs b/dan_layer/template_lib/src/models/confidential_proof.rs index d49ddacf5d..2b26f6fd88 100644 --- a/dan_layer/template_lib/src/models/confidential_proof.rs +++ b/dan_layer/template_lib/src/models/confidential_proof.rs @@ -3,6 +3,8 @@ use serde::{Deserialize, Serialize}; use serde_with::{serde_as, Bytes}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ crypto::{BalanceProofSignature, PedersonCommitmentBytes, RistrettoPublicKeyBytes}, @@ -11,6 +13,7 @@ use crate::{ /// A zero-knowledge proof of a confidential transfer #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ConfidentialOutputProof { /// Proof of the confidential resources that are going to be transferred to the receiver pub output_statement: ConfidentialStatement, @@ -24,6 +27,7 @@ pub struct ConfidentialOutputProof { /// A zero-knowledge proof that a confidential resource amount is valid #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ConfidentialStatement { #[serde_as(as = "Bytes")] pub commitment: [u8; 32], @@ -39,6 +43,7 @@ pub struct ConfidentialStatement { /// A zero-knowledge proof that a withdrawal of confidential resources from a vault is valid #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct ConfidentialWithdrawProof { // #[cfg_attr(feature = "hex", serde(with = "hex::serde"))] pub inputs: Vec, @@ -52,6 +57,7 @@ pub struct ConfidentialWithdrawProof { #[serde_as] #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(transparent)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct EncryptedData(#[serde_as(as = "Bytes")] pub [u8; EncryptedData::size()]); impl EncryptedData { diff --git a/dan_layer/template_lib/src/models/layer_one_commitment.rs b/dan_layer/template_lib/src/models/layer_one_commitment.rs index f089679281..f64b70fc17 100644 --- a/dan_layer/template_lib/src/models/layer_one_commitment.rs +++ b/dan_layer/template_lib/src/models/layer_one_commitment.rs @@ -4,6 +4,8 @@ use std::fmt::{Display, Formatter}; use serde::{Deserialize, Serialize}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{hash::HashParseError, Hash}; @@ -11,7 +13,8 @@ use crate::{hash::HashParseError, Hash}; /// Used when a user wants to claim burned funds from the Minotari network into the Tari network #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] #[serde(transparent)] -pub struct UnclaimedConfidentialOutputAddress(Hash); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct UnclaimedConfidentialOutputAddress(#[cfg_attr(feature = "ts", ts(type = "string"))] Hash); impl UnclaimedConfidentialOutputAddress { pub const fn new(hash: Hash) -> Self { diff --git a/dan_layer/template_lib/src/models/metadata.rs b/dan_layer/template_lib/src/models/metadata.rs index 075d0e7a53..4aa52eccac 100644 --- a/dan_layer/template_lib/src/models/metadata.rs +++ b/dan_layer/template_lib/src/models/metadata.rs @@ -25,13 +25,16 @@ use std::str::FromStr; use serde::{Deserialize, Serialize}; use tari_bor::BorTag; use tari_template_abi::rust::{collections::BTreeMap, fmt::Display}; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::BinaryTag; const TAG: u64 = BinaryTag::Metadata as u64; /// A collection of user-defined data used to describe other types, for example, non-fungible tokens or events #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct Metadata(BorTag, TAG>); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct Metadata(#[cfg_attr(feature = "ts", ts(type = "string"))] BorTag, TAG>); impl Metadata { pub const fn new() -> Self { diff --git a/dan_layer/template_lib/src/models/non_fungible.rs b/dan_layer/template_lib/src/models/non_fungible.rs index ee6239b5ca..d2b2b1e082 100644 --- a/dan_layer/template_lib/src/models/non_fungible.rs +++ b/dan_layer/template_lib/src/models/non_fungible.rs @@ -9,6 +9,8 @@ use tari_template_abi::{ rust::{fmt, fmt::Display, str::FromStr, write}, EngineOp, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::BinaryTag; use crate::{ @@ -25,6 +27,7 @@ const DELIM: char = ':'; /// The unique identification of a non-fungible token inside it's parent resource #[serde_as] #[derive(Debug, Clone, Ord, PartialOrd, PartialEq, Eq, Serialize, Deserialize, Hash)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum NonFungibleId { U256(#[serde_as(as = "Bytes")] [u8; 32]), String(String), @@ -200,10 +203,12 @@ const TAG: u64 = BinaryTag::NonFungibleAddress.as_u64(); /// The unique identifier of a non-fungible index in the Tari network #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct NonFungibleAddress(BorTag); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct NonFungibleAddress(#[cfg_attr(feature = "ts", ts(type = "string"))] BorTag); /// Data used to build a `NonFungibleAddress` #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, PartialOrd, Ord)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct NonFungibleAddressContents { resource_address: ResourceAddress, id: NonFungibleId, diff --git a/dan_layer/template_lib/src/models/non_fungible_index.rs b/dan_layer/template_lib/src/models/non_fungible_index.rs index 187d913be2..e159f9b270 100644 --- a/dan_layer/template_lib/src/models/non_fungible_index.rs +++ b/dan_layer/template_lib/src/models/non_fungible_index.rs @@ -22,13 +22,17 @@ use serde::{Deserialize, Serialize}; use tari_template_abi::rust::{fmt, fmt::Display}; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::ResourceAddress; /// The unique identifier of a non-fungible index in the Tari network #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct NonFungibleIndexAddress { resource_address: ResourceAddress, + #[cfg_attr(feature = "ts", ts(type = "number"))] index: u64, } diff --git a/dan_layer/template_lib/src/models/proof.rs b/dan_layer/template_lib/src/models/proof.rs index 8b123719d9..ee9529c729 100644 --- a/dan_layer/template_lib/src/models/proof.rs +++ b/dan_layer/template_lib/src/models/proof.rs @@ -23,6 +23,8 @@ use serde::{Deserialize, Serialize}; use tari_bor::BorTag; use tari_template_abi::{call_engine, rust::fmt, EngineOp}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{ args::{InvokeResult, ProofAction, ProofInvokeArg, ProofRef}, @@ -34,7 +36,8 @@ const TAG: u64 = BinaryTag::ProofId.as_u64(); /// The unique identification of a proof during a transaction execution #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Ord, PartialOrd, Hash)] -pub struct ProofId(BorTag); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct ProofId(#[cfg_attr(feature = "ts", ts(type = "number"))] BorTag); impl From for ProofId { fn from(value: u32) -> Self { diff --git a/dan_layer/template_lib/src/models/resource.rs b/dan_layer/template_lib/src/models/resource.rs index 08a4fde386..1c9e8b6066 100644 --- a/dan_layer/template_lib/src/models/resource.rs +++ b/dan_layer/template_lib/src/models/resource.rs @@ -26,6 +26,8 @@ use tari_template_abi::rust::{ fmt::{Display, Formatter}, str::FromStr, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::BinaryTag; use crate::{hash::HashParseError, newtype_struct_serde_impl, Hash}; @@ -34,7 +36,8 @@ const TAG: u64 = BinaryTag::ResourceAddress.as_u64(); /// The unique identification of a resource in the Tari network #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct ResourceAddress(BorTag); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct ResourceAddress(#[cfg_attr(feature = "ts", ts(type = "string"))] BorTag); impl ResourceAddress { pub const fn new(address: Hash) -> Self { diff --git a/dan_layer/template_lib/src/models/vault.rs b/dan_layer/template_lib/src/models/vault.rs index 2c6a61c6f6..fa4a4b36c1 100644 --- a/dan_layer/template_lib/src/models/vault.rs +++ b/dan_layer/template_lib/src/models/vault.rs @@ -32,6 +32,8 @@ use tari_template_abi::{ }, EngineOp, }; +#[cfg(feature = "ts")] +use ts_rs::TS; use super::{BinaryTag, NonFungible, Proof, ProofAuth}; use crate::{ @@ -57,7 +59,8 @@ const TAG: u64 = BinaryTag::VaultId as u64; /// A vault's unique identification in the Tari network #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct VaultId(BorTag); +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] +pub struct VaultId(#[cfg_attr(feature = "ts", ts(type = "string"))] BorTag); impl VaultId { pub const fn new(address: Hash) -> Self { diff --git a/dan_layer/template_lib/src/resource/mod.rs b/dan_layer/template_lib/src/resource/mod.rs index 7277a2c337..456db338b5 100644 --- a/dan_layer/template_lib/src/resource/mod.rs +++ b/dan_layer/template_lib/src/resource/mod.rs @@ -29,9 +29,12 @@ use std::fmt::Display; pub use builder::*; mod manager; pub use manager::*; +#[cfg(feature = "ts")] +use ts_rs::TS; /// Represents every possible type of resource in the Tari network #[derive(Clone, Copy, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum ResourceType { /// Fungible tokens do not have individual identity, making them interchangeable. E.g. monetary units, liquidity /// pool tokens, tokenized shares or commodities, etc. diff --git a/dan_layer/template_test_tooling/templates/faucet/Cargo.lock b/dan_layer/template_test_tooling/templates/faucet/Cargo.lock index 9c7669594a..600c8b42c8 100644 --- a/dan_layer/template_test_tooling/templates/faucet/Cargo.lock +++ b/dan_layer/template_test_tooling/templates/faucet/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" + [[package]] name = "ciborium" version = "0.2.1" @@ -47,18 +53,18 @@ checksum = "d36047f46c69ef97b60e7b069a26ce9a15cd8a7852eddb6991ea94a83ba36a78" [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.20" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -89,7 +95,7 @@ checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -103,6 +109,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tari_bor" version = "0.3.0" @@ -110,6 +127,7 @@ dependencies = [ "ciborium", "ciborium-io", "serde", + "ts-rs", ] [[package]] @@ -118,6 +136,7 @@ version = "0.3.0" dependencies = [ "serde", "tari_bor", + "ts-rs", ] [[package]] @@ -130,6 +149,7 @@ dependencies = [ "tari_bor", "tari_template_abi", "tari_template_macros", + "ts-rs", ] [[package]] @@ -138,13 +158,96 @@ version = "0.3.0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "tari_bor", "tari_template_abi", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "ts-rs" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2cae1fc5d05d47aa24b64f9a4f7cba24cdc9187a2084dd97ac57bef5eccae6" +dependencies = [ + "thiserror", + "ts-rs-macros", +] + +[[package]] +name = "ts-rs-macros" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f7f9b821696963053a89a7bd8b292dc34420aea8294d7b225274d488f3ec92" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn 2.0.48", + "termcolor", +] + [[package]] name = "unicode-ident" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/dan_layer/transaction/Cargo.toml b/dan_layer/transaction/Cargo.toml index 76cb9a68a3..fb00dd1746 100644 --- a/dan_layer/transaction/Cargo.toml +++ b/dan_layer/transaction/Cargo.toml @@ -17,3 +17,7 @@ tari_template_lib = { workspace = true } rand = { workspace = true } serde = { workspace = true, default-features = true } thiserror = { workspace = true } +ts-rs = { workspace = true, optional = true } + +[features] +ts = ["ts-rs"] diff --git a/dan_layer/transaction/src/signature.rs b/dan_layer/transaction/src/signature.rs index 09a1494773..7bcf728881 100644 --- a/dan_layer/transaction/src/signature.rs +++ b/dan_layer/transaction/src/signature.rs @@ -13,6 +13,8 @@ use tari_engine_types::{ hashing::{hasher64, EngineHashDomainLabel}, instruction::Instruction, }; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct TransactionSignatureFields { @@ -25,8 +27,11 @@ pub struct TransactionSignatureFields { } #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionSignature { + #[cfg_attr(feature = "ts", ts(type = "string"))] public_key: PublicKey, + #[cfg_attr(feature = "ts", ts(type = "string"))] signature: Signature, } diff --git a/dan_layer/transaction/src/transaction.rs b/dan_layer/transaction/src/transaction.rs index 6ee76ccab8..50814d7fd0 100644 --- a/dan_layer/transaction/src/transaction.rs +++ b/dan_layer/transaction/src/transaction.rs @@ -14,11 +14,15 @@ use tari_engine_types::{ substate::SubstateId, }; use tari_template_lib::{models::ComponentAddress, Hash}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::{builder::TransactionBuilder, transaction_id::TransactionId, TransactionSignature}; #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Transaction { + #[cfg_attr(feature = "ts", ts(flatten))] id: TransactionId, fee_instructions: Vec, instructions: Vec, @@ -212,6 +216,7 @@ impl Transaction { } #[derive(Debug, Clone, Deserialize, Serialize, Eq, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct SubstateRequirement { #[serde(with = "serde_with::string")] substate_id: SubstateId, diff --git a/dan_layer/transaction/src/transaction_id.rs b/dan_layer/transaction/src/transaction_id.rs index b3d25d5e60..d4100c1d6e 100644 --- a/dan_layer/transaction/src/transaction_id.rs +++ b/dan_layer/transaction/src/transaction_id.rs @@ -10,11 +10,15 @@ use serde::{Deserialize, Serialize}; use tari_common_types::types::FixedHashSizeError; use tari_crypto::tari_utilities::hex::{from_hex, Hex}; use tari_engine_types::serde_with; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize, Default)] #[serde(transparent)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct TransactionId { #[serde(with = "serde_with::hex")] + #[cfg_attr(feature = "ts", ts(type = "string"))] id: [u8; 32], } diff --git a/dan_layer/wallet/sdk/Cargo.toml b/dan_layer/wallet/sdk/Cargo.toml index 673dbb37a5..27013d01aa 100644 --- a/dan_layer/wallet/sdk/Cargo.toml +++ b/dan_layer/wallet/sdk/Cargo.toml @@ -33,8 +33,11 @@ serde = { workspace = true, default-features = true } serde_json = { workspace = true } thiserror = { workspace = true } zeroize = { workspace = true } +ts-rs = { workspace = true, optional = true } [dev-dependencies] tari_dan_wallet_storage_sqlite = { workspace = true } - tempfile = { workspace = true } + +[features] +ts = ["ts-rs"] diff --git a/dan_layer/wallet/sdk/src/apis/jwt.rs b/dan_layer/wallet/sdk/src/apis/jwt.rs index 1bdd6d0e6f..75bf8aed7b 100644 --- a/dan_layer/wallet/sdk/src/apis/jwt.rs +++ b/dan_layer/wallet/sdk/src/apis/jwt.rs @@ -11,6 +11,8 @@ use jsonwebtoken::{decode, encode, errors, DecodingKey, EncodingKey, Header, Val use serde::{Deserialize, Serialize}; use tari_engine_types::substate::SubstateId; use tari_template_lib::prelude::{ComponentAddress, ResourceAddress}; +#[cfg(feature = "ts")] +use ts_rs::TS; use crate::storage::{WalletStorageError, WalletStore, WalletStoreReader, WalletStoreWriter}; @@ -22,6 +24,7 @@ pub struct JwtApi<'a, TStore> { } #[derive(Debug, Clone, Deserialize, Serialize, Eq, PartialEq)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum JrpcPermission { AccountInfo, NftGetOwnershipProof(Option), @@ -97,6 +100,7 @@ impl Display for JrpcPermission { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct JrpcPermissions(pub Vec); impl FromStr for JrpcPermissions { @@ -138,7 +142,9 @@ impl TryFrom<&[String]> for JrpcPermissions { } #[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Claims { + #[cfg_attr(feature = "ts", ts(type = "number"))] pub id: u64, pub name: String, pub permissions: JrpcPermissions, diff --git a/dan_layer/wallet/sdk/src/models/account.rs b/dan_layer/wallet/sdk/src/models/account.rs index 103d732d3a..f3ba6596b4 100644 --- a/dan_layer/wallet/sdk/src/models/account.rs +++ b/dan_layer/wallet/sdk/src/models/account.rs @@ -4,11 +4,15 @@ use std::fmt::{Display, Formatter}; use tari_engine_types::substate::SubstateId; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub struct Account { pub name: Option, pub address: SubstateId, + #[cfg_attr(feature = "ts", ts(type = "number"))] pub key_index: u64, pub is_default: bool, } diff --git a/dan_layer/wallet/sdk/src/models/wallet_transaction.rs b/dan_layer/wallet/sdk/src/models/wallet_transaction.rs index 71f88d70de..c0fbb368a5 100644 --- a/dan_layer/wallet/sdk/src/models/wallet_transaction.rs +++ b/dan_layer/wallet/sdk/src/models/wallet_transaction.rs @@ -11,6 +11,8 @@ use tari_dan_storage::consensus_models::QuorumCertificate; use tari_engine_types::commit_result::FinalizeResult; use tari_template_lib::models::Amount; use tari_transaction::Transaction; +#[cfg(feature = "ts")] +use ts_rs::TS; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct WalletTransaction { @@ -27,6 +29,7 @@ pub struct WalletTransaction { } #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Default)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/src/types/"))] pub enum TransactionStatus { #[default] New, diff --git a/package-lock.json b/package-lock.json index 38c4db773d..d1bf93c7de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,7 @@ { - "name": "tari-dan", - "lockfileVersion": 2, - "requires": true, - "packages": {}, - "version": "0.3.0" + "name": "tari-dan", + "lockfileVersion": 2, + "requires": true, + "packages": {}, + "version": "0.3.0" } diff --git a/scripts/file_license_check.sh b/scripts/file_license_check.sh index 1761428d9e..71adf5d4d4 100755 --- a/scripts/file_license_check.sh +++ b/scripts/file_license_check.sh @@ -3,7 +3,7 @@ rg -i "Copyright.*The Tari Project" --files-without-match \ -g '!*.{Dockerfile,asc,bat,config,config.js,css,csv,drawio,env,gitkeep,hbs,html,ini,iss,json,lock,md,min.js,ps1,py,rc,scss,sh,sql,svg,toml,txt,yml,vue,liquid}' . \ - | sort > /tmp/rgtemp + -g '!bindings/*' | sort > /tmp/rgtemp # sort the .license.ignore file as sorting seems to behave differently on different platforms cat .license.ignore | sort > /tmp/.license.ignore