Daniel Ternyak ab5fa1a799
Support Non-Ethereum Networks (#849)
* Make UnlockHeader a PureComponent

* MVP

* actually disable wallet format if not determined to be valid format for wallet

* default to correct derivation in mnemonic modal

* cleanup

* fix tslint

* use enums for HD wallet getPath

* Add stricter typing

* Fix labels not updating on selector

* Ban hardware wallet support for custom network unsupported chainIds

* Fix type error

* Fix custom node dPath not being saved

* Fix mnemonic modal

* default path bugfixes

* add react-select

* misc fixes; rabbit holing hard.

* fix tslint

* revert identicon changes

* reload on network change :/

* actually reload on network change

* really really reload on network change

* tslint fixes

* Update styles

* set table width

* fix package versioning

* push broken sagas

* Fix saga test

* fix tslint

* address round of review

* move non-selectors out to utilty; adjust reload timer

* cleanup network util comments

* manage wallet disable at WalletDecrypt instead of in both WalletDecrypt and WalletButton

* Separate WalletDecrypt props into ownProps / StateProps

* disable payment requests on non-eth networks

* specialize connect; separate props

* remove unused state prop

* remove bad import

* create tests for networks

* Clarify Lite-Send error on non-ethereum networkS

* remove string option for network config name

* Create concept of always-on 'EXTRA_PATHS'; include SINGULAR_DTV legacy dPath in 'EXTRA_PATHS'

* fix multiple imports

* address PR comments
2018-01-20 14:06:28 -06:00

44 lines
1.2 KiB
TypeScript

import { BTCTxExplorer, ETHTxExplorer } from './data';
export type WhitelistedCoins = 'BTC' | 'REP' | 'ETH';
const serverURL = 'https://bity.myetherapi.com';
const bityURL = 'https://bity.com/api';
const BTCMin = 0.01;
const BTCMax = 3;
// while Bity is supposedly OK with any order that is at least 0.01 BTC Worth, the order will fail if you send 0.01 BTC worth of ETH.
// This is a bad magic number, but will suffice for now
// value = percent higher/lower than 0.01 BTC worth
const buffers = {
ETH: 0.1,
REP: 0.2
};
// rate must be BTC[KIND]
export function generateKindMin(BTCKINDRate: number, kind: keyof typeof buffers): number {
const kindMinVal = BTCKINDRate * BTCMin;
return kindMinVal + kindMinVal * buffers[kind];
}
// rate must be BTC[KIND]
export function generateKindMax(BTCKINDRate: number, kind: keyof typeof buffers): number {
const kindMax = BTCKINDRate * BTCMax;
return kindMax - kindMax * buffers[kind];
}
export const bityConfig = {
serverURL,
bityURL,
ETHTxExplorer,
BTCTxExplorer,
BTCMin,
BTCMax,
validStatus: ['RCVE', 'FILL', 'CONF', 'EXEC'],
invalidStatus: ['CANC'],
postConfig: {
headers: {
'Content-Type': 'application/json; charset:UTF-8'
}
}
};