You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: packages/web-extension/README.md
+11-17Lines changed: 11 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -16,12 +16,10 @@ In this document, we will cover:
16
16
17
17
-**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.
18
18
19
-
20
19
## System Overview
21
20
22
21
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.
23
22
24
-
25
23
### Components from the web-extension Package
26
24
27
25
-**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
52
50
53
51
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:
54
52
55
-
56
53

57
54
58
55
## Component Descriptions
@@ -65,7 +62,6 @@ In essence, the **SigningCoordinator** is responsible for managing the signing o
65
62
66
63
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.
67
64
68
-
69
65
### WalletManager
70
66
71
67
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
92
88
93
89
## Integration and Communication Flow
94
90
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.
96
92
97
93
## Bootstrapping
98
94
@@ -104,20 +100,19 @@ In the UI script the application creates the **SigningCoordinator** instance and
104
100
105
101
```javascript
106
102
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
+
);
115
110
```
116
111
117
112
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**:
118
113
119
114
```javascript
120
-
ui.ts
115
+
ui.ts;
121
116
122
117
// Instantiate the SigningCoordinator
123
118
constsigningCoordinator=newSigningCoordinator(
@@ -161,7 +156,7 @@ exposeSigningCoordinatorApi(
161
156
The UI script also creates proxy objects for the exposed instances from the service worker of the **WalletRepository**, **WalletManager** and **ObservableWallet**:
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
258
252
259
253
### WalletManager
260
254
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).
262
256
263
257
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:
0 commit comments