Skip to content

Commit c3b266d

Browse files
authored
Merge pull request #1114 from input-output-hk/update-flake-parts
chore: update flake-parts to wrap std
2 parents be44491 + fb7bc02 commit c3b266d

File tree

8 files changed

+86
-47
lines changed

8 files changed

+86
-47
lines changed

compose/smash/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Cardano JS SDK | Smash Server
22

33
Dockerized Cardano Smash Server based on Ubuntu. Downloads the Smash Server binary, configures and runs
4-
it. `inputoutput/cardano-db-sync` image is not used since it doesn't contain Smash Server binary. This Docker image is intended for testing and development purposes only.
4+
it. `inputoutput/cardano-db-sync` image is not used since it doesn't contain Smash Server binary. This Docker image is intended for testing and development purposes only.

compose/smash/init.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ DB=$(cat /run/secrets/postgres_db_db_sync)
44
PASSWORD=$(cat /run/secrets/postgres_password)
55
USER=$(cat /run/secrets/postgres_user)
66

7-
8-
echo "postgres:5432:${DB}:${USER}:${PASSWORD}" > /config/pgpass
7+
echo "postgres:5432:${DB}:${USER}:${PASSWORD}" >/config/pgpass
98

109
_term() {
1110
kill $CHILD
@@ -14,9 +13,9 @@ _term() {
1413
trap _term SIGTERM
1514

1615
PGPASSFILE=/config/pgpass cardano-smash-server \
17-
--config /config/config.json \
18-
--port 3100 \
19-
--admins /config/smash-admins.txt &
16+
--config /config/config.json \
17+
--port 3100 \
18+
--admins /config/smash-admins.txt &
2019

2120
CHILD=$!
2221
wait "$CHILD"

flake.lock

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
inputs = {
33
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
4+
flake-parts.url = "github:hercules-ci/flake-parts";
5+
46
devshell.url = "github:numtide/devshell";
57

68
n2c.url = "github:nlewo/nix2container";
@@ -15,23 +17,30 @@
1517
};
1618

1719
outputs = {std, ...} @ inputs:
18-
std.growOn {
19-
inherit inputs;
20-
cellsFrom = ./nix;
21-
cellBlocks = with std.blockTypes; [
22-
# Software Delivery Lifecycle (Local Development Environment)
23-
(devshells "envs")
24-
(runnables "jobs")
25-
# Software Delivery Lifecycle (Packaging Layers)
26-
# For deeper context, please consult:
27-
# https://std.divnix.com/patterns/four-packaging-layers.html
28-
(installables "packages" {ci.build = true;})
29-
(runnables "operables")
30-
(containers "oci-images" {ci.publish = true;})
31-
(kubectl "deployments" {
32-
ci.diff = true;
33-
ci.apply = true;
34-
})
20+
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
21+
imports = with inputs; [
22+
std.flakeModule
23+
devshell.flakeModule
3524
];
25+
systems = ["x86_64-linux"];
26+
27+
std.grow = {
28+
cellsFrom = ./nix;
29+
cellBlocks = with std.blockTypes; [
30+
# Software Delivery Lifecycle (Local Development Environment)
31+
(devshells "envs")
32+
(runnables "jobs")
33+
# Software Delivery Lifecycle (Packaging Layers)
34+
# For deeper context, please consult:
35+
# https://std.divnix.com/patterns/four-packaging-layers.html
36+
(installables "packages" {ci.build = true;})
37+
(runnables "operables")
38+
(containers "oci-images" {ci.publish = true;})
39+
(kubectl "deployments" {
40+
ci.diff = true;
41+
ci.apply = true;
42+
})
43+
];
44+
};
3645
};
3746
}

packages/cardano-services/copy-assets.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ for i in $(ls ./src); do
1414
fi
1515
done
1616

17-
for i in Http/schema.json Program/services/openApi.json ; do
17+
for i in Http/schema.json Program/services/openApi.json; do
1818
cp ./src/$i ./dist/cjs/$i
1919
# cp ./src/$i ./dist/esm/$i
2020
done

packages/cardano-services/test/jest-setup/rebuild-test-db.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ TEST1="yarn workspace @cardano-sdk/e2e test:wallet"
2525
TEST2="yarn workspace @cardano-sdk/e2e test:long-running delegation-rewards.test.ts"
2626
TEST3="yarn workspace @cardano-sdk/e2e test:local-network register-pool.test.ts"
2727

28-
for test in "$TEST1" "$TEST2" "$TEST3" ; do
29-
while ! $test ; do echo repeating... ; done
28+
for test in "$TEST1" "$TEST2" "$TEST3"; do
29+
while ! $test; do echo repeating...; done
3030
done
3131

3232
TL_LEVEL="${TL_LEVEL:=info}" node "$SCRIPT_DIR/mint-handles.js"

packages/wallet/test/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ Running these suites requires both a supported Ledger and Trezor device to be pl
44
install udev rules, if running on Linux, which can be done by using the script documented in
55
[Download and Install Ledger Live docs], and via the [Trezor Suite] UI.
66

7-
[Download and Install Ledger Live docs]: https://support.ledger.com/hc/en-us/articles/4404389606417-Download-and-install-Ledger-Live?docs=true
8-
[Trezor Suite]: https://trezor.io/trezor-suite
7+
[download and install ledger live docs]: https://support.ledger.com/hc/en-us/articles/4404389606417-Download-and-install-Ledger-Live?docs=true
8+
[trezor suite]: https://trezor.io/trezor-suite
99

10-
## Ledger HW Tests
10+
## Ledger HW Tests
1111

1212
`yarn test:hw:ledger`
1313

14-
## Trezor HW Tests
14+
## Trezor HW Tests
1515

1616
`yarn test:hw:trezor`

packages/web-extension/README.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ In this document, we will cover:
1616

1717
- **Diagrams:** Discussing how these components interact within the context of a web browser extension with visual representations to aid in understanding the structure and flow of interactions.
1818

19-
2019
## System Overview
2120

2221
The **web-extension** package provides components for handling wallet management-related operations within the browser web extensions context. It brings together its own specialized components and further leverages additional elements from other SDK packages, notably the **ObservableWallet** interface from the 'wallet' package and the **Witnesser** interface from the 'key-management’ package.
2322

24-
2523
### Components from the web-extension Package
2624

2725
- **WalletManager:** Manages the lifecycle of ObservableWallets, including activation and deactivation, and is responsible for creating Witnesser instances.
@@ -52,7 +50,6 @@ In-memory key agents could technically live in the service worker, but keeping t
5250

5351
This arrangement also ensures a safer, isolated environment for user prompts and transaction confirmations. As thus, the components of the wallet-extension are distributed among the service worker and the UI script as follows:
5452

55-
5653
![Location of instances within the web extension](img/fig1.png)
5754

5855
## Component Descriptions
@@ -65,7 +62,6 @@ In essence, the **SigningCoordinator** is responsible for managing the signing o
6562

6663
The **SigningCoordinator** also offers flexibility in handling different wallet types, such as InMemory, Ledger, and Trezor wallets. This flexibility is crucial for a web extension that aims to support a wide range of user preferences and hardware capabilities.
6764

68-
6965
### WalletManager
7066

7167
The **WalletManager** is responsible for orchestrating various wallet-related operations. It handles the lifecycle of wallets, including their creation, initialization, activation, deactivation, and switching of networks. These wallets are **ObservableWallet** instances, these instances provide real-time updates and states of the wallets, which include balance tracking, transaction histories, and more. The **WalletManager** effectively maintains a record of these instances, ensuring that the wallets are readily accessible.
@@ -92,7 +88,7 @@ The **ObservableWallet** is designed as a comprehensive interface that offers re
9288

9389
## Integration and Communication Flow
9490

95-
The web-extension package components interact across the UI script and the background script (service worker) of the web extension environment. The scripts communicate using message passing, which allows both service worker and UI scripts to listen for each other's messages and respond on the same channel.
91+
The web-extension package components interact across the UI script and the background script (service worker) of the web extension environment. The scripts communicate using message passing, which allows both service worker and UI scripts to listen for each other's messages and respond on the same channel.
9692

9793
## Bootstrapping
9894

@@ -104,20 +100,19 @@ In the UI script the application creates the **SigningCoordinator** instance and
104100

105101
```javascript
106102
exposeApi(
107-
{
108-
api$: of(signingCoordinator),
109-
baseChannel: signingCoordinatorApiChannel,
110-
properties: signingCoordinatorApiProperties
111-
},
112-
dependencies
113-
);
114-
103+
{
104+
api$: of(signingCoordinator),
105+
baseChannel: signingCoordinatorApiChannel,
106+
properties: signingCoordinatorApiProperties
107+
},
108+
dependencies
109+
);
115110
```
116111

117112
This function exposes the **SigningCoordinator** to the code running in the service worker. Additionally, the UI script must subscribe to the **transactionWitnessRequest$** and **signDataRequest$** observables of the **SigningCoordinator** so it can handle signing requests that are initiated by the **ObservableWallet** that lives in the service worker. This is an example on how the web extension application could start the **SigningCoordinator**:
118113

119114
```javascript
120-
ui.ts
115+
ui.ts;
121116

122117
// Instantiate the SigningCoordinator
123118
const signingCoordinator = new SigningCoordinator(
@@ -161,7 +156,7 @@ exposeSigningCoordinatorApi(
161156
The UI script also creates proxy objects for the exposed instances from the service worker of the **WalletRepository**, **WalletManager** and **ObservableWallet**:
162157

163158
```javascript
164-
ui.ts
159+
ui.ts;
165160

166161
// Consume remote objects.
167162
const walletManager = consumeRemoteApi(
@@ -179,7 +174,6 @@ const wallet = consumeRemoteApi(
179174
{ baseChannel: walletChannel(walletName), properties: observableWalletProperties },
180175
{ logger, runtime }
181176
);
182-
183177
```
184178

185179
The **consumeRemoteApi**, **walletManagerChannel**, **repositoryChannel** and **walletChannel** are all utility functions exported from the web-extension package.
@@ -258,7 +252,7 @@ This way the UI script can use this proxy object and subscribe to its observable
258252

259253
### WalletManager
260254

261-
The **WalletManager**, residing in the service worker, is responsible for instantiating **ObservableWallets** configured to track the given credentials, network and account (if applicable).
255+
The **WalletManager**, residing in the service worker, is responsible for instantiating **ObservableWallets** configured to track the given credentials, network and account (if applicable).
262256

263257
When the UI scripts triggers a wallet switch, either by switching networks, accounts or even wallet credentials entirely, the **WalletManager** retrieves the requested wallet data from the **WalletRepository**, builds a new **Witnesser** using the **SigningCoordinator** (which is a proxy object from the UI script) and creates the new **ObservableWallet** instance, this new active wallet is emitted via the **activeWallet$** observable:
264258

0 commit comments

Comments
 (0)