Skip to content

Commit

Permalink
npm & fix lerna & ancient oracle (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSulpiride authored May 15, 2024
1 parent dd7db4d commit 5e22d97
Show file tree
Hide file tree
Showing 136 changed files with 1,461 additions and 1,963 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ jobs:
name: Get package version
id: get_version
run: echo version=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_OUTPUT

- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to npm registry (release)
run: yarn run release:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

-
name: Build and push
uses: docker/build-push-action@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,5 @@ scripts/
**/lib
packages/*/lib
skandha
db
/db
packages/cli/.git-data.json
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/*
COPY . .

RUN yarn install --non-interactive --frozen-lockfile && \
yarn bootstrap && \
yarn build && \
yarn install --non-interactive --frozen-lockfile --production

Expand All @@ -16,7 +15,6 @@ RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/*
COPY --from=build_src /usr/app .

RUN yarn install --non-interactive --frozen-lockfile --production --force
RUN npx [email protected] bootstrap --ignore-scripts -- --production --no-optional

RUN cd node_modules/bcrypto && yarn install

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ curl -fsSL https://skandha.run | bash
Or follow the steps below:

1. install all dependencies by running `yarn`
2. build `yarn build && yarn bootstrap`
2. build `yarn build`
3. `cp config.json.default config.json`
4. edit `config.json`
5. (optional) run local geth-node from `test/geth-dev`
Expand Down
3 changes: 1 addition & 2 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"packages/*"
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "2.0.0",
"version": "2.0.1",
"stream": "true",
"command": {
"version": {
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "root",
"private": true,
"version": "2.0.0",
"version": "2.0.1",
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"clean": "rm -rf ./packages/*/lib ./packages/*/*.tsbuildinfo",
"bootstrap": "lerna bootstrap & lerna link",
"prebuild": "yarn workspace types run build",
"build": "yarn workspace types run build && yarn workspace db run build & lerna run build",
"bootstrap": "yarn install",
"prebuild": "yarn workspace @skandha/types run build",
"build-db": "yarn workspace @skandha/db run build",
"build": "yarn prebuild && yarn build-db & lerna run build",
"lint": "eslint --color --ext .ts packages/*/src/",
"fix-lint": "eslint --ext .ts --fix packages/*/src/",
"test": "lerna run test --concurrency 1",
Expand Down Expand Up @@ -39,7 +40,7 @@
"eslint-plugin-import": "2.26.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-mocha": "10.2.0",
"lerna": "6.4.1",
"lerna": "7.3.0",
"ts-node": "10.9.1",
"tsconfig-paths": "4.1.2",
"typescript": "4.8.4",
Expand Down
16 changes: 10 additions & 6 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "api",
"version": "2.0.0",
"name": "@skandha/api",
"private": "false",
"publishConfig": {
"access": "public"
},
"version": "2.0.1",
"description": "The API module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -29,16 +33,16 @@
},
"dependencies": {
"@fastify/cors": "8.2.1",
"@skandha/executor": "^2.0.1",
"@skandha/monitoring": "^2.0.1",
"@skandha/types": "^2.0.1",
"class-transformer": "0.5.1",
"class-validator": "0.14.1",
"ethers": "5.7.2",
"executor": "^2.0.0",
"fastify": "4.14.1",
"monitoring": "^2.0.0",
"pino": "8.11.0",
"pino-pretty": "10.0.0",
"reflect-metadata": "0.1.13",
"types": "^2.0.0"
"reflect-metadata": "0.1.13"
},
"devDependencies": {
"@types/connect": "3.4.35"
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Executor } from "executor/lib/executor";
import { Config } from "executor/lib/config";
import RpcError from "types/lib/api/errors/rpc-error";
import * as RpcErrorCodes from "types/lib/api/errors/rpc-error-codes";
import { Executor } from "@skandha/executor/lib/executor";
import { Config } from "@skandha/executor/lib/config";
import RpcError from "@skandha/types/lib/api/errors/rpc-error";
import * as RpcErrorCodes from "@skandha/types/lib/api/errors/rpc-error-codes";
import { FastifyInstance, RouteHandler } from "fastify";
import {
BundlerRPCMethods,
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/dto/SetReputation.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
IsNumber,
ValidateNested,
} from "class-validator";
import { ReputationStatus } from "types/lib/executor";
import { ReputationStatus } from "@skandha/types/lib/executor";

export class SetReputationEntry {
@IsEthereumAddress()
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/modules/debug.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { UserOperation } from "types/lib/contracts/UserOperation";
import { Debug } from "executor/lib/modules";
import { UserOperation } from "@skandha/types/lib/contracts/UserOperation";
import { Debug } from "@skandha/executor/lib/modules";
import { IsEthereumAddress } from "class-validator";
import { BundlingMode } from "types/lib/api/interfaces";
import { GetStakeStatus } from "executor/lib/interfaces";
import { BundlingMode } from "@skandha/types/lib/api/interfaces";
import { GetStakeStatus } from "@skandha/executor/lib/interfaces";
import { RpcMethodValidator } from "../utils/RpcMethodValidator";
import {
SetReputationArgs,
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/modules/eth.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Eth } from "executor/lib/modules/eth";
import { Eth } from "@skandha/executor/lib/modules/eth";
import {
EstimatedUserOperationGas,
UserOperationByHashResponse,
UserOperationReceipt,
} from "types/lib/api/interfaces";
} from "@skandha/types/lib/api/interfaces";
import { RpcMethodValidator } from "../utils/RpcMethodValidator";
import { SendUserOperationGasArgs } from "../dto/SendUserOperation.dto";
import { EstimateUserOperationGasArgs } from "../dto/EstimateUserOperation.dto";
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/modules/redirect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { providers } from "ethers";
import { Config } from "executor/lib/config";
import { Config } from "@skandha/executor/lib/config";

export class RedirectAPI {
private provider: providers.JsonRpcProvider;
Expand Down
10 changes: 5 additions & 5 deletions packages/api/src/modules/skandha.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Eth } from "executor/lib/modules/eth";
import { Eth } from "@skandha/executor/lib/modules/eth";
import {
GetConfigResponse,
GetFeeHistoryResponse,
GetGasPriceResponse,
} from "types/lib/api/interfaces";
import { Skandha } from "executor/lib/modules";
import RpcError from "types/lib/api/errors/rpc-error";
import * as RpcErrorCodes from "types/lib/api/errors/rpc-error-codes";
} from "@skandha/types/lib/api/interfaces";
import { Skandha } from "@skandha/executor/lib/modules";
import RpcError from "@skandha/types/lib/api/errors/rpc-error";
import * as RpcErrorCodes from "@skandha/types/lib/api/errors/rpc-error-codes";
import { RpcMethodValidator } from "../utils/RpcMethodValidator";
import { SendUserOperationGasArgs } from "../dto/SendUserOperation.dto";
import { FeeHistoryArgs } from "../dto/FeeHistory.dto";
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/modules/web3.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Web3 } from "executor/lib/modules";
import { Web3 } from "@skandha/executor/lib/modules";

export class Web3API {
constructor(private web3Module: Web3) {}
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fastify, { FastifyInstance } from "fastify";
import cors from "@fastify/cors";
import RpcError from "types/lib/api/errors/rpc-error";
import { ServerConfig } from "types/lib/api/interfaces";
import RpcError from "@skandha/types/lib/api/errors/rpc-error";
import { ServerConfig } from "@skandha/types/lib/api/interfaces";
import logger from "./logger";
import { HttpStatus } from "./constants";

Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/utils/RpcMethodValidator.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "reflect-metadata";
import { validate } from "class-validator";
import { plainToInstance } from "class-transformer";
import RpcError from "types/lib/api/errors/rpc-error";
import * as RpcErrorCodes from "types/lib/api/errors/rpc-error-codes";
import RpcError from "@skandha/types/lib/api/errors/rpc-error";
import * as RpcErrorCodes from "@skandha/types/lib/api/errors/rpc-error-codes";
import logger from "../logger";

export function validationFactory<T>(
Expand Down
20 changes: 12 additions & 8 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "cli",
"version": "2.0.0",
"name": "@skandha/cli",
"private": "false",
"publishConfig": {
"access": "public"
},
"version": "2.0.1",
"description": "> TODO: description",
"author": "zincoshine <[email protected]>",
"homepage": "https://https://github.com/etherspot/skandha#readme",
Expand Down Expand Up @@ -36,15 +40,15 @@
"@libp2p/peer-id-factory": "2.0.1",
"@libp2p/prometheus-metrics": "1.1.3",
"@multiformats/multiaddr": "12.1.3",
"api": "^2.0.0",
"db": "^2.0.0",
"executor": "^2.0.0",
"@skandha/api": "^2.0.1",
"@skandha/db": "^2.0.1",
"@skandha/executor": "^2.0.1",
"@skandha/monitoring": "^2.0.1",
"@skandha/node": "^2.0.1",
"@skandha/types": "^2.0.1",
"find-up": "5.0.0",
"got": "12.5.3",
"js-yaml": "4.1.0",
"monitoring": "^2.0.0",
"node": "^2.0.0",
"types": "^2.0.0",
"yargs": "17.6.2"
},
"devDependencies": {
Expand Down
16 changes: 8 additions & 8 deletions packages/cli/src/cmds/node/handler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Config } from "executor/lib/config";
import { Namespace, getNamespaceByValue, RocksDbController } from "db/lib";
import { NetworkConfig } from "executor/lib/interfaces";
import { BundlerNode, IBundlerNodeOptions, defaultOptions } from "node/lib";
import { initNetworkOptions } from "node/lib";
import logger from "api/lib/logger";
import { ExecutorOptions, ApiOptions, P2POptions } from "types/lib/options";
import { MetricsOptions } from "types/lib/options/metrics";
import { Config } from "@skandha/executor/lib/config";
import { Namespace, getNamespaceByValue, RocksDbController } from "@skandha/db/lib";
import { NetworkConfig } from "@skandha/executor/lib/interfaces";
import { BundlerNode, IBundlerNodeOptions, defaultOptions } from "@skandha/node/lib";
import { initNetworkOptions } from "@skandha/node/lib";
import logger from "@skandha/api/lib/logger";
import { ExecutorOptions, ApiOptions, P2POptions } from "@skandha/types/lib/options";
import { MetricsOptions } from "@skandha/types/lib/options/metrics";
import { IGlobalArgs } from "../../options";
import { mkdir, readFile } from "../../util";
import { getVersionData } from "../../util/version";
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/cmds/node/initPeerIdAndEnr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import path from "node:path";
import { SignableENR, createKeypairFromPeerId } from "@chainsafe/discv5";
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
import { PeerId } from "@libp2p/interface-peer-id";
import { defaultP2POptions } from "types/lib/options";
import { Logger } from "api/lib/logger";
import { defaultP2POptions } from "@skandha/types/lib/options";
import { Logger } from "@skandha/api/lib/logger";
import { fromString as uint8ArrayFromString } from "uint8arrays/from-string";
import { toString as uint8ArrayToString } from "uint8arrays/to-string";
import { peerIdFromBytes } from "@libp2p/peer-id";
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/src/cmds/standalone/handler.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Server } from "api/lib/server";
import { ApiApp } from "api/lib/app";
import { Config } from "executor/lib/config";
import { Server } from "@skandha/api/lib/server";
import { ApiApp } from "@skandha/api/lib/app";
import { Config } from "@skandha/executor/lib/config";
import {
Namespace,
getNamespaceByValue,
RocksDbController,
LocalDbController,
} from "db/lib";
import { NetworkConfig } from "executor/lib/interfaces";
import { IDbController } from "types/lib";
import { Executor } from "executor/lib/executor";
import logger from "api/lib/logger";
import { createMetrics, getHttpMetricsServer } from "monitoring/lib";
} from "@skandha/db/lib";
import { NetworkConfig } from "@skandha/executor/lib/interfaces";
import { IDbController } from "@skandha/types/lib";
import { Executor } from "@skandha/executor/lib/executor";
import logger from "@skandha/api/lib/logger";
import { createMetrics, getHttpMetricsServer } from "@skandha/monitoring/lib";
import { mkdir, readFile } from "../../util";
import { IStandaloneGlobalArgs } from "../../options";
import { getVersionData } from "../../util/version";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/options/bundlerOptions/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defaultApiOptions } from "types/lib/options/api";
import { defaultApiOptions } from "@skandha/types/lib/options/api";
import { ICliCommandOptions } from "../../util";
import { IBundlerOptions } from "./options";

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/options/bundlerOptions/executor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defaultExecutorOptions } from "types/lib/options/executor";
import { defaultExecutorOptions } from "@skandha/types/lib/options/executor";
import { ICliCommandOptions } from "../../util";
import { IBundlerOptions } from "./options";

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/options/bundlerOptions/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defaultMetricsOptions } from "types/lib/options/metrics";
import { defaultMetricsOptions } from "@skandha/types/lib/options/metrics";
import { ICliCommandOptions } from "../../util";
import { IBundlerOptions } from "./options";

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/options/bundlerOptions/network.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defaultP2POptions } from "types/lib/options";
import { defaultP2POptions } from "@skandha/types/lib/options";
import { ICliCommandOptions } from "../../util";
import { IBundlerOptions } from "./options";

Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/options/bundlerOptions/options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiOptions } from "types/lib/options/api";
import { ExecutorOptions } from "types/lib/options/executor";
import { MetricsOptions } from "types/lib/options/metrics";
import { P2POptions } from "types/lib/options/network";
import { ApiOptions } from "@skandha/types/lib/options/api";
import { ExecutorOptions } from "@skandha/types/lib/options/executor";
import { MetricsOptions } from "@skandha/types/lib/options/metrics";
import { P2POptions } from "@skandha/types/lib/options/network";

export interface IBundlerOptions {
api: ApiOptions;
Expand Down
10 changes: 7 additions & 3 deletions packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "db",
"version": "2.0.0",
"name": "@skandha/db",
"private": "false",
"publishConfig": {
"access": "public"
},
"version": "2.0.1",
"description": "The DB module of Etherspot bundler client",
"author": "Etherspot",
"homepage": "https://github.com/etherspot/etherspot-bundler#readme",
Expand Down Expand Up @@ -30,7 +34,7 @@
"dependencies": {
"@chainsafe/ssz": "0.10.1",
"@farcaster/rocksdb": "5.5.0",
"types": "^2.0.0"
"@skandha/types": "^2.0.1"
},
"devDependencies": {
"@types/rocksdb": "3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/localDb.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { IDbController } from "types/lib";
import { IDbController } from "@skandha/types/lib";

enum Status {
started = "started",
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/rocksDb.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from "node:path";
import rocks from "@farcaster/rocksdb";
// eslint-disable-next-line import/no-extraneous-dependencies
import { IDbController } from "types/lib";
import { IDbController } from "@skandha/types/lib";

enum Status {
started = "started",
Expand Down
Loading

0 comments on commit 5e22d97

Please sign in to comment.