@exodus/trezor-meta
Advanced tools
Comparing version 2.3.2 to 3.0.0
{ | ||
"name": "@exodus/trezor-meta", | ||
"version": "2.3.2", | ||
"version": "3.0.0", | ||
"description": "trezor constants, firmware, and utils", | ||
@@ -56,3 +56,2 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"@exodus/assets-base": "^8.0.53", | ||
"lodash": "^4.17.19" | ||
@@ -59,0 +58,0 @@ }, |
123
src/meta.js
const lodash = require('lodash') | ||
const semver = require('semver') | ||
const { default: assets } = require('@exodus/assets-base') | ||
const constants = require('./constants') | ||
const coinUtil = require('./coin-util') | ||
const ERC20_TOKEN_NAMES = Object.keys(assets).filter( | ||
(assetName) => assets[assetName].assetType === 'ETHEREUM_ERC20' | ||
) | ||
module.exports = (assets) => { | ||
const ERC20_TOKEN_NAMES = Object.keys(assets).filter( | ||
(assetName) => assets[assetName].assetType === 'ETHEREUM_ERC20' | ||
) | ||
const isSupportedFirmware = ({ | ||
model, | ||
major_version: major, | ||
minor_version: minor, | ||
patch_version: patch, | ||
}) => semver.gte([major, minor, patch].join('.'), constants.MINIMUM_FIRMWARE_VERSIONS[model]) | ||
const isSupportedFirmware = ({ | ||
model, | ||
major_version: major, | ||
minor_version: minor, | ||
patch_version: patch, | ||
}) => semver.gte([major, minor, patch].join('.'), constants.MINIMUM_FIRMWARE_VERSIONS[model]) | ||
const SUPPORTED_MODELS = ['T', '1'] | ||
const SUPPORTED_MODELS = ['T', '1'] | ||
// Assets supported by both trezor models on Exodus | ||
const BASE_SUPPORTED_ASSETS = [ | ||
'bitcoin', | ||
'ethereum', | ||
'dash', | ||
'dogecoin', | ||
'decred', | ||
'bgold', | ||
'litecoin', | ||
'bcash', | ||
'ethereumclassic', | ||
'zcash', | ||
'stellar', | ||
'digibyte', | ||
...ERC20_TOKEN_NAMES, | ||
].sort() | ||
// Assets supported by both trezor models on Exodus | ||
const BASE_SUPPORTED_ASSETS = [ | ||
'bitcoin', | ||
'ethereum', | ||
'dash', | ||
'dogecoin', | ||
'decred', | ||
'bgold', | ||
'litecoin', | ||
'bcash', | ||
'ethereumclassic', | ||
'zcash', | ||
'stellar', | ||
'digibyte', | ||
...ERC20_TOKEN_NAMES, | ||
].sort() | ||
// Assets supported by specific Trezor models on Exodus. | ||
const ASSETS_BY_MODEL = { | ||
T: [...BASE_SUPPORTED_ASSETS, 'ripple'].sort(), | ||
1: [...BASE_SUPPORTED_ASSETS], | ||
} | ||
// Assets supported by specific Trezor models on Exodus. | ||
const ASSETS_BY_MODEL = { | ||
T: [...BASE_SUPPORTED_ASSETS, 'ripple'].sort(), | ||
1: [...BASE_SUPPORTED_ASSETS], | ||
} | ||
// An object of asset names sorted by the device model which supports them. | ||
// Indicates assets supported on the firmware, but not necessarily | ||
// supported by our trezor integration yet | ||
const FIRMWARE_ASSETS_BY_MODEL = { | ||
T: [...constants.ASSETS_BY_MODEL.T, ...ERC20_TOKEN_NAMES], | ||
1: [...constants.ASSETS_BY_MODEL['1'], ...ERC20_TOKEN_NAMES], | ||
} | ||
// An object of asset names sorted by the device model which supports them. | ||
// Indicates assets supported on the firmware, but not necessarily | ||
// supported by our trezor integration yet | ||
const FIRMWARE_ASSETS_BY_MODEL = { | ||
T: [...constants.ASSETS_BY_MODEL.T, ...ERC20_TOKEN_NAMES], | ||
1: [...constants.ASSETS_BY_MODEL['1'], ...ERC20_TOKEN_NAMES], | ||
} | ||
// Assets supported by either model. | ||
const SUPPORTED_ASSETS = lodash.uniq([].concat(...Object.values(ASSETS_BY_MODEL))).sort() | ||
// Assets supported by either model. | ||
const SUPPORTED_ASSETS = lodash.uniq([].concat(...Object.values(ASSETS_BY_MODEL))).sort() | ||
// Assets supported only by model T. | ||
const SUPPORTED_ONLY_BY_MODEL_T = lodash.difference(ASSETS_BY_MODEL.T, ASSETS_BY_MODEL['1']) | ||
// Assets supported only by model T. | ||
const SUPPORTED_ONLY_BY_MODEL_T = lodash.difference(ASSETS_BY_MODEL.T, ASSETS_BY_MODEL['1']) | ||
// Assets we are planning to support in future. | ||
const FUTURE_SUPPORTED_ASSETS = ['tezos', 'lisk', 'ravencoin'] | ||
// Assets we are planning to support in future. | ||
const FUTURE_SUPPORTED_ASSETS = ['tezos', 'lisk', 'ravencoin'] | ||
const isSegwit = (assetName) => | ||
assets[assetName].assetType !== 'ETHEREUM_ERC20' && coinUtil.isSegwit(assetName) | ||
const isSegwit = (assetName) => | ||
assets[assetName].assetType !== 'ETHEREUM_ERC20' && coinUtil.isSegwit(assetName) | ||
const isSupportedByTrezor = (assetName) => SUPPORTED_ASSETS.includes(assetName) | ||
const isSupportedByTrezor = (assetName) => SUPPORTED_ASSETS.includes(assetName) | ||
const isSupportedOnlyByModelT = (assetName) => SUPPORTED_ONLY_BY_MODEL_T.includes(assetName) | ||
const isSupportedOnlyByModelT = (assetName) => SUPPORTED_ONLY_BY_MODEL_T.includes(assetName) | ||
module.exports = { | ||
isSupportedFirmware, | ||
SUPPORTED_MODELS, | ||
BASE_SUPPORTED_ASSETS, | ||
ASSETS_BY_MODEL, | ||
FIRMWARE_ASSETS_BY_MODEL, | ||
SUPPORTED_ASSETS, | ||
SUPPORTED_ONLY_BY_MODEL_T, | ||
FUTURE_SUPPORTED_ASSETS, | ||
isSegwit, | ||
isSupportedByTrezor, | ||
isSupportedOnlyByModelT, | ||
module.exports = { | ||
isSupportedFirmware, | ||
SUPPORTED_MODELS, | ||
BASE_SUPPORTED_ASSETS, | ||
ASSETS_BY_MODEL, | ||
FIRMWARE_ASSETS_BY_MODEL, | ||
SUPPORTED_ASSETS, | ||
SUPPORTED_ONLY_BY_MODEL_T, | ||
FUTURE_SUPPORTED_ASSETS, | ||
isSegwit, | ||
isSupportedByTrezor, | ||
isSupportedOnlyByModelT, | ||
} | ||
} |
24274
1
854
- Removed@exodus/assets-base@^8.0.53
- Removed@exodus/asset@1.2.0(transitive)
- Removed@exodus/assets-base@8.2.0(transitive)
- Removed@exodus/aurora-meta@1.0.5(transitive)
- Removed@exodus/basemainnet-meta@1.0.8(transitive)
- Removed@exodus/basic-utils@1.5.0(transitive)
- Removed@exodus/bitcoin-meta@1.0.2(transitive)
- Removed@exodus/bitcoinregtest-meta@1.0.1(transitive)
- Removed@exodus/bitcointestnet-meta@1.0.1(transitive)
- Removed@exodus/currency@2.3.3(transitive)
- Removed@exodus/ethereum-meta@1.5.1(transitive)
- Removed@exodus/ethereumclassic-meta@1.0.3(transitive)
- Removed@exodus/ethereumholesky-meta@1.0.3(transitive)
- Removed@exodus/fantommainnet-meta@1.1.2(transitive)
- Removed@exodus/matic-meta@1.3.0(transitive)
- Removed@exodus/optimism-meta@1.3.0(transitive)
- Removed@exodus/rootstock-meta@1.0.7(transitive)
- Removed@exodus/solana-meta@1.2.0(transitive)
- Removedbn.js@5.2.1(transitive)
- Removedminimalistic-assert@1.0.1(transitive)