diff --git a/.changeset/great-mugs-yawn.md b/.changeset/great-mugs-yawn.md new file mode 100644 index 0000000..a8fb170 --- /dev/null +++ b/.changeset/great-mugs-yawn.md @@ -0,0 +1,5 @@ +--- +'@fedimint/core-web': patch +--- + +Added Nix devshell to run Devimint within testing suite diff --git a/docs/core/dev/testing.md b/docs/core/dev/testing.md index 908b7ca..8013419 100644 --- a/docs/core/dev/testing.md +++ b/docs/core/dev/testing.md @@ -9,6 +9,30 @@ Vitest [browser mode](https://vitest.dev/guide/browser/) + playwright (provider) This framework should be suitable for all the additional libraries we have planned (e.g. react). +## Nix + +The Fedimint Web SDK depends on several external pieces of infrastructure. In order to run high-fidelity tests, we utilize a tool from the [fedimint](https://github.com/fedimint/fedimint) repo called [Devimint](https://github.com/fedimint/fedimint/tree/master/devimint). Devimint includes several pieces of infrastructure for running a local testing environment for fedimint applications including a bitcoind node (regtest), multiple guardian servers (fedimintd), multiple lightning gateways (lnd, cln), and a faucet for minting tokens. + +## Nix Installation & Setup + +To setup nix, use the [Determinate Nix Installer](https://github.com/DeterminateSystems/nix-installer) + +```sh +# The exact version might be different. +> nix --version +nix (Nix) 2.9.1 +``` + +Next, [install direnv](https://direnv.net/docs/installation.html) and run the following command to initialize direnv in your shell: + +```sh +direnv allow +``` + +::: tip +This takes a really long time to run for the first time. All future runs will be relatively quick. +::: + ## Usage ```bash diff --git a/flake.lock b/flake.lock index db65686..93161ec 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "advisory-db": { "flake": false, "locked": { - "lastModified": 1706115649, - "narHash": "sha256-Qrqb54qGaRsFdLDj8EJtI5leFGFfqWHLRgC+t6KWlpQ=", + "lastModified": 1727103737, + "narHash": "sha256-otyUwbqaXYkeBxPy3Gf0ACB0rHl23OzAlfpsVvY1hbc=", "owner": "rustsec", "repo": "advisory-db", - "rev": "1d2202ea2b32fabd3307641010301bfe187ef11a", + "rev": "45780a4d66ad647bd3c148509fb081943efdacfd", "type": "github" }, "original": { @@ -19,7 +19,7 @@ "android-nixpkgs": { "inputs": { "devshell": "devshell", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "nixpkgs": ["fedimint", "flakebox", "nixpkgs"] }, "locked": { @@ -79,15 +79,15 @@ }, "devshell": { "inputs": { - "nixpkgs": ["fedimint", "flakebox", "android-nixpkgs", "nixpkgs"], - "systems": "systems_2" + "flake-utils": "flake-utils_3", + "nixpkgs": ["fedimint", "flakebox", "android-nixpkgs", "nixpkgs"] }, "locked": { - "lastModified": 1695195896, - "narHash": "sha256-pq9q7YsGXnQzJFkR5284TmxrLNFc0wo4NQ/a5E93CQU=", + "lastModified": 1717408969, + "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", "owner": "numtide", "repo": "devshell", - "rev": "05d40d17bf3459606316e3e9ec683b784ff28f16", + "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", "type": "github" }, "original": { @@ -126,11 +126,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1708928609, - "narHash": "sha256-LcXC2NP/TzHMmJThZGG1e+7rht5HeuZK5WOirIDg+lU=", + "lastModified": 1727245890, + "narHash": "sha256-B4gUhZxqdn24PqL7z7ZuvLOS84HVskhKRByWdgA4/RI=", "owner": "nix-community", "repo": "fenix", - "rev": "e928fb6b5179ebd032c19afac5c461ccc0b6de55", + "rev": "de3acda8b67b92abeeb35ac236924afd959874ad", "type": "github" }, "original": { @@ -159,11 +159,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -174,14 +174,14 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_3" + "systems": "systems_2" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -192,14 +192,14 @@ }, "flake-utils_4": { "inputs": { - "systems": ["fedimint", "flakebox", "systems"] + "systems": "systems_3" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -209,6 +209,24 @@ } }, "flake-utils_5": { + "inputs": { + "systems": ["fedimint", "flakebox", "systems"] + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_6": { "inputs": { "systems": "systems_5" }, @@ -231,7 +249,7 @@ "android-nixpkgs": "android-nixpkgs", "crane": "crane", "fenix": ["fedimint", "fenix"], - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "nixpkgs": ["fedimint", "nixpkgs"], "systems": "systems_4" }, @@ -333,11 +351,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1727672256, - "narHash": "sha256-9/79hjQc9+xyH+QxeMcRsA6hDyw6Z9Eo1/oxjvwirLk=", + "lastModified": 1727129439, + "narHash": "sha256-nPyrcFm6FSk7CxzVW4x2hu62aLDghNcv9dX6DF3dXw8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1719f27dd95fd4206afb9cec9f415b539978827e", + "rev": "babc25a577c3310cce57c72d5bed70f4c3c3843a", "type": "github" }, "original": { @@ -350,17 +368,17 @@ "root": { "inputs": { "fedimint": "fedimint", - "flake-utils": "flake-utils_5" + "flake-utils": "flake-utils_6" } }, "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1708878562, - "narHash": "sha256-IBHMNEe3lspVdIzjpM2OVZiBFmFw1DKtdgVN5G41pRc=", + "lastModified": 1727104575, + "narHash": "sha256-lB/ZS0SnHyE8Z3G8DIL/QJPg6w6x5ZhgVO2pBqnz89g=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "5346002d07d09badaf37949bec68012d963d61fc", + "rev": "3d0343251fe084b335b55c17a52bb4a3527b1bd0", "type": "github" }, "original": {