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
5 changes: 1 addition & 4 deletions packages/wasm-sdk/AI_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ const result = await sdk.getIdentityKeys("identityId");
Parameters:
- `identitiesIds` (array, required) - Identity IDs
- `contractId` (text, required) - Contract ID
- `documentTypeName` (text, optional) - Document Type (optional)
- `purposes` (multiselect, optional) - Key Purposes
- Options: `0` (Authentication), `1` (Encryption), `2` (Decryption), `3` (Transfer), `5` (Voting)

Expand Down Expand Up @@ -357,16 +356,14 @@ Parameters:
- `documentTypeName` (text, required) - Document Type
- `dataContractId` (text, required) - Data Contract ID
- `indexName` (text, required) - Index Name
- `resultType` (text, required) - Result Type
- `allowIncludeLockedAndAbstainingVoteTally` (checkbox, optional) - Allow Include Locked and Abstaining Vote Tally
- `startAtValue` (text, optional) - Start At Value
- `limit` (number, optional) - Limit
- `offset` (number, optional) - Offset
- `orderAscending` (checkbox, optional) - Order Ascending

Example:
```javascript
const result = await sdk.getContestedResources("documentTypeName", "dataContractId", "indexName", "resultType");
const result = await sdk.getContestedResources("documentTypeName", "dataContractId", "indexName");
```

**Get Contested Resource Vote State** - `getContestedResourceVoteState`
Expand Down
18 changes: 0 additions & 18 deletions packages/wasm-sdk/api-definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@
"label": "Contract ID",
"required": true
},
{
"name": "documentTypeName",
"type": "text",
"label": "Document Type (optional)",
"required": false
},
{
"name": "purposes",
"type": "multiselect",
Expand Down Expand Up @@ -535,18 +529,6 @@
"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",
Expand Down
19 changes: 2 additions & 17 deletions packages/wasm-sdk/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,6 @@ <h5>Parameters:</h5>
<span class="param-type">text</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Document Type (optional)</span>
<span class="param-type">text</span>
<span class="param-optional">(optional)</span>
</div>
<div class="parameter">
<span class="param-name">Key Purposes</span>
<span class="param-type">multiselect</span>
Expand All @@ -622,7 +617,7 @@ <h5>Parameters:</h5>

<div class="example-container">
<h5>Example</h5>
<div class="example-code" id="code-getIdentitiesContractKeys">return await window.wasmFunctions.get_identities_contract_keys(sdk, ['5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk'], 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', 'domain');</div>
<div class="example-code" id="code-getIdentitiesContractKeys">return await window.wasmFunctions.get_identities_contract_keys(sdk, ['5DbLwAxGBzUzo81VewMUwn4b5P4bpv9FNFybi25XB5Bk'], 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec');</div>
<button class="run-button" id="run-getIdentitiesContractKeys" onclick="runExample('getIdentitiesContractKeys')">Run</button>
<div class="example-result" id="result-getIdentitiesContractKeys"></div> </div>
</div>
Expand Down Expand Up @@ -1149,16 +1144,6 @@ <h5>Parameters:</h5>
<span class="param-type">text</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Result Type</span>
<span class="param-type">text</span>
<span class="param-required">(required)</span>
</div>
<div class="parameter">
<span class="param-name">Allow Include Locked and Abstaining Vote Tally</span>
<span class="param-type">checkbox</span>
<span class="param-optional">(optional)</span>
</div>
<div class="parameter">
<span class="param-name">Start At Value</span>
<span class="param-type">text</span>
Expand All @@ -1184,7 +1169,7 @@ <h5>Parameters:</h5>

<div class="example-container">
<h5>Example</h5>
<div class="example-code" id="code-getContestedResources">return await window.wasmFunctions.get_contested_resources(sdk, 'domain', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', 'parentNameAndLabel', 'documents', null, null, 10, 0, true);</div>
<div class="example-code" id="code-getContestedResources">return await window.wasmFunctions.get_contested_resources(sdk, 'domain', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', 'parentNameAndLabel', null, 10, 0, true);</div>
<button class="run-button" id="run-getContestedResources" onclick="runExample('getContestedResources')">Run</button>
<div class="example-result" id="result-getContestedResources"></div> </div>
</div>
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-09-03T20:55:56.075308+00:00",
"generated_at": "2025-09-04T13:38:48.983658+00:00",
"queries": {
"getIdentity": {
"category": "identity",
Expand Down
6 changes: 0 additions & 6 deletions packages/wasm-sdk/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2241,7 +2241,6 @@ <h2>Results</h2>
sdk,
values.identitiesIds,
values.contractId,
values.documentTypeName || undefined,
purposes
);
// Result is already a JS object from serde_wasm_bindgen
Expand All @@ -2250,7 +2249,6 @@ <h2>Results</h2>
sdk,
values.identitiesIds,
values.contractId,
values.documentTypeName || undefined,
purposes
);
// Result is already a JS object from serde_wasm_bindgen
Expand Down Expand Up @@ -2776,8 +2774,6 @@ <h2>Results</h2>
values.documentTypeName,
values.dataContractId,
values.indexName,
values.resultType,
values.allowIncludeLockedAndAbstainingVoteTally,
startAtValue,
values.limit,
values.offset,
Expand All @@ -2789,8 +2785,6 @@ <h2>Results</h2>
values.documentTypeName,
values.dataContractId,
values.indexName,
values.resultType,
values.allowIncludeLockedAndAbstainingVoteTally,
startAtValue,
values.limit,
values.offset,
Expand Down
1 change: 0 additions & 1 deletion packages/wasm-sdk/src/dpns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use dash_sdk::dpp::document::{Document, DocumentV0Getters};
use dash_sdk::dpp::identity::accessors::IdentityGettersV0;
use dash_sdk::dpp::prelude::Identifier;
use simple_signer::SingleKeySigner;
use std::sync::Mutex;

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down
7 changes: 5 additions & 2 deletions packages/wasm-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ pub mod wallet;

// Re-export commonly used items
pub use sdk::{WasmSdk, WasmSdkBuilder};
pub use queries::*;
pub use state_transitions::*;
pub use queries::{
data_contract::*, document::*, dpns::*, epoch::*, group::*, protocol::*, system::*, token::*, voting::*,
identity as query_identity
};
pub use state_transitions::identity as state_transition_identity;
pub use dpns::*;
pub use wallet::*;

Expand Down
2 changes: 1 addition & 1 deletion packages/wasm-sdk/src/queries/data_contract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::dpp::DataContractWasm;
use crate::sdk::WasmSdk;
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;
use dash_sdk::platform::{DataContract, Fetch, FetchMany, Identifier};
use dash_sdk::platform::query::LimitQuery;
use drive_proof_verifier::types::{DataContractHistory, DataContracts};
Expand Down
7 changes: 3 additions & 4 deletions packages/wasm-sdk/src/queries/document.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::sdk::WasmSdk;
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::{JsError, JsValue, JsCast};
use serde::{Serialize, Deserialize};
use dash_sdk::platform::Fetch;
use drive_proof_verifier::types::Documents;
use dash_sdk::dpp::prelude::Identifier;
use dash_sdk::dpp::document::Document;
use dash_sdk::dpp::document::DocumentV0Getters;
Expand Down Expand Up @@ -326,7 +325,7 @@ pub async fn get_documents_with_proof_info(
) -> Result<JsValue, JsError> {
use dash_sdk::platform::documents::document_query::DocumentQuery;
use dash_sdk::platform::FetchMany;
use drive_proof_verifier::types::Documents;


// Parse data contract ID
let contract_id = Identifier::from_string(
Expand Down Expand Up @@ -670,7 +669,7 @@ pub async fn get_dpns_usernames_with_proof_info(
) -> Result<JsValue, JsError> {
use dash_sdk::platform::documents::document_query::DocumentQuery;
use dash_sdk::platform::FetchMany;
use drive_proof_verifier::types::Documents;


// DPNS contract ID on testnet
const DPNS_CONTRACT_ID: &str = "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec";
Expand Down
5 changes: 2 additions & 3 deletions packages/wasm-sdk/src/queries/dpns.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::sdk::WasmSdk;
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::{JsError, JsValue};
use serde::{Serialize, Deserialize};
use serde::ser::Serialize as _;
use dash_sdk::platform::{Fetch, FetchMany, Document};
use dash_sdk::platform::{FetchMany, Document};
use dash_sdk::dpp::platform_value::string_encoding::Encoding;
use dash_sdk::dpp::document::DocumentV0Getters;

Expand Down
7 changes: 3 additions & 4 deletions packages/wasm-sdk/src/queries/epoch.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::sdk::WasmSdk;
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::{JsError, JsValue};
use serde::{Serialize, Deserialize};
use serde::ser::Serialize as _;
use dash_sdk::platform::{FetchMany, LimitQuery};
use dash_sdk::platform::fetch_current_no_parameters::FetchCurrent;
use dash_sdk::dpp::block::extended_epoch_info::ExtendedEpochInfo;
Expand Down Expand Up @@ -166,7 +165,7 @@ pub async fn get_evonodes_proposed_epoch_blocks_by_ids(
epoch: u16,
ids: Vec<String>,
) -> Result<JsValue, JsError> {
use drive_proof_verifier::types::{ProposerBlockCountById, ProposerBlockCounts};
use drive_proof_verifier::types::ProposerBlockCountById;

// Parse the ProTxHash strings
let pro_tx_hashes: Vec<ProTxHash> = ids
Expand Down Expand Up @@ -346,7 +345,7 @@ pub async fn get_finalized_epoch_infos_with_proof_info(
ascending: Option<bool>,
) -> Result<JsValue, JsError> {
use dash_sdk::platform::types::finalized_epoch::FinalizedEpochQuery;
use drive_proof_verifier::types::FinalizedEpochInfos;


if start_epoch.is_none() {
return Err(JsError::new("start_epoch is required for finalized epoch queries"));
Expand Down
5 changes: 2 additions & 3 deletions packages/wasm-sdk/src/queries/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::sdk::WasmSdk;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::{JsError, JsValue};
use serde::{Serialize, Deserialize};
use serde::ser::Serialize as _;
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use dash_sdk::platform::{Fetch, FetchMany, Identifier};
use dash_sdk::dpp::data_contract::group::Group;
Expand Down Expand Up @@ -528,7 +527,7 @@ pub async fn get_group_info_with_proof_info(
data_contract_id: &str,
group_contract_position: u32,
) -> Result<JsValue, JsError> {
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;

// Parse data contract ID
let contract_id = Identifier::from_string(
Expand Down Expand Up @@ -568,7 +567,7 @@ pub async fn get_group_infos_with_proof_info(
start_at_info: JsValue,
count: Option<u32>,
) -> Result<JsValue, JsError> {
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;

// Parse contract ID
let contract_id = Identifier::from_string(
Expand Down
9 changes: 2 additions & 7 deletions packages/wasm-sdk/src/queries/identity.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use crate::dpp::IdentityWasm;
use crate::sdk::WasmSdk;
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use dash_sdk::platform::{Fetch, FetchMany, FetchUnproved, Identifier, Identity};
use dash_sdk::platform::{Fetch, FetchMany, Identifier, Identity};
use dash_sdk::dpp::identity::identity_public_key::IdentityPublicKey;
use dash_sdk::dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::{JsError, JsValue};
use serde::{Serialize, Deserialize};
use serde::ser::Serialize as _;
use js_sys::Array;
use rs_dapi_client::IntoInner;
use std::collections::BTreeMap;
use drive_proof_verifier::types::{IdentityPublicKeys, IndexMap};
use dash_sdk::dpp::identity::KeyID;

// Proof info functions are now included below

Expand Down Expand Up @@ -692,13 +689,12 @@ pub async fn get_identities_contract_keys(
sdk: &WasmSdk,
identities_ids: Vec<String>,
contract_id: &str,
document_type_name: Option<String>,
purposes: Option<Vec<u32>>,
) -> Result<JsValue, JsError> {
use dash_sdk::dpp::identity::Purpose;

// Convert string IDs to Identifiers
let identity_ids: Vec<Identifier> = identities_ids
let _identity_ids: Vec<Identifier> = identities_ids
.iter()
.map(|id| Identifier::from_string(
id,
Expand Down Expand Up @@ -1296,7 +1292,6 @@ pub async fn get_identities_contract_keys_with_proof_info(
sdk: &WasmSdk,
identities_ids: Vec<String>,
contract_id: &str,
_document_type_name: Option<String>,
purposes: Option<Vec<u32>>,
) -> Result<JsValue, JsError> {
use dash_sdk::dpp::identity::Purpose;
Expand Down
3 changes: 1 addition & 2 deletions packages/wasm-sdk/src/queries/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::sdk::WasmSdk;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::{JsError, JsValue};
use serde::{Serialize, Deserialize};
use serde::ser::Serialize as _;

#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -108,7 +107,7 @@ pub async fn get_protocol_version_upgrade_vote_status(
pub async fn get_protocol_version_upgrade_state_with_proof_info(sdk: &WasmSdk) -> Result<JsValue, JsError> {
use dash_sdk::platform::FetchMany;
use drive_proof_verifier::types::ProtocolVersionVoteCount;
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;

let (upgrade_result, metadata, proof): (drive_proof_verifier::types::ProtocolVersionUpgrades, _, _) = ProtocolVersionVoteCount::fetch_many_with_metadata_and_proof(sdk.as_ref(), (), None)
.await
Expand Down
9 changes: 4 additions & 5 deletions packages/wasm-sdk/src/queries/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::sdk::WasmSdk;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::{JsError, JsValue};
use serde::{Serialize, Deserialize};
use serde::ser::Serialize as _;
use dash_sdk::dpp::core_types::validator_set::v0::ValidatorSetV0Getters;

// Response structures for the gRPC getStatus endpoint
Expand Down Expand Up @@ -596,7 +595,7 @@ pub async fn get_path_elements(
pub async fn get_total_credits_in_platform_with_proof_info(sdk: &WasmSdk) -> Result<JsValue, JsError> {
use dash_sdk::platform::Fetch;
use drive_proof_verifier::types::{TotalCreditsInPlatform as TotalCreditsQuery, NoParamQuery};
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;

let (total_credits_result, metadata, proof) = TotalCreditsQuery::fetch_with_metadata_and_proof(sdk.as_ref(), NoParamQuery {}, None)
.await
Expand Down Expand Up @@ -629,7 +628,7 @@ pub async fn get_prefunded_specialized_balance_with_proof_info(
) -> Result<JsValue, JsError> {
use dash_sdk::platform::{Identifier, Fetch};
use drive_proof_verifier::types::PrefundedSpecializedBalance as PrefundedBalance;
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;

// Parse identity ID
let identity_identifier = Identifier::from_string(
Expand Down Expand Up @@ -666,9 +665,9 @@ pub async fn get_path_elements_with_proof_info(
keys: Vec<String>,
) -> Result<JsValue, JsError> {
use dash_sdk::platform::FetchMany;
use drive_proof_verifier::types::{KeysInPath, Elements};
use drive_proof_verifier::types::KeysInPath;
use dash_sdk::drive::grovedb::Element;
use crate::queries::{ProofMetadataResponse, ResponseMetadata, ProofInfo};
use crate::queries::ProofMetadataResponse;

// Convert string path to byte vectors
// Path elements can be either numeric values (like "96" for Balances) or string keys
Expand Down
Loading
Loading