@exodus/assets-feature 4.1.2 → 5.1.0
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 +16 -0
- package/README.md +36 -0
- package/api/index.d.ts +14 -0
- package/client/asset-client-interface.js +20 -6
- package/client/index.js +1 -0
- package/index.d.ts +8 -0
- package/module/asset-preferences.js +1 -1
- package/module/assets-module.js +2 -2
- package/package.json +17 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [5.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@5.0.0...@exodus/assets-feature@5.1.0) (2024-04-23)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- type remaining API methods shipped with headless ([#6619](https://github.com/ExodusMovement/exodus-hydra/issues/6619)) ([d1ec08e](https://github.com/ExodusMovement/exodus-hydra/commit/d1ec08e695f0df2c9e63b01169c746ef872fe541))
|
|
11
|
+
|
|
12
|
+
## [5.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@4.1.2...@exodus/assets-feature@5.0.0) (2024-03-11)
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
- get public key from `publicKeyProvider` (#5924)
|
|
17
|
+
|
|
18
|
+
### Code Refactoring
|
|
19
|
+
|
|
20
|
+
- get public key from `publicKeyProvider` ([#5924](https://github.com/ExodusMovement/exodus-hydra/issues/5924)) ([5f656cf](https://github.com/ExodusMovement/exodus-hydra/commit/5f656cf41503ff59e98dc0259b0e76b30c94a5e2))
|
|
21
|
+
|
|
6
22
|
## [4.1.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@4.1.1...@exodus/assets-feature@4.1.2) (2024-02-20)
|
|
7
23
|
|
|
8
24
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -7,3 +7,39 @@ Assets module, clients and apis
|
|
|
7
7
|
```sh
|
|
8
8
|
yarn add @exodus/assets-feature
|
|
9
9
|
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
`@exodus/assets-feature` is bundled with `@exodus/headless`. It injects the `assetsAtom` into the IOC, which you can then reference in your feature's dependencies to get all/any particular assets.
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import createExodus from '@exodus/headless'
|
|
17
|
+
|
|
18
|
+
const container = createExodus({ adapters, config, port })
|
|
19
|
+
const terribleTickersFeatureYouShouldNotUse = () => ({
|
|
20
|
+
id: 'tickers',
|
|
21
|
+
definitions: [
|
|
22
|
+
{
|
|
23
|
+
definition: {
|
|
24
|
+
id: 'tickers',
|
|
25
|
+
type: 'api',
|
|
26
|
+
factory: ({ assetsAtom }) => ({
|
|
27
|
+
tickers: {
|
|
28
|
+
get: async (name) => {
|
|
29
|
+
const { value: assets } = await assetsAtom.get()
|
|
30
|
+
return assets[name].ticker
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
// provided by `@exodus/assets-feature`
|
|
36
|
+
dependencies: ['assetsAtom'],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
container.use(terribleTickersFeatureYouShouldNotUse())
|
|
43
|
+
const exodus = container.resolve()
|
|
44
|
+
exodus.tickers.get('bitcoin').then(console.log) // 'BTC'
|
|
45
|
+
```
|
package/api/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const assetsApiDefinition: {
|
|
2
|
+
id: 'assetsApi'
|
|
3
|
+
type: 'api'
|
|
4
|
+
factory(): {
|
|
5
|
+
assets: {
|
|
6
|
+
enableMultiAddressMode(params: { assetNames: string[] }): Promise<void>
|
|
7
|
+
disableMultiAddressMode(params: { assetNames: string[] }): Promise<void>
|
|
8
|
+
disablePurpose(params: { assetName: string; purpose: number }): Promise<void>
|
|
9
|
+
enablePurpose(params: { assetName: string; purpose: number }): Promise<void>
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default assetsApiDefinition
|
|
@@ -8,10 +8,10 @@ class AssetClientInterface {
|
|
|
8
8
|
#walletAccountsAtom
|
|
9
9
|
#enabledWalletAccountsAtom
|
|
10
10
|
#transactionSigner
|
|
11
|
+
#publicKeyProvider
|
|
11
12
|
|
|
12
13
|
constructor({
|
|
13
14
|
blockchainMetadata,
|
|
14
|
-
wallet,
|
|
15
15
|
walletAccountsAtom,
|
|
16
16
|
enabledWalletAccountsAtom,
|
|
17
17
|
assetsModule,
|
|
@@ -19,9 +19,9 @@ class AssetClientInterface {
|
|
|
19
19
|
addressProvider,
|
|
20
20
|
feeMonitors,
|
|
21
21
|
transactionSigner,
|
|
22
|
+
publicKeyProvider,
|
|
22
23
|
}) {
|
|
23
24
|
this.blockchainMetadata = blockchainMetadata
|
|
24
|
-
this.wallet = wallet
|
|
25
25
|
this.#walletAccountsAtom = walletAccountsAtom
|
|
26
26
|
this.#enabledWalletAccountsAtom = enabledWalletAccountsAtom
|
|
27
27
|
this.assetsModule = assetsModule
|
|
@@ -29,6 +29,7 @@ class AssetClientInterface {
|
|
|
29
29
|
this.feeMonitors = feeMonitors
|
|
30
30
|
this.#availableAssetNamesAtom = availableAssetNamesAtom
|
|
31
31
|
this.#transactionSigner = transactionSigner
|
|
32
|
+
this.#publicKeyProvider = publicKeyProvider
|
|
32
33
|
|
|
33
34
|
// TODO: remove conditional when clients updated
|
|
34
35
|
if (assetsModule.initialize) {
|
|
@@ -172,13 +173,26 @@ class AssetClientInterface {
|
|
|
172
173
|
|
|
173
174
|
// addresses interface
|
|
174
175
|
|
|
175
|
-
getPublicKey = async ({
|
|
176
|
+
getPublicKey = async ({
|
|
177
|
+
assetName,
|
|
178
|
+
walletAccount,
|
|
179
|
+
purpose = 44,
|
|
180
|
+
addressIndex = 0,
|
|
181
|
+
chainIndex = 0,
|
|
182
|
+
}) => {
|
|
176
183
|
const walletAccountInstance = await this.#getWalletAccount(walletAccount)
|
|
177
|
-
|
|
184
|
+
const asset = this.assetsModule.getAsset(assetName)
|
|
185
|
+
|
|
186
|
+
const keyIdentifier = asset.baseAsset.api.getKeyIdentifier({
|
|
187
|
+
purpose,
|
|
178
188
|
accountIndex: walletAccountInstance.index,
|
|
179
|
-
baseAssetName: assetName,
|
|
180
|
-
addressIndex,
|
|
181
189
|
chainIndex,
|
|
190
|
+
addressIndex,
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
return this.#publicKeyProvider.getPublicKey({
|
|
194
|
+
walletAccount: walletAccountInstance,
|
|
195
|
+
keyIdentifier,
|
|
182
196
|
})
|
|
183
197
|
}
|
|
184
198
|
|
package/client/index.js
CHANGED
package/index.d.ts
ADDED
package/module/assets-module.js
CHANGED
|
@@ -46,8 +46,8 @@ const _isDisabledCustomToken = (token) => token.lifecycleStatus === STATUS.DISAB
|
|
|
46
46
|
const normalizeToken = (token) => ({
|
|
47
47
|
...token,
|
|
48
48
|
name: token.name || token.assetName,
|
|
49
|
-
displayName: token.displayName || token.properName,
|
|
50
|
-
displayTicker: token.displayTicker || token.properTicker,
|
|
49
|
+
displayName: token.displayName || token.properName, // eslint-disable-line @exodus/hydra/no-asset-proper
|
|
50
|
+
displayTicker: token.displayTicker || token.properTicker, // eslint-disable-line @exodus/hydra/no-asset-proper
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
const initialAssetRegistry = {
|
package/package.json
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/assets-feature",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Assets module, clients and apis",
|
|
6
6
|
"main": "index.js",
|
|
7
|
-
"author": "Exodus Movement Inc.",
|
|
7
|
+
"author": "Exodus Movement, Inc.",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"test": "jest",
|
|
10
|
-
"lint": "eslint . --ignore-path ../../.gitignore",
|
|
9
|
+
"test": "run -T jest",
|
|
10
|
+
"lint": "run -T eslint . --ignore-path ../../.gitignore",
|
|
11
11
|
"lint:fix": "yarn lint --fix"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
+
"api",
|
|
15
|
+
"atoms",
|
|
14
16
|
"client",
|
|
15
17
|
"module",
|
|
16
18
|
"monitor",
|
|
17
19
|
"plugin",
|
|
18
20
|
"redux",
|
|
19
|
-
"
|
|
20
|
-
"atoms",
|
|
21
|
-
"README.md",
|
|
21
|
+
"index.d.ts",
|
|
22
22
|
"CHANGELOG.md",
|
|
23
|
+
"README.md",
|
|
23
24
|
"!**/__tests__/**"
|
|
24
25
|
],
|
|
25
26
|
"homepage": "https://github.com/ExodusMovement/exodus-hydra/tree/master/features/assets-feature",
|
|
@@ -43,26 +44,29 @@
|
|
|
43
44
|
"reselect": "^3.0.1"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@exodus/available-assets": "^8.
|
|
47
|
+
"@exodus/available-assets": "^8.1.0",
|
|
48
|
+
"@exodus/bip44-constants": "^195.0.0",
|
|
47
49
|
"@exodus/bitcoin-meta": "^1.0.1",
|
|
48
50
|
"@exodus/bitcoin-plugin": "^1.0.3",
|
|
49
51
|
"@exodus/bitcoinregtest-plugin": "^1.0.3",
|
|
50
52
|
"@exodus/bitcointestnet-plugin": "^1.0.3",
|
|
51
|
-
"@exodus/blockchain-metadata": "^15.
|
|
53
|
+
"@exodus/blockchain-metadata": "^15.3.0",
|
|
52
54
|
"@exodus/combined-assets-meta": "^1.2.5",
|
|
53
55
|
"@exodus/cosmos-plugin": "^1.0.0",
|
|
56
|
+
"@exodus/ethereum-lib": "^4.2.7",
|
|
54
57
|
"@exodus/ethereum-meta": "^1.1.0",
|
|
58
|
+
"@exodus/keychain": "^6.1.1",
|
|
55
59
|
"@exodus/models": "^9.1.1",
|
|
56
60
|
"@exodus/osmosis-plugin": "^1.0.0",
|
|
61
|
+
"@exodus/public-key-provider": "^2.0.1",
|
|
57
62
|
"@exodus/redux-dependency-injection": "^3.0.0",
|
|
58
63
|
"@exodus/storage-memory": "^2.1.1",
|
|
59
|
-
"@exodus/wallet-accounts": "^16.
|
|
64
|
+
"@exodus/wallet-accounts": "^16.3.1",
|
|
60
65
|
"@exodus/wild-emitter": "^1.0.0",
|
|
61
|
-
"
|
|
66
|
+
"bip39": "^3.1.0",
|
|
62
67
|
"events": "^3.3.0",
|
|
63
|
-
"jest": "^29.1.2",
|
|
64
68
|
"msw": "^2.0.0",
|
|
65
69
|
"redux": "^4.0.0"
|
|
66
70
|
},
|
|
67
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "34f1dab70f6c2fc0062d946f5c74ae84e5379539"
|
|
68
72
|
}
|