This is a demo to swap CKB and SUDT automatically using Open Transaction (OTX).
-
Download open-transaction-pool and build the executable.
git clone https://github.com/doitian/open-transaction-pool.git ../open-transaction-pool/ pushd ../open-transaction-pool/ cargo build --release popd
-
Use the config file
open-transaction-pool.toml
in this repository to start open-transaction-pool.../open-transaction-pool/target/release/open-transaction-pool -c open-transaction-pool.toml
-
Generate development key pairs for the web server.
npm run init
-
Run the development server.
npm run dev # or yarn dev # or pnpm dev
Open http://localhost:3000 with your browser to see the demo.
- First go to the assets page http://localhost:3000/assets
- Claim CKB via Faucet
- Issue SUDT when there are some CKBs in the account.
- Use the buttons in the assets list to initiate the swap proposal.
- As of now, the open transaction pool lacks a P2P extension for broadcasting open transactions. Thus, it is essential to share a single pool instance among multiple users.
- The demo requires exact match on the amount of CKB and SUDT.