Skip to content

Commit 213d7cb

Browse files
authored
Replace hethers.js with ethers.js in hardhat-example (#875)
Replace hethers.js with ethers.js in our hardhat example in tools folder. Bump network and mirror node images in tests Signed-off-by: georgi-l95 <[email protected]>
1 parent c6b5d1c commit 213d7cb

File tree

12 files changed

+9835
-22241
lines changed

12 files changed

+9835
-22241
lines changed

packages/server/tests/acceptance/index.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ describe('RPC Server Acceptance Tests', function () {
125125

126126
function runLocalHederaNetwork() {
127127
// set env variables for docker images until local-node is updated
128-
process.env['NETWORK_NODE_IMAGE_TAG'] = '0.35.0-alpha.1';
129-
process.env['HAVEGED_IMAGE_TAG'] = '0.35.0-alpha.1';
130-
process.env['MIRROR_IMAGE_TAG'] = '0.73.0-rc1';
128+
process.env['NETWORK_NODE_IMAGE_TAG'] = '0.35.0-alpha.2';
129+
process.env['HAVEGED_IMAGE_TAG'] = '0.35.0-alpha.2';
130+
process.env['MIRROR_IMAGE_TAG'] = '0.74.0-rc2';
131131

132132
console.log(`Docker container versions, services: ${process.env['NETWORK_NODE_IMAGE_TAG']}, mirror: ${process.env['MIRROR_IMAGE_TAG']}`);
133133

packages/server/tests/helpers/prerequisite.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const RELAY_URL = process.env.E2E_RELAY_HOST || LOCAL_RELAY_URL;
1111

1212
(function () {
1313
if (USE_LOCAL_NODE) {
14-
process.env['NETWORK_NODE_IMAGE_TAG'] = '0.35.0-alpha.1';
15-
process.env['HAVEGED_IMAGE_TAG'] = '0.35.0-alpha.1';
16-
process.env['MIRROR_IMAGE_TAG'] = '0.73.0-rc1';
14+
process.env['NETWORK_NODE_IMAGE_TAG'] = '0.35.0-alpha.2';
15+
process.env['HAVEGED_IMAGE_TAG'] = '0.35.0-alpha.2';
16+
process.env['MIRROR_IMAGE_TAG'] = '0.74.0-rc2';
1717

1818
console.log(`Docker container versions, services: ${process.env['NETWORK_NODE_IMAGE_TAG']}, mirror: ${process.env['MIRROR_IMAGE_TAG']}`);
1919

tools/hardhat-example/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@
33
Simple scripts for basic operations like hbars transfer, balance fetching, and contract interactions (deployment and calls).
44

55
## Prerequisite
6+
67
You must have running:
8+
79
- JSON-RPC Relay
810

911
## Configuration
1012

1113
Create `.env` file based on `.env.example`
14+
1215
```
1316
# Alias accounts keys
1417
OPERATOR_PRIVATE_KEY=
1518
RECEIVER_PRIVATE_KEY=
16-
1719
```
1820

1921
## Setup & Install
2022

2123
In the project directory:
2224

2325
1. Run `npm install`
24-
2. Run `npx hardhat test`
26+
2. Run `npx @hashgraph/hedera-local start -d`
27+
3. Run `npx hardhat test`

tools/hardhat-example/hardhat.config.js

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@
2020

2121
require('dotenv').config();
2222
require('@nomicfoundation/hardhat-toolbox');
23+
require('@nomicfoundation/hardhat-chai-matchers');
24+
require('@nomiclabs/hardhat-ethers');
2325

2426
task('show-balance', async () => {
2527
const showBalance = require('./scripts/showBalance');
2628
return showBalance();
2729
});
2830

2931
task('transfer-hbars', async () => {
30-
const transferHbars = require('./scripts/transferHbars');
31-
return transferHbars();
32+
const transferHbar = require('./scripts/transferHbars');
33+
return transferHbar();
3234
});
3335

3436
task('deploy-contract', async () => {
@@ -46,12 +48,31 @@ task('contract-call', async (taskArgs) => {
4648
return contractCall(taskArgs.contractAddress, taskArgs.msg);
4749
});
4850

51+
/** @type import('hardhat/config').HardhatUserConfig */
4952
module.exports = {
50-
solidity: '0.8.4',
51-
defaultNetwork: 'relay',
53+
mocha: {
54+
timeout: 3600000,
55+
},
56+
solidity: {
57+
version: '0.8.9',
58+
settings: {
59+
optimizer: {
60+
enabled: true,
61+
runs: 500,
62+
},
63+
},
64+
},
65+
defaultNetwork: 'local',
5266
networks: {
53-
relay: {
54-
url: process.env.RELAY_ENDPOINT
55-
}
56-
}
67+
local: {
68+
url: process.env.RELAY_ENDPOINT,
69+
accounts: [process.env.OPERATOR_PRIVATE_KEY, process.env.RECEIVER_PRIVATE_KEY],
70+
chainId: 298,
71+
},
72+
testnet: {
73+
url: 'https://testnet.hashio.io/api',
74+
accounts: [],
75+
chainId: 296,
76+
},
77+
},
5778
};

0 commit comments

Comments
 (0)