diff --git a/.changeset/rename-provider-to-wireprovider.md b/.changeset/rename-provider-to-wireprovider.md deleted file mode 100644 index a4b59d9b..00000000 --- a/.changeset/rename-provider-to-wireprovider.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@parity/truapi": minor ---- - -Rename the exported `Provider` transport type to `WireProvider` to make its role explicit. It is the low-level SCALE-wire-frame pipe (a `MessagePort` or iframe `postMessage` channel) that `createTransport` runs on. The `createIframeProvider` / `createMessagePortProvider` factories are unchanged; only the type name moves. Consumers importing `Provider` should import `WireProvider` instead. diff --git a/.changeset/truapi-sandbox-bootstrap.md b/.changeset/truapi-sandbox-bootstrap.md deleted file mode 100644 index 1b94d436..00000000 --- a/.changeset/truapi-sandbox-bootstrap.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@parity/truapi": minor ---- - -Add the `@parity/truapi/sandbox` entry point: host-environment detection (`isCorrectEnvironment`), a lazily-built cached client (`getClientSync`, `null` outside a host container), and a `subscribeConnectionStatus` connected/disconnected listener. Browser-embedded hosts can bootstrap a client without assembling the transport by hand. diff --git a/.github/PULL_REQUEST_TEMPLATE/release.md b/.github/PULL_REQUEST_TEMPLATE/release.md index f213a957..caecc733 100644 --- a/.github/PULL_REQUEST_TEMPLATE/release.md +++ b/.github/PULL_REQUEST_TEMPLATE/release.md @@ -15,6 +15,7 @@ - [ ] Ran `npm run changeset` and selected the package + bump type (patch / minor / major) - [ ] Ran `npm run version-packages` to consume the changeset - [ ] `js/packages/truapi/package.json` version is bumped +- [ ] `@parity/truapi-host` depends on `^` - [ ] `js/packages/truapi/CHANGELOG.md` has the new entry - [ ] `rust/crates/truapi/Cargo.toml` version matches `js/packages/truapi/package.json` - [ ] No leftover files under `.changeset/` (other than `config.json`) diff --git a/.github/workflows/release-version-check.yml b/.github/workflows/release-version-check.yml index 659d13aa..b0d96299 100644 --- a/.github/workflows/release-version-check.yml +++ b/.github/workflows/release-version-check.yml @@ -16,14 +16,15 @@ jobs: with: persist-credentials: false - - name: Verify package.json and Cargo.toml versions match + - name: Verify release versions + run: npm run check-release-versions + + - name: Verify changesets were consumed run: | set -euo pipefail - pkg_version=$(jq -r '.version' js/packages/truapi/package.json) - cargo_version=$(awk -F'"' '/^version = "/ { print $2; exit }' rust/crates/truapi/Cargo.toml) - echo "package.json: ${pkg_version}" - echo "Cargo.toml: ${cargo_version}" - if [ "${pkg_version}" != "${cargo_version}" ]; then - echo "::error::Version mismatch — js/packages/truapi/package.json (${pkg_version}) and rust/crates/truapi/Cargo.toml (${cargo_version}) must match on a release: PR. Run \`npm run version-packages\` from the repo root to sync." + remaining_changesets="$(find .changeset -maxdepth 1 -type f -name '*.md' -print)" + if [ -n "${remaining_changesets}" ]; then + echo "::error::Release PR still contains unconsumed changesets. Run npm run version-packages." + echo "${remaining_changesets}" exit 1 fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2af249ba..e29146f4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,38 +45,57 @@ jobs: - name: Resolve target packages id: version + env: + RELEASE_COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }} run: | set -euo pipefail - packages=( - "@parity/truapi js/packages/truapi" - "@parity/truapi-host js/packages/truapi-host" - ) - pending="$(mktemp)" - for entry in "${packages[@]}"; do - name="${entry%% *}" - path="${entry#* }" - version="$(jq -r '.version' "${path}/package.json")" - tag="${name}@${version}" - if npm_status="$(npm view "${tag}" version --registry=https://registry.npmjs.org 2>&1)"; then - echo "Package ${tag} already exists on npm; skipping ${name}." - elif grep -Eq 'E404|404 Not Found' <<< "${npm_status}"; then - echo "Publishing ${tag}." - echo "${name}|${path}|${version}|${tag}" >> "${pending}" - else - echo "${npm_status}" >&2 + subject="${RELEASE_COMMIT_MESSAGE%%$'\n'*}" + release="${subject#release: }" + name="${release% *}" + declared_version="${release##* }" + + case "${name}" in + @parity/truapi) path="js/packages/truapi" ;; + @parity/truapi-host) path="js/packages/truapi-host" ;; + *) + echo "::error::Unsupported release commit subject: ${subject}" exit 1 - fi - done - if [ -s "${pending}" ]; then + ;; + esac + + version="$(jq -r '.version' "${path}/package.json")" + if [ "${declared_version}" != "${version}" ]; then + echo "::error::Release subject declares ${declared_version}, but ${path}/package.json is ${version}." + exit 1 + fi + + tag="${name}@${version}" + if npm_status="$(npm view "${tag}" version --registry=https://registry.npmjs.org 2>&1)"; then + echo "Package ${tag} already exists on npm; nothing to publish." + echo "proceed=false" >> "$GITHUB_OUTPUT" + elif grep -Eq 'E404|404 Not Found' <<< "${npm_status}"; then + echo "Publishing ${tag}." echo "proceed=true" >> "$GITHUB_OUTPUT" { echo "packages<> "$GITHUB_OUTPUT" else - echo "No unpublished package tags found." - echo "proceed=false" >> "$GITHUB_OUTPUT" + echo "${npm_status}" >&2 + exit 1 + fi + + - name: Verify release manifests + if: steps.version.outputs.proceed == 'true' + run: | + set -euo pipefail + npm run check-release-versions + remaining_changesets="$(find .changeset -maxdepth 1 -type f -name '*.md' -print)" + if [ -n "${remaining_changesets}" ]; then + echo "::error::Release commit still contains unconsumed changesets. Run npm run version-packages." + echo "${remaining_changesets}" + exit 1 fi - if: steps.version.outputs.proceed == 'true' diff --git a/Cargo.lock b/Cargo.lock index 932a28dd..88f32c8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3641,7 +3641,7 @@ dependencies = [ [[package]] name = "truapi" -version = "0.3.1" +version = "0.4.0" dependencies = [ "derive_more 2.1.1", "futures", diff --git a/docs/RELEASE_PROCESS.md b/docs/RELEASE_PROCESS.md index bc52db8b..94636066 100644 --- a/docs/RELEASE_PROCESS.md +++ b/docs/RELEASE_PROCESS.md @@ -33,11 +33,13 @@ npm run version-packages # consumes the changeset, bumps package.json + writ The first command writes a markdown file under `.changeset/`; the second consumes it, bumps the selected package `package.json`, appends the package `CHANGELOG.md`, deletes the changeset file, and then runs -`scripts/sync-cargo-version.mjs` to keep `rust/crates/truapi/Cargo.toml` -aligned with `js/packages/truapi/package.json`. A protocol release should -therefore include the `@parity/truapi` package, its changelog, and the Cargo -version. A host-runtime-only release can bump `@parity/truapi-host` without -changing the Rust crate version. +`scripts/sync-release-versions.mjs`. That script keeps +`rust/crates/truapi/Cargo.toml` and the host package's `@parity/truapi` +dependency aligned with `js/packages/truapi/package.json`; the command then +refreshes `package-lock.json`. A protocol release should therefore include the +`@parity/truapi` package, its changelog, the Cargo version, the host dependency, +and the lockfile. A host-runtime-only release can bump +`@parity/truapi-host` without changing the Rust crate version. ### 3. Open a release PR diff --git a/js/packages/truapi-host/package.json b/js/packages/truapi-host/package.json index f3988d74..ec03a8bd 100644 --- a/js/packages/truapi-host/package.json +++ b/js/packages/truapi-host/package.json @@ -49,7 +49,7 @@ "test": "bun test" }, "dependencies": { - "@parity/truapi": "file:../truapi" + "@parity/truapi": "^0.4.0" }, "devDependencies": { "@types/bun": "^1.3.0", diff --git a/js/packages/truapi/CHANGELOG.md b/js/packages/truapi/CHANGELOG.md index e7b31f8e..b4d13ae1 100644 --- a/js/packages/truapi/CHANGELOG.md +++ b/js/packages/truapi/CHANGELOG.md @@ -1,5 +1,20 @@ # @parity/truapi +## 0.4.0 + +### Minor Changes + +- Add the `coinPayment` client namespace (RFC 0017 Coinage Payment): `createPurse`, `queryPurse`, `rebalancePurse`, `deletePurse`, `deposit`, `refund`, `createCheque`, `createReceivable`, and `listenForPayment`, with the `CoinPayment*` / `HostCoinPayment*` / `VersionedHostCoinPayment*` request/response/error types and their wire discriminants. + + **Breaking:** the `CallError` SCALE codec now decodes to a tagged `CallErrorValue` union (`Domain` / `Denied` / `Unsupported` / `MalformedFrame` / `HostFailure`) instead of projecting only the domain error and throwing on framework-level failures. The `Transport.truapiVersion` field is removed and `Transport.codecVersion` is deprecated; generated handshake calls read the codec version directly. + +## 0.3.2 + +### Minor Changes + +- Rename the exported `Provider` transport type to `WireProvider` to make its role explicit. It is the low-level SCALE-wire-frame pipe (a `MessagePort` or iframe `postMessage` channel) that `createTransport` runs on. The `createIframeProvider` / `createMessagePortProvider` factories are unchanged; only the type name moves. Consumers importing `Provider` should import `WireProvider` instead. +- Add the `@parity/truapi/sandbox` entry point: host-environment detection (`isCorrectEnvironment`), a lazily-built cached client (`getClientSync`, `null` outside a host container), and a `subscribeConnectionStatus` connected/disconnected listener. Browser-embedded hosts can bootstrap a client without assembling the transport by hand. + ## 0.3.1 ### Patch Changes diff --git a/js/packages/truapi/package.json b/js/packages/truapi/package.json index db961565..51b0cb90 100644 --- a/js/packages/truapi/package.json +++ b/js/packages/truapi/package.json @@ -1,6 +1,6 @@ { "name": "@parity/truapi", - "version": "0.3.1", + "version": "0.4.0", "description": "TrUAPI TypeScript transport, SCALE codecs, and generated API client", "license": "MIT", "author": "Parity Technologies ", diff --git a/js/packages/truapi/src/explorer/codegen/versions/0.4.0/services.ts b/js/packages/truapi/src/explorer/codegen/versions/0.4.0/services.ts new file mode 100644 index 00000000..ae8c5c76 --- /dev/null +++ b/js/packages/truapi/src/explorer/codegen/versions/0.4.0/services.ts @@ -0,0 +1,788 @@ +// Auto-generated by truapi-codegen. Do not edit. +import type { ServiceInfo } from "../../../../playground/services-types.js"; + +export const services: ServiceInfo[] = [ + { + name: "Account", + methods: [ + { + name: "connection_status_subscribe", + type: "subscription", + signature: + "connectionStatusSubscribe(): ObservableLike", + docUrl: + "api/account/trait.Account.html#method.connection_status_subscribe", + description: "Subscribe to account connection status changes.", + responseType: "host-account-connection-status-subscribe-item", + }, + { + name: "get_account", + type: "unary", + signature: + "getAccount(request: HostAccountGetRequest): Promise>>", + docUrl: "api/account/trait.Account.html#method.get_account", + description: "Retrieve a product-scoped account.", + requestDescription: "HostAccountGetRequest", + requestType: "host-account-get-request", + responseType: "host-account-get-response", + }, + { + name: "get_account_alias", + type: "unary", + signature: + "getAccountAlias(request: HostAccountGetAliasRequest): Promise>>", + docUrl: "api/account/trait.Account.html#method.get_account_alias", + description: "Retrieve a contextual alias for a product account.", + requestDescription: "HostAccountGetAliasRequest", + requestType: "host-account-get-alias-request", + responseType: "host-account-get-alias-response", + }, + { + name: "create_account_proof", + type: "unary", + signature: + "createAccountProof(request: HostAccountCreateProofRequest): Promise>>", + docUrl: "api/account/trait.Account.html#method.create_account_proof", + description: "Generate a ring VRF proof for a product account.", + requestDescription: "HostAccountCreateProofRequest", + requestType: "host-account-create-proof-request", + responseType: "host-account-create-proof-response", + }, + { + name: "get_legacy_accounts", + type: "unary", + signature: + "getLegacyAccounts(): Promise>>", + docUrl: "api/account/trait.Account.html#method.get_legacy_accounts", + description: "List non-product accounts the user owns.", + responseType: "host-get-legacy-accounts-response", + }, + { + name: "get_user_id", + type: "unary", + signature: + "getUserId(): Promise>>", + docUrl: "api/account/trait.Account.html#method.get_user_id", + description: "Fetch the user's primary identity.", + responseType: "host-get-user-id-response", + }, + { + name: "request_login", + type: "unary", + signature: + "requestLogin(request: HostRequestLoginRequest): Promise>>", + docUrl: "api/account/trait.Account.html#method.request_login", + description: + 'Request the host to present the login flow to the user.\n\nProducts should call this in response to a user action (e.g. tapping a\n"Sign in" button), not automatically on load.', + requestDescription: "HostRequestLoginRequest", + requestType: "host-request-login-request", + responseType: "host-request-login-response", + }, + ], + }, + { + name: "Chain", + methods: [ + { + name: "follow_head_subscribe", + type: "subscription", + signature: + "followHeadSubscribe(request: RemoteChainHeadFollowRequest): ObservableLike", + docUrl: "api/chain/trait.Chain.html#method.follow_head_subscribe", + description: "Follow the chain head and receive block events.", + requestDescription: "RemoteChainHeadFollowRequest", + requestType: "remote-chain-head-follow-request", + responseType: "remote-chain-head-follow-item", + }, + { + name: "get_head_header", + type: "unary", + signature: + "getHeadHeader(request: RemoteChainHeadHeaderRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.get_head_header", + description: "Fetch a block header.", + requestDescription: "RemoteChainHeadHeaderRequest", + requestType: "remote-chain-head-header-request", + responseType: "remote-chain-head-header-response", + }, + { + name: "get_head_body", + type: "unary", + signature: + "getHeadBody(request: RemoteChainHeadBodyRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.get_head_body", + description: "Fetch a block body.", + requestDescription: "RemoteChainHeadBodyRequest", + requestType: "remote-chain-head-body-request", + responseType: "remote-chain-head-body-response", + }, + { + name: "get_head_storage", + type: "unary", + signature: + "getHeadStorage(request: RemoteChainHeadStorageRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.get_head_storage", + description: "Query runtime storage at a specific block.", + requestDescription: "RemoteChainHeadStorageRequest", + requestType: "remote-chain-head-storage-request", + responseType: "remote-chain-head-storage-response", + }, + { + name: "call_head", + type: "unary", + signature: + "callHead(request: RemoteChainHeadCallRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.call_head", + description: "Invoke a runtime call at a specific block.", + requestDescription: "RemoteChainHeadCallRequest", + requestType: "remote-chain-head-call-request", + responseType: "remote-chain-head-call-response", + }, + { + name: "unpin_head", + type: "unary", + signature: + "unpinHead(request: RemoteChainHeadUnpinRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.unpin_head", + description: "Release pinned blocks.", + requestDescription: "RemoteChainHeadUnpinRequest", + requestType: "remote-chain-head-unpin-request", + }, + { + name: "continue_head", + type: "unary", + signature: + "continueHead(request: RemoteChainHeadContinueRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.continue_head", + description: "Continue a paused chain-head operation.", + requestDescription: "RemoteChainHeadContinueRequest", + requestType: "remote-chain-head-continue-request", + }, + { + name: "stop_head_operation", + type: "unary", + signature: + "stopHeadOperation(request: RemoteChainHeadStopOperationRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.stop_head_operation", + description: "Stop a chain-head operation.", + requestDescription: "RemoteChainHeadStopOperationRequest", + requestType: "remote-chain-head-stop-operation-request", + }, + { + name: "get_spec_genesis_hash", + type: "unary", + signature: + "getSpecGenesisHash(request: RemoteChainSpecGenesisHashRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.get_spec_genesis_hash", + description: "Fetch the canonical genesis hash for a chain.", + requestDescription: "RemoteChainSpecGenesisHashRequest", + requestType: "remote-chain-spec-genesis-hash-request", + responseType: "remote-chain-spec-genesis-hash-response", + }, + { + name: "get_spec_chain_name", + type: "unary", + signature: + "getSpecChainName(request: RemoteChainSpecChainNameRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.get_spec_chain_name", + description: "Fetch the display name of a chain.", + requestDescription: "RemoteChainSpecChainNameRequest", + requestType: "remote-chain-spec-chain-name-request", + responseType: "remote-chain-spec-chain-name-response", + }, + { + name: "get_spec_properties", + type: "unary", + signature: + "getSpecProperties(request: RemoteChainSpecPropertiesRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.get_spec_properties", + description: "Fetch the JSON-encoded properties of a chain.", + requestDescription: "RemoteChainSpecPropertiesRequest", + requestType: "remote-chain-spec-properties-request", + responseType: "remote-chain-spec-properties-response", + }, + { + name: "broadcast_transaction", + type: "unary", + signature: + "broadcastTransaction(request: RemoteChainTransactionBroadcastRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.broadcast_transaction", + description: "Broadcast a signed transaction.", + requestDescription: "RemoteChainTransactionBroadcastRequest", + requestType: "remote-chain-transaction-broadcast-request", + responseType: "remote-chain-transaction-broadcast-response", + }, + { + name: "stop_transaction", + type: "unary", + signature: + "stopTransaction(request: RemoteChainTransactionStopRequest): Promise>>", + docUrl: "api/chain/trait.Chain.html#method.stop_transaction", + description: "Stop a transaction broadcast.", + requestDescription: "RemoteChainTransactionStopRequest", + requestType: "remote-chain-transaction-stop-request", + }, + ], + }, + { + name: "Chat", + methods: [ + { + name: "create_room", + type: "unary", + signature: + "createRoom(request: HostChatCreateRoomRequest): Promise>>", + docUrl: "api/chat/trait.Chat.html#method.create_room", + description: "Create a chat room.", + requestDescription: "HostChatCreateRoomRequest", + requestType: "host-chat-create-room-request", + responseType: "host-chat-create-room-response", + }, + { + name: "register_bot", + type: "unary", + signature: + "registerBot(request: HostChatRegisterBotRequest): Promise>>", + docUrl: "api/chat/trait.Chat.html#method.register_bot", + description: "Register a chat bot.", + requestDescription: "HostChatRegisterBotRequest", + requestType: "host-chat-register-bot-request", + responseType: "host-chat-register-bot-response", + }, + { + name: "list_subscribe", + type: "subscription", + signature: "listSubscribe(): ObservableLike", + docUrl: "api/chat/trait.Chat.html#method.list_subscribe", + description: "Subscribe to the list of chat rooms.", + responseType: "host-chat-list-subscribe-item", + }, + { + name: "post_message", + type: "unary", + signature: + "postMessage(request: HostChatPostMessageRequest): Promise>>", + docUrl: "api/chat/trait.Chat.html#method.post_message", + description: "Post a message to a chat room.", + requestDescription: "HostChatPostMessageRequest", + requestType: "host-chat-post-message-request", + responseType: "host-chat-post-message-response", + }, + { + name: "action_subscribe", + type: "subscription", + signature: + "actionSubscribe(): ObservableLike", + docUrl: "api/chat/trait.Chat.html#method.action_subscribe", + description: "Subscribe to received chat actions.", + responseType: "host-chat-action-subscribe-item", + }, + { + name: "custom_message_render_subscribe", + type: "subscription", + signature: + "customMessageRenderSubscribe(request: ProductChatCustomMessageRenderSubscribeRequest): ObservableLike", + docUrl: + "api/chat/trait.Chat.html#method.custom_message_render_subscribe", + description: + "Subscribe to custom message render requests from the host. Each\nemitted item is a [`CustomRendererNode`](crate::v01::CustomRendererNode)\ntree describing the rendered UI.", + requestDescription: "ProductChatCustomMessageRenderSubscribeRequest", + requestType: "product-chat-custom-message-render-subscribe-request", + responseType: "custom-renderer-node", + }, + ], + }, + { + name: "Coin Payment", + methods: [ + { + name: "create_purse", + type: "unary", + signature: + "createPurse(request: HostCoinPaymentCreatePurseRequest): Promise>>", + docUrl: "api/coin_payment/trait.CoinPayment.html#method.create_purse", + description: "Create a new firewalled CoinPayment purse.", + requestDescription: "HostCoinPaymentCreatePurseRequest", + requestType: "host-coin-payment-create-purse-request", + responseType: "host-coin-payment-create-purse-response", + }, + { + name: "query_purse", + type: "unary", + signature: + "queryPurse(request: HostCoinPaymentQueryPurseRequest): Promise>>", + docUrl: "api/coin_payment/trait.CoinPayment.html#method.query_purse", + description: "Query product-visible purse metadata and balance.", + requestDescription: "HostCoinPaymentQueryPurseRequest", + requestType: "host-coin-payment-query-purse-request", + responseType: "host-coin-payment-query-purse-response", + }, + { + name: "rebalance_purse", + type: "subscription", + signature: + "rebalancePurse(request: HostCoinPaymentRebalancePurseRequest): ObservableLike>", + docUrl: + "api/coin_payment/trait.CoinPayment.html#method.rebalance_purse", + description: "Transfer balance between local purses.", + requestDescription: "HostCoinPaymentRebalancePurseRequest", + requestType: "host-coin-payment-rebalance-purse-request", + responseType: "coin-payment-status", + }, + { + name: "delete_purse", + type: "subscription", + signature: + "deletePurse(request: HostCoinPaymentDeletePurseRequest): ObservableLike>", + docUrl: "api/coin_payment/trait.CoinPayment.html#method.delete_purse", + description: + "Delete a purse after draining its balance into another local purse.", + requestDescription: "HostCoinPaymentDeletePurseRequest", + requestType: "host-coin-payment-delete-purse-request", + responseType: "coin-payment-status", + }, + { + name: "create_receivable", + type: "unary", + signature: + "createReceivable(request: HostCoinPaymentCreateReceivableRequest): Promise>>", + docUrl: + "api/coin_payment/trait.CoinPayment.html#method.create_receivable", + description: + "Create a receivable public key for depositing into a purse.", + requestDescription: "HostCoinPaymentCreateReceivableRequest", + requestType: "host-coin-payment-create-receivable-request", + responseType: "host-coin-payment-create-receivable-response", + }, + { + name: "create_cheque", + type: "unary", + signature: + "createCheque(request: HostCoinPaymentCreateChequeRequest): Promise>>", + docUrl: "api/coin_payment/trait.CoinPayment.html#method.create_cheque", + description: + "Create a cheque paying from a local purse to a receivable.", + requestDescription: "HostCoinPaymentCreateChequeRequest", + requestType: "host-coin-payment-create-cheque-request", + responseType: "host-coin-payment-create-cheque-response", + }, + { + name: "deposit", + type: "subscription", + signature: + "deposit(request: HostCoinPaymentDepositRequest): ObservableLike>", + docUrl: "api/coin_payment/trait.CoinPayment.html#method.deposit", + description: "Claim coins from a cheque into the receivable's purse.", + requestDescription: "HostCoinPaymentDepositRequest", + requestType: "host-coin-payment-deposit-request", + responseType: "coin-payment-status", + }, + { + name: "refund", + type: "subscription", + signature: + "refund(request: HostCoinPaymentRefundRequest): ObservableLike>", + docUrl: "api/coin_payment/trait.CoinPayment.html#method.refund", + description: "Attempt to return coins associated with a receivable.", + requestDescription: "HostCoinPaymentRefundRequest", + requestType: "host-coin-payment-refund-request", + responseType: "coin-payment-status", + }, + { + name: "listen_for_payment", + type: "subscription", + signature: + "listenForPayment(request: HostCoinPaymentListenForRequest): ObservableLike>", + docUrl: + "api/coin_payment/trait.CoinPayment.html#method.listen_for_payment", + description: + "Listen for a cheque delivered through a standard transmission channel.", + requestDescription: "HostCoinPaymentListenForRequest", + requestType: "host-coin-payment-listen-for-request", + responseType: "host-coin-payment-listen-for-item", + }, + ], + }, + { + name: "Entropy", + methods: [ + { + name: "derive", + type: "unary", + signature: + "derive(request: HostDeriveEntropyRequest): Promise>>", + docUrl: "api/entropy/trait.Entropy.html#method.derive", + description: "Derive deterministic entropy.", + requestDescription: "HostDeriveEntropyRequest", + requestType: "host-derive-entropy-request", + responseType: "host-derive-entropy-response", + }, + ], + }, + { + name: "Local Storage", + methods: [ + { + name: "read", + type: "unary", + signature: + "read(request: HostLocalStorageReadRequest): Promise>>", + docUrl: "api/local_storage/trait.LocalStorage.html#method.read", + description: "Read a value by key.", + requestDescription: "HostLocalStorageReadRequest", + requestType: "host-local-storage-read-request", + responseType: "host-local-storage-read-response", + }, + { + name: "write", + type: "unary", + signature: + "write(request: HostLocalStorageWriteRequest): Promise>>", + docUrl: "api/local_storage/trait.LocalStorage.html#method.write", + description: "Write a value to a key.", + requestDescription: "HostLocalStorageWriteRequest", + requestType: "host-local-storage-write-request", + }, + { + name: "clear", + type: "unary", + signature: + "clear(request: HostLocalStorageClearRequest): Promise>>", + docUrl: "api/local_storage/trait.LocalStorage.html#method.clear", + description: "Clear a value by key.", + requestDescription: "HostLocalStorageClearRequest", + requestType: "host-local-storage-clear-request", + }, + ], + }, + { + name: "Notifications", + methods: [ + { + name: "send_push_notification", + type: "unary", + signature: + "sendPushNotification(request: HostPushNotificationRequest): Promise>>", + docUrl: + "api/notifications/trait.Notifications.html#method.send_push_notification", + description: + "Send a push notification to the user.\n\nReturns a [`NotificationId`](crate::v01::NotificationId) that can be\npassed to [`cancel_push_notification`](Self::cancel_push_notification)\nto retract a scheduled notification. When `scheduled_at` is set the host\npersists the notification across restarts and fires it through the\nplatform-native scheduler. See [RFC 0019].\n\n[RFC 0019]: https://github.com/paritytech/truapi/blob/main/docs/rfcs/0019-scheduled-notifications.md", + requestDescription: "HostPushNotificationRequest", + requestType: "host-push-notification-request", + responseType: "host-push-notification-response", + }, + { + name: "cancel_push_notification", + type: "unary", + signature: + "cancelPushNotification(request: HostPushNotificationCancelRequest): Promise>>", + docUrl: + "api/notifications/trait.Notifications.html#method.cancel_push_notification", + description: + "Cancels a previously issued push notification.\n\nCancellation is idempotent: returns `Ok(())` whether the notification is\nstill pending, already fired, or was never issued. See [RFC 0019].\n\n[RFC 0019]: https://github.com/paritytech/truapi/blob/main/docs/rfcs/0019-scheduled-notifications.md", + requestDescription: "HostPushNotificationCancelRequest", + requestType: "host-push-notification-cancel-request", + }, + ], + }, + { + name: "Payment", + methods: [ + { + name: "balance_subscribe", + type: "subscription", + signature: + "balanceSubscribe(request: HostPaymentBalanceSubscribeRequest): ObservableLike>", + docUrl: "api/payment/trait.Payment.html#method.balance_subscribe", + description: "Subscribe to payment balance updates.", + requestDescription: "HostPaymentBalanceSubscribeRequest", + requestType: "host-payment-balance-subscribe-request", + responseType: "host-payment-balance-subscribe-item", + }, + { + name: "top_up", + type: "unary", + signature: + "topUp(request: HostPaymentTopUpRequest): Promise>>", + docUrl: "api/payment/trait.Payment.html#method.top_up", + description: "Top up the user's payment balance.", + requestDescription: "HostPaymentTopUpRequest", + requestType: "host-payment-top-up-request", + }, + { + name: "request", + type: "unary", + signature: + "request(request: HostPaymentRequest): Promise>>", + docUrl: "api/payment/trait.Payment.html#method.request", + description: "Request a payment from the user.", + requestDescription: "HostPaymentRequest", + requestType: "host-payment-request", + responseType: "host-payment-response", + }, + { + name: "status_subscribe", + type: "subscription", + signature: + "statusSubscribe(request: HostPaymentStatusSubscribeRequest): ObservableLike>", + docUrl: "api/payment/trait.Payment.html#method.status_subscribe", + description: + "Subscribe to payment lifecycle updates for a specific payment.", + requestDescription: "HostPaymentStatusSubscribeRequest", + requestType: "host-payment-status-subscribe-request", + responseType: "host-payment-status-subscribe-item", + }, + ], + }, + { + name: "Permissions", + methods: [ + { + name: "request_device_permission", + type: "unary", + signature: + "requestDevicePermission(request: HostDevicePermissionRequest): Promise>>", + docUrl: + "api/permissions/trait.Permissions.html#method.request_device_permission", + description: "Request a device-capability permission from the user.", + requestDescription: + "Enum values: Notifications / Camera / Microphone / Bluetooth / NFC / Location / Clipboard / OpenUrl / Biometrics", + requestType: "host-device-permission-request", + responseType: "host-device-permission-response", + }, + { + name: "request_remote_permission", + type: "unary", + signature: + "requestRemotePermission(request: RemotePermissionRequest): Promise>>", + docUrl: + "api/permissions/trait.Permissions.html#method.request_remote_permission", + description: "Request a remote-operation permission.", + requestDescription: "RemotePermissionRequest", + requestType: "remote-permission-request", + responseType: "remote-permission-response", + }, + ], + }, + { + name: "Preimage", + methods: [ + { + name: "lookup_subscribe", + type: "subscription", + signature: + "lookupSubscribe(request: RemotePreimageLookupSubscribeRequest): ObservableLike", + docUrl: "api/preimage/trait.Preimage.html#method.lookup_subscribe", + description: "Subscribe to preimage lookups for a given key.", + requestDescription: "RemotePreimageLookupSubscribeRequest", + requestType: "remote-preimage-lookup-subscribe-request", + responseType: "remote-preimage-lookup-subscribe-item", + }, + { + name: "submit", + type: "unary", + signature: + "submit(request: HexString): Promise>>", + docUrl: "api/preimage/trait.Preimage.html#method.submit", + description: + "Submit a preimage. Returns the preimage key (hash) on success.", + requestDescription: "HexString", + }, + ], + }, + { + name: "Resource Allocation", + methods: [ + { + name: "request", + type: "unary", + signature: + "request(request: HostRequestResourceAllocationRequest): Promise>>", + docUrl: + "api/resource_allocation/trait.ResourceAllocation.html#method.request", + description: "Request the host to pre-allocate one or more resources.", + requestDescription: "HostRequestResourceAllocationRequest", + requestType: "host-request-resource-allocation-request", + responseType: "host-request-resource-allocation-response", + }, + ], + }, + { + name: "Signing", + methods: [ + { + name: "create_transaction", + type: "unary", + signature: + "createTransaction(request: ProductAccountTxPayload): Promise>>", + docUrl: "api/signing/trait.Signing.html#method.create_transaction", + description: "Construct a signed transaction for a product account.", + requestDescription: "ProductAccountTxPayload", + requestType: "product-account-tx-payload", + responseType: "host-create-transaction-response", + }, + { + name: "create_transaction_with_legacy_account", + type: "unary", + signature: + "createTransactionWithLegacyAccount(request: LegacyAccountTxPayload): Promise>>", + docUrl: + "api/signing/trait.Signing.html#method.create_transaction_with_legacy_account", + description: + "Construct a signed transaction for a non-product (legacy) account.", + requestDescription: "LegacyAccountTxPayload", + requestType: "legacy-account-tx-payload", + responseType: "host-create-transaction-with-legacy-account-response", + }, + { + name: "sign_raw_with_legacy_account", + type: "unary", + signature: + "signRawWithLegacyAccount(request: HostSignRawWithLegacyAccountRequest): Promise>>", + docUrl: + "api/signing/trait.Signing.html#method.sign_raw_with_legacy_account", + description: "Sign raw bytes with a non-product account.", + requestDescription: "HostSignRawWithLegacyAccountRequest", + requestType: "host-sign-raw-with-legacy-account-request", + responseType: "host-sign-payload-response", + }, + { + name: "sign_payload_with_legacy_account", + type: "unary", + signature: + "signPayloadWithLegacyAccount(request: HostSignPayloadWithLegacyAccountRequest): Promise>>", + docUrl: + "api/signing/trait.Signing.html#method.sign_payload_with_legacy_account", + description: "Sign an extrinsic payload with a non-product account.", + requestDescription: "HostSignPayloadWithLegacyAccountRequest", + requestType: "host-sign-payload-with-legacy-account-request", + responseType: "host-sign-payload-response", + }, + { + name: "sign_raw", + type: "unary", + signature: + "signRaw(request: HostSignRawRequest): Promise>>", + docUrl: "api/signing/trait.Signing.html#method.sign_raw", + description: "Sign raw bytes or a message.", + requestDescription: "HostSignRawRequest", + requestType: "host-sign-raw-request", + responseType: "host-sign-payload-response", + }, + { + name: "sign_payload", + type: "unary", + signature: + "signPayload(request: HostSignPayloadRequest): Promise>>", + docUrl: "api/signing/trait.Signing.html#method.sign_payload", + description: "Sign an extrinsic payload.", + requestDescription: "HostSignPayloadRequest", + requestType: "host-sign-payload-request", + responseType: "host-sign-payload-response", + }, + ], + }, + { + name: "Statement Store", + methods: [ + { + name: "subscribe", + type: "subscription", + signature: + "subscribe(request: RemoteStatementStoreSubscribeRequest): ObservableLike>", + docUrl: + "api/statement_store/trait.StatementStore.html#method.subscribe", + description: "Subscribe to statements matching a topic filter.", + requestDescription: "RemoteStatementStoreSubscribeRequest", + requestType: "remote-statement-store-subscribe-request", + responseType: "remote-statement-store-subscribe-item", + }, + { + name: "create_proof", + type: "unary", + signature: + "createProof(request: RemoteStatementStoreCreateProofRequest): Promise>>", + docUrl: + "api/statement_store/trait.StatementStore.html#method.create_proof", + description: + "Create a proof for a statement.\n\n**Deprecated:** use [`create_proof_authorized`](Self::create_proof_authorized)\ninstead, which uses a pre-allocated allowance account and does not\nrequire a per-call signing prompt. Pairing hosts may reject this method\nwhen their signing channel cannot sign statement proof payloads exactly.", + requestDescription: "RemoteStatementStoreCreateProofRequest", + requestType: "remote-statement-store-create-proof-request", + responseType: "remote-statement-store-create-proof-response", + }, + { + name: "submit", + type: "unary", + signature: + "submit(request: SignedStatement): Promise>>", + docUrl: "api/statement_store/trait.StatementStore.html#method.submit", + description: + "Submit a signed statement to the network. The request body is the\n[`SignedStatement`](crate::v01::SignedStatement) directly (no wrapping\nstruct), matching upstream `triangle-js-sdks`.", + requestDescription: "SignedStatement", + requestType: "signed-statement", + }, + { + name: "create_proof_authorized", + type: "unary", + signature: + "createProofAuthorized(request: Statement): Promise>>", + docUrl: + "api/statement_store/trait.StatementStore.html#method.create_proof_authorized", + description: + "Create a proof for a statement using a pre-allocated allowance account,\nbypassing the per-call signing prompt.", + requestDescription: "Statement", + requestType: "statement", + responseType: "remote-statement-store-create-proof-response", + }, + ], + }, + { + name: "System", + methods: [ + { + name: "handshake", + type: "unary", + signature: + "handshake(request: HostHandshakeRequest): Promise>>", + docUrl: "api/system/trait.System.html#method.handshake", + description: "Negotiate the wire codec version with the product.", + requestDescription: "HostHandshakeRequest", + requestType: "host-handshake-request", + }, + { + name: "feature_supported", + type: "unary", + signature: + "featureSupported(request: HostFeatureSupportedRequest): Promise>>", + docUrl: "api/system/trait.System.html#method.feature_supported", + description: "Query whether the host supports a specific feature.", + requestDescription: "HostFeatureSupportedRequest", + requestType: "host-feature-supported-request", + responseType: "host-feature-supported-response", + }, + { + name: "navigate_to", + type: "unary", + signature: + "navigateTo(request: HostNavigateToRequest): Promise>>", + docUrl: "api/system/trait.System.html#method.navigate_to", + description: "Request the host to open a URL.", + requestDescription: "HostNavigateToRequest", + requestType: "host-navigate-to-request", + }, + ], + }, + { + name: "Theme", + methods: [ + { + name: "subscribe", + type: "subscription", + signature: "subscribe(): ObservableLike", + docUrl: "api/theme/trait.Theme.html#method.subscribe", + description: "Subscribe to host theme changes.", + responseType: "host-theme-subscribe-item", + }, + ], + }, +]; diff --git a/js/packages/truapi/src/explorer/codegen/versions/0.4.0/types.ts b/js/packages/truapi/src/explorer/codegen/versions/0.4.0/types.ts new file mode 100644 index 00000000..a98ae20c --- /dev/null +++ b/js/packages/truapi/src/explorer/codegen/versions/0.4.0/types.ts @@ -0,0 +1,4302 @@ +// Auto-generated by truapi-codegen. Do not edit. +import type { DataType } from "../../../data-types.js"; + +export const types: DataType[] = [ + { + id: "account-id", + name: "AccountId", + category: "transaction", + definition: "export type AccountId = HexString;", + description: + "A 32-byte raw account identifier used for legacy (non-product) accounts.", + }, + { + id: "action-trigger", + name: "ActionTrigger", + category: "chat", + definition: + "export interface ActionTrigger {\n messageId: string;\n actionId: string;\n payload?: HexString;\n}", + description: "Payload when a user clicks an action button.", + fields: [ + { + name: "message_id", + type: "string", + description: "Message containing the action.", + }, + { + name: "action_id", + type: "string", + description: "Which action was triggered.", + }, + { + name: "payload", + type: "HexString | undefined", + description: "Optional additional data.", + }, + ], + }, + { + id: "allocatable-resource", + name: "AllocatableResource", + category: "resource_allocation", + definition: + 'export type AllocatableResource =\n | { tag: "StatementStoreAllowance"; value?: undefined }\n | { tag: "BulletinAllowance"; value?: undefined }\n | { tag: "SmartContractAllowance"; value: number }\n | { tag: "AutoSigning"; value?: undefined }\n;', + description: + "A resource the host can pre-allocate on behalf of the product (RFC 0010).\n\nFor the slot-table allowances (`StatementStoreAllowance`,\n`BulletinAllowance`, `SmartContractAllowance`), pre-allocation is\nopportunistic and the host may also fulfil the allowance implicitly on the\nfirst submission. `AutoSigning` must be requested explicitly through this\ncall.", + variants: [ + { + name: "StatementStoreAllowance", + type: '{ tag: "StatementStoreAllowance"; value?: undefined }', + description: + "Statement Store slot allowance for the product's own allowance account.", + }, + { + name: "BulletinAllowance", + type: '{ tag: "BulletinAllowance"; value?: undefined }', + description: + "Bulletin chain slot allowance for the product's own allowance account.", + }, + { + name: "SmartContractAllowance", + type: '{ tag: "SmartContractAllowance"; value: number }', + description: + "Pre-warmed PGAS balance for the smart-contract account at the given\nderivation index.", + }, + { + name: "AutoSigning", + type: '{ tag: "AutoSigning"; value?: undefined }', + description: + "Permission to sign on the product's behalf without per-call user prompts.", + }, + ], + }, + { + id: "allocation-outcome", + name: "AllocationOutcome", + category: "resource_allocation", + definition: + 'export type AllocationOutcome = "Allocated" | "Rejected" | "NotAvailable";', + description: "Outcome of allocating a single resource (RFC 0010).", + variants: [ + { + name: "Allocated", + type: '{ tag: "Allocated"; value?: undefined }', + description: "Resource is now available for use.", + }, + { + name: "Rejected", + type: '{ tag: "Rejected"; value?: undefined }', + description: "User or host refused the allocation.", + }, + { + name: "NotAvailable", + type: '{ tag: "NotAvailable"; value?: undefined }', + description: + "Host cannot provide this resource on the current chain or environment.", + }, + ], + }, + { + id: "arrangement", + name: "Arrangement", + category: "chat", + definition: + 'export type Arrangement = "Start" | "End" | "Center" | "SpaceBetween" | "SpaceAround" | "SpaceEvenly";', + description: "Layout arrangement (like CSS flexbox `justify-content`).", + variants: [ + { + name: "Start", + type: '{ tag: "Start"; value?: undefined }', + }, + { + name: "End", + type: '{ tag: "End"; value?: undefined }', + }, + { + name: "Center", + type: '{ tag: "Center"; value?: undefined }', + }, + { + name: "SpaceBetween", + type: '{ tag: "SpaceBetween"; value?: undefined }', + }, + { + name: "SpaceAround", + type: '{ tag: "SpaceAround"; value?: undefined }', + }, + { + name: "SpaceEvenly", + type: '{ tag: "SpaceEvenly"; value?: undefined }', + }, + ], + }, + { + id: "background", + name: "Background", + category: "chat", + definition: + "export interface Background {\n color: ColorToken;\n shape?: Shape;\n}", + description: "Background styling.", + fields: [ + { + name: "color", + type: "ColorToken", + description: "Background color.", + }, + { + name: "shape", + type: "Shape | undefined", + description: "Background shape.", + }, + ], + }, + { + id: "balance", + name: "Balance", + category: "payment", + definition: "export type Balance = bigint;", + description: + "Balance amount for payment operations. Interpreted according to the host's\nsingle fixed payment asset (e.g. pUSD).", + }, + { + id: "border-style", + name: "BorderStyle", + category: "chat", + definition: + "export interface BorderStyle {\n width: Size;\n color: ColorToken;\n shape?: Shape;\n}", + description: "Border styling.", + fields: [ + { + name: "width", + type: "Size", + description: "Border width.", + }, + { + name: "color", + type: "ColorToken", + description: "Border color.", + }, + { + name: "shape", + type: "Shape | undefined", + description: "Border shape.", + }, + ], + }, + { + id: "box-props", + name: "BoxProps", + category: "chat", + definition: + "export interface BoxProps {\n contentAlignment?: ContentAlignment;\n}", + description: "Properties for a [`CustomRendererNode::Box`] container.", + fields: [ + { + name: "content_alignment", + type: "ContentAlignment | undefined", + description: "Content alignment within the box.", + }, + ], + }, + { + id: "button-props", + name: "ButtonProps", + category: "chat", + definition: + "export interface ButtonProps {\n text: string;\n variant?: ButtonVariant;\n enabled: boolean | undefined;\n loading: boolean | undefined;\n clickAction?: string;\n}", + description: "Properties for a [`CustomRendererNode::Button`].", + fields: [ + { + name: "text", + type: "string", + description: "Button label text.", + }, + { + name: "variant", + type: "ButtonVariant | undefined", + description: "Button style variant.", + }, + { + name: "enabled", + type: "boolean | undefined", + description: + "Whether the button is enabled. Absent leaves the default to the host.", + }, + { + name: "loading", + type: "boolean | undefined", + description: + "Whether the button shows a loading state. Absent leaves the default to the host.", + }, + { + name: "click_action", + type: "string | undefined", + description: "Action identifier triggered on click.", + }, + ], + }, + { + id: "button-variant", + name: "ButtonVariant", + category: "chat", + definition: 'export type ButtonVariant = "Primary" | "Secondary" | "Text";', + description: "Button style variants.", + variants: [ + { + name: "Primary", + type: '{ tag: "Primary"; value?: undefined }', + }, + { + name: "Secondary", + type: '{ tag: "Secondary"; value?: undefined }', + }, + { + name: "Text", + type: '{ tag: "Text"; value?: undefined }', + }, + ], + }, + { + id: "chat-action", + name: "ChatAction", + category: "chat", + definition: + "export interface ChatAction {\n actionId: string;\n title: string;\n}", + description: "A clickable action button in a chat message.", + fields: [ + { + name: "action_id", + type: "string", + description: "Action identifier.", + }, + { + name: "title", + type: "string", + description: "Button label.", + }, + ], + }, + { + id: "chat-action-layout", + name: "ChatActionLayout", + category: "chat", + definition: 'export type ChatActionLayout = "Column" | "Grid";', + description: "Layout for action buttons.", + variants: [ + { + name: "Column", + type: '{ tag: "Column"; value?: undefined }', + }, + { + name: "Grid", + type: '{ tag: "Grid"; value?: undefined }', + }, + ], + }, + { + id: "chat-action-payload", + name: "ChatActionPayload", + category: "chat", + definition: + 'export type ChatActionPayload =\n | { tag: "MessagePosted"; value: ChatMessageContent }\n | { tag: "ActionTriggered"; value: ActionTrigger }\n | { tag: "Command"; value: ChatCommand }\n;', + description: "Payload of a received chat action.", + variants: [ + { + name: "MessagePosted", + type: '{ tag: "MessagePosted"; value: ChatMessageContent }', + description: "A peer posted a message.", + }, + { + name: "ActionTriggered", + type: '{ tag: "ActionTriggered"; value: ActionTrigger }', + description: "A user triggered an action button.", + }, + { + name: "Command", + type: '{ tag: "Command"; value: ChatCommand }', + description: "A user issued a command.", + }, + ], + }, + { + id: "chat-actions", + name: "ChatActions", + category: "chat", + definition: + "export interface ChatActions {\n text?: string;\n actions: Array;\n layout: ChatActionLayout;\n}", + description: "A set of action buttons with optional text.", + fields: [ + { + name: "text", + type: "string | undefined", + description: "Optional message text.", + }, + { + name: "actions", + type: "Array", + description: "List of action buttons.", + }, + { + name: "layout", + type: "ChatActionLayout", + description: "`Column` or `Grid` layout.", + }, + ], + }, + { + id: "chat-bot-registration-status", + name: "ChatBotRegistrationStatus", + category: "chat", + definition: 'export type ChatBotRegistrationStatus = "New" | "Exists";', + description: "Whether the bot was newly registered or already existed.", + variants: [ + { + name: "New", + type: '{ tag: "New"; value?: undefined }', + }, + { + name: "Exists", + type: '{ tag: "Exists"; value?: undefined }', + }, + ], + }, + { + id: "chat-command", + name: "ChatCommand", + category: "chat", + definition: + "export interface ChatCommand {\n command: string;\n payload: string;\n}", + description: "A slash command from a chat user.", + fields: [ + { + name: "command", + type: "string", + description: "Command name.", + }, + { + name: "payload", + type: "string", + description: "Command arguments.", + }, + ], + }, + { + id: "chat-custom-message", + name: "ChatCustomMessage", + category: "chat", + definition: + "export interface ChatCustomMessage {\n messageType: string;\n payload: HexString;\n}", + description: + "A custom message with application-defined type and binary payload.", + fields: [ + { + name: "message_type", + type: "string", + description: "Application-defined type key.", + }, + { + name: "payload", + type: "HexString", + description: "Binary payload.", + }, + ], + }, + { + id: "chat-file", + name: "ChatFile", + category: "chat", + definition: + "export interface ChatFile {\n url: string;\n fileName: string;\n mimeType: string;\n sizeBytes: bigint;\n text?: string;\n}", + description: "A file attachment in a chat message.", + fields: [ + { + name: "url", + type: "string", + description: "File download URL.", + }, + { + name: "file_name", + type: "string", + description: "File name.", + }, + { + name: "mime_type", + type: "string", + description: "MIME type.", + }, + { + name: "size_bytes", + type: "bigint", + description: "File size in bytes.", + }, + { + name: "text", + type: "string | undefined", + description: "Optional caption text.", + }, + ], + }, + { + id: "chat-media", + name: "ChatMedia", + category: "chat", + definition: "export interface ChatMedia {\n url: string;\n}", + description: "A media attachment.", + fields: [ + { + name: "url", + type: "string", + description: "Media URL.", + }, + ], + }, + { + id: "chat-message-content", + name: "ChatMessageContent", + category: "chat", + definition: + 'export type ChatMessageContent =\n | { tag: "Text"; value: { text: string } }\n | { tag: "RichText"; value: ChatRichText }\n | { tag: "Actions"; value: ChatActions }\n | { tag: "File"; value: ChatFile }\n | { tag: "Reaction"; value: ChatReaction }\n | { tag: "ReactionRemoved"; value: ChatReaction }\n | { tag: "Custom"; value: ChatCustomMessage }\n;', + description: "Content of a chat message -- one of several types.", + variants: [ + { + name: "Text", + type: '{ tag: "Text"; value: { text: string } }', + description: "Plain text message.", + }, + { + name: "RichText", + type: '{ tag: "RichText"; value: ChatRichText }', + description: "Rich text with media.", + }, + { + name: "Actions", + type: '{ tag: "Actions"; value: ChatActions }', + description: "Action button set.", + }, + { + name: "File", + type: '{ tag: "File"; value: ChatFile }', + description: "File attachment.", + }, + { + name: "Reaction", + type: '{ tag: "Reaction"; value: ChatReaction }', + description: "Emoji reaction.", + }, + { + name: "ReactionRemoved", + type: '{ tag: "ReactionRemoved"; value: ChatReaction }', + description: "Reaction removal.", + }, + { + name: "Custom", + type: '{ tag: "Custom"; value: ChatCustomMessage }', + description: "Custom message.", + }, + ], + }, + { + id: "chat-reaction", + name: "ChatReaction", + category: "chat", + definition: + "export interface ChatReaction {\n messageId: string;\n emoji: string;\n}", + description: "A reaction to a chat message.", + fields: [ + { + name: "message_id", + type: "string", + description: "Message being reacted to.", + }, + { + name: "emoji", + type: "string", + description: "Emoji reaction.", + }, + ], + }, + { + id: "chat-rich-text", + name: "ChatRichText", + category: "chat", + definition: + "export interface ChatRichText {\n text?: string;\n media: Array;\n}", + description: "Rich text message with optional media.", + fields: [ + { + name: "text", + type: "string | undefined", + description: "Optional text content.", + }, + { + name: "media", + type: "Array", + description: "Attached media items.", + }, + ], + }, + { + id: "chat-room", + name: "ChatRoom", + category: "chat", + definition: + "export interface ChatRoom {\n roomId: string;\n participatingAs: ChatRoomParticipation;\n}", + description: "A chat room the product participates in.", + fields: [ + { + name: "room_id", + type: "string", + description: "Room identifier.", + }, + { + name: "participating_as", + type: "ChatRoomParticipation", + description: "`RoomHost` or `Bot`.", + }, + ], + }, + { + id: "chat-room-participation", + name: "ChatRoomParticipation", + category: "chat", + definition: 'export type ChatRoomParticipation = "RoomHost" | "Bot";', + description: "How the product participates in a chat room.", + variants: [ + { + name: "RoomHost", + type: '{ tag: "RoomHost"; value?: undefined }', + }, + { + name: "Bot", + type: '{ tag: "Bot"; value?: undefined }', + }, + ], + }, + { + id: "chat-room-registration-status", + name: "ChatRoomRegistrationStatus", + category: "chat", + definition: 'export type ChatRoomRegistrationStatus = "New" | "Exists";', + description: "Whether the room was newly created or already existed.", + variants: [ + { + name: "New", + type: '{ tag: "New"; value?: undefined }', + }, + { + name: "Exists", + type: '{ tag: "Exists"; value?: undefined }', + }, + ], + }, + { + id: "coin-payment-balance", + name: "CoinPaymentBalance", + category: "coin_payment", + definition: "export type CoinPaymentBalance = number;", + description: "Balance amount for CoinPayment operations.", + }, + { + id: "coin-payment-cheque", + name: "CoinPaymentCheque", + category: "coin_payment", + definition: + "export interface CoinPaymentCheque {\n id: CoinPaymentReceivable;\n amount: CoinPaymentBalance;\n encryptedSecrets: HexString;\n}", + description: "Standardized encrypted Coinage secret transmission payload.", + fields: [ + { + name: "id", + type: "CoinPaymentReceivable", + description: "Receivable public key protecting the cheque contents.", + }, + { + name: "amount", + type: "CoinPaymentBalance", + description: "Claimed payment amount.", + }, + { + name: "encrypted_secrets", + type: "HexString", + description: "Concatenated coin secrets encrypted to the receivable.", + }, + ], + }, + { + id: "coin-payment-clearing-reference", + name: "CoinPaymentClearingReference", + category: "coin_payment", + definition: + "export interface CoinPaymentClearingReference {\n root: CoinPaymentMerkleRoot;\n leaves: Array<[CoinPaymentCoinagePubKey, CoinPaymentTransactionHash]>;\n}", + description: + "Product-visible clearing reference for reconciliation and receipts.", + fields: [ + { + name: "root", + type: "CoinPaymentMerkleRoot", + description: "Clearing Merkle root.", + }, + { + name: "leaves", + type: "Array<[CoinPaymentCoinagePubKey, CoinPaymentTransactionHash]>", + description: "Product-visible coin key and transaction hash leaves.", + }, + ], + }, + { + id: "coin-payment-coinage-pub-key", + name: "CoinPaymentCoinagePubKey", + category: "coin_payment", + definition: "export type CoinPaymentCoinagePubKey = HexString;", + description: "Public Coinage key referenced by clearing evidence.", + }, + { + id: "coin-payment-error", + name: "CoinPaymentError", + category: "coin_payment", + definition: + 'export type CoinPaymentError = "BalanceLow" | "Denied" | "BadCoins" | "SnipedCoins" | "PurseNotFound" | "ReceivableNotFound" | "UnsupportedChannel" | "UserAgentCapabilityUnavailable" | "Internal";', + description: "Errors returned by CoinPayment host operations.", + variants: [ + { + name: "BalanceLow", + type: '{ tag: "BalanceLow"; value?: undefined }', + description: "Source purse has too little balance.", + }, + { + name: "Denied", + type: '{ tag: "Denied"; value?: undefined }', + description: "User agent denied spend, transfer, or access.", + }, + { + name: "BadCoins", + type: '{ tag: "BadCoins"; value?: undefined }', + description: "Coin secrets do not control valid coins.", + }, + { + name: "SnipedCoins", + type: '{ tag: "SnipedCoins"; value?: undefined }', + description: "Coin secrets were claimed elsewhere.", + }, + { + name: "PurseNotFound", + type: '{ tag: "PurseNotFound"; value?: undefined }', + description: "Purse does not exist or is not visible to the caller.", + }, + { + name: "ReceivableNotFound", + type: '{ tag: "ReceivableNotFound"; value?: undefined }', + description: + "Receivable does not exist or is not visible to the caller.", + }, + { + name: "UnsupportedChannel", + type: '{ tag: "UnsupportedChannel"; value?: undefined }', + description: "Requested transmission channel is not supported.", + }, + { + name: "UserAgentCapabilityUnavailable", + type: '{ tag: "UserAgentCapabilityUnavailable"; value?: undefined }', + description: "Required host/user-agent capability is unavailable.", + }, + { + name: "Internal", + type: '{ tag: "Internal"; value?: undefined }', + description: "Unexpected runtime failure.", + }, + ], + }, + { + id: "coin-payment-merkle-root", + name: "CoinPaymentMerkleRoot", + category: "coin_payment", + definition: "export type CoinPaymentMerkleRoot = HexString;", + description: "Merkle root for a product-visible clearing reference.", + }, + { + id: "coin-payment-product-id", + name: "CoinPaymentProductId", + category: "coin_payment", + definition: "export type CoinPaymentProductId = string;", + description: + "Authenticated product identifier recorded for a product-created purse.", + }, + { + id: "coin-payment-purse-id", + name: "CoinPaymentPurseId", + category: "coin_payment", + definition: "export type CoinPaymentPurseId = number;", + description: "RFC 0017 CoinPayment purse identifier.", + }, + { + id: "coin-payment-purse-info", + name: "CoinPaymentPurseInfo", + category: "coin_payment", + definition: + "export interface CoinPaymentPurseInfo {\n name: string;\n created: CoinPaymentTimestamp;\n creator: CoinPaymentProductId;\n balance: CoinPaymentBalance;\n}", + description: + "Product-visible metadata and balance state for a CoinPayment purse.", + fields: [ + { + name: "name", + type: "string", + description: + "Human-readable purse name supplied by the creating product.", + }, + { + name: "created", + type: "CoinPaymentTimestamp", + description: "Creation timestamp.", + }, + { + name: "creator", + type: "CoinPaymentProductId", + description: "Product that created the purse.", + }, + { + name: "balance", + type: "CoinPaymentBalance", + description: "Current product-visible balance.", + }, + ], + }, + { + id: "coin-payment-receivable", + name: "CoinPaymentReceivable", + category: "coin_payment", + definition: "export type CoinPaymentReceivable = HexString;", + description: "Public key identifying a CoinPayment receivable.", + }, + { + id: "coin-payment-status", + name: "CoinPaymentStatus", + category: "coin_payment", + definition: + 'export type CoinPaymentStatus =\n | { tag: "Clearing"; value: { clearing: CoinPaymentBalance; cleared: CoinPaymentBalance } }\n | { tag: "Failed"; value: { error: CoinPaymentError; cleared: CoinPaymentBalance; reference: CoinPaymentClearingReference } }\n | { tag: "Done"; value: { cleared: CoinPaymentBalance; reference: CoinPaymentClearingReference } }\n;', + description: "Clearing status stream item.", + variants: [ + { + name: "Clearing", + type: '{ tag: "Clearing"; value: { clearing: CoinPaymentBalance; cleared: CoinPaymentBalance } }', + description: "More coins have cleared.", + }, + { + name: "Failed", + type: '{ tag: "Failed"; value: { error: CoinPaymentError; cleared: CoinPaymentBalance; reference: CoinPaymentClearingReference } }', + description: "Some or all coins failed to transfer.", + }, + { + name: "Done", + type: '{ tag: "Done"; value: { cleared: CoinPaymentBalance; reference: CoinPaymentClearingReference } }', + description: "All coins cleared.", + }, + ], + }, + { + id: "coin-payment-timestamp", + name: "CoinPaymentTimestamp", + category: "coin_payment", + definition: "export type CoinPaymentTimestamp = bigint;", + description: "Milliseconds since Unix epoch.", + }, + { + id: "coin-payment-transaction-hash", + name: "CoinPaymentTransactionHash", + category: "coin_payment", + definition: "export type CoinPaymentTransactionHash = HexString;", + description: "Transaction hash for a product-visible clearing reference.", + }, + { + id: "coin-payment-transmission-channel", + name: "CoinPaymentTransmissionChannel", + category: "coin_payment", + definition: + 'export type CoinPaymentTransmissionChannel =\n | { tag: "Standard"; value: { sssTopic: HexString } }\n;', + description: "Standardized cheque transmission channel.", + variants: [ + { + name: "Standard", + type: '{ tag: "Standard"; value: { sssTopic: HexString } }', + description: "Statement-store/HOP handoff identified by an SSS topic.", + }, + ], + }, + { + id: "color-token", + name: "ColorToken", + category: "chat", + definition: + 'export type ColorToken = "FgPrimary" | "FgSecondary" | "FgTertiary" | "BgSurfaceMain" | "BgSurfaceContainer" | "BgSurfaceNested" | "FgSuccess" | "FgError" | "FgWarning";', + description: "Semantic color tokens for theming.", + variants: [ + { + name: "FgPrimary", + type: '{ tag: "FgPrimary"; value?: undefined }', + }, + { + name: "FgSecondary", + type: '{ tag: "FgSecondary"; value?: undefined }', + }, + { + name: "FgTertiary", + type: '{ tag: "FgTertiary"; value?: undefined }', + }, + { + name: "BgSurfaceMain", + type: '{ tag: "BgSurfaceMain"; value?: undefined }', + }, + { + name: "BgSurfaceContainer", + type: '{ tag: "BgSurfaceContainer"; value?: undefined }', + }, + { + name: "BgSurfaceNested", + type: '{ tag: "BgSurfaceNested"; value?: undefined }', + }, + { + name: "FgSuccess", + type: '{ tag: "FgSuccess"; value?: undefined }', + }, + { + name: "FgError", + type: '{ tag: "FgError"; value?: undefined }', + }, + { + name: "FgWarning", + type: '{ tag: "FgWarning"; value?: undefined }', + }, + ], + }, + { + id: "column-props", + name: "ColumnProps", + category: "chat", + definition: + "export interface ColumnProps {\n horizontalAlignment?: HorizontalAlignment;\n verticalArrangement?: Arrangement;\n}", + description: "Properties for a [`CustomRendererNode::Column`] layout.", + fields: [ + { + name: "horizontal_alignment", + type: "HorizontalAlignment | undefined", + description: "Horizontal alignment of children.", + }, + { + name: "vertical_arrangement", + type: "Arrangement | undefined", + description: "Vertical arrangement of children.", + }, + ], + }, + { + id: "component", + name: "Component", + category: "chat", + definition: + "export interface Component

{\n modifiers: Array;\n props: P;\n children: Array;\n}", + description: + "A component in the custom renderer UI tree, combining modifiers, typed props,\nand recursive children.", + fields: [ + { + name: "modifiers", + type: "Array", + description: "Layout and styling modifiers.", + }, + { + name: "props", + type: "P", + description: "Component-specific properties.", + }, + { + name: "children", + type: "Array", + description: "Child nodes.", + }, + ], + }, + { + id: "content-alignment", + name: "ContentAlignment", + category: "chat", + definition: + 'export type ContentAlignment = "TopStart" | "TopCenter" | "TopEnd" | "CenterStart" | "Center" | "CenterEnd" | "BottomStart" | "BottomCenter" | "BottomEnd";', + description: "2D content alignment.", + variants: [ + { + name: "TopStart", + type: '{ tag: "TopStart"; value?: undefined }', + }, + { + name: "TopCenter", + type: '{ tag: "TopCenter"; value?: undefined }', + }, + { + name: "TopEnd", + type: '{ tag: "TopEnd"; value?: undefined }', + }, + { + name: "CenterStart", + type: '{ tag: "CenterStart"; value?: undefined }', + }, + { + name: "Center", + type: '{ tag: "Center"; value?: undefined }', + }, + { + name: "CenterEnd", + type: '{ tag: "CenterEnd"; value?: undefined }', + }, + { + name: "BottomStart", + type: '{ tag: "BottomStart"; value?: undefined }', + }, + { + name: "BottomCenter", + type: '{ tag: "BottomCenter"; value?: undefined }', + }, + { + name: "BottomEnd", + type: '{ tag: "BottomEnd"; value?: undefined }', + }, + ], + }, + { + id: "custom-renderer-node", + name: "CustomRendererNode", + category: "chat", + definition: + 'export type CustomRendererNode =\n | { tag: "Nil"; value?: undefined }\n | { tag: "String"; value: { text: string } }\n | { tag: "Box"; value: Component }\n | { tag: "Column"; value: Component }\n | { tag: "Row"; value: Component }\n | { tag: "Spacer"; value: Component }\n | { tag: "Text"; value: Component }\n | { tag: "Button"; value: Component }\n | { tag: "TextField"; value: Component }\n;', + description: + "A node in the custom renderer UI tree. Can be nested recursively via the\n`children` field of each [`Component`].", + variants: [ + { + name: "Nil", + type: '{ tag: "Nil"; value?: undefined }', + description: "Empty node.", + }, + { + name: "String", + type: '{ tag: "String"; value: { text: string } }', + description: "Raw text string.", + }, + { + name: "Box", + type: '{ tag: "Box"; value: Component }', + description: "Generic container.", + }, + { + name: "Column", + type: '{ tag: "Column"; value: Component }', + description: "Vertical layout.", + }, + { + name: "Row", + type: '{ tag: "Row"; value: Component }', + description: "Horizontal layout.", + }, + { + name: "Spacer", + type: '{ tag: "Spacer"; value: Component }', + description: "Flexible space.", + }, + { + name: "Text", + type: '{ tag: "Text"; value: Component }', + description: "Text display.", + }, + { + name: "Button", + type: '{ tag: "Button"; value: Component }', + description: "Interactive button.", + }, + { + name: "TextField", + type: '{ tag: "TextField"; value: Component }', + description: "Text input.", + }, + ], + }, + { + id: "dimensions", + name: "Dimensions", + category: "chat", + definition: + "export interface Dimensions {\n top: Size;\n end: Size;\n bottom?: Size;\n start?: Size;\n}", + description: + "CSS-like dimensions: (top, end, bottom, start).\nBottom defaults to top, start defaults to end when `None`.", + fields: [ + { + name: "top", + type: "Size", + description: "Top dimension.", + }, + { + name: "end", + type: "Size", + description: "End dimension.", + }, + { + name: "bottom", + type: "Size | undefined", + description: "Bottom dimension. Defaults to top when absent.", + }, + { + name: "start", + type: "Size | undefined", + description: "Start dimension. Defaults to end when absent.", + }, + ], + }, + { + id: "generic-error", + name: "GenericError", + category: "common", + definition: "export interface GenericError {\n reason: string;\n}", + description: + "Generic error payload carrying a human-readable reason string. Used by many\nmethods as a catch-all error type.", + fields: [ + { + name: "reason", + type: "string", + }, + ], + }, + { + id: "genesis-hash", + name: "GenesisHash", + category: "transaction", + definition: "export type GenesisHash = HexString;", + description: + "A 32-byte chain genesis hash used to identify the target chain.", + }, + { + id: "horizontal-alignment", + name: "HorizontalAlignment", + category: "chat", + definition: 'export type HorizontalAlignment = "Start" | "Center" | "End";', + description: "Horizontal alignment options.", + variants: [ + { + name: "Start", + type: '{ tag: "Start"; value?: undefined }', + }, + { + name: "Center", + type: '{ tag: "Center"; value?: undefined }', + }, + { + name: "End", + type: '{ tag: "End"; value?: undefined }', + }, + ], + }, + { + id: "host-account-connection-status-subscribe-item", + name: "HostAccountConnectionStatusSubscribeItem", + category: "account", + definition: + 'export type HostAccountConnectionStatusSubscribeItem = "Disconnected" | "Connected";', + description: "User's authentication state.", + variants: [ + { + name: "Disconnected", + type: '{ tag: "Disconnected"; value?: undefined }', + }, + { + name: "Connected", + type: '{ tag: "Connected"; value?: undefined }', + }, + ], + }, + { + id: "host-account-create-proof-error", + name: "HostAccountCreateProofError", + category: "account", + definition: + 'export type HostAccountCreateProofError =\n | { tag: "RingNotFound"; value?: undefined }\n | { tag: "Rejected"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Error returned when ring VRF proof creation fails.", + variants: [ + { + name: "RingNotFound", + type: '{ tag: "RingNotFound"; value?: undefined }', + description: "Ring not available at the specified location.", + }, + { + name: "Rejected", + type: '{ tag: "Rejected"; value?: undefined }', + description: "User or host rejected.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-account-create-proof-request", + name: "HostAccountCreateProofRequest", + category: "account", + definition: + "export interface HostAccountCreateProofRequest {\n productAccountId: ProductAccountId;\n ringLocation: RingLocation;\n context: HexString;\n}", + description: "Request to create a ring VRF proof for a product account.", + fields: [ + { + name: "product_account_id", + type: "ProductAccountId", + description: "Product account that should create the proof.", + }, + { + name: "ring_location", + type: "RingLocation", + description: "Ring location to use for proof generation.", + }, + { + name: "context", + type: "HexString", + description: "Context bytes bound to the proof.", + }, + ], + }, + { + id: "host-account-create-proof-response", + name: "HostAccountCreateProofResponse", + category: "account", + definition: + "export interface HostAccountCreateProofResponse {\n proof: HexString;\n}", + description: "Response containing a ring VRF proof.", + fields: [ + { + name: "proof", + type: "HexString", + description: "Variable-length ring VRF proof bytes.", + }, + ], + }, + { + id: "host-account-get-alias-request", + name: "HostAccountGetAliasRequest", + category: "account", + definition: + "export interface HostAccountGetAliasRequest {\n productAccountId: ProductAccountId;\n}", + description: + "Request to retrieve a contextual alias for a product account.", + fields: [ + { + name: "product_account_id", + type: "ProductAccountId", + description: "Product account to derive the alias for.", + }, + ], + }, + { + id: "host-account-get-alias-response", + name: "HostAccountGetAliasResponse", + category: "account", + definition: + "export interface HostAccountGetAliasResponse {\n context: HexString;\n alias: HexString;\n}", + description: + "A privacy-preserving alias derived via ring VRF, bound to a specific context.", + fields: [ + { + name: "context", + type: "HexString", + description: "32-byte context identifier.", + }, + { + name: "alias", + type: "HexString", + description: "Ring VRF alias (variable length).", + }, + ], + }, + { + id: "host-account-get-error", + name: "HostAccountGetError", + category: "account", + definition: + 'export type HostAccountGetError =\n | { tag: "NotConnected"; value?: undefined }\n | { tag: "Rejected"; value?: undefined }\n | { tag: "DomainNotValid"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Error returned when credential/account requests fail.", + variants: [ + { + name: "NotConnected", + type: '{ tag: "NotConnected"; value?: undefined }', + description: "User is not logged in.", + }, + { + name: "Rejected", + type: '{ tag: "Rejected"; value?: undefined }', + description: "User or host rejected the request.", + }, + { + name: "DomainNotValid", + type: '{ tag: "DomainNotValid"; value?: undefined }', + description: "Domain identifier is invalid.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all error with reason.", + }, + ], + }, + { + id: "host-account-get-request", + name: "HostAccountGetRequest", + category: "account", + definition: + "export interface HostAccountGetRequest {\n productAccountId: ProductAccountId;\n}", + description: "Request to retrieve a product-scoped account.", + fields: [ + { + name: "product_account_id", + type: "ProductAccountId", + description: "Product account to retrieve.", + }, + ], + }, + { + id: "host-account-get-response", + name: "HostAccountGetResponse", + category: "account", + definition: + "export interface HostAccountGetResponse {\n account: ProductAccount;\n}", + description: "Response containing a product-scoped account.", + fields: [ + { + name: "account", + type: "ProductAccount", + description: "Retrieved product account.", + }, + ], + }, + { + id: "host-chat-action-subscribe-item", + name: "HostChatActionSubscribeItem", + category: "chat", + definition: + "export interface HostChatActionSubscribeItem {\n roomId: string;\n peer: string;\n payload: ChatActionPayload;\n}", + description: "A chat action received from the host.", + fields: [ + { + name: "room_id", + type: "string", + description: "Room where the action occurred.", + }, + { + name: "peer", + type: "string", + description: "Peer who initiated the action.", + }, + { + name: "payload", + type: "ChatActionPayload", + description: "The action payload.", + }, + ], + }, + { + id: "host-chat-create-room-error", + name: "HostChatCreateRoomError", + category: "chat", + definition: + 'export type HostChatCreateRoomError =\n | { tag: "PermissionDenied"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Chat room registration error.", + variants: [ + { + name: "PermissionDenied", + type: '{ tag: "PermissionDenied"; value?: undefined }', + description: "Not allowed.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-chat-create-room-request", + name: "HostChatCreateRoomRequest", + category: "chat", + definition: + "export interface HostChatCreateRoomRequest {\n roomId: string;\n name: string;\n icon: string;\n}", + description: "Request to create a chat room.", + fields: [ + { + name: "room_id", + type: "string", + description: "Unique room identifier.", + }, + { + name: "name", + type: "string", + description: "Room display name.", + }, + { + name: "icon", + type: "string", + description: "URL or base64 image.", + }, + ], + }, + { + id: "host-chat-create-room-response", + name: "HostChatCreateRoomResponse", + category: "chat", + definition: + "export interface HostChatCreateRoomResponse {\n status: ChatRoomRegistrationStatus;\n}", + description: "Result of a room registration.", + fields: [ + { + name: "status", + type: "ChatRoomRegistrationStatus", + description: "`New` or `Exists`.", + }, + ], + }, + { + id: "host-chat-list-subscribe-item", + name: "HostChatListSubscribeItem", + category: "chat", + definition: + "export interface HostChatListSubscribeItem {\n rooms: Array;\n}", + description: "Item containing the current chat rooms.", + fields: [ + { + name: "rooms", + type: "Array", + description: "Chat rooms the product participates in.", + }, + ], + }, + { + id: "host-chat-post-message-error", + name: "HostChatPostMessageError", + category: "chat", + definition: + 'export type HostChatPostMessageError =\n | { tag: "MessageTooLarge"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Chat message posting error.", + variants: [ + { + name: "MessageTooLarge", + type: '{ tag: "MessageTooLarge"; value?: undefined }', + description: "Message exceeded size limit.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-chat-post-message-request", + name: "HostChatPostMessageRequest", + category: "chat", + definition: + "export interface HostChatPostMessageRequest {\n roomId: string;\n payload: ChatMessageContent;\n}", + description: "Request to post a message to a chat room.", + fields: [ + { + name: "room_id", + type: "string", + description: "Room to post to.", + }, + { + name: "payload", + type: "ChatMessageContent", + description: "Message content.", + }, + ], + }, + { + id: "host-chat-post-message-response", + name: "HostChatPostMessageResponse", + category: "chat", + definition: + "export interface HostChatPostMessageResponse {\n messageId: string;\n}", + description: "Result of posting a message.", + fields: [ + { + name: "message_id", + type: "string", + description: "Assigned message ID.", + }, + ], + }, + { + id: "host-chat-register-bot-error", + name: "HostChatRegisterBotError", + category: "chat", + definition: + 'export type HostChatRegisterBotError =\n | { tag: "PermissionDenied"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Chat bot registration error.", + variants: [ + { + name: "PermissionDenied", + type: '{ tag: "PermissionDenied"; value?: undefined }', + description: "Not allowed.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-chat-register-bot-request", + name: "HostChatRegisterBotRequest", + category: "chat", + definition: + "export interface HostChatRegisterBotRequest {\n botId: string;\n name: string;\n icon: string;\n}", + description: "Request to register a chat bot.", + fields: [ + { + name: "bot_id", + type: "string", + description: "Unique bot identifier.", + }, + { + name: "name", + type: "string", + description: "Bot display name.", + }, + { + name: "icon", + type: "string", + description: "URL or base64 image.", + }, + ], + }, + { + id: "host-chat-register-bot-response", + name: "HostChatRegisterBotResponse", + category: "chat", + definition: + "export interface HostChatRegisterBotResponse {\n status: ChatBotRegistrationStatus;\n}", + description: "Result of a bot registration.", + fields: [ + { + name: "status", + type: "ChatBotRegistrationStatus", + description: "`New` or `Exists`.", + }, + ], + }, + { + id: "host-coin-payment-create-cheque-request", + name: "HostCoinPaymentCreateChequeRequest", + category: "coin_payment", + definition: + "export interface HostCoinPaymentCreateChequeRequest {\n from: CoinPaymentPurseId;\n to: CoinPaymentReceivable;\n amount: CoinPaymentBalance;\n}", + description: + "Request to create a cheque from a local purse to a receivable.", + fields: [ + { + name: "from", + type: "CoinPaymentPurseId", + description: "Source purse.", + }, + { + name: "to", + type: "CoinPaymentReceivable", + description: "Destination receivable.", + }, + { + name: "amount", + type: "CoinPaymentBalance", + description: "Payment amount.", + }, + ], + }, + { + id: "host-coin-payment-create-cheque-response", + name: "HostCoinPaymentCreateChequeResponse", + category: "coin_payment", + definition: + "export interface HostCoinPaymentCreateChequeResponse {\n cheque: CoinPaymentCheque;\n}", + description: "Created cheque response.", + fields: [ + { + name: "cheque", + type: "CoinPaymentCheque", + description: "Encrypted cheque.", + }, + ], + }, + { + id: "host-coin-payment-create-purse-request", + name: "HostCoinPaymentCreatePurseRequest", + category: "coin_payment", + definition: + "export interface HostCoinPaymentCreatePurseRequest {\n name: string;\n}", + description: "Request to create a new firewalled CoinPayment purse.", + fields: [ + { + name: "name", + type: "string", + description: "Human-readable purse name.", + }, + ], + }, + { + id: "host-coin-payment-create-purse-response", + name: "HostCoinPaymentCreatePurseResponse", + category: "coin_payment", + definition: + "export interface HostCoinPaymentCreatePurseResponse {\n purse: CoinPaymentPurseId;\n}", + description: "Created purse identifier.", + fields: [ + { + name: "purse", + type: "CoinPaymentPurseId", + description: "Assigned purse identifier.", + }, + ], + }, + { + id: "host-coin-payment-create-receivable-request", + name: "HostCoinPaymentCreateReceivableRequest", + category: "coin_payment", + definition: + "export interface HostCoinPaymentCreateReceivableRequest {\n into: CoinPaymentPurseId;\n}", + description: "Request to create a fresh receivable for a purse.", + fields: [ + { + name: "into", + type: "CoinPaymentPurseId", + description: "Target purse for future deposits.", + }, + ], + }, + { + id: "host-coin-payment-create-receivable-response", + name: "HostCoinPaymentCreateReceivableResponse", + category: "coin_payment", + definition: + "export interface HostCoinPaymentCreateReceivableResponse {\n receivable: CoinPaymentReceivable;\n}", + description: "Created receivable response.", + fields: [ + { + name: "receivable", + type: "CoinPaymentReceivable", + description: "Receivable public key.", + }, + ], + }, + { + id: "host-coin-payment-delete-purse-request", + name: "HostCoinPaymentDeletePurseRequest", + category: "coin_payment", + definition: + "export interface HostCoinPaymentDeletePurseRequest {\n target: CoinPaymentPurseId;\n drainInto: CoinPaymentPurseId;\n}", + description: "Request to delete a purse after draining its balance.", + fields: [ + { + name: "target", + type: "CoinPaymentPurseId", + description: "Purse to delete.", + }, + { + name: "drain_into", + type: "CoinPaymentPurseId", + description: "Purse that receives drained funds.", + }, + ], + }, + { + id: "host-coin-payment-deposit-request", + name: "HostCoinPaymentDepositRequest", + category: "coin_payment", + definition: + "export interface HostCoinPaymentDepositRequest {\n cheque: CoinPaymentCheque;\n}", + description: + "Request to deposit a cheque into the purse associated with its receivable.", + fields: [ + { + name: "cheque", + type: "CoinPaymentCheque", + description: "Cheque to deposit.", + }, + ], + }, + { + id: "host-coin-payment-listen-for-item", + name: "HostCoinPaymentListenForItem", + category: "coin_payment", + definition: + 'export type HostCoinPaymentListenForItem =\n | { tag: "Channel"; value: CoinPaymentTransmissionChannel }\n | { tag: "Cheque"; value: CoinPaymentCheque }\n;', + description: "Stream item for `host_coin_payment_listen_for`.", + variants: [ + { + name: "Channel", + type: '{ tag: "Channel"; value: CoinPaymentTransmissionChannel }', + description: "Handoff channel suitable for inclusion in an invoice.", + }, + { + name: "Cheque", + type: '{ tag: "Cheque"; value: CoinPaymentCheque }', + description: "Cheque received through the handoff channel.", + }, + ], + }, + { + id: "host-coin-payment-listen-for-request", + name: "HostCoinPaymentListenForRequest", + category: "coin_payment", + definition: + "export interface HostCoinPaymentListenForRequest {\n receivable: CoinPaymentReceivable;\n}", + description: "Request to listen for a cheque delivered to a receivable.", + fields: [ + { + name: "receivable", + type: "CoinPaymentReceivable", + description: "Receivable to listen for.", + }, + ], + }, + { + id: "host-coin-payment-query-purse-request", + name: "HostCoinPaymentQueryPurseRequest", + category: "coin_payment", + definition: + "export interface HostCoinPaymentQueryPurseRequest {\n purse: CoinPaymentPurseId;\n}", + description: "Request to query product-visible purse metadata.", + fields: [ + { + name: "purse", + type: "CoinPaymentPurseId", + description: "Purse to query.", + }, + ], + }, + { + id: "host-coin-payment-query-purse-response", + name: "HostCoinPaymentQueryPurseResponse", + category: "coin_payment", + definition: + "export interface HostCoinPaymentQueryPurseResponse {\n info: CoinPaymentPurseInfo;\n}", + description: "Product-visible purse metadata response.", + fields: [ + { + name: "info", + type: "CoinPaymentPurseInfo", + description: "Purse information.", + }, + ], + }, + { + id: "host-coin-payment-rebalance-purse-request", + name: "HostCoinPaymentRebalancePurseRequest", + category: "coin_payment", + definition: + "export interface HostCoinPaymentRebalancePurseRequest {\n from: CoinPaymentPurseId;\n to: CoinPaymentPurseId;\n amount: CoinPaymentBalance;\n}", + description: "Request to transfer balance between local purses.", + fields: [ + { + name: "from", + type: "CoinPaymentPurseId", + description: "Source purse.", + }, + { + name: "to", + type: "CoinPaymentPurseId", + description: "Destination purse.", + }, + { + name: "amount", + type: "CoinPaymentBalance", + description: "Amount to move.", + }, + ], + }, + { + id: "host-coin-payment-refund-request", + name: "HostCoinPaymentRefundRequest", + category: "coin_payment", + definition: + "export interface HostCoinPaymentRefundRequest {\n receivable: CoinPaymentReceivable;\n}", + description: "Request to refund coins associated with a receivable.", + fields: [ + { + name: "receivable", + type: "CoinPaymentReceivable", + description: "Receivable to refund.", + }, + ], + }, + { + id: "host-create-transaction-error", + name: "HostCreateTransactionError", + category: "transaction", + definition: + 'export type HostCreateTransactionError =\n | { tag: "FailedToDecode"; value?: undefined }\n | { tag: "Rejected"; value?: undefined }\n | { tag: "NotSupported"; value: { reason: string } }\n | { tag: "PermissionDenied"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Transaction creation error.", + variants: [ + { + name: "FailedToDecode", + type: '{ tag: "FailedToDecode"; value?: undefined }', + description: "Payload could not be deserialized.", + }, + { + name: "Rejected", + type: '{ tag: "Rejected"; value?: undefined }', + description: "User rejected.", + }, + { + name: "NotSupported", + type: '{ tag: "NotSupported"; value: { reason: string } }', + description: "Unsupported payload version or extension.", + }, + { + name: "PermissionDenied", + type: '{ tag: "PermissionDenied"; value?: undefined }', + description: "Not authenticated.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-create-transaction-response", + name: "HostCreateTransactionResponse", + category: "signing", + definition: + "export interface HostCreateTransactionResponse {\n transaction: HexString;\n}", + description: "Response containing a created transaction.", + fields: [ + { + name: "transaction", + type: "HexString", + description: "SCALE-encoded signed transaction.", + }, + ], + }, + { + id: "host-create-transaction-with-legacy-account-response", + name: "HostCreateTransactionWithLegacyAccountResponse", + category: "signing", + definition: + "export interface HostCreateTransactionWithLegacyAccountResponse {\n transaction: HexString;\n}", + description: + "Response containing a transaction created with a non-product account.", + fields: [ + { + name: "transaction", + type: "HexString", + description: "SCALE-encoded signed transaction.", + }, + ], + }, + { + id: "host-derive-entropy-error", + name: "HostDeriveEntropyError", + category: "entropy", + definition: + 'export type HostDeriveEntropyError =\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Error from [`crate::api::Entropy::derive`] (RFC 0007).", + variants: [ + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-derive-entropy-request", + name: "HostDeriveEntropyRequest", + category: "entropy", + definition: + "export interface HostDeriveEntropyRequest {\n context: HexString;\n}", + description: + "Request to derive deterministic per-product entropy (RFC 0007).\n\nThe host derives 32 bytes from product-scoped seed material and `context`.\nRepeated calls with the same `context` for the same product yield the same\nentropy.", + fields: [ + { + name: "context", + type: "HexString", + description: "Domain-separated derivation context.", + }, + ], + }, + { + id: "host-derive-entropy-response", + name: "HostDeriveEntropyResponse", + category: "entropy", + definition: + "export interface HostDeriveEntropyResponse {\n entropy: HexString;\n}", + description: + "Response carrying 32 bytes of deterministically derived entropy.", + fields: [ + { + name: "entropy", + type: "HexString", + description: "32 bytes of derived entropy.", + }, + ], + }, + { + id: "host-device-permission-request", + name: "HostDevicePermissionRequest", + category: "permissions", + definition: + 'export type HostDevicePermissionRequest = "Notifications" | "Camera" | "Microphone" | "Bluetooth" | "NFC" | "Location" | "Clipboard" | "OpenUrl" | "Biometrics";', + description: + "Device-capability permission requested from the host (RFC 0002).\n\nThe user's decision is persisted indefinitely after the first prompt and\nsurvives app restarts, whether the decision was grant or deny; the host\ndoes not re-prompt on subsequent requests for the same capability.", + variants: [ + { + name: "Notifications", + type: '{ tag: "Notifications"; value?: undefined }', + }, + { + name: "Camera", + type: '{ tag: "Camera"; value?: undefined }', + }, + { + name: "Microphone", + type: '{ tag: "Microphone"; value?: undefined }', + }, + { + name: "Bluetooth", + type: '{ tag: "Bluetooth"; value?: undefined }', + }, + { + name: "NFC", + type: '{ tag: "NFC"; value?: undefined }', + }, + { + name: "Location", + type: '{ tag: "Location"; value?: undefined }', + }, + { + name: "Clipboard", + type: '{ tag: "Clipboard"; value?: undefined }', + }, + { + name: "OpenUrl", + type: '{ tag: "OpenUrl"; value?: undefined }', + }, + { + name: "Biometrics", + type: '{ tag: "Biometrics"; value?: undefined }', + }, + ], + }, + { + id: "host-device-permission-response", + name: "HostDevicePermissionResponse", + category: "permissions", + definition: + "export interface HostDevicePermissionResponse {\n granted: boolean;\n}", + description: "Outcome of a device-permission request.", + fields: [ + { + name: "granted", + type: "boolean", + description: "Whether the permission was granted.", + }, + ], + }, + { + id: "host-feature-supported-request", + name: "HostFeatureSupportedRequest", + category: "system", + definition: + 'export type HostFeatureSupportedRequest =\n | { tag: "Chain"; value: { genesisHash: HexString } }\n;', + description: "Request to query whether a feature is supported by the host.", + variants: [ + { + name: "Chain", + type: '{ tag: "Chain"; value: { genesisHash: HexString } }', + description: + "Ask whether the host can interact with the chain identified by genesis hash.", + }, + ], + }, + { + id: "host-feature-supported-response", + name: "HostFeatureSupportedResponse", + category: "system", + definition: + "export interface HostFeatureSupportedResponse {\n supported: boolean;\n}", + description: "Response to a feature-support query.", + fields: [ + { + name: "supported", + type: "boolean", + description: "Whether the feature is supported.", + }, + ], + }, + { + id: "host-get-legacy-accounts-response", + name: "HostGetLegacyAccountsResponse", + category: "account", + definition: + "export interface HostGetLegacyAccountsResponse {\n accounts: Array;\n}", + description: + "Response containing all legacy (user-imported) accounts owned by the user.", + fields: [ + { + name: "accounts", + type: "Array", + description: "Legacy accounts.", + }, + ], + }, + { + id: "host-get-user-id-error", + name: "HostGetUserIdError", + category: "account", + definition: + 'export type HostGetUserIdError =\n | { tag: "PermissionDenied"; value?: undefined }\n | { tag: "NotConnected"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Error from [`crate::api::Account::get_user_id`].", + variants: [ + { + name: "PermissionDenied", + type: '{ tag: "PermissionDenied"; value?: undefined }', + description: "User denied the identity disclosure request.", + }, + { + name: "NotConnected", + type: '{ tag: "NotConnected"; value?: undefined }', + description: "User is not logged in.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-get-user-id-response", + name: "HostGetUserIdResponse", + category: "account", + definition: + "export interface HostGetUserIdResponse {\n primaryUsername: string;\n}", + description: "The user's primary DotNS account identity.", + fields: [ + { + name: "primary_username", + type: "string", + description: "The user's primary DotNS username.", + }, + ], + }, + { + id: "host-handshake-error", + name: "HostHandshakeError", + category: "system", + definition: + 'export type HostHandshakeError =\n | { tag: "Timeout"; value?: undefined }\n | { tag: "UnsupportedProtocolVersion"; value?: undefined }\n | { tag: "Unknown"; value: GenericError }\n;', + description: + "Error from [`crate::api::System::handshake`] (RFC 0009).\n\nThe handshake is the first call on a fresh connection; it does not require\nuser authentication and is used to negotiate the wire codec version.", + variants: [ + { + name: "Timeout", + type: '{ tag: "Timeout"; value?: undefined }', + description: "Host did not complete the handshake in time.", + }, + { + name: "UnsupportedProtocolVersion", + type: '{ tag: "UnsupportedProtocolVersion"; value?: undefined }', + description: + "Host does not speak the codec version requested by the product.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: GenericError }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-handshake-request", + name: "HostHandshakeRequest", + category: "system", + definition: + "export interface HostHandshakeRequest {\n codecVersion: number;\n}", + description: + "Wire-codec negotiation payload sent by the product (RFC 0009).", + fields: [ + { + name: "codec_version", + type: "number", + description: "Wire codec version requested by the product.", + }, + ], + }, + { + id: "host-local-storage-clear-request", + name: "HostLocalStorageClearRequest", + category: "local_storage", + definition: + "export interface HostLocalStorageClearRequest {\n key: string;\n}", + description: "Request to clear a local storage key.", + fields: [ + { + name: "key", + type: "string", + description: "Storage key to clear.", + }, + ], + }, + { + id: "host-local-storage-read-error", + name: "HostLocalStorageReadError", + category: "local_storage", + definition: + 'export type HostLocalStorageReadError =\n | { tag: "Full"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Local storage operation error.", + variants: [ + { + name: "Full", + type: '{ tag: "Full"; value?: undefined }', + description: "Storage quota exceeded.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-local-storage-read-request", + name: "HostLocalStorageReadRequest", + category: "local_storage", + definition: + "export interface HostLocalStorageReadRequest {\n key: string;\n}", + description: "Request to read a local storage value.", + fields: [ + { + name: "key", + type: "string", + description: "Storage key to read.", + }, + ], + }, + { + id: "host-local-storage-read-response", + name: "HostLocalStorageReadResponse", + category: "local_storage", + definition: + "export interface HostLocalStorageReadResponse {\n value?: HexString;\n}", + description: "Response containing an optional local storage value.", + fields: [ + { + name: "value", + type: "HexString | undefined", + description: "Stored value, if present.", + }, + ], + }, + { + id: "host-local-storage-write-request", + name: "HostLocalStorageWriteRequest", + category: "local_storage", + definition: + "export interface HostLocalStorageWriteRequest {\n key: string;\n value: HexString;\n}", + description: "Request to write a value into local storage.", + fields: [ + { + name: "key", + type: "string", + description: "Storage key to write.", + }, + { + name: "value", + type: "HexString", + description: "Value to store at the key.", + }, + ], + }, + { + id: "host-navigate-to-error", + name: "HostNavigateToError", + category: "system", + definition: + 'export type HostNavigateToError =\n | { tag: "PermissionDenied"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Error from [`crate::api::System::navigate_to`].", + variants: [ + { + name: "PermissionDenied", + type: '{ tag: "PermissionDenied"; value?: undefined }', + description: "User denied the navigation prompt.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-navigate-to-request", + name: "HostNavigateToRequest", + category: "system", + definition: "export interface HostNavigateToRequest {\n url: string;\n}", + description: "Request to navigate the host to an external URL.", + fields: [ + { + name: "url", + type: "string", + description: "URL to open.", + }, + ], + }, + { + id: "host-payment-balance-subscribe-error", + name: "HostPaymentBalanceSubscribeError", + category: "payment", + definition: + 'export type HostPaymentBalanceSubscribeError =\n | { tag: "PermissionDenied"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: + "Error from [`crate::api::Payment::balance_subscribe`].\n\nSee [RFC 0006].\n\n[RFC 0006]: https://github.com/paritytech/triangle-js-sdks/pull/94", + variants: [ + { + name: "PermissionDenied", + type: '{ tag: "PermissionDenied"; value?: undefined }', + description: "User denied the balance disclosure request.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-payment-balance-subscribe-item", + name: "HostPaymentBalanceSubscribeItem", + category: "payment", + definition: + "export interface HostPaymentBalanceSubscribeItem {\n available: Balance;\n}", + description: + "Current payment balance state pushed to subscribers.\n\nSee [RFC 0006].\n\n[RFC 0006]: https://github.com/paritytech/triangle-js-sdks/pull/94", + fields: [ + { + name: "available", + type: "Balance", + description: "Balance that can be spent right now.", + }, + ], + }, + { + id: "host-payment-balance-subscribe-request", + name: "HostPaymentBalanceSubscribeRequest", + category: "payment", + definition: + "export interface HostPaymentBalanceSubscribeRequest {\n purse?: CoinPaymentPurseId;\n}", + description: "Request to subscribe to payment balance updates.", + fields: [ + { + name: "purse", + type: "CoinPaymentPurseId | undefined", + description: "Optional purse selector. `None` means MAIN_PURSE.", + }, + ], + }, + { + id: "host-payment-error", + name: "HostPaymentError", + category: "payment", + definition: + 'export type HostPaymentError =\n | { tag: "Rejected"; value?: undefined }\n | { tag: "InsufficientBalance"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: + "Error from [`crate::api::Payment::request`].\n\nSee [RFC 0006].\n\n[RFC 0006]: https://github.com/paritytech/triangle-js-sdks/pull/94", + variants: [ + { + name: "Rejected", + type: '{ tag: "Rejected"; value?: undefined }', + description: "User rejected the payment request.", + }, + { + name: "InsufficientBalance", + type: '{ tag: "InsufficientBalance"; value?: undefined }', + description: + "User's available balance is not sufficient for the requested amount.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-payment-request", + name: "HostPaymentRequest", + category: "payment", + definition: + "export interface HostPaymentRequest {\n from?: CoinPaymentPurseId;\n amount: Balance;\n destination: HexString;\n}", + description: "Request to initiate a payment to another account.", + fields: [ + { + name: "from", + type: "CoinPaymentPurseId | undefined", + description: "Optional purse selector. `None` means MAIN_PURSE.", + }, + { + name: "amount", + type: "Balance", + description: "Amount to pay.", + }, + { + name: "destination", + type: "HexString", + description: "Destination account.", + }, + ], + }, + { + id: "host-payment-response", + name: "HostPaymentResponse", + category: "payment", + definition: "export interface HostPaymentResponse {\n id: string;\n}", + description: + "Receipt returned after a successful payment request.\n\nSee [RFC 0006].\n\n[RFC 0006]: https://github.com/paritytech/triangle-js-sdks/pull/94", + fields: [ + { + name: "id", + type: "string", + description: "The assigned payment identifier.", + }, + ], + }, + { + id: "host-payment-status-subscribe-error", + name: "HostPaymentStatusSubscribeError", + category: "payment", + definition: + 'export type HostPaymentStatusSubscribeError =\n | { tag: "PaymentNotFound"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: + "Error from [`crate::api::Payment::status_subscribe`].\n\nSee [RFC 0006].\n\n[RFC 0006]: https://github.com/paritytech/triangle-js-sdks/pull/94", + variants: [ + { + name: "PaymentNotFound", + type: '{ tag: "PaymentNotFound"; value?: undefined }', + description: + "Payment ID was not found or does not belong to the current product.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-payment-status-subscribe-item", + name: "HostPaymentStatusSubscribeItem", + category: "payment", + definition: + 'export type HostPaymentStatusSubscribeItem =\n | { tag: "Processing"; value?: undefined }\n | { tag: "Completed"; value?: undefined }\n | { tag: "Failed"; value: { reason: string } }\n;', + description: + "Payment lifecycle status pushed to subscribers.\n\nOnce a terminal state (`Completed` or `Failed`) is reached, the host\ndelivers it and may close the subscription.\n\nSee [RFC 0006].\n\n[RFC 0006]: https://github.com/paritytech/triangle-js-sdks/pull/94", + variants: [ + { + name: "Processing", + type: '{ tag: "Processing"; value?: undefined }', + description: "Payment is being processed.", + }, + { + name: "Completed", + type: '{ tag: "Completed"; value?: undefined }', + description: "Payment has been settled successfully.", + }, + { + name: "Failed", + type: '{ tag: "Failed"; value: { reason: string } }', + description: "Payment has failed.", + }, + ], + }, + { + id: "host-payment-status-subscribe-request", + name: "HostPaymentStatusSubscribeRequest", + category: "payment", + definition: + "export interface HostPaymentStatusSubscribeRequest {\n paymentId: string;\n}", + description: "Request to subscribe to a payment status.", + fields: [ + { + name: "payment_id", + type: "string", + description: "Payment identifier to watch.", + }, + ], + }, + { + id: "host-payment-top-up-error", + name: "HostPaymentTopUpError", + category: "payment", + definition: + 'export type HostPaymentTopUpError =\n | { tag: "InsufficientFunds"; value?: undefined }\n | { tag: "InvalidSource"; value?: undefined }\n | { tag: "PartialPayment"; value: { credited: Balance } }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: + "Error from [`crate::api::Payment::top_up`].\n\nSee [RFC 0006].\n\n[RFC 0006]: https://github.com/paritytech/triangle-js-sdks/pull/94", + variants: [ + { + name: "InsufficientFunds", + type: '{ tag: "InsufficientFunds"; value?: undefined }', + description: "The source account does not hold sufficient funds.", + }, + { + name: "InvalidSource", + type: '{ tag: "InvalidSource"; value?: undefined }', + description: "The source account was not found or is invalid.", + }, + { + name: "PartialPayment", + type: '{ tag: "PartialPayment"; value: { credited: Balance } }', + description: + "Some coins were claimed but the total fell short of the requested amount.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-payment-top-up-request", + name: "HostPaymentTopUpRequest", + category: "payment", + definition: + "export interface HostPaymentTopUpRequest {\n into?: CoinPaymentPurseId;\n amount: Balance;\n source: PaymentTopUpSource;\n}", + description: "Request to top up the product payment balance.", + fields: [ + { + name: "into", + type: "CoinPaymentPurseId | undefined", + description: "Optional purse selector. `None` means MAIN_PURSE.", + }, + { + name: "amount", + type: "Balance", + description: "Amount to top up.", + }, + { + name: "source", + type: "PaymentTopUpSource", + description: "Funding source for the top-up.", + }, + ], + }, + { + id: "host-push-notification-cancel-request", + name: "HostPushNotificationCancelRequest", + category: "notifications", + definition: + "export interface HostPushNotificationCancelRequest {\n id: NotificationId;\n}", + description: "Request to cancel a previously scheduled notification.", + fields: [ + { + name: "id", + type: "NotificationId", + description: + "The notification identifier returned by [`HostPushNotificationResponse`].", + }, + ], + }, + { + id: "host-push-notification-error", + name: "HostPushNotificationError", + category: "notifications", + definition: + 'export type HostPushNotificationError =\n | { tag: "ScheduleLimitReached"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Push notification error.", + variants: [ + { + name: "ScheduleLimitReached", + type: '{ tag: "ScheduleLimitReached"; value?: undefined }', + description: + "The host-wide queue of pending scheduled notifications is full.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-push-notification-request", + name: "HostPushNotificationRequest", + category: "notifications", + definition: + "export interface HostPushNotificationRequest {\n text: string;\n deeplink?: string;\n scheduledAt?: bigint;\n}", + description: + "Push notification payload.\n\nWhen `scheduled_at` is `Some`, the notification is deferred to the given\nwall-clock instant (Unix milliseconds UTC). `None` fires immediately,\npreserving prior behaviour. See [RFC 0019].\n\n[RFC 0019]: https://github.com/paritytech/truapi/blob/main/docs/rfcs/0019-scheduled-notifications.md", + fields: [ + { + name: "text", + type: "string", + description: "Notification text.", + }, + { + name: "deeplink", + type: "string | undefined", + description: "Optional URL to open on tap.", + }, + { + name: "scheduled_at", + type: "bigint | undefined", + description: + "Optional Unix timestamp in milliseconds (UTC) at which the notification\nshould fire. `None` fires immediately.", + }, + ], + }, + { + id: "host-push-notification-response", + name: "HostPushNotificationResponse", + category: "notifications", + definition: + "export interface HostPushNotificationResponse {\n id: NotificationId;\n}", + description: + "Successful push notification response carrying the assigned id.", + fields: [ + { + name: "id", + type: "NotificationId", + description: "Host-assigned notification identifier.", + }, + ], + }, + { + id: "host-request-login-error", + name: "HostRequestLoginError", + category: "account", + definition: + 'export type HostRequestLoginError =\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Login request error.", + variants: [ + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-request-login-request", + name: "HostRequestLoginRequest", + category: "account", + definition: + "export interface HostRequestLoginRequest {\n reason?: string;\n}", + description: "Request to present the host login flow.", + fields: [ + { + name: "reason", + type: "string | undefined", + description: "Optional human-readable reason shown in the login UI.", + }, + ], + }, + { + id: "host-request-login-response", + name: "HostRequestLoginResponse", + category: "account", + definition: + 'export type HostRequestLoginResponse = "Success" | "AlreadyConnected" | "Rejected";', + description: "Result of a login request.", + variants: [ + { + name: "Success", + type: '{ tag: "Success"; value?: undefined }', + description: "User successfully authenticated.", + }, + { + name: "AlreadyConnected", + type: '{ tag: "AlreadyConnected"; value?: undefined }', + description: "User is already authenticated — no action was taken.", + }, + { + name: "Rejected", + type: '{ tag: "Rejected"; value?: undefined }', + description: "User dismissed/rejected the login UI.", + }, + ], + }, + { + id: "host-request-resource-allocation-request", + name: "HostRequestResourceAllocationRequest", + category: "resource_allocation", + definition: + "export interface HostRequestResourceAllocationRequest {\n resources: Array;\n}", + description: "Batched resource pre-allocation request (RFC 0010).", + fields: [ + { + name: "resources", + type: "Array", + description: "Resources to allocate.", + }, + ], + }, + { + id: "host-request-resource-allocation-response", + name: "HostRequestResourceAllocationResponse", + category: "resource_allocation", + definition: + "export interface HostRequestResourceAllocationResponse {\n outcomes: Array;\n}", + description: + "Per-resource outcomes for a batched allocation request (RFC 0010).", + fields: [ + { + name: "outcomes", + type: "Array", + description: + "Per-resource allocation outcomes, in the same order as the request.", + }, + ], + }, + { + id: "host-sign-payload-data", + name: "HostSignPayloadData", + category: "signing", + definition: + "export interface HostSignPayloadData {\n blockHash: HexString;\n blockNumber: HexString;\n era: HexString;\n genesisHash: HexString;\n method: HexString;\n nonce: HexString;\n specVersion: HexString;\n tip: HexString;\n transactionVersion: HexString;\n signedExtensions: Array;\n version: number;\n assetId?: HexString;\n metadataHash?: HexString;\n mode?: number;\n withSignedTransaction?: boolean;\n}", + description: + "Full Substrate extrinsic signing payload with all fields needed for signature\ngeneration.", + fields: [ + { + name: "block_hash", + type: "HexString", + description: "Reference block hash.", + }, + { + name: "block_number", + type: "HexString", + description: "Reference block number.", + }, + { + name: "era", + type: "HexString", + description: "Mortality era encoding.", + }, + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "method", + type: "HexString", + description: "SCALE-encoded call data.", + }, + { + name: "nonce", + type: "HexString", + description: "Account nonce.", + }, + { + name: "spec_version", + type: "HexString", + description: "Runtime spec version.", + }, + { + name: "tip", + type: "HexString", + description: "Transaction tip.", + }, + { + name: "transaction_version", + type: "HexString", + description: "Transaction format version.", + }, + { + name: "signed_extensions", + type: "Array", + description: "Extension identifiers.", + }, + { + name: "version", + type: "number", + description: "Extrinsic version.", + }, + { + name: "asset_id", + type: "HexString | undefined", + description: "For multi-asset tips.", + }, + { + name: "metadata_hash", + type: "HexString | undefined", + description: "CheckMetadataHash extension.", + }, + { + name: "mode", + type: "number | undefined", + description: "Metadata mode.", + }, + { + name: "with_signed_transaction", + type: "boolean | undefined", + description: "Request signed transaction back.", + }, + ], + }, + { + id: "host-sign-payload-error", + name: "HostSignPayloadError", + category: "signing", + definition: + 'export type HostSignPayloadError =\n | { tag: "FailedToDecode"; value?: undefined }\n | { tag: "Rejected"; value?: undefined }\n | { tag: "PermissionDenied"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Signing operation error.", + variants: [ + { + name: "FailedToDecode", + type: '{ tag: "FailedToDecode"; value?: undefined }', + description: "Payload could not be deserialized.", + }, + { + name: "Rejected", + type: '{ tag: "Rejected"; value?: undefined }', + description: "User rejected signing.", + }, + { + name: "PermissionDenied", + type: '{ tag: "PermissionDenied"; value?: undefined }', + description: "Not authenticated.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "host-sign-payload-request", + name: "HostSignPayloadRequest", + category: "signing", + definition: + "export interface HostSignPayloadRequest {\n account: ProductAccountId;\n payload: HostSignPayloadData;\n}", + description: "Request to sign an extrinsic payload with a product account.", + fields: [ + { + name: "account", + type: "ProductAccountId", + description: "Product account that will sign this payload.", + }, + { + name: "payload", + type: "HostSignPayloadData", + description: "The extrinsic payload to sign.", + }, + ], + }, + { + id: "host-sign-payload-response", + name: "HostSignPayloadResponse", + category: "signing", + definition: + "export interface HostSignPayloadResponse {\n signature: HexString;\n signedTransaction?: HexString;\n}", + description: "Result of a signing operation.", + fields: [ + { + name: "signature", + type: "HexString", + description: "The cryptographic signature.", + }, + { + name: "signed_transaction", + type: "HexString | undefined", + description: "Full signed transaction, if requested.", + }, + ], + }, + { + id: "host-sign-payload-with-legacy-account-request", + name: "HostSignPayloadWithLegacyAccountRequest", + category: "signing", + definition: + "export interface HostSignPayloadWithLegacyAccountRequest {\n signer: string;\n payload: HostSignPayloadData;\n}", + description: + "Sign a Substrate extrinsic payload with a non-product (legacy) account.\nContains the same fields as [`HostSignPayloadRequest`] minus `address`\n(replaced by `signer`).", + fields: [ + { + name: "signer", + type: "string", + description: "Signer address (SS58 or hex) of the legacy account.", + }, + { + name: "payload", + type: "HostSignPayloadData", + description: "The extrinsic payload to sign.", + }, + ], + }, + { + id: "host-sign-raw-request", + name: "HostSignRawRequest", + category: "signing", + definition: + "export interface HostSignRawRequest {\n account: ProductAccountId;\n payload: RawPayload;\n}", + description: + "A raw signing request pairing an account with the payload to sign.", + fields: [ + { + name: "account", + type: "ProductAccountId", + description: "Product account that will sign this payload.", + }, + { + name: "payload", + type: "RawPayload", + description: "The payload to sign.", + }, + ], + }, + { + id: "host-sign-raw-with-legacy-account-request", + name: "HostSignRawWithLegacyAccountRequest", + category: "signing", + definition: + "export interface HostSignRawWithLegacyAccountRequest {\n signer: string;\n payload: RawPayload;\n}", + description: + "Sign raw bytes with a non-product (legacy) account. The signer field\nidentifies which legacy account to use.", + fields: [ + { + name: "signer", + type: "string", + description: "Signer address (SS58 or hex) of the legacy account.", + }, + { + name: "payload", + type: "RawPayload", + description: "The data to sign.", + }, + ], + }, + { + id: "host-theme-subscribe-item", + name: "HostThemeSubscribeItem", + category: "theme", + definition: + "export interface HostThemeSubscribeItem {\n name: ThemeName;\n variant: ThemeVariant;\n}", + description: "Current theme state pushed to subscribers.", + fields: [ + { + name: "name", + type: "ThemeName", + description: "Theme name.", + }, + { + name: "variant", + type: "ThemeVariant", + description: "Light or dark variant.", + }, + ], + }, + { + id: "legacy-account", + name: "LegacyAccount", + category: "account", + definition: + "export interface LegacyAccount {\n publicKey: HexString;\n name?: string;\n}", + description: + "A user-imported (legacy) account: public key plus an optional user-chosen\ndisplay name.\n\nReturned by [`HostGetLegacyAccountsResponse`]. Distinct from\n[`ProductAccount`], which is protocol-derived and never carries a label.", + fields: [ + { + name: "public_key", + type: "HexString", + description: "The account public key (variable-length bytes).", + }, + { + name: "name", + type: "string | undefined", + description: "Optional user-chosen display name.", + }, + ], + }, + { + id: "legacy-account-tx-payload", + name: "LegacyAccountTxPayload", + category: "transaction", + definition: + "export interface LegacyAccountTxPayload {\n signer: AccountId;\n genesisHash: GenesisHash;\n callData: HexString;\n extensions: Array;\n txExtVersion: number;\n}", + description: + "Transaction payload for a legacy (non-product) account.\n\nIdentical to [`ProductAccountTxPayload`] except the signer is a raw\n32-byte [`AccountId`].", + fields: [ + { + name: "signer", + type: "AccountId", + description: "Raw 32-byte public key of the legacy account.", + }, + { + name: "genesis_hash", + type: "GenesisHash", + description: "Chain where the transaction will execute.", + }, + { + name: "call_data", + type: "HexString", + description: "SCALE-encoded Call data.", + }, + { + name: "extensions", + type: "Array", + description: "Transaction extensions supplied by the caller.", + }, + { + name: "tx_ext_version", + type: "number", + description: "0 for Extrinsic V4, runtime-supported value for V5.", + }, + ], + }, + { + id: "modifier", + name: "Modifier", + category: "chat", + definition: + 'export type Modifier =\n | { tag: "Margin"; value: Dimensions }\n | { tag: "Padding"; value: Dimensions }\n | { tag: "Background"; value: Background }\n | { tag: "Border"; value: BorderStyle }\n | { tag: "Height"; value: { height: Size } }\n | { tag: "Width"; value: { width: Size } }\n | { tag: "MinWidth"; value: { width: Size } }\n | { tag: "MinHeight"; value: { height: Size } }\n | { tag: "FillWidth"; value: { enabled: boolean } }\n | { tag: "FillHeight"; value: { enabled: boolean } }\n;', + description: + "Layout and styling modifiers applied to custom renderer components.", + variants: [ + { + name: "Margin", + type: '{ tag: "Margin"; value: Dimensions }', + description: "Outer spacing.", + }, + { + name: "Padding", + type: '{ tag: "Padding"; value: Dimensions }', + description: "Inner spacing.", + }, + { + name: "Background", + type: '{ tag: "Background"; value: Background }', + description: "Background fill.", + }, + { + name: "Border", + type: '{ tag: "Border"; value: BorderStyle }', + description: "Border style.", + }, + { + name: "Height", + type: '{ tag: "Height"; value: { height: Size } }', + description: "Fixed height.", + }, + { + name: "Width", + type: '{ tag: "Width"; value: { width: Size } }', + description: "Fixed width.", + }, + { + name: "MinWidth", + type: '{ tag: "MinWidth"; value: { width: Size } }', + description: "Minimum width.", + }, + { + name: "MinHeight", + type: '{ tag: "MinHeight"; value: { height: Size } }', + description: "Minimum height.", + }, + { + name: "FillWidth", + type: '{ tag: "FillWidth"; value: { enabled: boolean } }', + description: "Fill available width.", + }, + { + name: "FillHeight", + type: '{ tag: "FillHeight"; value: { enabled: boolean } }', + description: "Fill available height.", + }, + ], + }, + { + id: "notification-id", + name: "NotificationId", + category: "notifications", + definition: "export type NotificationId = number;", + description: + "Opaque identifier for a push notification, unique per product.", + }, + { + id: "operation-started-result", + name: "OperationStartedResult", + category: "chain", + definition: + 'export type OperationStartedResult =\n | { tag: "Started"; value: { operationId: string } }\n | { tag: "LimitReached"; value?: undefined }\n;', + variants: [ + { + name: "Started", + type: '{ tag: "Started"; value: { operationId: string } }', + }, + { + name: "LimitReached", + type: '{ tag: "LimitReached"; value?: undefined }', + }, + ], + }, + { + id: "payment-top-up-source", + name: "PaymentTopUpSource", + category: "payment", + definition: + 'export type PaymentTopUpSource =\n | { tag: "ProductAccount"; value: { derivationIndex: number } }\n | { tag: "PrivateKey"; value: { sr25519SecretKey: HexString } }\n | { tag: "Coins"; value: { sr25519SecretKeys: Array } }\n;', + description: + "Source for a payment top-up operation.\n\nSee [RFC 0006].\n\n[RFC 0006]: https://github.com/paritytech/triangle-js-sdks/pull/94", + variants: [ + { + name: "ProductAccount", + type: '{ tag: "ProductAccount"; value: { derivationIndex: number } }', + description: "Fund from one of the calling product's scoped accounts.", + }, + { + name: "PrivateKey", + type: '{ tag: "PrivateKey"; value: { sr25519SecretKey: HexString } }', + description: + "Fund from a one-time account represented by its private key. This is a\nstandard account holding public funds, not a coin key.", + }, + { + name: "Coins", + type: '{ tag: "Coins"; value: { sr25519SecretKeys: Array } }', + description: + "Fund directly from coin secret keys. Each key is an sr25519 secret\ncontrolling a single coin.", + }, + ], + }, + { + id: "preimage-submit-error", + name: "PreimageSubmitError", + category: "preimage", + definition: + 'export type PreimageSubmitError =\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Preimage submission error.", + variants: [ + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "product-account", + name: "ProductAccount", + category: "account", + definition: "export interface ProductAccount {\n publicKey: HexString;\n}", + description: "A product account: public key only, no display name.", + fields: [ + { + name: "public_key", + type: "HexString", + description: "The account public key (variable-length bytes).", + }, + ], + }, + { + id: "product-account-id", + name: "ProductAccountId", + category: "account", + definition: + "export interface ProductAccountId {\n dotNsIdentifier: string;\n derivationIndex: number;\n}", + description: + "Identifies a product-specific account by combining a dotNS domain name with a\nderivation index.", + fields: [ + { + name: "dot_ns_identifier", + type: "string", + description: + 'A dotNS domain name identifier (e.g., `"my-product.dot"`).', + }, + { + name: "derivation_index", + type: "number", + description: + "Key derivation index for generating product-specific accounts.", + }, + ], + }, + { + id: "product-account-tx-payload", + name: "ProductAccountTxPayload", + category: "transaction", + definition: + "export interface ProductAccountTxPayload {\n signer: ProductAccountId;\n genesisHash: GenesisHash;\n callData: HexString;\n extensions: Array;\n txExtVersion: number;\n}", + description: + "Transaction payload for a product account.\n\nContains everything the host needs to construct a signed extrinsic.\nThe signer is a [`ProductAccountId`]; the host resolves the\ncorresponding key pair through its account management layer.", + fields: [ + { + name: "signer", + type: "ProductAccountId", + description: "Product account that will sign the transaction.", + }, + { + name: "genesis_hash", + type: "GenesisHash", + description: "Chain where the transaction will execute.", + }, + { + name: "call_data", + type: "HexString", + description: "SCALE-encoded Call data.", + }, + { + name: "extensions", + type: "Array", + description: "Transaction extensions supplied by the caller.", + }, + { + name: "tx_ext_version", + type: "number", + description: "0 for Extrinsic V4, runtime-supported value for V5.", + }, + ], + }, + { + id: "product-chat-custom-message-render-subscribe-request", + name: "ProductChatCustomMessageRenderSubscribeRequest", + category: "chat", + definition: + "export interface ProductChatCustomMessageRenderSubscribeRequest {\n messageId: string;\n messageType: string;\n payload: HexString;\n}", + description: + "Subscribe payload identifying the chat message to render. The host responds\nwith a stream of [`CustomRendererNode`] trees describing the rendered UI.", + fields: [ + { + name: "message_id", + type: "string", + description: "Message identifier.", + }, + { + name: "message_type", + type: "string", + description: "Application-defined message type.", + }, + { + name: "payload", + type: "HexString", + description: "Binary payload.", + }, + ], + }, + { + id: "raw-payload", + name: "RawPayload", + category: "signing", + definition: + 'export type RawPayload =\n | { tag: "Bytes"; value: { bytes: HexString } }\n | { tag: "Payload"; value: { payload: string } }\n;', + description: "Raw data to sign -- either binary bytes or a string message.", + variants: [ + { + name: "Bytes", + type: '{ tag: "Bytes"; value: { bytes: HexString } }', + description: "Raw binary data to sign.", + }, + { + name: "Payload", + type: '{ tag: "Payload"; value: { payload: string } }', + description: "String message to sign.", + }, + ], + }, + { + id: "remote-chain-head-body-request", + name: "RemoteChainHeadBodyRequest", + category: "chain", + definition: + "export interface RemoteChainHeadBodyRequest {\n genesisHash: HexString;\n followSubscriptionId: string;\n hash: HexString;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "follow_subscription_id", + type: "string", + description: "Follow subscription identifier.", + }, + { + name: "hash", + type: "HexString", + description: "Block hash.", + }, + ], + }, + { + id: "remote-chain-head-body-response", + name: "RemoteChainHeadBodyResponse", + category: "chain", + definition: + "export interface RemoteChainHeadBodyResponse {\n operation: OperationStartedResult;\n}", + fields: [ + { + name: "operation", + type: "OperationStartedResult", + description: "Started operation result.", + }, + ], + }, + { + id: "remote-chain-head-call-request", + name: "RemoteChainHeadCallRequest", + category: "chain", + definition: + "export interface RemoteChainHeadCallRequest {\n genesisHash: HexString;\n followSubscriptionId: string;\n hash: HexString;\n function: string;\n callParameters: HexString;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "follow_subscription_id", + type: "string", + description: "Follow subscription identifier.", + }, + { + name: "hash", + type: "HexString", + description: "Block hash.", + }, + { + name: "function", + type: "string", + description: "Runtime API function name.", + }, + { + name: "call_parameters", + type: "HexString", + description: "SCALE-encoded call parameters.", + }, + ], + }, + { + id: "remote-chain-head-call-response", + name: "RemoteChainHeadCallResponse", + category: "chain", + definition: + "export interface RemoteChainHeadCallResponse {\n operation: OperationStartedResult;\n}", + fields: [ + { + name: "operation", + type: "OperationStartedResult", + description: "Started operation result.", + }, + ], + }, + { + id: "remote-chain-head-continue-request", + name: "RemoteChainHeadContinueRequest", + category: "chain", + definition: + "export interface RemoteChainHeadContinueRequest {\n genesisHash: HexString;\n followSubscriptionId: string;\n operationId: string;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "follow_subscription_id", + type: "string", + description: "Follow subscription identifier.", + }, + { + name: "operation_id", + type: "string", + description: "Operation identifier.", + }, + ], + }, + { + id: "remote-chain-head-follow-item", + name: "RemoteChainHeadFollowItem", + category: "chain", + definition: + 'export type RemoteChainHeadFollowItem =\n | { tag: "Initialized"; value: { finalizedBlockHashes: Array; finalizedBlockRuntime?: RuntimeType } }\n | { tag: "NewBlock"; value: { blockHash: HexString; parentBlockHash: HexString; newRuntime?: RuntimeType } }\n | { tag: "BestBlockChanged"; value: { bestBlockHash: HexString } }\n | { tag: "Finalized"; value: { finalizedBlockHashes: Array; prunedBlockHashes: Array } }\n | { tag: "OperationBodyDone"; value: { operationId: string; value: Array } }\n | { tag: "OperationCallDone"; value: { operationId: string; output: HexString } }\n | { tag: "OperationStorageItems"; value: { operationId: string; items: Array } }\n | { tag: "OperationStorageDone"; value: { operationId: string } }\n | { tag: "OperationWaitingForContinue"; value: { operationId: string } }\n | { tag: "OperationInaccessible"; value: { operationId: string } }\n | { tag: "OperationError"; value: { operationId: string; error: string } }\n | { tag: "Stop"; value?: undefined }\n;', + variants: [ + { + name: "Initialized", + type: '{ tag: "Initialized"; value: { finalizedBlockHashes: Array; finalizedBlockRuntime?: RuntimeType } }', + }, + { + name: "NewBlock", + type: '{ tag: "NewBlock"; value: { blockHash: HexString; parentBlockHash: HexString; newRuntime?: RuntimeType } }', + }, + { + name: "BestBlockChanged", + type: '{ tag: "BestBlockChanged"; value: { bestBlockHash: HexString } }', + }, + { + name: "Finalized", + type: '{ tag: "Finalized"; value: { finalizedBlockHashes: Array; prunedBlockHashes: Array } }', + }, + { + name: "OperationBodyDone", + type: '{ tag: "OperationBodyDone"; value: { operationId: string; value: Array } }', + }, + { + name: "OperationCallDone", + type: '{ tag: "OperationCallDone"; value: { operationId: string; output: HexString } }', + }, + { + name: "OperationStorageItems", + type: '{ tag: "OperationStorageItems"; value: { operationId: string; items: Array } }', + }, + { + name: "OperationStorageDone", + type: '{ tag: "OperationStorageDone"; value: { operationId: string } }', + }, + { + name: "OperationWaitingForContinue", + type: '{ tag: "OperationWaitingForContinue"; value: { operationId: string } }', + }, + { + name: "OperationInaccessible", + type: '{ tag: "OperationInaccessible"; value: { operationId: string } }', + }, + { + name: "OperationError", + type: '{ tag: "OperationError"; value: { operationId: string; error: string } }', + }, + { + name: "Stop", + type: '{ tag: "Stop"; value?: undefined }', + }, + ], + }, + { + id: "remote-chain-head-follow-request", + name: "RemoteChainHeadFollowRequest", + category: "chain", + definition: + "export interface RemoteChainHeadFollowRequest {\n genesisHash: HexString;\n withRuntime: boolean;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "with_runtime", + type: "boolean", + description: "Whether to include runtime information in events.", + }, + ], + }, + { + id: "remote-chain-head-header-request", + name: "RemoteChainHeadHeaderRequest", + category: "chain", + definition: + "export interface RemoteChainHeadHeaderRequest {\n genesisHash: HexString;\n followSubscriptionId: string;\n hash: HexString;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "follow_subscription_id", + type: "string", + description: "Follow subscription identifier.", + }, + { + name: "hash", + type: "HexString", + description: "Block hash.", + }, + ], + }, + { + id: "remote-chain-head-header-response", + name: "RemoteChainHeadHeaderResponse", + category: "chain", + definition: + "export interface RemoteChainHeadHeaderResponse {\n header?: HexString;\n}", + fields: [ + { + name: "header", + type: "HexString | undefined", + description: "SCALE-encoded block header.", + }, + ], + }, + { + id: "remote-chain-head-stop-operation-request", + name: "RemoteChainHeadStopOperationRequest", + category: "chain", + definition: + "export interface RemoteChainHeadStopOperationRequest {\n genesisHash: HexString;\n followSubscriptionId: string;\n operationId: string;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "follow_subscription_id", + type: "string", + description: "Follow subscription identifier.", + }, + { + name: "operation_id", + type: "string", + description: "Operation identifier.", + }, + ], + }, + { + id: "remote-chain-head-storage-request", + name: "RemoteChainHeadStorageRequest", + category: "chain", + definition: + "export interface RemoteChainHeadStorageRequest {\n genesisHash: HexString;\n followSubscriptionId: string;\n hash: HexString;\n items: Array;\n childTrie?: HexString;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "follow_subscription_id", + type: "string", + description: "Follow subscription identifier.", + }, + { + name: "hash", + type: "HexString", + description: "Block hash.", + }, + { + name: "items", + type: "Array", + description: "Storage items to query.", + }, + { + name: "child_trie", + type: "HexString | undefined", + description: "Optional child trie.", + }, + ], + }, + { + id: "remote-chain-head-storage-response", + name: "RemoteChainHeadStorageResponse", + category: "chain", + definition: + "export interface RemoteChainHeadStorageResponse {\n operation: OperationStartedResult;\n}", + fields: [ + { + name: "operation", + type: "OperationStartedResult", + description: "Started operation result.", + }, + ], + }, + { + id: "remote-chain-head-unpin-request", + name: "RemoteChainHeadUnpinRequest", + category: "chain", + definition: + "export interface RemoteChainHeadUnpinRequest {\n genesisHash: HexString;\n followSubscriptionId: string;\n hashes: Array;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "follow_subscription_id", + type: "string", + description: "Follow subscription identifier.", + }, + { + name: "hashes", + type: "Array", + description: "Block hashes to unpin.", + }, + ], + }, + { + id: "remote-chain-spec-chain-name-request", + name: "RemoteChainSpecChainNameRequest", + category: "chain", + definition: + "export interface RemoteChainSpecChainNameRequest {\n genesisHash: HexString;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + ], + }, + { + id: "remote-chain-spec-chain-name-response", + name: "RemoteChainSpecChainNameResponse", + category: "chain", + definition: + "export interface RemoteChainSpecChainNameResponse {\n chainName: string;\n}", + fields: [ + { + name: "chain_name", + type: "string", + description: "Chain display name.", + }, + ], + }, + { + id: "remote-chain-spec-genesis-hash-request", + name: "RemoteChainSpecGenesisHashRequest", + category: "chain", + definition: + "export interface RemoteChainSpecGenesisHashRequest {\n genesisHash: HexString;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash requested by the product.", + }, + ], + }, + { + id: "remote-chain-spec-genesis-hash-response", + name: "RemoteChainSpecGenesisHashResponse", + category: "chain", + definition: + "export interface RemoteChainSpecGenesisHashResponse {\n genesisHash: HexString;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + ], + }, + { + id: "remote-chain-spec-properties-request", + name: "RemoteChainSpecPropertiesRequest", + category: "chain", + definition: + "export interface RemoteChainSpecPropertiesRequest {\n genesisHash: HexString;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + ], + }, + { + id: "remote-chain-spec-properties-response", + name: "RemoteChainSpecPropertiesResponse", + category: "chain", + definition: + "export interface RemoteChainSpecPropertiesResponse {\n properties: string;\n}", + fields: [ + { + name: "properties", + type: "string", + description: "JSON-encoded properties.", + }, + ], + }, + { + id: "remote-chain-transaction-broadcast-request", + name: "RemoteChainTransactionBroadcastRequest", + category: "chain", + definition: + "export interface RemoteChainTransactionBroadcastRequest {\n genesisHash: HexString;\n transaction: HexString;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "transaction", + type: "HexString", + description: "Signed transaction bytes.", + }, + ], + }, + { + id: "remote-chain-transaction-broadcast-response", + name: "RemoteChainTransactionBroadcastResponse", + category: "chain", + definition: + "export interface RemoteChainTransactionBroadcastResponse {\n operationId?: string;\n}", + fields: [ + { + name: "operation_id", + type: "string | undefined", + description: "Broadcast operation identifier, if available.", + }, + ], + }, + { + id: "remote-chain-transaction-stop-request", + name: "RemoteChainTransactionStopRequest", + category: "chain", + definition: + "export interface RemoteChainTransactionStopRequest {\n genesisHash: HexString;\n operationId: string;\n}", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "operation_id", + type: "string", + description: "Operation identifier of the broadcast to stop.", + }, + ], + }, + { + id: "remote-permission", + name: "RemotePermission", + category: "permissions", + definition: + 'export type RemotePermission =\n | { tag: "Remote"; value: { domains: Array } }\n | { tag: "WebRtc"; value?: undefined }\n | { tag: "ChainSubmit"; value?: undefined }\n | { tag: "PreimageSubmit"; value?: undefined }\n | { tag: "StatementSubmit"; value?: undefined }\n;', + description: + "One remote-operation permission requested by the product (RFC 0002).\n\n`ChainSubmit`, `PreimageSubmit`, and `StatementSubmit` are also triggered\nimplicitly by the corresponding business calls when not yet granted.", + variants: [ + { + name: "Remote", + type: '{ tag: "Remote"; value: { domains: Array } }', + description: "Outbound HTTP/WebSocket access to a set of domains.", + }, + { + name: "WebRtc", + type: '{ tag: "WebRtc"; value?: undefined }', + description: "WebRTC media access.", + }, + { + name: "ChainSubmit", + type: '{ tag: "ChainSubmit"; value?: undefined }', + description: + "Submitting transactions on behalf of the user via `remote_chain_transaction_broadcast`.", + }, + { + name: "PreimageSubmit", + type: '{ tag: "PreimageSubmit"; value?: undefined }', + description: + "Submitting preimages on behalf of the user via `remote_preimage_submit`.", + }, + { + name: "StatementSubmit", + type: '{ tag: "StatementSubmit"; value?: undefined }', + description: + "Submitting statements on behalf of the user via `remote_statement_store_submit`.", + }, + ], + }, + { + id: "remote-permission-request", + name: "RemotePermissionRequest", + category: "permissions", + definition: + "export interface RemotePermissionRequest {\n permission: RemotePermission;\n}", + description: "remote-permission request (RFC 0002).", + fields: [ + { + name: "permission", + type: "RemotePermission", + description: "Permission requested by the product.", + }, + ], + }, + { + id: "remote-permission-response", + name: "RemotePermissionResponse", + category: "permissions", + definition: + "export interface RemotePermissionResponse {\n granted: boolean;\n}", + description: "Outcome of a remote-permission request.", + fields: [ + { + name: "granted", + type: "boolean", + description: "Whether the permission was granted.", + }, + ], + }, + { + id: "remote-preimage-lookup-subscribe-item", + name: "RemotePreimageLookupSubscribeItem", + category: "preimage", + definition: + "export interface RemotePreimageLookupSubscribeItem {\n value?: HexString;\n}", + description: "Item containing an optional preimage lookup result.", + fields: [ + { + name: "value", + type: "HexString | undefined", + description: "Preimage data, if found.", + }, + ], + }, + { + id: "remote-preimage-lookup-subscribe-request", + name: "RemotePreimageLookupSubscribeRequest", + category: "preimage", + definition: + "export interface RemotePreimageLookupSubscribeRequest {\n key: HexString;\n}", + description: "Request to subscribe to preimage lookup results.", + fields: [ + { + name: "key", + type: "HexString", + description: "Hash of the preimage.", + }, + ], + }, + { + id: "remote-statement-store-create-proof-error", + name: "RemoteStatementStoreCreateProofError", + category: "statement_store", + definition: + 'export type RemoteStatementStoreCreateProofError =\n | { tag: "UnableToSign"; value?: undefined }\n | { tag: "UnknownAccount"; value?: undefined }\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Statement proof creation error.", + variants: [ + { + name: "UnableToSign", + type: '{ tag: "UnableToSign"; value?: undefined }', + description: "Signing operation failed.", + }, + { + name: "UnknownAccount", + type: '{ tag: "UnknownAccount"; value?: undefined }', + description: "Account not recognized.", + }, + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "remote-statement-store-create-proof-request", + name: "RemoteStatementStoreCreateProofRequest", + category: "statement_store", + definition: + "export interface RemoteStatementStoreCreateProofRequest {\n productAccountId: ProductAccountId;\n statement: Statement;\n}", + description: "Request to create a cryptographic proof for a statement.", + fields: [ + { + name: "product_account_id", + type: "ProductAccountId", + description: "Product account that should create the proof.", + }, + { + name: "statement", + type: "Statement", + description: "Statement to prove.", + }, + ], + }, + { + id: "remote-statement-store-create-proof-response", + name: "RemoteStatementStoreCreateProofResponse", + category: "statement_store", + definition: + "export interface RemoteStatementStoreCreateProofResponse {\n proof: StatementProof;\n}", + description: "Response containing a statement proof.", + fields: [ + { + name: "proof", + type: "StatementProof", + description: "Created statement proof.", + }, + ], + }, + { + id: "remote-statement-store-subscribe-item", + name: "RemoteStatementStoreSubscribeItem", + category: "statement_store", + definition: + "export interface RemoteStatementStoreSubscribeItem {\n statements: Array;\n isComplete: boolean;\n}", + description: + "Page of signed statements delivered by the statement store subscription\n(RFC 0008). The `is_complete` flag distinguishes the historical-dump phase\n(`false`) from the live-update phase (`true`).", + fields: [ + { + name: "statements", + type: "Array", + description: "Signed statements matching the subscription.", + }, + { + name: "is_complete", + type: "boolean", + description: + "`false` while the host is still streaming the historical dump (more\npages to follow). `true` once the dump is complete; all subsequent\npages are also `true` and carry only newly-arrived statements.", + }, + ], + }, + { + id: "remote-statement-store-subscribe-request", + name: "RemoteStatementStoreSubscribeRequest", + category: "statement_store", + definition: + 'export type RemoteStatementStoreSubscribeRequest =\n | { tag: "MatchAll"; value: Array }\n | { tag: "MatchAny"; value: Array }\n;', + description: + "Request to subscribe to statements via a topic filter (RFC 0008).", + variants: [ + { + name: "MatchAll", + type: '{ tag: "MatchAll"; value: Array }', + description: "AND: statement must contain every listed topic.", + }, + { + name: "MatchAny", + type: '{ tag: "MatchAny"; value: Array }', + description: "OR: statement must contain at least one listed topic.", + }, + ], + }, + { + id: "resource-allocation-error", + name: "ResourceAllocationError", + category: "resource_allocation", + definition: + 'export type ResourceAllocationError =\n | { tag: "Unknown"; value: { reason: string } }\n;', + description: "Error from [`crate::api::ResourceAllocation::request`].", + variants: [ + { + name: "Unknown", + type: '{ tag: "Unknown"; value: { reason: string } }', + description: "Catch-all.", + }, + ], + }, + { + id: "ring-location", + name: "RingLocation", + category: "account", + definition: + "export interface RingLocation {\n genesisHash: HexString;\n ringRootHash: HexString;\n hints?: RingLocationHint;\n}", + description: + "Locates a specific ring on a specific chain for ring VRF operations.", + fields: [ + { + name: "genesis_hash", + type: "HexString", + description: "Chain genesis hash.", + }, + { + name: "ring_root_hash", + type: "HexString", + description: "Root hash of the ring.", + }, + { + name: "hints", + type: "RingLocationHint | undefined", + description: "Optional location hints.", + }, + ], + }, + { + id: "ring-location-hint", + name: "RingLocationHint", + category: "account", + definition: + "export interface RingLocationHint {\n palletInstance?: number;\n}", + description: "Hints for locating a ring on-chain.", + fields: [ + { + name: "pallet_instance", + type: "number | undefined", + description: "Optional pallet instance index.", + }, + ], + }, + { + id: "row-props", + name: "RowProps", + category: "chat", + definition: + "export interface RowProps {\n verticalAlignment?: VerticalAlignment;\n horizontalArrangement?: Arrangement;\n}", + description: "Properties for a [`CustomRendererNode::Row`] layout.", + fields: [ + { + name: "vertical_alignment", + type: "VerticalAlignment | undefined", + description: "Vertical alignment of children.", + }, + { + name: "horizontal_arrangement", + type: "Arrangement | undefined", + description: "Horizontal arrangement of children.", + }, + ], + }, + { + id: "runtime-api", + name: "RuntimeApi", + category: "chain", + definition: + "export interface RuntimeApi {\n name: string;\n version: number;\n}", + fields: [ + { + name: "name", + type: "string", + description: "Runtime API name.", + }, + { + name: "version", + type: "number", + description: "Runtime API version.", + }, + ], + }, + { + id: "runtime-spec", + name: "RuntimeSpec", + category: "chain", + definition: + "export interface RuntimeSpec {\n specName: string;\n implName: string;\n specVersion: number;\n implVersion: number;\n transactionVersion?: number;\n apis: Array;\n}", + fields: [ + { + name: "spec_name", + type: "string", + description: "Specification name.", + }, + { + name: "impl_name", + type: "string", + description: "Implementation name.", + }, + { + name: "spec_version", + type: "number", + description: "Spec version number.", + }, + { + name: "impl_version", + type: "number", + description: "Implementation version.", + }, + { + name: "transaction_version", + type: "number | undefined", + description: "Transaction format version.", + }, + { + name: "apis", + type: "Array", + description: "Supported runtime APIs.", + }, + ], + }, + { + id: "runtime-type", + name: "RuntimeType", + category: "chain", + definition: + 'export type RuntimeType =\n | { tag: "Valid"; value: RuntimeSpec }\n | { tag: "Invalid"; value: { error: string } }\n;', + variants: [ + { + name: "Valid", + type: '{ tag: "Valid"; value: RuntimeSpec }', + }, + { + name: "Invalid", + type: '{ tag: "Invalid"; value: { error: string } }', + }, + ], + }, + { + id: "shape", + name: "Shape", + category: "chat", + definition: + 'export type Shape =\n | { tag: "Rounded"; value: { radius: Size } }\n | { tag: "Circle"; value?: undefined }\n;', + description: "Shape for borders and backgrounds.", + variants: [ + { + name: "Rounded", + type: '{ tag: "Rounded"; value: { radius: Size } }', + description: "Border radius value.", + }, + { + name: "Circle", + type: '{ tag: "Circle"; value?: undefined }', + description: "Circular shape.", + }, + ], + }, + { + id: "signed-statement", + name: "SignedStatement", + category: "statement_store", + definition: + "export interface SignedStatement {\n proof: StatementProof;\n decryptionKey?: HexString;\n expiry?: bigint;\n channel?: HexString;\n topics: Array;\n data?: HexString;\n}", + description: "A statement with a required (not optional) proof.", + fields: [ + { + name: "proof", + type: "StatementProof", + description: "Required cryptographic proof.", + }, + { + name: "decryption_key", + type: "HexString | undefined", + description: "Optional decryption key.", + }, + { + name: "expiry", + type: "bigint | undefined", + description: "Optional Unix timestamp expiry.", + }, + { + name: "channel", + type: "HexString | undefined", + description: "Optional channel.", + }, + { + name: "topics", + type: "Array", + description: "[u8; 32] tags.", + }, + { + name: "data", + type: "HexString | undefined", + description: "Optional data payload.", + }, + ], + }, + { + id: "size", + name: "Size", + category: "chat", + definition: "export type Size = number | bigint;", + description: + "A size/dimension value (logical pixels) used across the custom renderer.\n\nEncoded as a SCALE `Compact`: the common small values cost a single\nbyte on the wire instead of eight.", + }, + { + id: "statement", + name: "Statement", + category: "statement_store", + definition: + "export interface Statement {\n proof?: StatementProof;\n decryptionKey?: HexString;\n expiry?: bigint;\n channel?: HexString;\n topics: Array;\n data?: HexString;\n}", + description: "A statement with optional proof and metadata.", + fields: [ + { + name: "proof", + type: "StatementProof | undefined", + description: "Optional cryptographic proof.", + }, + { + name: "decryption_key", + type: "HexString | undefined", + description: "Optional decryption key.", + }, + { + name: "expiry", + type: "bigint | undefined", + description: "Optional Unix timestamp expiry.", + }, + { + name: "channel", + type: "HexString | undefined", + description: "Optional channel.", + }, + { + name: "topics", + type: "Array", + description: "[u8; 32] tags.", + }, + { + name: "data", + type: "HexString | undefined", + description: "Optional data payload.", + }, + ], + }, + { + id: "statement-proof", + name: "StatementProof", + category: "statement_store", + definition: + 'export type StatementProof =\n | { tag: "Sr25519"; value: { signature: HexString; signer: HexString } }\n | { tag: "Ed25519"; value: { signature: HexString; signer: HexString } }\n | { tag: "Ecdsa"; value: { signature: HexString; signer: HexString } }\n | { tag: "OnChain"; value: { who: HexString; blockHash: HexString; event: bigint } }\n;', + description: "Cryptographic proof for a statement.", + variants: [ + { + name: "Sr25519", + type: '{ tag: "Sr25519"; value: { signature: HexString; signer: HexString } }', + description: "Sr25519 signature proof.", + }, + { + name: "Ed25519", + type: '{ tag: "Ed25519"; value: { signature: HexString; signer: HexString } }', + description: "Ed25519 signature proof.", + }, + { + name: "Ecdsa", + type: '{ tag: "Ecdsa"; value: { signature: HexString; signer: HexString } }', + description: "ECDSA signature proof.", + }, + { + name: "OnChain", + type: '{ tag: "OnChain"; value: { who: HexString; blockHash: HexString; event: bigint } }', + description: "On-chain event proof.", + }, + ], + }, + { + id: "storage-query-item", + name: "StorageQueryItem", + category: "chain", + definition: + "export interface StorageQueryItem {\n key: HexString;\n queryType: StorageQueryType;\n}", + fields: [ + { + name: "key", + type: "HexString", + description: "Storage key to query.", + }, + { + name: "query_type", + type: "StorageQueryType", + description: "What to return.", + }, + ], + }, + { + id: "storage-query-type", + name: "StorageQueryType", + category: "chain", + definition: + 'export type StorageQueryType = "Value" | "Hash" | "ClosestDescendantMerkleValue" | "DescendantsValues" | "DescendantsHashes";', + variants: [ + { + name: "Value", + type: '{ tag: "Value"; value?: undefined }', + }, + { + name: "Hash", + type: '{ tag: "Hash"; value?: undefined }', + }, + { + name: "ClosestDescendantMerkleValue", + type: '{ tag: "ClosestDescendantMerkleValue"; value?: undefined }', + }, + { + name: "DescendantsValues", + type: '{ tag: "DescendantsValues"; value?: undefined }', + }, + { + name: "DescendantsHashes", + type: '{ tag: "DescendantsHashes"; value?: undefined }', + }, + ], + }, + { + id: "storage-result-item", + name: "StorageResultItem", + category: "chain", + definition: + "export interface StorageResultItem {\n key: HexString;\n value?: HexString;\n hash?: HexString;\n closestDescendantMerkleValue?: HexString;\n}", + fields: [ + { + name: "key", + type: "HexString", + description: "The queried key.", + }, + { + name: "value", + type: "HexString | undefined", + description: "Value, if requested.", + }, + { + name: "hash", + type: "HexString | undefined", + description: "Hash, if requested.", + }, + { + name: "closest_descendant_merkle_value", + type: "HexString | undefined", + description: "Merkle value, if requested.", + }, + ], + }, + { + id: "text-field-props", + name: "TextFieldProps", + category: "chat", + definition: + "export interface TextFieldProps {\n text: string;\n placeholder?: string;\n label?: string;\n enabled: boolean | undefined;\n valueChangeAction?: string;\n}", + description: "Properties for a [`CustomRendererNode::TextField`].", + fields: [ + { + name: "text", + type: "string", + description: "Current text value.", + }, + { + name: "placeholder", + type: "string | undefined", + description: "Placeholder text.", + }, + { + name: "label", + type: "string | undefined", + description: "Field label.", + }, + { + name: "enabled", + type: "boolean | undefined", + description: + "Whether the field is enabled. Absent leaves the default to the host.", + }, + { + name: "value_change_action", + type: "string | undefined", + description: "Action identifier triggered when the value changes.", + }, + ], + }, + { + id: "text-props", + name: "TextProps", + category: "chat", + definition: + "export interface TextProps {\n style?: TypographyStyle;\n color?: ColorToken;\n}", + description: "Properties for a [`CustomRendererNode::Text`] display.", + fields: [ + { + name: "style", + type: "TypographyStyle | undefined", + description: "Typography preset.", + }, + { + name: "color", + type: "ColorToken | undefined", + description: "Text color.", + }, + ], + }, + { + id: "theme-name", + name: "ThemeName", + category: "theme", + definition: + 'export type ThemeName =\n | { tag: "Custom"; value: string }\n | { tag: "Default"; value?: undefined }\n;', + description: "Identifies a named theme.", + variants: [ + { + name: "Custom", + type: '{ tag: "Custom"; value: string }', + description: "A custom named theme.", + }, + { + name: "Default", + type: '{ tag: "Default"; value?: undefined }', + description: "The host's default theme.", + }, + ], + }, + { + id: "theme-variant", + name: "ThemeVariant", + category: "theme", + definition: 'export type ThemeVariant = "Light" | "Dark";', + description: "Light or dark variant.", + variants: [ + { + name: "Light", + type: '{ tag: "Light"; value?: undefined }', + }, + { + name: "Dark", + type: '{ tag: "Dark"; value?: undefined }', + }, + ], + }, + { + id: "topic", + name: "Topic", + category: "statement_store", + definition: "export type Topic = HexString;", + description: "32-byte statement topic.", + }, + { + id: "tx-payload-extension", + name: "TxPayloadExtension", + category: "transaction", + definition: + "export interface TxPayloadExtension {\n id: string;\n extra: HexString;\n additionalSigned: HexString;\n}", + description: "A signed extension for a transaction payload.", + fields: [ + { + name: "id", + type: "string", + description: 'Extension name (e.g., `"CheckSpecVersion"`).', + }, + { + name: "extra", + type: "HexString", + description: "SCALE-encoded extra data (in extrinsic body).", + }, + { + name: "additional_signed", + type: "HexString", + description: "SCALE-encoded implicit data (signed, not in body).", + }, + ], + }, + { + id: "typography-style", + name: "TypographyStyle", + category: "chat", + definition: + 'export type TypographyStyle = "HeadlineLarge" | "TitleMediumRegular" | "BodyLargeRegular" | "BodyMediumRegular" | "BodySmallRegular";', + description: "Text typography presets.", + variants: [ + { + name: "HeadlineLarge", + type: '{ tag: "HeadlineLarge"; value?: undefined }', + }, + { + name: "TitleMediumRegular", + type: '{ tag: "TitleMediumRegular"; value?: undefined }', + }, + { + name: "BodyLargeRegular", + type: '{ tag: "BodyLargeRegular"; value?: undefined }', + }, + { + name: "BodyMediumRegular", + type: '{ tag: "BodyMediumRegular"; value?: undefined }', + }, + { + name: "BodySmallRegular", + type: '{ tag: "BodySmallRegular"; value?: undefined }', + }, + ], + }, + { + id: "vertical-alignment", + name: "VerticalAlignment", + category: "chat", + definition: 'export type VerticalAlignment = "Top" | "Center" | "Bottom";', + description: "Vertical alignment options.", + variants: [ + { + name: "Top", + type: '{ tag: "Top"; value?: undefined }', + }, + { + name: "Center", + type: '{ tag: "Center"; value?: undefined }', + }, + { + name: "Bottom", + type: '{ tag: "Bottom"; value?: undefined }', + }, + ], + }, +]; diff --git a/package-lock.json b/package-lock.json index b7ff84bd..43c6dcfc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ }, "js/packages/truapi": { "name": "@parity/truapi", - "version": "0.3.1", + "version": "0.4.0", "license": "MIT", "dependencies": { "@noble/hashes": "^2.2.0", @@ -35,7 +35,7 @@ "version": "0.1.0", "license": "MIT", "dependencies": { - "@parity/truapi": "file:../truapi" + "@parity/truapi": "^0.4.0" }, "devDependencies": { "@types/bun": "^1.3.0", diff --git a/package.json b/package.json index 1b371984..003a6e86 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,9 @@ "test": "cargo test --workspace && npm test --prefix js/packages/truapi", "lint": "npm run format:check && npm run typecheck", "changeset": "changeset", - "version-packages": "changeset version && node scripts/sync-cargo-version.mjs" + "version-packages": "changeset version && npm run sync-release-versions && npm install --package-lock-only --ignore-scripts", + "sync-release-versions": "node scripts/sync-release-versions.mjs", + "check-release-versions": "node scripts/sync-release-versions.mjs --check" }, "devDependencies": { "@changesets/cli": "^2.28.1", diff --git a/rust/crates/truapi/Cargo.toml b/rust/crates/truapi/Cargo.toml index 592213a6..fc2a264e 100644 --- a/rust/crates/truapi/Cargo.toml +++ b/rust/crates/truapi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "truapi" -version = "0.3.1" +version = "0.4.0" edition.workspace = true license.workspace = true description = "TrUAPI trait and type definitions" diff --git a/scripts/sync-cargo-version.mjs b/scripts/sync-cargo-version.mjs deleted file mode 100755 index fb495dca..00000000 --- a/scripts/sync-cargo-version.mjs +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env node -import { readFileSync, writeFileSync } from "node:fs"; -import { fileURLToPath } from "node:url"; -import { dirname, resolve } from "node:path"; - -const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); -const pkgPath = resolve(repoRoot, "js/packages/truapi/package.json"); -const cargoPath = resolve(repoRoot, "rust/crates/truapi/Cargo.toml"); - -const { version } = JSON.parse(readFileSync(pkgPath, "utf8")); -if (typeof version !== "string" || version.length === 0) { - console.error(`sync-cargo-version: could not read .version from ${pkgPath}`); - process.exit(1); -} - -const cargo = readFileSync(cargoPath, "utf8"); -const versionLine = /^version = "[^"]*"$/m; -if (!versionLine.test(cargo)) { - console.error( - `sync-cargo-version: could not find a top-level \`version = "…"\` line in ${cargoPath}`, - ); - process.exit(1); -} - -const next = cargo.replace(versionLine, `version = "${version}"`); -if (next === cargo) { - console.log(`sync-cargo-version: already at ${version}`); - process.exit(0); -} - -writeFileSync(cargoPath, next); -console.log(`sync-cargo-version: bumped rust/crates/truapi/Cargo.toml to ${version}`); diff --git a/scripts/sync-release-versions.mjs b/scripts/sync-release-versions.mjs new file mode 100644 index 00000000..982dfabb --- /dev/null +++ b/scripts/sync-release-versions.mjs @@ -0,0 +1,131 @@ +#!/usr/bin/env node +import { readFileSync, writeFileSync } from "node:fs"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +/** + * Keep release metadata derived from @parity/truapi's version in sync. + * + * Update Cargo.toml and the host package's dependency range: + * npm run sync-release-versions + * + * Verify those files and package-lock.json without writing changes: + * npm run check-release-versions + * + * `npm run version-packages` runs the update after consuming changesets and + * then refreshes package-lock.json. + */ + +const command = "sync-release-versions"; +const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const truapiPath = resolve(repoRoot, "js/packages/truapi/package.json"); +const hostPath = resolve(repoRoot, "js/packages/truapi-host/package.json"); +const cargoPath = resolve(repoRoot, "rust/crates/truapi/Cargo.toml"); +const lockPath = resolve(repoRoot, "package-lock.json"); +const check = process.argv.includes("--check"); + +const truapi = readJson(truapiPath); +const host = readJson(hostPath); +if (typeof truapi.version !== "string" || truapi.version.length === 0) { + fail(`could not read .version from ${truapiPath}`); +} + +const expectedDependency = `^${truapi.version}`; +const actualDependency = host.dependencies?.["@parity/truapi"]; +const cargo = readFile(cargoPath); +const cargoVersionLine = /^version = "([^"]*)"$/m; +const cargoVersion = cargo.match(cargoVersionLine)?.[1]; +if (cargoVersion === undefined) { + fail(`could not find a top-level \`version = "..."\` line in ${cargoPath}`); +} + +if (check) { + const errors = []; + if (cargoVersion !== truapi.version) { + errors.push( + `rust/crates/truapi/Cargo.toml is ${cargoVersion}; expected ${truapi.version}`, + ); + } + if (actualDependency !== expectedDependency) { + errors.push( + `js/packages/truapi-host/package.json requires ${actualDependency ?? ""}; expected ${expectedDependency}`, + ); + } + + const lock = readJson(lockPath); + const lockedTruapi = lock.packages?.["js/packages/truapi"]?.version; + const lockedHost = lock.packages?.["js/packages/truapi-host"]?.version; + const lockedDependency = + lock.packages?.["js/packages/truapi-host"]?.dependencies?.[ + "@parity/truapi" + ]; + if (lockedTruapi !== truapi.version) { + errors.push( + `package-lock.json records @parity/truapi ${lockedTruapi ?? ""}; expected ${truapi.version}`, + ); + } + if (lockedHost !== host.version) { + errors.push( + `package-lock.json records @parity/truapi-host ${lockedHost ?? ""}; expected ${host.version}`, + ); + } + if (lockedDependency !== expectedDependency) { + errors.push( + `package-lock.json records the host dependency as ${lockedDependency ?? ""}; expected ${expectedDependency}`, + ); + } + + if (errors.length > 0) { + for (const error of errors) console.error(`${command}: ${error}`); + console.error(`${command}: run \`npm run version-packages\` to sync`); + process.exit(1); + } + + console.log( + `${command}: Cargo.toml, host dependencies, and package-lock.json use @parity/truapi ${truapi.version}`, + ); + process.exit(0); +} + +const nextCargo = cargo.replace( + cargoVersionLine, + `version = "${truapi.version}"`, +); +if (nextCargo === cargo) { + console.log(`${command}: Cargo.toml already uses ${truapi.version}`); +} else { + writeFileSync(cargoPath, nextCargo); + console.log(`${command}: updated Cargo.toml to ${truapi.version}`); +} + +if (actualDependency === expectedDependency) { + console.log( + `${command}: host already requires @parity/truapi ${expectedDependency}`, + ); +} else { + host.dependencies ??= {}; + host.dependencies["@parity/truapi"] = expectedDependency; + writeFileSync(hostPath, `${JSON.stringify(host, null, 2)}\n`); + console.log( + `${command}: updated host dependency to @parity/truapi ${expectedDependency}`, + ); +} + +function readJson(path) { + return JSON.parse(readFile(path)); +} + +function readFile(path) { + try { + return readFileSync(path, "utf8"); + } catch (error) { + console.error(`${command}: could not read ${path}`); + console.error(error); + process.exit(1); + } +} + +function fail(message) { + console.error(`${command}: ${message}`); + process.exit(1); +}