Skip to content

Commit 2701667

Browse files
committed
refactor: adapt explorer to new unstable implementation in WASM client
1 parent 76e14c7 commit 2701667

File tree

1 file changed

+10
-7
lines changed
  • mithril-explorer/src/components/CertifyCardanoTransactionsModal

1 file changed

+10
-7
lines changed

mithril-explorer/src/components/CertifyCardanoTransactionsModal/index.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,17 @@ export default function CertifyCardanoTransactionsModal({
9797
}, [client, currentStep, transactionsProofs, certificate]);
9898

9999
async function buildClient(aggregator, genesisKey) {
100-
const client = new MithrilClient(aggregator, genesisKey);
100+
const client = new MithrilClient(aggregator, genesisKey, {
101+
// The following option activates the unstable features of the client.
102+
// Unstable features will trigger an error if this option is not set.
103+
unstable: true,
104+
});
101105
setClient(client);
102106
return client;
103107
}
104108

105109
async function getTransactionsProofsAndCertificate(client, transactionHashes) {
106-
const proofs = await client.unstable.get_cardano_transaction_proofs(transactionHashes);
110+
const proofs = await client.get_cardano_transaction_proofs(transactionHashes);
107111
const certificate = await client.get_mithril_certificate(proofs.certificate_hash);
108112

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

113117
async function verifyTransactionProofAgainstCertificate(client, transactionsProofs, certificate) {
114118
// Verify proof validity if so get its protocol message
115-
const protocolMessage =
116-
await client.unstable.verify_cardano_transaction_proof_then_compute_message(
117-
transactionsProofs,
118-
certificate,
119-
);
119+
const protocolMessage = await client.verify_cardano_transaction_proof_then_compute_message(
120+
transactionsProofs,
121+
certificate,
122+
);
120123
const isProofValid =
121124
(await client.verify_message_match_certificate(protocolMessage, certificate)) === true;
122125

0 commit comments

Comments
 (0)