Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(website): CAN-602 #1488

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions packages/website/src/features/Deploy/QueueFromGitOpsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -930,10 +930,18 @@ export default function QueueFromGitOps() {
>
{deployer.queuedTransactions.length === 0 ? (
<VStack>
<Text color="gray.300" mb="4">
Some transactions should be executed outside the safe
before staging. You can execute these now in your browser.
By clicking the button below.
<Text color="gray.300">
The following steps should be executed outside the safe
before staging.
{buildState.result?.deployerSteps.map((s) => (
<Text color="gray.300" ml="2" key={s.name}>
- {s.name}
</Text>
))}
<Text color="gray.300" mb="4">
You can execute these now in your browser. By clicking
the button below.
</Text>
</Text>
<Button
onClick={() =>
Expand Down Expand Up @@ -984,7 +992,7 @@ export default function QueueFromGitOps() {
stager.safeTxn && (
<Box mt="4" mb="4">
<Heading size="sm" mb={2}>
Transactions
Safe Transactions:
</Heading>
{buildState.result?.safeSteps.length === 0 ? (
<AlertCannon borderless status="info">
Expand Down
45 changes: 35 additions & 10 deletions packages/website/src/hooks/cannon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
PackageReference,
publishPackage,
findUpgradeFromPackage,
ChainBuilderContext,
} from '@usecannon/builder';
import _ from 'lodash';
import { useEffect, useReducer, useState } from 'react';
Expand Down Expand Up @@ -215,20 +216,44 @@ export function useCannonBuildTmp(safe: SafeDefinition | null) {

const skippedSteps: StepExecutionError[] = [];

currentRuntime.on(Events.PostStepExecute, (stepType: string, stepLabel: string, stepOutput: ChainArtifacts) => {
const stepName = `${stepType}.${stepLabel}`;
currentRuntime.on(
Events.PostStepExecute,
(
stepType: string,
stepLabel: string,
stepOutput: ChainArtifacts,
_ctx: ChainBuilderContext,
result: ChainArtifacts
) => {
const stepName = `${stepType}.${stepLabel}`;

addLog('info', `cannon.ts: on Events.PostStepExecute operation ${stepName} output: ${JSON.stringify(stepOutput)}`);

//simulatedSteps.push(_.cloneDeep(stepOutput));
addLog('info', `cannon.ts: on Events.PostStepExecute operation ${stepName} output: ${JSON.stringify(stepOutput)}`);

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

dispatch({ message: `Building ${stepName}...` });
});
// 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 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 = '';
}
}

dispatch({ message: `Building ${stepName}...` });
}
);

currentRuntime.on(Events.SkipDeploy, (stepName: string, err: Error) => {
addLog('error', `cannon.ts: on Events.SkipDeploy error ${err.toString()} happened on the operation ${stepName}`);
Expand Down
Loading