Skip to content

Commit

Permalink
refactor(dataverse)!: rename the metadata field to claims (SubmitClaims)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Aug 7, 2024
1 parent 18e2930 commit 0febba9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
25 changes: 12 additions & 13 deletions contracts/axone-dataverse/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ pub fn execute(
) -> Result<Response, ContractError> {
nonpayable(&info)?;
match msg {
ExecuteMsg::SubmitClaims {
metadata,
format: _,
} => execute::submit_claims(deps, info, metadata),
ExecuteMsg::SubmitClaims { claims, format: _ } => {
execute::submit_claims(deps, info, claims)
}
_ => Err(StdError::generic_err("Not implemented").into()),
}
}
Expand All @@ -94,9 +93,9 @@ pub mod execute {
pub fn submit_claims(
deps: DepsMut<'_>,
info: MessageInfo,
data: Binary,
claims: Binary,
) -> Result<Response, ContractError> {
let buf = BufReader::new(data.as_slice());
let buf = BufReader::new(claims.as_slice());
let mut reader = NQuadsReader::new(buf);
let rdf_quads = reader.read_all()?;
let vc_dataset = Dataset::from(rdf_quads.as_slice());
Expand Down Expand Up @@ -275,7 +274,7 @@ mod tests {
let info = message_info(&addr(SENDER), &coins(10, "uaxone"));

let msg = ExecuteMsg::SubmitClaims {
metadata: Binary::from("data".as_bytes()),
claims: Binary::from("data".as_bytes()),
format: Some(RdfDatasetFormat::NQuads),
};

Expand Down Expand Up @@ -345,7 +344,7 @@ mod tests {
&[],
),
ExecuteMsg::SubmitClaims {
metadata: Binary::new(read_test_data("vc-eddsa-2020-ok.nq")),
claims: Binary::new(read_test_data("vc-eddsa-2020-ok.nq")),
format: Some(RdfDatasetFormat::NQuads),
},
);
Expand Down Expand Up @@ -410,7 +409,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
&[],
),
ExecuteMsg::SubmitClaims {
metadata: Binary::new("notrdf".as_bytes().to_vec()),
claims: Binary::new("notrdf".as_bytes().to_vec()),
format: Some(RdfDatasetFormat::NQuads),
},
);
Expand All @@ -429,7 +428,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
&[],
),
ExecuteMsg::SubmitClaims {
metadata: Binary::new(vec![]),
claims: Binary::new(vec![]),
format: Some(RdfDatasetFormat::NQuads),
},
);
Expand All @@ -451,7 +450,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
&[],
),
ExecuteMsg::SubmitClaims {
metadata: Binary::new(read_test_data("vc-eddsa-2020-ok-unsecured.nq")),
claims: Binary::new(read_test_data("vc-eddsa-2020-ok-unsecured.nq")),
format: Some(RdfDatasetFormat::NQuads),
},
);
Expand All @@ -473,7 +472,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
&[],
),
ExecuteMsg::SubmitClaims {
metadata: Binary::new(read_test_data("vc-unsupported-1.nq")),
claims: Binary::new(read_test_data("vc-unsupported-1.nq")),
format: Some(RdfDatasetFormat::NQuads),
},
);
Expand Down Expand Up @@ -524,7 +523,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
&[],
),
ExecuteMsg::SubmitClaims {
metadata: Binary::new(read_test_data("vc-eddsa-2020-ok.nq")),
claims: Binary::new(read_test_data("vc-eddsa-2020-ok.nq")),
format: Some(RdfDatasetFormat::NQuads),
},
);
Expand Down
8 changes: 4 additions & 4 deletions contracts/axone-dataverse/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ pub enum ExecuteMsg {
/// - `DataIntegrity` with the following cryptosuites: `eddsa-2022`, `eddsa-rdfc-2022`.
///
SubmitClaims {
/// The serialized metadata intended for attachment.
/// This metadata should adhere to the format specified in the `format` field.
metadata: Binary,
/// RDF dataset serialization format for the metadata.
/// The Verifiable Credential containing the claims.
/// The claims must be serialized in the format specified by the `format` field.
claims: Binary,
/// RDF dataset serialization format for the claims.
/// If not provided, the default format is [N-Quads](https://www.w3.org/TR/n-quads/) format.
format: Option<RdfDatasetFormat>,
},
Expand Down

0 comments on commit 0febba9

Please sign in to comment.