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..8aa487ba5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8747,6 +8747,7 @@ dependencies = [ "ciborium-io", "serde", "serde_json", + "ts-rs", ] [[package]] @@ -9128,6 +9129,7 @@ dependencies = [ "tari_crypto", "tari_engine_types", "tari_mmr", + "ts-rs", ] [[package]] @@ -9202,6 +9204,7 @@ dependencies = [ "tari_transaction", "thiserror", "time", + "ts-rs", ] [[package]] @@ -9337,6 +9340,7 @@ dependencies = [ "tari_utilities", "tempfile", "thiserror", + "ts-rs", "zeroize", ] @@ -9382,6 +9386,7 @@ dependencies = [ "tari_template_lib", "tari_utilities", "thiserror", + "ts-rs", ] [[package]] @@ -9473,6 +9478,7 @@ dependencies = [ "tari_engine_types", "tari_transaction", "thiserror", + "ts-rs", ] [[package]] @@ -9796,6 +9802,7 @@ dependencies = [ "hashbrown 0.13.2", "serde", "tari_bor", + "ts-rs", ] [[package]] @@ -9816,6 +9823,7 @@ dependencies = [ "tari_bor", "tari_template_abi", "tari_template_macros", + "ts-rs", ] [[package]] @@ -9874,6 +9882,7 @@ dependencies = [ "tari_engine_types", "tari_template_lib", "thiserror", + "ts-rs", ] [[package]] @@ -10013,6 +10022,7 @@ dependencies = [ "tari_engine_types", "tari_transaction", "thiserror", + "ts-rs", ] [[package]] @@ -10051,6 +10061,7 @@ dependencies = [ "tari_template_lib", "tari_transaction", "thiserror", + "ts-rs", ] [[package]] @@ -10678,6 +10689,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..e5b4ad57a1 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 = [] 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/src/Components/StatusChip.tsx b/applications/tari_dan_wallet_web_ui/src/Components/StatusChip.tsx index 8eb805ec08..dffe950d75 100644 --- a/applications/tari_dan_wallet_web_ui/src/Components/StatusChip.tsx +++ b/applications/tari_dan_wallet_web_ui/src/Components/StatusChip.tsx @@ -23,9 +23,10 @@ import { Chip, Avatar } from "@mui/material"; import { IoCheckmarkOutline, IoDiamondOutline, IoReload, IoHourglassOutline, IoCloseOutline } from "react-icons/io5"; import { useTheme } from "@mui/material/styles"; +import { TransactionStatus } from "../../../../bindings/TransactionStatus"; interface StatusChipProps { - status: "Accepted" | "Pending" | "DryRun" | "New" | "Rejected" | "InvalidTransaction"; + status: TransactionStatus; showTitle?: boolean; } @@ -36,6 +37,7 @@ const colorList: Record = { New: "#9D5CF9", Rejected: "#DB7E7E", InvalidTransaction: "#DB7E7E", + OnlyFeeAccepted: "#FFA500", }; export default function StatusChip({ status, showTitle = true }: StatusChipProps) { @@ -48,14 +50,32 @@ export default function StatusChip({ status, showTitle = true }: StatusChipProps New: , Rejected: , InvalidTransaction: , + OnlyFeeAccepted: ( + <> + + + + ), }; + let bgColor = colorList[status]; + let background = null; + + if (status === "OnlyFeeAccepted") { + const leftColor = colorList["Accepted"]; + const rightColor = colorList["Rejected"]; + background = `linear-gradient(to right, ${leftColor} 50%, ${colorList["Rejected"]} 50%)`; + } + if (!showTitle) { - return {iconList[status]}; + let leftColor = colorList["Accepted"]; + let rightColor = colorList["Rejected"]; + + return {iconList[status]}; } else { return ( {iconList[status]}} + avatar={{iconList[status]}} label={status} style={{ color: colorList[status], borderColor: colorList[status] }} variant="outlined" diff --git a/applications/tari_dan_wallet_web_ui/src/api/hooks/useTransactions.tsx b/applications/tari_dan_wallet_web_ui/src/api/hooks/useTransactions.tsx index e61e1a94d5..38fe735bb7 100644 --- a/applications/tari_dan_wallet_web_ui/src/api/hooks/useTransactions.tsx +++ b/applications/tari_dan_wallet_web_ui/src/api/hooks/useTransactions.tsx @@ -20,9 +20,10 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import { useQuery } from "@tanstack/react-query"; +import { UseQueryResult, useQuery } from "@tanstack/react-query"; import { getAllTransaction, jsonRpc } from "../../utils/json_rpc"; import { apiError } from "../helpers/types"; +import { TransactionGetAllResponse } from "../../../../../bindings/TransactionGetAllResponse"; const useTransactionDetails = (hash: string) => { return useQuery({ @@ -36,7 +37,10 @@ const useTransactionDetails = (hash: string) => { }); }; -const useGetAllTransactions = (status: string | null | undefined, component: string | null | undefined) => { +const useGetAllTransactions = ( + status: string | null | undefined, + component: string | null | undefined, +): UseQueryResult => { return useQuery({ queryKey: ["transactions"], queryFn: () => getAllTransaction(status, component), diff --git a/applications/tari_dan_wallet_web_ui/src/routes/Transactions/Transactions.tsx b/applications/tari_dan_wallet_web_ui/src/routes/Transactions/Transactions.tsx index a5fe5fffb5..7ec1c12d52 100644 --- a/applications/tari_dan_wallet_web_ui/src/routes/Transactions/Transactions.tsx +++ b/applications/tari_dan_wallet_web_ui/src/routes/Transactions/Transactions.tsx @@ -41,6 +41,9 @@ import { DataTableCell } from "../../Components/StyledComponents"; import { useGetAllTransactions } from "../../api/hooks/useTransactions"; import { emptyRows, handleChangePage, handleChangeRowsPerPage } from "../../utils/helpers"; import { useAccountsGet } from "../../api/hooks/useAccounts"; +import { Transaction } from "../../../../../bindings/Transaction"; +import { FinalizeResult } from "../../../../../bindings/FinalizeResult"; +import { TransactionStatus } from "../../../../../bindings/TransactionStatus"; export default function Transactions({ accountName }: { accountName: string }) { const { data: accountsData } = useAccountsGet(accountName); @@ -74,41 +77,43 @@ export default function Transactions({ accountName }: { accountName: string }) { - {data?.transactions?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((t: any) => { - if (t?.[0]?.id !== undefined) { - const hash = t[0].id; - return ( - - - - {hash} - - - - - - {t?.[1]?.cost_breakdown?.total_fees_charged || 0} - - - - - - - ); - } - })} + {data?.transactions + ?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) + .map((t: [Transaction, FinalizeResult | null, TransactionStatus, string]) => { + if (t?.[0]?.id !== undefined) { + const hash = t[0].id; + return ( + + + + {hash} + + + + + + {t?.[1]?.cost_breakdown?.total_fees_charged || 0} + + + + + + + ); + } + })} {emptyRows(page, rowsPerPage, data?.transactions) > 0 && ( { if (Array.isArray(json)) { @@ -100,7 +103,14 @@ function shortenString(string: string, start: number = 8, end: number = 8) { return string.substring(0, start) + "..." + string.slice(-end); } -function emptyRows(page: number, rowsPerPage: number, array: any[]) { +function emptyRows( + page: number, + rowsPerPage: number, + array: Array<[Transaction, FinalizeResult | null, TransactionStatus, string]> | undefined, +) { + if (array === undefined) { + return 0; + } return page > 0 ? Math.max(0, (1 + page) * rowsPerPage - array.length) : 0; } diff --git a/applications/tari_dan_wallet_web_ui/src/utils/json_rpc.tsx b/applications/tari_dan_wallet_web_ui/src/utils/json_rpc.tsx index 0170a938e6..d9f214f7d5 100644 --- a/applications/tari_dan_wallet_web_ui/src/utils/json_rpc.tsx +++ b/applications/tari_dan_wallet_web_ui/src/utils/json_rpc.tsx @@ -34,13 +34,7 @@ async function internalJsonRpc(method: string, token: any = null, params: any = id = json_id; json_id += 1; }); - let address = "http://localhost:9000"; - try { - address = await (await fetch("/json_rpc_address")).text(); - if (!address.startsWith("http")) { - address = "http://" + address; - } - } catch {} + let address = "http://localhost:18013"; let headers: { [key: string]: string } = { "Content-Type": "application/json", }; diff --git a/applications/tari_dan_wallet_web_ui/tsconfig.json b/applications/tari_dan_wallet_web_ui/tsconfig.json index b5eaa05e05..6030032894 100644 --- a/applications/tari_dan_wallet_web_ui/tsconfig.json +++ b/applications/tari_dan_wallet_web_ui/tsconfig.json @@ -16,6 +16,6 @@ "noEmit": true, "jsx": "react-jsx", }, - "include": ["src"], + "include": ["src", "../../bindings/**/*"], "references": [{ "path": "./tsconfig.node.json" }], } 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_validator_node/Cargo.toml b/applications/tari_validator_node/Cargo.toml index 3e1cea4d89..d55ab772c2 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 = [] 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/.gitignore b/applications/tari_validator_node_web_ui/.gitignore index 4d29575de8..c60eac7420 100644 --- a/applications/tari_validator_node_web_ui/.gitignore +++ b/applications/tari_validator_node_web_ui/.gitignore @@ -9,7 +9,7 @@ /coverage # production -/build +build/* # misc .DS_Store diff --git a/bindings/AccessRule.ts b/bindings/AccessRule.ts new file mode 100644 index 0000000000..445f01aab4 --- /dev/null +++ b/bindings/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/Account.ts b/bindings/Account.ts new file mode 100644 index 0000000000..cda6896ff9 --- /dev/null +++ b/bindings/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: bigint; + is_default: boolean; +} diff --git a/bindings/AccountGetDefaultRequest.ts b/bindings/AccountGetDefaultRequest.ts new file mode 100644 index 0000000000..bc436edc54 --- /dev/null +++ b/bindings/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/AccountGetRequest.ts b/bindings/AccountGetRequest.ts new file mode 100644 index 0000000000..6fc79f1f68 --- /dev/null +++ b/bindings/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/AccountGetResponse.ts b/bindings/AccountGetResponse.ts new file mode 100644 index 0000000000..3bf3663b1f --- /dev/null +++ b/bindings/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/AccountInfo.ts b/bindings/AccountInfo.ts new file mode 100644 index 0000000000..c9a75870e2 --- /dev/null +++ b/bindings/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/AccountNftInfo.ts b/bindings/AccountNftInfo.ts new file mode 100644 index 0000000000..cdb35c439e --- /dev/null +++ b/bindings/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: string; + is_burned: boolean; +} diff --git a/bindings/AccountSetDefaultRequest.ts b/bindings/AccountSetDefaultRequest.ts new file mode 100644 index 0000000000..3878cf0ecc --- /dev/null +++ b/bindings/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/AccountSetDefaultResponse.ts b/bindings/AccountSetDefaultResponse.ts new file mode 100644 index 0000000000..ec4c0c8574 --- /dev/null +++ b/bindings/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/AccountsCreateFreeTestCoinsRequest.ts b/bindings/AccountsCreateFreeTestCoinsRequest.ts new file mode 100644 index 0000000000..85aef5e991 --- /dev/null +++ b/bindings/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: bigint | null; +} diff --git a/bindings/AccountsCreateFreeTestCoinsResponse.ts b/bindings/AccountsCreateFreeTestCoinsResponse.ts new file mode 100644 index 0000000000..c3b206447e --- /dev/null +++ b/bindings/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/AccountsCreateRequest.ts b/bindings/AccountsCreateRequest.ts new file mode 100644 index 0000000000..246c6d77c3 --- /dev/null +++ b/bindings/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/AccountsCreateResponse.ts b/bindings/AccountsCreateResponse.ts new file mode 100644 index 0000000000..d6842c9dc3 --- /dev/null +++ b/bindings/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/AccountsGetBalancesRequest.ts b/bindings/AccountsGetBalancesRequest.ts new file mode 100644 index 0000000000..fcfa8b99d0 --- /dev/null +++ b/bindings/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/AccountsGetBalancesResponse.ts b/bindings/AccountsGetBalancesResponse.ts new file mode 100644 index 0000000000..42038ba125 --- /dev/null +++ b/bindings/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/AccountsInvokeRequest.ts b/bindings/AccountsInvokeRequest.ts new file mode 100644 index 0000000000..fef6794dfb --- /dev/null +++ b/bindings/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/AccountsInvokeResponse.ts b/bindings/AccountsInvokeResponse.ts new file mode 100644 index 0000000000..c6880e4951 --- /dev/null +++ b/bindings/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/AccountsListRequest.ts b/bindings/AccountsListRequest.ts new file mode 100644 index 0000000000..51bdf96363 --- /dev/null +++ b/bindings/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: bigint; + limit: bigint; +} diff --git a/bindings/AccountsListResponse.ts b/bindings/AccountsListResponse.ts new file mode 100644 index 0000000000..d786c27648 --- /dev/null +++ b/bindings/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/AddAddressRequest.ts b/bindings/AddAddressRequest.ts new file mode 100644 index 0000000000..e7a45892f9 --- /dev/null +++ b/bindings/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/AddPeerRequest.ts b/bindings/AddPeerRequest.ts new file mode 100644 index 0000000000..c95eae8dcd --- /dev/null +++ b/bindings/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/AddPeerResponse.ts b/bindings/AddPeerResponse.ts new file mode 100644 index 0000000000..2f3c13dbe4 --- /dev/null +++ b/bindings/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/Amount.ts b/bindings/Amount.ts new file mode 100644 index 0000000000..07f91ec68a --- /dev/null +++ b/bindings/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/Arg.ts b/bindings/Arg.ts new file mode 100644 index 0000000000..ef1428921c --- /dev/null +++ b/bindings/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/ArgDef.ts b/bindings/ArgDef.ts new file mode 100644 index 0000000000..f8b3b7cf92 --- /dev/null +++ b/bindings/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/AuthGetAllJwtRequest.ts b/bindings/AuthGetAllJwtRequest.ts new file mode 100644 index 0000000000..e98b4ae2cb --- /dev/null +++ b/bindings/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/AuthGetAllJwtResponse.ts b/bindings/AuthGetAllJwtResponse.ts new file mode 100644 index 0000000000..bbf866499f --- /dev/null +++ b/bindings/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/AuthLoginAcceptRequest.ts b/bindings/AuthLoginAcceptRequest.ts new file mode 100644 index 0000000000..b19c497569 --- /dev/null +++ b/bindings/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/AuthLoginAcceptResponse.ts b/bindings/AuthLoginAcceptResponse.ts new file mode 100644 index 0000000000..87fdbde2b2 --- /dev/null +++ b/bindings/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/AuthLoginDenyRequest.ts b/bindings/AuthLoginDenyRequest.ts new file mode 100644 index 0000000000..6cd275f017 --- /dev/null +++ b/bindings/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/AuthLoginDenyResponse.ts b/bindings/AuthLoginDenyResponse.ts new file mode 100644 index 0000000000..9feb6a1c4f --- /dev/null +++ b/bindings/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/AuthLoginRequest.ts b/bindings/AuthLoginRequest.ts new file mode 100644 index 0000000000..fd1de9232e --- /dev/null +++ b/bindings/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/AuthLoginResponse.ts b/bindings/AuthLoginResponse.ts new file mode 100644 index 0000000000..c48a127738 --- /dev/null +++ b/bindings/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/AuthRevokeTokenRequest.ts b/bindings/AuthRevokeTokenRequest.ts new file mode 100644 index 0000000000..c4e0667c9c --- /dev/null +++ b/bindings/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/AuthRevokeTokenResponse.ts b/bindings/AuthRevokeTokenResponse.ts new file mode 100644 index 0000000000..2786750995 --- /dev/null +++ b/bindings/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/BalanceEntry.ts b/bindings/BalanceEntry.ts new file mode 100644 index 0000000000..35d70ab5e7 --- /dev/null +++ b/bindings/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/BalanceProofSignature.ts b/bindings/BalanceProofSignature.ts new file mode 100644 index 0000000000..0efd5da591 --- /dev/null +++ b/bindings/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/Block.ts b/bindings/Block.ts new file mode 100644 index 0000000000..08e6354663 --- /dev/null +++ b/bindings/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/BlockId.ts b/bindings/BlockId.ts new file mode 100644 index 0000000000..7d993fa8a2 --- /dev/null +++ b/bindings/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/BucketId.ts b/bindings/BucketId.ts new file mode 100644 index 0000000000..1aa1cf2406 --- /dev/null +++ b/bindings/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/ClaimBurnRequest.ts b/bindings/ClaimBurnRequest.ts new file mode 100644 index 0000000000..877c49d5fc --- /dev/null +++ b/bindings/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: bigint | null; +} diff --git a/bindings/ClaimBurnResponse.ts b/bindings/ClaimBurnResponse.ts new file mode 100644 index 0000000000..ffad4d7112 --- /dev/null +++ b/bindings/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/ClaimValidatorFeesRequest.ts b/bindings/ClaimValidatorFeesRequest.ts new file mode 100644 index 0000000000..5ef60f5447 --- /dev/null +++ b/bindings/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/ClaimValidatorFeesResponse.ts b/bindings/ClaimValidatorFeesResponse.ts new file mode 100644 index 0000000000..c1855db1dd --- /dev/null +++ b/bindings/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/Claims.ts b/bindings/Claims.ts new file mode 100644 index 0000000000..9d657815cf --- /dev/null +++ b/bindings/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: bigint; + name: string; + permissions: JrpcPermissions; + exp: number; +} diff --git a/bindings/Command.ts b/bindings/Command.ts new file mode 100644 index 0000000000..5d89974b88 --- /dev/null +++ b/bindings/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/CommitteeShard.ts b/bindings/CommitteeShard.ts new file mode 100644 index 0000000000..2fc3eca3d4 --- /dev/null +++ b/bindings/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/CommitteeShardInfo.ts b/bindings/CommitteeShardInfo.ts new file mode 100644 index 0000000000..8c67e6ca9f --- /dev/null +++ b/bindings/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/ComponentAccessRules.ts b/bindings/ComponentAccessRules.ts new file mode 100644 index 0000000000..1db3651946 --- /dev/null +++ b/bindings/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/ComponentAddress.ts b/bindings/ComponentAddress.ts new file mode 100644 index 0000000000..321e8c197f --- /dev/null +++ b/bindings/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/ComponentAddressOrName.ts b/bindings/ComponentAddressOrName.ts new file mode 100644 index 0000000000..35dac1738a --- /dev/null +++ b/bindings/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/ComponentBody.ts b/bindings/ComponentBody.ts new file mode 100644 index 0000000000..367f58919b --- /dev/null +++ b/bindings/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/ComponentHeader.ts b/bindings/ComponentHeader.ts new file mode 100644 index 0000000000..f6248f3456 --- /dev/null +++ b/bindings/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/ConfidentialClaim.ts b/bindings/ConfidentialClaim.ts new file mode 100644 index 0000000000..22964823de --- /dev/null +++ b/bindings/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/ConfidentialCreateOutputProofRequest.ts b/bindings/ConfidentialCreateOutputProofRequest.ts new file mode 100644 index 0000000000..4f81f4e6a6 --- /dev/null +++ b/bindings/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/ConfidentialCreateOutputProofResponse.ts b/bindings/ConfidentialCreateOutputProofResponse.ts new file mode 100644 index 0000000000..a01f311b2c --- /dev/null +++ b/bindings/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/ConfidentialOutput.ts b/bindings/ConfidentialOutput.ts new file mode 100644 index 0000000000..0c36b52f47 --- /dev/null +++ b/bindings/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/ConfidentialOutputProof.ts b/bindings/ConfidentialOutputProof.ts new file mode 100644 index 0000000000..cd52c57014 --- /dev/null +++ b/bindings/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/ConfidentialStatement.ts b/bindings/ConfidentialStatement.ts new file mode 100644 index 0000000000..5e2492f8c9 --- /dev/null +++ b/bindings/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/ConfidentialTransferRequest.ts b/bindings/ConfidentialTransferRequest.ts new file mode 100644 index 0000000000..da4b833d03 --- /dev/null +++ b/bindings/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/ConfidentialTransferResponse.ts b/bindings/ConfidentialTransferResponse.ts new file mode 100644 index 0000000000..a0452c54f1 --- /dev/null +++ b/bindings/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/ConfidentialWithdrawProof.ts b/bindings/ConfidentialWithdrawProof.ts new file mode 100644 index 0000000000..de624dd32a --- /dev/null +++ b/bindings/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/Connection.ts b/bindings/Connection.ts new file mode 100644 index 0000000000..f8405c5c98 --- /dev/null +++ b/bindings/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/ConnectionDirection.ts b/bindings/ConnectionDirection.ts new file mode 100644 index 0000000000..45100c453e --- /dev/null +++ b/bindings/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/Decision.ts b/bindings/Decision.ts new file mode 100644 index 0000000000..a697b0f15c --- /dev/null +++ b/bindings/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/DeleteAddressRequest.ts b/bindings/DeleteAddressRequest.ts new file mode 100644 index 0000000000..90da954aad --- /dev/null +++ b/bindings/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/DryRunTransactionFinalizeResult.ts b/bindings/DryRunTransactionFinalizeResult.ts new file mode 100644 index 0000000000..cf435e4b3b --- /dev/null +++ b/bindings/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/EncryptedData.ts b/bindings/EncryptedData.ts new file mode 100644 index 0000000000..8eb5aa818c --- /dev/null +++ b/bindings/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/Epoch.ts b/bindings/Epoch.ts new file mode 100644 index 0000000000..d98ccd5f63 --- /dev/null +++ b/bindings/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/Event.ts b/bindings/Event.ts new file mode 100644 index 0000000000..effd489751 --- /dev/null +++ b/bindings/Event.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 { ComponentAddress } from "./ComponentAddress"; +import type { Hash } from "./Hash"; +import type { Metadata } from "./Metadata"; + +export interface Event { + component_address: ComponentAddress | null; + template_address: Hash; + tx_hash: Hash; + topic: string; + payload: Metadata; +} diff --git a/bindings/Evidence.ts b/bindings/Evidence.ts new file mode 100644 index 0000000000..10e550400a --- /dev/null +++ b/bindings/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/ExecuteResult.ts b/bindings/ExecuteResult.ts new file mode 100644 index 0000000000..ae236b9c37 --- /dev/null +++ b/bindings/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/ExecutedTransaction.ts b/bindings/ExecutedTransaction.ts new file mode 100644 index 0000000000..5be16ad74a --- /dev/null +++ b/bindings/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/FeeClaim.ts b/bindings/FeeClaim.ts new file mode 100644 index 0000000000..715b761925 --- /dev/null +++ b/bindings/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/FeeClaimAddress.ts b/bindings/FeeClaimAddress.ts new file mode 100644 index 0000000000..3f8a46adf3 --- /dev/null +++ b/bindings/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/FeeCostBreakdown.ts b/bindings/FeeCostBreakdown.ts new file mode 100644 index 0000000000..2c0f0566a3 --- /dev/null +++ b/bindings/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/FeeReceipt.ts b/bindings/FeeReceipt.ts new file mode 100644 index 0000000000..31feb4bebf --- /dev/null +++ b/bindings/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/FeeSource.ts b/bindings/FeeSource.ts new file mode 100644 index 0000000000..cb18543544 --- /dev/null +++ b/bindings/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/FinalizeResult.ts b/bindings/FinalizeResult.ts new file mode 100644 index 0000000000..ae3e4c1ef0 --- /dev/null +++ b/bindings/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/ForeignProposal.ts b/bindings/ForeignProposal.ts new file mode 100644 index 0000000000..bdadf26b42 --- /dev/null +++ b/bindings/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/ForeignProposalState.ts b/bindings/ForeignProposalState.ts new file mode 100644 index 0000000000..a7fe60bf3d --- /dev/null +++ b/bindings/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/FunctionDef.ts b/bindings/FunctionDef.ts new file mode 100644 index 0000000000..2f5eaf5cc1 --- /dev/null +++ b/bindings/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/GetAccountNftRequest.ts b/bindings/GetAccountNftRequest.ts new file mode 100644 index 0000000000..42adee881d --- /dev/null +++ b/bindings/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/GetBlockRequest.ts b/bindings/GetBlockRequest.ts new file mode 100644 index 0000000000..aaec6654aa --- /dev/null +++ b/bindings/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/GetBlockResponse.ts b/bindings/GetBlockResponse.ts new file mode 100644 index 0000000000..1b350e5abf --- /dev/null +++ b/bindings/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/GetBlocksCountResponse.ts b/bindings/GetBlocksCountResponse.ts new file mode 100644 index 0000000000..8e9a091baf --- /dev/null +++ b/bindings/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/GetBlocksRequest.ts b/bindings/GetBlocksRequest.ts new file mode 100644 index 0000000000..3890877af5 --- /dev/null +++ b/bindings/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/GetBlocksResponse.ts b/bindings/GetBlocksResponse.ts new file mode 100644 index 0000000000..37d06be2c2 --- /dev/null +++ b/bindings/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/GetCommitteeRequest.ts b/bindings/GetCommitteeRequest.ts new file mode 100644 index 0000000000..cf496bd0f1 --- /dev/null +++ b/bindings/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/GetConnectionsResponse.ts b/bindings/GetConnectionsResponse.ts new file mode 100644 index 0000000000..87a6d892a8 --- /dev/null +++ b/bindings/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/GetEpochManagerStatsResponse.ts b/bindings/GetEpochManagerStatsResponse.ts new file mode 100644 index 0000000000..2f5eb1736c --- /dev/null +++ b/bindings/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/GetIdentityResponse.ts b/bindings/GetIdentityResponse.ts new file mode 100644 index 0000000000..0b0f977fed --- /dev/null +++ b/bindings/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/GetNetworkCommitteeResponse.ts b/bindings/GetNetworkCommitteeResponse.ts new file mode 100644 index 0000000000..e746758b8c --- /dev/null +++ b/bindings/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/GetNonFungibleCountRequest.ts b/bindings/GetNonFungibleCountRequest.ts new file mode 100644 index 0000000000..b4400b81dc --- /dev/null +++ b/bindings/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/GetNonFungiblesRequest.ts b/bindings/GetNonFungiblesRequest.ts new file mode 100644 index 0000000000..f95fbb836b --- /dev/null +++ b/bindings/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/GetNonFungiblesResponse.ts b/bindings/GetNonFungiblesResponse.ts new file mode 100644 index 0000000000..d4feee936a --- /dev/null +++ b/bindings/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/GetRecentTransactionsRequest.ts b/bindings/GetRecentTransactionsRequest.ts new file mode 100644 index 0000000000..6db8a1ceff --- /dev/null +++ b/bindings/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/GetRecentTransactionsResponse.ts b/bindings/GetRecentTransactionsResponse.ts new file mode 100644 index 0000000000..cbf2006b0b --- /dev/null +++ b/bindings/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/GetRelatedTransactionsRequest.ts b/bindings/GetRelatedTransactionsRequest.ts new file mode 100644 index 0000000000..55772a6990 --- /dev/null +++ b/bindings/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/GetRelatedTransactionsResponse.ts b/bindings/GetRelatedTransactionsResponse.ts new file mode 100644 index 0000000000..cd920c0f35 --- /dev/null +++ b/bindings/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/GetShardKey.ts b/bindings/GetShardKey.ts new file mode 100644 index 0000000000..7e7dab1e52 --- /dev/null +++ b/bindings/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/GetStateRequest.ts b/bindings/GetStateRequest.ts new file mode 100644 index 0000000000..ac3e373951 --- /dev/null +++ b/bindings/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/GetStateResponse.ts b/bindings/GetStateResponse.ts new file mode 100644 index 0000000000..e20666b2e6 --- /dev/null +++ b/bindings/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/GetSubstateRequest.ts b/bindings/GetSubstateRequest.ts new file mode 100644 index 0000000000..be0ab78ea8 --- /dev/null +++ b/bindings/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/GetSubstateResponse.ts b/bindings/GetSubstateResponse.ts new file mode 100644 index 0000000000..d6797f8ce4 --- /dev/null +++ b/bindings/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/GetSubstatesByTransactionRequest.ts b/bindings/GetSubstatesByTransactionRequest.ts new file mode 100644 index 0000000000..961e4f083a --- /dev/null +++ b/bindings/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/GetSubstatesByTransactionResponse.ts b/bindings/GetSubstatesByTransactionResponse.ts new file mode 100644 index 0000000000..6d27b2f9a6 --- /dev/null +++ b/bindings/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/GetTemplateRequest.ts b/bindings/GetTemplateRequest.ts new file mode 100644 index 0000000000..62ecf4c0e3 --- /dev/null +++ b/bindings/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/GetTemplateResponse.ts b/bindings/GetTemplateResponse.ts new file mode 100644 index 0000000000..00f6514690 --- /dev/null +++ b/bindings/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/GetTemplatesRequest.ts b/bindings/GetTemplatesRequest.ts new file mode 100644 index 0000000000..62e71deab3 --- /dev/null +++ b/bindings/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/GetTemplatesResponse.ts b/bindings/GetTemplatesResponse.ts new file mode 100644 index 0000000000..a2b3be8169 --- /dev/null +++ b/bindings/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/GetTransactionRequest.ts b/bindings/GetTransactionRequest.ts new file mode 100644 index 0000000000..3ce05d285b --- /dev/null +++ b/bindings/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/GetTransactionResponse.ts b/bindings/GetTransactionResponse.ts new file mode 100644 index 0000000000..4b3d2b29b4 --- /dev/null +++ b/bindings/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/GetTransactionResultRequest.ts b/bindings/GetTransactionResultRequest.ts new file mode 100644 index 0000000000..73b506c393 --- /dev/null +++ b/bindings/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/GetTransactionResultResponse.ts b/bindings/GetTransactionResultResponse.ts new file mode 100644 index 0000000000..9eadf6d40b --- /dev/null +++ b/bindings/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/GetValidatorFeesRequest.ts b/bindings/GetValidatorFeesRequest.ts new file mode 100644 index 0000000000..569fe078bf --- /dev/null +++ b/bindings/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/GetValidatorFeesResponse.ts b/bindings/GetValidatorFeesResponse.ts new file mode 100644 index 0000000000..39b11ab635 --- /dev/null +++ b/bindings/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/Hash.ts b/bindings/Hash.ts new file mode 100644 index 0000000000..3053896346 --- /dev/null +++ b/bindings/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/IndexedValue.ts b/bindings/IndexedValue.ts new file mode 100644 index 0000000000..5c29b803e3 --- /dev/null +++ b/bindings/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/IndexedWellKnownTypes.ts b/bindings/IndexedWellKnownTypes.ts new file mode 100644 index 0000000000..8d20980c48 --- /dev/null +++ b/bindings/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/IndexerTransactionFinalizedResult.ts b/bindings/IndexerTransactionFinalizedResult.ts new file mode 100644 index 0000000000..ec96ee2e89 --- /dev/null +++ b/bindings/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/InspectSubstateRequest.ts b/bindings/InspectSubstateRequest.ts new file mode 100644 index 0000000000..567cd72f21 --- /dev/null +++ b/bindings/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/InspectSubstateResponse.ts b/bindings/InspectSubstateResponse.ts new file mode 100644 index 0000000000..6a30bc9d7c --- /dev/null +++ b/bindings/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/Instruction.ts b/bindings/Instruction.ts new file mode 100644 index 0000000000..fd635d4bfd --- /dev/null +++ b/bindings/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/InstructionResult.ts b/bindings/InstructionResult.ts new file mode 100644 index 0000000000..a73cc1fc9b --- /dev/null +++ b/bindings/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/JrpcPermission.ts b/bindings/JrpcPermission.ts new file mode 100644 index 0000000000..c8ca7afe08 --- /dev/null +++ b/bindings/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/JrpcPermissions.ts b/bindings/JrpcPermissions.ts new file mode 100644 index 0000000000..9c212ab4eb --- /dev/null +++ b/bindings/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/KeysCreateRequest.ts b/bindings/KeysCreateRequest.ts new file mode 100644 index 0000000000..39f2948b52 --- /dev/null +++ b/bindings/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: bigint | null; +} diff --git a/bindings/KeysCreateResponse.ts b/bindings/KeysCreateResponse.ts new file mode 100644 index 0000000000..640f2410ef --- /dev/null +++ b/bindings/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/KeysListRequest.ts b/bindings/KeysListRequest.ts new file mode 100644 index 0000000000..7436eda386 --- /dev/null +++ b/bindings/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/KeysListResponse.ts b/bindings/KeysListResponse.ts new file mode 100644 index 0000000000..239dc4a2cf --- /dev/null +++ b/bindings/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/KeysSetActiveRequest.ts b/bindings/KeysSetActiveRequest.ts new file mode 100644 index 0000000000..7c69787a42 --- /dev/null +++ b/bindings/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: bigint; +} diff --git a/bindings/KeysSetActiveResponse.ts b/bindings/KeysSetActiveResponse.ts new file mode 100644 index 0000000000..0d365896aa --- /dev/null +++ b/bindings/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/ListAccountNftRequest.ts b/bindings/ListAccountNftRequest.ts new file mode 100644 index 0000000000..4bb0e13cea --- /dev/null +++ b/bindings/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: bigint; + offset: bigint; +} diff --git a/bindings/ListAccountNftResponse.ts b/bindings/ListAccountNftResponse.ts new file mode 100644 index 0000000000..e6805c1180 --- /dev/null +++ b/bindings/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/ListBlocksRequest.ts b/bindings/ListBlocksRequest.ts new file mode 100644 index 0000000000..ee6cdb52cb --- /dev/null +++ b/bindings/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/ListBlocksResponse.ts b/bindings/ListBlocksResponse.ts new file mode 100644 index 0000000000..8e56039fab --- /dev/null +++ b/bindings/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/LockFlag.ts b/bindings/LockFlag.ts new file mode 100644 index 0000000000..08258cccd4 --- /dev/null +++ b/bindings/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/LogEntry.ts b/bindings/LogEntry.ts new file mode 100644 index 0000000000..fec6ce1ce2 --- /dev/null +++ b/bindings/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: bigint; + message: string; + level: LogLevel; +} diff --git a/bindings/LogLevel.ts b/bindings/LogLevel.ts new file mode 100644 index 0000000000..58aaf969d3 --- /dev/null +++ b/bindings/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/Metadata.ts b/bindings/Metadata.ts new file mode 100644 index 0000000000..c35ff1cded --- /dev/null +++ b/bindings/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/MintAccountNftRequest.ts b/bindings/MintAccountNftRequest.ts new file mode 100644 index 0000000000..4c3b3be6c7 --- /dev/null +++ b/bindings/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/MintAccountNftResponse.ts b/bindings/MintAccountNftResponse.ts new file mode 100644 index 0000000000..c7e9b0c63f --- /dev/null +++ b/bindings/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/NodeHeight.ts b/bindings/NodeHeight.ts new file mode 100644 index 0000000000..58a2e016dd --- /dev/null +++ b/bindings/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/NonFungible.ts b/bindings/NonFungible.ts new file mode 100644 index 0000000000..309278152e --- /dev/null +++ b/bindings/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/NonFungibleAddress.ts b/bindings/NonFungibleAddress.ts new file mode 100644 index 0000000000..7f6b2fe163 --- /dev/null +++ b/bindings/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/NonFungibleAddressContents.ts b/bindings/NonFungibleAddressContents.ts new file mode 100644 index 0000000000..2a30c1023e --- /dev/null +++ b/bindings/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/NonFungibleContainer.ts b/bindings/NonFungibleContainer.ts new file mode 100644 index 0000000000..847f081128 --- /dev/null +++ b/bindings/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/NonFungibleId.ts b/bindings/NonFungibleId.ts new file mode 100644 index 0000000000..565fdb5452 --- /dev/null +++ b/bindings/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/NonFungibleIndex.ts b/bindings/NonFungibleIndex.ts new file mode 100644 index 0000000000..ab9d49f0f8 --- /dev/null +++ b/bindings/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/NonFungibleIndexAddress.ts b/bindings/NonFungibleIndexAddress.ts new file mode 100644 index 0000000000..d801fd3be4 --- /dev/null +++ b/bindings/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: bigint; +} diff --git a/bindings/NonFungibleSubstate.ts b/bindings/NonFungibleSubstate.ts new file mode 100644 index 0000000000..d3a9011b7e --- /dev/null +++ b/bindings/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/Ordering.ts b/bindings/Ordering.ts new file mode 100644 index 0000000000..9e36dbd3d3 --- /dev/null +++ b/bindings/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/OwnerRule.ts b/bindings/OwnerRule.ts new file mode 100644 index 0000000000..f3f0d2541d --- /dev/null +++ b/bindings/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/PedersonCommitmentBytes.ts b/bindings/PedersonCommitmentBytes.ts new file mode 100644 index 0000000000..e0200e6eb4 --- /dev/null +++ b/bindings/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/ProofId.ts b/bindings/ProofId.ts new file mode 100644 index 0000000000..9d70f4967c --- /dev/null +++ b/bindings/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/ProofsCancelRequest.ts b/bindings/ProofsCancelRequest.ts new file mode 100644 index 0000000000..ecab2f6a25 --- /dev/null +++ b/bindings/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/ProofsCancelResponse.ts b/bindings/ProofsCancelResponse.ts new file mode 100644 index 0000000000..3fbcc7c781 --- /dev/null +++ b/bindings/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/ProofsFinalizeRequest.ts b/bindings/ProofsFinalizeRequest.ts new file mode 100644 index 0000000000..5f72f3ad6c --- /dev/null +++ b/bindings/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/ProofsFinalizeResponse.ts b/bindings/ProofsFinalizeResponse.ts new file mode 100644 index 0000000000..5b3d38c58d --- /dev/null +++ b/bindings/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/ProofsGenerateRequest.ts b/bindings/ProofsGenerateRequest.ts new file mode 100644 index 0000000000..15a4f8058f --- /dev/null +++ b/bindings/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/ProofsGenerateResponse.ts b/bindings/ProofsGenerateResponse.ts new file mode 100644 index 0000000000..7782251b15 --- /dev/null +++ b/bindings/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/QcId.ts b/bindings/QcId.ts new file mode 100644 index 0000000000..e7591e629f --- /dev/null +++ b/bindings/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/QuorumCertificate.ts b/bindings/QuorumCertificate.ts new file mode 100644 index 0000000000..feb6d8405e --- /dev/null +++ b/bindings/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/QuorumDecision.ts b/bindings/QuorumDecision.ts new file mode 100644 index 0000000000..9aec4c8c50 --- /dev/null +++ b/bindings/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/RegisterValidatorNodeRequest.ts b/bindings/RegisterValidatorNodeRequest.ts new file mode 100644 index 0000000000..3ef1080cd7 --- /dev/null +++ b/bindings/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/RegisterValidatorNodeResponse.ts b/bindings/RegisterValidatorNodeResponse.ts new file mode 100644 index 0000000000..40755f8c8e --- /dev/null +++ b/bindings/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/RejectReason.ts b/bindings/RejectReason.ts new file mode 100644 index 0000000000..f25adfe1c1 --- /dev/null +++ b/bindings/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/RequireRule.ts b/bindings/RequireRule.ts new file mode 100644 index 0000000000..f7eb307e2d --- /dev/null +++ b/bindings/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/Resource.ts b/bindings/Resource.ts new file mode 100644 index 0000000000..d2992b141a --- /dev/null +++ b/bindings/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/ResourceAccessRules.ts b/bindings/ResourceAccessRules.ts new file mode 100644 index 0000000000..ae459d2bba --- /dev/null +++ b/bindings/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/ResourceAddress.ts b/bindings/ResourceAddress.ts new file mode 100644 index 0000000000..906f22228e --- /dev/null +++ b/bindings/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/ResourceContainer.ts b/bindings/ResourceContainer.ts new file mode 100644 index 0000000000..7a72354492 --- /dev/null +++ b/bindings/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/ResourceType.ts b/bindings/ResourceType.ts new file mode 100644 index 0000000000..84db56ac98 --- /dev/null +++ b/bindings/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/RestrictedAccessRule.ts b/bindings/RestrictedAccessRule.ts new file mode 100644 index 0000000000..a4e307c2b5 --- /dev/null +++ b/bindings/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/RevealFundsRequest.ts b/bindings/RevealFundsRequest.ts new file mode 100644 index 0000000000..46fcb1f245 --- /dev/null +++ b/bindings/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/RevealFundsResponse.ts b/bindings/RevealFundsResponse.ts new file mode 100644 index 0000000000..3d610b2870 --- /dev/null +++ b/bindings/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/RistrettoPublicKeyBytes.ts b/bindings/RistrettoPublicKeyBytes.ts new file mode 100644 index 0000000000..630c16a4c2 --- /dev/null +++ b/bindings/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/RuleRequirement.ts b/bindings/RuleRequirement.ts new file mode 100644 index 0000000000..0446b5070c --- /dev/null +++ b/bindings/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/SettingsGetResponse.ts b/bindings/SettingsGetResponse.ts new file mode 100644 index 0000000000..7ba7469dfc --- /dev/null +++ b/bindings/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/SettingsSetRequest.ts b/bindings/SettingsSetRequest.ts new file mode 100644 index 0000000000..c026eebbd8 --- /dev/null +++ b/bindings/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/SettingsSetResponse.ts b/bindings/SettingsSetResponse.ts new file mode 100644 index 0000000000..c2691f1b13 --- /dev/null +++ b/bindings/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/Shard.ts b/bindings/Shard.ts new file mode 100644 index 0000000000..ce3f3f311c --- /dev/null +++ b/bindings/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/ShardEvidence.ts b/bindings/ShardEvidence.ts new file mode 100644 index 0000000000..5b95a344c5 --- /dev/null +++ b/bindings/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/ShardId.ts b/bindings/ShardId.ts new file mode 100644 index 0000000000..2a907b4621 --- /dev/null +++ b/bindings/ShardId.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 ShardId = string; diff --git a/bindings/SubmitTransactionRequest.ts b/bindings/SubmitTransactionRequest.ts new file mode 100644 index 0000000000..4adb54db85 --- /dev/null +++ b/bindings/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/SubmitTransactionResponse.ts b/bindings/SubmitTransactionResponse.ts new file mode 100644 index 0000000000..744da4e6dc --- /dev/null +++ b/bindings/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/Substate.ts b/bindings/Substate.ts new file mode 100644 index 0000000000..d8fe1b7371 --- /dev/null +++ b/bindings/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/SubstateAddress.ts b/bindings/SubstateAddress.ts new file mode 100644 index 0000000000..3879aa84bd --- /dev/null +++ b/bindings/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/SubstateDestroyed.ts b/bindings/SubstateDestroyed.ts new file mode 100644 index 0000000000..8c37599337 --- /dev/null +++ b/bindings/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/SubstateDiff.ts b/bindings/SubstateDiff.ts new file mode 100644 index 0000000000..74fc6a30de --- /dev/null +++ b/bindings/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/SubstateId.ts b/bindings/SubstateId.ts new file mode 100644 index 0000000000..3f40e1ddfe --- /dev/null +++ b/bindings/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/SubstateRecord.ts b/bindings/SubstateRecord.ts new file mode 100644 index 0000000000..2ca39e3375 --- /dev/null +++ b/bindings/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/SubstateRequirement.ts b/bindings/SubstateRequirement.ts new file mode 100644 index 0000000000..4b5851ab3c --- /dev/null +++ b/bindings/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/SubstateStatus.ts b/bindings/SubstateStatus.ts new file mode 100644 index 0000000000..41a04febde --- /dev/null +++ b/bindings/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/SubstateValue.ts b/bindings/SubstateValue.ts new file mode 100644 index 0000000000..a2ba32440d --- /dev/null +++ b/bindings/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/TemplateAbi.ts b/bindings/TemplateAbi.ts new file mode 100644 index 0000000000..dc04350ce5 --- /dev/null +++ b/bindings/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/TemplateMetadata.ts b/bindings/TemplateMetadata.ts new file mode 100644 index 0000000000..2d4f33bc52 --- /dev/null +++ b/bindings/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/TemplateRegistrationRequest.ts b/bindings/TemplateRegistrationRequest.ts new file mode 100644 index 0000000000..38d9df6d7e --- /dev/null +++ b/bindings/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/TemplateRegistrationResponse.ts b/bindings/TemplateRegistrationResponse.ts new file mode 100644 index 0000000000..100aae44d6 --- /dev/null +++ b/bindings/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/Transaction.ts b/bindings/Transaction.ts new file mode 100644 index 0000000000..3f248f7cff --- /dev/null +++ b/bindings/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/TransactionAtom.ts b/bindings/TransactionAtom.ts new file mode 100644 index 0000000000..e72e23050f --- /dev/null +++ b/bindings/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/TransactionClaimBurnResponse.ts b/bindings/TransactionClaimBurnResponse.ts new file mode 100644 index 0000000000..bd86637f60 --- /dev/null +++ b/bindings/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/TransactionGetAllRequest.ts b/bindings/TransactionGetAllRequest.ts new file mode 100644 index 0000000000..203a2c258b --- /dev/null +++ b/bindings/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/TransactionGetAllResponse.ts b/bindings/TransactionGetAllResponse.ts new file mode 100644 index 0000000000..797057e23d --- /dev/null +++ b/bindings/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/TransactionGetRequest.ts b/bindings/TransactionGetRequest.ts new file mode 100644 index 0000000000..c726ca6e17 --- /dev/null +++ b/bindings/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/TransactionGetResponse.ts b/bindings/TransactionGetResponse.ts new file mode 100644 index 0000000000..2d475b3482 --- /dev/null +++ b/bindings/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/TransactionGetResultRequest.ts b/bindings/TransactionGetResultRequest.ts new file mode 100644 index 0000000000..93a8a8b0be --- /dev/null +++ b/bindings/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/TransactionGetResultResponse.ts b/bindings/TransactionGetResultResponse.ts new file mode 100644 index 0000000000..91348f1508 --- /dev/null +++ b/bindings/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/TransactionId.ts b/bindings/TransactionId.ts new file mode 100644 index 0000000000..a140afa9bf --- /dev/null +++ b/bindings/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/TransactionReceipt.ts b/bindings/TransactionReceipt.ts new file mode 100644 index 0000000000..e68f67601a --- /dev/null +++ b/bindings/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/TransactionReceiptAddress.ts b/bindings/TransactionReceiptAddress.ts new file mode 100644 index 0000000000..8a7ba6c021 --- /dev/null +++ b/bindings/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/TransactionResult.ts b/bindings/TransactionResult.ts new file mode 100644 index 0000000000..4b1b22f80d --- /dev/null +++ b/bindings/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/TransactionSignature.ts b/bindings/TransactionSignature.ts new file mode 100644 index 0000000000..ed0edef18b --- /dev/null +++ b/bindings/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/TransactionStatus.ts b/bindings/TransactionStatus.ts new file mode 100644 index 0000000000..ab9356ff73 --- /dev/null +++ b/bindings/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/TransactionSubmitRequest.ts b/bindings/TransactionSubmitRequest.ts new file mode 100644 index 0000000000..19c3543629 --- /dev/null +++ b/bindings/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/TransactionSubmitResponse.ts b/bindings/TransactionSubmitResponse.ts new file mode 100644 index 0000000000..50d515f626 --- /dev/null +++ b/bindings/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/TransactionWaitResultRequest.ts b/bindings/TransactionWaitResultRequest.ts new file mode 100644 index 0000000000..3df763358d --- /dev/null +++ b/bindings/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/TransactionWaitResultResponse.ts b/bindings/TransactionWaitResultResponse.ts new file mode 100644 index 0000000000..39756f410e --- /dev/null +++ b/bindings/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/TransferRequest.ts b/bindings/TransferRequest.ts new file mode 100644 index 0000000000..2be0c02663 --- /dev/null +++ b/bindings/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/TransferResponse.ts b/bindings/TransferResponse.ts new file mode 100644 index 0000000000..5103d05d99 --- /dev/null +++ b/bindings/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/TsNaiveDateTime.ts b/bindings/TsNaiveDateTime.ts new file mode 100644 index 0000000000..c984650df8 --- /dev/null +++ b/bindings/TsNaiveDateTime.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 TsNaiveDateTime = string; diff --git a/bindings/Type.ts b/bindings/Type.ts new file mode 100644 index 0000000000..ac5048892c --- /dev/null +++ b/bindings/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/UnclaimedConfidentialOutput.ts b/bindings/UnclaimedConfidentialOutput.ts new file mode 100644 index 0000000000..013b42752b --- /dev/null +++ b/bindings/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/UnclaimedConfidentialOutputAddress.ts b/bindings/UnclaimedConfidentialOutputAddress.ts new file mode 100644 index 0000000000..ce28d5b0de --- /dev/null +++ b/bindings/UnclaimedConfidentialOutputAddress.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 { Hash } from "./Hash"; + +export type UnclaimedConfidentialOutputAddress = Hash; diff --git a/bindings/ValidatorFee.ts b/bindings/ValidatorFee.ts new file mode 100644 index 0000000000..e731594228 --- /dev/null +++ b/bindings/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/ValidatorNode.ts b/bindings/ValidatorNode.ts new file mode 100644 index 0000000000..21e653abe8 --- /dev/null +++ b/bindings/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/ValidatorSignature.ts b/bindings/ValidatorSignature.ts new file mode 100644 index 0000000000..2e4e824718 --- /dev/null +++ b/bindings/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/Vault.ts b/bindings/Vault.ts new file mode 100644 index 0000000000..61fc56e731 --- /dev/null +++ b/bindings/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/VaultId.ts b/bindings/VaultId.ts new file mode 100644 index 0000000000..781cfdc982 --- /dev/null +++ b/bindings/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/WebRtcStart.ts b/bindings/WebRtcStart.ts new file mode 100644 index 0000000000..f85d79058d --- /dev/null +++ b/bindings/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/WebRtcStartRequest.ts b/bindings/WebRtcStartRequest.ts new file mode 100644 index 0000000000..33e7fa94a5 --- /dev/null +++ b/bindings/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/WebRtcStartResponse.ts b/bindings/WebRtcStartResponse.ts new file mode 100644 index 0000000000..2bd57d7adb --- /dev/null +++ b/bindings/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..d97282d430 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 } + +[features] +ts = [] diff --git a/clients/tari_indexer_client/src/types.rs b/clients/tari_indexer_client/src/types.rs index 4df232c5fd..b2378fe8bc 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/"))] 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/"))] 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/"))] 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/"))] 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/"))] pub struct SubmitTransactionRequest { pub transaction: Transaction, pub required_substates: Vec, @@ -61,41 +69,50 @@ pub struct SubmitTransactionRequest { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct GetTransactionResultRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetTransactionResultResponse { pub result: IndexerTransactionFinalizedResult, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub enum IndexerTransactionFinalizedResult { Pending, Finalized { final_decision: Decision, execution_result: Option, 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/"))] 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/"))] pub struct AddAddressRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -103,6 +120,7 @@ pub struct AddAddressRequest { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct DeleteAddressRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -110,6 +128,7 @@ pub struct DeleteAddressRequest { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetNonFungibleCountRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -117,6 +136,7 @@ pub struct GetNonFungibleCountRequest { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetNonFungiblesRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -125,12 +145,14 @@ pub struct GetNonFungiblesRequest { } #[derive(Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetNonFungiblesResponse { pub non_fungibles: Vec, } #[serde_as] #[derive(Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct NonFungibleSubstate { pub index: u64, #[serde_as(as = "DisplayFromStr")] @@ -140,6 +162,7 @@ pub struct NonFungibleSubstate { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetRelatedTransactionsRequest { #[serde_as(as = "DisplayFromStr")] pub address: SubstateId, @@ -147,43 +170,55 @@ pub struct GetRelatedTransactionsRequest { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetRelatedTransactionsResponse { pub transaction_results: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct AddPeerResponse {} #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] 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/"))] pub enum ConnectionDirection { Inbound, Outbound, } #[derive(Serialize, Debug)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetConnectionsResponse { pub connections: Vec, } diff --git a/clients/validator_node_client/Cargo.toml b/clients/validator_node_client/Cargo.toml index 8711155de1..d1d42b37c6 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 } + +[features] +ts = [] diff --git a/clients/validator_node_client/src/types.rs b/clients/validator_node_client/src/types.rs index 9ea2f3085f..03603d76ed 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/"))] 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/"))] 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/"))] 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/"))] pub struct GetTemplateRequest { pub template_address: TemplateAddress, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] 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/"))] 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/"))] 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/"))] pub struct GetTemplatesRequest { pub limit: u64, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetTemplatesResponse { pub templates: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] 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/"))] 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/"))] pub struct DryRunTransactionFinalizeResult { // TODO: we should not return the whole state but only the addresses and perhaps a hash of the state pub decision: QuorumDecision, @@ -145,46 +163,56 @@ pub struct DryRunTransactionFinalizeResult { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetTransactionRequest { pub transaction_id: TransactionId, } #[derive(Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetTransactionResponse { pub transaction: ExecutedTransaction, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetSubstatesByTransactionRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetSubstatesByTransactionResponse { pub substates: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetTransactionResultRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetTransactionResultResponse { pub result: Option, pub is_finalized: bool, + #[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/"))] pub struct GetRecentTransactionsRequest {} #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetRecentTransactionsResponse { pub transactions: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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,26 +221,31 @@ pub struct ListBlocksRequest { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ListBlocksResponse { pub blocks: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetBlockResponse { pub block: Block, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetBlocksResponse { pub blocks: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetBlocksCountResponse { pub count: i64, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct LogEntry { pub timestamp: u64, pub message: String, @@ -220,6 +253,7 @@ pub struct LogEntry { } #[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub enum LogLevel { Error, Warn, @@ -228,17 +262,20 @@ pub enum LogLevel { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] 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/"))] pub struct CommitteeShardInfo { pub shard: Shard, pub substate_address_range: RangeInclusive, @@ -246,28 +283,34 @@ pub struct CommitteeShardInfo { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct GetStateRequest { pub address: SubstateAddress, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetStateResponse { pub data: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct GetSubstateResponse { pub value: Option, pub created_by_tx: Option, @@ -275,6 +318,7 @@ pub struct GetSubstateResponse { } #[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub enum SubstateStatus { Up, Down, @@ -282,16 +326,21 @@ pub enum SubstateStatus { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct AddPeerResponse {} #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetEpochManagerStatsResponse { pub current_epoch: Epoch, pub current_block_height: u64, @@ -300,28 +349,37 @@ pub struct GetEpochManagerStatsResponse { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] 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/"))] 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/"))] pub struct GetValidatorFeesResponse { pub fees: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ValidatorFee { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub validator_public_key: PublicKey, pub epoch: Epoch, pub block_id: BlockId, @@ -347,11 +405,13 @@ impl From for ValidatorFee { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetBlockRequest { pub block_id: BlockId, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetBlocksRequest { pub limit: u64, pub offset: u64, @@ -359,22 +419,28 @@ pub struct GetBlocksRequest { } #[derive(Serialize, Debug)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub enum ConnectionDirection { Inbound, Outbound, } #[derive(Serialize, Debug)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetConnectionsResponse { pub connections: Vec, } diff --git a/clients/wallet_daemon_client/Cargo.toml b/clients/wallet_daemon_client/Cargo.toml index b6865b0053..30587a43cb 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 } + +[features] +ts = [] diff --git a/clients/wallet_daemon_client/src/lib.rs b/clients/wallet_daemon_client/src/lib.rs index a582dfb265..67d2353dd2 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/"))] 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..c42bad50ff 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}, @@ -76,6 +78,7 @@ pub struct CallInstructionRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct TransactionSubmitRequest { pub signing_key_index: Option, pub fee_instructions: Vec, @@ -89,19 +92,23 @@ pub struct TransactionSubmitRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct TransactionGetRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct TransactionGetResponse { pub transaction: Transaction, pub result: Option, @@ -110,39 +117,47 @@ pub struct TransactionGetResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] 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/"))] pub struct TransactionGetResultRequest { pub transaction_id: TransactionId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] 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/"))] 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 +165,7 @@ pub struct TransactionWaitResultResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct TransactionClaimBurnResponse { pub transaction_id: TransactionId, pub inputs: Vec, @@ -157,36 +173,46 @@ pub struct TransactionClaimBurnResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct KeysListRequest {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct KeysSetActiveRequest { pub index: u64, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct KeysCreateRequest { pub specific_index: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct AccountsCreateRequest { pub account_name: Option, pub custom_access_rules: Option, @@ -196,13 +222,16 @@ pub struct AccountsCreateRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct AccountsInvokeRequest { #[serde(deserialize_with = "opt_string_or_struct")] pub account: Option, @@ -212,29 +241,35 @@ pub struct AccountsInvokeRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AccountsInvokeResponse { pub result: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AccountsListRequest { pub offset: u64, pub limit: u64, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] 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/"))] pub struct AccountsGetBalancesRequest { #[serde(deserialize_with = "opt_string_or_struct")] pub account: Option, @@ -243,12 +278,14 @@ pub struct AccountsGetBalancesRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct BalanceEntry { pub vault_address: SubstateId, #[serde(with = "serde_with::string")] @@ -283,43 +320,52 @@ impl BalanceEntry { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] 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/"))] 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/"))] 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/"))] pub struct AccountSetDefaultResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct TransferResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -328,6 +374,7 @@ pub struct TransferResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ProofsGenerateRequest { pub amount: Amount, pub reveal_amount: Amount, @@ -336,50 +383,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/"))] 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/"))] pub struct ProofsFinalizeRequest { pub proof_id: ConfidentialProofId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ProofsFinalizeResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ProofsCancelRequest { pub proof_id: ConfidentialProofId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ConfidentialCreateOutputProofRequest { pub amount: Amount, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ConfidentialCreateOutputProofResponse { pub proof: ConfidentialOutputProof, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct ConfidentialTransferResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -387,15 +444,18 @@ pub struct ConfidentialTransferResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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, pub key_id: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ClaimBurnResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -403,9 +463,11 @@ pub struct ClaimBurnResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ProofsCancelResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct RevealFundsRequest { /// Account with funds to reveal #[serde(deserialize_with = "opt_string_or_struct")] @@ -419,6 +481,7 @@ pub struct RevealFundsRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct RevealFundsResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -426,6 +489,7 @@ pub struct RevealFundsResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AccountsCreateFreeTestCoinsRequest { pub account: Option, pub amount: Amount, @@ -434,20 +498,24 @@ pub struct AccountsCreateFreeTestCoinsRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct WebRtcStart { pub jwt: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct WebRtcStartRequest { pub signaling_server_token: String, pub permissions: String, @@ -455,55 +523,68 @@ pub struct WebRtcStartRequest { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct WebRtcStartResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct AuthLoginResponse { pub auth_token: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct AuthLoginAcceptResponse { pub permissions_token: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AuthLoginDenyRequest { pub auth_token: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AuthLoginDenyResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AuthRevokeTokenRequest { pub permission_token_id: i32, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AuthRevokeTokenResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct MintAccountNftResponse { pub nft_id: NonFungibleId, pub resource_address: ResourceAddress, @@ -512,60 +593,74 @@ pub struct MintAccountNftResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct GetAccountNftRequest { pub nft_id: NonFungibleId, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AccountNftInfo { + #[cfg_attr(feature = "ts", ts(type = "string"))] pub metadata: serde_json::Value, pub is_burned: bool, } +// #[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub type GetAccountNftResponse = AccountNftInfo; #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ListAccountNftRequest { pub limit: u64, pub offset: u64, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct ListAccountNftResponse { pub nfts: Vec, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AuthGetAllJwtRequest {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct AuthGetAllJwtResponse { pub jwt: Vec, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct GetValidatorFeesResponse { pub fee_summary: HashMap, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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/"))] pub struct ClaimValidatorFeesResponse { pub transaction_id: TransactionId, pub fee: Amount, @@ -573,14 +668,17 @@ pub struct ClaimValidatorFeesResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct SettingsSetRequest { pub indexer_url: String, } #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct SettingsSetResponse {} #[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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..de867e29fc 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 } [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 = [] diff --git a/dan_layer/common_types/src/committee.rs b/dan_layer/common_types/src/committee.rs index a22d5b7ed8..41c7382a4b 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/"))] 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..325e2f295c 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/"))] +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..7d38c0b4ff 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/"))] 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..8bbac876eb 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/"))] 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..2b4fa2e053 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/"))] +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..f5ff0ce7c0 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 } [features] default = ["debugging"] # Includes the ability to create free test coins debugging = [] +ts = [] diff --git a/dan_layer/engine_types/src/commit_result.rs b/dan_layer/engine_types/src/commit_result.rs index 45c00d7f65..96324bda21 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/"))] 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/"))] 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/"))] 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/"))] 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..a7376c74a0 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/"))] 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/"))] 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..1a5cd84f9f 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/"))] 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..079a5d7453 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/"))] 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..cab191482e 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/"))] 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..000920473a 100644 --- a/dan_layer/engine_types/src/events.rs +++ b/dan_layer/engine_types/src/events.rs @@ -28,10 +28,13 @@ 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/"))] pub struct Event { #[serde(with = "serde_with::hex::option")] component_address: Option, diff --git a/dan_layer/engine_types/src/fee_claim.rs b/dan_layer/engine_types/src/fee_claim.rs index 5ba05d9b5d..1c7aa01d9e 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/"))] +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/"))] 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..c2b1ba4fb8 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/"))] 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/"))] 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/"))] 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..885cfca9df 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/"))] 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/"))] 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..e264750315 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/"))] 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..48a902ab0f 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/"))] 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..4321ca84b0 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/"))] 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..73cf5d2888 100644 --- a/dan_layer/engine_types/src/logs.rs +++ b/dan_layer/engine_types/src/logs.rs @@ -27,8 +27,11 @@ 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/"))] pub struct LogEntry { pub timestamp: u64, pub message: String, diff --git a/dan_layer/engine_types/src/non_fungible.rs b/dan_layer/engine_types/src/non_fungible.rs index cb0c75b7b2..b5508a5bfa 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/"))] 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/"))] 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..2225e743fa 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/"))] 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..c9404a34e1 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/"))] 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..a97396db87 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/"))] 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 2706eab110..883b59d4fc 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/"))] 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/"))] pub enum SubstateId { Component(#[serde(with = "serde_with::string")] ComponentAddress), Resource(#[serde(with = "serde_with::string")] ResourceAddress), @@ -380,6 +384,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/"))] pub enum SubstateValue { Component(ComponentHeader), Resource(Resource), @@ -601,6 +606,7 @@ impl Display for SubstateValue { } #[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] 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..6b45c383fa 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/"))] +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/"))] 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..8bbc2aeecd 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/"))] 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..c6aa32f921 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 } + +[features] +ts = [] diff --git a/dan_layer/storage/src/consensus_models/block.rs b/dan_layer/storage/src/consensus_models/block.rs index 3830d64e83..65dccebef9 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/"))] 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/"))] +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..e7e1db2c92 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/"))] 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/"))] 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/"))] 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/"))] 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 ab713f4425..c4bc6683ae 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/"))] pub struct ExecutedTransaction { transaction: Transaction, result: ExecuteResult, resulting_outputs: Vec, + #[cfg_attr(feature = "ts", ts(type = "string"))] execution_time: Duration, final_decision: Option, abort_details: 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..2d951eb4f6 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/"))] 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/"))] 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..0df2674f42 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/"))] 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..a6cb11cb2c 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/"))] 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/"))] +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..e6624a0525 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/"))] 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/"))] 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..67b66b2f72 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/"))] 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..6bfd0a29e8 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/"))] 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..e4d8af1a04 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/"))] 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..295a791266 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/"))] pub enum Ordering { Ascending, Descending, diff --git a/dan_layer/tari_bor/Cargo.toml b/dan_layer/tari_bor/Cargo.toml index c6ffb5fba1..d36d4c5d6b 100644 --- a/dan_layer/tari_bor/Cargo.toml +++ b/dan_layer/tari_bor/Cargo.toml @@ -10,7 +10,11 @@ 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", +] } +ts-rs = { workspace = true } [dev-dependencies] serde_json = { workspace = true } @@ -20,4 +24,4 @@ default = ["std"] std = ["ciborium/std", "serde/std"] alloc = ["serde/alloc", "ciborium-io/alloc"] json_encoding = [] - +ts = [] diff --git a/dan_layer/template_abi/Cargo.toml b/dan_layer/template_abi/Cargo.toml index 51f9cadb90..4853f13ece 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 } [features] default = ["std"] std = ["tari_bor/std"] # TODO: look into how this is done properly alloc = ["hashbrown"] +ts = [] diff --git a/dan_layer/template_abi/src/types.rs b/dan_layer/template_abi/src/types.rs index 6c9558ac7b..e6cc6c49e5 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/"))] pub enum Type { #[default] Unit, diff --git a/dan_layer/template_lib/Cargo.toml b/dan_layer/template_lib/Cargo.toml index 32b511bcdd..a2fad15847 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 } + [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 = [] diff --git a/dan_layer/template_lib/src/args/arg.rs b/dan_layer/template_lib/src/args/arg.rs index 41dc1049dc..78f9eb454c 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/"))] 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..8f5bae7a7d 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/"))] 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..a986f73802 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/"))] 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/"))] 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/"))] 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/"))] 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/"))] 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/"))] 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..6ce4ae66ab 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/"))] 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..5dd2cd66e5 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/"))] 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..65382bb029 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/"))] 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..0635fdd801 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/"))] +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..9aa2181fe5 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/"))] 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..86f7eeaab3 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/"))] +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..97b9acf5d8 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/"))] +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..ee239cca63 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/"))] +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..602b714ae0 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/"))] 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/"))] 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/"))] 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/"))] 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..f50bc4470d 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,6 +13,7 @@ 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)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct UnclaimedConfidentialOutputAddress(Hash); impl UnclaimedConfidentialOutputAddress { diff --git a/dan_layer/template_lib/src/models/metadata.rs b/dan_layer/template_lib/src/models/metadata.rs index 075d0e7a53..d41ae4d48a 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/"))] +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..2d48008e68 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/"))] 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/"))] +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/"))] 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..26fe10f2c9 100644 --- a/dan_layer/template_lib/src/models/non_fungible_index.rs +++ b/dan_layer/template_lib/src/models/non_fungible_index.rs @@ -22,11 +22,14 @@ 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/"))] pub struct NonFungibleIndexAddress { resource_address: ResourceAddress, index: u64, diff --git a/dan_layer/template_lib/src/models/proof.rs b/dan_layer/template_lib/src/models/proof.rs index 8b123719d9..a4bb94cf8f 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/"))] +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..c0eca53961 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/"))] +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..33aa68e68a 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/"))] +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..6599f45d7e 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/"))] 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..63720b70a1 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 } + +[features] +ts = [] diff --git a/dan_layer/transaction/src/signature.rs b/dan_layer/transaction/src/signature.rs index 09a1494773..ed2cd8b0a6 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/"))] 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 65df6d340e..14990da1ae 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/"))] 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/"))] 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..e530541596 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/"))] 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..0b68f72119 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 } [dev-dependencies] tari_dan_wallet_storage_sqlite = { workspace = true } - tempfile = { workspace = true } + +[features] +ts = [] diff --git a/dan_layer/wallet/sdk/src/apis/jwt.rs b/dan_layer/wallet/sdk/src/apis/jwt.rs index 1bdd6d0e6f..aaa09c6105 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/"))] 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/"))] pub struct JrpcPermissions(pub Vec); impl FromStr for JrpcPermissions { @@ -138,6 +142,7 @@ impl TryFrom<&[String]> for JrpcPermissions { } #[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, export_to = "../../bindings/"))] pub struct Claims { pub id: u64, pub name: String, diff --git a/dan_layer/wallet/sdk/src/models/account.rs b/dan_layer/wallet/sdk/src/models/account.rs index 103d732d3a..c8b6da0cd6 100644 --- a/dan_layer/wallet/sdk/src/models/account.rs +++ b/dan_layer/wallet/sdk/src/models/account.rs @@ -4,8 +4,11 @@ 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/"))] pub struct Account { pub name: Option, pub address: SubstateId, diff --git a/dan_layer/wallet/sdk/src/models/wallet_transaction.rs b/dan_layer/wallet/sdk/src/models/wallet_transaction.rs index 20f489b539..da8a0dbcf4 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 { @@ -25,6 +27,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/"))] 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" }