Skip to content

Commit e4ccf3c

Browse files
authored
Merge pull request #25 from mlabs-haskell/calum/update-seabug-contracts
Preparing for demo
2 parents 6934783 + f99c4c4 commit e4ccf3c

12 files changed

+88
-881
lines changed

README.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
* [Optional: Copy testnet node database](#optional--copy-testnet-node-database)
99
* [Start services](#start-services)
1010
* [Optional: Mint your own NFTs](#optional--mint-your-own-nfts)
11+
- [Maintenance](#maintenance)
12+
* [Updating dependencies](#updating-dependencies)
13+
* [Targeting different networks](#targeting-different-networks)
14+
* [Adding new off-chain contracts](#adding-new-off-chain-contracts)
15+
* [Known errors](#known-errors)
1116
- [Components](#components)
1217
* [`nft-marketplace`](#-nft-marketplace-)
1318
* [`ogmios-datum-cache`](#-ogmios-datum-cache-)
@@ -25,7 +30,7 @@
2530
- arion - Provided by devshell
2631
- [docker](https://docs.docker.com/get-docker/)
2732
- [nami wallet](https://namiwallet.io/) installed as browser extension
28-
- Funds in wallet obtained from [faucet](https://testnets.cardano.org/en/testnets/cardano/tools/faucet/)
33+
- Funds in wallet obtained from [faucet](https://faucet.preview.world.dev.cardano.org/basic-faucet)
2934

3035
## Usage
3136

@@ -68,7 +73,7 @@ Please note that `arion up` will require a full cardano node to sync, which can
6873

6974
Once the chain is synced, you should be able to view the dApp UI from `localhost:8080`
7075

71-
Ensure that Nami is set to Testnet, that you have some Test Ada, and that you've set collateral in Nami.
76+
Ensure that Nami is set to Preview, that you have some Test Ada (see [the faucet](https://faucet.preview.world.dev.cardano.org/basic-faucet)), and that you've set collateral in Nami.
7277

7378
### Optional: Mint your own NFTs
7479

@@ -98,6 +103,37 @@ DESC: Description
98103

99104
The `IPFS Base36 CID` value can be used to continue the minting process.
100105

106+
## Maintenance
107+
108+
### Updating dependencies
109+
110+
- CTL: see [the docs](https://github.com/Plutonomicon/cardano-transaction-lib/blob/develop/doc/ctl-as-dependency.md)
111+
- Submodules: assuming submodules have been setup locally ([see docs](https://git-scm.com/book/en/v2/Git-Tools-Submodules)), just change to the new commit in the submodule, then stage and commit in the main `seabug` repo.
112+
- Purescript/JavaScript dependencies: these are managed in the submodules through the standard package management systems for the languages. For submodules using CTL (`seabug-contracts`), just be sure to follow the CTL docs to avoid conflicts in dependencies
113+
- Haskell dependencies: managed in [nix flakes](https://nixos.wiki/wiki/Flakes)
114+
- Runtime dependencies: also managed by flakes and [Arion](https://docs.hercules-ci.com/arion/)
115+
116+
### Targeting different networks
117+
118+
See [this PR](https://github.com/mlabs-haskell/seabug/pull/25) as an example of switching to the preview network. The general steps are:
119+
120+
- Update the [network in arion-compose.nix](https://github.com/mlabs-haskell/seabug/blob/68cdadfcd364076be467fe2dd2de4c06d35d4f3b/arion-compose.nix#L13-16)
121+
- Make a blockfrost project pointing to the correct network, and update the blockfrost project ids throughout the project
122+
- Update the network ids throughout the project
123+
- Update the blockfrost api url in `seabug-contracts`
124+
125+
### Adding new off-chain contracts
126+
127+
See the [CTL docs](https://github.com/Plutonomicon/cardano-transaction-lib/tree/develop/doc). Off-chain contracts are stored in the `seabug-contracts` submodule.
128+
129+
### Known errors
130+
131+
> WebSocket connection to ws://localho.st:9999/ws failed: WebSocket is closed before the connection is established
132+
> Error: [object Object]
133+
> at push.../seabug-contracts/output.js.exports.error
134+
135+
Try waiting a bit and reloading the page. Likely just ODC needing some time to start up.
136+
101137
## Components
102138

103139
### `nft-marketplace`

arion-compose.nix

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ let
88
# FIXME: CTL version also pinned in seabug-contract. We need only one source of truth
99
cardano-transaction-lib-server = (import
1010
cardano-transaction-lib/default.nix).packages.x86_64-linux."ctl-server:exe:ctl-server";
11-
in {
11+
cardano-configurations = fetchGit { url = "https://github.com/input-output-hk/cardano-configurations"; rev = "182b16cb743867b0b24b7af92efbf427b2b09b52"; };
12+
# { name = "preprod"; magic = 1; }
13+
network = {
14+
name = "preview";
15+
magic = 2; # use `null` for mainnet
16+
};
17+
in
18+
{
1219
# NOTE: still can't remember it...
1320
# ports = [ "host:container" ]
1421
config.services = {
@@ -48,10 +55,7 @@ in {
4855

4956
cardano-transaction-lib-server.service = {
5057
command =
51-
[ "${cardano-transaction-lib-server}/bin/ctl-server"
52-
"--port" "8081"
53-
"--ogmios-host" "ogmios" "--ogmios-port" "1337"
54-
];
58+
[ "${cardano-transaction-lib-server}/bin/ctl-server" "--port" "8081" ];
5559
ports = [ "8081:8081" ];
5660
useHostStore = true;
5761
volumes = [
@@ -67,27 +71,36 @@ in {
6771
"--node-socket"
6872
"/ipc/node.socket"
6973
"--node-config"
70-
"/config/testnet-node-config.json"
74+
"/config/cardano-node/config.json"
7175
];
7276
depends_on = { cardano-node.condition = "service_healthy"; };
73-
image = "cardanosolutions/ogmios:v5.5.1-testnet";
77+
image = "cardanosolutions/ogmios:v5.5.5-${network.name}";
7478
ports = [ "1337:1337" ];
7579
volumes = [
7680
"${toString ./.}/data/cardano-node/ipc:/ipc"
77-
"${toString ./.}/config:/config"
81+
"${cardano-configurations}/network/${network.name}:/config"
7882
];
7983
restart = "always";
8084
};
8185

8286
ogmios-datum-cache.service = {
83-
command = [ "${ogmios-datum-cache}/bin/ogmios-datum-cache"
84-
"--db-connection" "host=postgresql-db port=5432 user=seabug dbname=seabug password=seabug"
85-
"--server-port" "9999"
86-
"--server-api" "usr:pwd"
87-
"--ogmios-address" "ogmios" "--ogmios-port" "1337"
88-
"--from-tip" "--use-latest"
89-
"--block-filter" "{\"address\": \"${marketplace-escrow-address}\"}"
90-
];
87+
command = [
88+
"${ogmios-datum-cache}/bin/ogmios-datum-cache"
89+
"--db-connection"
90+
"host=postgresql-db port=5432 user=seabug dbname=seabug password=seabug"
91+
"--server-port"
92+
"9999"
93+
"--server-api"
94+
"usr:pwd"
95+
"--ogmios-address"
96+
"ogmios"
97+
"--ogmios-port"
98+
"1337"
99+
"--from-tip"
100+
"--use-latest"
101+
"--block-filter"
102+
"{\"address\": \"${marketplace-escrow-address}\"}"
103+
];
91104
depends_on = {
92105
ogmios.condition = "service_healthy";
93106
postgresql-db.condition = "service_healthy";
@@ -98,16 +111,28 @@ in {
98111
};
99112

100113
cardano-node.service = {
101-
environment = { NETWORK = "testnet"; };
102-
image = "inputoutput/cardano-node:1.35.2";
114+
image = "inputoutput/cardano-node:1.35.3";
103115
volumes = [
104116
"${toString ./.}/data/cardano-node/ipc:/ipc"
105117
"${toString ./.}/data/cardano-node/cardano-node-data:/data"
118+
"${cardano-configurations}/network/${network.name}/cardano-node:/config"
119+
"${cardano-configurations}/network/${network.name}/genesis:/genesis"
120+
];
121+
command = [
122+
"run"
123+
"--config"
124+
"/config/config.json"
125+
"--database-path"
126+
"/data/db"
127+
"--socket-path"
128+
"/ipc/node.socket"
129+
"--topology"
130+
"/config/topology.json"
106131
];
107132
healthcheck = {
108133
test = [
109134
"CMD-SHELL"
110-
"CARDANO_NODE_SOCKET_PATH=/ipc/node.socket /bin/cardano-cli query tip --testnet-magic 1097911063"
135+
"CARDANO_NODE_SOCKET_PATH=/ipc/node.socket /bin/cardano-cli query tip --testnet-magic ${toString network.magic}"
111136
];
112137
interval = "10s";
113138
timeout = "5s";

buildFrontendStage2.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ NODE_PATH=./src
2424
2525
REACT_APP_API_BASE_URL=http://nft-mp-svr.localho.st:8080
2626
27+
REACT_APP_CTL_LOG_LEVEL=Trace
2728
REACT_APP_CTL_SERVER_HOST=ctl.localho.st
2829
REACT_APP_CTL_SERVER_PORT=8080
2930
REACT_APP_CTL_SERVER_SECURE_CONN=false
@@ -36,7 +37,7 @@ REACT_APP_CTL_DATUM_CACHE_HOST=localho.st
3637
REACT_APP_CTL_DATUM_CACHE_PORT=9999
3738
REACT_APP_CTL_DATUM_CACHE_SECURE_CONN=false
3839
REACT_APP_CTL_NETWORK_ID=0
39-
REACT_APP_CTL_PROJECT_ID=testnetu7qDM8q2XT1S6gEBSicUIqXB6QN60l7B
40+
REACT_APP_CTL_PROJECT_ID=previewoXa2yw1U0z39X4VmTs6hstw4c6cPx1LN
4041
4142
REACT_APP_IPFS_BASE_URL=https://cloudflare-ipfs.com/ipfs/
4243
EOT

cardano-transaction-lib

config/alonzo-genesis.json

Lines changed: 0 additions & 196 deletions
This file was deleted.

0 commit comments

Comments
 (0)