UNPKG

hardhat-graph-protocol

Version:

A hardhat plugin that extends the runtime environment to inject additional functionality related to the usage of the Graph Protocol.

33 lines (29 loc) 1.53 kB
import type { GraphAccounts } from '@graphprotocol/toolshed' import type { GraphDeploymentName, GraphDeployments } from '@graphprotocol/toolshed/deployments' import { GraphDeploymentsList } from '@graphprotocol/toolshed/deployments' import type { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider' import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' export type GraphDeploymentOptions = { [deployment in GraphDeploymentName]?: string } export type GraphRuntimeEnvironmentOptions = { deployments?: GraphDeploymentOptions createAddressBook?: boolean } export type GraphRuntimeEnvironment = GraphDeployments & { provider: HardhatEthersProvider chainId: number accounts: { getAccounts: () => Promise<GraphAccounts> getDeployer: (accountIndex?: number) => Promise<HardhatEthersSigner> getGovernor: (accountIndex?: number) => Promise<HardhatEthersSigner> getArbitrator: (accountIndex?: number) => Promise<HardhatEthersSigner> getPauseGuardian: (accountIndex?: number) => Promise<HardhatEthersSigner> getSubgraphAvailabilityOracle: (accountIndex?: number) => Promise<HardhatEthersSigner> getGateway: (accountIndex?: number) => Promise<HardhatEthersSigner> getTestAccounts: () => Promise<HardhatEthersSigner[]> } } export function isGraphDeployment(deployment: unknown): deployment is GraphDeploymentName { return typeof deployment === 'string' && GraphDeploymentsList.includes(deployment as GraphDeploymentName) }