Backporting to beta (#4418)
* v1.5.1 * Disable notifications (#4243) * Fix wrong token handling (#4254) * Fixing wrong token displayed * Linting * Revert filtering out * Revert the revert * Don't panic on uknown git commit hash (#4231) * Additional logs for own transactions (#4278) * Integration with zgp whitelist contract (#4215) * zgp-transactions checker * polishing * rename + refactor * refuse-service-transactions cl option * fixed tests compilation * Renaming signAndSendTransaction to sendTransaction (#4351) * Fixed deadlock in external_url (#4354) * Fixing web3 in console (#4382) * Fixing estimate gas in case histogram is not available (#4387) * Restarting fetch client every now and then (#4399)
This commit is contained in:
committed by
Gav Wood
parent
b09cfe1885
commit
c7dbd87f8e
@@ -41,7 +41,7 @@ class Balance extends Component {
|
||||
|
||||
let body = (balance.tokens || [])
|
||||
.filter((balance) => new BigNumber(balance.value).gt(0))
|
||||
.map((balance) => {
|
||||
.map((balance, index) => {
|
||||
const token = balance.token;
|
||||
|
||||
let value;
|
||||
@@ -76,7 +76,8 @@ class Balance extends Component {
|
||||
return (
|
||||
<div
|
||||
className={ styles.balance }
|
||||
key={ token.tag }>
|
||||
key={ `${index}_${token.tag}` }
|
||||
>
|
||||
<img
|
||||
src={ imagesrc }
|
||||
alt={ token.name } />
|
||||
|
||||
@@ -124,7 +124,12 @@ export default class GasPriceEditor {
|
||||
@action loadDefaults () {
|
||||
Promise
|
||||
.all([
|
||||
this._api.parity.gasPriceHistogram(),
|
||||
// NOTE fetching histogram may fail if there is not enough data.
|
||||
// We fallback to empty histogram.
|
||||
this._api.parity.gasPriceHistogram().catch(() => ({
|
||||
bucket_bounds: [],
|
||||
counts: []
|
||||
})),
|
||||
this._api.eth.gasPrice()
|
||||
])
|
||||
.then(([histogram, _price]) => {
|
||||
|
||||
@@ -62,6 +62,31 @@ describe('ui/GasPriceEditor/store', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('constructor (defaults) when histogram not available', () => {
|
||||
const api = {
|
||||
eth: {
|
||||
gasPrice: sinon.stub().resolves(GASPRICE)
|
||||
},
|
||||
parity: {
|
||||
gasPriceHistogram: sinon.stub().rejects('Data not available')
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
store = new Store(api, { gasLimit: GASLIMIT });
|
||||
});
|
||||
|
||||
it('retrieves the histogram and gasPrice', done => {
|
||||
expect(api.eth.gasPrice).to.have.been.called;
|
||||
expect(api.parity.gasPriceHistogram).to.have.been.called;
|
||||
|
||||
setImmediate(() => {
|
||||
expect(store.histogram).not.to.be.null;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('setters', () => {
|
||||
beforeEach(() => {
|
||||
store = new Store(null, { gasLimit: GASLIMIT });
|
||||
|
||||
Reference in New Issue
Block a user