diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-06-06 12:36:05 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-06-07 01:11:30 +0800 |
commit | 3898b8e8ab083689221e39de6b18fe31e6699d38 (patch) | |
tree | 3a391b102aad84020edd74ee5912102a86dd7ada /packages/website/ts/containers | |
parent | 7ee7f9978049383030be8fd95100a9dfcd1923a3 (diff) | |
download | dexon-sol-tools-3898b8e8ab083689221e39de6b18fe31e6699d38.tar dexon-sol-tools-3898b8e8ab083689221e39de6b18fe31e6699d38.tar.gz dexon-sol-tools-3898b8e8ab083689221e39de6b18fe31e6699d38.tar.bz2 dexon-sol-tools-3898b8e8ab083689221e39de6b18fe31e6699d38.tar.lz dexon-sol-tools-3898b8e8ab083689221e39de6b18fe31e6699d38.tar.xz dexon-sol-tools-3898b8e8ab083689221e39de6b18fe31e6699d38.tar.zst dexon-sol-tools-3898b8e8ab083689221e39de6b18fe31e6699d38.zip |
Wrap AllowanceToggle in redux container
Diffstat (limited to 'packages/website/ts/containers')
-rw-r--r-- | packages/website/ts/containers/inputs/allowance_toggle.ts | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/packages/website/ts/containers/inputs/allowance_toggle.ts b/packages/website/ts/containers/inputs/allowance_toggle.ts new file mode 100644 index 000000000..1dd7b2101 --- /dev/null +++ b/packages/website/ts/containers/inputs/allowance_toggle.ts @@ -0,0 +1,42 @@ +import * as React from 'react'; +import { BalanceErrs, Token, TokenState } from 'ts/types'; +import { ActionTypes, ProviderType, TokenByAddress, TokenStateByAddress } from 'ts/types'; +import { connect } from 'react-redux'; +import { Dispatch } from 'redux'; +import { Blockchain } from 'ts/blockchain'; +import { State } from 'ts/redux/reducer'; + +import { AllowanceToggle as AllowanceToggleComponent } from 'ts/components/inputs/allowance_toggle'; +import { Dispatcher } from 'ts/redux/dispatcher'; + +interface AllowanceToggleProps { + blockchain: Blockchain; + onErrorOccurred?: (errType: BalanceErrs) => void; + token: Token; + tokenState: TokenState; + isDisabled: boolean; + refetchTokenStateAsync: () => Promise<void>; +} + +interface ConnectedState { + networkId: number; + userAddress: string; +} + +interface ConnectedDispatch { + dispatcher: Dispatcher; +} + +const mapStateToProps = (state: State, ownProps: AllowanceToggleProps): ConnectedState => ({ + networkId: state.networkId, + userAddress: state.userAddress, +}); + +const mapDispatchTopProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({ + dispatcher: new Dispatcher(dispatch), +}); + +export const AllowanceToggle: React.ComponentClass<AllowanceToggleProps> = connect( + mapStateToProps, + mapDispatchTopProps, +)(AllowanceToggleComponent); |