Skip to content

Commit

Permalink
feat(wasm-dpp): add entropy getter for document transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
pshenmic committed Dec 26, 2024
1 parent 711463a commit bab0359
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ impl DocumentCreateTransitionWasm {
INITIAL_REVISION as u32
}

#[wasm_bindgen(js_name = getEntropy)]
pub fn get_entropy(&self) -> Vec<u8> {
Vec::from(self.inner.entropy())
}

#[wasm_bindgen(js_name=getIdentityContractNonce)]
pub fn get_identity_contract_nonce(&self) -> u64 {
self.inner.base().identity_contract_nonce() as u64

Check warning on line 93 in packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs

View workflow job for this annotation

GitHub Actions / Rust packages (wasm-dpp) / Linting

casting to the same type is unnecessary (`u64` -> `u64`)

warning: casting to the same type is unnecessary (`u64` -> `u64`) --> packages/wasm-dpp/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs:93:9 | 93 | self.inner.base().identity_contract_nonce() as u64 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.inner.base().identity_contract_nonce()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ impl DocumentDeleteTransitionWasm {
self.inner.base().document_type_name().clone()
}

#[wasm_bindgen(js_name = getEntropy)]
pub fn get_entropy(&self) -> Vec<u8> {
Vec::from(self.inner.entropy())
}

#[wasm_bindgen(js_name=getDataContractId)]
pub fn data_contract_id(&self) -> IdentifierWrapper {
self.inner.base().data_contract_id().into()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ impl DocumentReplaceTransitionWasm {
self.inner.revision()
}

#[wasm_bindgen(js_name = getEntropy)]
pub fn get_entropy(&self) -> Vec<u8> {
Vec::from(self.inner.entropy())
}

#[wasm_bindgen(js_name=getUpdatedAt)]
pub fn updated_at(&self) -> Option<js_sys::Date> {
self.inner
Expand Down

0 comments on commit bab0359

Please sign in to comment.