Skip to content

Commit

Permalink
Merge branch 'pablo/implement-remote-eth-rpc' of https://github.com/d…
Browse files Browse the repository at this point in the history
…appnode/DNP_DAPPMANAGER into pablo/implement-remote-eth-rpc
  • Loading branch information
pablomendezroyo committed Feb 12, 2024
2 parents 398ed0d + 09fe4cb commit 188619e
Show file tree
Hide file tree
Showing 568 changed files with 1,448 additions and 20,989 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: NPM Release

on:
workflow_dispatch:
inputs:
packageName:
description: "Package Name (schemas, types, toolkit)"
required: true
version:
description: "Version to publish (e.g., 1.0.0)"
required: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Validate package name
run: |
if [[ ${{ github.event.inputs.packageName }} != "schemas" && ${{ github.event.inputs.packageName }} != "types" && ${{ github.event.inputs.packageName }} != "toolkit" ]]; then
echo "Error: Invalid package name"
exit 1
fi
- name: Validate version
run: |
if ! [[ ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Invalid version format"
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies and build
run: yarn && yarn build

- name: Build and Publish
run: |
cd packages/${{ github.event.inputs.packageName }}
yarn publish --new-version ${{ github.event.inputs.version }} --access public --non-interactive --no-git-tag-version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
token: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions packages/admin-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dev": "nodemon --ignore \"*.json\" -e ts,tsx --watch src/ --exec \"yarn build\""
},
"dependencies": {
"@dappnode/types": "^0.1.35",
"@dappnode/common": "^0.1.0",
"@dappnode/dappmanager": "^0.1.0",
"@dappnode/eventbus": "^0.1.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/admin-ui/server-mock/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import path from "path";
import { calls } from "../src/__mock-backend__";
import { startHttpApi } from "@dappnode/dappmanager/src/api/startHttpApi";
import { LoggerMiddleware } from "@dappnode/common";
import { LoggerMiddleware } from "@dappnode/types";
import { eventBus } from "./eventBus";
import { AdminPasswordDb } from "@dappnode/dappmanager/src/api/auth/adminPasswordDb";
import { DeviceCalls } from "@dappnode/dappmanager/src/calls/device/index.js";

const testFileDir = "test_files";

Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/server-mock/mockVpnClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VpnDevice, PackageVersionData } from "@dappnode/common";
import { VpnDevice, PackageVersionData } from "@dappnode/types";
import { VpnApiClient } from "@dappnode/dappmanager/src/api/vpnApiClient";

const url = "link-to-otp/?id=617824#hdfuisf";
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/autoUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AutoUpdateDataView, Routes } from "@dappnode/common";
import { AutoUpdateDataView, Routes } from "@dappnode/types";
import { pause } from "./utils/pause";

export const autoUpdate: Pick<
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/data/directory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MockDnp } from "./dnps/types";
import { mockDnps } from "./dnps";
import { DirectoryItem, DirectoryItemOk } from "@dappnode/common";
import { DirectoryItem, DirectoryItemOk } from "@dappnode/types";

function getDirectoryDnp(dnp: MockDnp, index: number): DirectoryItemOk {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstalledPackageDetailData, PackageContainer } from "@dappnode/common";
import { InstalledPackageDetailData, PackageContainer } from "@dappnode/types";
import { sampleContainer, sampleDnp } from "./sample";
import { MockDnp } from "./dnps/types";
import { mockDnps } from "./dnps";
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/data/dnpRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
UserSettingsAllDnps,
SetupWizardAllDnps,
CompatibleDnps
} from "@dappnode/common";
} from "@dappnode/types";
import { sampleRequestState } from "./sample";
import { MockDnp } from "./dnps/types";
import { mockDnps } from "./dnps";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PortProtocol } from "@dappnode/common";
import { PortProtocol } from "@dappnode/types";
import { bitcoin } from "./bitcoin";
import { MockDnp } from "./types";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PortProtocol } from "@dappnode/common";
import { PortProtocol } from "@dappnode/types";
import { MockDnp } from "./types";

const dnpName = "multi-service.dnp.dappnode.eth";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PortProtocol } from "@dappnode/common";
import { PortProtocol } from "@dappnode/types";
import { MockDnp } from "./types";

const dnpName = "open-ethereum.dnp.dappnode.eth";
Expand Down
7 changes: 3 additions & 4 deletions packages/admin-ui/src/__mock-backend__/data/dnps/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
SpecialPermission,
InstalledPackageDetailData,
PackageContainer,
RequestedDnp,
Manifest,
SetupWizard
} from "@dappnode/common";
RequestedDnp
} from "@dappnode/types";
import { Manifest, SetupWizard } from "@dappnode/types";

export interface MockDnp {
manifest: Manifest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DirectoryItem } from "@dappnode/common";
import { DirectoryItem } from "@dappnode/types";

// Packages from ENS public.dappnode.eth
// From block 8905883 to ~ 13000000
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/data/registry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DirectoryItem } from "@dappnode/common";
import { DirectoryItem } from "@dappnode/types";
import { mockPublicDnps } from "./publicDnps";

export const registry: DirectoryItem[] = [
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/data/sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
RequestedDnp,
InstalledPackageDetailData,
PackageContainer
} from "@dappnode/common";
} from "@dappnode/types";

const dnpName = "test.dnp.dappnode.eth";
export const sampleRequestState: RequestedDnp = {
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/devices.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Routes, VpnDevice } from "@dappnode/common";
import { Routes, VpnDevice } from "@dappnode/types";

const url = "link-to-otp/?id=617824#hdfuisf";
const password = "SAMPLETEMPPASSWORD";
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/fetchPkgsData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CoreUpdateDataAvailable, Routes } from "@dappnode/common";
import { CoreUpdateDataAvailable, Routes } from "@dappnode/types";
import { directory, registry, dnpRequests } from "./data";

export const fetchPkgsData: Pick<
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/httpsPortal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ExposableServiceInfo,
HttpsPortalMapping,
Routes
} from "@dappnode/common";
} from "@dappnode/types";

const mappings = new Map<string, HttpsPortalMapping>();

Expand Down
13 changes: 10 additions & 3 deletions packages/admin-ui/src/__mock-backend__/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IpfsClientTarget, PortProtocol, Routes } from "@dappnode/common";
import { IpfsClientTarget, PortProtocol, Routes } from "@dappnode/types";
import { autoUpdate } from "./autoUpdate";
import { devices } from "./devices";
import { fetchPkgsData } from "./fetchPkgsData";
Expand Down Expand Up @@ -123,7 +123,9 @@ export const otherCalls: Omit<Routes, keyof typeof namedSpacedCalls> = {
],
dappnodeWebNameSet: async ({ dappnodeWebName }) => {},
statsCpuGet: async () => ({
usedPercentage: 88
usedPercentage: 88,
numberOfCores: 4,
temperatureAverage: 40
}),
statsMemoryGet: async () => ({
total: 8093155328,
Expand All @@ -137,7 +139,12 @@ export const otherCalls: Omit<Routes, keyof typeof namedSpacedCalls> = {
free: 39646527488,
usedPercentage: 83
}),

statsSwapGet: async () => ({
total: 2147483648,
used: 0,
free: 2147483648,
usedPercentage: 0
}),
mountpointsGet: async () => [
{
mountpoint: "",
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/localProxying.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LocalProxyingStatus, Routes } from "@dappnode/common";
import { LocalProxyingStatus, Routes } from "@dappnode/types";
import { pause } from "./utils/pause";

const localProxyingStatusON: LocalProxyingStatus = "running";
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PackageNotificationDb, Routes } from "@dappnode/common";
import { PackageNotificationDb, Routes } from "@dappnode/types";

export const notifications: Pick<
Routes,
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/packages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstalledPackageDetailData, Routes } from "@dappnode/common";
import { InstalledPackageDetailData, Routes } from "@dappnode/types";
import { dnpInstalled } from "./data";
import { sampleContainer, sampleDnp } from "./data/sample";
import { pause } from "./utils/pause";
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/password.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Routes } from "@dappnode/common";
import { Routes } from "@dappnode/types";

let hostPasswordIsSecureState = false;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Routes, TrustedReleaseKey } from "@dappnode/common";
import { Routes, TrustedReleaseKey } from "@dappnode/types";

const initialTrustedKey: TrustedReleaseKey = {
name: "DAppNode Association",
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/ssh.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Routes } from "@dappnode/common";
import { Routes } from "@dappnode/types";

let sshPort = 22;
let sshStatus: "enabled" | "disabled" = "enabled";
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/stakerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Routes,
Signer,
Network
} from "@dappnode/common";
} from "@dappnode/types";

export const stakerConfig: Pick<
Routes,
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/telegram.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Routes } from "@dappnode/common";
import { Routes } from "@dappnode/types";

let isEnabled = false;
let token: string | null = null;
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/userActionLogs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Routes, UserActionLog } from "@dappnode/common";
import { Routes, UserActionLog } from "@dappnode/types";

const userActionLogsState: UserActionLog[] = [];

Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/volumes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pause } from "./utils/pause";
import { dnpInstalled } from "./data";
import { VolumeData, Routes } from "@dappnode/common";
import { VolumeData, Routes } from "@dappnode/types";

const volumesState = new Map<string, VolumeData>(
getInitialVolumes().map(vol => [vol.name, vol])
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/wifi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Routes } from "@dappnode/common";
import { Routes } from "@dappnode/types";

export const wifi: Pick<Routes, "wifiCredentialsGet" | "wifiReportGet"> = {
wifiCredentialsGet: async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/__mock-backend__/wireguard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Routes } from "@dappnode/common";
import { Routes } from "@dappnode/types";

const initialDevices = [
"dappnode_admin",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import filterDirectory from "pages/installer/helpers/filterDirectory";
import { DirectoryItem } from "@dappnode/common";
import { DirectoryItem } from "@dappnode/types";
import { SelectedCategories } from "pages/installer/types";

const sampleDirectoryState: DirectoryItem = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
userSettingsToFormData
} from "pages/installer/parsers/formDataParser";
import { SetupWizardFormDataReturn } from "pages/installer/types";
import { UserSettingsAllDnps } from "@dappnode/common";
import { UserSettingsAllDnps } from "@dappnode/types";
import deepmerge from "deepmerge";
import { SetupTargetAllDnps } from "types";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserSettingsAllDnps } from "@dappnode/common";
import { UserSettingsAllDnps } from "@dappnode/types";
import deepmerge from "deepmerge";
import { difference, isDeepEmpty } from "utils/lodashExtended";

Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/api/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LoginStatusReturn } from "@dappnode/common";
import { LoginStatusReturn } from "@dappnode/types";
import {
apiTestMode,
apiUrls,
Expand Down
7 changes: 3 additions & 4 deletions packages/admin-ui/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import {
SubscriptionsTypes,
Routes,
routesData,
ResolvedType,
parseRpcResponse,
subscriptionsFactory
} from "@dappnode/common";
ResolvedType
} from "@dappnode/types";
import { parseRpcResponse, subscriptionsFactory } from "@dappnode/common";
// Internal
import { mapSubscriptionsToRedux } from "./subscriptions";
import { initialCallsOnOpen } from "./initialCalls";
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/api/interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Emitter } from "mitt";
import { RpcPayload, RpcResponse } from "@dappnode/common";
import { RpcPayload, RpcResponse } from "@dappnode/types";

export type LoginStatus =
| { status: "logged-in"; username: string }
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/api/mock/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RpcPayload, RpcResponse } from "@dappnode/common";
import { RpcPayload, RpcResponse } from "@dappnode/types";
import { calls } from "../../__mock-backend__";
import { IApiRpc } from "../interface";

Expand Down
4 changes: 2 additions & 2 deletions packages/admin-ui/src/api/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import io, { Socket } from "socket.io-client";
import { Emitter } from "mitt";
import { Args, RpcPayload, RpcResponse } from "@dappnode/common";
import { Args, RpcPayload, RpcResponse } from "@dappnode/types";
import { IApiRpc } from "./interface";
import { socketIoUrl } from "params";
import { subscriptionsData } from "@dappnode/common";
import { subscriptionsData } from "@dappnode/types";

let socketGlobal: Socket | null = null;
let apiStarted = false;
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/api/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { updateVolumes, setSystemInfo } from "services/dappnodeStatus/actions";
import { setDnpInstalled } from "services/dnpInstalled/actions";
import { updateDnpDirectory } from "services/dnpDirectory/actions";
import { updateDnpRegistry } from "services/dnpRegistry/actions";
import { Subscriptions } from "@dappnode/common";
import { Subscriptions } from "@dappnode/types";

export function mapSubscriptionsToRedux(subscriptions: Subscriptions): void {
subscriptions.directory.on(directoryDnps => {
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/api/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dappmanagerDnpName, coreDnpName } from "params";
import { Args } from "@dappnode/common";
import { Args } from "@dappnode/types";

/**
* Restarting the DAPPMANAGER will cause this error
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/components/EthMultiClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ConsensusClientMainnet,
executionClientsMainnet,
consensusClientsMainnet
} from "@dappnode/common";
} from "@dappnode/types";
import { AiFillSafetyCertificate, AiFillClockCircle } from "react-icons/ai";
import { FaDatabase } from "react-icons/fa";
import Switch from "./Switch";
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/components/IpfsClient.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import "./multiClient.scss";
import { IpfsClientTarget } from "@dappnode/common";
import { IpfsClientTarget } from "@dappnode/types";
import Card from "components/Card";
import { joinCssClass } from "utils/css";
import Input from "./Input";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { orderBy, isEmpty } from "lodash-es";
// Components
import Input from "components/Input";
import { UserSettingsAllDnps } from "@dappnode/common";
import { UserSettingsAllDnps } from "@dappnode/types";
import { prettyDnpName } from "utils/format";
import "./editorAdvanced.scss";

Expand Down
Loading

0 comments on commit 188619e

Please sign in to comment.