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.

66 lines 3.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAccounts = getAccounts; const toolshed_1 = require("@graphprotocol/toolshed"); const hardhat_1 = require("@graphprotocol/toolshed/hardhat"); function getAccounts(provider, chainId, grtTokenAddress) { return { getAccounts: async () => { const accounts = await (0, toolshed_1.getAccounts)(provider); for (const account of Object.values(accounts)) { if (typeof account === 'object' && 'address' in account) { await setBalanceIfLocal(provider, chainId, grtTokenAddress, account); } else if (Array.isArray(account)) { for (const testAccount of account) { await setBalanceIfLocal(provider, chainId, grtTokenAddress, testAccount); } } } return accounts; }, getDeployer: async (accountIndex) => { const account = await (0, toolshed_1.getDeployer)(provider, accountIndex); await setBalanceIfLocal(provider, chainId, grtTokenAddress, account); return account; }, getGovernor: async (accountIndex) => { const account = await (0, toolshed_1.getGovernor)(provider, accountIndex); await setBalanceIfLocal(provider, chainId, grtTokenAddress, account); return account; }, getArbitrator: async (accountIndex) => { const account = await (0, toolshed_1.getArbitrator)(provider, accountIndex); await setBalanceIfLocal(provider, chainId, grtTokenAddress, account); return account; }, getPauseGuardian: async (accountIndex) => { const account = await (0, toolshed_1.getPauseGuardian)(provider, accountIndex); await setBalanceIfLocal(provider, chainId, grtTokenAddress, account); return account; }, getSubgraphAvailabilityOracle: async (accountIndex) => { const account = await (0, toolshed_1.getSubgraphAvailabilityOracle)(provider, accountIndex); await setBalanceIfLocal(provider, chainId, grtTokenAddress, account); return account; }, getGateway: async (accountIndex) => { const account = await (0, toolshed_1.getGateway)(provider, accountIndex); await setBalanceIfLocal(provider, chainId, grtTokenAddress, account); return account; }, getTestAccounts: async () => { const accounts = await (0, toolshed_1.getTestAccounts)(provider); for (const account of accounts) { await setBalanceIfLocal(provider, chainId, grtTokenAddress, account); } return accounts; }, }; } async function setBalanceIfLocal(provider, chainId, grtTokenAddress, account) { if (grtTokenAddress && [1337, 31337].includes(chainId)) { await (0, hardhat_1.setGRTBalance)(provider, grtTokenAddress, account.address, toolshed_1.TEN_MILLION); } } //# sourceMappingURL=accounts.js.map