Skip to content

Commit 50a183a

Browse files
authored
Publish npm module for contract-examples (#663)
* export gingkgo suites * remove precompiles description from ping tests * update package.json * fix url in package json * change package name * prepare for module publishing * use npm ci * preload ethers * nits
1 parent 9dfcf9d commit 50a183a

File tree

9 files changed

+17111
-8194
lines changed

9 files changed

+17111
-8194
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
shell: bash
5353
- run: CURRENT_BRANCH=${{ github.head_ref || github.ref_name }} PUSH_DOCKER_IMAGE=true ./scripts/build_image.sh
5454
shell: bash
55-
55+
5656
e2e_test:
5757
name: e2e tests
5858
runs-on: ubuntu-latest
@@ -68,9 +68,9 @@ jobs:
6868
- name: Use Node.js
6969
uses: actions/setup-node@v3
7070
with:
71-
node-version: "14.x"
72-
- name: Yarn install
73-
run: yarn
71+
node-version: "18.x"
72+
- name: NPM Clean Install
73+
run: npm ci
7474
working-directory: ./contract-examples
7575
- name: Install AvalancheGo Release
7676
shell: bash

contract-examples/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true

contract-examples/README.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@ The goal of this guide is to lay out best practices regarding writing, testing a
1212

1313
## Prerequisites
1414

15-
### NodeJS and Yarn
15+
### NodeJS and NPM
1616

17-
First, install the LTS (long-term support) version of [nodejs](https://nodejs.org/en). This is `16.2.0` at the time of writing. NodeJS bundles `npm`.
18-
19-
Next, install [yarn](https://yarnpkg.com):
20-
21-
```zsh
22-
npm install -g yarn
23-
```
17+
First, install the LTS (long-term support) version of [nodejs](https://nodejs.org/en). This is `18.16.0` at the time of writing. NodeJS bundles `npm`.
2418

2519
### Solidity and Avalanche
2620

@@ -33,7 +27,7 @@ Clone the repo and install the necessary packages via `yarn`.
3327
```zsh
3428
$ git clone https://github.com/ava-labs/subnet-evm.git
3529
$ cd contract-examples
36-
$ yarn
30+
$ npm install
3731
```
3832

3933
## Write Contracts
@@ -54,7 +48,7 @@ For more information about precompiles see [subnet-evm precompiles](https://gith
5448

5549
Hardhat uses `hardhat.config.js` as the configuration file. You can define tasks, networks, compilers and more in that file. For more information see [here](https://hardhat.org/config/).
5650

57-
In Subnet-EVM, we provide a pre-configured file [hardhat.config.ts](https://github.com/ava-labs/avalanche-smart-contract-quickstart/blob/main/hardhat.config.ts).
51+
In Subnet-EVM, we provide a pre-configured file [hardhat.config.ts](https://github.com/ava-labs/subnet-evm/blob/master/contract-examples/hardhat.config.ts).
5852

5953
The HardHat config file includes a single network configuration: `local`. `local` defaults to using the following values for the RPC URL and the Chain ID:
6054

@@ -73,11 +67,11 @@ Alternatively, you can copy and paste the `local` network configuration to creat
7367

7468
```json
7569
{
76-
networks: {
77-
mynetwork: {
78-
url: "http://127.0.0.1:9650/ext/bc/28N1Tv5CZziQ3FKCaXmo8xtxoFtuoVA6NvZykAT5MtGjF4JkGs/rpc",
79-
chainId: 33333,
80-
accounts: [
70+
"networks": {
71+
"mynetwork": {
72+
"url": "http://127.0.0.1:9650/ext/bc/28N1Tv5CZziQ3FKCaXmo8xtxoFtuoVA6NvZykAT5MtGjF4JkGs/rpc",
73+
"chainId": 33333,
74+
"accounts": [
8175
"0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027",
8276
"0x7b4198529994b0dc604278c99d153cfd069d594753d471171a1d102a10438e07",
8377
"0x15614556be13730e9e8d6eacc1603143e7b96987429df8726384c2ec4502ef6e",
@@ -89,8 +83,8 @@ Alternatively, you can copy and paste the `local` network configuration to creat
8983
"0x86f78c5416151fe3546dece84fda4b4b1e36089f2dbc48496faf3a950f16157c",
9084
"0x750839e9dbbd2a0910efe40f50b2f3b2f2f59f5580bb4b83bd8c1201cf9a010a"
9185
],
92-
pollingInterval: "1s"
93-
},
86+
"pollingInterval": "1s"
87+
}
9488
}
9589
}
9690
```

contract-examples/hardhat.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import "@nomiclabs/hardhat-waffle"
2-
import "./tasks.ts"
2+
import "@nomiclabs/hardhat-ethers"
3+
import "./tasks"
34

45
// HardHat users must populate these environment variables in order to connect to their subnet-evm instance
56
// Since the blockchainID is not known in advance, there's no good default to use and we use the C-Chain here.
67
var local_rpc_uri = process.env.RPC_URI || "http://127.0.0.1:9650/ext/bc/C/rpc"
7-
var local_chain_id = parseInt(process.env.CHAIN_ID,10) || 99999
8+
var local_chain_id = parseInt(process.env.CHAIN_ID, 10) || 99999
89

910
export default {
1011
solidity: {

0 commit comments

Comments
 (0)