@exodus/models
Advanced tools
Comparing version 8.3.0 to 8.4.0
182
CHANGELOG.md
@@ -1,128 +0,160 @@ | ||
8.2.4 / 2020-06-25 | ||
------------------ | ||
## 8.2.6 / 2020-10-09 | ||
- same as 8.3.0, to avoid re-publishing all asset libs that depends on ~8.2.x | ||
## 8.3.0 / 2020-10-09 | ||
- add WalletAccount .icon, .color | ||
8.2.4 / 2020-06-25 | ||
--- | ||
- Add methods `addUtxo` and `toPriorityOrderedArray` to UtxoCollection needed for desktop | ||
8.2.3 / 2020-06-04 | ||
------------------ | ||
8.2.3 / 2020-06-04 | ||
--- | ||
- XTZ unstaking tx forced to "sent" type | ||
8.2.2 / 2020-05-11 | ||
------------------ | ||
8.2.2 / 2020-05-11 | ||
--- | ||
- PersonalNote - deep copy `sends` | ||
8.2.1 / 2020-04-21 | ||
------------------ | ||
8.2.1 / 2020-04-21 | ||
--- | ||
- PersonalNote - equals support undefined | ||
- PersonalNote - allow message be undefined | ||
8.2.0 / 2020-03-12 | ||
------------------ | ||
8.2.0 / 2020-03-12 | ||
--- | ||
- UtxoCollection - add `unionOverwrite` method | ||
8.1.0 / 2020-03-03 | ||
------------------ | ||
8.1.0 / 2020-03-03 | ||
--- | ||
- PersonalNote - allow arbitrary fields | ||
8.0.0 / 2020-01-20 | ||
------------------ | ||
8.0.0 / 2020-01-20 | ||
--- | ||
- Unify major version to match `@exodus/assets` & `@exodus/assets-base` | ||
- Bump `@exodus/assets` to `8.0.x` | ||
7.0.0 / 2020-01-02 | ||
------------------ | ||
7.0.0 / 2020-01-02 | ||
--- | ||
- Bump `@exodus/assets` to `5.0.x` | ||
6.1.0 / 2019-12-20 | ||
------------------ | ||
6.1.0 / 2019-12-20 | ||
--- | ||
- Add `types.js.flow` file | ||
6.0.0 / 2019-11-16 | ||
------------------ | ||
6.0.0 / 2019-11-16 | ||
--- | ||
- Bump `@exodus/assets` to `5.0.x` | ||
5.0.1 / 2019-11-13 | ||
------------------ | ||
5.0.1 / 2019-11-13 | ||
--- | ||
- WalletAccount - add `is2FA` prop | ||
5.0.0 / 2019-10-21 | ||
------------------ | ||
5.0.0 / 2019-10-21 | ||
--- | ||
- AccountState - introduce `create`, `contains`, and `merge` methods | ||
- Bump `@exodus/assets` to `4.0.x` | ||
4.2.2 / 2019-10-02 | ||
------------------ | ||
4.2.2 / 2019-10-02 | ||
--- | ||
- Add `wallet-account` | ||
- Add `account-state` | ||
4.1.2 / 2019-09-27 | ||
------------------ | ||
4.1.2 / 2019-09-27 | ||
--- | ||
- Optimize `tx.update`, `tx.equals`, `tx-set.updateTxsProperties` for calls with no changes | ||
4.1.1 / 2019-09-13 | ||
------------------ | ||
4.1.1 / 2019-09-13 | ||
--- | ||
- Tx - cleanup error, meta, token on toJSON if they are the default value | ||
- Tx - addresses stringify correct on toJSON now | ||
4.1.0 / 2019-09-09 | ||
------------------ | ||
4.1.0 / 2019-09-09 | ||
--- | ||
- Add `personal-note` | ||
- Add `personal-note-set` | ||
4.0.3 / 2019-08-22 | ||
------------------ | ||
4.0.3 / 2019-08-22 | ||
--- | ||
- Fix `tx.dropped` condition when checking for `confirmations` | ||
4.0.2 / 2019-08-16 | ||
------------------ | ||
4.0.2 / 2019-08-16 | ||
--- | ||
- Handle `tx.feeAmount` for BTT being a BTT currency (should be TRX) | ||
4.0.1 / 2019-08-16 | ||
------------------ | ||
4.0.1 / 2019-08-16 | ||
--- | ||
- Handle `tx.feeAmount` for ONT being an ONG currency | ||
4.0.0 / 2019-08-14 | ||
------------------ | ||
4.0.0 / 2019-08-14 | ||
--- | ||
- Add `tx.selfSend` | ||
- Bump `@exodus/assets` to `3.0.x` | ||
3.0.0 / 2019-08-09 | ||
------------------ | ||
3.0.0 / 2019-08-09 | ||
--- | ||
- Remove `tx.personalNote` | ||
- Improve `feeAmount` handling for assets that use a different fee currency | ||
2.2.0 / 2019-08-06 | ||
------------------ | ||
2.2.0 / 2019-08-06 | ||
--- | ||
- Handle `tx.feeAmount` for NEO being a GAS currency | ||
- Remove `fee-estimator` | ||
2.1.1 / 2019-07-26 | ||
------------------ | ||
2.1.1 / 2019-07-26 | ||
--- | ||
- Get rid of the `is-equal` dependency | ||
2.1.0 / 2019-07-24 | ||
------------------ | ||
2.1.0 / 2019-07-24 | ||
--- | ||
- Add `tx.from` as an array of addresses | ||
@@ -137,5 +169,6 @@ - Remove `tx.outputs` | ||
2.0.2 / 2019-07-12 | ||
------------------ | ||
2.0.2 / 2019-07-12 | ||
--- | ||
- utxo-collection: remove .merge's replaceByAddress flag | ||
@@ -145,38 +178,42 @@ - utxo-collection: memoize .addresses getter | ||
2.0.1 / 2019-06-21 | ||
------------------ | ||
2.0.1 / 2019-06-21 | ||
--- | ||
- `Tx` add parse feeAmount for Tron token | ||
2.0.0 / 2019-06-11 | ||
------------------ | ||
2.0.0 / 2019-06-11 | ||
--- | ||
- `@exodus/currency` bump to `1.0.0` | ||
- `@exodus/assets` bump to `2.0.0` | ||
1.0.2 / 2019-05-13 | ||
------------------ | ||
1.0.2 / 2019-05-13 | ||
--- | ||
- Give `Tx.data` a default value | ||
1.0.1 / 2019-05-08 | ||
------------------ | ||
1.0.1 / 2019-05-08 | ||
--- | ||
- Add `data` field to `Tx` | ||
1.0.0 / 2019-03-12 | ||
------------------ | ||
1.0.0 / 2019-03-12 | ||
--- | ||
- `@exodus/assets` to `1.0.0` | ||
## 0.1.4 / 2019-03-01 | ||
0.1.4 / 2019-03-01 | ||
------------------ | ||
- `Tx` introduce the concept of a dropped tx | ||
- `TxSet` account for dropped txs | ||
0.1.3 / 2019-02-07 | ||
------------------ | ||
0.1.3 / 2019-02-07 | ||
--- | ||
- `UtxosCollection.value` getter now caches. | ||
@@ -186,16 +223,19 @@ - `TxSet.getMutations` now accounts for failed txs with an error field. | ||
0.1.2 / 2018-12-05 | ||
------------------ | ||
0.1.2 / 2018-12-05 | ||
--- | ||
- `UtxosCollection/fee-estimator` does not enforce `P2PKH` addresses. | ||
0.1.1 / 2018-11-27 | ||
------------------ | ||
0.1.1 / 2018-11-27 | ||
--- | ||
- `UtxoCollection#addresses` now returns an `AddressSet`. | ||
- memoization on `size()` | ||
0.1.0 / 2018-11-11 | ||
------------------ | ||
0.1.0 / 2018-11-11 | ||
--- | ||
- upgrade `@exodus/currency` and `@exodus/assets` to ensure we get the version using `big-rational` intstead of `bignnumber.js` |
@@ -174,3 +174,3 @@ "use strict"; | ||
if (tx.sent && tx.feeAmount && tx.feeAmount.unitType === tx.coinAmount.unitType) { | ||
if (tx.feeAmount && tx.feeAmount.unitType === tx.coinAmount.unitType) { | ||
balance = balance.sub(tx.feeAmount); | ||
@@ -177,0 +177,0 @@ } |
@@ -31,3 +31,3 @@ "use strict"; | ||
this.meta = {}; | ||
this.token = null; | ||
this.tokens = []; | ||
this.data = {}; | ||
@@ -100,3 +100,8 @@ } | ||
if (json.duration) tx.duration = json.duration; | ||
if (json.token) tx.token = json.token; | ||
if (json.tokens) { | ||
(0, _assert.default)(Array.isArray(json.tokens), 'Tx.fromJSON(): tokens has to be an array.'); | ||
tx.tokens = json.tokens; | ||
} else if (json.token) tx.tokens = [json.token]; | ||
if (json.data) tx.data = json.data; | ||
@@ -119,3 +124,2 @@ if (json.meta) tx.meta = Object.assign({}, json.meta); | ||
if (json.height) tx.height = json.height; | ||
return (0, _proxyFreeze.default)(tx); | ||
@@ -159,3 +163,3 @@ } | ||
if (Object.keys(obj.meta).length === 0) delete obj.meta; | ||
if (!obj.token) delete obj.token; | ||
if (!obj.tokens.length) delete obj.tokens; | ||
return obj; | ||
@@ -208,2 +212,6 @@ } | ||
get token() { | ||
return this.tokens[0] || null; | ||
} | ||
} | ||
@@ -210,0 +218,0 @@ |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = exports.LEDGER_SRC = exports.TREZOR_SRC = exports.EXODUS_SRC = void 0; | ||
exports.default = exports.getDefaultLabel = exports.LABEL_MAX_LENGTH = exports.DEFAULT_ICONS = exports.DEFAULT_COLORS = exports.LEDGER_SRC = exports.TREZOR_SRC = exports.EXODUS_SRC = void 0; | ||
@@ -23,3 +23,26 @@ var _proxyFreeze = _interopRequireDefault(require("proxy-freeze")); | ||
exports.LEDGER_SRC = LEDGER_SRC; | ||
const DEFAULT_COLORS = Object.freeze({ | ||
exodus: '#ff3974', | ||
trezor: '#7b39ff', | ||
ledger: '#f5e400' | ||
}); | ||
exports.DEFAULT_COLORS = DEFAULT_COLORS; | ||
const DEFAULT_ICONS = Object.freeze({ | ||
exodus: 'exodus', | ||
trezor: 'trezor', | ||
ledger: 'trezor' | ||
}); | ||
exports.DEFAULT_ICONS = DEFAULT_ICONS; | ||
const LABEL_MAX_LENGTH = 100; | ||
exports.LABEL_MAX_LENGTH = LABEL_MAX_LENGTH; | ||
const capFirst = str => str[0].toUpperCase() + str.slice(1); | ||
const getDefaultLabel = ({ | ||
source, | ||
index | ||
}) => index === 0 ? capFirst(source) : ''; | ||
exports.getDefaultLabel = getDefaultLabel; | ||
const isColor = str => typeof str === 'string' && /^#[0-9a-fA-F]{3,6}/.test(str); | ||
@@ -37,3 +60,4 @@ | ||
color, | ||
icon | ||
icon, | ||
enabled = true | ||
}) { | ||
@@ -58,2 +82,4 @@ _defineProperty(this, "source", void 0); | ||
_defineProperty(this, "enabled", void 0); | ||
if (!source) { | ||
@@ -77,8 +103,19 @@ throw new Error('expected "source" for a wallet account'); | ||
if (color && !isColor(color)) { | ||
color = color || DEFAULT_COLORS[source]; | ||
icon = icon || DEFAULT_ICONS[source]; | ||
label = label || getDefaultLabel({ | ||
source, | ||
index | ||
}); | ||
if (label.length > LABEL_MAX_LENGTH) { | ||
label = label.slice(0, LABEL_MAX_LENGTH); | ||
} | ||
if (!isColor(color)) { | ||
throw new Error('expected "color" to be a hex string'); | ||
} | ||
if (icon && typeof icon !== 'string') { | ||
throw new Error('expected "icon" to be a string'); | ||
if (typeof icon !== 'string' || !icon.length) { | ||
throw new Error('expected "icon" to be a non-empty string'); | ||
} | ||
@@ -95,2 +132,3 @@ | ||
this.icon = icon; | ||
this.enabled = enabled; | ||
return (0, _proxyFreeze.default)(this); | ||
@@ -112,3 +150,4 @@ } | ||
color: this.color, | ||
icon: this.icon | ||
icon: this.icon, | ||
enabled: this.enabled | ||
}; | ||
@@ -140,2 +179,14 @@ if (this.id != null) json.id = this.id; | ||
exports.default = WalletAccount; | ||
exports.default = WalletAccount; | ||
_defineProperty(WalletAccount, "LABEL_MAX_LENGTH", LABEL_MAX_LENGTH); | ||
_defineProperty(WalletAccount, "DEFAULT_COLORS", DEFAULT_COLORS); | ||
_defineProperty(WalletAccount, "DEFAULT_ICONS", DEFAULT_ICONS); | ||
_defineProperty(WalletAccount, "EXODUS_SRC", EXODUS_SRC); | ||
_defineProperty(WalletAccount, "TREZOR_SRC", TREZOR_SRC); | ||
_defineProperty(WalletAccount, "LEDGER_SRC", LEDGER_SRC); |
{ | ||
"name": "@exodus/models", | ||
"version": "8.3.0", | ||
"version": "8.4.0", | ||
"description": "Exodus models", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
49389
1208
1