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): package.contracts #1702

Merged
merged 1 commit into from
Feb 18, 2025
Merged
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
17 changes: 9 additions & 8 deletions packages/website/src/features/Packages/DeploymentExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useRouter, usePathname } from 'next/navigation';
import ContractsTab from './Tabs/ContractsTab';
import FunctionCallsTab from './Tabs/FunctionCallsTab';
import EventDataTab from './Tabs/EventDataTab';
import isPlainObject from 'lodash/isPlainObject';

export const DeploymentExplorer: FC<{
pkg: ApiPackage;
Expand Down Expand Up @@ -40,16 +41,16 @@ export const DeploymentExplorer: FC<{
function mergeArtifactsContracts(obj: any, mergedContracts: any = {}) {
for (const key in obj) {
const currentArtifact = obj[key];
const address = currentArtifact.address;
const abi = currentArtifact.abi;
const artifacts = currentArtifact.artifacts;
const artifactsImports = artifacts?.imports;

const hasStepDefinition = stepDefinitions.some((step) =>
currentArtifact.deployedOn?.includes(step)
);
if (isPlainObject(currentArtifact)) {
const address = currentArtifact.address;
const abi = currentArtifact.abi;
const artifacts = currentArtifact.artifacts;
const artifactsImports = artifacts?.imports;
const hasStepDefinition = stepDefinitions.some((step) =>
currentArtifact.deployedOn?.includes(step)
);

if (typeof obj[key] === 'object') {
if (address && abi && hasStepDefinition) {
mergedContracts[address] = currentArtifact;
}
Expand Down
Loading