From b94ee6eef226448116896067f45411b5a0f81db0 Mon Sep 17 00:00:00 2001 From: thephez Date: Wed, 13 Aug 2025 12:06:08 -0400 Subject: [PATCH 01/17] refactor(sdk): extract query and state transition definitions from index.html --- packages/wasm-sdk/api-definitions.json | 2064 ++++++++++++++++++++++++ packages/wasm-sdk/index.html | 943 +---------- 2 files changed, 2115 insertions(+), 892 deletions(-) create mode 100644 packages/wasm-sdk/api-definitions.json diff --git a/packages/wasm-sdk/api-definitions.json b/packages/wasm-sdk/api-definitions.json new file mode 100644 index 0000000000..1e2d0d7b03 --- /dev/null +++ b/packages/wasm-sdk/api-definitions.json @@ -0,0 +1,2064 @@ +{ + "version": "1.0.1", + "generated_at": "2025-08-13T11:30:00.000000", + "source": "Curated definitions from fixed_definitions.json (fixed missing dpnsSearch)", + "queries": { + "identity": { + "label": "Identity Queries", + "queries": { + "getIdentity": { + "label": "Get Identity", + "description": "Fetch an identity by its identifier", + "inputs": [ + { + "name": "id", + "type": "text", + "label": "Identity ID", + "required": true + } + ] + }, + "getIdentityKeys": { + "label": "Get Identity Keys", + "description": "Retrieve keys associated with an identity", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true + }, + { + "name": "keyRequestType", + "type": "select", + "label": "Key Request Type", + "required": false, + "options": [ + { + "value": "all", + "label": "All Keys (AllKeys {}) - Get all keys for the identity" + }, + { + "value": "specific", + "label": "Specific Keys (SpecificKeys with key_ids) - Get specific keys by ID [🚧 Work in Progress]" + }, + { + "value": "search", + "label": "Search Keys (SearchKey with purpose_map) - Search by purpose and security level [🚧 Work in Progress]" + } + ] + }, + { + "name": "specificKeyIds", + "type": "array", + "label": "Specific Key IDs (required for 'specific' type)", + "required": false, + "placeholder": "0,1,2" + }, + { + "name": "searchPurposeMap", + "type": "text", + "label": "Search Purpose Map JSON (required for 'search' type)", + "required": false, + "placeholder": "{\"0\": {\"0\": \"current\"}, \"1\": {\"0\": \"all\"}}" + } + ] + }, + "getIdentitiesContractKeys": { + "label": "Get Identities Contract Keys", + "description": "Get keys for multiple identities related to a specific contract", + "inputs": [ + { + "name": "identitiesIds", + "type": "array", + "label": "Identity IDs", + "required": true + }, + { + "name": "contractId", + "type": "text", + "label": "Contract ID", + "required": true + }, + { + "name": "documentTypeName", + "type": "text", + "label": "Document Type (optional)", + "required": false + }, + { + "name": "purposes", + "type": "multiselect", + "label": "Key Purposes", + "required": false, + "options": [ + { + "value": "0", + "label": "Authentication" + }, + { + "value": "1", + "label": "Encryption" + }, + { + "value": "2", + "label": "Decryption" + }, + { + "value": "3", + "label": "Transfer" + }, + { + "value": "5", + "label": "Voting" + } + ] + } + ] + }, + "getIdentityNonce": { + "label": "Get Identity Nonce", + "description": "Get the current nonce for an identity", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true + } + ] + }, + "getIdentityContractNonce": { + "label": "Get Identity Contract Nonce", + "description": "Get the nonce for an identity in relation to a specific contract", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true + }, + { + "name": "contractId", + "type": "text", + "label": "Contract ID", + "required": true + } + ] + }, + "getIdentityBalance": { + "label": "Get Identity Balance", + "description": "Get the credit balance of an identity", + "inputs": [ + { + "name": "id", + "type": "text", + "label": "Identity ID", + "required": true + } + ] + }, + "getIdentitiesBalances": { + "label": "Get Identities Balances", + "description": "Get balances for multiple identities", + "inputs": [ + { + "name": "identityIds", + "type": "array", + "label": "Identity IDs", + "required": true + } + ] + }, + "getIdentityBalanceAndRevision": { + "label": "Get Identity Balance and Revision", + "description": "Get both balance and revision number for an identity", + "inputs": [ + { + "name": "id", + "type": "text", + "label": "Identity ID", + "required": true + } + ] + }, + "getIdentityByPublicKeyHash": { + "label": "Get Identity by Unique Public Key Hash", + "description": "Find an identity by its unique public key hash", + "inputs": [ + { + "name": "publicKeyHash", + "type": "text", + "label": "Public Key Hash", + "required": true, + "placeholder": "b7e904ce25ed97594e72f7af0e66f298031c1754" + } + ] + }, + "getIdentityByNonUniquePublicKeyHash": { + "label": "Get Identity by Non-Unique Public Key Hash", + "description": "Find identities by non-unique public key hash", + "inputs": [ + { + "name": "publicKeyHash", + "type": "text", + "label": "Public Key Hash", + "required": true, + "placeholder": "518038dc858461bcee90478fd994bba8057b7531" + } + ] + }, + "getIdentityTokenBalances": { + "label": "Get Identity Token Balances", + "description": "Get token balances for an identity", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true + }, + { + "name": "tokenIds", + "type": "array", + "label": "Token IDs", + "required": true + } + ] + }, + "getIdentitiesTokenBalances": { + "label": "Get Identities Token Balances", + "description": "Get token balance for multiple identities", + "inputs": [ + { + "name": "identityIds", + "type": "array", + "label": "Identity IDs", + "required": true + }, + { + "name": "tokenId", + "type": "text", + "label": "Token ID", + "required": true, + "placeholder": "Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv" + } + ] + }, + "getIdentityTokenInfos": { + "label": "Get Identity Token Info", + "description": "Get token information for an identity's tokens", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true + }, + { + "name": "tokenIds", + "type": "array", + "label": "Token IDs (optional)", + "required": false, + "placeholder": "[\"Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv\"]" + } + ] + }, + "getIdentitiesTokenInfos": { + "label": "Get Identities Token Info", + "description": "Get token information for multiple identities with a specific token", + "inputs": [ + { + "name": "identityIds", + "type": "array", + "label": "Identity IDs", + "required": true + }, + { + "name": "tokenId", + "type": "text", + "label": "Token ID", + "required": true, + "placeholder": "Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv" + } + ] + } + } + }, + "dataContract": { + "label": "Data Contract Queries", + "queries": { + "getDataContract": { + "label": "Get Data Contract", + "description": "Fetch a data contract by its identifier", + "inputs": [ + { + "name": "id", + "type": "text", + "label": "Data Contract ID", + "required": true, + "placeholder": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec" + } + ] + }, + "getDataContractHistory": { + "label": "Get Data Contract History", + "description": "Get the version history of a data contract", + "inputs": [ + { + "name": "id", + "type": "text", + "label": "Data Contract ID", + "required": true, + "placeholder": "HLY575cNazmc5824FxqaEMEBuzFeE4a98GDRNKbyJqCM" + }, + { + "name": "limit", + "type": "number", + "label": "Limit", + "required": false + }, + { + "name": "offset", + "type": "number", + "label": "Offset", + "required": false + } + ] + }, + "getDataContracts": { + "label": "Get Data Contracts", + "description": "Fetch multiple data contracts by their identifiers", + "inputs": [ + { + "name": "ids", + "type": "array", + "label": "Data Contract IDs", + "required": true, + "placeholder": "[\"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec\", \"ALybvzfcCwMs7sinDwmtumw17NneuW7RgFtFHgjKmF3A\"]" + } + ] + } + } + }, + "document": { + "label": "Document Queries", + "queries": { + "getDocuments": { + "label": "Get Documents", + "description": "Query documents from a data contract", + "inputs": [ + { + "name": "dataContractId", + "type": "text", + "label": "Data Contract ID", + "required": true, + "placeholder": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec" + }, + { + "name": "documentType", + "type": "text", + "label": "Document Type", + "required": true, + "placeholder": "domain" + }, + { + "name": "whereClause", + "type": "text", + "label": "Where Clause (JSON)", + "required": false, + "placeholder": "[[\"normalizedParentDomainName\", \"==\", \"dash\"], [\"normalizedLabel\", \"==\", \"therea1s11mshaddy5\"]]" + }, + { + "name": "orderBy", + "type": "text", + "label": "Order By (JSON)", + "required": false, + "placeholder": "[[\"$createdAt\", \"desc\"]]" + }, + { + "name": "limit", + "type": "number", + "label": "Limit", + "required": false + } + ] + }, + "getDocument": { + "label": "Get Document", + "description": "Fetch a specific document by ID", + "inputs": [ + { + "name": "dataContractId", + "type": "text", + "label": "Data Contract ID", + "required": true, + "placeholder": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec" + }, + { + "name": "documentType", + "type": "text", + "label": "Document Type", + "required": true, + "placeholder": "domain" + }, + { + "name": "documentId", + "type": "text", + "label": "Document ID", + "required": true, + "placeholder": "7NYmEKQsYtniQRUmxwdPGeVcirMoPh5ZPyAKz8BWFy3r" + } + ] + } + } + }, + "dpns": { + "label": "DPNS Queries", + "queries": { + "getDpnsUsername": { + "label": "Get DPNS Usernames", + "description": "Get DPNS usernames for an identity", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true + } + ] + }, + "dpnsCheckAvailability": { + "label": "DPNS Check Availability", + "description": "Check if a DPNS username is available", + "inputs": [ + { + "name": "label", + "type": "text", + "label": "Label (Username)", + "required": true + } + ] + }, + "dpnsResolve": { + "label": "DPNS Resolve Name", + "description": "Resolve a DPNS name to an identity ID", + "inputs": [ + { + "name": "name", + "type": "text", + "label": "Name", + "required": true + } + ] + }, + "dpnsSearch": { + "label": "DPNS Search Name", + "description": "Search for DPNS names that start with a given prefix", + "inputs": [ + { + "name": "prefix", + "type": "text", + "label": "Name Prefix", + "required": true, + "placeholder": "Enter prefix (e.g., ali)" + }, + { + "name": "limit", + "type": "number", + "label": "Limit", + "required": false, + "placeholder": "Default: 10" + } + ] + } + } + }, + "voting": { + "label": "Voting & Contested Resources", + "queries": { + "getContestedResources": { + "label": "Get Contested Resources", + "description": "Get list of contested resources", + "inputs": [ + { + "name": "documentTypeName", + "type": "text", + "label": "Document Type", + "required": true + }, + { + "name": "dataContractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "indexName", + "type": "text", + "label": "Index Name", + "required": true + }, + { + "name": "resultType", + "type": "text", + "label": "Result Type", + "required": true + }, + { + "name": "allowIncludeLockedAndAbstainingVoteTally", + "type": "checkbox", + "label": "Allow Include Locked and Abstaining Vote Tally", + "required": false + }, + { + "name": "startAtValue", + "type": "text", + "label": "Start At Value", + "required": false + }, + { + "name": "limit", + "type": "number", + "label": "Limit", + "required": false + }, + { + "name": "offset", + "type": "number", + "label": "Offset", + "required": false + }, + { + "name": "orderAscending", + "type": "checkbox", + "label": "Order Ascending", + "required": false + } + ] + }, + "getContestedResourceVoteState": { + "label": "Get Contested Resource Vote State", + "description": "Get the current vote state for a contested resource", + "inputs": [ + { + "name": "dataContractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "documentTypeName", + "type": "text", + "label": "Document Type", + "required": true + }, + { + "name": "indexName", + "type": "text", + "label": "Index Name", + "required": true + }, + { + "name": "indexValues", + "type": "array", + "label": "Index Values", + "required": true, + "placeholder": "[\"dash\", \"alice\"]" + }, + { + "name": "resultType", + "type": "text", + "label": "Result Type", + "required": true + }, + { + "name": "allowIncludeLockedAndAbstainingVoteTally", + "type": "checkbox", + "label": "Allow Include Locked and Abstaining Vote Tally", + "required": false + }, + { + "name": "startAtIdentifierInfo", + "type": "text", + "label": "Start At Identifier Info", + "required": false + }, + { + "name": "count", + "type": "number", + "label": "Count", + "required": false + }, + { + "name": "orderAscending", + "type": "checkbox", + "label": "Order Ascending", + "required": false + } + ] + }, + "getContestedResourceVotersForIdentity": { + "label": "Get Contested Resource Voters for Identity", + "description": "Get voters who voted for a specific identity in a contested resource", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Contract ID", + "required": true + }, + { + "name": "documentTypeName", + "type": "text", + "label": "Document Type", + "required": true + }, + { + "name": "indexName", + "type": "text", + "label": "Index Name", + "required": true + }, + { + "name": "indexValues", + "type": "array", + "label": "Index Values", + "required": true, + "placeholder": "[\"dash\", \"alice\"]" + }, + { + "name": "contestantId", + "type": "text", + "label": "Contestant Identity ID", + "required": true + }, + { + "name": "startAtVoterInfo", + "type": "text", + "label": "Start At Voter Info", + "required": false + }, + { + "name": "limit", + "type": "number", + "label": "Limit", + "required": false + }, + { + "name": "orderAscending", + "type": "checkbox", + "label": "Order Ascending", + "required": false + } + ] + }, + "getContestedResourceIdentityVotes": { + "label": "Get Contested Resource Identity Votes", + "description": "Get all votes cast by a specific identity", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true + }, + { + "name": "limit", + "type": "number", + "label": "Limit", + "required": false + }, + { + "name": "startAtVotePollIdInfo", + "type": "text", + "label": "Start At Vote Poll ID Info", + "required": false + }, + { + "name": "orderAscending", + "type": "checkbox", + "label": "Order Ascending", + "required": false + } + ] + }, + "getVotePollsByEndDate": { + "label": "Get Vote Polls by End Date", + "description": "Get vote polls within a time range", + "inputs": [ + { + "name": "startTimeInfo", + "type": "text", + "label": "Start Time Info", + "required": false, + "placeholder": "Timestamp in milliseconds as string" + }, + { + "name": "endTimeInfo", + "type": "text", + "label": "End Time Info", + "required": false, + "placeholder": "Timestamp in milliseconds as string" + }, + { + "name": "limit", + "type": "number", + "label": "Limit", + "required": false + }, + { + "name": "orderAscending", + "type": "checkbox", + "label": "Order Ascending", + "required": false + } + ] + } + } + }, + "protocol": { + "label": "Protocol & Version", + "queries": { + "getProtocolVersionUpgradeState": { + "label": "Get Protocol Version Upgrade State", + "description": "Get the current state of protocol version upgrades", + "inputs": [] + }, + "getProtocolVersionUpgradeVoteStatus": { + "label": "Get Protocol Version Upgrade Vote Status", + "description": "Get voting status for protocol version upgrades", + "inputs": [ + { + "name": "startProTxHash", + "type": "text", + "label": "Start ProTx Hash", + "required": true, + "placeholder": "143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113" + }, + { + "name": "count", + "type": "number", + "label": "Count", + "required": true + } + ] + } + } + }, + "epoch": { + "label": "Epoch & Block", + "queries": { + "getEpochsInfo": { + "label": "Get Epochs Info", + "description": "Get information about epochs", + "inputs": [ + { + "name": "epoch", + "type": "number", + "label": "Start Epoch", + "required": true + }, + { + "name": "count", + "type": "number", + "label": "Count", + "required": true + }, + { + "name": "ascending", + "type": "checkbox", + "label": "Ascending Order", + "required": false + } + ] + }, + "getCurrentEpoch": { + "label": "Get Current Epoch", + "description": "Get information about the current epoch", + "inputs": [] + }, + "getFinalizedEpochInfos": { + "label": "Get Finalized Epoch Info", + "description": "Get information about finalized epochs", + "inputs": [ + { + "name": "startEpoch", + "type": "number", + "label": "Start Epoch", + "required": true + }, + { + "name": "count", + "type": "number", + "label": "Count", + "required": true + } + ] + }, + "getEvonodesProposedEpochBlocksByIds": { + "label": "Get Evonodes Proposed Epoch Blocks by IDs", + "description": "Get proposed blocks by evonode IDs", + "inputs": [ + { + "name": "epoch", + "type": "number", + "label": "Epoch", + "required": true + }, + { + "name": "ids", + "type": "array", + "label": "ProTx Hashes", + "required": true, + "placeholder": "[\"143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113\"]" + } + ] + }, + "getEvonodesProposedEpochBlocksByRange": { + "label": "Get Evonodes Proposed Epoch Blocks by Range", + "description": "Get proposed blocks by range", + "inputs": [ + { + "name": "startProTxHash", + "type": "text", + "label": "Start ProTx Hash", + "required": true, + "placeholder": "143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113" + }, + { + "name": "count", + "type": "number", + "label": "Count", + "required": true + } + ] + } + } + }, + "token": { + "label": "Token Queries", + "queries": { + "getTokenStatuses": { + "label": "Get Token Statuses", + "description": "Get token statuses", + "inputs": [ + { + "name": "tokenIds", + "type": "array", + "label": "Token IDs", + "required": true + } + ] + }, + "getTokenDirectPurchasePrices": { + "label": "Get Token Direct Purchase Prices", + "description": "Get direct purchase prices for tokens", + "inputs": [ + { + "name": "tokenIds", + "type": "array", + "label": "Token IDs", + "required": true + } + ] + }, + "getTokenContractInfo": { + "label": "Get Token Contract Info", + "description": "Get information about a token contract", + "inputs": [ + { + "name": "dataContractId", + "type": "text", + "label": "Data Contract ID", + "required": true, + "placeholder": "EETVvWgohFDKtbB3ejEzBcDRMNYkc9TtgXY6y8hzP3Ta" + } + ] + }, + "getTokenPerpetualDistributionLastClaim": { + "label": "Get Token Perpetual Distribution Last Claim", + "description": "Get last claim information for perpetual distribution", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true + }, + { + "name": "tokenId", + "type": "text", + "label": "Token ID", + "required": true + } + ] + }, + "getTokenTotalSupply": { + "label": "Get Token Total Supply", + "description": "Get total supply of a token", + "inputs": [ + { + "name": "tokenId", + "type": "text", + "label": "Token ID", + "required": true, + "placeholder": "Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv" + } + ] + } + } + }, + "group": { + "label": "Group Queries", + "queries": { + "getGroupInfo": { + "label": "Get Group Info", + "description": "Get information about a group", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Contract ID", + "required": true + }, + { + "name": "groupContractPosition", + "type": "number", + "label": "Group Contract Position", + "required": true + } + ] + }, + "getGroupInfos": { + "label": "Get Group Infos", + "description": "Get information about multiple groups", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Contract ID", + "required": true + }, + { + "name": "startAtGroupContractPosition", + "type": "number", + "label": "Start at Position", + "required": false + }, + { + "name": "startGroupContractPositionIncluded", + "type": "checkbox", + "label": "Include Start Position", + "required": false + }, + { + "name": "count", + "type": "number", + "label": "Count", + "required": false + } + ] + }, + "getGroupActions": { + "label": "Get Group Actions", + "description": "Get actions for a group", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Contract ID", + "required": true + }, + { + "name": "groupContractPosition", + "type": "number", + "label": "Group Contract Position", + "required": true + }, + { + "name": "status", + "type": "select", + "label": "Status", + "required": true, + "options": [ + { + "value": "ACTIVE", + "label": "Active" + }, + { + "value": "CLOSED", + "label": "Closed" + } + ] + }, + { + "name": "startActionId", + "type": "text", + "label": "Start Action ID", + "required": false + }, + { + "name": "startActionIdIncluded", + "type": "checkbox", + "label": "Include Start Action", + "required": false + }, + { + "name": "count", + "type": "number", + "label": "Count", + "required": false + } + ] + }, + "getGroupActionSigners": { + "label": "Get Group Action Signers", + "description": "Get signers for a group action", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Contract ID", + "required": true + }, + { + "name": "groupContractPosition", + "type": "number", + "label": "Group Contract Position", + "required": true + }, + { + "name": "status", + "type": "select", + "label": "Status", + "required": true, + "options": [ + { + "value": "ACTIVE", + "label": "Active" + }, + { + "value": "CLOSED", + "label": "Closed" + } + ] + }, + { + "name": "actionId", + "type": "text", + "label": "Action ID", + "required": true + } + ] + } + } + }, + "system": { + "label": "System & Utility", + "queries": { + "getStatus": { + "label": "Get Status", + "description": "Get system status", + "inputs": [] + }, + "getCurrentQuorumsInfo": { + "label": "Get Current Quorums Info", + "description": "Get information about current quorums", + "inputs": [] + }, + "getPrefundedSpecializedBalance": { + "label": "Get Prefunded Specialized Balance", + "description": "Get prefunded specialized balance", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Specialized Balance ID", + "required": true, + "placeholder": "AzaU7zqCT7X1kxh8yWxkT9PxAgNqWDu4Gz13emwcRyAT" + } + ] + }, + "getTotalCreditsInPlatform": { + "label": "Get Total Credits in Platform", + "description": "Get total credits in the platform", + "inputs": [] + }, + "getPathElements": { + "label": "Get Path Elements", + "description": "Access any data in the Dash Platform state tree. This low-level query allows direct access to GroveDB storage by specifying a path through the tree structure and keys to retrieve at that path. Common paths include: Identities (32), Tokens (96), DataContractDocuments (64), Balances (16), Votes (80), and more.", + "inputs": [ + { + "name": "path", + "type": "array", + "label": "Path", + "required": true + }, + { + "name": "keys", + "type": "array", + "label": "Keys", + "required": true + } + ] + }, + "waitForStateTransitionResult": { + "label": "Wait for State Transition Result", + "description": "Internal query to wait for and retrieve the result of a previously submitted state transition", + "inputs": [ + { + "name": "stateTransitionHash", + "type": "text", + "label": "State Transition Hash", + "required": true + } + ] + } + } + } + }, + "transitions": { + "identity": { + "label": "Identity Transitions", + "transitions": { + "identityCreate": { + "label": "Identity Create", + "description": "Create a new identity with initial credits", + "inputs": [ + { + "name": "seedPhrase", + "type": "textarea", + "label": "Seed Phrase", + "required": true, + "placeholder": "Enter seed phrase (12-24 words) or click Generate", + "help": "The wallet seed phrase that will be used to derive identity keys" + }, + { + "name": "generateSeedButton", + "type": "button", + "label": "Generate New Seed", + "action": "generateTestSeed" + }, + { + "name": "identityIndex", + "type": "number", + "label": "Identity Index", + "required": true, + "value": 0, + "min": 0, + "max": 999, + "help": "The identity index is an internal reference within the wallet. Leave as 0 for first identity." + }, + { + "name": "keySelectionMode", + "type": "select", + "label": "Key Selection Mode", + "required": true, + "value": "default", + "options": [ + { + "value": "default", + "label": "Default (Recommended)" + }, + { + "value": "advanced", + "label": "Advanced" + } + ], + "help": "Default adds standard keys for most Platform operations. Advanced allows custom key configuration." + }, + { + "name": "keyPreview", + "type": "keyPreview", + "label": "Keys to be added", + "help": "These keys will be added to your new identity" + } + ] + }, + "identityTopUp": { + "label": "Identity Top Up", + "description": "Add credits to an existing identity", + "inputs": [ + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true, + "placeholder": "Enter the identity ID to top up (base58)", + "help": "The identity ID that will receive the credits from the asset lock proof" + } + ] + }, + "identityUpdate": { + "label": "Identity Update", + "description": "Update identity keys (add or disable)", + "inputs": [ + { + "name": "addPublicKeys", + "type": "textarea", + "label": "Keys to Add (JSON array)", + "required": false, + "placeholder": "[{\"keyType\":\"ECDSA_HASH160\",\"purpose\":\"AUTHENTICATION\",\"data\":\"base64_key_data\"}]" + }, + { + "name": "disablePublicKeys", + "type": "text", + "label": "Key IDs to Disable (comma-separated)", + "required": false, + "placeholder": "2,3,5" + } + ] + }, + "identityCreditTransfer": { + "label": "Identity Credit Transfer", + "description": "Transfer credits between identities", + "inputs": [ + { + "name": "recipientId", + "type": "text", + "label": "Recipient Identity ID", + "required": true + }, + { + "name": "amount", + "type": "number", + "label": "Amount (credits)", + "required": true + } + ] + }, + "identityCreditWithdrawal": { + "label": "Identity Credit Withdrawal", + "description": "Withdraw credits from identity to Dash address", + "inputs": [ + { + "name": "toAddress", + "type": "text", + "label": "Dash Address", + "required": true + }, + { + "name": "amount", + "type": "number", + "label": "Amount (credits)", + "required": true + }, + { + "name": "coreFeePerByte", + "type": "number", + "label": "Core Fee Per Byte (optional)", + "required": false + } + ] + } + } + }, + "dataContract": { + "label": "Data Contract Transitions", + "transitions": { + "dataContractCreate": { + "label": "Data Contract Create", + "description": "Create a new data contract", + "inputs": [ + { + "name": "canBeDeleted", + "type": "checkbox", + "label": "Can Be Deleted", + "required": false + }, + { + "name": "readonly", + "type": "checkbox", + "label": "Read Only", + "required": false + }, + { + "name": "keepsHistory", + "type": "checkbox", + "label": "Keeps History", + "required": false + }, + { + "name": "documentsKeepHistoryContractDefault", + "type": "checkbox", + "label": "Documents Keep History (Default)", + "required": false + }, + { + "name": "documentsMutableContractDefault", + "type": "checkbox", + "label": "Documents Mutable (Default)", + "required": false, + "defaultValue": true + }, + { + "name": "documentsCanBeDeletedContractDefault", + "type": "checkbox", + "label": "Documents Can Be Deleted (Default)", + "required": false, + "defaultValue": true + }, + { + "name": "requiresIdentityEncryptionBoundedKey", + "type": "text", + "label": "Requires Identity Encryption Key (optional)", + "required": false + }, + { + "name": "requiresIdentityDecryptionBoundedKey", + "type": "text", + "label": "Requires Identity Decryption Key (optional)", + "required": false + }, + { + "name": "documentSchemas", + "type": "json", + "label": "Document Schemas JSON", + "required": true, + "placeholder": "{\n \"note\": {\n \"type\": \"object\",\n \"properties\": {\n \"message\": {\n \"type\": \"string\",\n \"maxLength\": 100,\n \"position\": 0\n }\n },\n \"required\": [\"message\"],\n \"additionalProperties\": false\n }\n}" + }, + { + "name": "groups", + "type": "json", + "label": "Groups (optional)", + "required": false, + "placeholder": "{}" + }, + { + "name": "tokens", + "type": "json", + "label": "Tokens (optional)", + "required": false, + "placeholder": "{}" + }, + { + "name": "keywords", + "type": "text", + "label": "Keywords (comma separated, optional)", + "required": false + }, + { + "name": "description", + "type": "text", + "label": "Description (optional)", + "required": false + } + ] + }, + "dataContractUpdate": { + "label": "Data Contract Update", + "description": "Add document types, groups, or tokens to an existing data contract", + "inputs": [ + { + "name": "dataContractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "newDocumentSchemas", + "type": "json", + "label": "New Document Schemas to Add (optional)", + "required": false, + "placeholder": "{\n \"newType\": {\n \"type\": \"object\",\n \"properties\": {\n \"field\": {\n \"type\": \"string\",\n \"maxLength\": 100,\n \"position\": 0\n }\n },\n \"required\": [\"field\"],\n \"additionalProperties\": false\n }\n}" + }, + { + "name": "newGroups", + "type": "json", + "label": "New Groups to Add (optional)", + "required": false, + "placeholder": "{}" + }, + { + "name": "newTokens", + "type": "json", + "label": "New Tokens to Add (optional)", + "required": false, + "placeholder": "{}" + } + ] + } + } + }, + "document": { + "label": "Document Transitions", + "transitions": { + "documentCreate": { + "label": "Document Create", + "description": "Create a new document", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "documentType", + "type": "text", + "label": "Document Type", + "required": true + }, + { + "name": "fetchSchema", + "type": "button", + "label": "Fetch Schema", + "action": "fetchDocumentSchema" + }, + { + "name": "documentFields", + "type": "dynamic", + "label": "Document Fields" + } + ] + }, + "documentReplace": { + "label": "Document Replace", + "description": "Replace an existing document", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "documentType", + "type": "text", + "label": "Document Type", + "required": true + }, + { + "name": "documentId", + "type": "text", + "label": "Document ID", + "required": true + }, + { + "name": "loadDocument", + "type": "button", + "label": "Load Document", + "action": "loadExistingDocument" + }, + { + "name": "documentFields", + "type": "dynamic", + "label": "Document Fields" + } + ] + }, + "documentDelete": { + "label": "Document Delete", + "description": "Delete an existing document", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "documentType", + "type": "text", + "label": "Document Type", + "required": true + }, + { + "name": "documentId", + "type": "text", + "label": "Document ID", + "required": true + } + ] + }, + "documentTransfer": { + "label": "Document Transfer", + "description": "Transfer document ownership", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "documentType", + "type": "text", + "label": "Document Type", + "required": true + }, + { + "name": "documentId", + "type": "text", + "label": "Document ID", + "required": true + }, + { + "name": "recipientId", + "type": "text", + "label": "Recipient Identity ID", + "required": true + } + ] + }, + "documentPurchase": { + "label": "Document Purchase", + "description": "Purchase a document", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "documentType", + "type": "text", + "label": "Document Type", + "required": true + }, + { + "name": "documentId", + "type": "text", + "label": "Document ID", + "required": true + }, + { + "name": "price", + "type": "number", + "label": "Price (credits)", + "required": true + } + ] + }, + "documentSetPrice": { + "label": "Document Set Price", + "description": "Set or update document price", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "documentType", + "type": "text", + "label": "Document Type", + "required": true + }, + { + "name": "documentId", + "type": "text", + "label": "Document ID", + "required": true + }, + { + "name": "price", + "type": "number", + "label": "Price (credits, 0 to remove)", + "required": true + } + ] + }, + "dpnsRegister": { + "label": "DPNS Register Name", + "description": "Register a new DPNS username", + "inputs": [ + { + "name": "label", + "type": "text", + "label": "Username", + "required": true, + "placeholder": "Enter username (e.g., alice)", + "validateOnType": true + } + ] + } + } + }, + "token": { + "label": "Token Transitions", + "transitions": { + "tokenBurn": { + "label": "Token Burn", + "description": "Burn tokens", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenPosition", + "type": "number", + "label": "Token Contract Position", + "required": true + }, + { + "name": "amount", + "type": "text", + "label": "Amount to Burn", + "required": true + }, + { + "name": "publicNote", + "type": "text", + "label": "Public Note", + "required": false + } + ] + }, + "tokenMint": { + "label": "Token Mint", + "description": "Mint new tokens", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenPosition", + "type": "number", + "label": "Token Contract Position", + "required": true + }, + { + "name": "amount", + "type": "text", + "label": "Amount to Mint", + "required": true + }, + { + "name": "issuedToIdentityId", + "type": "text", + "label": "Issue To Identity ID", + "required": false + }, + { + "name": "publicNote", + "type": "text", + "label": "Public Note", + "required": false + } + ] + }, + "tokenClaim": { + "label": "Token Claim", + "description": "Claim tokens from a distribution", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenPosition", + "type": "number", + "label": "Token Contract Position", + "required": true + }, + { + "name": "distributionType", + "type": "select", + "label": "Distribution Type", + "required": true, + "options": [ + { + "value": "perpetual", + "label": "Perpetual" + }, + { + "value": "preprogrammed", + "label": "Pre-programmed" + } + ] + }, + { + "name": "publicNote", + "type": "text", + "label": "Public Note", + "required": false + } + ] + }, + "tokenSetPriceForDirectPurchase": { + "label": "Token Set Price", + "description": "Set or update the price for direct token purchases", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenPosition", + "type": "number", + "label": "Token Contract Position", + "required": true + }, + { + "name": "priceType", + "type": "select", + "label": "Price Type", + "required": true, + "options": [ + { + "value": "single", + "label": "Single Price" + }, + { + "value": "tiered", + "label": "Tiered Pricing" + } + ] + }, + { + "name": "priceData", + "type": "text", + "label": "Price Data (single price or JSON map)", + "required": false, + "placeholder": "Leave empty to remove pricing" + }, + { + "name": "publicNote", + "type": "text", + "label": "Public Note", + "required": false + } + ] + }, + "tokenDirectPurchase": { + "label": "Token Direct Purchase", + "description": "Purchase tokens directly at the configured price", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenPosition", + "type": "number", + "label": "Token Contract Position", + "required": true + }, + { + "name": "amount", + "type": "text", + "label": "Amount to Purchase", + "required": true + }, + { + "name": "totalAgreedPrice", + "type": "text", + "label": "Total Agreed Price (in credits) - Optional, fetches from pricing schedule if not provided", + "required": false + }, + { + "name": "keyId", + "type": "number", + "label": "Key ID (for signing)", + "required": true + } + ] + }, + "tokenConfigUpdate": { + "label": "Token Config Update", + "description": "Update token configuration settings", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenPosition", + "type": "number", + "label": "Token Contract Position", + "required": true + }, + { + "name": "configItemType", + "type": "select", + "label": "Config Item Type", + "required": true, + "options": [ + { + "value": "conventions", + "label": "Conventions" + }, + { + "value": "max_supply", + "label": "Max Supply" + }, + { + "value": "perpetual_distribution", + "label": "Perpetual Distribution" + }, + { + "value": "new_tokens_destination_identity", + "label": "New Tokens Destination Identity" + }, + { + "value": "minting_allow_choosing_destination", + "label": "Minting Allow Choosing Destination" + }, + { + "value": "manual_minting", + "label": "Manual Minting" + }, + { + "value": "manual_burning", + "label": "Manual Burning" + }, + { + "value": "conventions_control_group", + "label": "Conventions Control Group" + }, + { + "value": "conventions_admin_group", + "label": "Conventions Admin Group" + }, + { + "value": "max_supply_control_group", + "label": "Max Supply Control Group" + }, + { + "value": "max_supply_admin_group", + "label": "Max Supply Admin Group" + } + ] + }, + { + "name": "configValue", + "type": "text", + "label": "Config Value (JSON or specific value)", + "required": true + }, + { + "name": "publicNote", + "type": "text", + "label": "Public Note", + "required": false + } + ] + }, + "tokenTransfer": { + "label": "Token Transfer", + "description": "Transfer tokens to another identity", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenId", + "type": "text", + "label": "Token Contract Position", + "required": true + }, + { + "name": "amount", + "type": "number", + "label": "Amount to Transfer", + "required": true + }, + { + "name": "recipientId", + "type": "text", + "label": "Recipient Identity ID", + "required": true + } + ] + }, + "tokenFreeze": { + "label": "Token Freeze", + "description": "Freeze tokens for an identity", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenId", + "type": "text", + "label": "Token Contract Position", + "required": true + }, + { + "name": "identityId", + "type": "text", + "label": "Identity ID to Freeze", + "required": true + } + ] + }, + "tokenUnfreeze": { + "label": "Token Unfreeze", + "description": "Unfreeze tokens for an identity", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenId", + "type": "text", + "label": "Token Contract Position", + "required": true + }, + { + "name": "identityId", + "type": "text", + "label": "Identity ID to Unfreeze", + "required": true + } + ] + }, + "tokenDestroyFrozen": { + "label": "Token Destroy Frozen Funds", + "description": "Destroy frozen tokens", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true + }, + { + "name": "tokenId", + "type": "text", + "label": "Token Contract Position", + "required": true + }, + { + "name": "identityId", + "type": "text", + "label": "Identity ID", + "required": true + } + ] + } + } + }, + "voting": { + "label": "Voting Transitions", + "transitions": { + "dpnsUsername": { + "label": "DPNS Username", + "description": "Cast a vote for a contested DPNS username", + "inputs": [ + { + "name": "contestedUsername", + "type": "text", + "label": "Contested Username", + "required": true, + "placeholder": "Enter the contested username (e.g., 'myusername')" + }, + { + "name": "voteChoice", + "type": "select", + "label": "Vote Choice", + "required": true, + "options": [ + { + "value": "abstain", + "label": "Abstain" + }, + { + "value": "lock", + "label": "Lock (Give to no one)" + }, + { + "value": "towardsIdentity", + "label": "Vote for Identity" + } + ] + }, + { + "name": "targetIdentity", + "type": "text", + "label": "Target Identity ID (if voting for identity)", + "required": false, + "placeholder": "Identity ID to vote for", + "dependsOn": { + "field": "voteChoice", + "value": "towardsIdentity" + } + } + ] + }, + "masternodeVote": { + "label": "Contested Resource", + "description": "Cast a vote for contested resources as a masternode", + "inputs": [ + { + "name": "contractId", + "type": "text", + "label": "Data Contract ID", + "required": true, + "placeholder": "Contract ID containing the contested resource" + }, + { + "name": "fetchContestedResources", + "type": "button", + "label": "Get Contested Resources", + "action": "fetchContestedResources" + }, + { + "name": "contestedResourceDropdown", + "type": "dynamic", + "label": "Contested Resources" + }, + { + "name": "voteChoice", + "type": "select", + "label": "Vote Choice", + "required": true, + "options": [ + { + "value": "abstain", + "label": "Abstain" + }, + { + "value": "lock", + "label": "Lock (Give to no one)" + }, + { + "value": "towardsIdentity", + "label": "Vote for Identity" + } + ] + }, + { + "name": "targetIdentity", + "type": "text", + "label": "Target Identity ID (if voting for identity)", + "required": false, + "placeholder": "Identity ID to vote for", + "dependsOn": { + "field": "voteChoice", + "value": "towardsIdentity" + } + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/packages/wasm-sdk/index.html b/packages/wasm-sdk/index.html index b4bc1c1473..8878755b08 100644 --- a/packages/wasm-sdk/index.html +++ b/packages/wasm-sdk/index.html @@ -1210,349 +1210,26 @@

Results

let currentResult = null; let initRequestCounter = 0; - // State Transition definitions - const stateTransitionDefinitions = { - identity: { - label: "Identity Transitions", - transitions: { - identityCreate: { - label: "Identity Create", - description: "Create a new identity with initial credits", - inputs: [ - { name: "seedPhrase", type: "textarea", label: "Seed Phrase", required: true, - placeholder: "Enter seed phrase (12-24 words) or click Generate", - help: "The wallet seed phrase that will be used to derive identity keys" }, - { name: "generateSeedButton", type: "button", label: "Generate New Seed", - action: "generateTestSeed" }, - { name: "identityIndex", type: "number", label: "Identity Index", required: true, - value: 0, min: 0, max: 999, - help: "The identity index is an internal reference within the wallet. Leave as 0 for first identity." }, - { name: "keySelectionMode", type: "select", label: "Key Selection Mode", required: true, - value: "default", - options: [ - { value: "default", label: "Default (Recommended)" }, - { value: "advanced", label: "Advanced" } - ], - help: "Default adds standard keys for most Platform operations. Advanced allows custom key configuration." }, - { name: "keyPreview", type: "keyPreview", label: "Keys to be added", - help: "These keys will be added to your new identity" } - ] - }, - identityTopUp: { - label: "Identity Top Up", - description: "Add credits to an existing identity", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true, - placeholder: "Enter the identity ID to top up (base58)", - help: "The identity ID that will receive the credits from the asset lock proof" } - ] - }, - identityUpdate: { - label: "Identity Update", - description: "Update identity keys (add or disable)", - inputs: [ - { name: "addPublicKeys", type: "textarea", label: "Keys to Add (JSON array)", required: false, - placeholder: '[{"keyType":"ECDSA_HASH160","purpose":"AUTHENTICATION","data":"base64_key_data"}]' }, - { name: "disablePublicKeys", type: "text", label: "Key IDs to Disable (comma-separated)", required: false, - placeholder: "2,3,5" } - ] - }, - identityCreditTransfer: { - label: "Identity Credit Transfer", - description: "Transfer credits between identities", - inputs: [ - { name: "recipientId", type: "text", label: "Recipient Identity ID", required: true }, - { name: "amount", type: "number", label: "Amount (credits)", required: true } - ] - }, - identityCreditWithdrawal: { - label: "Identity Credit Withdrawal", - description: "Withdraw credits from identity to Dash address", - inputs: [ - { name: "toAddress", type: "text", label: "Dash Address", required: true }, - { name: "amount", type: "number", label: "Amount (credits)", required: true }, - { name: "coreFeePerByte", type: "number", label: "Core Fee Per Byte (optional)", required: false } - ] - } - } - }, - dataContract: { - label: "Data Contract Transitions", - transitions: { - dataContractCreate: { - label: "Data Contract Create", - description: "Create a new data contract", - inputs: [ - { name: "canBeDeleted", type: "checkbox", label: "Can Be Deleted", required: false }, - { name: "readonly", type: "checkbox", label: "Read Only", required: false }, - { name: "keepsHistory", type: "checkbox", label: "Keeps History", required: false }, - { name: "documentsKeepHistoryContractDefault", type: "checkbox", label: "Documents Keep History (Default)", required: false }, - { name: "documentsMutableContractDefault", type: "checkbox", label: "Documents Mutable (Default)", required: false, defaultValue: true }, - { name: "documentsCanBeDeletedContractDefault", type: "checkbox", label: "Documents Can Be Deleted (Default)", required: false, defaultValue: true }, - { name: "requiresIdentityEncryptionBoundedKey", type: "text", label: "Requires Identity Encryption Key (optional)", required: false }, - { name: "requiresIdentityDecryptionBoundedKey", type: "text", label: "Requires Identity Decryption Key (optional)", required: false }, - { name: "documentSchemas", type: "json", label: "Document Schemas JSON", required: true, placeholder: '{\n "note": {\n "type": "object",\n "properties": {\n "message": {\n "type": "string",\n "maxLength": 100,\n "position": 0\n }\n },\n "required": ["message"],\n "additionalProperties": false\n }\n}' }, - { name: "groups", type: "json", label: "Groups (optional)", required: false, placeholder: '{}' }, - { name: "tokens", type: "json", label: "Tokens (optional)", required: false, placeholder: '{}' }, - { name: "keywords", type: "text", label: "Keywords (comma separated, optional)", required: false }, - { name: "description", type: "text", label: "Description (optional)", required: false } - ] - }, - dataContractUpdate: { - label: "Data Contract Update", - description: "Add document types, groups, or tokens to an existing data contract", - inputs: [ - { name: "dataContractId", type: "text", label: "Data Contract ID", required: true }, - { name: "newDocumentSchemas", type: "json", label: "New Document Schemas to Add (optional)", required: false, placeholder: '{\n "newType": {\n "type": "object",\n "properties": {\n "field": {\n "type": "string",\n "maxLength": 100,\n "position": 0\n }\n },\n "required": ["field"],\n "additionalProperties": false\n }\n}' }, - { name: "newGroups", type: "json", label: "New Groups to Add (optional)", required: false, placeholder: '{}' }, - { name: "newTokens", type: "json", label: "New Tokens to Add (optional)", required: false, placeholder: '{}' } - ] - } - } - }, - document: { - label: "Document Transitions", - transitions: { - documentCreate: { - label: "Document Create", - description: "Create a new document", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentType", type: "text", label: "Document Type", required: true }, - { name: "fetchSchema", type: "button", label: "Fetch Schema", action: "fetchDocumentSchema" }, - { name: "documentFields", type: "dynamic", label: "Document Fields" } - ] - }, - documentReplace: { - label: "Document Replace", - description: "Replace an existing document", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentType", type: "text", label: "Document Type", required: true }, - { name: "documentId", type: "text", label: "Document ID", required: true }, - { name: "loadDocument", type: "button", label: "Load Document", action: "loadExistingDocument" }, - { name: "documentFields", type: "dynamic", label: "Document Fields" } - ] - }, - documentDelete: { - label: "Document Delete", - description: "Delete an existing document", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentType", type: "text", label: "Document Type", required: true }, - { name: "documentId", type: "text", label: "Document ID", required: true } - ] - }, - documentTransfer: { - label: "Document Transfer", - description: "Transfer document ownership", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentType", type: "text", label: "Document Type", required: true }, - { name: "documentId", type: "text", label: "Document ID", required: true }, - { name: "recipientId", type: "text", label: "Recipient Identity ID", required: true } - ] - }, - documentPurchase: { - label: "Document Purchase", - description: "Purchase a document", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentType", type: "text", label: "Document Type", required: true }, - { name: "documentId", type: "text", label: "Document ID", required: true }, - { name: "price", type: "number", label: "Price (credits)", required: true } - ] - }, - documentSetPrice: { - label: "Document Set Price", - description: "Set or update document price (0 to remove price)", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentType", type: "text", label: "Document Type", required: true }, - { name: "documentId", type: "text", label: "Document ID", required: true }, - { name: "price", type: "number", label: "Price (credits, 0 to remove)", required: true } - ] - }, - dpnsRegister: { - label: "DPNS Register Name", - description: "Register a new DPNS username", - inputs: [ - { name: "label", type: "text", label: "Username", required: true, placeholder: "Enter username (e.g., alice)", validateOnType: true } - ] - } - } - }, - token: { - label: "Token Transitions", - transitions: { - tokenBurn: { - label: "Token Burn", - description: "Burn tokens", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenPosition", type: "number", label: "Token Contract Position", required: true }, - { name: "amount", type: "text", label: "Amount to Burn", required: true }, - { name: "publicNote", type: "text", label: "Public Note", required: false } - ] - }, - tokenMint: { - label: "Token Mint", - description: "Mint new tokens", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenPosition", type: "number", label: "Token Contract Position", required: true }, - { name: "amount", type: "text", label: "Amount to Mint", required: true }, - { name: "issuedToIdentityId", type: "text", label: "Issue To Identity ID", required: false }, - { name: "publicNote", type: "text", label: "Public Note", required: false } - ] - }, - tokenClaim: { - label: "Token Claim", - description: "Claim tokens from a distribution", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenPosition", type: "number", label: "Token Contract Position", required: true }, - { name: "distributionType", type: "select", label: "Distribution Type", required: true, options: [ - { value: "perpetual", label: "Perpetual" }, - { value: "preprogrammed", label: "Pre-programmed" } - ]}, - { name: "keyId", type: "number", label: "Key ID (for signing)", required: true }, - { name: "publicNote", type: "text", label: "Public Note", required: false } - ] - }, - tokenSetPriceForDirectPurchase: { - label: "Token Set Price", - description: "Set or update the price for direct token purchases", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenPosition", type: "number", label: "Token Contract Position", required: true }, - { name: "priceType", type: "select", label: "Price Type", required: true, options: [ - { value: "single", label: "Single Price" }, - { value: "tiered", label: "Tiered Pricing" } - ]}, - { name: "priceData", type: "text", label: "Price Data (single price or JSON map)", required: false, placeholder: "Leave empty to remove pricing" }, - { name: "keyId", type: "number", label: "Key ID (for signing)", required: true }, - { name: "publicNote", type: "text", label: "Public Note", required: false } - ] - }, - tokenDirectPurchase: { - label: "Token Direct Purchase", - description: "Purchase tokens directly at the configured price", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenPosition", type: "number", label: "Token Contract Position", required: true }, - { name: "amount", type: "text", label: "Amount to Purchase", required: true }, - { name: "totalAgreedPrice", type: "text", label: "Total Agreed Price (in credits) - Optional, fetches from pricing schedule if not provided", required: false }, - { name: "keyId", type: "number", label: "Key ID (for signing)", required: true } - ] - }, - tokenConfigUpdate: { - label: "Token Config Update", - description: "Update token configuration settings", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenPosition", type: "number", label: "Token Contract Position", required: true }, - { name: "configItemType", type: "select", label: "Config Item Type", required: true, options: [ - { value: "conventions", label: "Conventions" }, - { value: "max_supply", label: "Max Supply" }, - { value: "perpetual_distribution", label: "Perpetual Distribution" }, - { value: "new_tokens_destination_identity", label: "New Tokens Destination Identity" }, - { value: "minting_allow_choosing_destination", label: "Minting Allow Choosing Destination" }, - { value: "manual_minting", label: "Manual Minting" }, - { value: "manual_burning", label: "Manual Burning" }, - { value: "conventions_control_group", label: "Conventions Control Group" }, - { value: "conventions_admin_group", label: "Conventions Admin Group" }, - { value: "max_supply_control_group", label: "Max Supply Control Group" }, - { value: "max_supply_admin_group", label: "Max Supply Admin Group" } - ]}, - { name: "configValue", type: "text", label: "Config Value (JSON or specific value)", required: true }, - { name: "keyId", type: "number", label: "Key ID (for signing)", required: true }, - { name: "publicNote", type: "text", label: "Public Note", required: false } - ] - }, - tokenTransfer: { - label: "Token Transfer", - description: "Transfer tokens to another identity", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenId", type: "text", label: "Token Contract Position", required: true }, - { name: "amount", type: "number", label: "Amount to Transfer", required: true }, - { name: "recipientId", type: "text", label: "Recipient Identity ID", required: true } - ] - }, - tokenFreeze: { - label: "Token Freeze", - description: "Freeze tokens for an identity", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenId", type: "text", label: "Token Contract Position", required: true }, - { name: "identityId", type: "text", label: "Identity ID to Freeze", required: true } - ] - }, - tokenUnfreeze: { - label: "Token Unfreeze", - description: "Unfreeze tokens for an identity", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenId", type: "text", label: "Token Contract Position", required: true }, - { name: "identityId", type: "text", label: "Identity ID to Unfreeze", required: true } - ] - }, - tokenDestroyFrozen: { - label: "Token Destroy Frozen Funds", - description: "Destroy frozen tokens", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true }, - { name: "tokenId", type: "text", label: "Token Contract Position", required: true }, - { name: "identityId", type: "text", label: "Identity ID", required: true } - ] - } - } - }, - voting: { - label: "Voting Transitions", - transitions: { - dpnsUsername: { - label: "DPNS Username", - description: "Cast a vote for a contested DPNS username (simplified)", - inputs: [ - { name: "contestedUsername", type: "text", label: "Contested Username", required: true, - placeholder: "Enter the contested username (e.g., 'myusername')" }, - { name: "voteChoice", type: "select", label: "Vote Choice", required: true, - options: [ - { value: "abstain", label: "Abstain" }, - { value: "lock", label: "Lock (Give to no one)" }, - { value: "towardsIdentity", label: "Vote for Identity" } - ] - }, - { name: "targetIdentity", type: "text", label: "Target Identity ID (if voting for identity)", required: false, - placeholder: "Identity ID to vote for", - dependsOn: { field: "voteChoice", value: "towardsIdentity" } } - ] - }, - masternodeVote: { - label: "Contested Resource", - description: "Cast a vote for contested resources as a masternode", - inputs: [ - { name: "contractId", type: "text", label: "Data Contract ID", required: true, - placeholder: "Contract ID containing the contested resource" }, - { name: "fetchContestedResources", type: "button", label: "Get Contested Resources", action: "fetchContestedResources" }, - { name: "contestedResourceDropdown", type: "dynamic", label: "Contested Resources" }, - { name: "voteChoice", type: "select", label: "Vote Choice", required: true, - options: [ - { value: "abstain", label: "Abstain" }, - { value: "lock", label: "Lock (Give to no one)" }, - { value: "towardsIdentity", label: "Vote for Identity" } - ] - }, - { name: "targetIdentity", type: "text", label: "Target Identity ID (if voting for identity)", required: false, - placeholder: "Identity ID to vote for", - dependsOn: { field: "voteChoice", value: "towardsIdentity" } } - ] - } + // API definitions - will be loaded from JSON + let queryDefinitions = {}; + let stateTransitionDefinitions = {}; + + // Function to load API definitions from JSON + async function loadApiDefinitions() { + try { + const response = await fetch('./api-definitions.json'); + if (!response.ok) { + throw new Error(`Failed to load API definitions: ${response.status}`); } + const apiData = await response.json(); + queryDefinitions = apiData.queries || {}; + stateTransitionDefinitions = apiData.transitions || {}; + console.log('API definitions loaded successfully'); + } catch (error) { + console.error('Failed to load API definitions:', error); + throw error; } - }; + } // Wallet definitions const walletDefinitions = { @@ -1727,549 +1404,6 @@

Results

} }; - // Query definitions - const queryDefinitions = { - identity: { - label: "Identity Queries", - queries: { - getIdentity: { - label: "Get Identity", - description: "Fetch an identity by its identifier", - inputs: [ - { name: "id", type: "text", label: "Identity ID", required: true } - ] - }, - getIdentityKeys: { - label: "Get Identity Keys", - description: "Retrieve keys associated with an identity", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true }, - { name: "keyRequestType", type: "select", label: "Key Request Type", required: true, - options: [ - { value: "all", label: "All Keys" }, - { value: "specific", label: "Specific Keys" }, - { value: "search", label: "Search Keys" } - ] - }, - { name: "specificKeyIds", type: "array", label: "Key IDs (for Specific Keys)", required: false, - dependsOn: { field: "keyRequestType", value: "specific" } }, - { name: "searchPurposeMap", type: "text", label: "Search Purpose Map (JSON)", required: false, - placeholder: '{"0": {"0": "current"}, "1": {"0": "all"}}', - dependsOn: { field: "keyRequestType", value: "search" } }, - { name: "limit", type: "number", label: "Limit", required: false }, - { name: "offset", type: "number", label: "Offset", required: false } - ] - }, - getIdentitiesContractKeys: { - label: "Get Identities Contract Keys", - description: "Get keys for multiple identities related to a specific contract", - inputs: [ - { name: "identitiesIds", type: "array", label: "Identity IDs", required: true }, - { name: "contractId", type: "text", label: "Contract ID", required: true }, - { name: "documentTypeName", type: "text", label: "Document Type Name", required: false }, - { name: "purposes", type: "multiselect", label: "Key Purposes", required: false, - options: [ - { value: "0", label: "Authentication" }, - { value: "1", label: "Encryption" }, - { value: "2", label: "Decryption" }, - { value: "3", label: "Transfer" }, - { value: "5", label: "Voting" } - ] - } - ] - }, - getIdentityNonce: { - label: "Get Identity Nonce", - description: "Get the current nonce for an identity", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true } - ] - }, - getIdentityContractNonce: { - label: "Get Identity Contract Nonce", - description: "Get the nonce for an identity in relation to a specific contract", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true }, - { name: "contractId", type: "text", label: "Contract ID", required: true } - ] - }, - getIdentityBalance: { - label: "Get Identity Balance", - description: "Get the credit balance of an identity", - inputs: [ - { name: "id", type: "text", label: "Identity ID", required: true } - ] - }, - getIdentitiesBalances: { - label: "Get Identities Balances", - description: "Get balances for multiple identities", - inputs: [ - { name: "ids", type: "array", label: "Identity IDs", required: true } - ] - }, - getIdentityBalanceAndRevision: { - label: "Get Identity Balance and Revision", - description: "Get both balance and revision number for an identity", - inputs: [ - { name: "id", type: "text", label: "Identity ID", required: true } - ] - }, - getIdentityByPublicKeyHash: { - label: "Get Identity by Unique Public Key Hash", - description: "Find an identity by its unique public key hash", - inputs: [ - { name: "publicKeyHash", type: "text", label: "Public Key Hash", required: true } - ] - }, - getIdentityByNonUniquePublicKeyHash: { - label: "Get Identity by Non-Unique Public Key Hash", - description: "Find identities by non-unique public key hash (for ECDSA_HASH160, BIP13_SCRIPT_HASH, or EDDSA_25519_HASH160 key types - supports pagination)", - inputs: [ - { name: "publicKeyHash", type: "text", label: "Public Key Hash", required: true }, - { name: "startAfter", type: "text", label: "Start After (Identity ID)", required: false } - ] - }, - getIdentityTokenBalances: { - label: "Get Identity Token Balances", - description: "Get token balances for an identity", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true }, - { name: "tokenIds", type: "array", label: "Token IDs", required: true } - ] - }, - getIdentitiesTokenBalances: { - label: "Get Identities Token Balances", - description: "Get token balance for multiple identities", - inputs: [ - { name: "identityIds", type: "array", label: "Identity IDs", required: true }, - { name: "tokenId", type: "text", label: "Token ID", required: true } - ] - }, - getIdentityTokenInfos: { - label: "Get Identity Token Info", - description: "Get token information (frozen status) for an identity's tokens", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true }, - { name: "tokenIds", type: "array", label: "Token IDs", required: true } - ] - }, - getIdentitiesTokenInfos: { - label: "Get Identities Token Info", - description: "Get token information (frozen status) for multiple identities with a specific token", - inputs: [ - { name: "identityIds", type: "array", label: "Identity IDs", required: true }, - { name: "tokenId", type: "text", label: "Token ID", required: true } - ] - } - } - }, - dataContract: { - label: "Data Contract Queries", - queries: { - getDataContract: { - label: "Get Data Contract", - description: "Fetch a data contract by its identifier", - inputs: [ - { name: "id", type: "text", label: "Data Contract ID", required: true } - ] - }, - getDataContractHistory: { - label: "Get Data Contract History", - description: "Get the version history of a data contract", - inputs: [ - { name: "id", type: "text", label: "Data Contract ID", required: true }, - { name: "limit", type: "number", label: "Limit", required: false }, - { name: "offset", type: "number", label: "Offset", required: false }, - { name: "startAtMs", type: "number", label: "Start At (ms)", required: false } - ] - }, - getDataContracts: { - label: "Get Data Contracts", - description: "Fetch multiple data contracts by their identifiers", - inputs: [ - { name: "ids", type: "array", label: "Data Contract IDs", required: true } - ] - } - } - }, - document: { - label: "Document Queries", - queries: { - getDocuments: { - label: "Get Documents", - description: "Query documents from a data contract", - inputs: [ - { name: "dataContractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentType", type: "text", label: "Document Type", required: true }, - { name: "loadContract", type: "button", label: "Load Contract", action: "loadDataContractForDocuments" }, - { name: "indexSelector", type: "select", label: "Select Index", required: false, dynamic: true }, - { name: "whereFields", type: "dynamic", label: "Where Fields", required: false }, - { name: "orderByFields", type: "dynamic", label: "Order By Fields", required: false }, - { name: "limit", type: "number", label: "Limit", required: false }, - { name: "startOption", type: "select", label: "Start Option", required: false, - options: [ - { value: "none", label: "None" }, - { value: "startAfter", label: "Start After" }, - { value: "startAt", label: "Start At" } - ] - }, - { name: "startValue", type: "text", label: "Start Value (Document ID)", required: false, - dependsOn: { field: "startOption", value: ["startAfter", "startAt"] } } - ] - }, - getDocument: { - label: "Get Document", - description: "Fetch a specific document by ID", - inputs: [ - { name: "dataContractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentType", type: "text", label: "Document Type", required: true }, - { name: "documentId", type: "text", label: "Document ID", required: true } - ] - } - } - }, - dpns: { - label: "DPNS Queries", - queries: { - getDpnsUsername: { - label: "Get DPNS Usernames", - description: "Get DPNS usernames for an identity", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true }, - { name: "limit", type: "number", label: "Limit", required: false, placeholder: "Default: 10" } - ] - }, - dpnsCheckAvailability: { - label: "DPNS Check Availability", - description: "Check if a DPNS username is available", - inputs: [ - { name: "label", type: "text", label: "Username to Check", required: true, placeholder: "Enter username (e.g., alice)" } - ] - }, - dpnsResolve: { - label: "DPNS Resolve Name", - description: "Resolve a DPNS name to an identity ID", - inputs: [ - { name: "name", type: "text", label: "DPNS Name", required: true, placeholder: "Enter name (e.g., alice or alice.dash)" } - ] - }, - dpnsSearch: { - label: "DPNS Search Name", - description: "Search for DPNS names that start with a given prefix", - inputs: [ - { name: "prefix", type: "text", label: "Name Prefix", required: true, placeholder: "Enter prefix (e.g., ali)" }, - { name: "limit", type: "number", label: "Limit", required: false, placeholder: "Default: 10" } - ] - } - } - }, - voting: { - label: "Voting & Contested Resources", - queries: { - getContestedResources: { - label: "Get Contested Resources", - description: "Get list of contested resources", - inputs: [ - { name: "documentTypeName", type: "text", label: "Document Type Name", required: true }, - { name: "dataContractId", type: "text", label: "Data Contract ID", required: true }, - { name: "indexName", type: "text", label: "Index Name", required: true }, - { name: "resultType", type: "select", label: "Result Type", required: true, - options: [ - { value: "documents", label: "Documents" }, - { value: "vote_tally", label: "Vote Tally" }, - { value: "document_with_vote_tally", label: "Document with Vote Tally" } - ] - }, - { name: "allowIncludeLockedAndAbstainingVoteTally", type: "checkbox", label: "Include Locked and Abstaining", required: false }, - { name: "startAtValue", type: "text", label: "Start At Value (hex bytes)", required: false }, - { name: "limit", type: "number", label: "Limit", required: false }, - { name: "offset", type: "number", label: "Offset", required: false }, - { name: "orderAscending", type: "checkbox", label: "Order Ascending", required: false } - ] - }, - getContestedResourceVoteState: { - label: "Get Contested Resource Vote State", - description: "Get the current vote state for a contested resource", - inputs: [ - { name: "dataContractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentTypeName", type: "text", label: "Document Type Name", required: true }, - { name: "indexName", type: "text", label: "Index Name", required: true }, - { name: "indexValues", type: "array", label: "Index Values", required: true }, - { name: "resultType", type: "select", label: "Result Type", required: true, - options: [ - { value: "contenders", label: "Contenders" }, - { value: "abstainers", label: "Abstainers" }, - { value: "locked", label: "Locked" } - ] - }, - { name: "allowIncludeLockedAndAbstainingVoteTally", type: "checkbox", label: "Include Locked and Abstaining", required: false }, - { name: "startAtIdentifierInfo", type: "json", label: "Start At Identifier Info (JSON)", required: false }, - { name: "count", type: "number", label: "Count", required: false }, - { name: "orderAscending", type: "checkbox", label: "Order Ascending", required: false } - ] - }, - getContestedResourceVotersForIdentity: { - label: "Get Contested Resource Voters for Identity", - description: "Get voters who voted for a specific identity in a contested resource", - inputs: [ - { name: "dataContractId", type: "text", label: "Data Contract ID", required: true }, - { name: "documentTypeName", type: "text", label: "Document Type Name", required: true }, - { name: "indexName", type: "text", label: "Index Name", required: true }, - { name: "indexValues", type: "array", label: "Index Values", required: true }, - { name: "contestantId", type: "text", label: "Contestant ID", required: true }, - { name: "startAtIdentifierInfo", type: "json", label: "Start At Identifier Info (JSON)", required: false }, - { name: "count", type: "number", label: "Count", required: false }, - { name: "orderAscending", type: "checkbox", label: "Order Ascending", required: false } - ] - }, - getContestedResourceIdentityVotes: { - label: "Get Contested Resource Identity Votes", - description: "Get all votes cast by a specific identity", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true }, - { name: "limit", type: "number", label: "Limit", required: false }, - { name: "offset", type: "number", label: "Offset", required: false }, - { name: "orderAscending", type: "checkbox", label: "Order Ascending", required: false } - ] - }, - getVotePollsByEndDate: { - label: "Get Vote Polls by End Date", - description: "Get vote polls within a time range", - inputs: [ - { name: "startTimeMs", type: "number", label: "Start Time (ms)", required: false }, - { name: "endTimeMs", type: "number", label: "End Time (ms)", required: false }, - { name: "limit", type: "number", label: "Limit", required: false }, - { name: "offset", type: "number", label: "Offset", required: false }, - { name: "orderAscending", type: "checkbox", label: "Ascending Order", required: false } - ] - } - } - }, - protocol: { - label: "Protocol & Version", - queries: { - getProtocolVersionUpgradeState: { - label: "Get Protocol Version Upgrade State", - description: "Get the current state of protocol version upgrades", - inputs: [] - }, - getProtocolVersionUpgradeVoteStatus: { - label: "Get Protocol Version Upgrade Vote Status", - description: "Get voting status for protocol version upgrades", - inputs: [ - { name: "startProTxHash", type: "text", label: "Start ProTx Hash (optional - leave empty to start from beginning)", required: false }, - { name: "count", type: "number", label: "Count (default: 100)", required: false } - ] - } - } - }, - epoch: { - label: "Epoch & Block", - queries: { - getEpochsInfo: { - label: "Get Epochs Info", - description: "Get information about epochs", - inputs: [ - { name: "startEpoch", type: "number", label: "Start Epoch", required: false }, - { name: "count", type: "number", label: "Count", required: false }, - { name: "ascending", type: "checkbox", label: "Ascending Order", required: false } - ] - }, - getCurrentEpoch: { - label: "Get Current Epoch", - description: "Get information about the current epoch", - inputs: [] - }, - getFinalizedEpochInfos: { - label: "Get Finalized Epoch Info", - description: "Get information about finalized epochs", - inputs: [ - { name: "startEpoch", type: "number", label: "Start Epoch", required: false }, - { name: "count", type: "number", label: "Count", required: false }, - { name: "ascending", type: "checkbox", label: "Ascending Order", required: false } - ] - }, - getEvonodesProposedEpochBlocksByIds: { - label: "Get Evonodes Proposed Epoch Blocks by IDs", - description: "Get proposed blocks by evonode IDs", - inputs: [ - { name: "epoch", type: "number", label: "Epoch", required: true }, - { name: "ids", type: "array", label: "Evonode IDs", required: true } - ] - }, - getEvonodesProposedEpochBlocksByRange: { - label: "Get Evonodes Proposed Epoch Blocks by Range", - description: "Get proposed blocks by range", - inputs: [ - { name: "epoch", type: "number", label: "Epoch", required: true }, - { name: "limit", type: "number", label: "Limit", required: false }, - { name: "startAfter", type: "text", label: "Start After (Evonode ID)", required: false }, - { name: "orderAscending", type: "checkbox", label: "Order Ascending", required: false } - ] - } - } - }, - token: { - label: "Token Queries", - queries: { - getIdentitiesTokenBalances: { - label: "Get Identities Token Balances", - description: "Get token balances for multiple identities", - inputs: [ - { name: "identityIds", type: "array", label: "Identity IDs", required: true }, - { name: "tokenId", type: "text", label: "Token ID", required: true } - ] - }, - getIdentityTokenInfos: { - label: "Get Identity Token Infos", - description: "Get token information (frozen status) for specific tokens of an identity", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true }, - { name: "tokenIds", type: "array", label: "Token IDs", required: false }, - { name: "limit", type: "number", label: "Limit", required: false }, - { name: "offset", type: "number", label: "Offset", required: false } - ] - }, - getIdentitiesTokenInfos: { - label: "Get Identities Token Infos", - description: "Get token information (frozen status) for multiple identities", - inputs: [ - { name: "identityIds", type: "array", label: "Identity IDs", required: true }, - { name: "tokenId", type: "text", label: "Token ID", required: true } - ] - }, - getTokenStatuses: { - label: "Get Token Statuses", - description: "Get pause/unpause status for tokens", - inputs: [ - { name: "tokenIds", type: "array", label: "Token IDs", required: true } - ] - }, - getTokenDirectPurchasePrices: { - label: "Get Token Direct Purchase Prices", - description: "Get direct purchase prices for tokens", - inputs: [ - { name: "tokenIds", type: "array", label: "Token IDs", required: true } - ] - }, - getTokenContractInfo: { - label: "Get Token Contract Info", - description: "Get contract information for a token", - inputs: [ - { name: "dataContractId", type: "text", label: "Token ID", required: true } - ] - }, - getTokenPerpetualDistributionLastClaim: { - label: "Get Token Perpetual Distribution Last Claim", - description: "Get last claim information for token perpetual distribution", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true }, - { name: "tokenId", type: "text", label: "Token ID", required: true } - ] - }, - getTokenTotalSupply: { - label: "Get Token Total Supply", - description: "Get total supply information for a token", - inputs: [ - { name: "tokenId", type: "text", label: "Token ID", required: true } - ] - } - } - }, - group: { - label: "Group Queries", - queries: { - getGroupInfo: { - label: "Get Group Info", - description: "Get information about a specific group", - inputs: [ - { name: "contractId", type: "text", label: "Contract ID", required: true }, - { name: "groupContractPosition", type: "number", label: "Group Contract Position", required: true } - ] - }, - getGroupInfos: { - label: "Get Group Infos", - description: "Get information about multiple groups", - inputs: [ - { name: "contractId", type: "text", label: "Contract ID", required: true }, - { name: "startAtGroupContractPosition", type: "number", label: "Start at Position", required: false }, - { name: "startGroupContractPositionIncluded", type: "checkbox", label: "Include Start Position", required: false }, - { name: "count", type: "number", label: "Count", required: false } - ] - }, - getGroupActions: { - label: "Get Group Actions", - description: "Get actions for a specific group", - inputs: [ - { name: "contractId", type: "text", label: "Contract ID", required: true }, - { name: "groupContractPosition", type: "number", label: "Group Contract Position", required: true }, - { name: "status", type: "select", label: "Status", required: true, options: [ - { value: "ACTIVE", label: "Active" }, - { value: "CLOSED", label: "Closed" } - ]}, - { name: "startActionId", type: "text", label: "Start Action ID", required: false }, - { name: "startActionIdIncluded", type: "checkbox", label: "Include Start Action", required: false }, - { name: "count", type: "number", label: "Count", required: false } - ] - }, - getGroupActionSigners: { - label: "Get Group Action Signers", - description: "Get signers for a specific group action", - inputs: [ - { name: "contractId", type: "text", label: "Contract ID", required: true }, - { name: "groupContractPosition", type: "number", label: "Group Contract Position", required: true }, - { name: "status", type: "select", label: "Status", required: true, options: [ - { value: "ACTIVE", label: "Active" }, - { value: "CLOSED", label: "Closed" } - ]}, - { name: "actionId", type: "text", label: "Action ID", required: true } - ] - } - } - }, - system: { - label: "System & Utility", - queries: { - getStatus: { - label: "Get Status", - description: "Get node and network status information", - inputs: [] - }, - getCurrentQuorumsInfo: { - label: "Get Current Quorums Info", - description: "Get information about current quorums", - inputs: [] - }, - getPrefundedSpecializedBalance: { - label: "Get Prefunded Specialized Balance", - description: "Get prefunded balance for specialized transactions", - inputs: [ - { name: "identityId", type: "text", label: "Identity ID", required: true } - ] - }, - getTotalCreditsInPlatform: { - label: "Get Total Credits in Platform", - description: "Get the total amount of credits in the platform", - inputs: [] - }, - getPathElements: { - label: "Get Path Elements", - description: "Get elements at specific paths in the state tree", - inputs: [ - { name: "keys", type: "array", label: "Keys (hex strings)", required: true } - ] - }, - waitForStateTransitionResult: { - label: "Wait for State Transition Result", - description: "Wait for a state transition to be processed", - inputs: [ - { name: "stateTransitionHash", type: "text", label: "State Transition Hash", required: true } - ] - } - } - } - }; - // Helper functions for result actions window.clearResults = function() { const resultContent = document.getElementById('identityInfo'); @@ -3747,9 +2881,9 @@

Results

return; } - const queryDef = queryDefinitions[category].queries[queryType]; + const queryDef = queryDefinitions[category]?.queries?.[queryType]; if (!queryDef) { - alert('Invalid query selection'); + alert('Invalid query selection or definitions not loaded'); return; } @@ -5749,7 +4883,7 @@

Results

executeButton.style.display = 'none'; queryDescription.style.display = 'none'; - if (operationType === 'queries' && category && queryDefinitions[category]) { + if (operationType === 'queries' && category && queryDefinitions[category] && queryDefinitions[category].queries) { // Populate query types Object.entries(queryDefinitions[category].queries).forEach(([key, query]) => { const option = document.createElement('option'); @@ -5757,7 +4891,7 @@

Results

option.textContent = query.label; queryTypeSelect.appendChild(option); }); - } else if (operationType === 'transitions' && category && stateTransitionDefinitions[category]) { + } else if (operationType === 'transitions' && category && stateTransitionDefinitions[category] && stateTransitionDefinitions[category].transitions) { // Populate transition types Object.entries(stateTransitionDefinitions[category].transitions).forEach(([key, transition]) => { const option = document.createElement('option'); @@ -6552,13 +5686,41 @@

Results

if (preloaderText && text) preloaderText.textContent = text; } + // Initialize UI after API definitions are loaded + function initializeUI() { + console.log('Initializing UI with loaded API definitions'); + console.log(`Available: ${Object.keys(queryDefinitions).length} query categories, ${Object.keys(stateTransitionDefinitions).length} transition categories`); + + // Initialize with queries selected to populate dropdowns + document.getElementById('operationType').dispatchEvent(new Event('change')); + console.log('UI initialization complete'); + } + // Initialize async function run() { try { - updateStatus('Loading WASM module...', 'loading'); + // Load API definitions FIRST (before any UI elements are shown) + updateStatus('Loading API definitions...', 'loading'); + try { + await loadApiDefinitions(); + console.log('API definitions loaded successfully'); + } catch (error) { + console.error('Failed to load API definitions:', error); + updateStatus('Failed to load API definitions', 'error'); + return; + } + + // Now show the preloader and start WASM initialization + updateStatus('Initializing SDK...', 'loading'); const preloader = document.getElementById('preloader'); preloader.style.display = 'block'; + // Initialize UI after API definitions are loaded + updateProgress(2, 'Initializing UI...'); + initializeUI(); + + updateStatus('Loading WASM module...', 'loading'); + // Start with initial progress updateProgress(5, 'Downloading WASM module...'); @@ -6658,9 +5820,6 @@

Results

} run(); - - // Initialize with queries selected - document.getElementById('operationType').dispatchEvent(new Event('change')); From 30501f5b69fca75baecfb8bf41ded081bd2f10aa Mon Sep 17 00:00:00 2001 From: thephez Date: Wed, 13 Aug 2025 12:07:00 -0400 Subject: [PATCH 02/17] chore: update api-def --- packages/wasm-sdk/api-definitions.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/wasm-sdk/api-definitions.json b/packages/wasm-sdk/api-definitions.json index 1e2d0d7b03..60fa8fb9aa 100644 --- a/packages/wasm-sdk/api-definitions.json +++ b/packages/wasm-sdk/api-definitions.json @@ -1,7 +1,7 @@ { - "version": "1.0.1", - "generated_at": "2025-08-13T11:30:00.000000", - "source": "Curated definitions from fixed_definitions.json (fixed missing dpnsSearch)", + "version": "1.0.2", + "generated_at": "2025-08-13T11:45:00.000000", + "source": "Restored getIdentitiesContractKeys purposes field", "queries": { "identity": { "label": "Identity Queries", From ff25532c56abc5b57e95a426ace90515d3d4c3d8 Mon Sep 17 00:00:00 2001 From: thephez Date: Wed, 13 Aug 2025 13:12:46 -0400 Subject: [PATCH 03/17] fix: correct api-definition migration discrepancies --- packages/wasm-sdk/api-definitions.json | 38 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/packages/wasm-sdk/api-definitions.json b/packages/wasm-sdk/api-definitions.json index 60fa8fb9aa..a90bbb5893 100644 --- a/packages/wasm-sdk/api-definitions.json +++ b/packages/wasm-sdk/api-definitions.json @@ -1,7 +1,7 @@ { - "version": "1.0.2", - "generated_at": "2025-08-13T11:45:00.000000", - "source": "Restored getIdentitiesContractKeys purposes field", + "version": "1.0.3", + "generated_at": "2025-08-13T17:10:00.000000", + "source": "index.html", "queries": { "identity": { "label": "Identity Queries", @@ -163,7 +163,7 @@ "description": "Get balances for multiple identities", "inputs": [ { - "name": "identityIds", + "name": "ids", "type": "array", "label": "Identity IDs", "required": true @@ -603,7 +603,7 @@ "description": "Get voters who voted for a specific identity in a contested resource", "inputs": [ { - "name": "contractId", + "name": "dataContractId", "type": "text", "label": "Contract ID", "required": true @@ -820,17 +820,29 @@ "description": "Get proposed blocks by range", "inputs": [ { - "name": "startProTxHash", - "type": "text", - "label": "Start ProTx Hash", - "required": true, - "placeholder": "143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113" + "name": "epoch", + "type": "number", + "label": "Epoch", + "required": true }, { - "name": "count", + "name": "limit", "type": "number", - "label": "Count", - "required": true + "label": "Limit", + "required": false + }, + { + "name": "startAfter", + "type": "text", + "label": "Start After (Evonode ID)", + "required": false, + "placeholder": "143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113" + }, + { + "name": "orderAscending", + "type": "checkbox", + "label": "Order Ascending", + "required": false } ] } From ed53b4e569362ed46db341d208c1174e08f78018 Mon Sep 17 00:00:00 2001 From: thephez Date: Wed, 13 Aug 2025 16:33:14 -0400 Subject: [PATCH 04/17] feat: switch generate_docs.py and check_documentation.py to use api-definitions.json --- packages/wasm-sdk/check_documentation.py | 54 +++--- packages/wasm-sdk/generate_docs.py | 222 ++--------------------- 2 files changed, 43 insertions(+), 233 deletions(-) diff --git a/packages/wasm-sdk/check_documentation.py b/packages/wasm-sdk/check_documentation.py index d3c4ccc07b..34321d566b 100755 --- a/packages/wasm-sdk/check_documentation.py +++ b/packages/wasm-sdk/check_documentation.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Check that all queries and state transitions in index.html are documented +Check that all queries and state transitions in api-definitions.json are documented """ import os @@ -10,12 +10,12 @@ from datetime import datetime def check_documentation_completeness(): - """Check if documentation is up to date with index.html""" + """Check if documentation is up to date with api-definitions.json""" script_dir = Path(__file__).parent # Required files - index_file = script_dir / 'index.html' + api_definitions_file = script_dir / 'api-definitions.json' manifest_file = script_dir / 'docs_manifest.json' docs_file = script_dir / 'docs.html' ai_ref_file = script_dir / 'AI_REFERENCE.md' @@ -24,8 +24,8 @@ def check_documentation_completeness(): warnings = [] # Check if all required files exist - if not index_file.exists(): - errors.append(f"ERROR: index.html not found at {index_file}") + if not api_definitions_file.exists(): + errors.append(f"ERROR: api-definitions.json not found at {api_definitions_file}") return errors, warnings if not manifest_file.exists(): @@ -38,23 +38,19 @@ def check_documentation_completeness(): if not ai_ref_file.exists(): errors.append(f"ERROR: AI reference not found at {ai_ref_file}. Run generate_docs.py first.") - # Extract current definitions from index.html - print("Extracting definitions from index.html...") - import subprocess - result = subprocess.run(['python3', 'extract_definitions.py'], cwd=script_dir, capture_output=True, text=True) - if result.returncode != 0: - errors.append(f"ERROR: Failed to extract definitions: {result.stderr}") + # Load current definitions from api-definitions.json + print("Loading definitions from api-definitions.json...") + try: + with open(api_definitions_file, 'r') as f: + api_data = json.load(f) + current_defs = { + 'queries': api_data.get('queries', {}), + 'transitions': api_data.get('transitions', {}) + } + except (FileNotFoundError, json.JSONDecodeError) as e: + errors.append(f"ERROR: Failed to load api-definitions.json: {e}") return errors, warnings - # Load extracted definitions - extracted_file = script_dir / 'extracted_definitions.json' - if not extracted_file.exists(): - errors.append("ERROR: Could not find extracted definitions") - return errors, warnings - - with open(extracted_file, 'r') as f: - current_defs = json.load(f) - # Load documentation manifest with open(manifest_file, 'r') as f: manifest = json.load(f) @@ -72,15 +68,11 @@ def check_documentation_completeness(): for cat_key, category in current_defs.get('queries', {}).items(): for query_key in category.get('queries', {}).keys(): - # Skip invalid entries - if query_key not in ['dependsOn', 'offset', 'limit']: - current_queries.add(query_key) + current_queries.add(query_key) for cat_key, category in current_defs.get('transitions', {}).items(): for trans_key in category.get('transitions', {}).keys(): - # Skip invalid entries - if trans_key not in ['dependsOn']: - current_transitions.add(trans_key) + current_transitions.add(trans_key) documented_queries = set(manifest.get('queries', {}).keys()) documented_transitions = set(manifest.get('transitions', {}).keys()) @@ -115,17 +107,17 @@ def check_documentation_completeness(): warnings.append(f" - {t}") # Check file timestamps - index_mtime = os.path.getmtime(index_file) + api_definitions_mtime = os.path.getmtime(api_definitions_file) if docs_file.exists(): docs_mtime = os.path.getmtime(docs_file) - if index_mtime > docs_mtime: - warnings.append("WARNING: index.html has been modified after docs.html was generated") + if api_definitions_mtime > docs_mtime: + warnings.append("WARNING: api-definitions.json has been modified after docs.html was generated") if ai_ref_file.exists(): ai_mtime = os.path.getmtime(ai_ref_file) - if index_mtime > ai_mtime: - warnings.append("WARNING: index.html has been modified after AI_REFERENCE.md was generated") + if api_definitions_mtime > ai_mtime: + warnings.append("WARNING: api-definitions.json has been modified after AI_REFERENCE.md was generated") return errors, warnings diff --git a/packages/wasm-sdk/generate_docs.py b/packages/wasm-sdk/generate_docs.py index 18ec5ae5b7..25bce6b28f 100755 --- a/packages/wasm-sdk/generate_docs.py +++ b/packages/wasm-sdk/generate_docs.py @@ -1,124 +1,29 @@ #!/usr/bin/env python3 """ Documentation generator for WASM JS SDK -Extracts query and state transition definitions from index.html +Reads query and state transition definitions from api-definitions.json and generates both user documentation (HTML) and AI reference (Markdown) """ -import os -import re import json import html as html_lib -import html from pathlib import Path from datetime import datetime -def extract_definitions_from_html(html_content): - """Extract query and state transition definitions from index.html""" - - # Extract queryDefinitions - query_match = re.search(r'const queryDefinitions = ({[\s\S]*?});(?=\s*(?:const|//|$))', html_content) - query_definitions = {} - if query_match: - # Clean up the JavaScript object to make it JSON-parseable - query_str = query_match.group(1) - # Convert JS object to JSON format - query_str = re.sub(r'(\w+):', r'"\1":', query_str) # Add quotes to keys - query_str = re.sub(r',\s*}', '}', query_str) # Remove trailing commas - query_str = re.sub(r',\s*]', ']', query_str) # Remove trailing commas in arrays - # Handle functions and complex values - query_str = re.sub(r'dependsOn:\s*{[^}]+}', '"dependsOn": {}', query_str) - query_str = re.sub(r'action:\s*"[^"]*"', '"action": ""', query_str) - query_str = re.sub(r'dynamic:\s*true', '"dynamic": true', query_str) - query_str = re.sub(r'defaultValue:\s*true', '"defaultValue": true', query_str) - query_str = re.sub(r'validateOnType:\s*true', '"validateOnType": true', query_str) - - try: - query_definitions = json.loads(query_str) - except json.JSONDecodeError as e: - print(f"Warning: Could not parse query definitions: {e}") - # Fallback to regex extraction - query_definitions = extract_definitions_regex(html_content, 'queryDefinitions') - - # Extract stateTransitionDefinitions - transition_match = re.search(r'const stateTransitionDefinitions = ({[\s\S]*?});(?=\s*(?:const|//|$))', html_content) - transition_definitions = {} - if transition_match: - trans_str = transition_match.group(1) - trans_str = re.sub(r'(\w+):', r'"\1":', trans_str) - trans_str = re.sub(r',\s*}', '}', trans_str) - trans_str = re.sub(r',\s*]', ']', trans_str) - trans_str = re.sub(r'dependsOn:\s*{[^}]+}', '"dependsOn": {}', trans_str) - trans_str = re.sub(r'action:\s*"[^"]*"', '"action": ""', trans_str) - trans_str = re.sub(r'dynamic:\s*true', '"dynamic": true', trans_str) - trans_str = re.sub(r'defaultValue:\s*true', '"defaultValue": true', trans_str) - trans_str = re.sub(r'validateOnType:\s*true', '"validateOnType": true', trans_str) - - try: - transition_definitions = json.loads(trans_str) - except json.JSONDecodeError as e: - print(f"Warning: Could not parse transition definitions: {e}") - transition_definitions = extract_definitions_regex(html_content, 'stateTransitionDefinitions') - - return query_definitions, transition_definitions - -def extract_definitions_regex(html_content, definition_name): - """Robust regex extraction method for JavaScript object definitions""" - definitions = {} - - # Find the complete definition block - pattern = rf'const {definition_name} = (\{{(?:[^{{}}]|{{[^{{}}]*}})*\}});' - match = re.search(pattern, html_content, re.DOTALL) - if not match: - return definitions - - full_def = match.group(1) - - # Extract each category - cat_pattern = r'(\w+):\s*\{[^}]*label:\s*"([^"]+)"[^}]*(?:queries|transitions):\s*\{([^}]+(?:\{[^}]*\}[^}]*)*)\}' - - for cat_match in re.finditer(cat_pattern, full_def, re.DOTALL): - cat_key = cat_match.group(1) - cat_label = cat_match.group(2) - items_block = cat_match.group(3) +def load_api_definitions(api_definitions_file): + """Load query and state transition definitions from api-definitions.json""" + try: + with open(api_definitions_file, 'r', encoding='utf-8') as f: + api_data = json.load(f) - items_key = 'queries' if 'query' in definition_name else 'transitions' - definitions[cat_key] = { - 'label': cat_label, - items_key: {} - } + query_definitions = api_data.get('queries', {}) + transition_definitions = api_data.get('transitions', {}) - # Extract individual queries/transitions - item_pattern = r'(\w+):\s*\{([^}]+(?:\{[^}]*\}[^}]*)*)\}' + return query_definitions, transition_definitions - for item_match in re.finditer(item_pattern, items_block): - item_key = item_match.group(1) - item_content = item_match.group(2) - - # Extract item details - item_data = {} - - # Extract label - label_match = re.search(r'label:\s*"([^"]+)"', item_content) - if label_match: - item_data['label'] = label_match.group(1) - - # Extract description - desc_match = re.search(r'description:\s*"([^"]+)"', item_content) - if desc_match: - item_data['description'] = desc_match.group(1) - - # Extract inputs array - inputs_match = re.search(r'inputs:\s*\[([^\]]+(?:\[[^\]]*\][^\]]*)*)\]', item_content, re.DOTALL) - if inputs_match: - inputs_str = inputs_match.group(1) - item_data['inputs'] = extract_inputs(inputs_str) - else: - item_data['inputs'] = [] - - definitions[cat_key][items_key][item_key] = item_data - - return definitions + except (FileNotFoundError, json.JSONDecodeError) as e: + print(f"Error loading API definitions: {e}") + return {}, {} def generate_example_code(query_key, inputs): """Generate example code for a query""" @@ -290,60 +195,6 @@ def generate_example_code(query_key, inputs): # Generate the function call (functions are imported directly, not methods on sdk) return f'return await window.wasmFunctions.{func_name}({", ".join(all_params)});' -def extract_inputs(inputs_str): - """Extract input definitions from JavaScript array string""" - inputs = [] - - # Match individual input objects - input_pattern = r'\{([^}]+(?:\{[^}]*\}[^}]*)*)\}' - - for match in re.finditer(input_pattern, inputs_str): - input_content = match.group(1) - input_data = {} - - # Extract name - name_match = re.search(r'name:\s*"([^"]+)"', input_content) - if name_match: - input_data['name'] = name_match.group(1) - - # Extract type - type_match = re.search(r'type:\s*"([^"]+)"', input_content) - if type_match: - input_data['type'] = type_match.group(1) - - # Extract label - label_match = re.search(r'label:\s*"([^"]+)"', input_content) - if label_match: - input_data['label'] = label_match.group(1) - - # Extract required - req_match = re.search(r'required:\s*(true|false)', input_content) - if req_match: - input_data['required'] = req_match.group(1) == 'true' - - # Extract placeholder - placeholder_match = re.search(r'placeholder:\s*["\']([^"\']+)["\']', input_content) - if placeholder_match: - input_data['placeholder'] = placeholder_match.group(1) - - # Extract options if present - options_match = re.search(r'options:\s*\[([^\]]+)\]', input_content) - if options_match: - options_str = options_match.group(1) - input_data['options'] = [] - - # Extract each option - opt_pattern = r'\{\s*value:\s*"([^"]+)"[^}]*label:\s*"([^"]+)"[^}]*\}' - for opt_match in re.finditer(opt_pattern, options_str): - input_data['options'].append({ - 'value': opt_match.group(1), - 'label': opt_match.group(2) - }) - - if input_data: - inputs.append(input_data) - - return inputs def generate_sidebar_entries(definitions, type_prefix, section_class=""): """Generate sidebar entries for queries or transitions""" @@ -1925,51 +1776,18 @@ def main(): # Get paths script_dir = Path(__file__).parent - index_file = script_dir / 'index.html' - if not index_file.exists(): - print(f"Error: index.html not found at {index_file}") - return 1 + # Load API definitions from api-definitions.json + api_definitions_file = script_dir / 'api-definitions.json' - # First check if we have manually fixed definitions - fixed_file = script_dir / 'fixed_definitions.json' - extracted_file = script_dir / 'extracted_definitions.json' - - if fixed_file.exists(): - print("Using manually fixed definitions...") - definitions_file = fixed_file - else: - # Extract definitions using the extraction script - print("Extracting definitions from index.html...") - import subprocess - result = subprocess.run(['python3', 'extract_definitions.py'], cwd=script_dir, capture_output=True, text=True) - if result.returncode != 0: - print(f"Error extracting definitions: {result.stderr}") - return 1 - - if not extracted_file.exists(): - print("Error: Could not find extracted definitions") - return 1 - definitions_file = extracted_file - - with open(definitions_file, 'r') as f: - extracted = json.load(f) - - query_defs = extracted.get('queries', {}) - transition_defs = extracted.get('transitions', {}) + if not api_definitions_file.exists(): + print(f"Error: api-definitions.json not found at {api_definitions_file}") + return 1 - # Clean up the extracted data (remove invalid entries like 'dependsOn') - for cat_key, category in list(query_defs.items()): - queries = category.get('queries', {}) - for q_key in list(queries.keys()): - if q_key in ['dependsOn', 'offset', 'limit'] or not queries[q_key].get('label'): - del queries[q_key] + print("Loading API definitions from api-definitions.json...") + query_defs, transition_defs = load_api_definitions(api_definitions_file) - for cat_key, category in list(transition_defs.items()): - transitions = category.get('transitions', {}) - for t_key in list(transitions.keys()): - if t_key in ['dependsOn'] or not transitions[t_key].get('label'): - del transitions[t_key] + # API definitions are already clean from JSON source - no cleanup needed print(f"Found {sum(len(cat.get('queries', {})) for cat in query_defs.values())} queries") print(f"Found {sum(len(cat.get('transitions', {})) for cat in transition_defs.values())} state transitions") From c06b35be0dd378a28cfa83eda7b76dd3731b3d0b Mon Sep 17 00:00:00 2001 From: thephez Date: Wed, 13 Aug 2025 17:05:26 -0400 Subject: [PATCH 05/17] chore: remove no longer used files --- packages/wasm-sdk/extract_definitions.py | 302 --- packages/wasm-sdk/extract_inputs.py | 124 - packages/wasm-sdk/fixed_definitions.json | 2019 ----------------- packages/wasm-sdk/save_fixed_definitions.py | 182 -- packages/wasm-sdk/update_inputs.py | 216 -- packages/wasm-sdk/update_state_transitions.py | 179 -- 6 files changed, 3022 deletions(-) delete mode 100644 packages/wasm-sdk/extract_definitions.py delete mode 100755 packages/wasm-sdk/extract_inputs.py delete mode 100644 packages/wasm-sdk/fixed_definitions.json delete mode 100644 packages/wasm-sdk/save_fixed_definitions.py delete mode 100644 packages/wasm-sdk/update_inputs.py delete mode 100644 packages/wasm-sdk/update_state_transitions.py diff --git a/packages/wasm-sdk/extract_definitions.py b/packages/wasm-sdk/extract_definitions.py deleted file mode 100644 index 1afd42374e..0000000000 --- a/packages/wasm-sdk/extract_definitions.py +++ /dev/null @@ -1,302 +0,0 @@ -#!/usr/bin/env python3 -""" -Extract query and state transition definitions from index.html -""" - -import json -import re -from pathlib import Path - -def manual_extract_definitions(html_file): - """Manually extract definitions using targeted patterns""" - - with open(html_file, 'r', encoding='utf-8') as f: - content = f.read() - - # Extract the complete queryDefinitions block - query_start = content.find('const queryDefinitions = {') - if query_start == -1: - return {}, {} - - # Find the end by counting braces - brace_count = 0 - pos = query_start + len('const queryDefinitions = ') - query_end = pos - - for i, char in enumerate(content[pos:], pos): - if char == '{': - brace_count += 1 - elif char == '}': - brace_count -= 1 - if brace_count == 0: - query_end = i + 1 - break - - query_block = content[pos:query_end] - - # Extract state transition definitions - trans_start = content.find('const stateTransitionDefinitions = {') - if trans_start == -1: - return {}, {} - - brace_count = 0 - pos = trans_start + len('const stateTransitionDefinitions = ') - trans_end = pos - - for i, char in enumerate(content[pos:], pos): - if char == '{': - brace_count += 1 - elif char == '}': - brace_count -= 1 - if brace_count == 0: - trans_end = i + 1 - break - - trans_block = content[pos:trans_end] - - # Parse definitions - query_defs = parse_definition_block(query_block, 'queries') - trans_defs = parse_definition_block(trans_block, 'transitions') - - return query_defs, trans_defs - -def parse_definition_block(block, item_type): - """Parse a definition block into structured data""" - definitions = {} - - # First, find all category blocks with the pattern: categoryName: { label: "...", queries/transitions: { ... } } - # We need to match the full category structure, not just anything with a label - cat_pattern = r'(\w+):\s*\{\s*label:\s*"([^"]+)"[^}]*' + item_type + r':\s*\{' - - for match in re.finditer(cat_pattern, block): - cat_key = match.group(1) - cat_label = match.group(2) - - # Skip if this looks like it's inside another structure - # Check if the match is at the top level by ensuring no unclosed braces before it - prefix = block[:match.start()] - if prefix.count('{') - prefix.count('}') > 0: - continue - - # Find this category's content - cat_start = match.start() - - # Find the full category block by counting braces - brace_count = 0 - cat_end = cat_start - in_category = False - - for i, char in enumerate(block[cat_start:], cat_start): - if char == '{': - brace_count += 1 - in_category = True - elif char == '}': - brace_count -= 1 - if in_category and brace_count == 0: - cat_end = i + 1 - break - - cat_block = block[cat_start:cat_end] - - # Now extract just the queries/transitions section - items_pattern = rf'{item_type}:\s*\{{' - items_match = re.search(items_pattern, cat_block) - - if items_match: - items_start = items_match.end() - - # Find the end of the items section by counting braces - brace_count = 1 - items_end = items_start - - for i, char in enumerate(cat_block[items_start:], items_start): - if char == '{': - brace_count += 1 - elif char == '}': - brace_count -= 1 - if brace_count == 0: - items_end = i - break - - items_block = cat_block[items_start:items_end] - - # Extract individual items - definitions[cat_key] = { - 'label': cat_label, - item_type: parse_items(items_block) - } - - return definitions - -def parse_items(items_block): - """Parse individual query/transition items""" - items = {} - - # Find each item that has label and description structure - # This pattern ensures we only match actual query/transition definitions - item_pattern = r'(\w+):\s*\{\s*label:\s*"' - - matches = list(re.finditer(item_pattern, items_block)) - - for match in matches: - item_key = match.group(1) - item_start = match.start() - - # Find the full item block by counting braces - brace_count = 0 - item_end = item_start - in_item = False - - for j, char in enumerate(items_block[item_start:], item_start): - if char == '{': - brace_count += 1 - in_item = True - elif char == '}': - brace_count -= 1 - if in_item and brace_count == 0: - item_end = j + 1 - break - - item_content = items_block[item_start + match.end() - match.start():item_end - 1] - - # Extract item details - item_data = {} - - # Extract label - label_match = re.search(r'label:\s*"([^"]+)"', item_content) - if label_match: - item_data['label'] = label_match.group(1) - - # Extract description - desc_match = re.search(r'description:\s*"([^"]+)"', item_content) - if desc_match: - item_data['description'] = desc_match.group(1) - - # Extract inputs - inputs_match = re.search(r'inputs:\s*\[', item_content) - if inputs_match: - inputs_start = inputs_match.end() - - # Find the end of inputs array - bracket_count = 1 - inputs_end = inputs_start - - for j, char in enumerate(item_content[inputs_start:], inputs_start): - if char == '[': - bracket_count += 1 - elif char == ']': - bracket_count -= 1 - if bracket_count == 0: - inputs_end = j - break - - inputs_content = item_content[inputs_start:inputs_end] - item_data['inputs'] = parse_inputs(inputs_content) - else: - item_data['inputs'] = [] - - items[item_key] = item_data - - return items - -def parse_inputs(inputs_content): - """Parse input array""" - inputs = [] - - # Find each input object - obj_starts = [m.start() for m in re.finditer(r'\{', inputs_content)] - - for start in obj_starts: - # Find the matching closing brace - brace_count = 1 - end = start + 1 - - for i, char in enumerate(inputs_content[start + 1:], start + 1): - if char == '{': - brace_count += 1 - elif char == '}': - brace_count -= 1 - if brace_count == 0: - end = i + 1 - break - - obj_content = inputs_content[start:end] - - # Parse this input object - input_data = {} - - # Extract fields - fields = { - 'name': r'name:\s*"([^"]+)"', - 'type': r'type:\s*"([^"]+)"', - 'label': r'label:\s*"([^"]+)"', - 'placeholder': r'placeholder:\s*["\']([^"\']+)["\']', - } - - for field, pattern in fields.items(): - match = re.search(pattern, obj_content) - if match: - input_data[field] = match.group(1) - - # Extract required - req_match = re.search(r'required:\s*(true|false)', obj_content) - if req_match: - input_data['required'] = req_match.group(1) == 'true' - - # Extract options if present - options_match = re.search(r'options:\s*\[', obj_content) - if options_match: - options_start = options_match.end() - bracket_count = 1 - options_end = options_start - - for i, char in enumerate(obj_content[options_start:], options_start): - if char == '[': - bracket_count += 1 - elif char == ']': - bracket_count -= 1 - if bracket_count == 0: - options_end = i - break - - options_content = obj_content[options_start:options_end] - input_data['options'] = [] - - # Extract each option - opt_pattern = r'\{\s*value:\s*"([^"]+)"[^}]*label:\s*"([^"]+)"[^}]*\}' - for opt_match in re.finditer(opt_pattern, options_content): - input_data['options'].append({ - 'value': opt_match.group(1), - 'label': opt_match.group(2) - }) - - if input_data: - inputs.append(input_data) - - return inputs - -def main(): - index_file = Path(__file__).parent / 'index.html' - - if not index_file.exists(): - print(f"Error: {index_file} not found") - return 1 - - query_defs, trans_defs = manual_extract_definitions(index_file) - - # Save to JSON for inspection - output = { - 'queries': query_defs, - 'transitions': trans_defs - } - - with open('extracted_definitions.json', 'w') as f: - json.dump(output, f, indent=2) - - print(f"Extracted {sum(len(cat.get('queries', {})) for cat in query_defs.values())} queries") - print(f"Extracted {sum(len(cat.get('transitions', {})) for cat in trans_defs.values())} transitions") - - return 0 - -if __name__ == '__main__': - exit(main()) \ No newline at end of file diff --git a/packages/wasm-sdk/extract_inputs.py b/packages/wasm-sdk/extract_inputs.py deleted file mode 100755 index 59f5b2e69d..0000000000 --- a/packages/wasm-sdk/extract_inputs.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python3 -""" -Extract input parameters from index.html and update fixed_definitions.json -""" - -import json -import re -from pathlib import Path - -def extract_inputs_from_html(): - """Extract input definitions from index.html""" - index_file = Path(__file__).parent / 'index.html' - - with open(index_file, 'r', encoding='utf-8') as f: - content = f.read() - - # Find the queryDefinitions and stateTransitionDefinitions objects - query_match = re.search(r'const queryDefinitions = ({[^;]+});', content, re.DOTALL) - trans_match = re.search(r'const stateTransitionDefinitions = ({[^;]+});', content, re.DOTALL) - - if not query_match or not trans_match: - print("Could not find definitions in index.html") - return {} - - # Extract the JavaScript objects - query_js = query_match.group(1) - trans_js = trans_match.group(1) - - # Parse inputs for each query/transition - inputs_map = {} - - # Process queries - for category_match in re.finditer(r'(\w+):\s*\{[^}]*queries:\s*\{([^}]+)\}', query_js, re.DOTALL): - category = category_match.group(1) - queries_block = category_match.group(2) - - for query_match in re.finditer(r'(\w+):\s*\{[^}]*inputs:\s*\[([^\]]*)\]', queries_block, re.DOTALL): - query_name = query_match.group(1) - inputs_str = query_match.group(2) - - # Parse inputs - inputs = [] - for input_match in re.finditer(r'\{([^}]+)\}', inputs_str): - input_str = input_match.group(1) - # Extract properties - name_match = re.search(r'name:\s*[\'"]([^\'\"]+)[\'"]', input_str) - type_match = re.search(r'type:\s*[\'"]([^\'\"]+)[\'"]', input_str) - label_match = re.search(r'label:\s*[\'"]([^\'\"]+)[\'"]', input_str) - required_match = re.search(r'required:\s*(true|false)', input_str) - - if name_match: - input_def = { - 'name': name_match.group(1), - 'type': type_match.group(1) if type_match else 'text', - 'label': label_match.group(1) if label_match else name_match.group(1), - 'required': required_match.group(1) == 'true' if required_match else True - } - inputs.append(input_def) - - inputs_map[f'query.{query_name}'] = inputs - - # Process transitions - for category_match in re.finditer(r'(\w+):\s*\{[^}]*transitions:\s*\{([^}]+)\}', trans_js, re.DOTALL): - category = category_match.group(1) - transitions_block = category_match.group(2) - - for trans_match in re.finditer(r'(\w+):\s*\{[^}]*inputs:\s*\[([^\]]*)\]', transitions_block, re.DOTALL): - trans_name = trans_match.group(1) - inputs_str = trans_match.group(2) - - # Parse inputs - inputs = [] - for input_match in re.finditer(r'\{([^}]+)\}', inputs_str): - input_str = input_match.group(1) - # Extract properties - name_match = re.search(r'name:\s*[\'"]([^\'\"]+)[\'"]', input_str) - type_match = re.search(r'type:\s*[\'"]([^\'\"]+)[\'"]', input_str) - label_match = re.search(r'label:\s*[\'"]([^\'\"]+)[\'"]', input_str) - required_match = re.search(r'required:\s*(true|false)', input_str) - - if name_match: - input_def = { - 'name': name_match.group(1), - 'type': type_match.group(1) if type_match else 'text', - 'label': label_match.group(1) if label_match else name_match.group(1), - 'required': required_match.group(1) == 'true' if required_match else True - } - inputs.append(input_def) - - inputs_map[f'transition.{trans_name}'] = inputs - - return inputs_map - -def update_fixed_definitions(): - """Update fixed_definitions.json with actual inputs""" - # Load current definitions - with open('fixed_definitions.json', 'r') as f: - definitions = json.load(f) - - # Get inputs from HTML - inputs_map = extract_inputs_from_html() - - # Update queries - for category in definitions['queries'].values(): - for query_key, query in category.get('queries', {}).items(): - map_key = f'query.{query_key}' - if map_key in inputs_map: - query['inputs'] = inputs_map[map_key] - - # Update transitions - for category in definitions['transitions'].values(): - for trans_key, trans in category.get('transitions', {}).items(): - map_key = f'transition.{trans_key}' - if map_key in inputs_map: - trans['inputs'] = inputs_map[map_key] - - # Save updated definitions - with open('fixed_definitions.json', 'w') as f: - json.dump(definitions, f, indent=2) - - print("Updated fixed_definitions.json with input parameters") - -if __name__ == '__main__': - update_fixed_definitions() \ No newline at end of file diff --git a/packages/wasm-sdk/fixed_definitions.json b/packages/wasm-sdk/fixed_definitions.json deleted file mode 100644 index 95507b0d31..0000000000 --- a/packages/wasm-sdk/fixed_definitions.json +++ /dev/null @@ -1,2019 +0,0 @@ -{ - "queries": { - "identity": { - "label": "Identity Queries", - "queries": { - "getIdentity": { - "label": "Get Identity", - "description": "Fetch an identity by its identifier", - "inputs": [ - { - "name": "id", - "type": "text", - "label": "Identity ID", - "required": true - } - ] - }, - "getIdentityKeys": { - "label": "Get Identity Keys", - "description": "Retrieve keys associated with an identity", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true - }, - { - "name": "keyRequestType", - "type": "select", - "label": "Key Request Type", - "required": false, - "options": [ - { - "value": "all", - "label": "All Keys (AllKeys {}) - Get all keys for the identity" - }, - { - "value": "specific", - "label": "Specific Keys (SpecificKeys with key_ids) - Get specific keys by ID [🚧 Work in Progress]" - }, - { - "value": "search", - "label": "Search Keys (SearchKey with purpose_map) - Search by purpose and security level [🚧 Work in Progress]" - } - ] - }, - { - "name": "specificKeyIds", - "type": "array", - "label": "Specific Key IDs (required for 'specific' type)", - "required": false, - "placeholder": "0,1,2" - }, - { - "name": "searchPurposeMap", - "type": "text", - "label": "Search Purpose Map JSON (required for 'search' type)", - "required": false, - "placeholder": "{\"0\": {\"0\": \"current\"}, \"1\": {\"0\": \"all\"}}" - } - ] - }, - "getIdentitiesContractKeys": { - "label": "Get Identities Contract Keys", - "description": "Get keys for multiple identities related to a specific contract", - "inputs": [ - { - "name": "identitiesIds", - "type": "array", - "label": "Identity IDs", - "required": true - }, - { - "name": "contractId", - "type": "text", - "label": "Contract ID", - "required": true - }, - { - "name": "documentTypeName", - "type": "text", - "label": "Document Type (optional)", - "required": false - }, - { - "name": "keyRequestType", - "type": "select", - "label": "Key Request Type", - "required": false - } - ] - }, - "getIdentityNonce": { - "label": "Get Identity Nonce", - "description": "Get the current nonce for an identity", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true - } - ] - }, - "getIdentityContractNonce": { - "label": "Get Identity Contract Nonce", - "description": "Get the nonce for an identity in relation to a specific contract", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true - }, - { - "name": "contractId", - "type": "text", - "label": "Contract ID", - "required": true - } - ] - }, - "getIdentityBalance": { - "label": "Get Identity Balance", - "description": "Get the credit balance of an identity", - "inputs": [ - { - "name": "id", - "type": "text", - "label": "Identity ID", - "required": true - } - ] - }, - "getIdentitiesBalances": { - "label": "Get Identities Balances", - "description": "Get balances for multiple identities", - "inputs": [ - { - "name": "identityIds", - "type": "array", - "label": "Identity IDs", - "required": true - } - ] - }, - "getIdentityBalanceAndRevision": { - "label": "Get Identity Balance and Revision", - "description": "Get both balance and revision number for an identity", - "inputs": [ - { - "name": "id", - "type": "text", - "label": "Identity ID", - "required": true - } - ] - }, - "getIdentityByPublicKeyHash": { - "label": "Get Identity by Unique Public Key Hash", - "description": "Find an identity by its unique public key hash", - "inputs": [ - { - "name": "publicKeyHash", - "type": "text", - "label": "Public Key Hash", - "required": true, - "placeholder": "b7e904ce25ed97594e72f7af0e66f298031c1754" - } - ] - }, - "getIdentityByNonUniquePublicKeyHash": { - "label": "Get Identity by Non-Unique Public Key Hash", - "description": "Find identities by non-unique public key hash", - "inputs": [ - { - "name": "publicKeyHash", - "type": "text", - "label": "Public Key Hash", - "required": true, - "placeholder": "518038dc858461bcee90478fd994bba8057b7531" - } - ] - }, - "getIdentityTokenBalances": { - "label": "Get Identity Token Balances", - "description": "Get token balances for an identity", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true - }, - { - "name": "tokenIds", - "type": "array", - "label": "Token IDs", - "required": true - } - ] - }, - "getIdentitiesTokenBalances": { - "label": "Get Identities Token Balances", - "description": "Get token balance for multiple identities", - "inputs": [ - { - "name": "identityIds", - "type": "array", - "label": "Identity IDs", - "required": true - }, - { - "name": "tokenId", - "type": "text", - "label": "Token ID", - "required": true, - "placeholder": "Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv" - } - ] - }, - "getIdentityTokenInfos": { - "label": "Get Identity Token Info", - "description": "Get token information for an identity's tokens", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true - }, - { - "name": "tokenIds", - "type": "array", - "label": "Token IDs (optional)", - "required": false, - "placeholder": "[\"Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv\"]" - } - ] - }, - "getIdentitiesTokenInfos": { - "label": "Get Identities Token Info", - "description": "Get token information for multiple identities with a specific token", - "inputs": [ - { - "name": "identityIds", - "type": "array", - "label": "Identity IDs", - "required": true - }, - { - "name": "tokenId", - "type": "text", - "label": "Token ID", - "required": true, - "placeholder": "Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv" - } - ] - } - } - }, - "dataContract": { - "label": "Data Contract Queries", - "queries": { - "getDataContract": { - "label": "Get Data Contract", - "description": "Fetch a data contract by its identifier", - "inputs": [ - { - "name": "id", - "type": "text", - "label": "Data Contract ID", - "required": true, - "placeholder": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec" - } - ] - }, - "getDataContractHistory": { - "label": "Get Data Contract History", - "description": "Get the version history of a data contract", - "inputs": [ - { - "name": "id", - "type": "text", - "label": "Data Contract ID", - "required": true, - "placeholder": "HLY575cNazmc5824FxqaEMEBuzFeE4a98GDRNKbyJqCM" - }, - { - "name": "limit", - "type": "number", - "label": "Limit", - "required": false - }, - { - "name": "offset", - "type": "number", - "label": "Offset", - "required": false - } - ] - }, - "getDataContracts": { - "label": "Get Data Contracts", - "description": "Fetch multiple data contracts by their identifiers", - "inputs": [ - { - "name": "ids", - "type": "array", - "label": "Data Contract IDs", - "required": true, - "placeholder": "[\"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec\", \"ALybvzfcCwMs7sinDwmtumw17NneuW7RgFtFHgjKmF3A\"]" - } - ] - } - } - }, - "document": { - "label": "Document Queries", - "queries": { - "getDocuments": { - "label": "Get Documents", - "description": "Query documents from a data contract", - "inputs": [ - { - "name": "dataContractId", - "type": "text", - "label": "Data Contract ID", - "required": true, - "placeholder": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec" - }, - { - "name": "documentType", - "type": "text", - "label": "Document Type", - "required": true, - "placeholder": "domain" - }, - { - "name": "whereClause", - "type": "text", - "label": "Where Clause (JSON)", - "required": false, - "placeholder": "[[\"normalizedParentDomainName\", \"==\", \"dash\"], [\"normalizedLabel\", \"==\", \"therea1s11mshaddy5\"]]" - }, - { - "name": "orderBy", - "type": "text", - "label": "Order By (JSON)", - "required": false, - "placeholder": "[[\"$createdAt\", \"desc\"]]" - }, - { - "name": "limit", - "type": "number", - "label": "Limit", - "required": false - } - ] - }, - "getDocument": { - "label": "Get Document", - "description": "Fetch a specific document by ID", - "inputs": [ - { - "name": "dataContractId", - "type": "text", - "label": "Data Contract ID", - "required": true, - "placeholder": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec" - }, - { - "name": "documentType", - "type": "text", - "label": "Document Type", - "required": true, - "placeholder": "domain" - }, - { - "name": "documentId", - "type": "text", - "label": "Document ID", - "required": true, - "placeholder": "7NYmEKQsYtniQRUmxwdPGeVcirMoPh5ZPyAKz8BWFy3r" - } - ] - } - } - }, - "dpns": { - "label": "DPNS Queries", - "queries": { - "getDpnsUsername": { - "label": "Get DPNS Usernames", - "description": "Get DPNS usernames for an identity", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true - } - ] - }, - "dpnsCheckAvailability": { - "label": "DPNS Check Availability", - "description": "Check if a DPNS username is available", - "inputs": [ - { - "name": "label", - "type": "text", - "label": "Label (Username)", - "required": true - } - ] - }, - "dpnsResolve": { - "label": "DPNS Resolve Name", - "description": "Resolve a DPNS name to an identity ID", - "inputs": [ - { - "name": "name", - "type": "text", - "label": "Name", - "required": true - } - ] - } - } - }, - "voting": { - "label": "Voting & Contested Resources", - "queries": { - "getContestedResources": { - "label": "Get Contested Resources", - "description": "Get list of contested resources", - "inputs": [ - { - "name": "documentTypeName", - "type": "text", - "label": "Document Type", - "required": true - }, - { - "name": "dataContractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "indexName", - "type": "text", - "label": "Index Name", - "required": true - }, - { - "name": "resultType", - "type": "text", - "label": "Result Type", - "required": true - }, - { - "name": "allowIncludeLockedAndAbstainingVoteTally", - "type": "checkbox", - "label": "Allow Include Locked and Abstaining Vote Tally", - "required": false - }, - { - "name": "startAtValue", - "type": "text", - "label": "Start At Value", - "required": false - }, - { - "name": "limit", - "type": "number", - "label": "Limit", - "required": false - }, - { - "name": "offset", - "type": "number", - "label": "Offset", - "required": false - }, - { - "name": "orderAscending", - "type": "checkbox", - "label": "Order Ascending", - "required": false - } - ] - }, - "getContestedResourceVoteState": { - "label": "Get Contested Resource Vote State", - "description": "Get the current vote state for a contested resource", - "inputs": [ - { - "name": "dataContractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "documentTypeName", - "type": "text", - "label": "Document Type", - "required": true - }, - { - "name": "indexName", - "type": "text", - "label": "Index Name", - "required": true - }, - { - "name": "indexValues", - "type": "array", - "label": "Index Values", - "required": true, - "placeholder": "[\"dash\", \"alice\"]" - }, - { - "name": "resultType", - "type": "text", - "label": "Result Type", - "required": true - }, - { - "name": "allowIncludeLockedAndAbstainingVoteTally", - "type": "checkbox", - "label": "Allow Include Locked and Abstaining Vote Tally", - "required": false - }, - { - "name": "startAtIdentifierInfo", - "type": "text", - "label": "Start At Identifier Info", - "required": false - }, - { - "name": "count", - "type": "number", - "label": "Count", - "required": false - }, - { - "name": "orderAscending", - "type": "checkbox", - "label": "Order Ascending", - "required": false - } - ] - }, - "getContestedResourceVotersForIdentity": { - "label": "Get Contested Resource Voters for Identity", - "description": "Get voters who voted for a specific identity in a contested resource", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Contract ID", - "required": true - }, - { - "name": "documentTypeName", - "type": "text", - "label": "Document Type", - "required": true - }, - { - "name": "indexName", - "type": "text", - "label": "Index Name", - "required": true - }, - { - "name": "indexValues", - "type": "array", - "label": "Index Values", - "required": true, - "placeholder": "[\"dash\", \"alice\"]" - }, - { - "name": "contestantId", - "type": "text", - "label": "Contestant Identity ID", - "required": true - }, - { - "name": "startAtVoterInfo", - "type": "text", - "label": "Start At Voter Info", - "required": false - }, - { - "name": "limit", - "type": "number", - "label": "Limit", - "required": false - }, - { - "name": "orderAscending", - "type": "checkbox", - "label": "Order Ascending", - "required": false - } - ] - }, - "getContestedResourceIdentityVotes": { - "label": "Get Contested Resource Identity Votes", - "description": "Get all votes cast by a specific identity", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true - }, - { - "name": "limit", - "type": "number", - "label": "Limit", - "required": false - }, - { - "name": "startAtVotePollIdInfo", - "type": "text", - "label": "Start At Vote Poll ID Info", - "required": false - }, - { - "name": "orderAscending", - "type": "checkbox", - "label": "Order Ascending", - "required": false - } - ] - }, - "getVotePollsByEndDate": { - "label": "Get Vote Polls by End Date", - "description": "Get vote polls within a time range", - "inputs": [ - { - "name": "startTimeInfo", - "type": "text", - "label": "Start Time Info", - "required": false, - "placeholder": "Timestamp in milliseconds as string" - }, - { - "name": "endTimeInfo", - "type": "text", - "label": "End Time Info", - "required": false, - "placeholder": "Timestamp in milliseconds as string" - }, - { - "name": "limit", - "type": "number", - "label": "Limit", - "required": false - }, - { - "name": "orderAscending", - "type": "checkbox", - "label": "Order Ascending", - "required": false - } - ] - } - } - }, - "protocol": { - "label": "Protocol & Version", - "queries": { - "getProtocolVersionUpgradeState": { - "label": "Get Protocol Version Upgrade State", - "description": "Get the current state of protocol version upgrades", - "inputs": [] - }, - "getProtocolVersionUpgradeVoteStatus": { - "label": "Get Protocol Version Upgrade Vote Status", - "description": "Get voting status for protocol version upgrades", - "inputs": [ - { - "name": "startProTxHash", - "type": "text", - "label": "Start ProTx Hash", - "required": true, - "placeholder": "143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113" - }, - { - "name": "count", - "type": "number", - "label": "Count", - "required": true - } - ] - } - } - }, - "epoch": { - "label": "Epoch & Block", - "queries": { - "getEpochsInfo": { - "label": "Get Epochs Info", - "description": "Get information about epochs", - "inputs": [ - { - "name": "epoch", - "type": "number", - "label": "Start Epoch", - "required": true - }, - { - "name": "count", - "type": "number", - "label": "Count", - "required": true - }, - { - "name": "ascending", - "type": "checkbox", - "label": "Ascending Order", - "required": false - } - ] - }, - "getCurrentEpoch": { - "label": "Get Current Epoch", - "description": "Get information about the current epoch", - "inputs": [] - }, - "getFinalizedEpochInfos": { - "label": "Get Finalized Epoch Info", - "description": "Get information about finalized epochs", - "inputs": [ - { - "name": "startEpoch", - "type": "number", - "label": "Start Epoch", - "required": true - }, - { - "name": "count", - "type": "number", - "label": "Count", - "required": true - } - ] - }, - "getEvonodesProposedEpochBlocksByIds": { - "label": "Get Evonodes Proposed Epoch Blocks by IDs", - "description": "Get proposed blocks by evonode IDs", - "inputs": [ - { - "name": "epoch", - "type": "number", - "label": "Epoch", - "required": true - }, - { - "name": "ids", - "type": "array", - "label": "ProTx Hashes", - "required": true, - "placeholder": "[\"143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113\"]" - } - ] - }, - "getEvonodesProposedEpochBlocksByRange": { - "label": "Get Evonodes Proposed Epoch Blocks by Range", - "description": "Get proposed blocks by range", - "inputs": [ - { - "name": "startProTxHash", - "type": "text", - "label": "Start ProTx Hash", - "required": true, - "placeholder": "143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113" - }, - { - "name": "count", - "type": "number", - "label": "Count", - "required": true - } - ] - } - } - }, - "token": { - "label": "Token Queries", - "queries": { - "getTokenStatuses": { - "label": "Get Token Statuses", - "description": "Get token statuses", - "inputs": [ - { - "name": "tokenIds", - "type": "array", - "label": "Token IDs", - "required": true - } - ] - }, - "getTokenDirectPurchasePrices": { - "label": "Get Token Direct Purchase Prices", - "description": "Get direct purchase prices for tokens", - "inputs": [ - { - "name": "tokenIds", - "type": "array", - "label": "Token IDs", - "required": true - } - ] - }, - "getTokenContractInfo": { - "label": "Get Token Contract Info", - "description": "Get information about a token contract", - "inputs": [ - { - "name": "dataContractId", - "type": "text", - "label": "Data Contract ID", - "required": true, - "placeholder": "EETVvWgohFDKtbB3ejEzBcDRMNYkc9TtgXY6y8hzP3Ta" - } - ] - }, - "getTokenPerpetualDistributionLastClaim": { - "label": "Get Token Perpetual Distribution Last Claim", - "description": "Get last claim information for perpetual distribution", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true - }, - { - "name": "tokenId", - "type": "text", - "label": "Token ID", - "required": true - } - ] - }, - "getTokenTotalSupply": { - "label": "Get Token Total Supply", - "description": "Get total supply of a token", - "inputs": [ - { - "name": "tokenId", - "type": "text", - "label": "Token ID", - "required": true, - "placeholder": "Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv" - } - ] - } - } - }, - "group": { - "label": "Group Queries", - "queries": { - "getGroupInfo": { - "label": "Get Group Info", - "description": "Get information about a group", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Contract ID", - "required": true - }, - { - "name": "groupContractPosition", - "type": "number", - "label": "Group Contract Position", - "required": true - } - ] - }, - "getGroupInfos": { - "label": "Get Group Infos", - "description": "Get information about multiple groups", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Contract ID", - "required": true - }, - { - "name": "startAtGroupContractPosition", - "type": "number", - "label": "Start at Position", - "required": false - }, - { - "name": "startGroupContractPositionIncluded", - "type": "checkbox", - "label": "Include Start Position", - "required": false - }, - { - "name": "count", - "type": "number", - "label": "Count", - "required": false - } - ] - }, - "getGroupActions": { - "label": "Get Group Actions", - "description": "Get actions for a group", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Contract ID", - "required": true - }, - { - "name": "groupContractPosition", - "type": "number", - "label": "Group Contract Position", - "required": true - }, - { - "name": "status", - "type": "select", - "label": "Status", - "required": true, - "options": [ - { - "value": "ACTIVE", - "label": "Active" - }, - { - "value": "CLOSED", - "label": "Closed" - } - ] - }, - { - "name": "startActionId", - "type": "text", - "label": "Start Action ID", - "required": false - }, - { - "name": "startActionIdIncluded", - "type": "checkbox", - "label": "Include Start Action", - "required": false - }, - { - "name": "count", - "type": "number", - "label": "Count", - "required": false - } - ] - }, - "getGroupActionSigners": { - "label": "Get Group Action Signers", - "description": "Get signers for a group action", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Contract ID", - "required": true - }, - { - "name": "groupContractPosition", - "type": "number", - "label": "Group Contract Position", - "required": true - }, - { - "name": "status", - "type": "select", - "label": "Status", - "required": true, - "options": [ - { - "value": "ACTIVE", - "label": "Active" - }, - { - "value": "CLOSED", - "label": "Closed" - } - ] - }, - { - "name": "actionId", - "type": "text", - "label": "Action ID", - "required": true - } - ] - } - } - }, - "system": { - "label": "System & Utility", - "queries": { - "getStatus": { - "label": "Get Status", - "description": "Get system status", - "inputs": [] - }, - "getCurrentQuorumsInfo": { - "label": "Get Current Quorums Info", - "description": "Get information about current quorums", - "inputs": [] - }, - "getPrefundedSpecializedBalance": { - "label": "Get Prefunded Specialized Balance", - "description": "Get prefunded specialized balance", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Specialized Balance ID", - "required": true, - "placeholder": "AzaU7zqCT7X1kxh8yWxkT9PxAgNqWDu4Gz13emwcRyAT" - } - ] - }, - "getTotalCreditsInPlatform": { - "label": "Get Total Credits in Platform", - "description": "Get total credits in the platform", - "inputs": [] - }, - "getPathElements": { - "label": "Get Path Elements", - "description": "Access any data in the Dash Platform state tree. This low-level query allows direct access to GroveDB storage by specifying a path through the tree structure and keys to retrieve at that path. Common paths include: Identities (32), Tokens (96), DataContractDocuments (64), Balances (16), Votes (80), and more.", - "inputs": [ - { - "name": "path", - "type": "array", - "label": "Path", - "required": true - }, - { - "name": "keys", - "type": "array", - "label": "Keys", - "required": true - } - ] - }, - "waitForStateTransitionResult": { - "label": "Wait for State Transition Result", - "description": "Internal query to wait for and retrieve the result of a previously submitted state transition", - "inputs": [ - { - "name": "stateTransitionHash", - "type": "text", - "label": "State Transition Hash", - "required": true - } - ] - } - } - } - }, - "transitions": { - "identity": { - "label": "Identity Transitions", - "transitions": { - "identityCreate": { - "label": "Identity Create", - "description": "Create a new identity with initial credits", - "inputs": [ - { - "name": "seedPhrase", - "type": "textarea", - "label": "Seed Phrase", - "required": true, - "placeholder": "Enter seed phrase (12-24 words) or click Generate", - "help": "The wallet seed phrase that will be used to derive identity keys" - }, - { - "name": "generateSeedButton", - "type": "button", - "label": "Generate New Seed", - "action": "generateTestSeed" - }, - { - "name": "identityIndex", - "type": "number", - "label": "Identity Index", - "required": true, - "value": 0, - "min": 0, - "max": 999, - "help": "The identity index is an internal reference within the wallet. Leave as 0 for first identity." - }, - { - "name": "keySelectionMode", - "type": "select", - "label": "Key Selection Mode", - "required": true, - "value": "default", - "options": [ - { - "value": "default", - "label": "Default (Recommended)" - }, - { - "value": "advanced", - "label": "Advanced" - } - ], - "help": "Default adds standard keys for most Platform operations. Advanced allows custom key configuration." - }, - { - "name": "keyPreview", - "type": "keyPreview", - "label": "Keys to be added", - "help": "These keys will be added to your new identity" - } - ] - }, - "identityTopUp": { - "label": "Identity Top Up", - "description": "Add credits to an existing identity", - "inputs": [ - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true, - "placeholder": "Enter the identity ID to top up (base58)", - "help": "The identity ID that will receive the credits from the asset lock proof" - } - ] - }, - "identityUpdate": { - "label": "Identity Update", - "description": "Update identity keys (add or disable)", - "inputs": [ - { - "name": "addPublicKeys", - "type": "textarea", - "label": "Keys to Add (JSON array)", - "required": false, - "placeholder": "[{\"keyType\":\"ECDSA_HASH160\",\"purpose\":\"AUTHENTICATION\",\"data\":\"base64_key_data\"}]" - }, - { - "name": "disablePublicKeys", - "type": "text", - "label": "Key IDs to Disable (comma-separated)", - "required": false, - "placeholder": "2,3,5" - } - ] - }, - "identityCreditTransfer": { - "label": "Identity Credit Transfer", - "description": "Transfer credits between identities", - "inputs": [ - { - "name": "recipientId", - "type": "text", - "label": "Recipient Identity ID", - "required": true - }, - { - "name": "amount", - "type": "number", - "label": "Amount (credits)", - "required": true - } - ] - }, - "identityCreditWithdrawal": { - "label": "Identity Credit Withdrawal", - "description": "Withdraw credits from identity to Dash address", - "inputs": [ - { - "name": "toAddress", - "type": "text", - "label": "Dash Address", - "required": true - }, - { - "name": "amount", - "type": "number", - "label": "Amount (credits)", - "required": true - }, - { - "name": "coreFeePerByte", - "type": "number", - "label": "Core Fee Per Byte (optional)", - "required": false - } - ] - } - } - }, - "dataContract": { - "label": "Data Contract Transitions", - "transitions": { - "dataContractCreate": { - "label": "Data Contract Create", - "description": "Create a new data contract", - "inputs": [ - { - "name": "canBeDeleted", - "type": "checkbox", - "label": "Can Be Deleted", - "required": false - }, - { - "name": "readonly", - "type": "checkbox", - "label": "Read Only", - "required": false - }, - { - "name": "keepsHistory", - "type": "checkbox", - "label": "Keeps History", - "required": false - }, - { - "name": "documentsKeepHistoryContractDefault", - "type": "checkbox", - "label": "Documents Keep History (Default)", - "required": false - }, - { - "name": "documentsMutableContractDefault", - "type": "checkbox", - "label": "Documents Mutable (Default)", - "required": false, - "defaultValue": true - }, - { - "name": "documentsCanBeDeletedContractDefault", - "type": "checkbox", - "label": "Documents Can Be Deleted (Default)", - "required": false, - "defaultValue": true - }, - { - "name": "requiresIdentityEncryptionBoundedKey", - "type": "text", - "label": "Requires Identity Encryption Key (optional)", - "required": false - }, - { - "name": "requiresIdentityDecryptionBoundedKey", - "type": "text", - "label": "Requires Identity Decryption Key (optional)", - "required": false - }, - { - "name": "documentSchemas", - "type": "json", - "label": "Document Schemas JSON", - "required": true, - "placeholder": "{\n \"note\": {\n \"type\": \"object\",\n \"properties\": {\n \"message\": {\n \"type\": \"string\",\n \"maxLength\": 100,\n \"position\": 0\n }\n },\n \"required\": [\"message\"],\n \"additionalProperties\": false\n }\n}" - }, - { - "name": "groups", - "type": "json", - "label": "Groups (optional)", - "required": false, - "placeholder": "{}" - }, - { - "name": "tokens", - "type": "json", - "label": "Tokens (optional)", - "required": false, - "placeholder": "{}" - }, - { - "name": "keywords", - "type": "text", - "label": "Keywords (comma separated, optional)", - "required": false - }, - { - "name": "description", - "type": "text", - "label": "Description (optional)", - "required": false - } - ] - }, - "dataContractUpdate": { - "label": "Data Contract Update", - "description": "Add document types, groups, or tokens to an existing data contract", - "inputs": [ - { - "name": "dataContractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "newDocumentSchemas", - "type": "json", - "label": "New Document Schemas to Add (optional)", - "required": false, - "placeholder": "{\n \"newType\": {\n \"type\": \"object\",\n \"properties\": {\n \"field\": {\n \"type\": \"string\",\n \"maxLength\": 100,\n \"position\": 0\n }\n },\n \"required\": [\"field\"],\n \"additionalProperties\": false\n }\n}" - }, - { - "name": "newGroups", - "type": "json", - "label": "New Groups to Add (optional)", - "required": false, - "placeholder": "{}" - }, - { - "name": "newTokens", - "type": "json", - "label": "New Tokens to Add (optional)", - "required": false, - "placeholder": "{}" - } - ] - } - } - }, - "document": { - "label": "Document Transitions", - "transitions": { - "documentCreate": { - "label": "Document Create", - "description": "Create a new document", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "documentType", - "type": "text", - "label": "Document Type", - "required": true - }, - { - "name": "fetchSchema", - "type": "button", - "label": "Fetch Schema", - "action": "fetchDocumentSchema" - }, - { - "name": "documentFields", - "type": "dynamic", - "label": "Document Fields" - } - ] - }, - "documentReplace": { - "label": "Document Replace", - "description": "Replace an existing document", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "documentType", - "type": "text", - "label": "Document Type", - "required": true - }, - { - "name": "documentId", - "type": "text", - "label": "Document ID", - "required": true - }, - { - "name": "loadDocument", - "type": "button", - "label": "Load Document", - "action": "loadExistingDocument" - }, - { - "name": "documentFields", - "type": "dynamic", - "label": "Document Fields" - } - ] - }, - "documentDelete": { - "label": "Document Delete", - "description": "Delete an existing document", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "documentType", - "type": "text", - "label": "Document Type", - "required": true - }, - { - "name": "documentId", - "type": "text", - "label": "Document ID", - "required": true - } - ] - }, - "documentTransfer": { - "label": "Document Transfer", - "description": "Transfer document ownership", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "documentType", - "type": "text", - "label": "Document Type", - "required": true - }, - { - "name": "documentId", - "type": "text", - "label": "Document ID", - "required": true - }, - { - "name": "recipientId", - "type": "text", - "label": "Recipient Identity ID", - "required": true - } - ] - }, - "documentPurchase": { - "label": "Document Purchase", - "description": "Purchase a document", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "documentType", - "type": "text", - "label": "Document Type", - "required": true - }, - { - "name": "documentId", - "type": "text", - "label": "Document ID", - "required": true - }, - { - "name": "price", - "type": "number", - "label": "Price (credits)", - "required": true - } - ] - }, - "documentSetPrice": { - "label": "Document Set Price", - "description": "Set or update document price", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "documentType", - "type": "text", - "label": "Document Type", - "required": true - }, - { - "name": "documentId", - "type": "text", - "label": "Document ID", - "required": true - }, - { - "name": "price", - "type": "number", - "label": "Price (credits, 0 to remove)", - "required": true - } - ] - }, - "dpnsRegister": { - "label": "DPNS Register Name", - "description": "Register a new DPNS username", - "inputs": [ - { - "name": "label", - "type": "text", - "label": "Username", - "required": true, - "placeholder": "Enter username (e.g., alice)", - "validateOnType": true - } - ] - } - } - }, - "token": { - "label": "Token Transitions", - "transitions": { - "tokenBurn": { - "label": "Token Burn", - "description": "Burn tokens", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenPosition", - "type": "number", - "label": "Token Contract Position", - "required": true - }, - { - "name": "amount", - "type": "text", - "label": "Amount to Burn", - "required": true - }, - { - "name": "publicNote", - "type": "text", - "label": "Public Note", - "required": false - } - ] - }, - "tokenMint": { - "label": "Token Mint", - "description": "Mint new tokens", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenPosition", - "type": "number", - "label": "Token Contract Position", - "required": true - }, - { - "name": "amount", - "type": "text", - "label": "Amount to Mint", - "required": true - }, - { - "name": "issuedToIdentityId", - "type": "text", - "label": "Issue To Identity ID", - "required": false - }, - { - "name": "publicNote", - "type": "text", - "label": "Public Note", - "required": false - } - ] - }, - "tokenClaim": { - "label": "Token Claim", - "description": "Claim tokens from a distribution", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenPosition", - "type": "number", - "label": "Token Contract Position", - "required": true - }, - { - "name": "distributionType", - "type": "select", - "label": "Distribution Type", - "required": true, - "options": [ - { - "value": "perpetual", - "label": "Perpetual" - }, - { - "value": "preprogrammed", - "label": "Pre-programmed" - } - ] - }, - { - "name": "publicNote", - "type": "text", - "label": "Public Note", - "required": false - } - ] - }, - "tokenSetPriceForDirectPurchase": { - "label": "Token Set Price", - "description": "Set or update the price for direct token purchases", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenPosition", - "type": "number", - "label": "Token Contract Position", - "required": true - }, - { - "name": "priceType", - "type": "select", - "label": "Price Type", - "required": true, - "options": [ - { - "value": "single", - "label": "Single Price" - }, - { - "value": "tiered", - "label": "Tiered Pricing" - } - ] - }, - { - "name": "priceData", - "type": "text", - "label": "Price Data (single price or JSON map)", - "required": false, - "placeholder": "Leave empty to remove pricing" - }, - { - "name": "publicNote", - "type": "text", - "label": "Public Note", - "required": false - } - ] - }, - "tokenDirectPurchase": { - "label": "Token Direct Purchase", - "description": "Purchase tokens directly at the configured price", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenPosition", - "type": "number", - "label": "Token Contract Position", - "required": true - }, - { - "name": "amount", - "type": "text", - "label": "Amount to Purchase", - "required": true - }, - { - "name": "totalAgreedPrice", - "type": "text", - "label": "Total Agreed Price (in credits) - Optional, fetches from pricing schedule if not provided", - "required": false - }, - { - "name": "keyId", - "type": "number", - "label": "Key ID (for signing)", - "required": true - } - ] - }, - "tokenConfigUpdate": { - "label": "Token Config Update", - "description": "Update token configuration settings", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenPosition", - "type": "number", - "label": "Token Contract Position", - "required": true - }, - { - "name": "configItemType", - "type": "select", - "label": "Config Item Type", - "required": true, - "options": [ - { - "value": "conventions", - "label": "Conventions" - }, - { - "value": "max_supply", - "label": "Max Supply" - }, - { - "value": "perpetual_distribution", - "label": "Perpetual Distribution" - }, - { - "value": "new_tokens_destination_identity", - "label": "New Tokens Destination Identity" - }, - { - "value": "minting_allow_choosing_destination", - "label": "Minting Allow Choosing Destination" - }, - { - "value": "manual_minting", - "label": "Manual Minting" - }, - { - "value": "manual_burning", - "label": "Manual Burning" - }, - { - "value": "conventions_control_group", - "label": "Conventions Control Group" - }, - { - "value": "conventions_admin_group", - "label": "Conventions Admin Group" - }, - { - "value": "max_supply_control_group", - "label": "Max Supply Control Group" - }, - { - "value": "max_supply_admin_group", - "label": "Max Supply Admin Group" - } - ] - }, - { - "name": "configValue", - "type": "text", - "label": "Config Value (JSON or specific value)", - "required": true - }, - { - "name": "publicNote", - "type": "text", - "label": "Public Note", - "required": false - } - ] - }, - "tokenTransfer": { - "label": "Token Transfer", - "description": "Transfer tokens to another identity", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenId", - "type": "text", - "label": "Token Contract Position", - "required": true - }, - { - "name": "amount", - "type": "number", - "label": "Amount to Transfer", - "required": true - }, - { - "name": "recipientId", - "type": "text", - "label": "Recipient Identity ID", - "required": true - } - ] - }, - "tokenFreeze": { - "label": "Token Freeze", - "description": "Freeze tokens for an identity", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenId", - "type": "text", - "label": "Token Contract Position", - "required": true - }, - { - "name": "identityId", - "type": "text", - "label": "Identity ID to Freeze", - "required": true - } - ] - }, - "tokenUnfreeze": { - "label": "Token Unfreeze", - "description": "Unfreeze tokens for an identity", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenId", - "type": "text", - "label": "Token Contract Position", - "required": true - }, - { - "name": "identityId", - "type": "text", - "label": "Identity ID to Unfreeze", - "required": true - } - ] - }, - "tokenDestroyFrozen": { - "label": "Token Destroy Frozen Funds", - "description": "Destroy frozen tokens", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true - }, - { - "name": "tokenId", - "type": "text", - "label": "Token Contract Position", - "required": true - }, - { - "name": "identityId", - "type": "text", - "label": "Identity ID", - "required": true - } - ] - } - } - }, - "voting": { - "label": "Voting Transitions", - "transitions": { - "dpnsUsername": { - "label": "DPNS Username", - "description": "Cast a vote for a contested DPNS username", - "inputs": [ - { - "name": "contestedUsername", - "type": "text", - "label": "Contested Username", - "required": true, - "placeholder": "Enter the contested username (e.g., 'myusername')" - }, - { - "name": "voteChoice", - "type": "select", - "label": "Vote Choice", - "required": true, - "options": [ - { - "value": "abstain", - "label": "Abstain" - }, - { - "value": "lock", - "label": "Lock (Give to no one)" - }, - { - "value": "towardsIdentity", - "label": "Vote for Identity" - } - ] - }, - { - "name": "targetIdentity", - "type": "text", - "label": "Target Identity ID (if voting for identity)", - "required": false, - "placeholder": "Identity ID to vote for", - "dependsOn": { - "field": "voteChoice", - "value": "towardsIdentity" - } - } - ] - }, - "masternodeVote": { - "label": "Contested Resource", - "description": "Cast a vote for contested resources as a masternode", - "inputs": [ - { - "name": "contractId", - "type": "text", - "label": "Data Contract ID", - "required": true, - "placeholder": "Contract ID containing the contested resource" - }, - { - "name": "fetchContestedResources", - "type": "button", - "label": "Get Contested Resources", - "action": "fetchContestedResources" - }, - { - "name": "contestedResourceDropdown", - "type": "dynamic", - "label": "Contested Resources" - }, - { - "name": "voteChoice", - "type": "select", - "label": "Vote Choice", - "required": true, - "options": [ - { - "value": "abstain", - "label": "Abstain" - }, - { - "value": "lock", - "label": "Lock (Give to no one)" - }, - { - "value": "towardsIdentity", - "label": "Vote for Identity" - } - ] - }, - { - "name": "targetIdentity", - "type": "text", - "label": "Target Identity ID (if voting for identity)", - "required": false, - "placeholder": "Identity ID to vote for", - "dependsOn": { - "field": "voteChoice", - "value": "towardsIdentity" - } - } - ] - } - } - } - } -} \ No newline at end of file diff --git a/packages/wasm-sdk/save_fixed_definitions.py b/packages/wasm-sdk/save_fixed_definitions.py deleted file mode 100644 index 2c9bea87c8..0000000000 --- a/packages/wasm-sdk/save_fixed_definitions.py +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env python3 -""" -Fix the extraction by manually defining the correct structure -""" - -import json - -# Based on the index.html structure, here's the correct organization -correct_structure = { - "queries": { - "identity": { - "label": "Identity Queries", - "queries": { - "getIdentity": {"label": "Get Identity", "description": "Fetch an identity by its identifier"}, - "getIdentityKeys": {"label": "Get Identity Keys", "description": "Retrieve keys associated with an identity"}, - "getIdentitiesContractKeys": {"label": "Get Identities Contract Keys", "description": "Get keys for multiple identities related to a specific contract"}, - "getIdentityNonce": {"label": "Get Identity Nonce", "description": "Get the current nonce for an identity"}, - "getIdentityContractNonce": {"label": "Get Identity Contract Nonce", "description": "Get the nonce for an identity in relation to a specific contract"}, - "getIdentityBalance": {"label": "Get Identity Balance", "description": "Get the credit balance of an identity"}, - "getIdentitiesBalances": {"label": "Get Identities Balances", "description": "Get balances for multiple identities"}, - "getIdentityBalanceAndRevision": {"label": "Get Identity Balance and Revision", "description": "Get both balance and revision number for an identity"}, - "getIdentityByPublicKeyHash": {"label": "Get Identity by Unique Public Key Hash", "description": "Find an identity by its unique public key hash"}, - "getIdentityByNonUniquePublicKeyHash": {"label": "Get Identity by Non-Unique Public Key Hash", "description": "Find identities by non-unique public key hash"}, - "getIdentityTokenBalances": {"label": "Get Identity Token Balances", "description": "Get token balances for an identity"}, - "getIdentitiesTokenBalances": {"label": "Get Identities Token Balances", "description": "Get token balance for multiple identities"}, - "getIdentityTokenInfos": {"label": "Get Identity Token Info", "description": "Get token information for an identity's tokens"}, - "getIdentitiesTokenInfos": {"label": "Get Identities Token Info", "description": "Get token information for multiple identities with a specific token"} - } - }, - "dataContract": { - "label": "Data Contract Queries", - "queries": { - "getDataContract": {"label": "Get Data Contract", "description": "Fetch a data contract by its identifier"}, - "getDataContractHistory": {"label": "Get Data Contract History", "description": "Get the version history of a data contract"}, - "getDataContracts": {"label": "Get Data Contracts", "description": "Fetch multiple data contracts by their identifiers"} - } - }, - "document": { - "label": "Document Queries", - "queries": { - "getDocuments": {"label": "Get Documents", "description": "Query documents from a data contract"}, - "getDocument": {"label": "Get Document", "description": "Fetch a specific document by ID"} - } - }, - "dpns": { - "label": "DPNS Queries", - "queries": { - "getDpnsUsername": {"label": "Get DPNS Usernames", "description": "Get DPNS usernames for an identity"}, - "dpnsCheckAvailability": {"label": "DPNS Check Availability", "description": "Check if a DPNS username is available"}, - "dpnsResolve": {"label": "DPNS Resolve Name", "description": "Resolve a DPNS name to an identity ID"} - } - }, - "voting": { - "label": "Voting & Contested Resources", - "queries": { - "getContestedResources": {"label": "Get Contested Resources", "description": "Get list of contested resources"}, - "getContestedResourceVoteState": {"label": "Get Contested Resource Vote State", "description": "Get the current vote state for a contested resource"}, - "getContestedResourceVotersForIdentity": {"label": "Get Contested Resource Voters for Identity", "description": "Get voters who voted for a specific identity in a contested resource"}, - "getContestedResourceIdentityVotes": {"label": "Get Contested Resource Identity Votes", "description": "Get all votes cast by a specific identity"}, - "getVotePollsByEndDate": {"label": "Get Vote Polls by End Date", "description": "Get vote polls within a time range"} - } - }, - "protocol": { - "label": "Protocol & Version", - "queries": { - "getProtocolVersionUpgradeState": {"label": "Get Protocol Version Upgrade State", "description": "Get the current state of protocol version upgrades"}, - "getProtocolVersionUpgradeVoteStatus": {"label": "Get Protocol Version Upgrade Vote Status", "description": "Get voting status for protocol version upgrades"} - } - }, - "epoch": { - "label": "Epoch & Block", - "queries": { - "getEpochsInfo": {"label": "Get Epochs Info", "description": "Get information about epochs"}, - "getCurrentEpoch": {"label": "Get Current Epoch", "description": "Get information about the current epoch"}, - "getFinalizedEpochInfos": {"label": "Get Finalized Epoch Info", "description": "Get information about finalized epochs"}, - "getEvonodesProposedEpochBlocksByIds": {"label": "Get Evonodes Proposed Epoch Blocks by IDs", "description": "Get proposed blocks by evonode IDs"}, - "getEvonodesProposedEpochBlocksByRange": {"label": "Get Evonodes Proposed Epoch Blocks by Range", "description": "Get proposed blocks by range"} - } - }, - "token": { - "label": "Token Queries", - "queries": { - "getTokenStatuses": {"label": "Get Token Statuses", "description": "Get token statuses"}, - "getTokenDirectPurchasePrices": {"label": "Get Token Direct Purchase Prices", "description": "Get direct purchase prices for tokens"}, - "getTokenContractInfo": {"label": "Get Token Contract Info", "description": "Get information about a token contract"}, - "getTokenPerpetualDistributionLastClaim": {"label": "Get Token Perpetual Distribution Last Claim", "description": "Get last claim information for perpetual distribution"}, - "getTokenTotalSupply": {"label": "Get Token Total Supply", "description": "Get total supply of a token"} - } - }, - "group": { - "label": "Group Queries", - "queries": { - "getGroupInfo": {"label": "Get Group Info", "description": "Get information about a group"}, - "getGroupInfos": {"label": "Get Group Infos", "description": "Get information about multiple groups"}, - "getGroupActions": {"label": "Get Group Actions", "description": "Get actions for a group"}, - "getGroupActionSigners": {"label": "Get Group Action Signers", "description": "Get signers for a group action"} - } - }, - "system": { - "label": "System & Utility", - "queries": { - "getStatus": {"label": "Get Status", "description": "Get system status"}, - "getCurrentQuorumsInfo": {"label": "Get Current Quorums Info", "description": "Get information about current quorums"}, - "getPrefundedSpecializedBalance": {"label": "Get Prefunded Specialized Balance", "description": "Get prefunded specialized balance"}, - "getTotalCreditsInPlatform": {"label": "Get Total Credits in Platform", "description": "Get total credits in the platform"}, - "getPathElements": {"label": "Get Path Elements", "description": "Get path elements"}, - "waitForStateTransitionResult": {"label": "Wait for State Transition Result", "description": "Wait for a state transition to be processed"} - } - } - }, - "transitions": { - "identity": { - "label": "Identity Transitions", - "transitions": { - "identityCreate": {"label": "Identity Create", "description": "Create a new identity with initial credits"}, - "identityTopUp": {"label": "Identity Top Up", "description": "Add credits to an existing identity"}, - "identityUpdate": {"label": "Identity Update", "description": "Update identity keys (add or disable)"}, - "identityCreditTransfer": {"label": "Identity Credit Transfer", "description": "Transfer credits between identities"}, - "identityCreditWithdrawal": {"label": "Identity Credit Withdrawal", "description": "Withdraw credits from identity to Dash address"} - } - }, - "dataContract": { - "label": "Data Contract Transitions", - "transitions": { - "dataContractCreate": {"label": "Data Contract Create", "description": "Create a new data contract"}, - "dataContractUpdate": {"label": "Data Contract Update", "description": "Add document types, groups, or tokens to an existing data contract"} - } - }, - "document": { - "label": "Document Transitions", - "transitions": { - "documentCreate": {"label": "Document Create", "description": "Create a new document"}, - "documentReplace": {"label": "Document Replace", "description": "Replace an existing document"}, - "documentDelete": {"label": "Document Delete", "description": "Delete an existing document"}, - "documentTransfer": {"label": "Document Transfer", "description": "Transfer document ownership"}, - "documentPurchase": {"label": "Document Purchase", "description": "Purchase a document"}, - "documentSetPrice": {"label": "Document Set Price", "description": "Set or update document price"}, - "dpnsRegister": {"label": "DPNS Register Name", "description": "Register a new DPNS username"} - } - }, - "token": { - "label": "Token Transitions", - "transitions": { - "tokenBurn": {"label": "Token Burn", "description": "Burn tokens"}, - "tokenMint": {"label": "Token Mint", "description": "Mint new tokens"}, - "tokenTransfer": {"label": "Token Transfer", "description": "Transfer tokens to another identity"}, - "tokenFreeze": {"label": "Token Freeze", "description": "Freeze tokens for an identity"}, - "tokenUnfreeze": {"label": "Token Unfreeze", "description": "Unfreeze tokens for an identity"}, - "tokenDestroyFrozen": {"label": "Token Destroy Frozen Funds", "description": "Destroy frozen tokens"} - } - }, - "voting": { - "label": "Voting Transitions", - "transitions": { - "dpnsUsername": {"label": "DPNS Username", "description": "Cast a vote for a contested DPNS username"}, - "masternodeVote": {"label": "Contested Resource", "description": "Cast a vote for contested resources as a masternode"} - } - } - } -} - -# Add empty inputs for now - we'll extract these properly later -def add_inputs(obj): - for cat_key, category in obj.items(): - items_key = 'queries' if 'queries' in category else 'transitions' - for item_key, item in category.get(items_key, {}).items(): - item['inputs'] = [] - -add_inputs(correct_structure['queries']) -add_inputs(correct_structure['transitions']) - -# Save the corrected structure -with open('fixed_definitions.json', 'w') as f: - json.dump(correct_structure, f, indent=2) - -print("Fixed extraction saved to fixed_definitions.json") -print(f"Categories: {len(correct_structure['queries'])} query categories, {len(correct_structure['transitions'])} transition categories") - -# Count items -query_count = sum(len(cat.get('queries', {})) for cat in correct_structure['queries'].values()) -trans_count = sum(len(cat.get('transitions', {})) for cat in correct_structure['transitions'].values()) -print(f"Total: {query_count} queries, {trans_count} transitions") \ No newline at end of file diff --git a/packages/wasm-sdk/update_inputs.py b/packages/wasm-sdk/update_inputs.py deleted file mode 100644 index e6894a31c0..0000000000 --- a/packages/wasm-sdk/update_inputs.py +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env python3 -""" -Manually update the inputs for each query/transition based on index.html -""" - -import json - -# Manually define the inputs for each query based on index.html -query_inputs = { - "getIdentity": [{"name": "id", "type": "text", "label": "Identity ID", "required": True}], - "getIdentityKeys": [ - {"name": "identityId", "type": "text", "label": "Identity ID", "required": True}, - {"name": "keyRequestType", "type": "select", "label": "Key Request Type", "required": False, "options": [ - {"value": "all", "label": "All Keys (AllKeys {})"}, - {"value": "specific", "label": "Specific Keys (SpecificKeys with key_ids)"}, - {"value": "search", "label": "Search Keys (SearchKey with purpose_map)"} - ]} - ], - "getIdentitiesContractKeys": [ - {"name": "identitiesIds", "type": "array", "label": "Identity IDs", "required": True}, - {"name": "contractId", "type": "text", "label": "Contract ID", "required": True}, - {"name": "documentTypeName", "type": "text", "label": "Document Type (optional)", "required": False}, - {"name": "keyRequestType", "type": "select", "label": "Key Request Type", "required": False} - ], - "getIdentityNonce": [ - {"name": "identityId", "type": "text", "label": "Identity ID", "required": True} - ], - "getIdentityContractNonce": [ - {"name": "identityId", "type": "text", "label": "Identity ID", "required": True}, - {"name": "contractId", "type": "text", "label": "Contract ID", "required": True} - ], - "getIdentityBalance": [ - {"name": "id", "type": "text", "label": "Identity ID", "required": True} - ], - "getIdentitiesBalances": [ - {"name": "identityIds", "type": "array", "label": "Identity IDs", "required": True} - ], - "getIdentityBalanceAndRevision": [ - {"name": "id", "type": "text", "label": "Identity ID", "required": True} - ], - "getIdentityByPublicKeyHash": [ - {"name": "publicKeyHash", "type": "text", "label": "Public Key Hash", "required": True, "placeholder": "b7e904ce25ed97594e72f7af0e66f298031c1754"} - ], - "getIdentityByNonUniquePublicKeyHash": [ - {"name": "publicKeyHash", "type": "text", "label": "Public Key Hash", "required": True, "placeholder": "518038dc858461bcee90478fd994bba8057b7531"} - ], - "getIdentityTokenBalances": [ - {"name": "identityId", "type": "text", "label": "Identity ID", "required": True}, - {"name": "tokenIds", "type": "array", "label": "Token IDs", "required": True} - ], - "getIdentitiesTokenBalances": [ - {"name": "identityIds", "type": "array", "label": "Identity IDs", "required": True}, - {"name": "tokenId", "type": "text", "label": "Token ID", "required": True, "placeholder": "Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv"} - ], - "getIdentityTokenInfos": [ - {"name": "identityId", "type": "text", "label": "Identity ID", "required": True}, - {"name": "tokenIds", "type": "array", "label": "Token IDs (optional)", "required": False, "placeholder": "[\"Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv\"]"} - ], - "getIdentitiesTokenInfos": [ - {"name": "identityIds", "type": "array", "label": "Identity IDs", "required": True}, - {"name": "tokenId", "type": "text", "label": "Token ID", "required": True, "placeholder": "Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv"} - ], - "getDataContract": [ - {"name": "id", "type": "text", "label": "Data Contract ID", "required": True, "placeholder": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec"} - ], - "getDataContractHistory": [ - {"name": "id", "type": "text", "label": "Data Contract ID", "required": True, "placeholder": "HLY575cNazmc5824FxqaEMEBuzFeE4a98GDRNKbyJqCM"}, - {"name": "limit", "type": "number", "label": "Limit", "required": False}, - {"name": "offset", "type": "number", "label": "Offset", "required": False} - ], - "getDataContracts": [ - {"name": "ids", "type": "array", "label": "Data Contract IDs", "required": True, "placeholder": "[\"GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec\", \"ALybvzfcCwMs7sinDwmtumw17NneuW7RgFtFHgjKmF3A\"]"} - ], - "getDocuments": [ - {"name": "dataContractId", "type": "text", "label": "Data Contract ID", "required": True, "placeholder": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec"}, - {"name": "documentType", "type": "text", "label": "Document Type", "required": True, "placeholder": "domain"}, - {"name": "whereClause", "type": "text", "label": "Where Clause (JSON)", "required": False, "placeholder": "[[\"normalizedParentDomainName\", \"==\", \"dash\"], [\"normalizedLabel\", \"==\", \"therea1s11mshaddy5\"]]"}, - {"name": "orderBy", "type": "text", "label": "Order By (JSON)", "required": False, "placeholder": "[[\"$createdAt\", \"desc\"]]"}, - {"name": "limit", "type": "number", "label": "Limit", "required": False} - ], - "getDocument": [ - {"name": "dataContractId", "type": "text", "label": "Data Contract ID", "required": True, "placeholder": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec"}, - {"name": "documentType", "type": "text", "label": "Document Type", "required": True, "placeholder": "domain"}, - {"name": "documentId", "type": "text", "label": "Document ID", "required": True, "placeholder": "7NYmEKQsYtniQRUmxwdPGeVcirMoPh5ZPyAKz8BWFy3r"} - ], - "getDpnsUsername": [ - {"name": "identityId", "type": "text", "label": "Identity ID", "required": True} - ], - "dpnsCheckAvailability": [ - {"name": "label", "type": "text", "label": "Label (Username)", "required": True} - ], - "dpnsResolve": [ - {"name": "name", "type": "text", "label": "Name", "required": True} - ], - "getContestedResources": [ - {"name": "resultType", "type": "select", "label": "Result Type", "required": True}, - {"name": "documentTypeName", "type": "text", "label": "Document Type", "required": True}, - {"name": "indexName", "type": "text", "label": "Index Name", "required": True}, - {"name": "count", "type": "number", "label": "Count", "required": False} - ], - "getContestedResourceVoteState": [ - {"name": "contractId", "type": "text", "label": "Contract ID", "required": True}, - {"name": "documentTypeName", "type": "text", "label": "Document Type", "required": True}, - {"name": "indexName", "type": "text", "label": "Index Name", "required": True} - ], - "getContestedResourceVotersForIdentity": [ - {"name": "contractId", "type": "text", "label": "Contract ID", "required": True}, - {"name": "documentTypeName", "type": "text", "label": "Document Type", "required": True}, - {"name": "indexName", "type": "text", "label": "Index Name", "required": True}, - {"name": "contestantId", "type": "text", "label": "Contestant Identity ID", "required": True} - ], - "getContestedResourceIdentityVotes": [ - {"name": "identityId", "type": "text", "label": "Identity ID", "required": True} - ], - "getVotePollsByEndDate": [ - {"name": "startTimeMs", "type": "number", "label": "Start Time (ms)", "required": True}, - {"name": "endTimeMs", "type": "number", "label": "End Time (ms)", "required": True} - ], - "getProtocolVersionUpgradeState": [], - "getProtocolVersionUpgradeVoteStatus": [ - {"name": "startProTxHash", "type": "text", "label": "Start ProTx Hash", "required": True, "placeholder": "143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113"}, - {"name": "count", "type": "number", "label": "Count", "required": True} - ], - "getEpochsInfo": [ - {"name": "epoch", "type": "number", "label": "Start Epoch", "required": True}, - {"name": "count", "type": "number", "label": "Count", "required": True}, - {"name": "ascending", "type": "checkbox", "label": "Ascending Order", "required": False} - ], - "getCurrentEpoch": [], - "getFinalizedEpochInfos": [ - {"name": "startEpoch", "type": "number", "label": "Start Epoch", "required": True}, - {"name": "count", "type": "number", "label": "Count", "required": True} - ], - "getEvonodesProposedEpochBlocksByIds": [ - {"name": "ids", "type": "array", "label": "ProTx Hashes", "required": True, "placeholder": "[\"143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113\"]"} - ], - "getEvonodesProposedEpochBlocksByRange": [ - {"name": "startProTxHash", "type": "text", "label": "Start ProTx Hash", "required": True, "placeholder": "143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113"}, - {"name": "count", "type": "number", "label": "Count", "required": True} - ], - "getTokenStatuses": [ - {"name": "tokenIds", "type": "array", "label": "Token IDs", "required": True} - ], - "getTokenDirectPurchasePrices": [ - {"name": "tokenIds", "type": "array", "label": "Token IDs", "required": True} - ], - "getTokenContractInfo": [ - {"name": "dataContractId", "type": "text", "label": "Data Contract ID", "required": True, "placeholder": "EETVvWgohFDKtbB3ejEzBcDRMNYkc9TtgXY6y8hzP3Ta"} - ], - "getTokenPerpetualDistributionLastClaim": [ - {"name": "identityId", "type": "text", "label": "Identity ID", "required": True}, - {"name": "tokenId", "type": "text", "label": "Token ID", "required": True} - ], - "getTokenTotalSupply": [ - {"name": "tokenId", "type": "text", "label": "Token ID", "required": True, "placeholder": "Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv"} - ], - "getGroupInfo": [ - {"name": "contractId", "type": "text", "label": "Contract ID", "required": True}, - {"name": "groupContractPosition", "type": "number", "label": "Group Contract Position", "required": True} - ], - "getGroupInfos": [ - {"name": "contractId", "type": "text", "label": "Contract ID", "required": True}, - {"name": "startAtGroupContractPosition", "type": "number", "label": "Start at Position", "required": False}, - {"name": "startGroupContractPositionIncluded", "type": "checkbox", "label": "Include Start Position", "required": False}, - {"name": "count", "type": "number", "label": "Count", "required": False} - ], - "getGroupActions": [ - {"name": "contractId", "type": "text", "label": "Contract ID", "required": True}, - {"name": "groupContractPosition", "type": "number", "label": "Group Contract Position", "required": True}, - {"name": "status", "type": "select", "label": "Status", "required": True, "options": [ - {"value": "ACTIVE", "label": "Active"}, - {"value": "CLOSED", "label": "Closed"} - ]}, - {"name": "startActionId", "type": "text", "label": "Start Action ID", "required": False}, - {"name": "startActionIdIncluded", "type": "checkbox", "label": "Include Start Action", "required": False}, - {"name": "count", "type": "number", "label": "Count", "required": False} - ], - "getGroupActionSigners": [ - {"name": "contractId", "type": "text", "label": "Contract ID", "required": True}, - {"name": "groupContractPosition", "type": "number", "label": "Group Contract Position", "required": True}, - {"name": "status", "type": "select", "label": "Status", "required": True, "options": [ - {"value": "ACTIVE", "label": "Active"}, - {"value": "CLOSED", "label": "Closed"} - ]}, - {"name": "actionId", "type": "text", "label": "Action ID", "required": True} - ], - "getStatus": [], - "getCurrentQuorumsInfo": [], - "getPrefundedSpecializedBalance": [ - {"name": "identityId", "type": "text", "label": "Specialized Balance ID", "required": True, "placeholder": "AzaU7zqCT7X1kxh8yWxkT9PxAgNqWDu4Gz13emwcRyAT"} - ], - "getTotalCreditsInPlatform": [], - "getPathElements": [ - {"name": "path", "type": "array", "label": "Path", "required": True}, - {"name": "keys", "type": "array", "label": "Keys", "required": True} - ], - "waitForStateTransitionResult": [ - {"name": "stateTransitionHash", "type": "text", "label": "State Transition Hash", "required": True} - ] -} - -# Load fixed definitions -with open('fixed_definitions.json', 'r') as f: - definitions = json.load(f) - -# Update query inputs -for cat_key, category in definitions['queries'].items(): - for query_key, query in category.get('queries', {}).items(): - if query_key in query_inputs: - query['inputs'] = query_inputs[query_key] - -# Save updated definitions -with open('fixed_definitions.json', 'w') as f: - json.dump(definitions, f, indent=2) - -print("Updated fixed_definitions.json with input parameters") \ No newline at end of file diff --git a/packages/wasm-sdk/update_state_transitions.py b/packages/wasm-sdk/update_state_transitions.py deleted file mode 100644 index 25f17e1fe1..0000000000 --- a/packages/wasm-sdk/update_state_transitions.py +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env python3 -""" -Extract state transition input definitions from index.html and update fixed_definitions.json -""" - -import json -import re - -# Manually define the state transition inputs based on index.html stateTransitionDefinitions -state_transition_inputs = { - "identityCreate": [ - {"name": "publicKeys", "type": "keyArray", "label": "Public Keys", "required": True}, - {"name": "assetLockProof", "type": "assetLockProof", "label": "Asset Lock Proof", "required": True} - ], - "identityTopUp": [ - {"name": "assetLockProof", "type": "assetLockProof", "label": "Asset Lock Proof", "required": True} - ], - "identityUpdate": [ - {"name": "addPublicKeys", "type": "textarea", "label": "Keys to Add (JSON array)", "required": False, - "placeholder": '[{"keyType":"ECDSA_HASH160","purpose":"AUTHENTICATION","data":"base64_key_data"}]'}, - {"name": "disablePublicKeys", "type": "text", "label": "Key IDs to Disable (comma-separated)", "required": False, - "placeholder": "2,3,5"} - ], - "identityCreditTransfer": [ - {"name": "recipientId", "type": "text", "label": "Recipient Identity ID", "required": True}, - {"name": "amount", "type": "number", "label": "Amount (credits)", "required": True} - ], - "identityCreditWithdrawal": [ - {"name": "toAddress", "type": "text", "label": "Dash Address", "required": True}, - {"name": "amount", "type": "number", "label": "Amount (credits)", "required": True}, - {"name": "coreFeePerByte", "type": "number", "label": "Core Fee Per Byte (optional)", "required": False} - ], - "dataContractCreate": [ - {"name": "canBeDeleted", "type": "checkbox", "label": "Can Be Deleted", "required": False}, - {"name": "readonly", "type": "checkbox", "label": "Read Only", "required": False}, - {"name": "keepsHistory", "type": "checkbox", "label": "Keeps History", "required": False}, - {"name": "documentsKeepHistoryContractDefault", "type": "checkbox", "label": "Documents Keep History (Default)", "required": False}, - {"name": "documentsMutableContractDefault", "type": "checkbox", "label": "Documents Mutable (Default)", "required": False, "defaultValue": True}, - {"name": "documentsCanBeDeletedContractDefault", "type": "checkbox", "label": "Documents Can Be Deleted (Default)", "required": False, "defaultValue": True}, - {"name": "requiresIdentityEncryptionBoundedKey", "type": "text", "label": "Requires Identity Encryption Key (optional)", "required": False}, - {"name": "requiresIdentityDecryptionBoundedKey", "type": "text", "label": "Requires Identity Decryption Key (optional)", "required": False}, - {"name": "documentSchemas", "type": "json", "label": "Document Schemas JSON", "required": True, - "placeholder": '{\n "note": {\n "type": "object",\n "properties": {\n "message": {\n "type": "string",\n "maxLength": 100,\n "position": 0\n }\n },\n "required": ["message"],\n "additionalProperties": false\n }\n}'}, - {"name": "groups", "type": "json", "label": "Groups (optional)", "required": False, "placeholder": '{}'}, - {"name": "tokens", "type": "json", "label": "Tokens (optional)", "required": False, "placeholder": '{}'}, - {"name": "keywords", "type": "text", "label": "Keywords (comma separated, optional)", "required": False}, - {"name": "description", "type": "text", "label": "Description (optional)", "required": False} - ], - "dataContractUpdate": [ - {"name": "dataContractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "newDocumentSchemas", "type": "json", "label": "New Document Schemas to Add (optional)", "required": False, - "placeholder": '{\n "newType": {\n "type": "object",\n "properties": {\n "field": {\n "type": "string",\n "maxLength": 100,\n "position": 0\n }\n },\n "required": ["field"],\n "additionalProperties": false\n }\n}'}, - {"name": "newGroups", "type": "json", "label": "New Groups to Add (optional)", "required": False, "placeholder": '{}'}, - {"name": "newTokens", "type": "json", "label": "New Tokens to Add (optional)", "required": False, "placeholder": '{}'} - ], - "documentCreate": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "documentType", "type": "text", "label": "Document Type", "required": True}, - {"name": "fetchSchema", "type": "button", "label": "Fetch Schema", "action": "fetchDocumentSchema"}, - {"name": "documentFields", "type": "dynamic", "label": "Document Fields"} - ], - "documentReplace": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "documentType", "type": "text", "label": "Document Type", "required": True}, - {"name": "documentId", "type": "text", "label": "Document ID", "required": True}, - {"name": "loadDocument", "type": "button", "label": "Load Document", "action": "loadExistingDocument"}, - {"name": "documentFields", "type": "dynamic", "label": "Document Fields"} - ], - "documentDelete": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "documentType", "type": "text", "label": "Document Type", "required": True}, - {"name": "documentId", "type": "text", "label": "Document ID", "required": True} - ], - "documentTransfer": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "documentType", "type": "text", "label": "Document Type", "required": True}, - {"name": "documentId", "type": "text", "label": "Document ID", "required": True}, - {"name": "recipientId", "type": "text", "label": "Recipient Identity ID", "required": True} - ], - "documentPurchase": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "documentType", "type": "text", "label": "Document Type", "required": True}, - {"name": "documentId", "type": "text", "label": "Document ID", "required": True}, - {"name": "price", "type": "number", "label": "Price (credits)", "required": True} - ], - "documentSetPrice": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "documentType", "type": "text", "label": "Document Type", "required": True}, - {"name": "documentId", "type": "text", "label": "Document ID", "required": True}, - {"name": "price", "type": "number", "label": "Price (credits, 0 to remove)", "required": True} - ], - "dpnsRegister": [ - {"name": "label", "type": "text", "label": "Username", "required": True, - "placeholder": "Enter username (e.g., alice)", "validateOnType": True} - ], - "tokenBurn": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "tokenPosition", "type": "number", "label": "Token Contract Position", "required": True}, - {"name": "amount", "type": "text", "label": "Amount to Burn", "required": True}, - {"name": "keyId", "type": "number", "label": "Key ID (for signing)", "required": True}, - {"name": "publicNote", "type": "text", "label": "Public Note", "required": False} - ], - "tokenMint": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "tokenPosition", "type": "number", "label": "Token Contract Position", "required": True}, - {"name": "amount", "type": "text", "label": "Amount to Mint", "required": True}, - {"name": "keyId", "type": "number", "label": "Key ID (for signing)", "required": True}, - {"name": "issuedToIdentityId", "type": "text", "label": "Issue To Identity ID", "required": False}, - {"name": "publicNote", "type": "text", "label": "Public Note", "required": False} - ], - "tokenTransfer": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "tokenId", "type": "text", "label": "Token Contract Position", "required": True}, - {"name": "amount", "type": "number", "label": "Amount to Transfer", "required": True}, - {"name": "recipientId", "type": "text", "label": "Recipient Identity ID", "required": True} - ], - "tokenFreeze": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "tokenId", "type": "text", "label": "Token Contract Position", "required": True}, - {"name": "identityId", "type": "text", "label": "Identity ID to Freeze", "required": True} - ], - "tokenUnfreeze": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "tokenId", "type": "text", "label": "Token Contract Position", "required": True}, - {"name": "identityId", "type": "text", "label": "Identity ID to Unfreeze", "required": True} - ], - "tokenDestroyFrozen": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True}, - {"name": "tokenId", "type": "text", "label": "Token Contract Position", "required": True}, - {"name": "identityId", "type": "text", "label": "Identity ID", "required": True} - ], - "dpnsUsername": [ - {"name": "contestedUsername", "type": "text", "label": "Contested Username", "required": True, - "placeholder": "Enter the contested username (e.g., 'myusername')"}, - {"name": "voteChoice", "type": "select", "label": "Vote Choice", "required": True, - "options": [ - {"value": "abstain", "label": "Abstain"}, - {"value": "lock", "label": "Lock (Give to no one)"}, - {"value": "towardsIdentity", "label": "Vote for Identity"} - ]}, - {"name": "targetIdentity", "type": "text", "label": "Target Identity ID (if voting for identity)", "required": False, - "placeholder": "Identity ID to vote for", - "dependsOn": {"field": "voteChoice", "value": "towardsIdentity"}} - ], - "masternodeVote": [ - {"name": "contractId", "type": "text", "label": "Data Contract ID", "required": True, - "placeholder": "Contract ID containing the contested resource"}, - {"name": "fetchContestedResources", "type": "button", "label": "Get Contested Resources", "action": "fetchContestedResources"}, - {"name": "contestedResourceDropdown", "type": "dynamic", "label": "Contested Resources"}, - {"name": "voteChoice", "type": "select", "label": "Vote Choice", "required": True, - "options": [ - {"value": "abstain", "label": "Abstain"}, - {"value": "lock", "label": "Lock (Give to no one)"}, - {"value": "towardsIdentity", "label": "Vote for Identity"} - ]}, - {"name": "targetIdentity", "type": "text", "label": "Target Identity ID (if voting for identity)", "required": False, - "placeholder": "Identity ID to vote for", - "dependsOn": {"field": "voteChoice", "value": "towardsIdentity"}} - ] -} - -# Load fixed definitions -with open('fixed_definitions.json', 'r') as f: - definitions = json.load(f) - -# Update state transition inputs -for cat_key, category in definitions['transitions'].items(): - for trans_key, transition in category.get('transitions', {}).items(): - if trans_key in state_transition_inputs: - transition['inputs'] = state_transition_inputs[trans_key] - print(f"Updated inputs for {trans_key}: {len(state_transition_inputs[trans_key])} parameters") - else: - print(f"Warning: No inputs defined for {trans_key}") - -# Save updated definitions -with open('fixed_definitions.json', 'w') as f: - json.dump(definitions, f, indent=2) - -print("Updated fixed_definitions.json with state transition input parameters") \ No newline at end of file From b989e2bc7f200071cc6b5f29b6fc5d1de3933a86 Mon Sep 17 00:00:00 2001 From: thephez Date: Wed, 13 Aug 2025 17:26:30 -0400 Subject: [PATCH 06/17] fix: make dpns search test work Includes generated docs (minus a few inconsistencies in STs) --- packages/wasm-sdk/AI_REFERENCE.md | 31 ++++++++++++---- packages/wasm-sdk/docs.html | 57 +++++++++++++++++++++++++----- packages/wasm-sdk/generate_docs.py | 14 +++++++- 3 files changed, 85 insertions(+), 17 deletions(-) diff --git a/packages/wasm-sdk/AI_REFERENCE.md b/packages/wasm-sdk/AI_REFERENCE.md index afad0797b1..0b689a3669 100644 --- a/packages/wasm-sdk/AI_REFERENCE.md +++ b/packages/wasm-sdk/AI_REFERENCE.md @@ -71,7 +71,8 @@ Parameters: - `identitiesIds` (array, required) - Identity IDs - `contractId` (text, required) - Contract ID - `documentTypeName` (text, optional) - Document Type (optional) -- `keyRequestType` (select, optional) - Key Request Type +- `purposes` (multiselect, optional) - Key Purposes + - Options: `0` (Authentication), `1` (Encryption), `2` (Decryption), `3` (Transfer), `5` (Voting) Example: ```javascript @@ -116,7 +117,7 @@ const balance = await sdk.getIdentityBalance(identityId); *Get balances for multiple identities* Parameters: -- `identityIds` (array, required) - Identity IDs +- `ids` (array, required) - Identity IDs Example: ```javascript @@ -327,6 +328,20 @@ Example: const result = await sdk.dpnsResolve("name"); ``` +**DPNS Search Name** - `dpnsSearch` +*Search for DPNS names that start with a given prefix* + +Parameters: +- `prefix` (text, required) - Name Prefix + - Example: `Enter prefix (e.g., ali)` +- `limit` (number, optional) - Limit + - Example: `Default: 10` + +Example: +```javascript +const result = await sdk.dpnsSearch("prefix"); +``` + #### Voting & Contested Resources **Get Contested Resources** - `getContestedResources` @@ -372,7 +387,7 @@ const result = await sdk.getContestedResourceVoteState("dataContractId", "docume *Get voters who voted for a specific identity in a contested resource* Parameters: -- `contractId` (text, required) - Contract ID +- `dataContractId` (text, required) - Contract ID - `documentTypeName` (text, required) - Document Type - `indexName` (text, required) - Index Name - `indexValues` (array, required) - Index Values @@ -384,7 +399,7 @@ Parameters: Example: ```javascript -const result = await sdk.getContestedResourceVotersForIdentity("contractId", "documentTypeName", "indexName", [], "contestantId"); +const result = await sdk.getContestedResourceVotersForIdentity("dataContractId", "documentTypeName", "indexName", [], "contestantId"); ``` **Get Contested Resource Identity Votes** - `getContestedResourceIdentityVotes` @@ -496,13 +511,15 @@ const result = await sdk.getEvonodesProposedEpochBlocksByIds(100, []); *Get proposed blocks by range* Parameters: -- `startProTxHash` (text, required) - Start ProTx Hash +- `epoch` (number, required) - Epoch +- `limit` (number, optional) - Limit +- `startAfter` (text, optional) - Start After (Evonode ID) - Example: `143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113` -- `count` (number, required) - Count +- `orderAscending` (checkbox, optional) - Order Ascending Example: ```javascript -const result = await sdk.getEvonodesProposedEpochBlocksByRange("startProTxHash", 100); +const result = await sdk.getEvonodesProposedEpochBlocksByRange(100); ``` #### Token Queries diff --git a/packages/wasm-sdk/docs.html b/packages/wasm-sdk/docs.html index 1c45c5888e..a35770617e 100644 --- a/packages/wasm-sdk/docs.html +++ b/packages/wasm-sdk/docs.html @@ -872,6 +872,7 @@

Table of Contents

  • Get DPNS Usernames
  • DPNS Check Availability
  • DPNS Resolve Name
  • +
  • DPNS Search Name
  • Voting & Contested Resources
  • Get Contested Resources
  • Get Contested Resource Vote State
  • @@ -1073,15 +1074,16 @@
    Parameters:
    (optional)
    - Key Request Type - select + Key Purposes + multiselect (optional) +
    Options: Authentication, Encryption, Decryption, Transfer, Voting
    Example
    -
    return await window.wasmFunctions.get_identities_contract_keys(sdk, ['5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk'], 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', 'domain', 'all');
    +
    return await window.wasmFunctions.get_identities_contract_keys(sdk, ['5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk'], 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', 'domain');
    @@ -1537,6 +1539,32 @@
    Example
    +
    +

    DPNS Search Name

    +

    Search for DPNS names that start with a given prefix

    + +
    +
    Parameters:
    +
    + Name Prefix + text + (required) +
    Example: Enter prefix (e.g., ali) +
    +
    + Limit + number + (optional) +
    Example: Default: 10 +
    +
    + +
    +
    Example
    +
    return await window.wasmFunctions.get_documents(sdk, 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', 'domain', JSON.stringify([["normalizedLabel", "startsWith", "ali"], ["normalizedParentDomainName", "==", "dash"]]), JSON.stringify([["normalizedLabel", "asc"]]), 10);
    + +
    +

    Voting & Contested Resources

    @@ -1932,21 +1960,32 @@

    Get Evonodes Proposed Epoch
    Parameters:
    - Start ProTx Hash - text + Epoch + number (required) -
    Example: 143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113
    - Count + Limit number - (required) + (optional) +
    Default: 100 (maximum items returned if not specified) +
    +
    + Start After (Evonode ID) + text + (optional) +
    Example: 143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113 +
    +
    + Order Ascending + checkbox + (optional)
    Example
    -
    return await window.wasmFunctions.get_evonodes_proposed_epoch_blocks_by_range(sdk, '143dcd6a6b7684fde01e88a10e5d65de9a29244c5ecd586d14a342657025f113', 100);
    +
    return await window.wasmFunctions.get_evonodes_proposed_epoch_blocks_by_range(sdk, 8635, 10, null, true);

    diff --git a/packages/wasm-sdk/generate_docs.py b/packages/wasm-sdk/generate_docs.py index 25bce6b28f..c92ee84831 100755 --- a/packages/wasm-sdk/generate_docs.py +++ b/packages/wasm-sdk/generate_docs.py @@ -65,6 +65,7 @@ def generate_example_code(query_key, inputs): 'documentId': f"'{test_data['document_id']}'", 'label': f"'{test_data['username']}'", 'name': f"'{test_data['username']}'", + 'prefix': "'ali'", 'epoch': '1000' if 'getEpochsInfo' in query_key else test_data['epoch'], 'keyRequestType': "'all'", 'limit': '10', @@ -102,7 +103,8 @@ def generate_example_code(query_key, inputs): 'startAtVoterInfo': 'null', 'startAtVotePollIdInfo': 'null', 'startTimeInfo': '(Date.now() - 86400000).toString()', - 'endTimeInfo': 'Date.now().toString()' + 'endTimeInfo': 'Date.now().toString()', + 'startAfter': 'null' } # Handle special cases for functions with structured parameters @@ -116,6 +118,15 @@ def generate_example_code(query_key, inputs): # getDataContractHistory expects: sdk, id, limit, offset, startAtMs # Use the specific contract ID for getDataContractHistory examples params = ["'HLY575cNazmc5824FxqaEMEBuzFeE4a98GDRNKbyJqCM'", "10", "0"] + elif query_key == 'dpnsSearch': + # dpnsSearch is implemented as get_documents with DPNS-specific parameters + # get_documents expects: sdk, contractId, documentType, whereClause, orderBy, limit + dpns_contract_id = "'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec'" + document_type = "'domain'" + where_clause = 'JSON.stringify([["normalizedLabel", "startsWith", "ali"], ["normalizedParentDomainName", "==", "dash"]])' + order_by = 'JSON.stringify([["normalizedLabel", "asc"]])' + limit = "10" + params = [dpns_contract_id, document_type, where_clause, order_by, limit] else: # Generate parameters normally params = [] @@ -154,6 +165,7 @@ def generate_example_code(query_key, inputs): 'getDpnsUsername': 'get_dpns_usernames', 'dpnsCheckAvailability': 'dpns_is_name_available', 'dpnsResolve': 'dpns_resolve_name', + 'dpnsSearch': 'get_documents', 'getContestedResources': 'get_contested_resources', 'getContestedResourceVoteState': 'get_contested_resource_vote_state', 'getContestedResourceVotersForIdentity': 'get_contested_resource_voters_for_identity', From 79015852cb6b5b5bc153f8afcc5b34273f0d40f4 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 14 Aug 2025 08:54:52 -0400 Subject: [PATCH 07/17] refactor: extract docs css to separate file Done to - Reduce the size of docs.html several hundred lines - Make the CSS reusable and easier to maintain - Allow for better caching of styles - Keep the documentation generation process clean and modular --- packages/wasm-sdk/docs.css | 471 +++++++++++++ packages/wasm-sdk/docs.html | 474 +------------ packages/wasm-sdk/docs_manifest.json | 6 +- packages/wasm-sdk/generate_docs.py | 956 ++++++++++++++------------- 4 files changed, 960 insertions(+), 947 deletions(-) create mode 100644 packages/wasm-sdk/docs.css diff --git a/packages/wasm-sdk/docs.css b/packages/wasm-sdk/docs.css new file mode 100644 index 0000000000..edd04d36d3 --- /dev/null +++ b/packages/wasm-sdk/docs.css @@ -0,0 +1,471 @@ +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + line-height: 1.6; + color: #333; + margin: 0; + padding: 0; + background-color: #f5f5f5; + display: flex; +} + +/* Sidebar styles */ +.sidebar { + width: 280px; + background-color: white; + box-shadow: 2px 0 4px rgba(0,0,0,0.1); + position: fixed; + height: 100vh; + overflow-y: auto; + padding: 20px; +} + +.sidebar h2 { + font-size: 1.2em; + margin-bottom: 10px; + color: #2c3e50; +} + +.sidebar ul { + list-style: none; + padding: 0; + margin: 0 0 20px 0; +} + +.sidebar li { + margin-bottom: 5px; +} + +.sidebar a { + color: #34495e; + text-decoration: none; + font-size: 0.9em; + display: block; + padding: 5px 10px; + border-radius: 3px; + transition: background-color 0.2s; +} + +.sidebar a:hover { + background-color: #ecf0f1; + color: #2c3e50; +} + +.sidebar .section-header { + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + color: white; + padding: 12px 20px; + margin: 20px -20px 15px -20px; + font-weight: 600; + font-size: 0.9em; + text-transform: uppercase; + letter-spacing: 0.5px; + position: relative; + overflow: hidden; +} + +.sidebar .section-header:before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.1); + transform: translateX(-100%); + transition: transform 0.6s ease; +} + +.sidebar .section-header:hover:before { + transform: translateX(0); +} + +.sidebar .section-header.state-transitions { + background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); +} + +.sidebar .category { + font-weight: 600; + color: #34495e; + margin-top: 15px; + margin-bottom: 8px; + font-size: 0.85em; + padding-left: 10px; + border-left: 3px solid #3498db; +} + +/* Search box styles */ +.search-container { + padding: 0 20px 20px 20px; + border-bottom: 1px solid #ecf0f1; +} + +.search-input { + width: 100%; + padding: 8px 12px; + border: 1px solid #ddd; + border-radius: 4px; + font-size: 0.9em; + outline: none; + transition: border-color 0.2s; +} + +.search-input:focus { + border-color: #3498db; +} + +.search-input::placeholder { + color: #95a5a6; +} + +.sidebar li.hidden { + display: none; +} + +.sidebar .no-results { + text-align: center; + color: #95a5a6; + padding: 20px; + font-size: 0.9em; + display: none; +} + +/* Main content styles */ +.main-content { + margin-left: 320px; + padding: 20px 40px; + max-width: 900px; +} + +h1, h2, h3, h4 { + color: #2c3e50; +} + +h1 { + border-bottom: 3px solid #3498db; + padding-bottom: 10px; +} + +h2 { + border-bottom: 2px solid #ecf0f1; + padding-bottom: 8px; + margin-top: 30px; +} + +h3 { + color: #34495e; + margin-top: 25px; +} + +.nav { + background-color: white; + padding: 15px; + border-radius: 8px; + margin-bottom: 30px; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); +} + +.nav ul { + list-style: none; + padding: 0; + margin: 0; +} + +.nav li { + display: inline-block; + margin-right: 20px; +} + +.nav a { + color: #3498db; + text-decoration: none; + font-weight: 500; +} + +.nav a:hover { + text-decoration: underline; +} + +.category { + background-color: white; + padding: 20px; + border-radius: 8px; + margin-bottom: 20px; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); +} + +.operation { + border-left: 4px solid #3498db; + padding-left: 20px; + margin-bottom: 30px; +} + +.description { + color: #7f8c8d; + font-style: italic; + margin-bottom: 15px; +} + +.parameters { + background-color: #ecf0f1; + padding: 15px; + border-radius: 5px; + margin-top: 10px; +} + +.parameter { + margin-bottom: 10px; + padding: 5px 0; + border-bottom: 1px solid #bdc3c7; +} + +.parameter:last-child { + border-bottom: none; +} + +.param-name { + font-weight: bold; + color: #2c3e50; +} + +.param-type { + color: #e74c3c; + font-family: monospace; + font-size: 0.9em; +} + +.param-required { + color: #e74c3c; + font-weight: bold; +} + +.param-optional { + color: #95a5a6; +} + +.code-example { + background-color: #2c3e50; + color: #ecf0f1; + padding: 15px; + border-radius: 5px; + overflow-x: auto; + font-family: monospace; + margin-top: 10px; +} + +/* Interactive example styles */ +.example-container { + background-color: #f8f9fa; + border: 1px solid #dee2e6; + border-radius: 5px; + padding: 15px; + margin-top: 15px; +} + +.example-code { + background-color: #2c3e50; + color: #ecf0f1; + padding: 10px; + border-radius: 3px; + font-family: monospace; + font-size: 0.9em; + margin-bottom: 10px; + position: relative; +} + +.run-button { + background-color: #3498db; + color: white; + border: none; + padding: 8px 16px; + border-radius: 3px; + cursor: pointer; + font-weight: 500; + transition: background-color 0.2s; +} + +.run-button:hover { + background-color: #2980b9; +} + +.run-button:disabled { + background-color: #95a5a6; + cursor: not-allowed; +} + +.example-result { + margin-top: 10px; + padding: 10px; + border-radius: 3px; + font-family: monospace; + font-size: 0.85em; + display: none; +} + +.example-result.success { + background-color: #d4edda; + border: 1px solid #c3e6cb; + color: #155724; +} + +.example-result.error { + background-color: #f8d7da; + border: 1px solid #f5c6cb; + color: #721c24; +} + +.loading { + display: inline-block; + width: 20px; + height: 20px; + border: 3px solid rgba(255,255,255,.3); + border-radius: 50%; + border-top-color: #fff; + animation: spin 1s ease-in-out infinite; +} + +@keyframes spin { + to { transform: rotate(360deg); } +} + +.back-to-top { + position: fixed; + bottom: 20px; + right: 20px; + background-color: #3498db; + color: white; + padding: 10px 15px; + border-radius: 5px; + text-decoration: none; + box-shadow: 0 2px 4px rgba(0,0,0,0.2); +} + +.back-to-top:hover { + background-color: #2980b9; +} + +.info-note { + background-color: #e3f2fd; + color: #1565c0; + padding: 12px 16px; + border-radius: 4px; + font-size: 0.9em; + margin: 10px 0; + border-left: 4px solid #1976d2; +} + +.path-info { + background-color: #f5f7fa; + border: 1px solid #e1e5eb; + border-radius: 4px; + padding: 15px; + margin-top: 15px; +} + +.path-info h6 { + margin-top: 15px; + margin-bottom: 10px; + color: #2c3e50; + font-size: 0.95em; +} + +.path-info h6:first-child { + margin-top: 0; +} + +.path-table { + width: 100%; + border-collapse: collapse; + margin-bottom: 15px; +} + +.path-table th { + background-color: #e9ecef; + padding: 8px 12px; + text-align: left; + font-weight: 600; + border: 1px solid #dee2e6; +} + +.path-table td { + padding: 8px 12px; + border: 1px solid #dee2e6; +} + +.path-table code { + background-color: #fff; + padding: 2px 6px; + border-radius: 3px; + font-family: monospace; +} + +.path-info ul { + margin: 0; + padding-left: 25px; +} + +.path-info li { + margin-bottom: 5px; + line-height: 1.6; +} + +.path-info li code { + background-color: #fff; + padding: 2px 6px; + border-radius: 3px; + font-family: monospace; +} + +/* Preloader styles */ +#preloader { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.8); + z-index: 9999; + display: flex; + justify-content: center; + align-items: center; +} + +.preloader-content { + text-align: center; + background: white; + padding: 30px 50px; + border-radius: 10px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); +} + +.preloader-text { + font-size: 16px; + margin-bottom: 15px; + color: #333; +} + +.preloader-progress { + margin-top: 20px; +} + +.progress-bar { + width: 300px; + height: 20px; + background-color: #f0f0f0; + border-radius: 10px; + overflow: hidden; + margin-bottom: 10px; +} + +.progress-fill { + height: 100%; + background: linear-gradient(90deg, #4CAF50, #45a049); + width: 0%; + transition: width 0.3s ease; +} + +.progress-percent { + font-size: 14px; + font-weight: bold; + color: #333; +} \ No newline at end of file diff --git a/packages/wasm-sdk/docs.html b/packages/wasm-sdk/docs.html index a35770617e..0e4484717f 100644 --- a/packages/wasm-sdk/docs.html +++ b/packages/wasm-sdk/docs.html @@ -6,479 +6,7 @@ Dash Platform WASM JS SDK Documentation - + From fb1609ce2a1f10220eb55e77aab59f0ee493fec1 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 14 Aug 2025 13:39:58 -0400 Subject: [PATCH 15/17] fix: sync api-definitions.json with Rust SDK function signatures - Add missing limit/offset parameters to getIdentityKeys and getIdentityTokenInfos - Add missing startAfter parameter to getIdentityByNonUniquePublicKeyHash - Rename epoch to startEpoch in getEpochsInfo to match implementation - Replace startAtVotePollIdInfo with offset in getContestedResourceIdentityVotes - Rename time parameters and add offset in getVotePollsByEndDate - Fix parameter names in getContestedResourceVotersForIdentity - Add missing ascending parameter to getFinalizedEpochInfos --- packages/wasm-sdk/AI_REFERENCE.md | 20 +++++--- packages/wasm-sdk/api-definitions.json | 69 +++++++++++++++++++++----- packages/wasm-sdk/docs.html | 67 +++++++++++++++++++------ packages/wasm-sdk/docs_manifest.json | 2 +- 4 files changed, 123 insertions(+), 35 deletions(-) diff --git a/packages/wasm-sdk/AI_REFERENCE.md b/packages/wasm-sdk/AI_REFERENCE.md index b59d2165cb..f106c09aed 100644 --- a/packages/wasm-sdk/AI_REFERENCE.md +++ b/packages/wasm-sdk/AI_REFERENCE.md @@ -58,6 +58,8 @@ Parameters: - Example: `0,1,2` - `searchPurposeMap` (text, optional) - Search Purpose Map JSON (required for 'search' type) - Example: `{"0": {"0": "current"}, "1": {"0": "all"}}` +- `limit` (number, optional) - Limit +- `offset` (number, optional) - Offset Example: ```javascript @@ -153,6 +155,7 @@ const result = await sdk.getIdentityByPublicKeyHash("publicKeyHash"); Parameters: - `publicKeyHash` (text, required) - Public Key Hash - Example: `518038dc858461bcee90478fd994bba8057b7531` +- `startAfter` (text, optional) - Start After Example: ```javascript @@ -191,6 +194,8 @@ Parameters: - `identityId` (text, required) - Identity ID - `tokenIds` (array, optional) - Token IDs (optional) - Example: `["Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv"]` +- `limit` (number, optional) - Limit +- `offset` (number, optional) - Offset Example: ```javascript @@ -394,8 +399,9 @@ Parameters: - `indexValues` (array, required) - Index Values - Example: `["dash", "alice"]` - `contestantId` (text, required) - Contestant Identity ID -- `startAtVoterInfo` (text, optional) - Start At Voter Info -- `limit` (number, optional) - Limit +- `startAtIdentifierInfo` (text, optional) - Start At Identifier Info +- `count` (number, optional) - Count + - Example: `Default: 100` - `orderAscending` (checkbox, optional) - Order Ascending Example: @@ -409,7 +415,7 @@ const result = await sdk.getContestedResourceVotersForIdentity("dataContractId", Parameters: - `identityId` (text, required) - Identity ID - `limit` (number, optional) - Limit -- `startAtVotePollIdInfo` (text, optional) - Start At Vote Poll ID Info +- `offset` (number, optional) - Offset - `orderAscending` (checkbox, optional) - Order Ascending Example: @@ -421,11 +427,12 @@ const result = await sdk.getContestedResourceIdentityVotes("identityId"); *Get vote polls within a time range* Parameters: -- `startTimeInfo` (text, optional) - Start Time Info +- `startTimeMs` (text, optional) - Start Time (ms) - Example: `Timestamp in milliseconds as string` -- `endTimeInfo` (text, optional) - End Time Info +- `endTimeMs` (text, optional) - End Time (ms) - Example: `Timestamp in milliseconds as string` - `limit` (number, optional) - Limit +- `offset` (number, optional) - Offset - `orderAscending` (checkbox, optional) - Order Ascending Example: @@ -464,7 +471,7 @@ const result = await sdk.getProtocolVersionUpgradeVoteStatus("startProTxHash", 1 *Get information about epochs* Parameters: -- `epoch` (number, required) - Start Epoch +- `startEpoch` (number, required) - Start Epoch - `count` (number, required) - Count - `ascending` (checkbox, optional) - Ascending Order @@ -489,6 +496,7 @@ const result = await sdk.getCurrentEpoch(); Parameters: - `startEpoch` (number, required) - Start Epoch - `count` (number, required) - Count +- `ascending` (checkbox, optional) - Ascending Order Example: ```javascript diff --git a/packages/wasm-sdk/api-definitions.json b/packages/wasm-sdk/api-definitions.json index e9f75de2de..e648e81c18 100644 --- a/packages/wasm-sdk/api-definitions.json +++ b/packages/wasm-sdk/api-definitions.json @@ -61,6 +61,18 @@ "label": "Search Purpose Map JSON (required for 'search' type)", "required": false, "placeholder": "{\"0\": {\"0\": \"current\"}, \"1\": {\"0\": \"all\"}}" + }, + { + "name": "limit", + "type": "number", + "label": "Limit", + "required": false + }, + { + "name": "offset", + "type": "number", + "label": "Offset", + "required": false } ] }, @@ -205,6 +217,12 @@ "label": "Public Key Hash", "required": true, "placeholder": "518038dc858461bcee90478fd994bba8057b7531" + }, + { + "name": "startAfter", + "type": "text", + "label": "Start After", + "required": false } ] }, @@ -261,6 +279,18 @@ "label": "Token IDs (optional)", "required": false, "placeholder": "[\"Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv\"]" + }, + { + "name": "limit", + "type": "number", + "label": "Limit", + "required": false + }, + { + "name": "offset", + "type": "number", + "label": "Offset", + "required": false } ] }, @@ -640,16 +670,17 @@ "required": true }, { - "name": "startAtVoterInfo", + "name": "startAtIdentifierInfo", "type": "text", - "label": "Start At Voter Info", + "label": "Start At Identifier Info", "required": false }, { - "name": "limit", + "name": "count", "type": "number", - "label": "Limit", - "required": false + "label": "Count", + "required": false, + "placeholder": "Default: 100" }, { "name": "orderAscending", @@ -676,9 +707,9 @@ "required": false }, { - "name": "startAtVotePollIdInfo", - "type": "text", - "label": "Start At Vote Poll ID Info", + "name": "offset", + "type": "number", + "label": "Offset", "required": false }, { @@ -694,16 +725,16 @@ "description": "Get vote polls within a time range", "inputs": [ { - "name": "startTimeInfo", + "name": "startTimeMs", "type": "text", - "label": "Start Time Info", + "label": "Start Time (ms)", "required": false, "placeholder": "Timestamp in milliseconds as string" }, { - "name": "endTimeInfo", + "name": "endTimeMs", "type": "text", - "label": "End Time Info", + "label": "End Time (ms)", "required": false, "placeholder": "Timestamp in milliseconds as string" }, @@ -713,6 +744,12 @@ "label": "Limit", "required": false }, + { + "name": "offset", + "type": "number", + "label": "Offset", + "required": false + }, { "name": "orderAscending", "type": "checkbox", @@ -760,7 +797,7 @@ "description": "Get information about epochs", "inputs": [ { - "name": "epoch", + "name": "startEpoch", "type": "number", "label": "Start Epoch", "required": true @@ -799,6 +836,12 @@ "type": "number", "label": "Count", "required": true + }, + { + "name": "ascending", + "type": "checkbox", + "label": "Ascending Order", + "required": false } ] }, diff --git a/packages/wasm-sdk/docs.html b/packages/wasm-sdk/docs.html index a2c554f71f..baf5ed2207 100644 --- a/packages/wasm-sdk/docs.html +++ b/packages/wasm-sdk/docs.html @@ -558,11 +558,22 @@
    Parameters:
    (optional)
    Example: {"0": {"0": "current"}, "1": {"0": "all"}} +
    + Limit + number + (optional) +
    Default: 100 (maximum items returned if not specified) +
    +
    + Offset + number + (optional) +
    Example
    -
    return await window.wasmFunctions.get_identity_keys(sdk, '5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk', 'all');
    +
    return await window.wasmFunctions.get_identity_keys(sdk, '5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk', 'all', 10, 0);
    @@ -747,11 +758,16 @@
    Parameters:
    (required)
    Example: 518038dc858461bcee90478fd994bba8057b7531 +
    + Start After + text + (optional) +
    Example
    -
    return await window.wasmFunctions.get_identity_by_non_unique_public_key_hash(sdk, '518038dc858461bcee90478fd994bba8057b7531');
    +
    return await window.wasmFunctions.get_identity_by_non_unique_public_key_hash(sdk, '518038dc858461bcee90478fd994bba8057b7531', null);
    @@ -821,11 +837,22 @@
    Parameters:
    (optional)
    Example: ["Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv"] +
    + Limit + number + (optional) +
    Default: 100 (maximum items returned if not specified) +
    +
    + Offset + number + (optional) +
    Example
    -
    return await window.wasmFunctions.get_identity_token_infos(sdk, '5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk', ['Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv']);
    +
    return await window.wasmFunctions.get_identity_token_infos(sdk, '5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk', ['Hqyu8WcRwXCTwbNxdga4CN5gsVEGc67wng4TFzceyLUv'], 10, 0);
    @@ -1254,15 +1281,15 @@
    Parameters:
    (required)
    - Start At Voter Info + Start At Identifier Info text (optional)
    - Limit + Count number (optional) -
    Default: 100 (maximum items returned if not specified) +
    Example: Default: 100
    Order Ascending @@ -1273,7 +1300,7 @@
    Parameters:
    Example
    -
    return await window.wasmFunctions.get_contested_resource_voters_for_identity(sdk, 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', 'domain', 'parentNameAndLabel', ['dash', 'alice'], '5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk', null, 10, true);
    +
    return await window.wasmFunctions.get_contested_resource_voters_for_identity(sdk, 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', 'domain', 'parentNameAndLabel', ['dash', 'alice'], '5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk', null, 100, true);
    🚧 Work in Progress
    @@ -1295,8 +1322,8 @@
    Parameters:

    Default: 100 (maximum items returned if not specified)
    - Start At Vote Poll ID Info - text + Offset + number (optional)
    @@ -1308,7 +1335,7 @@
    Parameters:
    Example
    -
    return await window.wasmFunctions.get_contested_resource_identity_votes(sdk, '5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk', 10, null, true);
    +
    return await window.wasmFunctions.get_contested_resource_identity_votes(sdk, '5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk', 10, 0, true);
    @@ -1319,13 +1346,13 @@

    Get Vote Polls by End Date

    Parameters:
    - Start Time Info + Start Time (ms) text (optional)
    Example: Timestamp in milliseconds as string
    - End Time Info + End Time (ms) text (optional)
    Example: Timestamp in milliseconds as string @@ -1336,6 +1363,11 @@
    Parameters:
    (optional)
    Default: 100 (maximum items returned if not specified)
    +
    + Offset + number + (optional) +
    Order Ascending checkbox @@ -1345,7 +1377,7 @@
    Parameters:
    Example
    -
    return await window.wasmFunctions.get_vote_polls_by_end_date(sdk, (Date.now() - 86400000).toString(), Date.now().toString(), 10, true);
    +
    return await window.wasmFunctions.get_vote_polls_by_end_date(sdk, Date.now() - 86400000, Date.now(), 10, 0, true);
    @@ -1419,7 +1451,7 @@
    Parameters:
    Example
    -
    return await window.wasmFunctions.get_epochs_info(sdk, 1000, 100, true);
    +
    return await window.wasmFunctions.get_epochs_info(sdk, 8635, 100, true);
    @@ -1453,11 +1485,16 @@
    Parameters:
    number (required) +
    + Ascending Order + checkbox + (optional) +
    Example
    -
    return await window.wasmFunctions.get_finalized_epoch_infos(sdk, 8635, 100);
    +
    return await window.wasmFunctions.get_finalized_epoch_infos(sdk, 8635, 100, true);
    diff --git a/packages/wasm-sdk/docs_manifest.json b/packages/wasm-sdk/docs_manifest.json index 91488f4198..7b13cad6fd 100644 --- a/packages/wasm-sdk/docs_manifest.json +++ b/packages/wasm-sdk/docs_manifest.json @@ -1,5 +1,5 @@ { - "generated_at": "2025-08-14T16:41:46.954854+00:00", + "generated_at": "2025-08-14T17:28:01.856354+00:00", "queries": { "getIdentity": { "category": "identity", From 2677ede6e2384bc10873bdd5343795da3f6fec31 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 14 Aug 2025 13:44:15 -0400 Subject: [PATCH 16/17] fix: normalize datetime to UTC before computing age in check_documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- packages/wasm-sdk/check_documentation.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/wasm-sdk/check_documentation.py b/packages/wasm-sdk/check_documentation.py index d75f2cec3f..1c766b3229 100755 --- a/packages/wasm-sdk/check_documentation.py +++ b/packages/wasm-sdk/check_documentation.py @@ -58,6 +58,11 @@ def check_documentation_completeness(): # Check if manifest is stale (older than 24 hours) if 'generated_at' in manifest: generated_time = datetime.fromisoformat(manifest['generated_at']) + # Normalize to UTC timezone + if generated_time.tzinfo is None: + generated_time = generated_time.replace(tzinfo=timezone.utc) + else: + generated_time = generated_time.astimezone(timezone.utc) age_hours = (datetime.now(timezone.utc) - generated_time).total_seconds() / 3600 if age_hours > 24: warnings.append(f"WARNING: Documentation was generated {age_hours:.1f} hours ago. Consider regenerating.") From d6f1770efb4decdd5a108c5728dac8c1c54ff246 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 14 Aug 2025 14:52:55 -0400 Subject: [PATCH 17/17] fix: change time parameter types from text to number - startTimeMs and endTimeMs now use number type instead of text - added numeric examples to placeholders for clarity --- packages/wasm-sdk/AI_REFERENCE.md | 8 ++++---- packages/wasm-sdk/api-definitions.json | 8 ++++---- packages/wasm-sdk/docs.html | 8 ++++---- packages/wasm-sdk/docs_manifest.json | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/wasm-sdk/AI_REFERENCE.md b/packages/wasm-sdk/AI_REFERENCE.md index f106c09aed..85c7a81f74 100644 --- a/packages/wasm-sdk/AI_REFERENCE.md +++ b/packages/wasm-sdk/AI_REFERENCE.md @@ -427,10 +427,10 @@ const result = await sdk.getContestedResourceIdentityVotes("identityId"); *Get vote polls within a time range* Parameters: -- `startTimeMs` (text, optional) - Start Time (ms) - - Example: `Timestamp in milliseconds as string` -- `endTimeMs` (text, optional) - End Time (ms) - - Example: `Timestamp in milliseconds as string` +- `startTimeMs` (number, optional) - Start Time (ms) + - Example: `Timestamp in milliseconds as string (e.g., 1650000000000)` +- `endTimeMs` (number, optional) - End Time (ms) + - Example: `Timestamp in milliseconds as string (e.g., 1650086400000)` - `limit` (number, optional) - Limit - `offset` (number, optional) - Offset - `orderAscending` (checkbox, optional) - Order Ascending diff --git a/packages/wasm-sdk/api-definitions.json b/packages/wasm-sdk/api-definitions.json index e648e81c18..ed1be49b62 100644 --- a/packages/wasm-sdk/api-definitions.json +++ b/packages/wasm-sdk/api-definitions.json @@ -726,17 +726,17 @@ "inputs": [ { "name": "startTimeMs", - "type": "text", + "type": "number", "label": "Start Time (ms)", "required": false, - "placeholder": "Timestamp in milliseconds as string" + "placeholder": "Timestamp in milliseconds as string (e.g., 1650000000000)" }, { "name": "endTimeMs", - "type": "text", + "type": "number", "label": "End Time (ms)", "required": false, - "placeholder": "Timestamp in milliseconds as string" + "placeholder": "Timestamp in milliseconds as string (e.g., 1650086400000)" }, { "name": "limit", diff --git a/packages/wasm-sdk/docs.html b/packages/wasm-sdk/docs.html index baf5ed2207..36b873d146 100644 --- a/packages/wasm-sdk/docs.html +++ b/packages/wasm-sdk/docs.html @@ -1347,15 +1347,15 @@

    Get Vote Polls by End Date

    Parameters:
    Start Time (ms) - text + number (optional) -
    Example: Timestamp in milliseconds as string +
    Example: Timestamp in milliseconds as string (e.g., 1650000000000)
    End Time (ms) - text + number (optional) -
    Example: Timestamp in milliseconds as string +
    Example: Timestamp in milliseconds as string (e.g., 1650086400000)
    Limit diff --git a/packages/wasm-sdk/docs_manifest.json b/packages/wasm-sdk/docs_manifest.json index 7b13cad6fd..c3a4999d63 100644 --- a/packages/wasm-sdk/docs_manifest.json +++ b/packages/wasm-sdk/docs_manifest.json @@ -1,5 +1,5 @@ { - "generated_at": "2025-08-14T17:28:01.856354+00:00", + "generated_at": "2025-08-14T18:48:19.291132+00:00", "queries": { "getIdentity": { "category": "identity",