Skip to content

Commit

Permalink
feat(dpp): move to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
pshenmic committed Dec 27, 2024
1 parent d77e1aa commit e21ae53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub trait DocumentTransitionV0Methods {
/// get the id
fn get_id(&self) -> Identifier;
/// get the entropy
fn entropy(&self) -> Vec<u8>;
fn entropy(&self) -> Option<Vec<u8>>;
fn document_type_name(&self) -> &String;
/// get the data contract id
fn data_contract_id(&self) -> Identifier;
Expand Down Expand Up @@ -168,8 +168,15 @@ impl DocumentTransitionV0Methods for DocumentTransition {
self.base().document_type_name()
}

fn entropy(&self) -> Vec<u8> {
self.entropy()
fn entropy(&self) -> Option<Vec<u8>> {
match self {
DocumentTransition::Create(t) => Some(Vec::from(t.entropy())),
DocumentTransition::Replace(t) => None,

Check warning on line 174 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dpp) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:174:41 | 174 | DocumentTransition::Replace(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t` | = note: `#[warn(unused_variables)]` on by default

Check warning on line 174 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:174:41 | 174 | DocumentTransition::Replace(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t` | = note: `#[warn(unused_variables)]` on by default

Check warning on line 174 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dash-sdk) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:174:41 | 174 | DocumentTransition::Replace(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t` | = note: `#[warn(unused_variables)]` on by default

Check warning on line 174 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

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

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:174:41 | 174 | DocumentTransition::Replace(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t` | = note: `#[warn(unused_variables)]` on by default

Check warning on line 174 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive-abci) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:174:41 | 174 | DocumentTransition::Replace(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t` | = note: `#[warn(unused_variables)]` on by default
DocumentTransition::Delete(t) => None,

Check warning on line 175 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dpp) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:175:40 | 175 | DocumentTransition::Delete(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 175 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:175:40 | 175 | DocumentTransition::Delete(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 175 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dash-sdk) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:175:40 | 175 | DocumentTransition::Delete(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 175 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

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

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:175:40 | 175 | DocumentTransition::Delete(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 175 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive-abci) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:175:40 | 175 | DocumentTransition::Delete(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`
DocumentTransition::Transfer(t) => None,

Check warning on line 176 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dpp) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:176:42 | 176 | DocumentTransition::Transfer(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 176 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:176:42 | 176 | DocumentTransition::Transfer(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 176 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dash-sdk) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:176:42 | 176 | DocumentTransition::Transfer(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 176 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

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

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:176:42 | 176 | DocumentTransition::Transfer(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 176 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive-abci) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:176:42 | 176 | DocumentTransition::Transfer(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`
DocumentTransition::UpdatePrice(t) => None,

Check warning on line 177 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dpp) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:177:45 | 177 | DocumentTransition::UpdatePrice(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 177 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:177:45 | 177 | DocumentTransition::UpdatePrice(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 177 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dash-sdk) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:177:45 | 177 | DocumentTransition::UpdatePrice(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 177 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

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

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:177:45 | 177 | DocumentTransition::UpdatePrice(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 177 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive-abci) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:177:45 | 177 | DocumentTransition::UpdatePrice(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`
DocumentTransition::Purchase(t) => None,

Check warning on line 178 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dpp) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:178:42 | 178 | DocumentTransition::Purchase(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 178 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:178:42 | 178 | DocumentTransition::Purchase(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 178 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dash-sdk) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:178:42 | 178 | DocumentTransition::Purchase(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 178 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

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

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:178:42 | 178 | DocumentTransition::Purchase(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`

Check warning on line 178 in packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (drive-abci) / Linting

unused variable: `t`

warning: unused variable: `t` --> packages/rs-dpp/src/state_transition/state_transitions/document/documents_batch_transition/document_transition/mod.rs:178:42 | 178 | DocumentTransition::Purchase(t) => None, | ^ help: if this is intentional, prefix it with an underscore: `_t`
}
}

fn data_contract_id(&self) -> Identifier {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl DocumentTransitionWasm {
}
}
#[wasm_bindgen(js_name=getEntropy)]
pub fn get_entropy(&self) -> Vec<u8> {
pub fn get_entropy(&self) -> Option<Vec<u8>> {
self.0.entropy()
}

Expand Down

0 comments on commit e21ae53

Please sign in to comment.