forked from statechannels/go-nitro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add config/docs files from nitro-gui repo
- Loading branch information
1 parent
0ce173b
commit 6b9e483
Showing
16 changed files
with
16,020 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.yarn/** linguist-vendored | ||
/.yarn/releases/* binary | ||
/.yarn/plugins/**/* binary | ||
/.pnp.* binary linguist-generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: RPC Test | ||
|
||
on: | ||
pull_request: | ||
paths: ['packages/nitro-rpc-client', '.github/workflows/ts-rpc-test.yml'] | ||
workflow_dispatch: | ||
jobs: | ||
run-rpc-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '^1.20.0' | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: 'yarn' | ||
|
||
# Install foundry so we can use it to run a chain instance | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
|
||
# Get go-nitro | ||
- uses: actions/checkout@v3 | ||
with: | ||
repository: 'statechannels/go-nitro' | ||
path: 'code/go-nitro' | ||
|
||
- name: Tidy | ||
run: go mod tidy | ||
working-directory: code/go-nitro | ||
|
||
- name: Run go-nitro RPC servers | ||
run: go run ./scripts/start-rpc-servers.go &> output.log & | ||
working-directory: code/go-nitro | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Run Create Channels script | ||
# TODO: We could write a test specific script that creates channels and checks the results | ||
run: npx ts-node ./scripts/client-runner.ts create-channels -w 300000 &> output.log | ||
working-directory: packages/nitro-rpc-client | ||
|
||
- name: Archive logs | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: logs | ||
path: ./**/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Build and lint | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.json", "**/*.md"] | ||
workflow_dispatch: | ||
jobs: | ||
build-and-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: "yarn" | ||
- name: Install dependencies | ||
run: yarn | ||
- name: Build everything | ||
run: yarn run build | ||
- name: Lint everything | ||
run: yarn run lint | ||
- name: Unit test packages | ||
run: yarn run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-disable */ | ||
//prettier-ignore | ||
module.exports = { | ||
name: "@yarnpkg/plugin-after-install", | ||
factory: function (require) { | ||
var plugin=(()=>{var x=Object.create,i=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var h=t=>i(t,"__esModule",{value:!0});var n=t=>{if(typeof require!="undefined")return require(t);throw new Error('Dynamic require of "'+t+'" is not supported')};var w=(t,o)=>{for(var e in o)i(t,e,{get:o[e],enumerable:!0})},P=(t,o,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of C(o))!y.call(t,r)&&r!=="default"&&i(t,r,{get:()=>o[r],enumerable:!(e=k(o,r))||e.enumerable});return t},a=t=>P(h(i(t!=null?x(I(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var A={};w(A,{default:()=>j});var g=a(n("@yarnpkg/core"));var c=a(n("@yarnpkg/core")),m={afterInstall:{description:"Hook that will always run after install",type:c.SettingsType.STRING,default:""}};var u=a(n("clipanion")),d=a(n("@yarnpkg/core"));var p=a(n("@yarnpkg/shell")),l=async(t,o)=>{var f;let e=t.get("afterInstall"),r=!!((f=t.projectCwd)==null?void 0:f.endsWith(`dlx-${process.pid}`));return e&&!r?(o&&console.log("Running `afterInstall` hook..."),(0,p.execute)(e,[],{cwd:t.projectCwd||void 0})):0};var s=class extends u.Command{async execute(){let o=await d.Configuration.find(this.context.cwd,this.context.plugins);return l(o,!1)}};s.paths=[["after-install"]];var b={configuration:m,commands:[s],hooks:{afterAllInstalled:async(t,o)=>{if((o==null?void 0:o.mode)===g.InstallMode.UpdateLockfile)return;if(await l(t.configuration,!0))throw new Error("The `afterInstall` hook failed, see output above.")}}},j=b;return A;})(); | ||
return plugin; | ||
} | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
nodeLinker: node-modules | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs | ||
spec: "@yarnpkg/plugin-workspace-tools" | ||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs | ||
spec: "@yarnpkg/plugin-interactive-tools" | ||
- path: .yarn/plugins/@yarnpkg/plugin-after-install.cjs | ||
spec: "https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.4.0/bundles/@yarnpkg/plugin-after-install.js" | ||
|
||
yarnPath: .yarn/releases/yarn-3.5.1.cjs | ||
|
||
afterInstall: yarn bootstrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* global module */ | ||
module.exports = { | ||
root: true, | ||
ignorePatterns: [ | ||
"!.prettierrc.js", | ||
"**/!.eslintrc.js", | ||
"**/dist*/", | ||
"**/*__GENERATED__*", | ||
"**/build", | ||
"**/public", | ||
"**/.cache", | ||
"**/styles", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
plugins: [ | ||
"@typescript-eslint", | ||
"prettier", | ||
// We enforce certain rules on how imports are handled | ||
"import", | ||
], | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:prettier/recommended", | ||
"plugin:import/errors", | ||
"plugin:import/warnings", | ||
"plugin:import/typescript", | ||
"plugin:@typescript-eslint/recommended", | ||
], | ||
rules: { | ||
"no-self-compare": "error", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, | ||
], | ||
"import/order": [ | ||
1, | ||
{ | ||
groups: [ | ||
"builtin", | ||
"external", | ||
"internal", | ||
"parent", | ||
"sibling", | ||
"index", | ||
], | ||
"newlines-between": "always", | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
.DS_Store | ||
dist/ | ||
build/ | ||
coverage/ | ||
.cache/ | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
**/.yarn/cache | ||
**/.yarn/unplugged | ||
**/.yarn/build-state.yml | ||
**/.yarn/install-state.gz | ||
.pnp.* | ||
|
||
|
||
# | ||
**/storybook-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Nitro typescript packages | ||
|
||
This directory contains work related to a UI for a go-nitro node. | ||
|
||
UI component demos deployed here: https://nitro-storybook.netlify.app/ | ||
|
||
Latest GUI from `main` branch deployed here https://nitro-gui.netlify.app/ | ||
|
||
## Packages | ||
|
||
- package [`nitro-gui`](./nitro-gui) contains the web UI | ||
- package [`nitro-rpc-client`](./nitro-rpc-client) contains a typescript library (and CLI tool) for communicating with go-nitro's RPC api. | ||
|
||
## Storybook | ||
|
||
Components can be viewed by running `yarn storybook` or `npm run storybook` from the `./nitro-gui` directory. | ||
|
||
## Running manual integration tests | ||
|
||
You will need to spin up: | ||
|
||
- a local `hardhat network` instance running with default settings | ||
- a GUI/Dashboard server (x1) `yarn dev` in the `nitro-gui` package | ||
- `n` browser tabs loading the GUI from the above server (try `n=3` for example, Alice/Irene/Bob in the below diagram) | ||
- `n` `go-nitro` RPC servers ("Nitro as a Service") `go run .` from this repo's root directory. Servers will each require: | ||
|
||
- unique message port | ||
- unique rpc port | ||
- unique channel signing key (a funded account on hardhat will be selected automatically) | ||
|
||
And then drive the network using e.g. the [command line tool](./nitro-rpc-client). You should see changes reflected in the UI. | ||
|
||
The interactions are shown in this diagram: | ||
|
||
![Architecture](./architecture.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "nitro-gui", | ||
"version": "0.0.1", | ||
"private": true, | ||
"description": "HTML/JS Front-end for go-nitro statechannel network", | ||
"homepage": "https://statechannels.org", | ||
"bugs": { | ||
"url": "https://github.com/statechannels/nitro-gui/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/statechannels/nitro-gui.git" | ||
}, | ||
"license": "(MIT-0 OR Apache-2.0)", | ||
"author": "http://statechannels.org", | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"build": "yarn workspaces foreach -pt run build", | ||
"lint": "yarn workspaces foreach -pt run lint", | ||
"bootstrap": "yarn workspaces foreach -pt run prepack", | ||
"test": "yarn workspaces foreach -pt run test" | ||
}, | ||
"packageManager": "yarn@3.5.1" | ||
} |
Oops, something went wrong.