Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mjlescano committed Oct 7, 2024
1 parent 8dd8957 commit 864bebb
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 26 deletions.
30 changes: 15 additions & 15 deletions packages/builder/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import _ from 'lodash';
import * as viem from 'viem';
import * as viemUtils from 'viem/utils';
import * as viemNumbers from 'viem/constants/number';
import * as viemAddresses from 'viem/constants/address';
import * as viemBytes from 'viem/constants/bytes';
import { Abi, Address, Hash, Hex, SendTransactionParameters } from 'viem';

import _ from 'lodash';
import { PackageReference } from './package-reference';

import type { RawChainDefinition } from './actions';

import { PackageReference } from './package-reference';

// loosely based on the hardhat `Artifact` type
export type ContractArtifact = {
contractName: string;
sourceName: string;
abi: Abi;
bytecode: Hex;
abi: viem.Abi;
bytecode: viem.Hex;
deployedBytecode: string;
linkReferences: {
[fileName: string]: {
Expand All @@ -33,8 +30,8 @@ export type ContractArtifact = {
};

export type ContractData = {
address: Address;
abi: Abi;
address: viem.Address;
abi: viem.Abi;
constructorArgs?: any[]; // only needed for external verification
linkedLibraries?: { [sourceName: string]: { [libName: string]: string } }; // only needed for external verification
deployTxnHash: string;
Expand All @@ -54,7 +51,7 @@ export type ContractMap = {

export type TransactionMap = {
[label: string]: {
hash: Hash | '';
hash: viem.Hash | '';
blockNumber?: string;
timestamp?: string;
events: EventMap;
Expand Down Expand Up @@ -164,14 +161,14 @@ const ethersStyleConstants = {
decodeFunctionData: viem.decodeFunctionData,
encodeFunctionResult: viem.encodeFunctionResult,
decodeFunctionResult: viem.decodeFunctionResult,
}
};

export const CannonHelperContext = {
...viemUtils,
...viemNumbers,
...viemAddresses,
...viemBytes,
...ethersStyleConstants
...ethersStyleConstants,
};

export type ChainBuilderContextWithHelpers = ChainBuilderContext & typeof CannonHelperContext;
Expand All @@ -180,7 +177,7 @@ export type BuildOptions = { [val: string]: string };

export type StorageMode = 'all' | 'metadata' | 'none';

export type CannonSigner = { wallet: viem.WalletClient; address: Address };
export type CannonSigner = { wallet: viem.WalletClient; address: viem.Address };

export type Contract = Pick<viem.SimulateContractParameters, 'abi' | 'address'>;

Expand All @@ -195,7 +192,10 @@ export interface ChainBuilderRuntimeInfo {
getSigner: (addr: viem.Address) => Promise<CannonSigner>;

// returns a signer which should be used for sending the specified transaction.
getDefaultSigner?: (txn: Omit<SendTransactionParameters, 'account' | 'chain'>, salt?: string) => Promise<CannonSigner>;
getDefaultSigner?: (
txn: Omit<viem.SendTransactionParameters, 'account' | 'chain'>,
salt?: string
) => Promise<CannonSigner>;

// returns contract information from the specified artifact name.
getArtifact?: (name: string) => Promise<ContractArtifact>;
Expand Down Expand Up @@ -313,7 +313,7 @@ export type StepState = {
artifacts: ChainArtifacts;

// If this is a cannon network build, the full dump of the chain blob is recorded
chainDump?: Hex | null; // only included if cannon network build
chainDump?: viem.Hex | null; // only included if cannon network build
};

export type DeploymentState = { [label: string]: StepState };
Expand Down
41 changes: 30 additions & 11 deletions packages/website/src/features/Docs/DocsCannonfilesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,22 +326,41 @@ export const DocsCannonfilesPage: FC = () => {
templates
</Link>{' '}
like
<Code>name=&lt;%= settings.name %&gt;</Code>). The templates can also use{' '}
<Link href="https://github.com/wevm/viem/tree/main/src/utils" isExternal>
<Code>name=&lt;%= settings.name %&gt;</Code>). The templates can
also use{' '}
<Link
href="https://github.com/wevm/viem/tree/main/src/utils"
isExternal
>
utilities
</Link>,{' '}
<Link href="https://github.com/wevm/viem/blob/main/src/constants/number.ts" isExternal>
</Link>
,{' '}
<Link
href="https://github.com/wevm/viem/blob/main/src/constants/number.ts"
isExternal
>
number constants
</Link>, and{' '}
<Link href="https://github.com/wevm/viem/blob/main/src/constants/address.ts" isExternal>
</Link>
, and{' '}
<Link
href="https://github.com/wevm/viem/blob/main/src/constants/address.ts"
isExternal
>
some
</Link>{' '}
<Link href="https://github.com/wevm/viem/blob/main/src/constants/bytes.ts" isExternal>
<Link
href="https://github.com/wevm/viem/blob/main/src/constants/bytes.ts"
isExternal
>
others
</Link>{' '}
from <Link href="https://viem.sh/" isExternal>viem</Link>. The objects are
also passed into cannonfiles that reference them with the{' '}
<Code>pull</Code> and <Code>clone</Code> operations.
from{' '}
<Link href="https://viem.sh/" isExternal>
viem
</Link>
. The objects are also passed into cannonfiles that reference
them with the <Code>pull</Code> and <Code>clone</Code>{' '}
operations.
</Text>
<Text mb={4}>
Packages that result from <Code>build</Code>s consist of three
Expand Down Expand Up @@ -801,4 +820,4 @@ export const DocsCannonfilesPage: FC = () => {
</Flex>
</Flex>
);
};
};

0 comments on commit 864bebb

Please sign in to comment.