From 82aa403e497adefdd5d5a19e7cfb3db1791c9c2d Mon Sep 17 00:00:00 2001 From: Maciej Kozuszek Date: Wed, 7 Aug 2024 16:01:27 +0200 Subject: [PATCH] Rename conflicting types --- .../tari_indexer_web_ui/package-lock.json | 2 +- .../src/routes/VN/Components/Connections.tsx | 4 +- .../src/routes/VN/Components/Info.tsx | 4 +- .../src/routes/VN/Components/NftGallery.tsx | 2 +- .../src/routes/VN/ValidatorNode.tsx | 4 +- .../src/utils/json_rpc.tsx | 40 +++--- .../tari_indexer_web_ui/tsconfig.json | 4 +- .../package-lock.json | 2 +- .../tari_validator_node_web_ui/src/App.tsx | 8 +- .../src/routes/Blocks/BlockDetails.tsx | 4 +- .../src/routes/Committees/Committee.tsx | 2 +- .../src/routes/Committees/Committees.tsx | 4 +- .../routes/Committees/CommitteesLayout.tsx | 10 +- .../routes/Committees/CommitteesPieChart.tsx | 6 +- .../routes/Committees/CommitteesRadial.tsx | 8 +- .../routes/Committees/CommitteesWaterfall.tsx | 4 +- .../src/routes/VN/Components/AllVNs.tsx | 2 +- .../src/routes/VN/Components/Blocks.tsx | 4 +- .../src/routes/VN/Components/Connections.tsx | 4 +- .../src/routes/VN/Components/Info.tsx | 6 +- .../VN/Components/TemplateFunctions.tsx | 5 +- .../src/routes/VN/Components/Templates.tsx | 2 +- .../src/routes/VN/ValidatorNode.tsx | 2 +- .../src/utils/json_rpc.tsx | 44 +++---- .../tari_validator_node_web_ui/tsconfig.json | 2 +- bindings/build.sh | 37 +++--- bindings/package.json | 24 +--- bindings/src/index.ts | 124 ++++++++++++++++++ bindings/src/tari-indexer-client.ts | 32 ++--- .../GetConnectionsResponse.ts | 6 - .../IndexerAddPeerRequest.ts} | 2 +- .../IndexerAddPeerResponse.ts} | 2 +- .../{Connection.ts => IndexerConnection.ts} | 6 +- .../IndexerConnectionDirection.ts | 3 + ...sRequest.ts => IndexerGetAllVnsRequest.ts} | 2 +- ...esponse.ts => IndexerGetAllVnsResponse.ts} | 2 +- .../IndexerGetCommsStatsResponse.ts} | 2 +- .../IndexerGetConnectionsResponse.ts | 6 + ...=> IndexerGetEpochManagerStatsResponse.ts} | 2 +- ...ponse.ts => IndexerGetIdentityResponse.ts} | 2 +- ...equest.ts => IndexerGetSubstateRequest.ts} | 2 +- ...ponse.ts => IndexerGetSubstateResponse.ts} | 2 +- ... => IndexerGetTransactionResultRequest.ts} | 2 +- ...=> IndexerGetTransactionResultResponse.ts} | 2 +- ....ts => IndexerSubmitTransactionRequest.ts} | 2 +- ...ts => IndexerSubmitTransactionResponse.ts} | 2 +- .../GetConnectionsResponse.ts | 6 - .../GetNetworkCommitteeResponse.ts | 4 +- .../types/validator-node-client/LogLevel.ts | 3 - .../validator-node-client/TemplateAbi.ts | 4 +- .../VNAddPeerRequest.ts} | 2 +- .../VNAddPeerResponse.ts} | 2 +- .../{ArgDef.ts => VNArgDef.ts} | 2 +- ...eeShardInfo.ts => VNCommitteeShardInfo.ts} | 2 +- .../{Connection.ts => VNConnection.ts} | 6 +- ...erResponse.ts => VNConnectionDirection.ts} | 2 +- .../{FunctionDef.ts => VNFunctionDef.ts} | 6 +- ...AllVnsRequest.ts => VNGetAllVnsRequest.ts} | 2 +- ...lVnsResponse.ts => VNGetAllVnsResponse.ts} | 2 +- .../VNGetCommsStatsResponse.ts} | 2 +- .../VNGetConnectionsResponse.ts | 6 + ...tyResponse.ts => VNGetIdentityResponse.ts} | 2 +- ...tateRequest.ts => VNGetSubstateRequest.ts} | 2 +- ...teResponse.ts => VNGetSubstateResponse.ts} | 2 +- ...st.ts => VNGetTransactionResultRequest.ts} | 2 +- ...e.ts => VNGetTransactionResultResponse.ts} | 2 +- .../{LogEntry.ts => VNLogEntry.ts} | 6 +- .../VNLogLevel.ts} | 2 +- ...quest.ts => VNSubmitTransactionRequest.ts} | 2 +- ...onse.ts => VNSubmitTransactionResponse.ts} | 2 +- bindings/src/validator-node-client.ts | 40 +++--- clients/tari_indexer_client/src/types.rs | 110 ++++++++++++---- clients/validator_node_client/src/types.rs | 122 +++++++++++++---- 73 files changed, 515 insertions(+), 273 deletions(-) delete mode 100644 bindings/src/types/tari-indexer-client/GetConnectionsResponse.ts rename bindings/src/types/{validator-node-client/AddPeerRequest.ts => tari-indexer-client/IndexerAddPeerRequest.ts} (82%) rename bindings/src/types/{validator-node-client/ConnectionDirection.ts => tari-indexer-client/IndexerAddPeerResponse.ts} (64%) rename bindings/src/types/tari-indexer-client/{Connection.ts => IndexerConnection.ts} (65%) create mode 100644 bindings/src/types/tari-indexer-client/IndexerConnectionDirection.ts rename bindings/src/types/tari-indexer-client/{GetAllVnsRequest.ts => IndexerGetAllVnsRequest.ts} (79%) rename bindings/src/types/tari-indexer-client/{GetAllVnsResponse.ts => IndexerGetAllVnsResponse.ts} (84%) rename bindings/src/types/{validator-node-client/GetCommsStatsResponse.ts => tari-indexer-client/IndexerGetCommsStatsResponse.ts} (74%) create mode 100644 bindings/src/types/tari-indexer-client/IndexerGetConnectionsResponse.ts rename bindings/src/types/tari-indexer-client/{GetEpochManagerStatsResponse.ts => IndexerGetEpochManagerStatsResponse.ts} (81%) rename bindings/src/types/tari-indexer-client/{GetIdentityResponse.ts => IndexerGetIdentityResponse.ts} (80%) rename bindings/src/types/tari-indexer-client/{GetSubstateRequest.ts => IndexerGetSubstateRequest.ts} (84%) rename bindings/src/types/tari-indexer-client/{GetSubstateResponse.ts => IndexerGetSubstateResponse.ts} (86%) rename bindings/src/types/tari-indexer-client/{GetTransactionResultRequest.ts => IndexerGetTransactionResultRequest.ts} (71%) rename bindings/src/types/tari-indexer-client/{GetTransactionResultResponse.ts => IndexerGetTransactionResultResponse.ts} (82%) rename bindings/src/types/tari-indexer-client/{SubmitTransactionRequest.ts => IndexerSubmitTransactionRequest.ts} (86%) rename bindings/src/types/tari-indexer-client/{SubmitTransactionResponse.ts => IndexerSubmitTransactionResponse.ts} (84%) delete mode 100644 bindings/src/types/validator-node-client/GetConnectionsResponse.ts delete mode 100644 bindings/src/types/validator-node-client/LogLevel.ts rename bindings/src/types/{tari-indexer-client/AddPeerRequest.ts => validator-node-client/VNAddPeerRequest.ts} (83%) rename bindings/src/types/{tari-indexer-client/AddPeerResponse.ts => validator-node-client/VNAddPeerResponse.ts} (66%) rename bindings/src/types/validator-node-client/{ArgDef.ts => VNArgDef.ts} (84%) rename bindings/src/types/validator-node-client/{CommitteeShardInfo.ts => VNCommitteeShardInfo.ts} (89%) rename bindings/src/types/validator-node-client/{Connection.ts => VNConnection.ts} (68%) rename bindings/src/types/validator-node-client/{AddPeerResponse.ts => VNConnectionDirection.ts} (64%) rename bindings/src/types/validator-node-client/{FunctionDef.ts => VNFunctionDef.ts} (60%) rename bindings/src/types/validator-node-client/{GetAllVnsRequest.ts => VNGetAllVnsRequest.ts} (81%) rename bindings/src/types/validator-node-client/{GetAllVnsResponse.ts => VNGetAllVnsResponse.ts} (86%) rename bindings/src/types/{tari-indexer-client/GetCommsStatsResponse.ts => validator-node-client/VNGetCommsStatsResponse.ts} (76%) create mode 100644 bindings/src/types/validator-node-client/VNGetConnectionsResponse.ts rename bindings/src/types/validator-node-client/{GetIdentityResponse.ts => VNGetIdentityResponse.ts} (87%) rename bindings/src/types/validator-node-client/{GetSubstateRequest.ts => VNGetSubstateRequest.ts} (83%) rename bindings/src/types/validator-node-client/{GetSubstateResponse.ts => VNGetSubstateResponse.ts} (88%) rename bindings/src/types/validator-node-client/{GetTransactionResultRequest.ts => VNGetTransactionResultRequest.ts} (73%) rename bindings/src/types/validator-node-client/{GetTransactionResultResponse.ts => VNGetTransactionResultResponse.ts} (88%) rename bindings/src/types/validator-node-client/{LogEntry.ts => VNLogEntry.ts} (60%) rename bindings/src/types/{tari-indexer-client/ConnectionDirection.ts => validator-node-client/VNLogLevel.ts} (63%) rename bindings/src/types/validator-node-client/{SubmitTransactionRequest.ts => VNSubmitTransactionRequest.ts} (82%) rename bindings/src/types/validator-node-client/{SubmitTransactionResponse.ts => VNSubmitTransactionResponse.ts} (85%) diff --git a/applications/tari_indexer_web_ui/package-lock.json b/applications/tari_indexer_web_ui/package-lock.json index 787971a9a..d907c3684 100644 --- a/applications/tari_indexer_web_ui/package-lock.json +++ b/applications/tari_indexer_web_ui/package-lock.json @@ -37,7 +37,7 @@ }, "../../bindings": { "name": "@tari-project/typescript-bindings", - "version": "1.0.3", + "version": "1.0.5", "license": "ISC", "devDependencies": { "shx": "^0.3.4", diff --git a/applications/tari_indexer_web_ui/src/routes/VN/Components/Connections.tsx b/applications/tari_indexer_web_ui/src/routes/VN/Components/Connections.tsx index 4ce20856b..1d68a7a96 100644 --- a/applications/tari_indexer_web_ui/src/routes/VN/Components/Connections.tsx +++ b/applications/tari_indexer_web_ui/src/routes/VN/Components/Connections.tsx @@ -36,7 +36,7 @@ import { TextField } from "@mui/material"; import { Form } from "react-router-dom"; import Fade from "@mui/material/Fade"; import CopyToClipboard from "../../../Components/CopyToClipboard"; -import type { Connection } from "@tari-project/typescript-bindings/tari-indexer-client"; +import type { IndexerConnection } from "@tari-project/typescript-bindings"; import { displayDuration } from "../../../utils/helpers"; @@ -60,7 +60,7 @@ const useInterval = (fn: () => Promise, ms: number) => { }; function Connections() { - const [connections, setConnections] = useState>([]); + const [connections, setConnections] = useState>([]); const [showPeerDialog, setShowAddPeerDialog] = useState(false); const [formState, setFormState] = useState({ publicKey: "", address: "" }); diff --git a/applications/tari_indexer_web_ui/src/routes/VN/Components/Info.tsx b/applications/tari_indexer_web_ui/src/routes/VN/Components/Info.tsx index 6165d32b6..a69a52a96 100644 --- a/applications/tari_indexer_web_ui/src/routes/VN/Components/Info.tsx +++ b/applications/tari_indexer_web_ui/src/routes/VN/Components/Info.tsx @@ -27,9 +27,9 @@ import TableCell from "@mui/material/TableCell"; import TableContainer from "@mui/material/TableContainer"; import TableRow from "@mui/material/TableRow"; import { DataTableCell } from "../../../Components/StyledComponents"; -import type { GetIdentityResponse } from "@tari-project/typescript-bindings/tari-indexer-client"; +import type { IndexerGetIdentityResponse } from "@tari-project/typescript-bindings"; -function Info({ identity }: { identity: GetIdentityResponse }) { +function Info({ identity }: { identity: IndexerGetIdentityResponse }) { return (
diff --git a/applications/tari_indexer_web_ui/src/routes/VN/Components/NftGallery.tsx b/applications/tari_indexer_web_ui/src/routes/VN/Components/NftGallery.tsx index 34503c6c3..d0136107e 100644 --- a/applications/tari_indexer_web_ui/src/routes/VN/Components/NftGallery.tsx +++ b/applications/tari_indexer_web_ui/src/routes/VN/Components/NftGallery.tsx @@ -24,7 +24,7 @@ import { useEffect, useState } from "react"; import { getNonFungibles } from "../../../utils/json_rpc"; import { useParams } from "react-router-dom"; import { ImageList, ImageListItem, ImageListItemBar } from "@mui/material"; -import type { NonFungibleSubstate } from "@tari-project/typescript-bindings/tari-indexer-client"; +import type { NonFungibleSubstate } from "@tari-project/typescript-bindings"; interface IImageData { img: string; diff --git a/applications/tari_indexer_web_ui/src/routes/VN/ValidatorNode.tsx b/applications/tari_indexer_web_ui/src/routes/VN/ValidatorNode.tsx index a16bbc476..fa9219b1a 100644 --- a/applications/tari_indexer_web_ui/src/routes/VN/ValidatorNode.tsx +++ b/applications/tari_indexer_web_ui/src/routes/VN/ValidatorNode.tsx @@ -29,10 +29,10 @@ import "./ValidatorNode.css"; import { StyledPaper } from "../../Components/StyledComponents"; import Grid from "@mui/material/Grid"; import SecondaryHeading from "../../Components/SecondaryHeading"; -import type { GetIdentityResponse } from "@tari-project/typescript-bindings/tari-indexer-client"; +import type { IndexerGetIdentityResponse } from "@tari-project/typescript-bindings"; function ValidatorNode() { - const [identity, setIdentity] = useState(); + const [identity, setIdentity] = useState(); const [error, setError] = useState(""); // Initial fetch useEffect(() => { diff --git a/applications/tari_indexer_web_ui/src/utils/json_rpc.tsx b/applications/tari_indexer_web_ui/src/utils/json_rpc.tsx index 97a0e8007..61afc33b5 100644 --- a/applications/tari_indexer_web_ui/src/utils/json_rpc.tsx +++ b/applications/tari_indexer_web_ui/src/utils/json_rpc.tsx @@ -21,13 +21,13 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import type { - AddPeerRequest, - AddPeerResponse, - GetAllVnsResponse, - GetCommsStatsResponse, - GetConnectionsResponse, + IndexerAddPeerRequest, + IndexerAddPeerResponse, + IndexerGetAllVnsResponse, + IndexerGetCommsStatsResponse, + IndexerGetConnectionsResponse, GetEpochManagerStatsResponse, - GetIdentityResponse, + IndexerGetIdentityResponse, GetNonFungibleCollectionsResponse, GetNonFungibleCountRequest, GetNonFungibleCountResponse, @@ -35,14 +35,14 @@ import type { GetNonFungiblesResponse, GetRelatedTransactionsRequest, GetRelatedTransactionsResponse, - GetSubstateRequest, - GetSubstateResponse, - GetTransactionResultRequest, - GetTransactionResultResponse, + IndexerGetSubstateRequest, + IndexerGetSubstateResponse, + IndexerGetTransactionResultRequest, + IndexerGetTransactionResultResponse, InspectSubstateRequest, InspectSubstateResponse, - SubmitTransactionResponse, -} from "@tari-project/typescript-bindings/tari-indexer-client"; + IndexerSubmitTransactionResponse, +} from "@tari-project/typescript-bindings"; async function jsonRpc(method: string, params: any = null) { let id = 0; @@ -76,24 +76,24 @@ async function jsonRpc(method: string, params: any = null) { } export const getOpenRpcSchema = (): Promise => jsonRpc("rpc.discover"); -export const getIdentity = (): Promise => jsonRpc("get_identity"); -export const getAllVns = (epoch: number): Promise => jsonRpc("get_all_vns", { epoch }); -export const addPeer = (request: AddPeerRequest): Promise => jsonRpc("add_peer", request); -export const getCommsStats = (): Promise => jsonRpc("get_comms_stats"); -export const getSubstate = (request: GetSubstateRequest): Promise => +export const getIdentity = (): Promise => jsonRpc("get_identity"); +export const getAllVns = (epoch: number): Promise => jsonRpc("get_all_vns", { epoch }); +export const addPeer = (request: IndexerAddPeerRequest): Promise => jsonRpc("add_peer", request); +export const getCommsStats = (): Promise => jsonRpc("get_comms_stats"); +export const getSubstate = (request: IndexerGetSubstateRequest): Promise => jsonRpc("get_substate", request); export const inspectSubstate = (request: InspectSubstateRequest): Promise => jsonRpc("inspect_substate", request); -export const getConnections = (): Promise => jsonRpc("get_connections"); +export const getConnections = (): Promise => jsonRpc("get_connections"); export const getNonFungibleCollections = (): Promise => jsonRpc("get_non_fungible_collections"); export const getNonFungibleCount = (request: GetNonFungibleCountRequest): Promise => jsonRpc("get_non_fungible_count", request); export const getNonFungibles = (request: GetNonFungiblesRequest): Promise => jsonRpc("get_non_fungibles", request); -export const submitTransaction = (request: GetNonFungiblesRequest): Promise => +export const submitTransaction = (request: GetNonFungiblesRequest): Promise => jsonRpc("submit_transaction", request); -export const getTransactionResult = (request: GetTransactionResultRequest): Promise => +export const getTransactionResult = (request: IndexerGetTransactionResultRequest): Promise => jsonRpc("get_transaction_result", request); export const getSubstateTransactions = ( request: GetRelatedTransactionsRequest, diff --git a/applications/tari_indexer_web_ui/tsconfig.json b/applications/tari_indexer_web_ui/tsconfig.json index 18ec70dd1..c7f106ba7 100644 --- a/applications/tari_indexer_web_ui/tsconfig.json +++ b/applications/tari_indexer_web_ui/tsconfig.json @@ -10,11 +10,11 @@ "strict": true, "forceConsistentCasingInFileNames": true, "module": "ESNext", - "moduleResolution": "Bundler", + "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx", + "jsx": "react-jsx" }, "include": ["src", "../../bindings/**/*"], "references": [{ "path": "./tsconfig.node.json" }] diff --git a/applications/tari_validator_node_web_ui/package-lock.json b/applications/tari_validator_node_web_ui/package-lock.json index a257b3548..3aa7c7c09 100644 --- a/applications/tari_validator_node_web_ui/package-lock.json +++ b/applications/tari_validator_node_web_ui/package-lock.json @@ -38,7 +38,7 @@ }, "../../bindings": { "name": "@tari-project/typescript-bindings", - "version": "1.0.0", + "version": "1.0.5", "license": "ISC", "devDependencies": { "shx": "^0.3.4", diff --git a/applications/tari_validator_node_web_ui/src/App.tsx b/applications/tari_validator_node_web_ui/src/App.tsx index 57101f07a..5446e620d 100644 --- a/applications/tari_validator_node_web_ui/src/App.tsx +++ b/applications/tari_validator_node_web_ui/src/App.tsx @@ -39,12 +39,12 @@ import TransactionDetails from "./routes/Transactions/TransactionDetails"; import BlockDetails from "./routes/Blocks/BlockDetails"; import type { GetEpochManagerStatsResponse, - GetIdentityResponse, -} from "@tari-project/typescript-bindings/validator-node-client"; + VNGetIdentityResponse, +} from "@tari-project/typescript-bindings"; interface IContext { epoch?: GetEpochManagerStatsResponse; - identity?: GetIdentityResponse; + identity?: VNGetIdentityResponse; shardKey?: string | null; error?: string; } @@ -126,7 +126,7 @@ export const breadcrumbRoutes = [ export default function App() { const [epoch, setEpoch] = useState(undefined); - const [identity, setIdentity] = useState(undefined); + const [identity, setIdentity] = useState(undefined); const [shardKey, setShardKey] = useState(null); const [error, setError] = useState(""); diff --git a/applications/tari_validator_node_web_ui/src/routes/Blocks/BlockDetails.tsx b/applications/tari_validator_node_web_ui/src/routes/Blocks/BlockDetails.tsx index d99ea643a..1f4e499f6 100644 --- a/applications/tari_validator_node_web_ui/src/routes/Blocks/BlockDetails.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/Blocks/BlockDetails.tsx @@ -35,7 +35,7 @@ import { getBlock, getIdentity } from "../../utils/json_rpc"; import Transactions from "./Transactions"; import { primitiveDateTimeToDate, primitiveDateTimeToSecs } from "../../utils/helpers"; import type { Block, TransactionAtom } from "@tari-project/typescript-bindings"; -import type { GetIdentityResponse } from "@tari-project/typescript-bindings/validator-node-client"; +import type { VNGetIdentityResponse } from "@tari-project/typescript-bindings"; export default function BlockDetails() { const { blockId } = useParams(); @@ -48,7 +48,7 @@ export default function BlockDetails() { const [localPrepared, setLocalPrepared] = useState([]); const [accept, setAccept] = useState([]); const [epochEvents, setEpochEvents] = useState([]); - const [identity, setIdentity] = useState(); + const [identity, setIdentity] = useState(); const [blockTime, setBlockTime] = useState(0); useEffect(() => { diff --git a/applications/tari_validator_node_web_ui/src/routes/Committees/Committee.tsx b/applications/tari_validator_node_web_ui/src/routes/Committees/Committee.tsx index 5b09af411..2fc2b575a 100644 --- a/applications/tari_validator_node_web_ui/src/routes/Committees/Committee.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/Committees/Committee.tsx @@ -31,7 +31,7 @@ import IconButton from "@mui/material/IconButton"; import Collapse from "@mui/material/Collapse"; import { Typography } from "@mui/material"; import ManageSearchOutlinedIcon from "@mui/icons-material/ManageSearchOutlined"; -import type { ValidatorNode } from "@tari-project/typescript-bindings/validator-node-client"; +import type { ValidatorNode } from "@tari-project/typescript-bindings"; function Committee({ begin, diff --git a/applications/tari_validator_node_web_ui/src/routes/Committees/Committees.tsx b/applications/tari_validator_node_web_ui/src/routes/Committees/Committees.tsx index e0c1f5c17..2e8bf7384 100644 --- a/applications/tari_validator_node_web_ui/src/routes/Committees/Committees.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/Committees/Committees.tsx @@ -32,9 +32,9 @@ import TablePagination from "@mui/material/TablePagination"; import { Typography } from "@mui/material"; import CommitteesWaterfall from "./CommitteesWaterfall"; import { emptyRows } from "../../utils/helpers"; -import type { CommitteeShardInfo } from "@tari-project/typescript-bindings/validator-node-client"; +import type { VNCommitteeShardInfo } from "@tari-project/typescript-bindings"; -function Committees({ committees, peerId }: { committees: CommitteeShardInfo[] | null; peerId: string }) { +function Committees({ committees, peerId }: { committees: VNCommitteeShardInfo[] | null; peerId: string }) { const [page, setPage] = useState(0); const [rowsPerPage, setRowsPerPage] = useState(10); diff --git a/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesLayout.tsx b/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesLayout.tsx index 016812952..a40f21127 100644 --- a/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesLayout.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesLayout.tsx @@ -31,9 +31,9 @@ import CommitteesRadial from "./CommitteesRadial"; import CommitteesPieChart from "./CommitteesPieChart"; import { getNetworkCommittees } from "../../utils/json_rpc"; import type { - CommitteeShardInfo, + VNCommitteeShardInfo, GetNetworkCommitteeResponse, -} from "@tari-project/typescript-bindings/validator-node-client"; +} from "@tari-project/typescript-bindings"; function CommitteesLayout() { const [committees, setCommittees] = useState(null); @@ -63,18 +63,18 @@ function CommitteesLayout() { Current epoch: {epoch.current_epoch}
Total number of validators:{" "} - {committees.committees.reduce((acc: number, info: CommitteeShardInfo) => acc + info.validators.length, 0)} + {committees.committees.reduce((acc: number, info: VNCommitteeShardInfo) => acc + info.validators.length, 0)}
Total buckets: {committees.committees.length}
Min committee size:{" "} {committees.committees - .map((vn: CommitteeShardInfo) => vn.validators.length) + .map((vn: VNCommitteeShardInfo) => vn.validators.length) .reduce((acc, curr) => Math.min(acc, curr), 100000)}
Max committee size:{" "} {committees.committees - .map((vn: CommitteeShardInfo) => vn.validators.length) + .map((vn: VNCommitteeShardInfo) => vn.validators.length) .reduce((acc, curr) => Math.max(acc, curr), 0)} diff --git a/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesPieChart.tsx b/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesPieChart.tsx index 3720b30ec..8cb8c6490 100644 --- a/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesPieChart.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesPieChart.tsx @@ -24,9 +24,9 @@ import { useState, useEffect } from "react"; import EChartsReact from "echarts-for-react"; import "../../theme/echarts.css"; import type { - CommitteeShardInfo, + VNCommitteeShardInfo, GetNetworkCommitteeResponse, -} from "@tari-project/typescript-bindings/validator-node-client"; +} from "@tari-project/typescript-bindings"; interface IData { value: number; @@ -41,7 +41,7 @@ const MyChartComponent = ({ chartData }: MyChartComponentProps) => { const [titles, setTitles] = useState([]); useEffect(() => { - const mappedTitles = chartData.committees.map((shardInfo: CommitteeShardInfo) => { + const mappedTitles = chartData.committees.map((shardInfo: VNCommitteeShardInfo) => { return `${shardInfo.substate_address_range.start.slice(0, 6)}... - ${shardInfo.substate_address_range.end.slice( 0, 6, diff --git a/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesRadial.tsx b/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesRadial.tsx index 0c1d4eadd..21ecf7aab 100644 --- a/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesRadial.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesRadial.tsx @@ -26,10 +26,10 @@ import EChartsReact from "echarts-for-react"; import { ICommitteeChart } from "../../utils/interfaces"; import "../../theme/echarts.css"; import type { - CommitteeShardInfo, + VNCommitteeShardInfo, GetNetworkCommitteeResponse, ValidatorNode, -} from "@tari-project/typescript-bindings/validator-node-client"; +} from "@tari-project/typescript-bindings"; export default function CommitteesRadial({ committees }: { committees: GetNetworkCommitteeResponse }) { const [chartData, setChartData] = useState({ @@ -60,7 +60,7 @@ export default function CommitteesRadial({ committees }: { committees: GetNetwor activeright: [], }; - dataset.forEach((data: CommitteeShardInfo) => { + dataset.forEach((data: VNCommitteeShardInfo) => { const start = fromHexString(data.substate_address_range.start)[0]; const end = fromHexString(data.substate_address_range.end)[0]; @@ -91,7 +91,7 @@ export default function CommitteesRadial({ committees }: { committees: GetNetwor } }); setChartData(info); - const newTitles = dataset.map((info: CommitteeShardInfo) => `Committee ${info.shard}`); + const newTitles = dataset.map((info: VNCommitteeShardInfo) => `Committee ${info.shard}`); setTitles(newTitles); }, [committees]); diff --git a/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesWaterfall.tsx b/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesWaterfall.tsx index d604c7d02..b02a82423 100644 --- a/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesWaterfall.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/Committees/CommitteesWaterfall.tsx @@ -25,9 +25,9 @@ import { fromHexString } from "../VN/Components/helpers"; import EChartsReact from "echarts-for-react"; import { ICommitteeChart } from "../../utils/interfaces"; import "../../theme/echarts.css"; -import type { CommitteeShardInfo, ValidatorNode } from "@tari-project/typescript-bindings/validator-node-client"; +import type { VNCommitteeShardInfo, ValidatorNode } from "@tari-project/typescript-bindings"; -export default function CommitteesWaterfall({ committees }: { committees: CommitteeShardInfo[] }) { +export default function CommitteesWaterfall({ committees }: { committees: VNCommitteeShardInfo[] }) { const [chartData, setChartData] = useState({ activeleft: [], inactiveleft: [], diff --git a/applications/tari_validator_node_web_ui/src/routes/VN/Components/AllVNs.tsx b/applications/tari_validator_node_web_ui/src/routes/VN/Components/AllVNs.tsx index d80b7ef36..1aeac6abe 100644 --- a/applications/tari_validator_node_web_ui/src/routes/VN/Components/AllVNs.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/VN/Components/AllVNs.tsx @@ -32,7 +32,7 @@ import Typography from "@mui/material/Typography"; import TablePagination from "@mui/material/TablePagination"; import { DataTableCell } from "../../../Components/StyledComponents"; import { emptyRows } from "../../../utils/helpers"; -import type { BaseLayerValidatorNode } from "@tari-project/typescript-bindings/base-node-client"; +import type { BaseLayerValidatorNode } from "@tari-project/typescript-bindings"; function AllVNs({ epoch }: { epoch: number }) { const [vns, setVns] = useState([]); diff --git a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Blocks.tsx b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Blocks.tsx index 04e6541ed..7a19bdfc2 100644 --- a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Blocks.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Blocks.tsx @@ -40,13 +40,13 @@ import Filter from "../../../Components/Filter"; import Fade from "@mui/material/Fade"; import StatusChip from "../../../Components/StatusChip"; import { Ordering, type Block } from "@tari-project/typescript-bindings"; -import type { GetIdentityResponse } from "@tari-project/typescript-bindings/validator-node-client"; +import type { VNGetIdentityResponse } from "@tari-project/typescript-bindings"; function Blocks() { const [blocks, setBlocks] = useState([]); const [blocksCount, setBlocksCount] = useState(0); const [lastSort, setLastSort] = useState({ column: "height", order: -1 }); - const [identity, setIdentity] = useState(); + const [identity, setIdentity] = useState(); const [page, setPage] = useState(0); const [rowsPerPage, setRowsPerPage] = useState(10); diff --git a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Connections.tsx b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Connections.tsx index 468d34b1f..7c1c5ca46 100644 --- a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Connections.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Connections.tsx @@ -36,7 +36,7 @@ import { TextField } from "@mui/material"; import { Form } from "react-router-dom"; import Fade from "@mui/material/Fade"; import CopyToClipboard from "../../../Components/CopyToClipboard"; -import type { Connection } from "@tari-project/typescript-bindings/validator-node-client"; +import type { VNConnection } from "@tari-project/typescript-bindings"; import { displayDuration } from "../../../utils/helpers"; const useInterval = (fn: () => Promise, ms: number) => { @@ -59,7 +59,7 @@ const useInterval = (fn: () => Promise, ms: number) => { }; function Connections() { - const [connections, setConnections] = useState([]); + const [connections, setConnections] = useState([]); const [showPeerDialog, setShowAddPeerDialog] = useState(false); const [formState, setFormState] = useState({ publicKey: "", address: "" }); diff --git a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Info.tsx b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Info.tsx index 94d7629e7..f450022fd 100644 --- a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Info.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Info.tsx @@ -31,8 +31,8 @@ import { DataTableCell } from "../../../Components/StyledComponents"; import { TextField } from "@mui/material"; import type { GetEpochManagerStatsResponse, - GetIdentityResponse, -} from "@tari-project/typescript-bindings/validator-node-client"; + VNGetIdentityResponse, +} from "@tari-project/typescript-bindings"; function Info({ epoch, @@ -40,7 +40,7 @@ function Info({ shardKey, }: { epoch: GetEpochManagerStatsResponse; - identity: GetIdentityResponse; + identity: VNGetIdentityResponse; shardKey: string | null; }) { const [registering, setRegistering] = useState(false); diff --git a/applications/tari_validator_node_web_ui/src/routes/VN/Components/TemplateFunctions.tsx b/applications/tari_validator_node_web_ui/src/routes/VN/Components/TemplateFunctions.tsx index 6b835fc51..1401a860f 100644 --- a/applications/tari_validator_node_web_ui/src/routes/VN/Components/TemplateFunctions.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/VN/Components/TemplateFunctions.tsx @@ -33,8 +33,7 @@ import { DataTableCell, BoxHeading, BoxHeading2 } from "../../../Components/Styl import PageHeading from "../../../Components/PageHeading"; import Grid from "@mui/material/Grid"; import { StyledPaper } from "../../../Components/StyledComponents"; -import { fromHexString } from "./helpers"; -import type { ArgDef, GetTemplateResponse } from "@tari-project/typescript-bindings/validator-node-client"; +import type { VNArgDef, GetTemplateResponse } from "@tari-project/typescript-bindings"; function TemplateFunctions() { const { address } = useParams(); @@ -70,7 +69,7 @@ function TemplateFunctions() { {fn.name} {fn.arguments - .map((a: ArgDef) => { + .map((a: VNArgDef) => { return a.name + ":" + a.arg_type; }) .join(", ")} diff --git a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Templates.tsx b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Templates.tsx index a0348d22f..13d0d32cd 100644 --- a/applications/tari_validator_node_web_ui/src/routes/VN/Components/Templates.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/VN/Components/Templates.tsx @@ -44,7 +44,7 @@ import Typography from "@mui/material/Typography"; import Fade from "@mui/material/Fade"; import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined"; import { emptyRows } from "../../../utils/helpers"; -import type { TemplateMetadata } from "@tari-project/typescript-bindings/validator-node-client"; +import type { TemplateMetadata } from "@tari-project/typescript-bindings"; type ColumnKey = keyof TemplateMetadata; diff --git a/applications/tari_validator_node_web_ui/src/routes/VN/ValidatorNode.tsx b/applications/tari_validator_node_web_ui/src/routes/VN/ValidatorNode.tsx index 04b922722..b72743350 100644 --- a/applications/tari_validator_node_web_ui/src/routes/VN/ValidatorNode.tsx +++ b/applications/tari_validator_node_web_ui/src/routes/VN/ValidatorNode.tsx @@ -35,7 +35,7 @@ import Grid from "@mui/material/Grid"; import SecondaryHeading from "../../Components/SecondaryHeading"; import { VNContext } from "../../App"; import { getNetworkCommittees } from "../../utils/json_rpc"; -import type { GetNetworkCommitteeResponse } from "@tari-project/typescript-bindings/validator-node-client"; +import type { GetNetworkCommitteeResponse } from "@tari-project/typescript-bindings"; function ValidatorNode() { const [committees, setCommittees] = useState(null); diff --git a/applications/tari_validator_node_web_ui/src/utils/json_rpc.tsx b/applications/tari_validator_node_web_ui/src/utils/json_rpc.tsx index 36902c4e0..b1fff48cb 100644 --- a/applications/tari_validator_node_web_ui/src/utils/json_rpc.tsx +++ b/applications/tari_validator_node_web_ui/src/utils/json_rpc.tsx @@ -20,11 +20,11 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import type { GetFilteredBlocksCountRequest } from "@tari-project/typescript-bindings/validator-node-client"; +import type { GetFilteredBlocksCountRequest } from "@tari-project/typescript-bindings"; import type { - AddPeerRequest, - GetAllVnsRequest, - GetAllVnsResponse, + VNAddPeerRequest, + VNGetAllVnsRequest, + VNGetAllVnsResponse, GetBlockRequest, GetBlockResponse, GetBlocksCountResponse, @@ -32,10 +32,10 @@ import type { GetBlocksResponse, GetCommitteeRequest, GetCommitteeResponse, - GetCommsStatsResponse, - GetConnectionsResponse, + VNGetCommsStatsResponse, + VNGetConnectionsResponse, GetEpochManagerStatsResponse, - GetIdentityResponse, + VNGetIdentityResponse, GetMempoolStatsResponse, GetNetworkCommitteeResponse, GetRecentTransactionsResponse, @@ -43,8 +43,8 @@ import type { GetShardKeyResponse, GetStateRequest, GetStateResponse, - GetSubstateRequest, - GetSubstateResponse, + VNGetSubstateRequest, + VNGetSubstateResponse, GetSubstatesByTransactionRequest, GetSubstatesByTransactionResponse, GetTemplateRequest, @@ -53,16 +53,16 @@ import type { GetTemplatesResponse, GetTransactionRequest, GetTransactionResponse, - GetTransactionResultRequest, - GetTransactionResultResponse, + VNGetTransactionResultRequest, + VNGetTransactionResultResponse, GetTxPoolResponse, ListBlocksRequest, ListBlocksResponse, - SubmitTransactionRequest, - SubmitTransactionResponse, + VNSubmitTransactionRequest, + VNSubmitTransactionResponse, VNGetValidatorFeesRequest, VNGetValidatorFeesResponse, -} from "@tari-project/typescript-bindings/validator-node-client"; +} from "@tari-project/typescript-bindings"; const DEFAULT_ADDRESS = new URL("http://127.0.0.1:18200"); @@ -107,15 +107,15 @@ async function jsonRpc(method: string, params: any = null) { } // Transaction -export const submitTransaction = (request: SubmitTransactionRequest): Promise => +export const submitTransaction = (request: VNSubmitTransactionRequest): Promise => jsonRpc("submit_transaction", request); export const getRecentTransactions = (): Promise => jsonRpc("get_recent_transactions"); export const getTransaction = (request: GetTransactionRequest): Promise => jsonRpc("get_transaction", request); -export const getTransactionResult = (request: GetTransactionResultRequest): Promise => +export const getTransactionResult = (request: VNGetTransactionResultRequest): Promise => jsonRpc("get_transaction_result", request); export const getState = (request: GetStateRequest): Promise => jsonRpc("get_state", request); -export const getSubstate = (request: GetSubstateRequest): Promise => +export const getSubstate = (request: VNGetSubstateRequest): Promise => jsonRpc("get_substate", request); export const getUpSubstates = (request: GetSubstatesByTransactionRequest): Promise => jsonRpc("get_substates_created_by_transaction", request); @@ -139,7 +139,7 @@ export const getTemplates = (request: GetTemplatesRequest): Promise => jsonRpc("get_identity"); +export const getIdentity = (): Promise => jsonRpc("get_identity"); export const getMempoolStats = (): Promise => jsonRpc("get_mempool_stats"); export const getEpochManagerStats = (): Promise => jsonRpc("get_epoch_manager_stats"); @@ -147,12 +147,12 @@ export const getShardKey = (request: GetShardKeyRequest): Promise => jsonRpc("get_committee", request); -export const getAllVns = (request: GetAllVnsRequest): Promise => jsonRpc("get_all_vns", request); +export const getAllVns = (request: VNGetAllVnsRequest): Promise => jsonRpc("get_all_vns", request); export const getNetworkCommittees = (): Promise => jsonRpc("get_network_committees", {}); export const getFees = (request: VNGetValidatorFeesRequest): Promise => jsonRpc("get_fees", request); // Comms -export const addPeer = (request: AddPeerRequest) => jsonRpc("add_peer", request); -export const getCommsStats = (): Promise => jsonRpc("get_comms_stats"); -export const getConnections = (): Promise => jsonRpc("get_connections"); +export const addPeer = (request: VNAddPeerRequest) => jsonRpc("add_peer", request); +export const getCommsStats = (): Promise => jsonRpc("get_comms_stats"); +export const getConnections = (): Promise => jsonRpc("get_connections"); diff --git a/applications/tari_validator_node_web_ui/tsconfig.json b/applications/tari_validator_node_web_ui/tsconfig.json index a972e52ca..c7f106ba7 100644 --- a/applications/tari_validator_node_web_ui/tsconfig.json +++ b/applications/tari_validator_node_web_ui/tsconfig.json @@ -10,7 +10,7 @@ "strict": true, "forceConsistentCasingInFileNames": true, "module": "ESNext", - "moduleResolution": "Bundler", + "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, diff --git a/bindings/build.sh b/bindings/build.sh index 0f0a18706..9258d61cd 100755 --- a/bindings/build.sh +++ b/bindings/build.sh @@ -6,38 +6,45 @@ set -e SOURCE_PATH="./src" TYPES_DIR="types" HELPERS_DIR="helpers" -INDEX_FILE="index.ts" -npx shx rm -rf $SOURCE_PATH/$TYPES_DIR -npx shx rm -rf $SOURCE_PATH/$INDEX_FILE +MAIN_INDEX_FILE="index.ts" + +if [ -f "$SOURCE_PATH/$TYPES_DIR" ]; then + npx shx rm -rf $SOURCE_PATH/$TYPES_DIR +fi +if [ -f "$SOURCE_PATH/$TYPES_DIR" ]; then + npx shx rm -rf $SOURCE_PATH/$MAIN_INDEX_FILE +fi cargo test --workspace --exclude integration_tests export_bindings --features ts npx shx mv ../dan_layer/bindings/src/types/* ./src/types/ npx shx rm -rf ../dan_layer/bindings/ # Add the license header -echo "// Copyright 2023 The Tari Project" >> $SOURCE_PATH/$INDEX_FILE -echo "// SPDX-License-Identifier: BSD-3-Clause" >> $SOURCE_PATH/$INDEX_FILE -echo "" >> $SOURCE_PATH/$INDEX_FILE +echo "// Copyright 2023 The Tari Project" >> $SOURCE_PATH/$MAIN_INDEX_FILE +echo "// SPDX-License-Identifier: BSD-3-Clause" >> $SOURCE_PATH/$MAIN_INDEX_FILE +echo "" >> $SOURCE_PATH/$MAIN_INDEX_FILE cd ./src # Generate the index file for file in $(find $TYPES_DIR -name "*.ts" -maxdepth 1 | sort); do MODULE_NAME="${file%.*}" - echo "export * from './$MODULE_NAME';" >> $INDEX_FILE + echo "export * from './$MODULE_NAME';" >> $MAIN_INDEX_FILE done for dir in $(find $TYPES_DIR -mindepth 1 -maxdepth 1 -type d | sort); do - index_file="$(basename $dir).ts" - if [ -f "$index_file" ]; then - npx shx rm "$index_file" + module_dir_name="$(basename $dir)" + module_export_file="$module_dir_name.ts" + if [ -f "$module_export_file" ]; then + npx shx rm "$module_export_file" fi - echo "// Copyright 2023 The Tari Project" >> "$index_file" - echo "// SPDX-License-Identifier: BSD-3-Clause" >> "$index_file" - echo "" >> "$index_file" + echo "// Copyright 2023 The Tari Project" >> "$module_export_file" + echo "// SPDX-License-Identifier: BSD-3-Clause" >> "$module_export_file" + echo "" >> "$module_export_file" for file in $(find $dir -name "*.ts" -maxdepth 1); do MODULE_NAME="${file%.*}" - echo "export * from './$MODULE_NAME';" >> "$index_file" + echo "export * from './$MODULE_NAME';" >> "$module_export_file" done + echo "export * from './$module_dir_name';" >> $MAIN_INDEX_FILE done # Add helpers @@ -45,7 +52,7 @@ for file in $(find $HELPERS_DIR -name "*.ts" | sort); do FILE_NAME=$(basename $file) if [ "$FILE_NAME" != "index.ts" ]; then MODULE_NAME="${FILE_NAME%.*}" - echo "export * from './$HELPERS_DIR/$MODULE_NAME';" >> $INDEX_FILE + echo "export * from './$HELPERS_DIR/$MODULE_NAME';" >> $MAIN_INDEX_FILE fi done diff --git a/bindings/package.json b/bindings/package.json index 5b6d0eb8e..a744004cf 100644 --- a/bindings/package.json +++ b/bindings/package.json @@ -2,28 +2,8 @@ "name": "@tari-project/typescript-bindings", "version": "1.0.5", "description": "", - "exports": { - ".": { - "default": "./dist/index.js", - "types": "./dist/index.d.ts" - }, - "./base-node-client": { - "default": "./dist/base-node-client.js", - "types": "./dist/base-node-client.d.ts" - }, - "./tari-indexer-client": { - "default": "./dist/tari-indexer-client.js", - "types": "./dist/tari-indexer-client.d.ts" - }, - "./validator-node-client": { - "default": "./dist/validator-node-client.js", - "types": "./dist/validator-node-client.d.ts" - }, - "./wallet-daemon-client": { - "default": "./dist/wallet-daemon-client.js", - "types": "./dist/wallet-daemon-client.d.ts" - } - }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", "publishConfig": { "access": "public" }, diff --git a/bindings/src/index.ts b/bindings/src/index.ts index 3861a356d..951e59b40 100644 --- a/bindings/src/index.ts +++ b/bindings/src/index.ts @@ -113,4 +113,128 @@ export * from "./types/Vault"; export * from "./types/VersionedSubstateIdLockIntent"; export * from "./types/VersionedSubstateId"; export * from "./types/ViewableBalanceProof"; +export * from "./base-node-client"; +export * from "./tari-indexer-client"; +export * from "./validator-node-client"; +export * from "./wallet-daemon-client"; +export * from "./helpers/helpers"; +// Copyright 2023 The Tari Project +// SPDX-License-Identifier: BSD-3-Clause + +export * from "./types/AccessRule"; +export * from "./types/Account"; +export * from "./types/Amount"; +export * from "./types/ArgDef"; +export * from "./types/Arg"; +export * from "./types/AuthHook"; +export * from "./types/Block"; +export * from "./types/BucketId"; +export * from "./types/Claims"; +export * from "./types/Command"; +export * from "./types/CommitteeInfo"; +export * from "./types/CommitteeShardInfo"; +export * from "./types/Committee"; +export * from "./types/ComponentAccessRules"; +export * from "./types/ComponentAddress"; +export * from "./types/ComponentBody"; +export * from "./types/ComponentHeader"; +export * from "./types/ComponentKey"; +export * from "./types/ConfidentialClaim"; +export * from "./types/ConfidentialOutputStatement"; +export * from "./types/ConfidentialOutput"; +export * from "./types/ConfidentialStatement"; +export * from "./types/ConfidentialTransferInputSelection"; +export * from "./types/ConfidentialWithdrawProof"; +export * from "./types/Decision"; +export * from "./types/ElgamalVerifiableBalance"; +export * from "./types/EntityId"; +export * from "./types/Epoch"; +export * from "./types/Event"; +export * from "./types/Evidence"; +export * from "./types/ExecutedTransaction"; +export * from "./types/ExecuteResult"; +export * from "./types/FeeBreakdown"; +export * from "./types/FeeClaimAddress"; +export * from "./types/FeeClaim"; +export * from "./types/FeeCostBreakdown"; +export * from "./types/FeeReceipt"; +export * from "./types/FeeSource"; +export * from "./types/FinalizeResult"; +export * from "./types/ForeignProposalState"; +export * from "./types/ForeignProposal"; +export * from "./types/FunctionDef"; +export * from "./types/IndexedValue"; +export * from "./types/IndexedWellKnownTypes"; +export * from "./types/InstructionResult"; +export * from "./types/Instruction"; +export * from "./types/JrpcPermissions"; +export * from "./types/JrpcPermission"; +export * from "./types/LeaderFee"; +export * from "./types/LockFlag"; +export * from "./types/LogEntry"; +export * from "./types/LogLevel"; +export * from "./types/Metadata"; +export * from "./types/NetworkCommitteeInfo"; +export * from "./types/NodeHeight"; +export * from "./types/NonFungibleAddressContents"; +export * from "./types/NonFungibleAddress"; +export * from "./types/NonFungibleContainer"; +export * from "./types/NonFungibleId"; +export * from "./types/NonFungibleIndexAddress"; +export * from "./types/NonFungibleIndex"; +export * from "./types/NonFungibleToken"; +export * from "./types/NonFungible"; +export * from "./types/NumPreshards"; +export * from "./types/Ordering"; +export * from "./types/OwnerRule"; +export * from "./types/PeerAddress"; +export * from "./types/ProofId"; +export * from "./types/QuorumCertificate"; +export * from "./types/QuorumDecision"; +export * from "./types/RejectReason"; +export * from "./types/RequireRule"; +export * from "./types/ResourceAccessRules"; +export * from "./types/ResourceAddress"; +export * from "./types/ResourceContainer"; +export * from "./types/Resource"; +export * from "./types/ResourceType"; +export * from "./types/RestrictedAccessRule"; +export * from "./types/RuleRequirement"; +export * from "./types/ShardEvidence"; +export * from "./types/ShardGroup"; +export * from "./types/Shard"; +export * from "./types/SubstateAddress"; +export * from "./types/SubstateDestroyed"; +export * from "./types/SubstateDiff"; +export * from "./types/SubstateId"; +export * from "./types/SubstateLockFlag"; +export * from "./types/SubstateRecord"; +export * from "./types/SubstateRequirement"; +export * from "./types/Substate"; +export * from "./types/SubstateType"; +export * from "./types/SubstateValue"; +export * from "./types/TemplateDef"; +export * from "./types/TemplateDefV1"; +export * from "./types/TransactionAtom"; +export * from "./types/TransactionPoolRecord"; +export * from "./types/TransactionPoolStage"; +export * from "./types/TransactionReceiptAddress"; +export * from "./types/TransactionReceipt"; +export * from "./types/TransactionResult"; +export * from "./types/TransactionSignature"; +export * from "./types/TransactionStatus"; +export * from "./types/Transaction"; +export * from "./types/Type"; +export * from "./types/UnclaimedConfidentialOutput"; +export * from "./types/UnsignedTransaction"; +export * from "./types/ValidatorSignature"; +export * from "./types/VaultId"; +export * from "./types/Vault"; +export * from "./types/VersionedSubstateIdLockIntent"; +export * from "./types/VersionedSubstateId"; +export * from "./types/ViewableBalanceProof"; +export * from "./base-node-client"; +export * from "./tari-indexer-client"; +export * from "./validator-node-client"; +export * from "./wallet-daemon-client"; export * from "./helpers/helpers"; diff --git a/bindings/src/tari-indexer-client.ts b/bindings/src/tari-indexer-client.ts index aed64ba5d..65912d438 100644 --- a/bindings/src/tari-indexer-client.ts +++ b/bindings/src/tari-indexer-client.ts @@ -1,37 +1,37 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -export * from "./types/tari-indexer-client/GetAllVnsRequest"; -export * from "./types/tari-indexer-client/GetSubstateRequest"; -export * from "./types/tari-indexer-client/Connection"; +export * from "./types/tari-indexer-client/IndexerSubmitTransactionResponse"; export * from "./types/tari-indexer-client/GetTemplateDefinitionResponse"; export * from "./types/tari-indexer-client/GetNonFungibleCountRequest"; -export * from "./types/tari-indexer-client/GetSubstateResponse"; +export * from "./types/tari-indexer-client/IndexerGetSubstateRequest"; +export * from "./types/tari-indexer-client/IndexerGetConnectionsResponse"; export * from "./types/tari-indexer-client/GetNonFungiblesResponse"; -export * from "./types/tari-indexer-client/GetAllVnsResponse"; +export * from "./types/tari-indexer-client/IndexerGetCommsStatsResponse"; export * from "./types/tari-indexer-client/InspectSubstateRequest"; export * from "./types/tari-indexer-client/ListSubstateItem"; +export * from "./types/tari-indexer-client/IndexerConnectionDirection"; +export * from "./types/tari-indexer-client/IndexerSubmitTransactionRequest"; +export * from "./types/tari-indexer-client/IndexerAddPeerRequest"; export * from "./types/tari-indexer-client/ListSubstatesResponse"; -export * from "./types/tari-indexer-client/GetTransactionResultRequest"; -export * from "./types/tari-indexer-client/SubmitTransactionRequest"; +export * from "./types/tari-indexer-client/IndexerGetTransactionResultRequest"; +export * from "./types/tari-indexer-client/IndexerAddPeerResponse"; export * from "./types/tari-indexer-client/GetNonFungiblesRequest"; -export * from "./types/tari-indexer-client/GetTransactionResultResponse"; +export * from "./types/tari-indexer-client/IndexerGetEpochManagerStatsResponse"; +export * from "./types/tari-indexer-client/IndexerGetAllVnsRequest"; export * from "./types/tari-indexer-client/ListSubstatesRequest"; -export * from "./types/tari-indexer-client/GetIdentityResponse"; export * from "./types/tari-indexer-client/GetRelatedTransactionsResponse"; -export * from "./types/tari-indexer-client/SubmitTransactionResponse"; -export * from "./types/tari-indexer-client/GetEpochManagerStatsResponse"; +export * from "./types/tari-indexer-client/IndexerConnection"; +export * from "./types/tari-indexer-client/IndexerGetSubstateResponse"; export * from "./types/tari-indexer-client/GetRelatedTransactionsRequest"; -export * from "./types/tari-indexer-client/ConnectionDirection"; export * from "./types/tari-indexer-client/InspectSubstateResponse"; -export * from "./types/tari-indexer-client/AddPeerRequest"; +export * from "./types/tari-indexer-client/IndexerGetIdentityResponse"; export * from "./types/tari-indexer-client/NonFungibleSubstate"; +export * from "./types/tari-indexer-client/IndexerGetTransactionResultResponse"; export * from "./types/tari-indexer-client/GetNonFungibleCountResponse"; -export * from "./types/tari-indexer-client/GetCommsStatsResponse"; export * from "./types/tari-indexer-client/GetTemplateDefinitionRequest"; export * from "./types/tari-indexer-client/ListTemplatesResponse"; export * from "./types/tari-indexer-client/IndexerTransactionFinalizedResult"; +export * from "./types/tari-indexer-client/IndexerGetAllVnsResponse"; export * from "./types/tari-indexer-client/ListTemplatesRequest"; export * from "./types/tari-indexer-client/GetNonFungibleCollectionsResponse"; -export * from "./types/tari-indexer-client/AddPeerResponse"; -export * from "./types/tari-indexer-client/GetConnectionsResponse"; diff --git a/bindings/src/types/tari-indexer-client/GetConnectionsResponse.ts b/bindings/src/types/tari-indexer-client/GetConnectionsResponse.ts deleted file mode 100644 index 87a6d892a..000000000 --- a/bindings/src/types/tari-indexer-client/GetConnectionsResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Connection } from "./Connection"; - -export interface GetConnectionsResponse { - connections: Array; -} diff --git a/bindings/src/types/validator-node-client/AddPeerRequest.ts b/bindings/src/types/tari-indexer-client/IndexerAddPeerRequest.ts similarity index 82% rename from bindings/src/types/validator-node-client/AddPeerRequest.ts rename to bindings/src/types/tari-indexer-client/IndexerAddPeerRequest.ts index c95eae8dc..33a38e4fa 100644 --- a/bindings/src/types/validator-node-client/AddPeerRequest.ts +++ b/bindings/src/types/tari-indexer-client/IndexerAddPeerRequest.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface AddPeerRequest { +export interface IndexerAddPeerRequest { public_key: string; addresses: Array; wait_for_dial: boolean; diff --git a/bindings/src/types/validator-node-client/ConnectionDirection.ts b/bindings/src/types/tari-indexer-client/IndexerAddPeerResponse.ts similarity index 64% rename from bindings/src/types/validator-node-client/ConnectionDirection.ts rename to bindings/src/types/tari-indexer-client/IndexerAddPeerResponse.ts index 45100c453..ab8ca012a 100644 --- a/bindings/src/types/validator-node-client/ConnectionDirection.ts +++ b/bindings/src/types/tari-indexer-client/IndexerAddPeerResponse.ts @@ -1,3 +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"; +export type IndexerAddPeerResponse = Record; diff --git a/bindings/src/types/tari-indexer-client/Connection.ts b/bindings/src/types/tari-indexer-client/IndexerConnection.ts similarity index 65% rename from bindings/src/types/tari-indexer-client/Connection.ts rename to bindings/src/types/tari-indexer-client/IndexerConnection.ts index a51952229..e048e1c69 100644 --- a/bindings/src/types/tari-indexer-client/Connection.ts +++ b/bindings/src/types/tari-indexer-client/IndexerConnection.ts @@ -1,11 +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"; +import type { IndexerConnectionDirection } from "./IndexerConnectionDirection"; -export interface Connection { +export interface IndexerConnection { connection_id: string; peer_id: string; address: string; - direction: ConnectionDirection; + direction: IndexerConnectionDirection; age: { secs: number; nanos: number }; ping_latency: { secs: number; nanos: number } | null; user_agent: string | null; diff --git a/bindings/src/types/tari-indexer-client/IndexerConnectionDirection.ts b/bindings/src/types/tari-indexer-client/IndexerConnectionDirection.ts new file mode 100644 index 000000000..9d3afdd7a --- /dev/null +++ b/bindings/src/types/tari-indexer-client/IndexerConnectionDirection.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 IndexerConnectionDirection = "Inbound" | "Outbound"; diff --git a/bindings/src/types/tari-indexer-client/GetAllVnsRequest.ts b/bindings/src/types/tari-indexer-client/IndexerGetAllVnsRequest.ts similarity index 79% rename from bindings/src/types/tari-indexer-client/GetAllVnsRequest.ts rename to bindings/src/types/tari-indexer-client/IndexerGetAllVnsRequest.ts index 4519cc294..888eb073c 100644 --- a/bindings/src/types/tari-indexer-client/GetAllVnsRequest.ts +++ b/bindings/src/types/tari-indexer-client/IndexerGetAllVnsRequest.ts @@ -1,6 +1,6 @@ // 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 GetAllVnsRequest { +export interface IndexerGetAllVnsRequest { epoch: Epoch; } diff --git a/bindings/src/types/tari-indexer-client/GetAllVnsResponse.ts b/bindings/src/types/tari-indexer-client/IndexerGetAllVnsResponse.ts similarity index 84% rename from bindings/src/types/tari-indexer-client/GetAllVnsResponse.ts rename to bindings/src/types/tari-indexer-client/IndexerGetAllVnsResponse.ts index b41de4a0c..24b586bb9 100644 --- a/bindings/src/types/tari-indexer-client/GetAllVnsResponse.ts +++ b/bindings/src/types/tari-indexer-client/IndexerGetAllVnsResponse.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { BaseLayerValidatorNode } from "../base-node-client/BaseLayerValidatorNode"; -export interface GetAllVnsResponse { +export interface IndexerGetAllVnsResponse { vns: Array; } diff --git a/bindings/src/types/validator-node-client/GetCommsStatsResponse.ts b/bindings/src/types/tari-indexer-client/IndexerGetCommsStatsResponse.ts similarity index 74% rename from bindings/src/types/validator-node-client/GetCommsStatsResponse.ts rename to bindings/src/types/tari-indexer-client/IndexerGetCommsStatsResponse.ts index a2086736f..5f5069657 100644 --- a/bindings/src/types/validator-node-client/GetCommsStatsResponse.ts +++ b/bindings/src/types/tari-indexer-client/IndexerGetCommsStatsResponse.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface GetCommsStatsResponse { +export interface IndexerGetCommsStatsResponse { connection_status: string; } diff --git a/bindings/src/types/tari-indexer-client/IndexerGetConnectionsResponse.ts b/bindings/src/types/tari-indexer-client/IndexerGetConnectionsResponse.ts new file mode 100644 index 000000000..afc7c9253 --- /dev/null +++ b/bindings/src/types/tari-indexer-client/IndexerGetConnectionsResponse.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 { IndexerConnection } from "./IndexerConnection"; + +export interface IndexerGetConnectionsResponse { + connections: Array; +} diff --git a/bindings/src/types/tari-indexer-client/GetEpochManagerStatsResponse.ts b/bindings/src/types/tari-indexer-client/IndexerGetEpochManagerStatsResponse.ts similarity index 81% rename from bindings/src/types/tari-indexer-client/GetEpochManagerStatsResponse.ts rename to bindings/src/types/tari-indexer-client/IndexerGetEpochManagerStatsResponse.ts index 43c59ecd9..99385e200 100644 --- a/bindings/src/types/tari-indexer-client/GetEpochManagerStatsResponse.ts +++ b/bindings/src/types/tari-indexer-client/IndexerGetEpochManagerStatsResponse.ts @@ -1,7 +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 GetEpochManagerStatsResponse { +export interface IndexerGetEpochManagerStatsResponse { current_epoch: Epoch; current_block_height: number; current_block_hash: string; diff --git a/bindings/src/types/tari-indexer-client/GetIdentityResponse.ts b/bindings/src/types/tari-indexer-client/IndexerGetIdentityResponse.ts similarity index 80% rename from bindings/src/types/tari-indexer-client/GetIdentityResponse.ts rename to bindings/src/types/tari-indexer-client/IndexerGetIdentityResponse.ts index 8d2ff7966..c5c07c2c1 100644 --- a/bindings/src/types/tari-indexer-client/GetIdentityResponse.ts +++ b/bindings/src/types/tari-indexer-client/IndexerGetIdentityResponse.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface GetIdentityResponse { +export interface IndexerGetIdentityResponse { peer_id: string; public_key: string; public_addresses: Array; diff --git a/bindings/src/types/tari-indexer-client/GetSubstateRequest.ts b/bindings/src/types/tari-indexer-client/IndexerGetSubstateRequest.ts similarity index 84% rename from bindings/src/types/tari-indexer-client/GetSubstateRequest.ts rename to bindings/src/types/tari-indexer-client/IndexerGetSubstateRequest.ts index 0ea09d9b8..f428297d4 100644 --- a/bindings/src/types/tari-indexer-client/GetSubstateRequest.ts +++ b/bindings/src/types/tari-indexer-client/IndexerGetSubstateRequest.ts @@ -1,7 +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 { +export interface IndexerGetSubstateRequest { address: SubstateId; version: number | null; local_search_only: boolean; diff --git a/bindings/src/types/tari-indexer-client/GetSubstateResponse.ts b/bindings/src/types/tari-indexer-client/IndexerGetSubstateResponse.ts similarity index 86% rename from bindings/src/types/tari-indexer-client/GetSubstateResponse.ts rename to bindings/src/types/tari-indexer-client/IndexerGetSubstateResponse.ts index aa8eeaa06..6db8a2c3d 100644 --- a/bindings/src/types/tari-indexer-client/GetSubstateResponse.ts +++ b/bindings/src/types/tari-indexer-client/IndexerGetSubstateResponse.ts @@ -2,7 +2,7 @@ import type { Substate } from "../Substate"; import type { SubstateId } from "../SubstateId"; -export interface GetSubstateResponse { +export interface IndexerGetSubstateResponse { address: SubstateId; version: number; substate: Substate; diff --git a/bindings/src/types/tari-indexer-client/GetTransactionResultRequest.ts b/bindings/src/types/tari-indexer-client/IndexerGetTransactionResultRequest.ts similarity index 71% rename from bindings/src/types/tari-indexer-client/GetTransactionResultRequest.ts rename to bindings/src/types/tari-indexer-client/IndexerGetTransactionResultRequest.ts index 232705435..1b83eaf10 100644 --- a/bindings/src/types/tari-indexer-client/GetTransactionResultRequest.ts +++ b/bindings/src/types/tari-indexer-client/IndexerGetTransactionResultRequest.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface GetTransactionResultRequest { +export interface IndexerGetTransactionResultRequest { transaction_id: string; } diff --git a/bindings/src/types/tari-indexer-client/GetTransactionResultResponse.ts b/bindings/src/types/tari-indexer-client/IndexerGetTransactionResultResponse.ts similarity index 82% rename from bindings/src/types/tari-indexer-client/GetTransactionResultResponse.ts rename to bindings/src/types/tari-indexer-client/IndexerGetTransactionResultResponse.ts index da40eb444..1bb01027c 100644 --- a/bindings/src/types/tari-indexer-client/GetTransactionResultResponse.ts +++ b/bindings/src/types/tari-indexer-client/IndexerGetTransactionResultResponse.ts @@ -1,6 +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 GetTransactionResultResponse { +export interface IndexerGetTransactionResultResponse { result: IndexerTransactionFinalizedResult; } diff --git a/bindings/src/types/tari-indexer-client/SubmitTransactionRequest.ts b/bindings/src/types/tari-indexer-client/IndexerSubmitTransactionRequest.ts similarity index 86% rename from bindings/src/types/tari-indexer-client/SubmitTransactionRequest.ts rename to bindings/src/types/tari-indexer-client/IndexerSubmitTransactionRequest.ts index c1ccd8412..55711de39 100644 --- a/bindings/src/types/tari-indexer-client/SubmitTransactionRequest.ts +++ b/bindings/src/types/tari-indexer-client/IndexerSubmitTransactionRequest.ts @@ -2,7 +2,7 @@ import type { SubstateRequirement } from "../SubstateRequirement"; import type { Transaction } from "../Transaction"; -export interface SubmitTransactionRequest { +export interface IndexerSubmitTransactionRequest { transaction: Transaction; required_substates: Array; is_dry_run: boolean; diff --git a/bindings/src/types/tari-indexer-client/SubmitTransactionResponse.ts b/bindings/src/types/tari-indexer-client/IndexerSubmitTransactionResponse.ts similarity index 84% rename from bindings/src/types/tari-indexer-client/SubmitTransactionResponse.ts rename to bindings/src/types/tari-indexer-client/IndexerSubmitTransactionResponse.ts index cc125400c..7c68496da 100644 --- a/bindings/src/types/tari-indexer-client/SubmitTransactionResponse.ts +++ b/bindings/src/types/tari-indexer-client/IndexerSubmitTransactionResponse.ts @@ -1,7 +1,7 @@ // 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 SubmitTransactionResponse { +export interface IndexerSubmitTransactionResponse { transaction_id: string; result: IndexerTransactionFinalizedResult; } diff --git a/bindings/src/types/validator-node-client/GetConnectionsResponse.ts b/bindings/src/types/validator-node-client/GetConnectionsResponse.ts deleted file mode 100644 index 87a6d892a..000000000 --- a/bindings/src/types/validator-node-client/GetConnectionsResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Connection } from "./Connection"; - -export interface GetConnectionsResponse { - connections: Array; -} diff --git a/bindings/src/types/validator-node-client/GetNetworkCommitteeResponse.ts b/bindings/src/types/validator-node-client/GetNetworkCommitteeResponse.ts index 378c5495e..9bf81c3fd 100644 --- a/bindings/src/types/validator-node-client/GetNetworkCommitteeResponse.ts +++ b/bindings/src/types/validator-node-client/GetNetworkCommitteeResponse.ts @@ -1,8 +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"; +import type { VNCommitteeShardInfo } from "./VNCommitteeShardInfo"; export interface GetNetworkCommitteeResponse { current_epoch: Epoch; - committees: Array; + committees: Array; } diff --git a/bindings/src/types/validator-node-client/LogLevel.ts b/bindings/src/types/validator-node-client/LogLevel.ts deleted file mode 100644 index 58aaf969d..000000000 --- a/bindings/src/types/validator-node-client/LogLevel.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type LogLevel = "Error" | "Warn" | "Info" | "Debug"; diff --git a/bindings/src/types/validator-node-client/TemplateAbi.ts b/bindings/src/types/validator-node-client/TemplateAbi.ts index ee1a33844..cdb3fe3c2 100644 --- a/bindings/src/types/validator-node-client/TemplateAbi.ts +++ b/bindings/src/types/validator-node-client/TemplateAbi.ts @@ -1,8 +1,8 @@ // 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"; +import type { VNFunctionDef } from "./VNFunctionDef"; export interface TemplateAbi { template_name: string; - functions: Array; + functions: Array; version: string; } diff --git a/bindings/src/types/tari-indexer-client/AddPeerRequest.ts b/bindings/src/types/validator-node-client/VNAddPeerRequest.ts similarity index 83% rename from bindings/src/types/tari-indexer-client/AddPeerRequest.ts rename to bindings/src/types/validator-node-client/VNAddPeerRequest.ts index c95eae8dc..0d11938a7 100644 --- a/bindings/src/types/tari-indexer-client/AddPeerRequest.ts +++ b/bindings/src/types/validator-node-client/VNAddPeerRequest.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface AddPeerRequest { +export interface VNAddPeerRequest { public_key: string; addresses: Array; wait_for_dial: boolean; diff --git a/bindings/src/types/tari-indexer-client/AddPeerResponse.ts b/bindings/src/types/validator-node-client/VNAddPeerResponse.ts similarity index 66% rename from bindings/src/types/tari-indexer-client/AddPeerResponse.ts rename to bindings/src/types/validator-node-client/VNAddPeerResponse.ts index 2f3c13dbe..2a4b40aea 100644 --- a/bindings/src/types/tari-indexer-client/AddPeerResponse.ts +++ b/bindings/src/types/validator-node-client/VNAddPeerResponse.ts @@ -1,3 +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; +export type VNAddPeerResponse = Record; diff --git a/bindings/src/types/validator-node-client/ArgDef.ts b/bindings/src/types/validator-node-client/VNArgDef.ts similarity index 84% rename from bindings/src/types/validator-node-client/ArgDef.ts rename to bindings/src/types/validator-node-client/VNArgDef.ts index f8b3b7cf9..37a04bcb4 100644 --- a/bindings/src/types/validator-node-client/ArgDef.ts +++ b/bindings/src/types/validator-node-client/VNArgDef.ts @@ -1,6 +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 { +export interface VNArgDef { name: string; arg_type: string; } diff --git a/bindings/src/types/validator-node-client/CommitteeShardInfo.ts b/bindings/src/types/validator-node-client/VNCommitteeShardInfo.ts similarity index 89% rename from bindings/src/types/validator-node-client/CommitteeShardInfo.ts rename to bindings/src/types/validator-node-client/VNCommitteeShardInfo.ts index f9d924bae..cf1259643 100644 --- a/bindings/src/types/validator-node-client/CommitteeShardInfo.ts +++ b/bindings/src/types/validator-node-client/VNCommitteeShardInfo.ts @@ -2,7 +2,7 @@ import type { SubstateAddress } from "../SubstateAddress"; import type { ValidatorNode } from "./ValidatorNode"; -export interface CommitteeShardInfo { +export interface VNCommitteeShardInfo { shard: number; substate_address_range: { start: SubstateAddress; end: SubstateAddress }; validators: Array; diff --git a/bindings/src/types/validator-node-client/Connection.ts b/bindings/src/types/validator-node-client/VNConnection.ts similarity index 68% rename from bindings/src/types/validator-node-client/Connection.ts rename to bindings/src/types/validator-node-client/VNConnection.ts index a51952229..80b512b19 100644 --- a/bindings/src/types/validator-node-client/Connection.ts +++ b/bindings/src/types/validator-node-client/VNConnection.ts @@ -1,11 +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"; +import type { VNConnectionDirection } from "./VNConnectionDirection"; -export interface Connection { +export interface VNConnection { connection_id: string; peer_id: string; address: string; - direction: ConnectionDirection; + direction: VNConnectionDirection; age: { secs: number; nanos: number }; ping_latency: { secs: number; nanos: number } | null; user_agent: string | null; diff --git a/bindings/src/types/validator-node-client/AddPeerResponse.ts b/bindings/src/types/validator-node-client/VNConnectionDirection.ts similarity index 64% rename from bindings/src/types/validator-node-client/AddPeerResponse.ts rename to bindings/src/types/validator-node-client/VNConnectionDirection.ts index 2f3c13dbe..a770598e5 100644 --- a/bindings/src/types/validator-node-client/AddPeerResponse.ts +++ b/bindings/src/types/validator-node-client/VNConnectionDirection.ts @@ -1,3 +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; +export type VNConnectionDirection = "Inbound" | "Outbound"; diff --git a/bindings/src/types/validator-node-client/FunctionDef.ts b/bindings/src/types/validator-node-client/VNFunctionDef.ts similarity index 60% rename from bindings/src/types/validator-node-client/FunctionDef.ts rename to bindings/src/types/validator-node-client/VNFunctionDef.ts index 2f5eaf5cc..e7880bf66 100644 --- a/bindings/src/types/validator-node-client/FunctionDef.ts +++ b/bindings/src/types/validator-node-client/VNFunctionDef.ts @@ -1,9 +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"; +import type { VNArgDef } from "./VNArgDef"; -export interface FunctionDef { +export interface VNFunctionDef { name: string; - arguments: Array; + arguments: Array; output: string; is_mut: boolean; } diff --git a/bindings/src/types/validator-node-client/GetAllVnsRequest.ts b/bindings/src/types/validator-node-client/VNGetAllVnsRequest.ts similarity index 81% rename from bindings/src/types/validator-node-client/GetAllVnsRequest.ts rename to bindings/src/types/validator-node-client/VNGetAllVnsRequest.ts index 4519cc294..3247968c8 100644 --- a/bindings/src/types/validator-node-client/GetAllVnsRequest.ts +++ b/bindings/src/types/validator-node-client/VNGetAllVnsRequest.ts @@ -1,6 +1,6 @@ // 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 GetAllVnsRequest { +export interface VNGetAllVnsRequest { epoch: Epoch; } diff --git a/bindings/src/types/validator-node-client/GetAllVnsResponse.ts b/bindings/src/types/validator-node-client/VNGetAllVnsResponse.ts similarity index 86% rename from bindings/src/types/validator-node-client/GetAllVnsResponse.ts rename to bindings/src/types/validator-node-client/VNGetAllVnsResponse.ts index b41de4a0c..abf52509e 100644 --- a/bindings/src/types/validator-node-client/GetAllVnsResponse.ts +++ b/bindings/src/types/validator-node-client/VNGetAllVnsResponse.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { BaseLayerValidatorNode } from "../base-node-client/BaseLayerValidatorNode"; -export interface GetAllVnsResponse { +export interface VNGetAllVnsResponse { vns: Array; } diff --git a/bindings/src/types/tari-indexer-client/GetCommsStatsResponse.ts b/bindings/src/types/validator-node-client/VNGetCommsStatsResponse.ts similarity index 76% rename from bindings/src/types/tari-indexer-client/GetCommsStatsResponse.ts rename to bindings/src/types/validator-node-client/VNGetCommsStatsResponse.ts index a2086736f..f357ddbdd 100644 --- a/bindings/src/types/tari-indexer-client/GetCommsStatsResponse.ts +++ b/bindings/src/types/validator-node-client/VNGetCommsStatsResponse.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface GetCommsStatsResponse { +export interface VNGetCommsStatsResponse { connection_status: string; } diff --git a/bindings/src/types/validator-node-client/VNGetConnectionsResponse.ts b/bindings/src/types/validator-node-client/VNGetConnectionsResponse.ts new file mode 100644 index 000000000..c1a690536 --- /dev/null +++ b/bindings/src/types/validator-node-client/VNGetConnectionsResponse.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 { VNConnection } from "./VNConnection"; + +export interface VNGetConnectionsResponse { + connections: Array; +} diff --git a/bindings/src/types/validator-node-client/GetIdentityResponse.ts b/bindings/src/types/validator-node-client/VNGetIdentityResponse.ts similarity index 87% rename from bindings/src/types/validator-node-client/GetIdentityResponse.ts rename to bindings/src/types/validator-node-client/VNGetIdentityResponse.ts index 0b0f977fe..45a57ddf8 100644 --- a/bindings/src/types/validator-node-client/GetIdentityResponse.ts +++ b/bindings/src/types/validator-node-client/VNGetIdentityResponse.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface GetIdentityResponse { +export interface VNGetIdentityResponse { peer_id: string; public_key: string; public_addresses: Array; diff --git a/bindings/src/types/validator-node-client/GetSubstateRequest.ts b/bindings/src/types/validator-node-client/VNGetSubstateRequest.ts similarity index 83% rename from bindings/src/types/validator-node-client/GetSubstateRequest.ts rename to bindings/src/types/validator-node-client/VNGetSubstateRequest.ts index bb81a22f6..6c89c885f 100644 --- a/bindings/src/types/validator-node-client/GetSubstateRequest.ts +++ b/bindings/src/types/validator-node-client/VNGetSubstateRequest.ts @@ -1,7 +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 { +export interface VNGetSubstateRequest { address: SubstateId; version: number; } diff --git a/bindings/src/types/validator-node-client/GetSubstateResponse.ts b/bindings/src/types/validator-node-client/VNGetSubstateResponse.ts similarity index 88% rename from bindings/src/types/validator-node-client/GetSubstateResponse.ts rename to bindings/src/types/validator-node-client/VNGetSubstateResponse.ts index 336ef4c6b..dc3298d67 100644 --- a/bindings/src/types/validator-node-client/GetSubstateResponse.ts +++ b/bindings/src/types/validator-node-client/VNGetSubstateResponse.ts @@ -2,7 +2,7 @@ import type { SubstateStatus } from "./SubstateStatus"; import type { SubstateValue } from "../SubstateValue"; -export interface GetSubstateResponse { +export interface VNGetSubstateResponse { value: SubstateValue | null; created_by_tx: string | null; status: SubstateStatus; diff --git a/bindings/src/types/validator-node-client/GetTransactionResultRequest.ts b/bindings/src/types/validator-node-client/VNGetTransactionResultRequest.ts similarity index 73% rename from bindings/src/types/validator-node-client/GetTransactionResultRequest.ts rename to bindings/src/types/validator-node-client/VNGetTransactionResultRequest.ts index 232705435..ae01f3e30 100644 --- a/bindings/src/types/validator-node-client/GetTransactionResultRequest.ts +++ b/bindings/src/types/validator-node-client/VNGetTransactionResultRequest.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface GetTransactionResultRequest { +export interface VNGetTransactionResultRequest { transaction_id: string; } diff --git a/bindings/src/types/validator-node-client/GetTransactionResultResponse.ts b/bindings/src/types/validator-node-client/VNGetTransactionResultResponse.ts similarity index 88% rename from bindings/src/types/validator-node-client/GetTransactionResultResponse.ts rename to bindings/src/types/validator-node-client/VNGetTransactionResultResponse.ts index 74524820c..dc9dd1e32 100644 --- a/bindings/src/types/validator-node-client/GetTransactionResultResponse.ts +++ b/bindings/src/types/validator-node-client/VNGetTransactionResultResponse.ts @@ -2,7 +2,7 @@ import type { Decision } from "../Decision"; import type { ExecuteResult } from "../ExecuteResult"; -export interface GetTransactionResultResponse { +export interface VNGetTransactionResultResponse { result: ExecuteResult | null; final_decision: Decision | null; finalized_time: { secs: number; nanos: number } | null; diff --git a/bindings/src/types/validator-node-client/LogEntry.ts b/bindings/src/types/validator-node-client/VNLogEntry.ts similarity index 60% rename from bindings/src/types/validator-node-client/LogEntry.ts rename to bindings/src/types/validator-node-client/VNLogEntry.ts index 6c253638f..dca464f93 100644 --- a/bindings/src/types/validator-node-client/LogEntry.ts +++ b/bindings/src/types/validator-node-client/VNLogEntry.ts @@ -1,8 +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"; +import type { VNLogLevel } from "./VNLogLevel"; -export interface LogEntry { +export interface VNLogEntry { timestamp: number; message: string; - level: LogLevel; + level: VNLogLevel; } diff --git a/bindings/src/types/tari-indexer-client/ConnectionDirection.ts b/bindings/src/types/validator-node-client/VNLogLevel.ts similarity index 63% rename from bindings/src/types/tari-indexer-client/ConnectionDirection.ts rename to bindings/src/types/validator-node-client/VNLogLevel.ts index 45100c453..2e546d0c6 100644 --- a/bindings/src/types/tari-indexer-client/ConnectionDirection.ts +++ b/bindings/src/types/validator-node-client/VNLogLevel.ts @@ -1,3 +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"; +export type VNLogLevel = "Error" | "Warn" | "Info" | "Debug"; diff --git a/bindings/src/types/validator-node-client/SubmitTransactionRequest.ts b/bindings/src/types/validator-node-client/VNSubmitTransactionRequest.ts similarity index 82% rename from bindings/src/types/validator-node-client/SubmitTransactionRequest.ts rename to bindings/src/types/validator-node-client/VNSubmitTransactionRequest.ts index 7b38e3a3e..aab90662f 100644 --- a/bindings/src/types/validator-node-client/SubmitTransactionRequest.ts +++ b/bindings/src/types/validator-node-client/VNSubmitTransactionRequest.ts @@ -1,7 +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 { +export interface VNSubmitTransactionRequest { transaction: Transaction; is_dry_run: boolean; } diff --git a/bindings/src/types/validator-node-client/SubmitTransactionResponse.ts b/bindings/src/types/validator-node-client/VNSubmitTransactionResponse.ts similarity index 85% rename from bindings/src/types/validator-node-client/SubmitTransactionResponse.ts rename to bindings/src/types/validator-node-client/VNSubmitTransactionResponse.ts index 9cc4c75d9..b32b6f171 100644 --- a/bindings/src/types/validator-node-client/SubmitTransactionResponse.ts +++ b/bindings/src/types/validator-node-client/VNSubmitTransactionResponse.ts @@ -1,7 +1,7 @@ // 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"; -export interface SubmitTransactionResponse { +export interface VNSubmitTransactionResponse { transaction_id: string; dry_run_result: DryRunTransactionFinalizeResult | null; } diff --git a/bindings/src/validator-node-client.ts b/bindings/src/validator-node-client.ts index f0fda897e..263fcdc93 100644 --- a/bindings/src/validator-node-client.ts +++ b/bindings/src/validator-node-client.ts @@ -1,59 +1,59 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -export * from "./types/validator-node-client/GetAllVnsRequest"; export * from "./types/validator-node-client/GetTransactionResponse"; export * from "./types/validator-node-client/TemplateAbi"; export * from "./types/validator-node-client/GetStateResponse"; export * from "./types/validator-node-client/GetRecentTransactionsResponse"; -export * from "./types/validator-node-client/GetSubstateRequest"; -export * from "./types/validator-node-client/Connection"; export * from "./types/validator-node-client/GetNetworkCommitteeResponse"; +export * from "./types/validator-node-client/VNGetTransactionResultRequest"; export * from "./types/validator-node-client/GetBlockResponse"; export * from "./types/validator-node-client/GetSubstatesByTransactionRequest"; +export * from "./types/validator-node-client/VNFunctionDef"; export * from "./types/validator-node-client/GetTemplateRequest"; -export * from "./types/validator-node-client/GetSubstateResponse"; -export * from "./types/validator-node-client/GetAllVnsResponse"; export * from "./types/validator-node-client/GetShardKeyResponse"; +export * from "./types/validator-node-client/VNGetSubstateRequest"; +export * from "./types/validator-node-client/VNArgDef"; export * from "./types/validator-node-client/GetTxPoolResponse"; +export * from "./types/validator-node-client/VNGetAllVnsResponse"; +export * from "./types/validator-node-client/VNGetTransactionResultResponse"; export * from "./types/validator-node-client/GetTemplatesResponse"; -export * from "./types/validator-node-client/GetTransactionResultRequest"; +export * from "./types/validator-node-client/VNGetConnectionsResponse"; export * from "./types/validator-node-client/TemplateMetadata"; -export * from "./types/validator-node-client/SubmitTransactionRequest"; +export * from "./types/validator-node-client/VNLogEntry"; export * from "./types/validator-node-client/GetShardKeyRequest"; +export * from "./types/validator-node-client/VNGetAllVnsRequest"; export * from "./types/validator-node-client/GetRecentTransactionsRequest"; export * from "./types/validator-node-client/GetSubstatesByTransactionResponse"; -export * from "./types/validator-node-client/GetTransactionResultResponse"; +export * from "./types/validator-node-client/VNConnectionDirection"; +export * from "./types/validator-node-client/VNSubmitTransactionRequest"; export * from "./types/validator-node-client/GetTemplateResponse"; -export * from "./types/validator-node-client/LogEntry"; export * from "./types/validator-node-client/ValidatorFee"; +export * from "./types/validator-node-client/VNGetIdentityResponse"; export * from "./types/validator-node-client/GetBlocksRequest"; export * from "./types/validator-node-client/ListBlocksRequest"; -export * from "./types/validator-node-client/GetIdentityResponse"; export * from "./types/validator-node-client/SubstateStatus"; export * from "./types/validator-node-client/GetMempoolStatsResponse"; export * from "./types/validator-node-client/GetCommitteeResponse"; -export * from "./types/validator-node-client/CommitteeShardInfo"; export * from "./types/validator-node-client/GetBlocksCountResponse"; -export * from "./types/validator-node-client/SubmitTransactionResponse"; export * from "./types/validator-node-client/GetEpochManagerStatsResponse"; export * from "./types/validator-node-client/GetStateRequest"; export * from "./types/validator-node-client/GetBlocksResponse"; export * from "./types/validator-node-client/ListBlocksResponse"; -export * from "./types/validator-node-client/ConnectionDirection"; +export * from "./types/validator-node-client/VNAddPeerRequest"; export * from "./types/validator-node-client/GetCommitteeRequest"; -export * from "./types/validator-node-client/FunctionDef"; +export * from "./types/validator-node-client/VNCommitteeShardInfo"; +export * from "./types/validator-node-client/VNGetSubstateResponse"; export * from "./types/validator-node-client/ValidatorNode"; export * from "./types/validator-node-client/VNGetValidatorFeesResponse"; export * from "./types/validator-node-client/GetFilteredBlocksCountRequest"; -export * from "./types/validator-node-client/AddPeerRequest"; export * from "./types/validator-node-client/GetTransactionRequest"; -export * from "./types/validator-node-client/GetCommsStatsResponse"; +export * from "./types/validator-node-client/VNAddPeerResponse"; +export * from "./types/validator-node-client/VNGetCommsStatsResponse"; export * from "./types/validator-node-client/GetTemplatesRequest"; -export * from "./types/validator-node-client/LogLevel"; export * from "./types/validator-node-client/GetBlockRequest"; -export * from "./types/validator-node-client/ArgDef"; +export * from "./types/validator-node-client/VNConnection"; +export * from "./types/validator-node-client/VNSubmitTransactionResponse"; export * from "./types/validator-node-client/VNGetValidatorFeesRequest"; -export * from "./types/validator-node-client/AddPeerResponse"; -export * from "./types/validator-node-client/GetConnectionsResponse"; +export * from "./types/validator-node-client/VNLogLevel"; export * from "./types/validator-node-client/DryRunTransactionFinalizeResult"; diff --git a/clients/tari_indexer_client/src/types.rs b/clients/tari_indexer_client/src/types.rs index a4582026b..3eabeee1f 100644 --- a/clients/tari_indexer_client/src/types.rs +++ b/clients/tari_indexer_client/src/types.rs @@ -1,24 +1,24 @@ // Copyright 2023 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -use std::{sync::Arc, time::Duration}; +use std::{ sync::Arc, time::Duration }; use multiaddr::Multiaddr; -use serde::{Deserialize, Serialize}; +use serde::{ Deserialize, Serialize }; use serde_json::Value as JsonValue; -use serde_with::{serde_as, DisplayFromStr}; +use serde_with::{ serde_as, DisplayFromStr }; use tari_base_node_client::types::BaseLayerValidatorNode; -use tari_common_types::types::{FixedHash, PublicKey}; -use tari_dan_common_types::{substate_type::SubstateType, Epoch}; +use tari_common_types::types::{ FixedHash, PublicKey }; +use tari_dan_common_types::{ substate_type::SubstateType, Epoch }; use tari_dan_storage::consensus_models::Decision; use tari_engine_types::{ commit_result::ExecuteResult, serde_with as serde_tools, - substate::{Substate, SubstateId}, + substate::{ Substate, SubstateId }, TemplateAddress, }; use tari_template_abi::TemplateDef; -use tari_transaction::{SubstateRequirement, Transaction, TransactionId}; +use tari_transaction::{ SubstateRequirement, Transaction, TransactionId }; #[cfg(feature = "ts")] use ts_rs::TS; @@ -67,7 +67,11 @@ pub struct ListSubstateItem { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetSubstateRequest" + ) )] pub struct GetSubstateRequest { #[serde(with = "serde_tools::string")] @@ -81,7 +85,11 @@ pub struct GetSubstateRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetSubstateResponse" + ) )] pub struct GetSubstateResponse { #[serde(with = "serde_tools::string")] @@ -125,7 +133,11 @@ pub struct InspectSubstateResponse { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerSubmitTransactionRequest" + ) )] pub struct SubmitTransactionRequest { pub transaction: Transaction, @@ -138,7 +150,11 @@ pub struct SubmitTransactionRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerSubmitTransactionResponse" + ) )] pub struct SubmitTransactionResponse { #[cfg_attr(feature = "ts", ts(type = "string"))] @@ -188,7 +204,11 @@ pub struct TemplateMetadata { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetTransactionResultRequest" + ) )] pub struct GetTransactionResultRequest { #[cfg_attr(feature = "ts", ts(type = "string"))] @@ -199,7 +219,11 @@ pub struct GetTransactionResultRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetTransactionResultResponse" + ) )] pub struct GetTransactionResultResponse { pub result: IndexerTransactionFinalizedResult, @@ -230,7 +254,11 @@ pub enum IndexerTransactionFinalizedResult { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetIdentityResponse" + ) )] pub struct GetIdentityResponse { pub peer_id: String, @@ -244,7 +272,11 @@ pub struct GetIdentityResponse { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetAllVnsRequest" + ) )] pub struct GetAllVnsRequest { pub epoch: Epoch, @@ -254,7 +286,11 @@ pub struct GetAllVnsRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetAllVnsResponse" + ) )] pub struct GetAllVnsResponse { pub vns: Vec, @@ -362,7 +398,11 @@ pub struct GetRelatedTransactionsResponse { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerAddPeerRequest" + ) )] pub struct AddPeerRequest { #[cfg_attr(feature = "ts", ts(type = "string"))] @@ -376,7 +416,11 @@ pub struct AddPeerRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerAddPeerResponse" + ) )] pub struct AddPeerResponse {} @@ -384,7 +428,11 @@ pub struct AddPeerResponse {} #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetCommsStatsResponse" + ) )] pub struct GetCommsStatsResponse { pub connection_status: String, @@ -394,7 +442,11 @@ pub struct GetCommsStatsResponse { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetEpochManagerStatsResponse" + ) )] pub struct GetEpochManagerStatsResponse { pub current_epoch: Epoch, @@ -408,7 +460,11 @@ pub struct GetEpochManagerStatsResponse { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerConnection" + ) )] pub struct Connection { pub connection_id: String, @@ -427,7 +483,11 @@ pub struct Connection { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerConnectionDirection" + ) )] pub enum ConnectionDirection { Inbound, @@ -438,7 +498,11 @@ pub enum ConnectionDirection { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/tari-indexer-client/") + ts( + export, + export_to = "../../bindings/src/types/tari-indexer-client/", + rename = "IndexerGetConnectionsResponse" + ) )] pub struct GetConnectionsResponse { pub connections: Vec, diff --git a/clients/validator_node_client/src/types.rs b/clients/validator_node_client/src/types.rs index a0c3f219e..470ebda99 100644 --- a/clients/validator_node_client/src/types.rs +++ b/clients/validator_node_client/src/types.rs @@ -20,14 +20,14 @@ // 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::{ops::RangeInclusive, sync::Arc, time::Duration}; +use std::{ ops::RangeInclusive, sync::Arc, time::Duration }; use multiaddr::Multiaddr; -use serde::{Deserialize, Serialize}; +use serde::{ Deserialize, Serialize }; use tari_base_node_client::types::BaseLayerValidatorNode; -use tari_common_types::types::{FixedHash, PublicKey}; +use tari_common_types::types::{ FixedHash, PublicKey }; use tari_dan_common_types::{ - committee::{Committee, CommitteeInfo}, + committee::{ Committee, CommitteeInfo }, shard::Shard, Epoch, PeerAddress, @@ -47,13 +47,13 @@ use tari_dan_storage::{ Ordering, }; use tari_engine_types::{ - commit_result::{ExecuteResult, FinalizeResult}, + commit_result::{ ExecuteResult, FinalizeResult }, fees::FeeCostBreakdown, serde_with, - substate::{SubstateId, SubstateValue}, + substate::{ SubstateId, SubstateValue }, TemplateAddress, }; -use tari_transaction::{Transaction, TransactionId}; +use tari_transaction::{ Transaction, TransactionId }; #[cfg(feature = "ts")] use ts_rs::TS; @@ -61,7 +61,11 @@ use ts_rs::TS; #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNGetIdentityResponse" + ) )] pub struct GetIdentityResponse { pub peer_id: String, @@ -113,7 +117,11 @@ pub struct TemplateAbi { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNFunctionDef" + ) )] pub struct FunctionDef { pub name: String, @@ -126,7 +134,7 @@ pub struct FunctionDef { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts(export, export_to = "../../bindings/src/types/validator-node-client/", rename = "VNArgDef") )] pub struct ArgDef { pub name: String, @@ -178,7 +186,11 @@ pub struct TemplateMetadata { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNSubmitTransactionRequest" + ) )] pub struct SubmitTransactionRequest { pub transaction: Transaction, @@ -189,7 +201,11 @@ pub struct SubmitTransactionRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNSubmitTransactionResponse" + ) )] pub struct SubmitTransactionResponse { #[cfg_attr(feature = "ts", ts(type = "string"))] @@ -214,7 +230,11 @@ pub struct DryRunTransactionFinalizeResult { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNGetAllVnsRequest" + ) )] pub struct GetAllVnsRequest { pub epoch: Epoch, @@ -224,7 +244,11 @@ pub struct GetAllVnsRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNGetAllVnsResponse" + ) )] pub struct GetAllVnsResponse { pub vns: Vec, @@ -276,7 +300,11 @@ pub struct GetSubstatesByTransactionResponse { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNGetTransactionResultRequest" + ) )] pub struct GetTransactionResultRequest { #[cfg_attr(feature = "ts", ts(type = "string"))] @@ -287,7 +315,11 @@ pub struct GetTransactionResultRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNGetTransactionResultResponse" + ) )] pub struct GetTransactionResultResponse { pub result: Option, @@ -385,7 +417,7 @@ pub struct GetBlocksCountResponse { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts(export, export_to = "../../bindings/src/types/validator-node-client/", rename = "VNLogEntry") )] pub struct LogEntry { #[cfg_attr(feature = "ts", ts(type = "number"))] @@ -398,7 +430,7 @@ pub struct LogEntry { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts(export, export_to = "../../bindings/src/types/validator-node-client/", rename = "VNLogLevel") )] pub enum LogLevel { Error, @@ -443,7 +475,11 @@ pub struct GetNetworkCommitteeResponse { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNCommitteeShardInfo" + ) )] pub struct CommitteeShardInfo { #[cfg_attr(feature = "ts", ts(type = "number"))] @@ -530,7 +566,11 @@ pub struct GetStateResponse { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNGetSubstateRequest" + ) )] pub struct GetSubstateRequest { pub address: SubstateId, @@ -541,7 +581,11 @@ pub struct GetSubstateRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNGetSubstateResponse" + ) )] pub struct GetSubstateResponse { pub value: Option, @@ -566,7 +610,11 @@ pub enum SubstateStatus { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNAddPeerRequest" + ) )] pub struct AddPeerRequest { #[cfg_attr(feature = "ts", ts(type = "string"))] @@ -580,7 +628,11 @@ pub struct AddPeerRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNAddPeerResponse" + ) )] pub struct AddPeerResponse {} @@ -588,7 +640,11 @@ pub struct AddPeerResponse {} #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNGetCommsStatsResponse" + ) )] pub struct GetCommsStatsResponse { pub connection_status: String, @@ -718,7 +774,11 @@ pub struct GetFilteredBlocksCountRequest { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNConnection" + ) )] pub struct Connection { pub connection_id: String, @@ -737,7 +797,11 @@ pub struct Connection { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNConnectionDirection" + ) )] pub enum ConnectionDirection { Inbound, @@ -748,7 +812,11 @@ pub enum ConnectionDirection { #[cfg_attr( feature = "ts", derive(TS), - ts(export, export_to = "../../bindings/src/types/validator-node-client/") + ts( + export, + export_to = "../../bindings/src/types/validator-node-client/", + rename = "VNGetConnectionsResponse" + ) )] pub struct GetConnectionsResponse { pub connections: Vec,