Skip to content

Commit

Permalink
refactor(run-live.ts): replace hash() method with hash property for b…
Browse files Browse the repository at this point in the history
…etter readability and performance

fix(run-live.ts): correct the usage of hash in console.log statements to ensure accurate transaction hash display
  • Loading branch information
MartinMinkov committed Feb 21, 2024
1 parent 638f42a commit e12d29e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/examples/zkapps/dex/run-live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,10 @@ function logPendingTransaction(pendingTx: Mina.PendingTransaction) {
console.log(
'tx sent: ' +
(useCustomLocalNetwork
? `file://${os.homedir()}/.cache/zkapp-cli/lightnet/explorer/<version>/index.html?target=transaction&hash=${pendingTx.hash()}`
: `https://minascan.io/berkeley/tx/${pendingTx.hash()}?type=zk-tx`)
? `file://${os.homedir()}/.cache/zkapp-cli/lightnet/explorer/<version>/index.html?target=transaction&hash=${
pendingTx.hash
}`
: `https://minascan.io/berkeley/tx/${pendingTx.hash}?type=zk-tx`)
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/examples/zkapps/hello-world/run-live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ let transaction = await Mina.transaction(
transaction.sign([senderKey, zkAppKey]);
console.log('Sending the transaction.');
let pendingTx = await transaction.send();
if (pendingTx.hash() !== undefined) {
if (pendingTx.hash !== undefined) {
console.log(`Success! Deploy transaction sent.
Your smart contract will be deployed
as soon as the transaction is included in a block.
Txn hash: ${pendingTx.hash()}`);
Txn hash: ${pendingTx.hash}`);
}
console.log('Waiting for transaction inclusion in a block.');
await pendingTx.wait({ maxAttempts: 90 });
Expand All @@ -77,11 +77,11 @@ transaction = await Mina.transaction({ sender, fee: transactionFee }, () => {
await transaction.sign([senderKey]).prove();
console.log('Sending the transaction.');
pendingTx = await transaction.send();
if (pendingTx.hash() !== undefined) {
if (pendingTx.hash !== undefined) {
console.log(`Success! Update transaction sent.
Your smart contract state will be updated
as soon as the transaction is included in a block.
Txn hash: ${pendingTx.hash()}`);
Txn hash: ${pendingTx.hash}`);
}
console.log('Waiting for transaction inclusion in a block.');
await pendingTx.wait({ maxAttempts: 90 });
Expand Down

0 comments on commit e12d29e

Please sign in to comment.