@exodus/headless 2.0.0-alpha.3 → 2.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,218 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.0-alpha.30](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.29...@exodus/headless@2.0.0-alpha.30) (2023-06-01)
7
+
8
+ ### Features
9
+
10
+ - port base asset names to monitor atom changes to headless ([#1756](https://github.com/ExodusMovement/exodus-hydra/issues/1756)) ([edebc00](https://github.com/ExodusMovement/exodus-hydra/commit/edebc00f7264b7450cc18919b472c33b1f180797))
11
+
12
+ ## [2.0.0-alpha.29](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.28...@exodus/headless@2.0.0-alpha.29) (2023-06-01)
13
+
14
+ ### Features
15
+
16
+ - allow replacing existing dependencies ([#1753](https://github.com/ExodusMovement/exodus-hydra/issues/1753)) ([df6060d](https://github.com/ExodusMovement/exodus-hydra/commit/df6060d09f67dac21f3994dee04223567c921d0a))
17
+
18
+ ## [2.0.0-alpha.28](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.27...@exodus/headless@2.0.0-alpha.28) (2023-05-31)
19
+
20
+ ### Features
21
+
22
+ - add crypto news monitor to headless ([#1750](https://github.com/ExodusMovement/exodus-hydra/issues/1750)) ([64d46a3](https://github.com/ExodusMovement/exodus-hydra/commit/64d46a3d95c3b34d504b0b7128961df1427b6853))
23
+
24
+ ## [2.0.0-alpha.27](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.26...@exodus/headless@2.0.0-alpha.27) (2023-05-31)
25
+
26
+ ### Features
27
+
28
+ - integrate top-movers monitor into headless ([#1743](https://github.com/ExodusMovement/exodus-hydra/issues/1743)) ([05c4b22](https://github.com/ExodusMovement/exodus-hydra/commit/05c4b22e69e823563d81bfe7b30a2d21574d0c45))
29
+
30
+ ## [2.0.0-alpha.26](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.25...@exodus/headless@2.0.0-alpha.26) (2023-05-30)
31
+
32
+ ### Features
33
+
34
+ - integrate feeMonitors into headless ([#1732](https://github.com/ExodusMovement/exodus-hydra/issues/1732)) ([5a4b9b4](https://github.com/ExodusMovement/exodus-hydra/commit/5a4b9b4e2e7b70ac550775860a3bf5474e21a4d0))
35
+
36
+ ## [2.0.0-alpha.25](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.24...@exodus/headless@2.0.0-alpha.25) (2023-05-26)
37
+
38
+ ### Features
39
+
40
+ - migrate connected origins to headless ([#1702](https://github.com/ExodusMovement/exodus-hydra/issues/1702)) ([7f6678e](https://github.com/ExodusMovement/exodus-hydra/commit/7f6678eabc5a66dbf11002f021bb700bec3d32f3))
41
+
42
+ ## [2.0.0-alpha.24](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.23...@exodus/headless@2.0.0-alpha.24) (2023-05-26)
43
+
44
+ ### Features
45
+
46
+ - emit extra payload on application create hook ([#1709](https://github.com/ExodusMovement/exodus-hydra/issues/1709)) ([23412f6](https://github.com/ExodusMovement/exodus-hydra/commit/23412f603cb36c1249d0ed8248a1e44742d5dac9))
47
+
48
+ ## [2.0.0-alpha.23](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.22...@exodus/headless@2.0.0-alpha.23) (2023-05-24)
49
+
50
+ ### Features
51
+
52
+ - add personal notes to headless ([#1676](https://github.com/ExodusMovement/exodus-hydra/issues/1676)) ([c658211](https://github.com/ExodusMovement/exodus-hydra/commit/c6582113b56953edbf68fd0f4d29f4ee802e8bf5))
53
+
54
+ ### Bug Fixes
55
+
56
+ - handle market-history-new-assets ([#1657](https://github.com/ExodusMovement/exodus-hydra/issues/1657)) ([89ff868](https://github.com/ExodusMovement/exodus-hydra/commit/89ff868ade7def9dc1ae99555f069e1a0cfeacba))
57
+ - start geolocation at start ([#1669](https://github.com/ExodusMovement/exodus-hydra/issues/1669)) ([ecfd0f3](https://github.com/ExodusMovement/exodus-hydra/commit/ecfd0f3a74ebf2ed5bca53c67c55ec304df91f4c))
58
+
59
+ ## [2.0.0-alpha.22](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.21...@exodus/headless@2.0.0-alpha.22) (2023-05-16)
60
+
61
+ ### Features
62
+
63
+ - **headless:** bump geolocation ([#1642](https://github.com/ExodusMovement/exodus-hydra/issues/1642)) ([ff1d61b](https://github.com/ExodusMovement/exodus-hydra/commit/ff1d61b0b91ec54fe78f99a33ad987e3a0e54d65))
64
+
65
+ ## [2.0.0-alpha.21](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.20...@exodus/headless@2.0.0-alpha.21) (2023-05-16)
66
+
67
+ ### Features
68
+
69
+ - add mock address provider to headless ([#1637](https://github.com/ExodusMovement/exodus-hydra/issues/1637)) ([c331601](https://github.com/ExodusMovement/exodus-hydra/commit/c331601d7de43bab8f67c7d48905b11a54ffccad))
70
+ - disable kyc tests ([#1638](https://github.com/ExodusMovement/exodus-hydra/issues/1638)) ([b51cfaf](https://github.com/ExodusMovement/exodus-hydra/commit/b51cfafe2431ff99695f0fc74c9b7590f67fe427))
71
+
72
+ ## [2.0.0-alpha.20](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.19...@exodus/headless@2.0.0-alpha.20) (2023-05-12)
73
+
74
+ ### Features
75
+
76
+ - stop timers on remoteConfig.stop(), kyc.stop(), referrals.stop() ([#1593](https://github.com/ExodusMovement/exodus-hydra/issues/1593)) ([0f73363](https://github.com/ExodusMovement/exodus-hydra/commit/0f7336362cdc5a6f878109e6353ac241795e4fc6))
77
+
78
+ ### Bug Fixes
79
+
80
+ - kyc tests ([#1619](https://github.com/ExodusMovement/exodus-hydra/issues/1619)) ([20da423](https://github.com/ExodusMovement/exodus-hydra/commit/20da423b98aa3b950e197b4a2290898c731c59b2))
81
+ - kyc tests (again) ([#1626](https://github.com/ExodusMovement/exodus-hydra/issues/1626)) ([0f12f89](https://github.com/ExodusMovement/exodus-hydra/commit/0f12f898691504aefffeaca0db2fd3dbe9740ff6))
82
+
83
+ ## [2.0.0-alpha.19](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.18...@exodus/headless@2.0.0-alpha.19) (2023-05-08)
84
+
85
+ ### ⚠ BREAKING CHANGES
86
+
87
+ - use revamped geolocation (#1559)
88
+
89
+ ### Features
90
+
91
+ - add addressesProvider to headless ([#1540](https://github.com/ExodusMovement/exodus-hydra/issues/1540)) ([90e963a](https://github.com/ExodusMovement/exodus-hydra/commit/90e963aafa0bb855d8c857902feac37514985d4a))
92
+ - add kyc and referrals modules to headless ([#1539](https://github.com/ExodusMovement/exodus-hydra/issues/1539)) ([1a0cf7c](https://github.com/ExodusMovement/exodus-hydra/commit/1a0cf7c18cbbfc5f2b92d9720d9cbf17cd850214))
93
+
94
+ ### Code Refactoring
95
+
96
+ - use revamped geolocation ([#1559](https://github.com/ExodusMovement/exodus-hydra/issues/1559)) ([4378d13](https://github.com/ExodusMovement/exodus-hydra/commit/4378d137a67e4836a45c72e6bfc79590d4b7ab20))
97
+
98
+ ## [2.0.0-alpha.18](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.17...@exodus/headless@2.0.0-alpha.18) (2023-05-05)
99
+
100
+ ### Bug Fixes
101
+
102
+ - announce that featureFlags writes to featureFlagAtoms ([#1548](https://github.com/ExodusMovement/exodus-hydra/issues/1548)) ([fefac86](https://github.com/ExodusMovement/exodus-hydra/commit/fefac86970ab11e85d530d8424ca9f3de86fed91))
103
+
104
+ ## [2.0.0-alpha.17](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.16...@exodus/headless@2.0.0-alpha.17) (2023-05-05)
105
+
106
+ ### ⚠ BREAKING CHANGES
107
+
108
+ - don't serialize port payloads (#1458)
109
+
110
+ ### Features
111
+
112
+ - add feature-flags to headless ([#1516](https://github.com/ExodusMovement/exodus-hydra/issues/1516)) ([9d2da89](https://github.com/ExodusMovement/exodus-hydra/commit/9d2da895d4f58d34674b19d42fe3fd621d439f73))
113
+
114
+ ### Code Refactoring
115
+
116
+ - don't serialize port payloads ([#1458](https://github.com/ExodusMovement/exodus-hydra/issues/1458)) ([9b98a28](https://github.com/ExodusMovement/exodus-hydra/commit/9b98a28b091146ad0dee631a236629f25a16b3e2))
117
+
118
+ ## [2.0.0-alpha.16](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.15...@exodus/headless@2.0.0-alpha.16) (2023-05-04)
119
+
120
+ ### Bug Fixes
121
+
122
+ - bump atoms in headless ([#1523](https://github.com/ExodusMovement/exodus-hydra/issues/1523)) ([7b6ca0b](https://github.com/ExodusMovement/exodus-hydra/commit/7b6ca0b19ccad9e33c9c0f0aac03feddad9d4cac))
123
+
124
+ ## [2.0.0-alpha.15](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.14...@exodus/headless@2.0.0-alpha.15) (2023-05-04)
125
+
126
+ ### ⚠ BREAKING CHANGES
127
+
128
+ - use readOnlyAtoms dependency processor (#1497)
129
+
130
+ ### Features
131
+
132
+ - add geolocation to headless ([#1514](https://github.com/ExodusMovement/exodus-hydra/issues/1514)) ([44a8620](https://github.com/ExodusMovement/exodus-hydra/commit/44a8620249f8de2147dc073098b68f0562fb7287))
133
+ - use readOnlyAtoms dependency processor ([#1497](https://github.com/ExodusMovement/exodus-hydra/issues/1497)) ([b3b4866](https://github.com/ExodusMovement/exodus-hydra/commit/b3b4866084428496aeff30dcb14ec583d6f4d64f))
134
+
135
+ ### Bug Fixes
136
+
137
+ - enabledAssets storage access ([#1519](https://github.com/ExodusMovement/exodus-hydra/issues/1519)) ([c4d9463](https://github.com/ExodusMovement/exodus-hydra/commit/c4d9463829b0015e70ce617e11940b1fea5bfbe6))
138
+
139
+ ## [2.0.0-alpha.14](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.13...@exodus/headless@2.0.0-alpha.14) (2023-05-03)
140
+
141
+ **Note:** Version bump only for package @exodus/headless
142
+
143
+ ## [2.0.0-alpha.13](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.12...@exodus/headless@2.0.0-alpha.13) (2023-05-02)
144
+
145
+ ### Features
146
+
147
+ - add rates monitor to headless ([#1470](https://github.com/ExodusMovement/exodus-hydra/issues/1470)) ([d214b9a](https://github.com/ExodusMovement/exodus-hydra/commit/d214b9a22ca0649bbd79e2c8f6d9592733c802d2))
148
+
149
+ ### Bug Fixes
150
+
151
+ - get assetsModule from 'adapters' ([#1491](https://github.com/ExodusMovement/exodus-hydra/issues/1491)) ([b010cbd](https://github.com/ExodusMovement/exodus-hydra/commit/b010cbd319ffcd02d18a7492dc20e2d7ba7fe1c4))
152
+
153
+ ## [2.0.0-alpha.12](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.11...@exodus/headless@2.0.0-alpha.12) (2023-05-02)
154
+
155
+ ### Features
156
+
157
+ - add balances to headless ([#1379](https://github.com/ExodusMovement/exodus-hydra/issues/1379)) ([b5d6846](https://github.com/ExodusMovement/exodus-hydra/commit/b5d6846d86b9d83463ece51a2ef14c4fd898d438))
158
+
159
+ ## [2.0.0-alpha.11](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.10...@exodus/headless@2.0.0-alpha.11) (2023-05-02)
160
+
161
+ ### Features
162
+
163
+ - migrate locales atoms ([#1457](https://github.com/ExodusMovement/exodus-hydra/issues/1457)) ([e6f3a7f](https://github.com/ExodusMovement/exodus-hydra/commit/e6f3a7feb4319d8aa44032e27df746343fdb66eb))
164
+ - migrate market history module ([#1456](https://github.com/ExodusMovement/exodus-hydra/issues/1456)) ([3e64532](https://github.com/ExodusMovement/exodus-hydra/commit/3e64532b739ea802f0df841b7c030c2c912d57e8))
165
+
166
+ ## [2.0.0-alpha.10](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.9...@exodus/headless@2.0.0-alpha.10) (2023-04-30)
167
+
168
+ ### Features
169
+
170
+ - add pricingClient to headless ([#1439](https://github.com/ExodusMovement/exodus-hydra/issues/1439)) ([2a82a4c](https://github.com/ExodusMovement/exodus-hydra/commit/2a82a4c663b542178580908aaaff840524d55369))
171
+ - attach wallet account atoms ([#1437](https://github.com/ExodusMovement/exodus-hydra/issues/1437)) ([2648699](https://github.com/ExodusMovement/exodus-hydra/commit/264869986c175091e6bc7c48e852946bd60911d6))
172
+
173
+ ## [2.0.0-alpha.9](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.8...@exodus/headless@2.0.0-alpha.9) (2023-04-26)
174
+
175
+ ### Features
176
+
177
+ - add available-assets to headless ([#1361](https://github.com/ExodusMovement/exodus-hydra/issues/1361)) ([900d142](https://github.com/ExodusMovement/exodus-hydra/commit/900d142018ff112f36ef0f7ef53cf5020020e3ca))
178
+
179
+ ## [2.0.0-alpha.8](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.7...@exodus/headless@2.0.0-alpha.8) (2023-04-25)
180
+
181
+ ### Features
182
+
183
+ - add enabled-assets to headless ([#1235](https://github.com/ExodusMovement/exodus-hydra/issues/1235)) ([a808b75](https://github.com/ExodusMovement/exodus-hydra/commit/a808b750bd911c33241ae710fbf8d8ba7e2073a6))
184
+ - add lifecycle docs ([#1313](https://github.com/ExodusMovement/exodus-hydra/issues/1313)) ([df18faa](https://github.com/ExodusMovement/exodus-hydra/commit/df18faa9c341404c2feaadf51ec46236c54e2f15))
185
+ - add remoteConfig module ([#1370](https://github.com/ExodusMovement/exodus-hydra/issues/1370)) ([ebc888d](https://github.com/ExodusMovement/exodus-hydra/commit/ebc888d6440c509a19dd6c9c600033fd41128ad7))
186
+ - add support for plugins ([#1351](https://github.com/ExodusMovement/exodus-hydra/issues/1351)) ([fac0e2a](https://github.com/ExodusMovement/exodus-hydra/commit/fac0e2a727b0e71ad5f0619b8457c7e80612f707))
187
+
188
+ ## [2.0.0-alpha.7](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.6...@exodus/headless@2.0.0-alpha.7) (2023-04-24)
189
+
190
+ ### ⚠ BREAKING CHANGES
191
+
192
+ - pass compatibility modes config to wallet (#1223)
193
+
194
+ ### Features
195
+
196
+ - add blockchain metadata to headless ([#1293](https://github.com/ExodusMovement/exodus-hydra/issues/1293)) ([04390a7](https://github.com/ExodusMovement/exodus-hydra/commit/04390a71cb01744cd427f470735fa0748b9157ca))
197
+ - add namespaceStorage preprocessor ([#1322](https://github.com/ExodusMovement/exodus-hydra/issues/1322)) ([95f403e](https://github.com/ExodusMovement/exodus-hydra/commit/95f403e59c87f90901247619c727496ebac0a399))
198
+ - pass compatibility modes config to wallet ([#1223](https://github.com/ExodusMovement/exodus-hydra/issues/1223)) ([b49b640](https://github.com/ExodusMovement/exodus-hydra/commit/b49b64097af7969e210e5ecf5395ee7f40a13eac))
199
+
200
+ ## [2.0.0-alpha.6](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.5...@exodus/headless@2.0.0-alpha.6) (2023-04-20)
201
+
202
+ ### Features
203
+
204
+ - add walletAccounts in headless ([#1184](https://github.com/ExodusMovement/exodus-hydra/issues/1184)) ([8d9c93d](https://github.com/ExodusMovement/exodus-hydra/commit/8d9c93d86173476211d596e883a72b51b645e866))
205
+
206
+ ## [2.0.0-alpha.5](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.4...@exodus/headless@2.0.0-alpha.5) (2023-04-20)
207
+
208
+ ### Features
209
+
210
+ - force restart on import ([#1297](https://github.com/ExodusMovement/exodus-hydra/issues/1297)) ([3900196](https://github.com/ExodusMovement/exodus-hydra/commit/39001966ce7d962ddde9df8aa3b93619053569f8))
211
+ - **headless:** clear storage when seed not present ([#1300](https://github.com/ExodusMovement/exodus-hydra/issues/1300)) ([c3c76f5](https://github.com/ExodusMovement/exodus-hydra/commit/c3c76f5953d91e5ef308b129f1bb2fec0dc41500))
212
+ - unlock encrypted storage on wallet unlock ([#1304](https://github.com/ExodusMovement/exodus-hydra/issues/1304)) ([09ea5f2](https://github.com/ExodusMovement/exodus-hydra/commit/09ea5f20ff9547557f59d4c416cee3291f348fdf))
213
+
214
+ ## [2.0.0-alpha.4](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.3...@exodus/headless@2.0.0-alpha.4) (2023-04-13)
215
+
216
+ **Note:** Version bump only for package @exodus/headless
217
+
6
218
  ## [2.0.0-alpha.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.2...@exodus/headless@2.0.0-alpha.3) (2023-04-11)
7
219
 
8
220
  ### Features
package/README.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  The headless Exodus wallet SDK
4
4
 
5
+ ## Table of Contents
6
+
7
+ - [Quick Start](#quick-start)
8
+ - [Lifecycle](#lifecycle)
9
+ - [Port](#port)
10
+ - [Adapters](#adapters)
11
+ - [Config](#config)
12
+ - [Headless API](#headless-api)
13
+
5
14
  ## Quick Start
6
15
 
7
16
  ```js
@@ -34,6 +43,65 @@ const exodus = container.resolve()
34
43
  await exodus.wallet.create({ passphrase: 'my-super-secure-passphrase' })
35
44
  ```
36
45
 
46
+ ## Lifecycle
47
+
48
+ The headless wallet instance transitions through different states during his life. When moving from one another, there are two things that are triggered:
49
+
50
+ - Fires hook call: Allows modules to subscribe and halt transition until listener resolves.
51
+ - Fires event call: Emitted after all hooks had been executed and resolved.
52
+
53
+ Below you can find a state diagram that visualize what hooks are triggered between state transitions:
54
+
55
+ ```mermaid
56
+ stateDiagram-v2
57
+ direction LR
58
+ [*] --> Starting
59
+
60
+ state Starting {
61
+ direction LR
62
+
63
+ state "Needs clear storage?*" as NeedsClear
64
+ state "Is importing?" as IsImporting
65
+
66
+ NeedsClear --> Clearing : CLEAR
67
+ Clearing --> IsImporting
68
+ IsImporting --> Importing : IMPORT
69
+ }
70
+
71
+ Starting --> Started : START
72
+
73
+ state Started {
74
+ direction LR
75
+
76
+ state "Has seed?" as HasSeed
77
+
78
+ HasSeed --> Empty : No
79
+ HasSeed --> Locked : Yes
80
+
81
+ Empty --> Locked : CREATE \n---or---\nIMPORT
82
+
83
+ Locked --> Migrating : MIGRATE
84
+ Migrating --> Unlocked : UNLOCK
85
+ Unlocked --> Locked : LOCK
86
+
87
+ Unlocked --> Restarting : DELETE
88
+
89
+
90
+ }
91
+
92
+ Restarting --> [*] : RESTART
93
+
94
+ Started --> Started : LOAD
95
+
96
+ classDef conditional fill:#ededed,stroke:#c2c2c2,color:#a6a6a6,stroke-width:2;
97
+
98
+ class NeedsClear conditional
99
+ class IsImporting conditional
100
+ class HasSeed conditional
101
+ ```
102
+
103
+ \* Wallet needs to clear storage if seed is not present or is restoring a new wallet
104
+
37
105
  ## Port
38
106
 
39
107
  Event bus between headless wallet and client
@@ -121,21 +189,21 @@ Currently not used.
121
189
 
122
190
  > Type: object
123
191
 
124
- | Method | Type | Description |
125
- | ------------------------ | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
126
- | exists | `async () => boolean` | Checks if a wallet exists on the device. |
127
- | create | `async ({ passphrase?: string }) => void` | Creates new wallet |
128
- | import | `async ({ mnemonic: string, passphrase?: string }) => void` | Imports existing wallet |
129
- | delete | `async ({ passphrase?: string }) => void` | Deletes wallet. Passphrase is mandatory if wallet was created with one |
130
- | lock | `async () => void` | Locks wallet |
131
- | unlock | `async ({ passphrase?: string }) => void` | Unlocks wallet. Passphrase is mandatory if wallet was created with one |
132
- | isLocked | `async () => boolean` | Checks if wallet is locked |
133
- | getMnemonic | `async () => void` | Sets wallet as backed up |
134
- | changePassphrase | `async ({ currentPassphrase?: string. newPassphrase: string }) => void` | Change passphrase. Current passphrase is mandatory if wallet was created with one |
135
- | restoreFromCurrentPhrase | `async ({ passphrase?: string }) => void` | Restore current wallet. Passphrase is mandatory if wallet was created with one |
136
- | load | `async () => void` | Loads UI by rehydratating data through port (`BE Only`) |
137
- | unload | `async () => void` | Unloads UI by rehydratating data through port (`BE Only`) |
138
- | changeLockTimer | `async ({ ttl: number }) => void` | Change auto unlock ttl (`BE Only`) |
192
+ | Method | Type | Description |
193
+ | ------------------------ | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
194
+ | exists | `async () => boolean` | Checks if a wallet exists on the device. |
195
+ | create | `async ({ passphrase?: string }) => void` | Creates new wallet |
196
+ | import | `async ({ mnemonic: string, passphrase?: string, forceRestart?: boolean }) => void` | Imports existing wallet |
197
+ | delete | `async ({ passphrase?: string }) => void` | Deletes wallet. Passphrase is mandatory if wallet was created with one |
198
+ | lock | `async () => void` | Locks wallet |
199
+ | unlock | `async ({ passphrase?: string }) => void` | Unlocks wallet. Passphrase is mandatory if wallet was created with one |
200
+ | isLocked | `async () => boolean` | Checks if wallet is locked |
201
+ | getMnemonic | `async () => void` | Sets wallet as backed up |
202
+ | changePassphrase | `async ({ currentPassphrase?: string. newPassphrase: string }) => void` | Change passphrase. Current passphrase is mandatory if wallet was created with one |
203
+ | restoreFromCurrentPhrase | `async ({ passphrase?: string }) => void` | Restore current wallet. Passphrase is mandatory if wallet was created with one |
204
+ | load | `async () => void` | Loads UI by rehydratating data through port (`BE Only`) |
205
+ | unload | `async () => void` | Unloads UI by rehydratating data through port (`BE Only`) |
206
+ | changeLockTimer | `async ({ ttl: number }) => void` | Change auto unlock ttl (`BE Only`) |
139
207
 
140
208
  ## isMnemonicValid
141
209
 
@@ -148,6 +216,55 @@ Currently not used.
148
216
 
149
217
  **Returns**: `boolean`
150
218
 
219
+ ## walletAccounts
220
+
221
+ > Type: object
222
+
223
+ | Method | Type | Description |
224
+ | ---------- | ------------------------------------------- | -------------------------------------------------------------- |
225
+ | create | `async (walletAccountFields) => void` | Creates a new WalletAccount with the provided fields. |
226
+ | update | `async (name, walletAccountFields) => void` | Updates an existing WalletAccount with the provided fields. |
227
+ | enable | `async (name) => void` | Enables an existing WalletAccount. |
228
+ | disable | `async (name) => void` | Disables an existing WalletAccount. |
229
+ | getEnabled | `async () => object` | Returns enabled walletAccounts as `{ [name]: WalletAccount }`. |
230
+
231
+ ## blockchainMetadata
232
+
233
+ > Type: object
234
+
235
+ | Method | Type | Description |
236
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
237
+ | getTxLog | `async ({ assetName, walletAccount }) => TxSet` | Get the TxSet for the provided `assetName`/`walletAccount` combination (AssetSource) |
238
+ | getLoadedTxLogs | `async () => object` | Get the all loaded `TxSet`s as a `{ [walletAccount]: { [assetName]: TxSet } } object` |
239
+ | updateTxs | `async ({ assetName: string, walletAccount: string, txs: object[] }) => void` | Add or update txs with updates provided in `txs` |
240
+ | overwriteTxs | `async ({ assetName: string, walletAccount: string, txs: object[], notifyReceivedTxs: ?boolean }) => void` | Overwrite specified txs. |
241
+ | clearTxs | `async ({ assetName: string, walletAccount: string }) => void` | Remove txs for AssetSource. |
242
+ | removeTxs | `async ({ assetName: string, walletAccount: string, txs: object[] }) => void` | Remove provided txs. |
243
+ | getAccountState | `async ({ assetName, walletAccount }) => AccountState` | Get the AccountState for the provided AssetSource |
244
+ | getLoadedAccountStates | `async () => object` | Get the all loaded `AccountState`s as a `{ [walletAccount]: { [assetName]: AccountState } } object` |
245
+ | updateAccountState | `async ({ assetName: string, walletAccount: string, newData: object }) => void` | Update accountState for AssetSource. |
246
+ | removeAccountState | `async ({ assetName: string, walletAccount: string }) => void` | Remove accountState for AssetSource. |
247
+ | batch | `() => Batch` | Create a batch of updates. See [blockchainMetadata](../blockchain-metadata) README for batching details. |
248
+
249
+ ## assets
250
+
251
+ > Type: object
252
+
253
+ | Method | Type | Description |
254
+ | ----------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------- |
255
+ | enable | `async (assetNames: string[]) => void` | Enables assets. |
256
+ | disable | `async (assetNames: string[]) => void` | Disables assets. |
257
+ | addAndEnableToken | `async (assetId: string, baseAssetName: string) => string` | Adds and enables a custom token. Returns the created `asset`'s `.name` |
258
+
259
+ ## locale
260
+
261
+ > Type: object
262
+
263
+ | Method | Type | Description |
264
+ | ----------- | ---------------------------------- | ------------------------- |
265
+ | setCurrency | `async (currency: string) => void` | Changes current currency. |
266
+ | setLanguage | `async (language: string) => void` | Changes current language. |
267
+
151
268
  ## subscribe
152
269
 
153
270
  > Type: function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.3",
3
+ "version": "2.0.0-alpha.30",
4
4
  "description": "The headless Exodus wallet SDK",
5
5
  "author": "Exodus Movement Inc",
6
6
  "main": "src/index.js",
@@ -23,30 +23,65 @@
23
23
  "scripts": {
24
24
  "lint": "eslint . --ignore-path ../../.gitignore",
25
25
  "lint:fix": "yarn lint --fix",
26
- "test": "jest"
26
+ "test": "jest --runInBand"
27
27
  },
28
28
  "dependencies": {
29
- "@exodus/atoms": "^2.9.0",
30
- "@exodus/dependency-injection": "^1.2.0",
31
- "@exodus/dependency-preprocessors": "^2.0.2",
29
+ "@exodus/addresses-provider": "^3.0.2",
30
+ "@exodus/atoms": "^3.5.3",
31
+ "@exodus/available-assets": "^2.0.0",
32
+ "@exodus/balances": "^6.0.0",
33
+ "@exodus/basic-utils": "^2.0.0",
34
+ "@exodus/blockchain-metadata": "^8.0.1",
35
+ "@exodus/config": "^7.0.0",
36
+ "@exodus/connected-origins": "^1.1.2",
37
+ "@exodus/crypto-news-monitor": "^2.0.0",
38
+ "@exodus/dependency-injection": "^1.4.0",
39
+ "@exodus/dependency-preprocessors": "^2.4.0",
40
+ "@exodus/enabled-assets": "^6.0.1",
41
+ "@exodus/exodus-pricing-client": "^1.1.0",
42
+ "@exodus/feature-flags": "^2.0.1",
43
+ "@exodus/fee-monitors": "^1.0.0",
32
44
  "@exodus/fetch": "^1.2.1",
33
- "@exodus/key-identifier-provider": "^1.1.1",
34
- "@exodus/keychain": "^3.2.1",
45
+ "@exodus/geolocation": "^2.0.0",
46
+ "@exodus/key-identifier-provider": "^1.1.3",
47
+ "@exodus/keychain": "^4.0.0",
48
+ "@exodus/kyc": "^3.4.0",
49
+ "@exodus/market-history": "^3.1.0",
35
50
  "@exodus/module": "^1.0.0",
36
- "@exodus/wallet": "^5.0.0",
37
- "@exodus/wallet-compatibility-modes": "1.0.2",
38
- "bip39": "2.6.0",
39
- "lodash": "https://registry.yarnpkg.com/@exodus/lodash/-/lodash-4.17.21-exodus.2.tgz",
51
+ "@exodus/personal-notes": "^3.0.1",
52
+ "@exodus/rates-monitor": "^2.0.0",
53
+ "@exodus/referrals": "^5.2.0",
54
+ "@exodus/top-movers-monitor": "^2.0.1",
55
+ "@exodus/wallet": "^6.0.1",
56
+ "@exodus/wallet-accounts": "^8.0.1",
57
+ "@exodus/wallet-compatibility-modes": "^2.0.0",
58
+ "bip39": "^2.6.0",
59
+ "events": "^3.3.0",
60
+ "lodash": "npm:@exodus/lodash@^4.17.21-exodus.2",
40
61
  "minimalistic-assert": "^1.0.1"
41
62
  },
42
63
  "devDependencies": {
64
+ "@exodus/algorand-lib": "^2.0.1",
65
+ "@exodus/algorand-meta": "^1.1.4",
66
+ "@exodus/bitcoin-lib": "^2.2.1",
67
+ "@exodus/bitcoin-meta": "^1.0.0",
68
+ "@exodus/currency": "^2.2.0",
43
69
  "@exodus/ethereum-lib": "^2.22.2",
70
+ "@exodus/ethereum-meta": "^1.0.23",
71
+ "@exodus/models": "^8.11.1",
44
72
  "@exodus/solana-lib": "^1.3.11",
45
- "@exodus/storage-memory": "^1.1.0",
73
+ "@exodus/solana-meta": "^1.0.2",
74
+ "@exodus/storage-encrypted": "^1.1.2",
75
+ "@exodus/storage-memory": "^2.1.0",
46
76
  "@exodus/wild-emitter": "^1.0.0",
47
77
  "buffer-json": "^2.0.0",
78
+ "deepmerge": "^4.2.2",
48
79
  "eslint": "^8.33.0",
49
- "jest": "^29.1.2"
80
+ "eslint-plugin-simple-import-sort": "^7.0.0",
81
+ "events": "^3.3.0",
82
+ "jest": "^29.1.2",
83
+ "nock": "^13.3.1",
84
+ "p-defer": "^4.0.0"
50
85
  },
51
- "gitHead": "f564f9445892bf57cf79ce8921c35ed874ab0b71"
86
+ "gitHead": "d2f34916f4466f83b89a06d52d14a7baf3178a34"
52
87
  }
package/src/api.js CHANGED
@@ -1,9 +1,39 @@
1
1
  import { validateMnemonic as isMnemonicValid } from 'bip39'
2
2
 
3
3
  const createApi = ({ ioc, port }) => {
4
- const { passphraseCache } = ioc.getByType('adapter')
4
+ const { assetsModule, passphraseCache } = ioc.getByType('adapter')
5
5
 
6
- const { application, wallet } = ioc.getByType('module')
6
+ const {
7
+ addressesProvider,
8
+ application,
9
+ blockchainMetadata,
10
+ enabledAssets,
11
+ kyc,
12
+ personalNotes,
13
+ referrals,
14
+ remoteConfig,
15
+ wallet,
16
+ walletAccounts,
17
+ connectedOrigins,
18
+ } = ioc.getByType('module')
19
+
20
+ const { ratesMonitor, feeMonitors } = ioc.getByType('monitor')
21
+
22
+ const {
23
+ // ...
24
+ currencyAtom,
25
+ enabledWalletAccountsAtom,
26
+ languageAtom,
27
+ connectedOriginsAtom,
28
+ } = ioc.getByType('atom')
29
+
30
+ // TODO: do this on 'unload'
31
+ const stop = () => {
32
+ kyc.stop()
33
+ referrals.stop()
34
+ remoteConfig.stop()
35
+ feeMonitors.stop()
36
+ }
7
37
 
8
38
  return {
9
39
  wallet: {
@@ -27,9 +57,80 @@ const createApi = ({ ioc, port }) => {
27
57
  changeLockTimer: application.changeLockTimer,
28
58
  isLocked: () => wallet.isLocked(),
29
59
  },
60
+ walletAccounts: {
61
+ create: walletAccounts.create,
62
+ update: walletAccounts.update,
63
+ disable: walletAccounts.disable,
64
+ enable: walletAccounts.enable,
65
+ getEnabled: enabledWalletAccountsAtom.get,
66
+ },
67
+ blockchainMetadata: {
68
+ getTxLog: blockchainMetadata.getTxLog,
69
+ getLoadedTxLogs: blockchainMetadata.getLoadedTxLogs,
70
+ updateTxs: blockchainMetadata.updateTxs,
71
+ overwriteTxs: blockchainMetadata.overwriteTxs,
72
+ clearTxs: blockchainMetadata.clearTxs,
73
+ removeTxs: blockchainMetadata.removeTxs,
74
+ getAccountState: blockchainMetadata.getAccountState,
75
+ getLoadedAccountStates: blockchainMetadata.getLoadedAccountStates,
76
+ updateAccountState: blockchainMetadata.updateAccountState,
77
+ removeAccountState: blockchainMetadata.removeAccountState,
78
+ batch: blockchainMetadata.batch,
79
+ },
80
+ assets: {
81
+ enable: enabledAssets.enable,
82
+ disable: enabledAssets.disable,
83
+ addAndEnableToken: async (...args) => {
84
+ const asset = await assetsModule.addToken(...args)
85
+ await enabledAssets.enable([asset.name])
86
+ return asset.name
87
+ },
88
+ },
89
+ remoteConfig: {
90
+ get: remoteConfig.get,
91
+ getAll: remoteConfig.getAll,
92
+ },
93
+ locale: {
94
+ setLanguage: (value) => languageAtom.set(value),
95
+ setCurrency: (value) => currencyAtom.set(value),
96
+ },
97
+ rates: {
98
+ refresh: () => ratesMonitor.update(),
99
+ },
100
+ addressesProvider: {
101
+ getAddress: addressesProvider.getAddress.bind(addressesProvider),
102
+ getSupportedPurposes: addressesProvider.getSupportedPurposes.bind(addressesProvider),
103
+ getReceiveAddress: addressesProvider.getReceiveAddress.bind(addressesProvider),
104
+ },
105
+ kyc: {
106
+ start: kyc.start,
107
+ sync: kyc.sync,
108
+ requestKycToken: kyc.requestKycToken,
109
+ },
110
+ referrals: {
111
+ setReferredBy: referrals.setReferredBy,
112
+ referralCodeExists: referrals.referralCodeExists,
113
+ },
114
+ personalNotes: {
115
+ upsert: personalNotes.upsert,
116
+ },
30
117
  isMnemonicValid,
31
118
  subscribe: port.subscribe.bind(port),
32
119
  unsubscribe: port.unsubscribe.bind(port),
120
+ stop,
121
+ connectedOrigins: {
122
+ get: connectedOriginsAtom.get,
123
+ add: connectedOrigins.add,
124
+ untrust: connectedOrigins.untrust,
125
+ isTrusted: connectedOrigins.isTrusted,
126
+ isAutoApprove: connectedOrigins.isAutoApprove,
127
+ setFavorite: connectedOrigins.setFavorite,
128
+ setAutoApprove: connectedOrigins.setAutoApprove,
129
+ connect: connectedOrigins.connect,
130
+ disconnect: connectedOrigins.disconnect,
131
+ updateConnection: connectedOrigins.updateConnection,
132
+ clearConnections: connectedOrigins.clearConnections,
133
+ },
33
134
  }
34
135
  }
35
136