@rskcapitalmanagement/rsk-striker-sdk v1.0.73
Striker-SDK
About
This repo contains files including const, interfaces, types etc. that are shared between striker and striker-api.
Testing
In order to test components that deal directly with RPC nodes, we use Hardhat. The tests use mocha and chai and are located in ./hardhat/test
.
The command to execute the test suite locally is:
npm run hh-test-[eth, polygon]
This command will spin up a hardhat node, which forks the Ethereum mainnet at a particular block number (see ./hardhat/hardhat.config.ts
).
Tests can obtain an RPC provider which is configured to interact with this test node like so:
import { ethers } from 'hardhat';
const provider = ethers.provider;
At startup, Hardhat provisions 20 test wallets, each with a balance of 10,000 ETH. Tests can get a reference to the array of Signers
like so:
import { ethers } from 'hardhat';
const signers = ethers.signers;
In most cases, you'll want to reset the Hardhat fork before executing a new test. To do this, you can use a utility function located in ./hardhat/test/test.util.ts
:
describe('YourTestSuite', () => {
beforeEach(async () => {
await resetFork();
});
it('YourTestCase', async () => {
...
});
});
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago