aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/containers
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-06 12:36:05 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-07 01:11:30 +0800
commit3898b8e8ab083689221e39de6b18fe31e6699d38 (patch)
tree3a391b102aad84020edd74ee5912102a86dd7ada /packages/website/ts/containers
parent7ee7f9978049383030be8fd95100a9dfcd1923a3 (diff)
downloaddexon-0x-contracts-3898b8e8ab083689221e39de6b18fe31e6699d38.tar.gz
dexon-0x-contracts-3898b8e8ab083689221e39de6b18fe31e6699d38.tar.zst
dexon-0x-contracts-3898b8e8ab083689221e39de6b18fe31e6699d38.zip
Wrap AllowanceToggle in redux container
Diffstat (limited to 'packages/website/ts/containers')
-rw-r--r--packages/website/ts/containers/inputs/allowance_toggle.ts42
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);