You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use the plugin you'll need to configure the target networks. We recommend using our base hardhat configuration which can be imported from `@graphprotocol/toolshed`:
@@ -40,12 +41,14 @@ export default config // or just "export default hardhatBaseConfig"
40
41
```
41
42
42
43
### Manual configuration
44
+
43
45
To manually configure target networks:
44
46
45
47
**Hardhat: Network config**
48
+
46
49
```ts
47
50
networks: {
48
-
arbitrumOne: {
51
+
arbitrumOne: {
49
52
chainId: 42161,
50
53
url: `https://arbitrum-one.infura.io/v3/123456`
51
54
deployments: {
@@ -55,6 +58,7 @@ To manually configure target networks:
55
58
},
56
59
}
57
60
```
61
+
58
62
**Hardhat: Graph config**
59
63
60
64
Additionally, the plugin adds a new config field to hardhat's config file: `graph`. This can be used used to define defaults for all networks:
@@ -86,10 +90,10 @@ The interface for the graph object can be found [here](src/types.ts), it's expan
86
90
```ts
87
91
exporttypeGraphRuntimeEnvironment= {
88
92
[deploymentName]: {
89
-
contracts:DeploymentContractsType,
90
-
addressBook:DeploymentAddressBookType,
93
+
contracts:DeploymentContractsType
94
+
addressBook:DeploymentAddressBookType
91
95
actions:DeplyomentActionsType
92
-
},
96
+
}
93
97
provider:HardhatEthersProvider
94
98
chainId:number
95
99
accounts: {
@@ -110,26 +114,31 @@ export type GraphRuntimeEnvironment = {
110
114
The plugin provides one object for each configured deployment, this object allows easily interacting with the associated deployment with a few additional features. The current deployments that are supported: `horizon` and `subgraphService`.
111
115
112
116
Each deployment will be of the form:
117
+
113
118
```ts
114
119
[deploymentName]: {
115
120
contracts:DeploymentContractsType,
116
121
addressBook:DeploymentAddressBookType,
117
122
actions:DeplyomentActionsType
118
123
},
119
124
```
125
+
120
126
Where:
127
+
121
128
- `contracts`: an object with all the contracts available in the deployment, already instanced, fully typed and ready to go.
122
129
- `addressBook`: an object allowing read and write access to the deployment's address book.
123
130
- `actions`: (optional) an object with helper functions to perform common actions in the associated deployment.
124
131
125
132
**Transaction logging**
126
133
127
134
Any transactions made using the `contracts` object will be automatically logged both to the console and to a file:
135
+
128
136
- `file`, in the project's root directory: `tx-YYYY-MM-DD.log`
129
137
- `console`, not shown by default. Run with `DEBUG=toolshed:tx` to enable them.
130
138
131
139
Note that this does not apply to getter functions (`view` or `pure`) as those are not state modifying calls.
__Note__ Transaction logging requires using js Proxy which strips down some type definitions from contract methods. This means that when transaction logging is enabled `contract.functionName.estimateGas` for example will not be available.
157
+
**Note** Transaction logging requires using js Proxy which strips down some type definitions from contract methods. This means that when transaction logging is enabled `contract.functionName.estimateGas` for example will not be available.
|`getAccounts()`| Returns all the accounts listed below | -|
215
+
|`getDeployer()`| Returns the deployer signer | 0|
216
+
|`getGovernor()`| Returns the governor signer | 1|
217
+
|`getArbitrator()`| Returns the arbitrator signer | 2|
218
+
|`getPauseGuardian()`| Returns the pause guardian signer | 3|
219
+
|`getSubgraphAvailabilityOracle()`| Returns a service provider signer | 4|
220
+
|`getGateway()`| Returns the gateway signer | 5|
221
+
|`getTestAccounts()`| Returns the test signers | 6-20|
211
222
212
223
Note that these are just helper functions to enforce a convention on which index to use for each account. These might not match what is configured in the target protocol deployment.
0 commit comments