Skip to content

Commit

Permalink
update setting of deployTxnHash to handle multiple contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
mjlescano committed Oct 22, 2024
1 parent ad78083 commit 99d9573
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions packages/website/src/hooks/cannon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,24 +230,25 @@ export function useCannonBuildTmp(safe: SafeDefinition | null) {
addLog('info', `cannon.ts: on Events.PostStepExecute operation ${stepName} output: ${JSON.stringify(stepOutput)}`);

// clean out txn hash
for (const txn in stepOutput.txns || {}) {
stepOutput.txns![txn].hash = '';
for (const txn of Object.values(stepOutput.txns || {})) {
if (txn.hash) {
txn.hash = '';
}
}

// clean out deploy txn hash
if (result.contracts) {
const contractKey = Object.keys(result.contracts)[0];
if (result.contracts[contractKey]?.deployTxnHash) {
result.contracts[contractKey].deployTxnHash = '';
// clean out deploy txn deploy hash
for (const contractData of Object.values(result.contracts || {})) {
if (contractData.deployTxnHash) {
contractData.deployTxnHash = '';
}
}

// clean out deploy txn hash
if (result.imports) {
const stepKey = Object.keys(result.imports)[0];
const contractKey = Object.keys(result.imports[stepKey].contracts || {})[0];
if (result.imports[stepKey].contracts?.[contractKey]?.deployTxnHash) {
result.imports[stepKey].contracts[contractKey].deployTxnHash = '';
// clean out deploy txn deploy hash
for (const importData of Object.values(result.imports || {})) {
for (const contractData of Object.values(importData.contracts || {})) {
if (contractData.deployTxnHash) {
contractData.deployTxnHash = '';
}
}
}

Expand Down

0 comments on commit 99d9573

Please sign in to comment.