@ledgerhq/coin-framework 0.3.5 → 0.3.6
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 +10 -0
- package/package.json +5 -5
- package/src/account/helpers.ts +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @ledgerhq/coin-framework
|
|
2
2
|
|
|
3
|
+
## 0.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`4a1454beb3`](https://github.com/LedgerHQ/ledger-live/commit/4a1454beb3f86405ba2686e07879c12a7d35ad8e), [`809065c571`](https://github.com/LedgerHQ/ledger-live/commit/809065c57198646a49adea112b9d799e35a57d25), [`ebe5b07afe`](https://github.com/LedgerHQ/ledger-live/commit/ebe5b07afec441ea3e2d9103da9e1175972add47)]:
|
|
8
|
+
- @ledgerhq/cryptoassets@9.8.0
|
|
9
|
+
- @ledgerhq/types-cryptoassets@7.2.1
|
|
10
|
+
- @ledgerhq/types-live@6.35.1
|
|
11
|
+
- @ledgerhq/live-portfolio@0.0.8
|
|
12
|
+
|
|
3
13
|
## 0.3.5
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-framework",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Ledger framework for Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
"prando": "^6.0.1",
|
|
62
62
|
"rxjs": "^6.6.7",
|
|
63
63
|
"rxjs-compat": "^6.6.7",
|
|
64
|
-
"@ledgerhq/cryptoassets": "^9.
|
|
64
|
+
"@ledgerhq/cryptoassets": "^9.8.0",
|
|
65
65
|
"@ledgerhq/devices": "^8.0.3",
|
|
66
66
|
"@ledgerhq/errors": "^6.12.6",
|
|
67
67
|
"@ledgerhq/hw-transport": "^6.28.4",
|
|
68
68
|
"@ledgerhq/live-env": "^0.3.0",
|
|
69
|
-
"@ledgerhq/live-portfolio": "^0.0.
|
|
69
|
+
"@ledgerhq/live-portfolio": "^0.0.8",
|
|
70
70
|
"@ledgerhq/live-promise": "^0.0.1",
|
|
71
71
|
"@ledgerhq/logs": "^6.10.1",
|
|
72
|
-
"@ledgerhq/types-cryptoassets": "^7.2.
|
|
73
|
-
"@ledgerhq/types-live": "^6.35.
|
|
72
|
+
"@ledgerhq/types-cryptoassets": "^7.2.1",
|
|
73
|
+
"@ledgerhq/types-live": "^6.35.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/invariant": "^2.2.2",
|
package/src/account/helpers.ts
CHANGED
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
// By convention, a main account is the top level account
|
|
21
21
|
// - in case of an Account is the account itself
|
|
22
22
|
// - in case of a SubAccount it's the parentAccount
|
|
23
|
-
export const getMainAccount = (
|
|
24
|
-
account:
|
|
25
|
-
parentAccount?:
|
|
26
|
-
):
|
|
23
|
+
export const getMainAccount = <A extends Account>(
|
|
24
|
+
account: A | SubAccount,
|
|
25
|
+
parentAccount?: A | null | undefined
|
|
26
|
+
): A => {
|
|
27
27
|
const mainAccount = account.type === "Account" ? account : parentAccount;
|
|
28
28
|
invariant(mainAccount, "an account is expected");
|
|
29
|
-
return mainAccount as
|
|
29
|
+
return mainAccount as A;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// Return the currency in which fees are paid for this account
|
|
@@ -246,8 +246,7 @@ export const isUpToDateAccount = (account: Account | null | undefined) => {
|
|
|
246
246
|
const { blockAvgTime } = currency;
|
|
247
247
|
if (!blockAvgTime) return true;
|
|
248
248
|
const outdated =
|
|
249
|
-
|
|
250
|
-
Date.now().valueOf() - (lastSyncDate.valueOf() || 0) >
|
|
249
|
+
Date.now() - lastSyncDate.getTime() >
|
|
251
250
|
blockAvgTime * 1000 + getEnv("SYNC_OUTDATED_CONSIDERED_DELAY");
|
|
252
251
|
return !outdated;
|
|
253
252
|
};
|