hardhat-deploy 2.0.0-next.39 → 2.0.0-next.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -17
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -49,8 +49,8 @@ Before going into the details, here is a very simple summary of the basic featur
|
|
|
49
49
|
**hardhat-deploy** allows you to write [`deploy scripts`](#deploy-scripts) in the `deploy` folder. Each of these files that look as follows will be executed in turn when you execute the following task: `hardhat --network <networkName> deploy`
|
|
50
50
|
|
|
51
51
|
```js
|
|
52
|
-
// we import what we need from the
|
|
53
|
-
import { deployScript, artifacts } from "
|
|
52
|
+
// we import what we need from the #rocketh alias, see below for setup
|
|
53
|
+
import { deployScript, artifacts } from "#rocketh";
|
|
54
54
|
|
|
55
55
|
export default deployScript(
|
|
56
56
|
// this allow us to define our deploy function which takes as first argument an environment object
|
|
@@ -125,16 +125,28 @@ Then you need import them in your deploy script.
|
|
|
125
125
|
|
|
126
126
|
But we recommend you import them in one location that you then import in your deploy script so you can share it to all of them.
|
|
127
127
|
|
|
128
|
-
We recommend to
|
|
128
|
+
We recommend to actually use the `rocketh.ts/js` config file to do that in one place.
|
|
129
|
+
We also recommend you setup an alias for it so you can import with `import .. from "#rocketh"` it from anywhere:
|
|
130
|
+
You can set it up by settings imports in `package.json`
|
|
129
131
|
|
|
130
|
-
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
...
|
|
136
|
+
"imports": {
|
|
137
|
+
"#rocketh": "./rocketh.js",
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Alternatively if you use typescript, you can instead use `tsconfig.json`
|
|
131
143
|
|
|
132
144
|
```json
|
|
133
145
|
{
|
|
134
146
|
"compilerOptions": {
|
|
135
147
|
...
|
|
136
148
|
"paths": {
|
|
137
|
-
"
|
|
149
|
+
"#rocketh": ["./rocketh.ts"]
|
|
138
150
|
}
|
|
139
151
|
}
|
|
140
152
|
}
|
|
@@ -163,27 +175,33 @@ export const config = {
|
|
|
163
175
|
// we add here the extension we need, so that they are available in the deploy scripts
|
|
164
176
|
// extensions are simply function that accept as their first argument the Environment
|
|
165
177
|
// by passing them to the setup function (see below) you get to access them trhough the environment object with type-safety
|
|
166
|
-
import * as
|
|
178
|
+
import * as deployExtensions from '@rocketh/deploy'; // this one provide a deploy function
|
|
167
179
|
import * as readExecuteFunctions from '@rocketh/read-execute'; // this one provide read,execute functions
|
|
168
|
-
const
|
|
180
|
+
const extensions = {...deployExtensions, ...readExecuteExtensions};
|
|
169
181
|
// ------------------------------------------------------------------------------------------------
|
|
170
182
|
// we re-export the artifacts, so they are easily available from the alias
|
|
171
183
|
import artifacts from './generated/artifacts.js';
|
|
172
184
|
export {artifacts};
|
|
173
185
|
// ------------------------------------------------------------------------------------------------
|
|
174
|
-
// we
|
|
186
|
+
// we create the rocketh function we need by passing the extensions
|
|
175
187
|
import {setup} from 'rocketh';
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
188
|
+
const {deployScript, loadAndExecuteDeployments} = setup<typeof extensions, typeof config.accounts, typeof config.data>(
|
|
189
|
+
extensions,
|
|
190
|
+
);
|
|
191
|
+
// ------------------------------------------------------------------------------------------------
|
|
192
|
+
// we do the same for hardhat-deploy
|
|
193
|
+
import {setupHardhatDeploy} from 'hardhat-deploy/helpers';
|
|
194
|
+
const {loadEnvironmentFromHardhat} = setupHardhatDeploy(extensions);
|
|
195
|
+
// ------------------------------------------------------------------------------------------------
|
|
196
|
+
// finally we export them
|
|
197
|
+
export {loadAndExecuteDeployments, deployScript, loadEnvironmentFromHardhat};
|
|
180
198
|
```
|
|
181
199
|
|
|
182
200
|
You can them create a deploy script in the `deploy` folder like so:
|
|
183
201
|
|
|
184
202
|
```typescript
|
|
185
|
-
// we import what we need from the
|
|
186
|
-
import { deployScript, artifacts } from "
|
|
203
|
+
// we import what we need from the #rocketh alias, see ../rocketh.ts
|
|
204
|
+
import { deployScript, artifacts } from "#rocketh";
|
|
187
205
|
|
|
188
206
|
export default deployScript(
|
|
189
207
|
async ({ deploy, namedAccounts }) => {
|
|
@@ -234,8 +252,8 @@ and you would have configuraiton in hardhat.config.ts
|
|
|
234
252
|
in v2 you will do this instead:
|
|
235
253
|
|
|
236
254
|
```typescript
|
|
237
|
-
/// we import what we need from the
|
|
238
|
-
import { deployScript, artifacts } from "
|
|
255
|
+
/// we import what we need from the #rocketh alias, see ../rocketh.ts
|
|
256
|
+
import { deployScript, artifacts } from "#rocketh";
|
|
239
257
|
|
|
240
258
|
export default deployScript(
|
|
241
259
|
async ({ deploy, namedAccounts }) => {
|
|
@@ -531,7 +549,7 @@ The execute expect as first argument a function
|
|
|
531
549
|
For example this script will deploy the `GreetingsRegistry` contract
|
|
532
550
|
|
|
533
551
|
```typescript
|
|
534
|
-
import { deployScript, artifacts } from "
|
|
552
|
+
import { deployScript, artifacts } from "#rocketh";
|
|
535
553
|
export default deployScript(
|
|
536
554
|
async ({ deploy, namedAccounts }) => {
|
|
537
555
|
const { deployer } = namedAccounts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hardhat-deploy",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.40",
|
|
4
4
|
"description": "deployment plugin for hardhat",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"as-soon": "^0.0.11",
|
|
34
34
|
"hardhat": "3.0.3",
|
|
35
35
|
"rimraf": "^6.0.1",
|
|
36
|
-
"rocketh": "^0.14.
|
|
36
|
+
"rocketh": "^0.14.4",
|
|
37
37
|
"set-defaults": "^0.0.5",
|
|
38
38
|
"typescript": "^5.9.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"hardhat": "^3.0.0",
|
|
42
|
-
"rocketh": "^0.14.
|
|
42
|
+
"rocketh": "^0.14.4"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@nomicfoundation/hardhat-zod-utils": "3.0.0",
|