diff --git a/packages/wasm-sdk/AI_REFERENCE.md b/packages/wasm-sdk/AI_REFERENCE.md index afad0797b10..85c7a81f74a 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 @@ -71,7 +73,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 +119,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 @@ -152,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 @@ -190,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 @@ -231,6 +237,7 @@ Parameters: - Example: `HLY575cNazmc5824FxqaEMEBuzFeE4a98GDRNKbyJqCM` - `limit` (number, optional) - Limit - `offset` (number, optional) - Offset +- `startAtMs` (number, optional) - Start At Timestamp (ms) Example: ```javascript @@ -327,6 +334,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,19 +393,20 @@ 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 - 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: ```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` @@ -393,7 +415,7 @@ const result = await sdk.getContestedResourceVotersForIdentity("contractId", "do 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: @@ -405,11 +427,12 @@ const result = await sdk.getContestedResourceIdentityVotes("identityId"); *Get vote polls within a time range* Parameters: -- `startTimeInfo` (text, optional) - Start Time Info - - Example: `Timestamp in milliseconds as string` -- `endTimeInfo` (text, optional) - End Time Info - - 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 Example: @@ -448,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 @@ -473,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 @@ -496,13 +520,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/fixed_definitions.json b/packages/wasm-sdk/api-definitions.json similarity index 94% rename from packages/wasm-sdk/fixed_definitions.json rename to packages/wasm-sdk/api-definitions.json index 95507b0d31b..ed1be49b62b 100644 --- a/packages/wasm-sdk/fixed_definitions.json +++ b/packages/wasm-sdk/api-definitions.json @@ -1,4 +1,7 @@ { + "version": "1.0.3", + "generated_at": "2025-08-13T17:10:00.000000", + "source": "index.html", "queries": { "identity": { "label": "Identity Queries", @@ -58,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 } ] }, @@ -84,10 +99,32 @@ "required": false }, { - "name": "keyRequestType", - "type": "select", - "label": "Key Request Type", - "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" + } + ] } ] }, @@ -138,7 +175,7 @@ "description": "Get balances for multiple identities", "inputs": [ { - "name": "identityIds", + "name": "ids", "type": "array", "label": "Identity IDs", "required": true @@ -180,6 +217,12 @@ "label": "Public Key Hash", "required": true, "placeholder": "518038dc858461bcee90478fd994bba8057b7531" + }, + { + "name": "startAfter", + "type": "text", + "label": "Start After", + "required": false } ] }, @@ -236,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 } ] }, @@ -298,6 +353,12 @@ "type": "number", "label": "Offset", "required": false + }, + { + "name": "startAtMs", + "type": "number", + "label": "Start At Timestamp (ms)", + "required": false } ] }, @@ -426,6 +487,26 @@ "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" + } + ] } } }, @@ -558,7 +639,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 @@ -589,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", @@ -625,9 +707,9 @@ "required": false }, { - "name": "startAtVotePollIdInfo", - "type": "text", - "label": "Start At Vote Poll ID Info", + "name": "offset", + "type": "number", + "label": "Offset", "required": false }, { @@ -643,18 +725,18 @@ "description": "Get vote polls within a time range", "inputs": [ { - "name": "startTimeInfo", - "type": "text", - "label": "Start Time Info", + "name": "startTimeMs", + "type": "number", + "label": "Start Time (ms)", "required": false, - "placeholder": "Timestamp in milliseconds as string" + "placeholder": "Timestamp in milliseconds as string (e.g., 1650000000000)" }, { - "name": "endTimeInfo", - "type": "text", - "label": "End Time Info", + "name": "endTimeMs", + "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", @@ -662,6 +744,12 @@ "label": "Limit", "required": false }, + { + "name": "offset", + "type": "number", + "label": "Offset", + "required": false + }, { "name": "orderAscending", "type": "checkbox", @@ -709,7 +797,7 @@ "description": "Get information about epochs", "inputs": [ { - "name": "epoch", + "name": "startEpoch", "type": "number", "label": "Start Epoch", "required": true @@ -748,6 +836,12 @@ "type": "number", "label": "Count", "required": true + }, + { + "name": "ascending", + "type": "checkbox", + "label": "Ascending Order", + "required": false } ] }, @@ -775,17 +869,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 } ] } diff --git a/packages/wasm-sdk/check_documentation.py b/packages/wasm-sdk/check_documentation.py index d3c4ccc07b6..1c766b3229c 100755 --- a/packages/wasm-sdk/check_documentation.py +++ b/packages/wasm-sdk/check_documentation.py @@ -1,21 +1,21 @@ #!/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 import sys import json from pathlib import Path -from datetime import datetime +from datetime import datetime, timezone 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) @@ -62,7 +58,12 @@ 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']) - age_hours = (datetime.now() - generated_time).total_seconds() / 3600 + # 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.") @@ -72,15 +73,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 +112,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/docs.css b/packages/wasm-sdk/docs.css new file mode 100644 index 00000000000..35302b49eaf --- /dev/null +++ b/packages/wasm-sdk/docs.css @@ -0,0 +1,474 @@ +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; +} + +.preloader--visible { + 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 1c45c5888e4..36b873d1461 100644 --- a/packages/wasm-sdk/docs.html +++ b/packages/wasm-sdk/docs.html @@ -6,479 +6,7 @@ Dash Platform WASM JS SDK Documentation - + diff --git a/packages/wasm-sdk/save_fixed_definitions.py b/packages/wasm-sdk/save_fixed_definitions.py deleted file mode 100644 index 2c9bea87c88..00000000000 --- 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 e6894a31c02..00000000000 --- 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 25f17e1fe1b..00000000000 --- 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