Skip to content

Commit

Permalink
🎉 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
doitian committed Feb 22, 2024
0 parents commit a7d1dae
Show file tree
Hide file tree
Showing 28 changed files with 8,521 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next"
}
66 changes: 66 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "🐛 Bug"
description: File a bug/issue
title: ":bug: <title>"
labels: ["bug"]
projects: ["cryptape/46"]
# assignees: []
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Remember, contributions to this repository should follow its [contributing guidelines](../blob/develop/docs/CONTRIBUTING.md).
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
validations:
required: false
- type: textarea
attributes:
label: Environment
description: |
examples:
- **Packages**: @ckb-cobuild/[email protected]
- **OS**: Ubuntu 20.04
- **Node**: v21.5.0
- **pnpm**: 8.6.12
value: |
- **Packages**:
- **OS**:
- **Node**:
- **pnpm**:
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "✨ Feature"
description: Request a feature
title: ":sparkles: <title>"
labels: ["enhancement"]
projects: ["cryptape/46"]
# assignees: []
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
Remember, contributions to this repository should follow its [contributing guidelines](../blob/develop/docs/CONTRIBUTING.md).
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the feature you are requesting.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Describe The Problem
description: Please present a concise description of the problem to be addressed by this feature request. Please be clear what parts of the problem are considered to be in-scope and out-of-scope.
validations:
required: true
- type: textarea
attributes:
label: Suggest A Solution
description: |
A concise description of your preferred solution. If there are multiple solutions, please present each one separately. Save comparisons for the very end.
placeholder: |
Things to address include:
- Details of the technical implementation
- Tradeoffs made in design decisions
- Caveats and considerations for the future
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the feature you are requesting!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
43 changes: 43 additions & 0 deletions .github/workflows/pnpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: pnpm

on:
push:
branches: [main, develop]
pull_request:
types: [opened, synchronize]

jobs:
pnpm:
name: pnpm
timeout-minutes: 15
runs-on: ubuntu-latest

strategy:
matrix:
node: ["18", "lts/*", "latest"]
run:
- pnpm build
- pnpm lint
- pnpm test

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: pnpm/[email protected]
with:
version: 8.6.12

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Run Command
run: ${{ matrix.run }}
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.env
.env.*

# CKB
/ckb-miner.toml
/ckb.toml
/ckb.toml.bak
/data
/default.db-options
/specs

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
4 changes: 4 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml
tasks:
- init: pnpm install
command: pnpm dev
21 changes: 21 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 ian

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# CKB Multisig CoBuild PoC

[Contributing Guidelines](docs/CONTRIBUTING.md)

## Disclaimer

TODO

## Background

TODO

## Getting Started

First, run the development server:

```bash
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

This will use the testnet and the public RPC node `https://testnet.ckbapp.dev/`. See [docs/dev.md](docs/dev.md) about how to set up a dev chain for local development and testing.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

See the list of configurable environment variables in the file [env.example](env.example).
7 changes: 7 additions & 0 deletions bin/dev-faucet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -e
set -u
[ -n "${DEBUG:-}" ] && set -x || true

ckb-cli wallet transfer --skip-check-to-address --to-address "$1" --capacity 300000 --privkey-path specs/miner.key
46 changes: 46 additions & 0 deletions bin/generate-blocks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

CKB_RPC_URL="${CKB_RPC_URL:-http://127.0.0.1:8114}"

function generate_one() {
curl --request POST \
-H "Content-Type: application/json" \
--url "$CKB_RPC_URL" \
--data '{
"id": 42,
"jsonrpc": "2.0",
"method": "generate_block",
"params": []
}'
echo
}

function generate_n() {
if [ $# -eq 0 ]; then
generate_one
else
for i in $(seq "$@"); do
generate_one
done
fi
}

case "${1:-}" in
--url)
CKB_RPC_URL="$2"
shift
shift
generate_n "$@"
;;
--url=*)
CKB_RPC_URL="${1#*=}"
shift
generate_n "$@"
;;
--help)
echo 'usage: generate-blocks.sh [--help|--url CKB_RPC_URL] [count]'
;;
*)
generate_n "$@"
;;
esac
26 changes: 26 additions & 0 deletions bin/run-dev-miner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -e
set -u
[ -n "${DEBUG:-}" ] && set -x || true

function has_tx() {
curl --request POST \
-H "Content-Type: application/json" \
--silent \
--url http://127.0.0.1:8114/ \
--data '{
"id": 42,
"jsonrpc": "2.0",
"method": "tx_pool_info",
"params": []
}' | grep -q '"\(pending\|proposed\)": *"0x[1-9]'
}

while true; do
if has_tx; then
sleep 1
bin/generate-blocks.sh 3
fi
sleep 1
done
6 changes: 6 additions & 0 deletions bin/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

if ! [ -e .env ]; then
echo "create .env"
cp env.example .env
fi
Loading

0 comments on commit a7d1dae

Please sign in to comment.