Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 42 additions & 16 deletions packages/wasm-sdk/AI_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -731,32 +731,63 @@ 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):
- `publicKeys` (keyArray, required) - Public Keys
- `assetLockProof` (assetLockProof, required) - Asset Lock Proof
Parameters:
- `assetLockProof` (string, required) - Asset lock proof (hex-encoded JSON)
- `assetLockProofPrivateKey` (string, required) - Private key for the asset lock proof (WIF format)
- `publicKeys` (string, required) - JSON array of public keys to add to the identity

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):
- `assetLockProof` (assetLockProof, required) - Asset Lock Proof
Parameters:
- `identityId` (string, required) - The identity ID to top up (base58 format)
- `assetLockProof` (string, required) - Asset lock proof (hex-encoded JSON)
- `assetLockProofPrivateKey` (string, required) - Private key for the asset lock proof (WIF format)

Example:
```javascript
const result = await sdk.identityTopUp(identityHex, /* params */, privateKeyHex);
const identityId = "5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk"; // base58
const assetLockProof = "a9147d3b... (hex-encoded)";
const assetLockProofPrivateKey = "XFfpaSbZq52HPy3WWwe1dXsZMiU1bQn8vQd34HNXkSZThevBWRn1"; // WIF format

const result = await sdk.identityTopUp(identityId, assetLockProof, assetLockProofPrivateKey);
```

**Identity Update** - `identityUpdate`
*Update identity keys (add or disable)*

Parameters (in addition to identity/key):
- `addPublicKeys` (textarea, optional) - Keys to Add (JSON array)
- Example: `[{"keyType":"ECDSA_HASH160","purpose":"AUTHENTICATION","data":"base64_key_data"}]`
- Example: `[{"type":0,"purpose":0,"securityLevel":2,"data":"base64_encoded_public_key","readOnly":false}]`
- `disablePublicKeys` (text, optional) - Key IDs to Disable (comma-separated)
- Example: `2,3,5`

Expand Down Expand Up @@ -974,7 +1005,6 @@ Parameters (in addition to identity/key):
- `contractId` (text, required) - Data Contract ID
- `tokenPosition` (number, required) - Token Contract Position
- `amount` (text, required) - Amount to Burn
- `keyId` (number, required) - Key ID (for signing)
- `publicNote` (text, optional) - Public Note

Example:
Expand All @@ -989,7 +1019,6 @@ Parameters (in addition to identity/key):
- `contractId` (text, required) - Data Contract ID
- `tokenPosition` (number, required) - Token Contract Position
- `amount` (text, required) - Amount to Mint
- `keyId` (number, required) - Key ID (for signing)
- `issuedToIdentityId` (text, optional) - Issue To Identity ID
- `publicNote` (text, optional) - Public Note

Expand All @@ -1005,7 +1034,6 @@ Parameters (in addition to identity/key):
- `contractId` (text, required) - Data Contract ID
- `tokenPosition` (number, required) - Token Contract Position
- `distributionType` (select, required) - Distribution Type
- `keyId` (number, required) - Key ID (for signing)
- `publicNote` (text, optional) - Public Note

Example:
Expand All @@ -1022,7 +1050,6 @@ Parameters (in addition to identity/key):
- `priceType` (select, required) - Price Type
- `priceData` (text, optional) - Price Data (single price or JSON map)
- Example: `Leave empty to remove pricing`
- `keyId` (number, required) - Key ID (for signing)
- `publicNote` (text, optional) - Public Note

Example:
Expand All @@ -1037,7 +1064,7 @@ Parameters (in addition to identity/key):
- `contractId` (text, required) - Data Contract ID
- `tokenPosition` (number, required) - Token Contract Position
- `amount` (text, required) - Amount to Purchase
- `totalAgreedPrice` (text, required) - Total Agreed Price (in credits)
- `totalAgreedPrice` (text, optional) - Total Agreed Price (in credits) - Optional, fetches from pricing schedule if not provided
- `keyId` (number, required) - Key ID (for signing)

Example:
Expand All @@ -1053,7 +1080,6 @@ Parameters (in addition to identity/key):
- `tokenPosition` (number, required) - Token Contract Position
- `configItemType` (select, required) - Config Item Type
- `configValue` (text, required) - Config Value (JSON or specific value)
- `keyId` (number, required) - Key ID (for signing)
- `publicNote` (text, optional) - Public Note

Example:
Expand Down
93 changes: 58 additions & 35 deletions packages/wasm-sdk/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -2335,37 +2335,85 @@ <h4 id="transition-identityCreate">Identity Create</h4>
<div class="parameters">
<h5>Parameters:</h5>
<div class="parameter">
<span class="param-name">Public Keys</span>
<span class="param-type">keyArray</span>
<span class="param-name">Asset Lock Proof</span>
<span class="param-type">string</span>
<span class="param-required">(required)</span>
<br><small>Hex-encoded JSON asset lock proof</small>
</div>
<div class="parameter">
<span class="param-name">Asset Lock Proof</span>
<span class="param-type">assetLockProof</span>
<span class="param-name">Asset Lock Proof Private Key</span>
<span class="param-type">string</span>
<span class="param-required">(required)</span>
<br><small>WIF format private key</small>
</div>
<div class="parameter">
<span class="param-name">Public Keys</span>
<span class="param-type">string</span>
<span class="param-required">(required)</span>
<br><small>JSON array of public keys</small>
</div>
</div>

<div class="example-container">
<h5>Example</h5>
<div class="example-code">const result = await sdk.identityCreate(identityHex, /* params */, privateKeyHex);</div> </div>
<div class="example-code">// 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
}
]);

const result = await sdk.identityCreate(assetLockProof, assetLockProofPrivateKey, publicKeys);</div> </div>
</div>
<div class="operation">
<h4 id="transition-identityTopUp">Identity Top Up</h4>
<p class="description">Add credits to an existing identity</p>

<div class="parameters">
<h5>Parameters:</h5>
<div class="parameter">
<span class="param-name">Identity ID</span>
<span class="param-type">string</span>
<span class="param-required">(required)</span>
<br><small>Base58 format identity ID</small>
</div>
<div class="parameter">
<span class="param-name">Asset Lock Proof</span>
<span class="param-type">assetLockProof</span>
<span class="param-type">string</span>
<span class="param-required">(required)</span>
<br><small>Hex-encoded JSON asset lock proof</small>
</div>
<div class="parameter">
<span class="param-name">Asset Lock Proof Private Key</span>
<span class="param-type">string</span>
<span class="param-required">(required)</span>
<br><small>WIF format private key</small>
</div>

<div class="example-container">
<h5>Example</h5>
<div class="example-code">const result = await sdk.identityTopUp(identityHex, /* params */, privateKeyHex);</div> </div>
<div class="example-code">const identityId = "5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk"; // base58
const assetLockProof = "a9147d3b... (hex-encoded)";
const assetLockProofPrivateKey = "XFfpaSbZq52HPy3WWwe1dXsZMiU1bQn8vQd34HNXkSZThevBWRn1"; // WIF format

const result = await sdk.identityTopUp(identityId, assetLockProof, assetLockProofPrivateKey);</div> </div>
</div>
<div class="operation">
<h4 id="transition-identityUpdate">Identity Update</h4>
Expand Down Expand Up @@ -2827,11 +2875,6 @@ <h5>Parameters:</h5>
<span class="param-type">text</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Key ID (for signing)</span>
<span class="param-type">number</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Public Note</span>
<span class="param-type">text</span>
Expand Down Expand Up @@ -2864,11 +2907,6 @@ <h5>Parameters:</h5>
<span class="param-type">text</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Key ID (for signing)</span>
<span class="param-type">number</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Issue To Identity ID</span>
<span class="param-type">text</span>
Expand Down Expand Up @@ -2907,11 +2945,6 @@ <h5>Parameters:</h5>
<span class="param-required">(required)</span>
<br><small>Options: Perpetual, Pre-programmed</small>
</div>
<div class="parameter">
<span class="param-name">Key ID (for signing)</span>
<span class="param-type">number</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Public Note</span>
<span class="param-type">text</span>
Expand Down Expand Up @@ -2951,11 +2984,6 @@ <h5>Parameters:</h5>
<span class="param-optional">(optional)</span>
<br><small>Example: Leave empty to remove pricing</small>
</div>
<div class="parameter">
<span class="param-name">Key ID (for signing)</span>
<span class="param-type">number</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Public Note</span>
<span class="param-type">text</span>
Expand Down Expand Up @@ -2989,9 +3017,9 @@ <h5>Parameters:</h5>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Total Agreed Price (in credits)</span>
<span class="param-name">Total Agreed Price (in credits) - Optional, fetches from pricing schedule if not provided</span>
<span class="param-type">text</span>
<span class="param-required">(required)</span>
<span class="param-optional">(optional)</span>
</div>
<div class="parameter">
<span class="param-name">Key ID (for signing)</span>
Expand Down Expand Up @@ -3024,18 +3052,13 @@ <h5>Parameters:</h5>
<span class="param-name">Config Item Type</span>
<span class="param-type">select</span>
<span class="param-required">(required)</span>
<br><small>Options: No Change, Conventions, Max Supply, Perpetual Distribution, New Tokens Destination Identity, Minting Allow Choosing Destination, Manual Minting, Manual Burning, Conventions Control Group, Conventions Admin Group, Max Supply Control Group, Max Supply Admin Group</small>
<br><small>Options: Conventions, Max Supply, Perpetual Distribution, New Tokens Destination Identity, Minting Allow Choosing Destination, Manual Minting, Manual Burning, Conventions Control Group, Conventions Admin Group, Max Supply Control Group, Max Supply Admin Group</small>
</div>
<div class="parameter">
<span class="param-name">Config Value (JSON or specific value)</span>
<span class="param-type">text</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Key ID (for signing)</span>
<span class="param-type">number</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Public Note</span>
<span class="param-type">text</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/wasm-sdk/docs_manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"generated_at": "2025-07-27T13:06:04.539212",
"generated_at": "2025-07-28T12:35:33.649527",
"queries": {
"getIdentity": {
"category": "identity",
Expand Down
62 changes: 50 additions & 12 deletions packages/wasm-sdk/fixed_definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1082,16 +1082,52 @@
"description": "Create a new identity with initial credits",
"inputs": [
{
"name": "publicKeys",
"type": "keyArray",
"label": "Public Keys",
"required": true
"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": "assetLockProof",
"type": "assetLockProof",
"label": "Asset Lock Proof",
"required": true
"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"
}
]
},
Expand All @@ -1100,10 +1136,12 @@
"description": "Add credits to an existing identity",
"inputs": [
{
"name": "assetLockProof",
"type": "assetLockProof",
"label": "Asset Lock Proof",
"required": true
"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"
}
]
},
Expand Down
Loading
Loading