From 98c16610c838e14380146c4af5785876bbecf690 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 6 Aug 2018 12:59:57 +0200 Subject: [PATCH] Change makeContract$ to makeContract --- packages/fether-react/src/stores/sendStore.spec.js | 4 ++-- packages/fether-react/src/utils/estimateGas.js | 6 +++--- packages/fether-react/src/utils/estimateGas.spec.js | 6 +++--- packages/fether-react/src/utils/testHelpers/mock.js | 2 +- packages/fether-react/src/utils/withBalance.js | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/fether-react/src/stores/sendStore.spec.js b/packages/fether-react/src/stores/sendStore.spec.js index f6b3730c..61e4b8f6 100644 --- a/packages/fether-react/src/stores/sendStore.spec.js +++ b/packages/fether-react/src/stores/sendStore.spec.js @@ -20,7 +20,7 @@ jest.mock('@parity/light.js', () => ({ unsubscribe: jest.fn() })) })), - makeContract$: jest.fn(() => mock.makeContract$), + makeContract: jest.fn(() => mock.makeContract), post$: jest.fn(() => mock.post$) })); @@ -88,7 +88,7 @@ describe('method send', () => { test('should call transfer$ if the token is Erc20', () => { sendStore.send(mock.erc20); - expect(mock.makeContract$.transfer$).toHaveBeenCalledWith( + expect(mock.makeContract.transfer$).toHaveBeenCalledWith( '0x123', new BigNumber('10000000000000000'), { gasPrice: new BigNumber('4000000000') } diff --git a/packages/fether-react/src/utils/estimateGas.js b/packages/fether-react/src/utils/estimateGas.js index 2be93363..be906a50 100644 --- a/packages/fether-react/src/utils/estimateGas.js +++ b/packages/fether-react/src/utils/estimateGas.js @@ -5,7 +5,7 @@ import abi from '@parity/shared/lib/contracts/abi/eip20'; import BigNumber from 'bignumber.js'; -import { makeContract$ } from '@parity/light.js'; +import { makeContract } from '@parity/light.js'; import memoize from 'lodash/memoize'; import { toWei } from '@parity/api/lib/util/wei'; @@ -15,7 +15,7 @@ const debug = Debug('estimateGas'); const GAS_MULT_FACTOR = 1.25; // Since estimateGas is not always accurate, we add a 33% factor for buffer. export const contractForToken = memoize(tokenAddress => - makeContract$(tokenAddress, abi) + makeContract(tokenAddress, abi) ); /** @@ -70,7 +70,7 @@ const addBuffer = estimated => { /** * This.tx is a user-friendly tx object. We convert it now as it can be - * passed to makeContract$.transfer(...). + * passed to makeContract.transfer(...). */ export const txForErc20 = (tx, token) => { return { diff --git a/packages/fether-react/src/utils/estimateGas.spec.js b/packages/fether-react/src/utils/estimateGas.spec.js index 34080429..a8272114 100644 --- a/packages/fether-react/src/utils/estimateGas.spec.js +++ b/packages/fether-react/src/utils/estimateGas.spec.js @@ -13,13 +13,13 @@ import { estimateGas, contractForToken } from './estimateGas'; import * as mock from './testHelpers/mock'; jest.mock('@parity/light.js', () => ({ - makeContract$: jest.fn(() => mock.makeContract$) + makeContract: jest.fn(() => mock.makeContract) })); describe('contractForToken', () => { - test('should call makeContract$', () => { + test('should call makeContract', () => { contractForToken('foo'); - expect(lightJs.makeContract$).toHaveBeenCalledWith('foo', abi); + expect(lightJs.makeContract).toHaveBeenCalledWith('foo', abi); }); test('should be memoized', () => { diff --git a/packages/fether-react/src/utils/testHelpers/mock.js b/packages/fether-react/src/utils/testHelpers/mock.js index 08e18c7a..e2f1265a 100644 --- a/packages/fether-react/src/utils/testHelpers/mock.js +++ b/packages/fether-react/src/utils/testHelpers/mock.js @@ -32,7 +32,7 @@ export const eth = { address: 'ETH' }; -export const makeContract$ = { +export const makeContract = { contractObject: { instance: { transfer: { diff --git a/packages/fether-react/src/utils/withBalance.js b/packages/fether-react/src/utils/withBalance.js index 2292bf64..8b0cc047 100644 --- a/packages/fether-react/src/utils/withBalance.js +++ b/packages/fether-react/src/utils/withBalance.js @@ -9,7 +9,7 @@ import compose from 'recompose/compose'; import { defaultAccount$, isNullOrLoading, - makeContract$, + makeContract, myBalance$ } from '@parity/light.js'; import { filter, map, switchMap } from 'rxjs/operators'; @@ -22,7 +22,7 @@ export const withErc20Balance = light({ defaultAccount$().pipe( filter(x => x), switchMap(defaultAccount => - makeContract$(token.address, abi).balanceOf$(defaultAccount) + makeContract(token.address, abi).balanceOf$(defaultAccount) ), map(value => (isNullOrLoading(value) ? null : value)), // Transform loading state to null map(value => value && value.div(10 ** token.decimals)) -- GitLab