diff --git a/packages/wasm-sdk/AI_REFERENCE.md b/packages/wasm-sdk/AI_REFERENCE.md index 57df8f64ce..dfd9f2eb94 100644 --- a/packages/wasm-sdk/AI_REFERENCE.md +++ b/packages/wasm-sdk/AI_REFERENCE.md @@ -757,29 +757,61 @@ const result = await sdk.{transition_name}(identityHex, ...params, privateKeyHex **Identity Create** - `identityCreate` *Create a new identity with initial credits* -Parameters (in addition to identity/key): -- `seedPhrase` (textarea, required) - Seed Phrase - - Example: `Enter seed phrase (12-24 words) or click Generate` -- `generateSeedButton` (button, optional) - Generate New Seed -- `identityIndex` (number, required) - Identity Index -- `keySelectionMode` (select, required) - Key Selection Mode -- `keyPreview` (keyPreview, optional) - Keys to be added +Parameters: +- `assetLockProof` (string, required) - Asset Lock Proof + - Hex-encoded JSON asset lock proof +- `assetLockProofPrivateKey` (string, required) - Asset Lock Proof Private Key + - WIF format private key +- `publicKeys` (string, required) - Public Keys + - JSON array of public keys + +Example: +```javascript +// Asset lock proof is a hex-encoded JSON object +const assetLockProof = "a9147d3b... (hex-encoded)"; +const assetLockProofPrivateKey = "XFfpaSbZq52HPy3WWwe1dXsZMiU1bQn8vQd34HNXkSZThevBWRn1"; // WIF format + +// Public keys array with proper key types +const publicKeys = JSON.stringify([ + { + id: 0, + type: 0, // ECDSA_SECP256K1 = 0, BLS12_381 = 1, ECDSA_HASH160 = 2 + purpose: 0, // AUTHENTICATION = 0, ENCRYPTION = 1, DECRYPTION = 2, TRANSFER = 3, etc. + securityLevel: 0, // MASTER = 0, CRITICAL = 1, HIGH = 2, MEDIUM = 3 + data: "A5GzYHPIolbHkFrp5l+s9IvF2lWMuuuSu3oWZB8vWHNJ", // Base64-encoded public key + readOnly: false + }, + { + id: 1, + type: 0, + purpose: 0, + securityLevel: 2, + data: "AnotherBase64EncodedPublicKeyHere", // Base64-encoded public key + readOnly: false + } +]); -Example: -```javascript -const result = await sdk.identityCreate(identityHex, /* params */, privateKeyHex); +const result = await sdk.identityCreate(assetLockProof, assetLockProofPrivateKey, publicKeys); ``` **Identity Top Up** - `identityTopUp` *Add credits to an existing identity* -Parameters (in addition to identity/key): -- `identityId` (text, required) - Identity ID - - Example: `Enter the identity ID to top up (base58)` +Parameters: +- `identityId` (string, required) - Identity ID + - Base58 format identity ID +- `assetLockProof` (string, required) - Asset Lock Proof + - Hex-encoded JSON asset lock proof +- `assetLockProofPrivateKey` (string, required) - Asset Lock Proof Private Key + - WIF format private key Example: ```javascript -const result = await sdk.identityTopUp(identityHex, /* params */, privateKeyHex); +const identityId = "5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk"; // base58 +const assetLockProof = "a9147d3b... (hex-encoded)"; +const assetLockProofPrivateKey = "XFfpaSbZq52HPy3WWve1dXsZMiU1bQn8vQd34HNXkSZThevBWRn1"; // WIF format + +const result = await sdk.identityTopUp(identityId, assetLockProof, assetLockProofPrivateKey); ``` **Identity Update** - `identityUpdate` diff --git a/packages/wasm-sdk/api-definitions.json b/packages/wasm-sdk/api-definitions.json index a2b91d2e6e..67e39c11d6 100644 --- a/packages/wasm-sdk/api-definitions.json +++ b/packages/wasm-sdk/api-definitions.json @@ -1235,7 +1235,31 @@ "label": "Keys to be added", "help": "These keys will be added to your new identity" } - ] + ], + "sdk_params": [ + { + "name": "assetLockProof", + "type": "string", + "label": "Asset Lock Proof", + "required": true, + "description": "Hex-encoded JSON asset lock proof" + }, + { + "name": "assetLockProofPrivateKey", + "type": "string", + "label": "Asset Lock Proof Private Key", + "required": true, + "description": "WIF format private key" + }, + { + "name": "publicKeys", + "type": "string", + "label": "Public Keys", + "required": true, + "description": "JSON array of public keys" + } + ], + "sdk_example": "// Asset lock proof is a hex-encoded JSON object\nconst assetLockProof = \"a9147d3b... (hex-encoded)\";\nconst assetLockProofPrivateKey = \"XFfpaSbZq52HPy3WWwe1dXsZMiU1bQn8vQd34HNXkSZThevBWRn1\"; // WIF format\n\n// Public keys array with proper key types\nconst publicKeys = JSON.stringify([\n {\n id: 0,\n type: 0, // ECDSA_SECP256K1 = 0, BLS12_381 = 1, ECDSA_HASH160 = 2\n purpose: 0, // AUTHENTICATION = 0, ENCRYPTION = 1, DECRYPTION = 2, TRANSFER = 3, etc.\n securityLevel: 0, // MASTER = 0, CRITICAL = 1, HIGH = 2, MEDIUM = 3\n data: \"A5GzYHPIolbHkFrp5l+s9IvF2lWMuuuSu3oWZB8vWHNJ\", // Base64-encoded public key\n readOnly: false\n },\n {\n id: 1,\n type: 0,\n purpose: 0,\n securityLevel: 2,\n data: \"AnotherBase64EncodedPublicKeyHere\", // Base64-encoded public key\n readOnly: false\n }\n]);\n\nconst result = await sdk.identityCreate(assetLockProof, assetLockProofPrivateKey, publicKeys);" }, "identityTopUp": { "label": "Identity Top Up", @@ -1249,7 +1273,31 @@ "placeholder": "Enter the identity ID to top up (base58)", "help": "The identity ID that will receive the credits from the asset lock proof" } - ] + ], + "sdk_params": [ + { + "name": "identityId", + "type": "string", + "label": "Identity ID", + "required": true, + "description": "Base58 format identity ID" + }, + { + "name": "assetLockProof", + "type": "string", + "label": "Asset Lock Proof", + "required": true, + "description": "Hex-encoded JSON asset lock proof" + }, + { + "name": "assetLockProofPrivateKey", + "type": "string", + "label": "Asset Lock Proof Private Key", + "required": true, + "description": "WIF format private key" + } + ], + "sdk_example": "const identityId = \"5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk\"; // base58\nconst assetLockProof = \"a9147d3b... (hex-encoded)\";\nconst assetLockProofPrivateKey = \"XFfpaSbZq52HPy3WWve1dXsZMiU1bQn8vQd34HNXkSZThevBWRn1\"; // WIF format\n\nconst result = await sdk.identityTopUp(identityId, assetLockProof, assetLockProofPrivateKey);" }, "identityUpdate": { "label": "Identity Update", diff --git a/packages/wasm-sdk/docs.css b/packages/wasm-sdk/docs.css index 35302b49ea..4af6d24309 100644 --- a/packages/wasm-sdk/docs.css +++ b/packages/wasm-sdk/docs.css @@ -270,6 +270,8 @@ h3 { font-size: 0.9em; margin-bottom: 10px; position: relative; + white-space: pre-wrap; + overflow-x: auto; } .run-button { diff --git a/packages/wasm-sdk/docs.html b/packages/wasm-sdk/docs.html index 4eeaaba1ea..167b857b71 100644 --- a/packages/wasm-sdk/docs.html +++ b/packages/wasm-sdk/docs.html @@ -1952,37 +1952,52 @@
No parameters required
' else: - for param in inputs: + for param in params_to_use: html_content += generate_parameter_entry(param) html_content += '''