Skip to content

Commit

Permalink
Merge pull request #4 from ckb-cell/feat/rgbpp-transaction-queue
Browse files Browse the repository at this point in the history
feat: rgb++ ckb transaction queue
  • Loading branch information
ahonn authored Mar 26, 2024
2 parents d40462b + cd635ff commit c638c20
Show file tree
Hide file tree
Showing 51 changed files with 3,088 additions and 288 deletions.
13 changes: 13 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@ BITCOIN_JSON_RPC_USERNAME=
BITCOIN_JSON_RPC_PASSWORD=

BITCOIN_ELECTRS_API_URL=

BITCOIN_SPV_SERVICE_URL=

CKB_RPC_URL=https://testnet.ckb.dev/rpc
CKB_INDEXER_URL=https://testnet.ckb.dev/indexer

PAYMASTER_PRIVATE_KEY=
PAYMASTER_CELL_CAPACITY=31600000000
PAYMASTER_CELL_PRESET_COUNT=500

UNLOCKER_CELL_BATCH_SIZE=100

TRANSACTION_QUEUE_JOB_DELAY=12000
17 changes: 17 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ jobs:
test:
runs-on: ubuntu-latest

services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand All @@ -36,4 +47,10 @@ jobs:
BITCOIN_JSON_RPC_USERNAME: ${{ secrets.BITCOIN_JSON_RPC_USERNAME }}
BITCOIN_JSON_RPC_PASSWORD: ${{ secrets.BITCOIN_JSON_RPC_PASSWORD }}
BITCOIN_ELECTRS_API_URL: ${{ secrets.BITCOIN_ELECTRS_API_URL }}
BITCOIN_SPV_SERVICE_URL: ${{ secrets.BITCOIN_SPV_SERVICE_URL }}
CKB_RPC_URL: ${{ secrets.CKB_RPC_URL }}
CKB_INDEXER_URL: ${{ secrets.CKB_INDEXER_URL }}
PAYMASTER_PRIVATE_KEY: ${{ secrets.PAYMASTER_PRIVATE_KEY }}
REDIS_URL: redis://localhost:6379
CI_REDIS_URL: redis://localhost:6379
run: pnpm test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ yarn.lock
coverage
data
redis.conf
dump.rdb
.envrc
4 changes: 4 additions & 0 deletions api/serverless.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { buildFastify } from '../src/app';

export const config = {
maxDuration: 300,
};

const app = buildFastify();

export default async (req: Request, res: Response) => {
Expand Down
7 changes: 7 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"packages": [
"nodejs@latest",
"nodePackages.pnpm@latest",
"redis@latest"
]
}
66 changes: 66 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"lockfile_version": "1",
"packages": {
"nodePackages.pnpm@latest": {
"last_modified": "2024-03-08T13:51:52Z",
"resolved": "github:NixOS/nixpkgs/a343533bccc62400e8a9560423486a3b6c11a23b#nodePackages.pnpm",
"source": "devbox-search",
"version": "8.15.3",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/m9p6q42njy1k33fdzf2axqyhy8vh4vn5-pnpm-8.15.3"
},
"aarch64-linux": {
"store_path": "/nix/store/war7jm6ka7afc2v8a78hlq8v9m4pg38m-pnpm-8.15.3"
},
"x86_64-darwin": {
"store_path": "/nix/store/3w3bs2cdqx7sivcldcf6drwrhilv511m-pnpm-8.15.3"
},
"x86_64-linux": {
"store_path": "/nix/store/hcq09j80njlfghy65qmwhn5nq20nk8kl-pnpm-8.15.3"
}
}
},
"nodejs@latest": {
"last_modified": "2024-03-09T07:11:56Z",
"resolved": "github:NixOS/nixpkgs/0e7f98a5f30166cbed344569426850b21e4091d4#nodejs_21",
"source": "devbox-search",
"version": "21.7.1",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/mh1db6rni4mlcr473sh3fy6jg2m38jvg-nodejs-21.7.1"
},
"aarch64-linux": {
"store_path": "/nix/store/ziyb3ny5f9hcwp0lsb9gwdv1pqsn03x1-nodejs-21.7.1"
},
"x86_64-darwin": {
"store_path": "/nix/store/0zaa3aarbsj38g62ihv94gz2hgvgh6bc-nodejs-21.7.1"
},
"x86_64-linux": {
"store_path": "/nix/store/4arhczh30ychpx6h2wpj5nhx39wm0nla-nodejs-21.7.1"
}
}
},
"redis@latest": {
"last_modified": "2024-03-08T13:51:52Z",
"plugin_version": "0.0.2",
"resolved": "github:NixOS/nixpkgs/a343533bccc62400e8a9560423486a3b6c11a23b#redis",
"source": "devbox-search",
"version": "7.2.4",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/700kyznxcmlkqqabhwa64vmyg4aj6igj-redis-7.2.4"
},
"aarch64-linux": {
"store_path": "/nix/store/xlc976dh4nb2aa0gzs0jfgld4cc3x8si-redis-7.2.4"
},
"x86_64-darwin": {
"store_path": "/nix/store/5v58fadclljqa2fmwq281bx5wma9cslb-redis-7.2.4"
},
"x86_64-linux": {
"store_path": "/nix/store/zp1lapdicjxnjhiz8l6j2j4nn6sa9fg5-redis-7.2.4"
}
}
}
}
}
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
]
},
"dependencies": {
"@ckb-lumos/base": "^0.21.1",
"@ckb-lumos/ckb-indexer": "^0.21.1",
"@ckb-lumos/codec": "^0.21.1",
"@ckb-lumos/lumos": "^0.21.1",
"@fastify/compress": "^7.0.0",
"@fastify/cors": "^9.0.1",
"@fastify/http-proxy": "^9.4.0",
Expand All @@ -32,36 +36,45 @@
"@fastify/sensible": "^5.5.0",
"@fastify/swagger": "^8.14.0",
"@fastify/swagger-ui": "^3.0.0",
"@nervosnetwork/ckb-sdk-utils": "^0.109.1",
"@rgbpp-sdk/btc": "0.0.0-snap-20240326062949",
"@rgbpp-sdk/ckb": "0.0.0-snap-20240326062949",
"@sentry/node": "^7.102.1",
"@sentry/profiling-node": "^7.102.1",
"awilix": "^10.0.1",
"axios": "^1.6.7",
"bullmq": "^5.4.2",
"dotenv": "^16.4.2",
"fastify": "^4.26.0",
"fastify-cron": "^1.3.1",
"fastify-plugin": "^4.5.1",
"fastify-type-provider-zod": "^1.1.9",
"ioredis": "^5.3.2",
"lodash": "^4.17.21",
"multicoin-address-validator": "^0.5.16",
"pino": "^8.19.0",
"std-env": "^3.7.0",
"uuid": "^9.0.1",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/ioredis-mock": "^8.2.5",
"@types/lodash": "^4.17.0",
"@types/multicoin-address-validator": "^0.5.2",
"@types/node": "^20.11.17",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitest/coverage-istanbul": "^1.3.1",
"@vitest/ui": "^1.3.1",
"bitcoinjs-lib": "^6.1.5",
"cross-env": "^7.0.3",
"ecpair": "^2.1.0",
"eslint": "^8.56.0",
"ioredis-mock": "^8.9.0",
"lint-staged": "^15.2.2",
"pino-pretty": "^10.3.1",
"prettier": "^3.2.5",
"simple-git-hooks": "^2.10.0",
"tiny-secp256k1": "^2.2.3",
"tsx": "^4.7.1",
"typescript": "^5.3.3",
"vercel": "^33.5.1",
Expand Down
Loading

0 comments on commit c638c20

Please sign in to comment.