Skip to content

Commit

Permalink
chore: various cleanup and refactor (#73)
Browse files Browse the repository at this point in the history
- add website
- rename `./definitions` to `./chainfile`
- various other smaller cleanup and refactor
  • Loading branch information
fuxingloh authored Jun 4, 2024
1 parent 36942b2 commit 05f9602
Show file tree
Hide file tree
Showing 75 changed files with 3,585 additions and 544 deletions.
5 changes: 5 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ to accelerate the adoption of blockchain technology.

```json
{
"id": "eip155:1/geth:1.13.5/lighthouse:4.5.0",
"caip2": "eip155:1",
"name": "Ethereum Mainnet (Geth + Lighthouse)"
}
Expand All @@ -68,7 +67,7 @@ afterAll(async () => {
});

it('should rpc(eth_blockNumber)', async () => {
const hardhat = testcontainers.getContainer('hardhat');
const hardhat = testcontainers.get('hardhat');

const response = await hardhat.rpc({
method: 'eth_blockNumber',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"$schema": "./node_modules/chainfile/schema.json",
"id": "bip122:000000000019d6689c085ae165831e93/bitcoind:25.1",
"caip2": "bip122:000000000019d6689c085ae165831e93",
"name": "Bitcoin Mainnet",
"env": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
import { ChainfileContainer, ChainfileTestcontainers } from 'chainfile-testcontainers';
import waitForExpect from 'wait-for-expect';

import bitcoind from './bitcoind.json';
import mainnet from './mainnet.json';

let testcontainers: ChainfileTestcontainers;

beforeAll(async () => {
testcontainers = await ChainfileTestcontainers.start(bitcoind);
testcontainers = await ChainfileTestcontainers.start(mainnet);
});

afterAll(async () => {
Expand All @@ -18,7 +18,7 @@ describe('bitcoind', () => {
let bitcoind: ChainfileContainer;

beforeAll(() => {
bitcoind = testcontainers.getContainer('bitcoind');
bitcoind = testcontainers.get('bitcoind');
});

it('should rpc(getblockchaininfo)', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
{
"name": "@chainfile/eip155-1337",
"name": "@chainfile/bitcoincore",
"version": "0.0.0",
"private": true,
"private": false,
"repository": {
"url": "git+https://github.com/vetumorg/chainfile"
},
"license": "MPL-2.0",
"files": [
"**/*.json"
],
"scripts": {
"lint": "eslint .",
"test": "jest"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown"
],
"*.{ts,tsx}": [
"eslint --fix",
"prettier --write"
]
},
"jest": {
"preset": "@workspace/jest-preset"
},
"devDependencies": {
"@workspace/jest-preset": "workspace:*",
"@workspace/tsconfig": "workspace:*",
"chainfile": "workspace:*",
"chainfile-testcontainers": "workspace:*"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"$schema": "./node_modules/chainfile/schema.json",
"id": "bip122:0f9188f13cb7b2c71f2a335e3a4fc328/bitcoind:25.1",
"caip2": "bip122:0f9188f13cb7b2c71f2a335e3a4fc328",
"name": "Bitcoin Regtest",
"env": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
import { ChainfileContainer, ChainfileTestcontainers } from 'chainfile-testcontainers';

import bitcoind from './bitcoind.json';
import regtest from './regtest.json';

let testcontainers: ChainfileTestcontainers;

beforeAll(async () => {
testcontainers = await ChainfileTestcontainers.start(bitcoind);
testcontainers = await ChainfileTestcontainers.start(regtest);
});

afterAll(async () => {
Expand All @@ -17,7 +17,7 @@ describe('bitcoind', () => {
let bitcoind: ChainfileContainer;

beforeAll(() => {
bitcoind = testcontainers.getContainer('bitcoind');
bitcoind = testcontainers.get('bitcoind');
});

it('should rpc(getblockchaininfo)', async () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"$schema": "./node_modules/chainfile/schema.json",
"id": "eip155:1337/ganache:7.9.1",
"caip2": "eip155:1337",
"name": "Ganache",
"containers": {
Expand Down
25 changes: 25 additions & 0 deletions chainfile/ganache/localhost.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { afterAll, beforeAll, expect, it } from '@jest/globals';
import { ChainfileTestcontainers } from 'chainfile-testcontainers';

import localhost from './localhost.json';

let testcontainers: ChainfileTestcontainers;

beforeAll(async () => {
testcontainers = await ChainfileTestcontainers.start(localhost);
});

afterAll(async () => {
await testcontainers.stop();
});

it('should rpc(eth_blockNumber)', async () => {
const response = await testcontainers.get('ganache').rpc({
method: 'eth_blockNumber',
});

expect(response.status).toStrictEqual(200);
expect(await response.json()).toMatchObject({
result: '0x0',
});
});
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
{
"name": "@chainfile/eip155-31337",
"name": "@chainfile/ganache",
"version": "0.0.0",
"private": true,
"private": false,
"repository": {
"url": "git+https://github.com/vetumorg/chainfile"
},
"license": "MPL-2.0",
"files": [
"**/*.json"
],
"scripts": {
"lint": "eslint .",
"test": "jest"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown"
],
"*.{ts,tsx}": [
"eslint --fix",
"prettier --write"
]
},
"jest": {
"preset": "@workspace/jest-preset"
},
"devDependencies": {
"@workspace/jest-preset": "workspace:*",
"@workspace/tsconfig": "workspace:*",
"chainfile": "workspace:*",
"chainfile-testcontainers": "workspace:*"
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"$schema": "./node_modules/chainfile/schema.json",
"id": "eip155:31337/hardhat:2.19.4",
"caip2": "eip155:31337",
"name": "Hardhat",
"containers": {
Expand Down
26 changes: 26 additions & 0 deletions chainfile/hardhat/localhost.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { afterAll, beforeAll, expect, it } from '@jest/globals';
import { ChainfileTestcontainers } from 'chainfile-testcontainers';

import localhost from './localhost.json';

let testcontainers: ChainfileTestcontainers;

beforeAll(async () => {
testcontainers = await ChainfileTestcontainers.start(localhost);
});

afterAll(async () => {
await testcontainers.stop();
});

it('should rpc(eth_blockNumber)', async () => {
const response = await testcontainers.get('hardhat').rpc({
method: 'eth_blockNumber',
});

expect(response.status).toStrictEqual(200);

expect(await response.json()).toMatchObject({
result: '0x0',
});
});
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
{
"name": "@chainfile/bip122-0f9188f13cb7b2c71f2a335e3a4fc328",
"name": "@chainfile/hardhat",
"version": "0.0.0",
"private": true,
"private": false,
"repository": {
"url": "git+https://github.com/vetumorg/chainfile"
},
"license": "MPL-2.0",
"files": [
"**/*.json"
],
"scripts": {
"lint": "eslint .",
"test": "jest"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown"
],
"*.{ts,tsx}": [
"eslint --fix",
"prettier --write"
]
},
"jest": {
"preset": "@workspace/jest-preset"
},
"devDependencies": {
"@workspace/jest-preset": "workspace:*",
"@workspace/tsconfig": "workspace:*",
"chainfile": "workspace:*",
"chainfile-testcontainers": "workspace:*"
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
{
"name": "@chainfile/bip122-000000000019d6689c085ae165831e93",
"name": "@chainfile/solana",
"version": "0.0.0",
"private": true,
"private": false,
"repository": {
"url": "git+https://github.com/vetumorg/chainfile"
},
"license": "MPL-2.0",
"files": [
"**/*.json"
],
"scripts": {
"lint": "eslint .",
"test": "jest"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown"
],
"*.{ts,tsx}": [
"eslint --fix",
"prettier --write"
]
},
"jest": {
"preset": "@workspace/jest-preset"
},
"devDependencies": {
"@workspace/jest-preset": "workspace:*",
"@workspace/tsconfig": "workspace:*",
"chainfile": "workspace:*",
"chainfile-testcontainers": "workspace:*"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"$schema": "./node_modules/chainfile/schema.json",
"id": "solana:00000000000000000000000000000000/solana-test-validator:1.17.26",
"caip2": "solana:00000000000000000000000000000000",
"name": "Solana Test Validator",
"containers": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('solana-test-validator', () => {
let validator: ChainfileContainer;

beforeAll(() => {
validator = testcontainers.getContainer('solana-test-validator');
validator = testcontainers.get('solana-test-validator');
});

it('should rpc(getBlockHeight)', async () => {
Expand Down

This file was deleted.

34 changes: 0 additions & 34 deletions definitions/eip155-1337/ganache.test.ts

This file was deleted.

3 changes: 0 additions & 3 deletions definitions/eip155-1337/tsconfig.json

This file was deleted.

34 changes: 0 additions & 34 deletions definitions/eip155-31337/hardhat.test.ts

This file was deleted.

3 changes: 0 additions & 3 deletions definitions/eip155-31337/tsconfig.json

This file was deleted.

Loading

0 comments on commit 05f9602

Please sign in to comment.