chore: enums for statement and op types (#69)

* Experiment with statement & op enums

* Clean-up & fixes

* More clean-up

* Add argument length checks

* More clean-up

* Place statement and operation logic in submodules
This commit is contained in:
Ahmad Afuni 2025-02-20 19:08:29 +10:00 committed by GitHub
parent 83a4f8969f
commit c2d23b0b1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 891 additions and 606 deletions

View file

@ -1,6 +1,6 @@
use crate::middleware::{
containers::Dictionary, hash_str, AnchoredKey, Hash, NativeStatement, Params, Pod, PodId,
PodSigner, PodType, Statement, StatementArg, Value, KEY_SIGNER, KEY_TYPE,
containers::Dictionary, hash_str, AnchoredKey, Hash, Params, Pod, PodId, PodSigner, PodType,
Statement, Value, KEY_SIGNER, KEY_TYPE,
};
use crate::primitives::merkletree::MerkleTree;
use anyhow::Result;
@ -81,15 +81,7 @@ impl Pod for MockSignedPod {
let id = self.id();
self.dict
.iter()
.map(|(k, v)| {
Statement(
NativeStatement::ValueOf,
vec![
StatementArg::Key(AnchoredKey(id, Hash(k.0))),
StatementArg::Literal(*v),
],
)
})
.map(|(k, v)| Statement::ValueOf(AnchoredKey(id, Hash(k.0)), *v))
.collect()
}