Skip to content

Commit

Permalink
refactor: adapt explorer to new unstable implementation in WASM client
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed Sep 4, 2024
1 parent 76e14c7 commit 2701667
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,17 @@ export default function CertifyCardanoTransactionsModal({
}, [client, currentStep, transactionsProofs, certificate]);

async function buildClient(aggregator, genesisKey) {
const client = new MithrilClient(aggregator, genesisKey);
const client = new MithrilClient(aggregator, genesisKey, {
// The following option activates the unstable features of the client.
// Unstable features will trigger an error if this option is not set.
unstable: true,
});
setClient(client);
return client;
}

async function getTransactionsProofsAndCertificate(client, transactionHashes) {
const proofs = await client.unstable.get_cardano_transaction_proofs(transactionHashes);
const proofs = await client.get_cardano_transaction_proofs(transactionHashes);
const certificate = await client.get_mithril_certificate(proofs.certificate_hash);

setTransactionsProofs(proofs);
Expand All @@ -112,11 +116,10 @@ export default function CertifyCardanoTransactionsModal({

async function verifyTransactionProofAgainstCertificate(client, transactionsProofs, certificate) {
// Verify proof validity if so get its protocol message
const protocolMessage =
await client.unstable.verify_cardano_transaction_proof_then_compute_message(
transactionsProofs,
certificate,
);
const protocolMessage = await client.verify_cardano_transaction_proof_then_compute_message(
transactionsProofs,
certificate,
);
const isProofValid =
(await client.verify_message_match_certificate(protocolMessage, certificate)) === true;

Expand Down

0 comments on commit 2701667

Please sign in to comment.