Following the migration path outline in DeFiCh#580, this repository has been conslidated into DeFiCh/jellyfish/apps/playground.
DeFi playground for DeFi Blockchain engineers to build DeFi applications without running your own node.
docker-compose.yml
version: '3.7'
services:
traefik:
image: traefik:v2.4
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:3000"
ports:
- "3000:3000"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
defi-blockchain:
image: defi/defichain:1.7.0
command: >
defid
-printtoconsole
-rpcallowip=0.0.0.0/0
-rpcbind=0.0.0.0
-rpcuser=playground-rpcuser
-rpcpassword=playground-rpcpassword
-masternode_operator=mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy
-regtest=1
-txnotokens=0
-logtimemicros
-txindex=1
-acindex=1
-amkheight=0
-bayfrontheight=1
-bayfrontgardensheight=2
-clarkequayheight=3
-dakotaheight=4
-dakotacrescentheight=5
-eunosheight=6
defi-whale:
image: ghcr.io/defich/whale:latest
depends_on:
- defi-blockchain
environment:
WHALE_DEFID_URL: http://playground-rpcuser:playground-rpcpassword@defi-blockchain:19554
WHALE_DATABASE_PROVIDER: memory
WHALE_NETWORK: playground
labels:
- "traefik.http.routers.whale.priority=1"
- "traefik.http.routers.whale.rule=PathPrefix(`/{version:v[1-9]}/playground/`)"
- "traefik.http.routers.whale.entrypoints=web"
- "traefik.http.services.whale.loadbalancer.server.port=3000"
defi-playground:
image: ghcr.io/defich/playground:latest
depends_on:
- defi-blockchain
environment:
PLAYGROUND_DEFID_URL: http://playground-rpcuser:playground-rpcpassword@defi-blockchain:19554
labels:
- "traefik.http.routers.playground.priority=0"
- "traefik.http.routers.playground.rule=PathPrefix(`/{version:v[1-9]}/playground/rpc/`)"
- "traefik.http.routers.playground.entrypoints=web"
- "traefik.http.services.playground.loadbalancer.server.port=3000"
Thanks for contributing, appreciate all the help we can get. Feel free to make a pull-request, we will guide you along the way to make it merge-able. Here are some of our documented contributing guidelines.
You need node v14
, and npm v7
for this project, it's required to set
up npm workspaces.
npm install
There are three types of tests required for DeFi Playground.
All types of tests required Docker
as @defichain/testcontainers
will
automatically spin up regtest
instances for testing. The number of containers it will spin up concurrently is
dependent on your jest --maxConcurrency
count. Test are known to be flaky due to the usage of multiple Docker
containers for test concurrency.
Unit testing are created to test each individual units/components of a software. As they are unit tests, they should be
closely co-located together with the unit. They follow the naming semantic of *.spec.ts
and placed together in the
same directory of the code you are testing. Code coverage is collected for this.
On top of unit tests, this provides additional testing that tests the entire lifecycle of DeFi playground. All
dependencies and modules are integrated together as expected. They follow the naming semantic of *.e2e.ts
and placed
in the same directory as the component. Code coverage is collected for this.
For endpoints that are meant to be consumed by developer, the testing should be done in playground-api-cient
.
Dogfooding at its finest, tests should be written in packages/playground-api-client/__tests__
to test the e2e aspect
of each endpoint.
Coverage is collected for unit and e2e tests at each pull request to main with codecov
; more testing 🚀 less 🐛 = 😎
jest
Docker images are published automatically to GitHub Container Registry (ghcr.io/defich). When a
new GitHub releases is triggered, GitHub Action will automatically
build the docker image in this repo and publish it. Two images are created for each release targeting linux/amd64
and linux/arm64
. The latest tag will always be updated with the last release and semantic release is enforced for each
release.
IntelliJ IDEA is the IDE of choice for writing and maintaining this library. IntelliJ's files are included for convenience with basic toolchain setup but use of IntelliJ is totally optional.
If you discover a security vulnerability in DeFi Playground
,
please see submit it privately.
By using DeFi Playground
(this repo), you (the user) agree to be bound by the terms of this license.