@exodus/models
Advanced tools
Comparing version 2.2.0 to 3.0.0
@@ -0,1 +1,7 @@ | ||
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,0 +8,0 @@ ------------------ |
@@ -29,3 +29,2 @@ "use strict"; | ||
this.from = []; | ||
this.personalNote = ''; | ||
this.meta = {}; | ||
@@ -53,8 +52,30 @@ this.token = null; | ||
if (json.feeAmount && json.coinName) { | ||
let feeAmount = json.feeAmount; | ||
let coinName = json.coinName; | ||
if (String(json.feeAmount).endsWith('ETH')) coinName = 'ethereum'; | ||
if (String(json.feeAmount).endsWith('TRX')) coinName = 'tronmainnet'; | ||
if (String(json.feeAmount).endsWith('BTC')) coinName = 'bitcoin'; | ||
if (String(json.feeAmount).endsWith('GAS')) coinName = 'neogas'; | ||
tx.feeAmount = parseCurrency(json.feeAmount, coinName); | ||
switch (_assets.default[coinName].assetType) { | ||
case 'ETHEREUM_ERC20': | ||
coinName = 'ethereum'; | ||
break; | ||
case 'VECHAIN_TOKEN': | ||
coinName = 'vethor'; | ||
break; | ||
case 'TRON_TOKEN': | ||
coinName = 'tronmainnet'; | ||
break; | ||
} | ||
if (coinName === 'vechainthor') coinName = 'vethor'; | ||
if (coinName === 'neo') { | ||
coinName = 'neogas'; | ||
if (String(json.feeAmount) === '0 NEO') { | ||
feeAmount = '0 GAS'; | ||
} | ||
} | ||
tx.feeAmount = parseCurrency(feeAmount, coinName); | ||
} else if (json.feeAmount && !json.coinName && (0, _currency.isNumberUnit)(json.feeAmount)) { | ||
@@ -72,3 +93,2 @@ tx.feeAmount = json.feeAmount; | ||
if (json.duration) tx.duration = json.duration; | ||
if (json.personalNote) tx.personalNote = json.personalNote; | ||
if (json.token) tx.token = json.token; | ||
@@ -127,3 +147,2 @@ if (json.data) tx.data = json.data; | ||
if (obj.from.length === 0) delete obj.from; | ||
if (!obj.personalNote) delete obj.personalNote; | ||
if (Object.keys(obj.data).length === 0) delete obj.data; | ||
@@ -130,0 +149,0 @@ return obj; |
{ | ||
"name": "@exodus/models", | ||
"version": "2.2.0", | ||
"version": "3.0.0", | ||
"description": "Exodus models", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
31265
773