merge
This commit is contained in:
parent
e567757c91
commit
eeb7f8562b
28
.travis.yml
28
.travis.yml
|
@ -35,31 +35,21 @@ before_install:
|
|||
sh -e /etc/init.d/xvfb start
|
||||
# uncomment once integration tests are included in CI
|
||||
# docker pull dternyak/eth-priv-to-addr:latest
|
||||
sudo apt-get install libusb-1.0
|
||||
sudo apt-get install libusb-1.0
|
||||
fi
|
||||
|
||||
|
||||
install:
|
||||
- yarn --silent
|
||||
|
||||
script:
|
||||
- |
|
||||
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
||||
npm run prettier:diff
|
||||
npm run test:coverage -- --maxWorkers=2
|
||||
npm run report-coverage
|
||||
npm run tslint
|
||||
npm run tscheck
|
||||
npm run freezer
|
||||
npm run freezer:validate
|
||||
fi
|
||||
before_script:
|
||||
- chmod +x ./travis-scripts/test-{linux,osx}.sh
|
||||
|
||||
script:
|
||||
- ./travis-scripts/test-linux.sh
|
||||
- ./travis-scripts/test-osx.sh
|
||||
|
||||
- |
|
||||
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||
npm run build:electron
|
||||
ls -la dist/electron-builds
|
||||
fi
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
on_failure: never
|
||||
on_failure: never
|
49
README.md
49
README.md
|
@ -5,40 +5,52 @@
|
|||
* **Just looking to download?** Grab our [latest release](https://github.com/MyCryptoHQ/MyCrypto/releases).
|
||||
* **Looking for the old site?** Check out [https://legacy.mycrypto.com](https://legacy.mycrypto.com) or the source at [MyCryptoHQ/mycrypto.com](https://github.com/MyCryptoHQ/mycrypto.com)
|
||||
|
||||
## Requirements
|
||||
|
||||
* Node 8.9.4\*
|
||||
* Yarn >= 1.7.0\*\*
|
||||
* Python 2.7.X\*\*\*
|
||||
|
||||
<sub>\*Higher versions should work fine, but may cause inconsistencies. It's suggested you run 8.9.4 using `nvm`.</sub>
|
||||
<br/>
|
||||
<sub>**npm is NOT supported for package management. MyCrypto uses yarn.lock to ensure sub-dependency versions are pinned, so yarn is required to install node_modules</sub>
|
||||
<br/>
|
||||
<sub>\***Python 3 is **not** supported, since our dependencies use `node-gyp`.</sub>
|
||||
|
||||
## Running the App
|
||||
|
||||
This codebase targets Node 8.9.4 (LTS). After `npm install`ing all dependencies (You may be required to install additional system dependencies, due to some node modules relying on them) you can run various commands depending on what you want to do:
|
||||
After `yarn`ing all dependencies you can run various commands depending on what you want to do:
|
||||
|
||||
#### Development
|
||||
|
||||
```bash
|
||||
# run app in dev mode in browser, rebuild on file changes
|
||||
npm run dev
|
||||
yarn dev
|
||||
```
|
||||
|
||||
```bash
|
||||
# run app in dev mode in electron, rebuild on file changes
|
||||
npm run dev:electron
|
||||
yarn dev:electron
|
||||
```
|
||||
|
||||
#### Build Releases
|
||||
|
||||
```bash
|
||||
# builds the production server app
|
||||
npm run build
|
||||
yarn build
|
||||
```
|
||||
|
||||
```bash
|
||||
# builds the downloadable version of the site
|
||||
npm run build:downloadable
|
||||
yarn build:downloadable
|
||||
```
|
||||
|
||||
```bash
|
||||
# builds the electron apps
|
||||
npm run build:electron
|
||||
yarn build:electron
|
||||
|
||||
# builds only one OS's electron app
|
||||
npm run build:electron:(osx|linux|windows)
|
||||
yarn build:electron:(osx|linux|windows)
|
||||
```
|
||||
|
||||
All of these builds are output to a folder in `dist/`.
|
||||
|
@ -47,26 +59,26 @@ All of these builds are output to a folder in `dist/`.
|
|||
|
||||
```bash
|
||||
# run unit tests with Jest
|
||||
npm run test
|
||||
yarn test
|
||||
```
|
||||
|
||||
#### Integration Tests:
|
||||
|
||||
```bash
|
||||
# run integration tests with Jest
|
||||
npm run test:int
|
||||
yarn test:int
|
||||
```
|
||||
|
||||
#### Dev (HTTPS):
|
||||
|
||||
Some parts of the site, such as the Ledger wallet, require an HTTPS environment to work. To develop on HTTPS, do the following:
|
||||
|
||||
1. Create your own SSL Certificate (Heroku has a [nice guide here](https://devcenter.heroku.com/articles/ssl-certificate-self))
|
||||
2. Move the `.key` and `.crt` files into `webpack_config/server.*`
|
||||
3. Run the following command:
|
||||
1. Create your own SSL Certificate (Heroku has a [nice guide here](https://devcenter.heroku.com/articles/ssl-certificate-self))
|
||||
2. Move the `.key` and `.crt` files into `webpack_config/server.*`
|
||||
3. Run the following command:
|
||||
|
||||
```bash
|
||||
npm run dev:https
|
||||
yarn dev:https
|
||||
```
|
||||
|
||||
#### Address Derivation Checker:
|
||||
|
@ -79,20 +91,20 @@ To test for correct address derivation, the address derivation checker uses mult
|
|||
|
||||
##### The derivation checker utility assumes that you have:
|
||||
|
||||
1. Docker installed/available
|
||||
2. [dternyak/eth-priv-to-addr](https://hub.docker.com/r/dternyak/eth-priv-to-addr/) pulled from DockerHub
|
||||
1. Docker installed/available
|
||||
2. [dternyak/eth-priv-to-addr](https://hub.docker.com/r/dternyak/eth-priv-to-addr/) pulled from DockerHub
|
||||
|
||||
##### Docker setup instructions:
|
||||
|
||||
1. Install docker (on macOS, [Docker for Mac](https://docs.docker.com/docker-for-mac/) is suggested)
|
||||
2. `docker pull dternyak/eth-priv-to-addr`
|
||||
1. Install docker (on macOS, [Docker for Mac](https://docs.docker.com/docker-for-mac/) is suggested)
|
||||
2. `docker pull dternyak/eth-priv-to-addr`
|
||||
|
||||
##### Run Derivation Checker
|
||||
|
||||
The derivation checker utility runs as part of the integration test suite.
|
||||
|
||||
```bash
|
||||
npm run test:int
|
||||
yarn test:int
|
||||
```
|
||||
|
||||
## Folder structure:
|
||||
|
@ -134,4 +146,3 @@ npm run test:int
|
|||
</a>
|
||||
|
||||
Cross browser testing and debugging provided by the very lovely team at BrowserStack.
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import React, { Component } from 'react';
|
||||
import { Store } from 'redux';
|
||||
import { Provider, connect } from 'react-redux';
|
||||
import { withRouter, Switch, Redirect, HashRouter, Route, BrowserRouter } from 'react-router-dom';
|
||||
import { withRouter, Switch, HashRouter, Route, BrowserRouter } from 'react-router-dom';
|
||||
|
||||
import { AppState } from 'features/reducers';
|
||||
import { getNetworkUnit, getTheme } from 'features/config';
|
||||
import { transactionMetaActions } from 'features/transaction';
|
||||
// Components
|
||||
import Contracts from 'containers/Tabs/Contracts';
|
||||
import ENS from 'containers/Tabs/ENS';
|
||||
|
@ -18,26 +23,23 @@ import QrSignerModal from 'containers/QrSignerModal';
|
|||
import OnboardModal from 'containers/OnboardModal';
|
||||
import WelcomeModal from 'components/WelcomeModal';
|
||||
import NewAppReleaseModal from 'components/NewAppReleaseModal';
|
||||
import { Store } from 'redux';
|
||||
import { pollOfflineStatus, TPollOfflineStatus } from 'actions/config';
|
||||
import { AppState } from 'reducers';
|
||||
import PalettePage from 'components/Palette';
|
||||
import { RouteNotFound } from 'components/RouteNotFound';
|
||||
import { RedirectWithQuery } from 'components/RedirectWithQuery';
|
||||
import { Theme } from 'config';
|
||||
import 'what-input';
|
||||
import { setUnitMeta, TSetUnitMeta } from 'actions/transaction';
|
||||
import { getNetworkUnit } from 'selectors/config';
|
||||
|
||||
interface OwnProps {
|
||||
store: Store<AppState>;
|
||||
}
|
||||
|
||||
interface StateProps {
|
||||
networkUnit: string;
|
||||
networkUnit: ReturnType<typeof getNetworkUnit>;
|
||||
theme: ReturnType<typeof getTheme>;
|
||||
}
|
||||
|
||||
interface DispatchProps {
|
||||
pollOfflineStatus: TPollOfflineStatus;
|
||||
setUnitMeta: TSetUnitMeta;
|
||||
setUnitMeta: transactionMetaActions.TSetUnitMeta;
|
||||
}
|
||||
|
||||
type Props = OwnProps & StateProps & DispatchProps;
|
||||
|
@ -52,15 +54,21 @@ class RootClass extends Component<Props, State> {
|
|||
};
|
||||
|
||||
public componentDidMount() {
|
||||
this.props.pollOfflineStatus();
|
||||
this.props.setUnitMeta(this.props.networkUnit);
|
||||
this.addBodyClasses();
|
||||
this.updateTheme(this.props.theme);
|
||||
}
|
||||
|
||||
public componentDidCatch(error: Error) {
|
||||
this.setState({ error });
|
||||
}
|
||||
|
||||
public componentDidUpdate(prevProps: Props) {
|
||||
if (this.props.theme !== prevProps.theme) {
|
||||
this.updateTheme(this.props.theme, prevProps.theme);
|
||||
}
|
||||
}
|
||||
|
||||
public render() {
|
||||
const { store } = this.props;
|
||||
const { error } = this.state;
|
||||
|
@ -69,18 +77,9 @@ class RootClass extends Component<Props, State> {
|
|||
return <ErrorScreen error={error} />;
|
||||
}
|
||||
|
||||
const CaptureRouteNotFound = withRouter(({ children, location }) => {
|
||||
return location && location.state && location.state.error ? (
|
||||
<PageNotFound />
|
||||
) : (
|
||||
(children as JSX.Element)
|
||||
);
|
||||
});
|
||||
|
||||
const routes = (
|
||||
<CaptureRouteNotFound>
|
||||
<Switch>
|
||||
<Redirect exact={true} from="/" to="/account" />
|
||||
<Route path="/account" component={SendTransaction} />
|
||||
<Route path="/generate" component={GenerateWallet} />
|
||||
<Route path="/swap" component={Swap} />
|
||||
|
@ -90,6 +89,10 @@ class RootClass extends Component<Props, State> {
|
|||
<Route path="/tx-status" component={CheckTransaction} exact={true} />
|
||||
<Route path="/pushTx" component={BroadcastTx} />
|
||||
<Route path="/support-us" component={SupportPage} exact={true} />
|
||||
{process.env.NODE_ENV !== 'production' && (
|
||||
<Route path="/dev/palette" component={PalettePage} exact={true} />
|
||||
)}
|
||||
<RedirectWithQuery exactArg={true} from="/" to="/account" pushArg={true} />
|
||||
<RouteNotFound />
|
||||
</Switch>
|
||||
</CaptureRouteNotFound>
|
||||
|
@ -102,8 +105,8 @@ class RootClass extends Component<Props, State> {
|
|||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Provider store={store} key={Math.random()}>
|
||||
<Router key={Math.random()}>
|
||||
<Provider store={store}>
|
||||
<Router>
|
||||
<React.Fragment>
|
||||
{routes}
|
||||
<LegacyRoutes />
|
||||
|
@ -141,6 +144,14 @@ class RootClass extends Component<Props, State> {
|
|||
|
||||
document.body.className += ` ${classes.join(' ')}`;
|
||||
}
|
||||
|
||||
private updateTheme(theme: Theme, oldTheme?: Theme) {
|
||||
const root = document.documentElement;
|
||||
if (oldTheme) {
|
||||
root.classList.remove(`theme--${oldTheme}`);
|
||||
}
|
||||
root.classList.add(`theme--${theme}`);
|
||||
}
|
||||
}
|
||||
|
||||
const LegacyRoutes = withRouter(props => {
|
||||
|
@ -183,13 +194,19 @@ const LegacyRoutes = withRouter(props => {
|
|||
);
|
||||
});
|
||||
|
||||
const mapStateToProps = (state: AppState) => {
|
||||
return {
|
||||
networkUnit: getNetworkUnit(state)
|
||||
};
|
||||
};
|
||||
const CaptureRouteNotFound = withRouter(({ children, location }) => {
|
||||
return location && location.state && location.state.error ? (
|
||||
<PageNotFound />
|
||||
) : (
|
||||
(children as JSX.Element)
|
||||
);
|
||||
});
|
||||
|
||||
const mapStateToProps = (state: AppState): StateProps => ({
|
||||
networkUnit: getNetworkUnit(state),
|
||||
theme: getTheme(state)
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, {
|
||||
pollOfflineStatus,
|
||||
setUnitMeta
|
||||
setUnitMeta: transactionMetaActions.setUnitMeta
|
||||
})(RootClass);
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
import { TypeKeys } from './constants';
|
||||
import {
|
||||
AddressLabel,
|
||||
AddressLabelEntry,
|
||||
SetAddressLabel,
|
||||
ClearAddressLabel,
|
||||
SetAddressLabelEntry,
|
||||
ChangeAddressLabelEntry,
|
||||
SaveAddressLabelEntry,
|
||||
ClearAddressLabelEntry,
|
||||
RemoveAddressLabelEntry
|
||||
} from './actionTypes';
|
||||
|
||||
export type TSetAddressLabel = typeof setAddressLabel;
|
||||
export function setAddressLabel(payload: AddressLabel): SetAddressLabel {
|
||||
return {
|
||||
type: TypeKeys.SET_ADDRESS_LABEL,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TClearAddressLabel = typeof clearAddressLabel;
|
||||
export function clearAddressLabel(payload: string): ClearAddressLabel {
|
||||
return {
|
||||
type: TypeKeys.CLEAR_ADDRESS_LABEL,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TSetAddressLabelEntry = typeof setAddressLabelEntry;
|
||||
export function setAddressLabelEntry(payload: AddressLabelEntry): SetAddressLabelEntry {
|
||||
return {
|
||||
type: TypeKeys.SET_ADDRESS_LABEL_ENTRY,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TChangeAddressLabelEntry = typeof changeAddressLabelEntry;
|
||||
export function changeAddressLabelEntry(payload: AddressLabelEntry): ChangeAddressLabelEntry {
|
||||
return {
|
||||
type: TypeKeys.CHANGE_ADDRESS_LABEL_ENTRY,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TSaveAddressLabelEntry = typeof saveAddressLabelEntry;
|
||||
export function saveAddressLabelEntry(payload: string): SaveAddressLabelEntry {
|
||||
return {
|
||||
type: TypeKeys.SAVE_ADDRESS_LABEL_ENTRY,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TClearAddressLabelEntry = typeof clearAddressLabelEntry;
|
||||
export function clearAddressLabelEntry(payload: string): ClearAddressLabelEntry {
|
||||
return {
|
||||
type: TypeKeys.CLEAR_ADDRESS_LABEL_ENTRY,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TRemoveAddressLabelEntry = typeof removeAddressLabelEntry;
|
||||
export function removeAddressLabelEntry(payload: string): RemoveAddressLabelEntry {
|
||||
return {
|
||||
type: TypeKeys.REMOVE_ADDRESS_LABEL_ENTRY,
|
||||
payload
|
||||
};
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
SET_ADDRESS_LABEL = 'SET_ADDRESS_LABEL',
|
||||
CLEAR_ADDRESS_LABEL = 'CLEAR_ADDRESS_LABEL',
|
||||
SET_ADDRESS_LABEL_ENTRY = 'SET_ADDRESS_LABEL_TEMPORARY_ENTRY',
|
||||
CHANGE_ADDRESS_LABEL_ENTRY = 'CHANGE_ADDRESS_LABEL_ENTRY',
|
||||
SAVE_ADDRESS_LABEL_ENTRY = 'SAVE_ADDRESS_LABEL_ENTRY',
|
||||
CLEAR_ADDRESS_LABEL_ENTRY = 'CLEAR_ADDRESS_LABEL_ENTRY',
|
||||
REMOVE_ADDRESS_LABEL_ENTRY = 'REMOVE_ADDRESS_LABEL_ENTRY'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './actionTypes';
|
||||
export * from './actionCreators';
|
||||
export * from './constants';
|
|
@ -1,153 +0,0 @@
|
|||
import * as interfaces from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
|
||||
export function setOnline(): interfaces.SetOnlineAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_SET_ONLINE
|
||||
};
|
||||
}
|
||||
|
||||
export function setOffline(): interfaces.SetOfflineAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_SET_OFFLINE
|
||||
};
|
||||
}
|
||||
|
||||
export type TToggleAutoGasLimit = typeof toggleAutoGasLimit;
|
||||
export function toggleAutoGasLimit(): interfaces.ToggleAutoGasLimitAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_TOGGLE_AUTO_GAS_LIMIT
|
||||
};
|
||||
}
|
||||
|
||||
export type TChangeLanguage = typeof changeLanguage;
|
||||
export function changeLanguage(sign: string): interfaces.ChangeLanguageAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_LANGUAGE_CHANGE,
|
||||
payload: sign
|
||||
};
|
||||
}
|
||||
|
||||
export type TPollOfflineStatus = typeof pollOfflineStatus;
|
||||
export function pollOfflineStatus(): interfaces.PollOfflineStatus {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_POLL_OFFLINE_STATUS
|
||||
};
|
||||
}
|
||||
|
||||
export type TChangeNodeRequested = typeof changeNodeRequested;
|
||||
export function changeNodeRequested(payload: string): interfaces.ChangeNodeRequestedAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_REQUESTED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TChangeNodeSucceded = typeof changeNodeSucceeded;
|
||||
export function changeNodeSucceeded(
|
||||
payload: interfaces.ChangeNodeSucceededAction['payload']
|
||||
): interfaces.ChangeNodeSucceededAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_SUCCEEDED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TChangeNodeFailed = typeof changeNodeFailed;
|
||||
export function changeNodeFailed(): interfaces.ChangeNodeFailedAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_FAILED
|
||||
};
|
||||
}
|
||||
|
||||
export type TChangeNodeRequestedOneTime = typeof changeNodeRequestedOneTime;
|
||||
export function changeNodeRequestedOneTime(
|
||||
payload: string
|
||||
): interfaces.ChangeNodeRequestedOneTimeAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_REQUESTED_ONETIME,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TChangeNodeForce = typeof changeNodeForce;
|
||||
export function changeNodeForce(payload: string): interfaces.ChangeNodeForceAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_FORCE,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TChangeNetworkRequested = typeof changeNetworkRequested;
|
||||
export function changeNetworkRequested(
|
||||
payload: interfaces.ChangeNetworkRequestedAction['payload']
|
||||
): interfaces.ChangeNetworkRequestedAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_CHANGE_NETWORK_REQUESTED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TAddCustomNode = typeof addCustomNode;
|
||||
export function addCustomNode(
|
||||
payload: interfaces.AddCustomNodeAction['payload']
|
||||
): interfaces.AddCustomNodeAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_ADD_CUSTOM_NODE,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TRemoveCustomNode = typeof removeCustomNode;
|
||||
export function removeCustomNode(
|
||||
payload: interfaces.RemoveCustomNodeAction['payload']
|
||||
): interfaces.RemoveCustomNodeAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_REMOVE_CUSTOM_NODE,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TAddCustomNetwork = typeof addCustomNetwork;
|
||||
export function addCustomNetwork(
|
||||
payload: interfaces.AddCustomNetworkAction['payload']
|
||||
): interfaces.AddCustomNetworkAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_ADD_CUSTOM_NETWORK,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TRemoveCustomNetwork = typeof removeCustomNetwork;
|
||||
export function removeCustomNetwork(
|
||||
payload: interfaces.RemoveCustomNetworkAction['payload']
|
||||
): interfaces.RemoveCustomNetworkAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_REMOVE_CUSTOM_NETWORK,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TSetLatestBlock = typeof setLatestBlock;
|
||||
export function setLatestBlock(payload: string): interfaces.SetLatestBlockAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_SET_LATEST_BLOCK,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export function web3SetNode(
|
||||
payload: interfaces.Web3setNodeAction['payload']
|
||||
): interfaces.Web3setNodeAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_NODE_WEB3_SET,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TWeb3UnsetNode = typeof web3UnsetNode;
|
||||
export function web3UnsetNode(): interfaces.Web3UnsetNodeAction {
|
||||
return {
|
||||
type: TypeKeys.CONFIG_NODE_WEB3_UNSET
|
||||
};
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
import { TypeKeys } from './constants';
|
||||
import { CustomNodeConfig, StaticNodeConfig } from 'types/node';
|
||||
import { CustomNetworkConfig } from 'types/network';
|
||||
|
||||
export interface SetOnlineAction {
|
||||
type: TypeKeys.CONFIG_SET_ONLINE;
|
||||
}
|
||||
|
||||
export interface SetOfflineAction {
|
||||
type: TypeKeys.CONFIG_SET_OFFLINE;
|
||||
}
|
||||
|
||||
export interface ToggleAutoGasLimitAction {
|
||||
type: TypeKeys.CONFIG_TOGGLE_AUTO_GAS_LIMIT;
|
||||
}
|
||||
|
||||
/*** Change Language ***/
|
||||
export interface ChangeLanguageAction {
|
||||
type: TypeKeys.CONFIG_LANGUAGE_CHANGE;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
/*** Poll offline status ***/
|
||||
export interface PollOfflineStatus {
|
||||
type: TypeKeys.CONFIG_POLL_OFFLINE_STATUS;
|
||||
}
|
||||
|
||||
/*** Change Node Requested ***/
|
||||
export interface ChangeNodeRequestedAction {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_REQUESTED;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
/*** Change Node Succeeded ***/
|
||||
export interface ChangeNodeSucceededAction {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_SUCCEEDED;
|
||||
payload: {
|
||||
nodeId: string;
|
||||
networkId: string;
|
||||
};
|
||||
}
|
||||
|
||||
/*** Change Node Failed ***/
|
||||
export interface ChangeNodeFailedAction {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_FAILED;
|
||||
}
|
||||
|
||||
/*** Change Node Onetime ***/
|
||||
export interface ChangeNodeRequestedOneTimeAction {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_REQUESTED_ONETIME;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
/*** Force Change Node ***/
|
||||
export interface ChangeNodeForceAction {
|
||||
type: TypeKeys.CONFIG_CHANGE_NODE_FORCE;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
/*** Change Network Intent ***/
|
||||
export interface ChangeNetworkRequestedAction {
|
||||
type: TypeKeys.CONFIG_CHANGE_NETWORK_REQUESTED;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
/*** Add Custom Node ***/
|
||||
export interface AddCustomNodeAction {
|
||||
type: TypeKeys.CONFIG_ADD_CUSTOM_NODE;
|
||||
payload: CustomNodeConfig;
|
||||
}
|
||||
|
||||
/*** Remove Custom Node ***/
|
||||
export interface RemoveCustomNodeAction {
|
||||
type: TypeKeys.CONFIG_REMOVE_CUSTOM_NODE;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
/*** Add Custom Network ***/
|
||||
export interface AddCustomNetworkAction {
|
||||
type: TypeKeys.CONFIG_ADD_CUSTOM_NETWORK;
|
||||
payload: CustomNetworkConfig;
|
||||
}
|
||||
|
||||
/*** Remove Custom Network ***/
|
||||
export interface RemoveCustomNetworkAction {
|
||||
type: TypeKeys.CONFIG_REMOVE_CUSTOM_NETWORK;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
/*** Set Latest Block ***/
|
||||
export interface SetLatestBlockAction {
|
||||
type: TypeKeys.CONFIG_SET_LATEST_BLOCK;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
/*** Unset Web3 as a Node ***/
|
||||
export interface Web3UnsetNodeAction {
|
||||
type: TypeKeys.CONFIG_NODE_WEB3_UNSET;
|
||||
}
|
||||
|
||||
/*** Set Web3 as a Node ***/
|
||||
export interface Web3setNodeAction {
|
||||
type: TypeKeys.CONFIG_NODE_WEB3_SET;
|
||||
payload: { id: 'web3'; config: StaticNodeConfig };
|
||||
}
|
||||
|
||||
export type CustomNetworkAction = AddCustomNetworkAction | RemoveCustomNetworkAction;
|
||||
|
||||
export type CustomNodeAction = AddCustomNodeAction | RemoveCustomNodeAction;
|
||||
|
||||
export type NodeAction =
|
||||
| ChangeNodeSucceededAction
|
||||
| ChangeNodeRequestedAction
|
||||
| ChangeNodeFailedAction
|
||||
| Web3UnsetNodeAction
|
||||
| Web3setNodeAction;
|
||||
|
||||
export type MetaAction =
|
||||
| ChangeLanguageAction
|
||||
| SetOnlineAction
|
||||
| SetOfflineAction
|
||||
| ToggleAutoGasLimitAction
|
||||
| PollOfflineStatus
|
||||
| SetLatestBlockAction;
|
||||
|
||||
/*** Union Type ***/
|
||||
export type ConfigAction = CustomNetworkAction | CustomNodeAction | NodeAction | MetaAction;
|
|
@ -1,26 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
CONFIG_LANGUAGE_CHANGE = 'CONFIG_LANGUAGE_CHANGE',
|
||||
|
||||
CONFIG_SET_ONLINE = 'CONFIG_SET_ONLINE',
|
||||
CONFIG_SET_OFFLINE = 'CONFIG_SET_OFFLINE',
|
||||
|
||||
CONFIG_TOGGLE_OFFLINE = 'CONFIG_TOGGLE_OFFLINE',
|
||||
CONFIG_TOGGLE_AUTO_GAS_LIMIT = 'CONFIG_TOGGLE_AUTO_GAS_LIMIT',
|
||||
CONFIG_POLL_OFFLINE_STATUS = 'CONFIG_POLL_OFFLINE_STATUS',
|
||||
CONFIG_SET_LATEST_BLOCK = 'CONFIG_SET_LATEST_BLOCK',
|
||||
|
||||
CONFIG_NODE_WEB3_SET = 'CONFIG_NODE_WEB3_SET',
|
||||
CONFIG_NODE_WEB3_UNSET = 'CONFIG_NODE_WEB3_UNSET',
|
||||
CONFIG_CHANGE_NODE_REQUESTED = 'CONFIG_CHANGE_NODE_REQUESTED',
|
||||
CONFIG_CHANGE_NODE_SUCCEEDED = 'CONFIG_CHANGE_NODE_SUCCEEDED',
|
||||
CONFIG_CHANGE_NODE_FAILED = 'CONFIG_CHANGE_NODE_FAILED',
|
||||
CONFIG_CHANGE_NODE_REQUESTED_ONETIME = 'CONFIG_CHANGE_NODE_REQUESTED_ONETIME',
|
||||
CONFIG_CHANGE_NODE_FORCE = 'CONFIG_CHANGE_NODE_FORCE',
|
||||
CONFIG_CHANGE_NETWORK_REQUESTED = 'CONFIG_CHANGE_NETWORK_REQUESTED',
|
||||
|
||||
CONFIG_ADD_CUSTOM_NODE = 'CONFIG_ADD_CUSTOM_NODE',
|
||||
CONFIG_REMOVE_CUSTOM_NODE = 'CONFIG_REMOVE_CUSTOM_NODE',
|
||||
|
||||
CONFIG_ADD_CUSTOM_NETWORK = 'CONFIG_ADD_CUSTOM_NETWORK',
|
||||
CONFIG_REMOVE_CUSTOM_NETWORK = 'CONFIG_REMOVE_CUSTOM_NETWORK'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './actionCreators';
|
||||
export * from './actionTypes';
|
||||
export * from './constants';
|
|
@ -1,20 +0,0 @@
|
|||
import * as interfaces from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
import { Token } from 'types/network';
|
||||
|
||||
export type TAddCustomToken = typeof addCustomToken;
|
||||
export function addCustomToken(payload: Token): interfaces.AddCustomTokenAction {
|
||||
return {
|
||||
type: TypeKeys.CUSTOM_TOKEN_ADD,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TRemoveCustomToken = typeof removeCustomToken;
|
||||
|
||||
export function removeCustomToken(payload: string): interfaces.RemoveCustomTokenAction {
|
||||
return {
|
||||
type: TypeKeys.CUSTOM_TOKEN_REMOVE,
|
||||
payload
|
||||
};
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
CUSTOM_TOKEN_ADD = 'CUSTOM_TOKEN_ADD',
|
||||
CUSTOM_TOKEN_REMOVE = 'CUSTOM_TOKEN_REMOVE'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './actionCreators';
|
||||
export * from './actionTypes';
|
||||
export * from './constants';
|
|
@ -1,43 +0,0 @@
|
|||
import * as interfaces from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
export function getDeterministicWallets(
|
||||
args: interfaces.GetDeterministicWalletsArgs
|
||||
): interfaces.GetDeterministicWalletsAction {
|
||||
const { seed, dPath, publicKey, chainCode, limit, offset } = args;
|
||||
return {
|
||||
type: TypeKeys.DW_GET_WALLETS,
|
||||
payload: {
|
||||
seed,
|
||||
dPath,
|
||||
publicKey,
|
||||
chainCode,
|
||||
limit: limit || 5,
|
||||
offset: offset || 0
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function setDeterministicWallets(
|
||||
wallets: interfaces.DeterministicWalletData[]
|
||||
): interfaces.SetDeterministicWalletsAction {
|
||||
return {
|
||||
type: TypeKeys.DW_SET_WALLETS,
|
||||
payload: wallets
|
||||
};
|
||||
}
|
||||
|
||||
export function setDesiredToken(token: string | undefined): interfaces.SetDesiredTokenAction {
|
||||
return {
|
||||
type: TypeKeys.DW_SET_DESIRED_TOKEN,
|
||||
payload: token
|
||||
};
|
||||
}
|
||||
|
||||
export function updateDeterministicWallet(
|
||||
args: interfaces.UpdateDeterministicWalletArgs
|
||||
): interfaces.UpdateDeterministicWalletAction {
|
||||
return {
|
||||
type: TypeKeys.DW_UPDATE_WALLET,
|
||||
payload: args
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
DW_GET_WALLETS = 'DW_GET_WALLETS',
|
||||
DW_SET_WALLETS = 'DW_SET_WALLETS',
|
||||
DW_SET_DESIRED_TOKEN = 'DW_SET_DESIRED_TOKEN',
|
||||
DW_UPDATE_WALLET = 'DW_UPDATE_WALLET'
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
export * from './actionTypes';
|
||||
export * from './actionCreators';
|
|
@ -1 +0,0 @@
|
|||
export * from './resolveDomain';
|
|
@ -1,35 +0,0 @@
|
|||
import * as ActionTypes from '../actionTypes';
|
||||
import { TypeKeys } from '../constants';
|
||||
import { DomainRequest } from 'libs/ens';
|
||||
import { ResolveDomainCached } from 'actions/ens';
|
||||
|
||||
export type TResolveDomainRequested = typeof resolveDomainRequested;
|
||||
export const resolveDomainRequested = (domain: string): ActionTypes.ResolveDomainRequested => ({
|
||||
type: TypeKeys.ENS_RESOLVE_DOMAIN_REQUESTED,
|
||||
payload: { domain }
|
||||
});
|
||||
|
||||
export const resolveDomainCached = (
|
||||
payload: ResolveDomainCached['payload']
|
||||
): ResolveDomainCached => ({
|
||||
type: TypeKeys.ENS_RESOLVE_DOMAIN_CACHED,
|
||||
payload
|
||||
});
|
||||
|
||||
export type TResolveDomainSucceeded = typeof resolveDomainSucceeded;
|
||||
export const resolveDomainSucceeded = (
|
||||
domain: string,
|
||||
domainData: DomainRequest
|
||||
): ActionTypes.ResolveDomainSucceeded => ({
|
||||
type: TypeKeys.ENS_RESOLVE_DOMAIN_SUCCEEDED,
|
||||
payload: { domain, domainData }
|
||||
});
|
||||
|
||||
export type TResolveDomainFailed = typeof resolveDomainFailed;
|
||||
export const resolveDomainFailed = (
|
||||
domain: string,
|
||||
error: Error
|
||||
): ActionTypes.ResolveDomainFailed => ({
|
||||
type: TypeKeys.ENS_RESOLVE_DOMAIN_FAILED,
|
||||
payload: { domain, error }
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
import { ResolveDomainAction } from './resolveDomain';
|
||||
export * from './resolveDomain';
|
||||
|
||||
export type EnsAction = ResolveDomainAction;
|
|
@ -1 +0,0 @@
|
|||
export * from './actionTypes';
|
|
@ -1,28 +0,0 @@
|
|||
import { TypeKeys } from '../constants';
|
||||
import { DomainRequest } from 'libs/ens';
|
||||
|
||||
export interface ResolveDomainRequested {
|
||||
type: TypeKeys.ENS_RESOLVE_DOMAIN_REQUESTED;
|
||||
payload: { domain: string };
|
||||
}
|
||||
|
||||
export interface ResolveDomainSucceeded {
|
||||
type: TypeKeys.ENS_RESOLVE_DOMAIN_SUCCEEDED;
|
||||
payload: { domain: string; domainData: DomainRequest };
|
||||
}
|
||||
|
||||
export interface ResolveDomainCached {
|
||||
type: TypeKeys.ENS_RESOLVE_DOMAIN_CACHED;
|
||||
payload: { domain: string };
|
||||
}
|
||||
|
||||
export interface ResolveDomainFailed {
|
||||
type: TypeKeys.ENS_RESOLVE_DOMAIN_FAILED;
|
||||
payload: { domain: string; error: Error };
|
||||
}
|
||||
|
||||
export type ResolveDomainAction =
|
||||
| ResolveDomainRequested
|
||||
| ResolveDomainSucceeded
|
||||
| ResolveDomainFailed
|
||||
| ResolveDomainCached;
|
|
@ -1,6 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
ENS_RESOLVE_DOMAIN_REQUESTED = 'ENS_RESOLVE_DOMAIN_REQUESTED',
|
||||
ENS_RESOLVE_DOMAIN_SUCCEEDED = 'ENS_RESOLVE_DOMAIN_SUCCEEDED',
|
||||
ENS_RESOLVE_DOMAIN_FAILED = 'ENS_RESOLVE_DOMAIN_FAILED',
|
||||
ENS_RESOLVE_DOMAIN_CACHED = 'ENS_RESOLVE_DOMAIN_CACHED'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './constants';
|
||||
export * from './actionTypes';
|
||||
export * from './actionCreators';
|
|
@ -1,19 +0,0 @@
|
|||
import * as interfaces from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
|
||||
export type TFetchGasEstimates = typeof fetchGasEstimates;
|
||||
export function fetchGasEstimates(): interfaces.FetchGasEstimatesAction {
|
||||
return {
|
||||
type: TypeKeys.GAS_FETCH_ESTIMATES
|
||||
};
|
||||
}
|
||||
|
||||
export type TSetGasEstimates = typeof setGasEstimates;
|
||||
export function setGasEstimates(
|
||||
payload: interfaces.SetGasEstimatesAction['payload']
|
||||
): interfaces.SetGasEstimatesAction {
|
||||
return {
|
||||
type: TypeKeys.GAS_SET_ESTIMATES,
|
||||
payload
|
||||
};
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
import { TypeKeys } from './constants';
|
||||
import { GasEstimates } from 'api/gas';
|
||||
|
||||
export interface FetchGasEstimatesAction {
|
||||
type: TypeKeys.GAS_FETCH_ESTIMATES;
|
||||
}
|
||||
|
||||
export interface SetGasEstimatesAction {
|
||||
type: TypeKeys.GAS_SET_ESTIMATES;
|
||||
payload: GasEstimates;
|
||||
}
|
||||
|
||||
/*** Union Type ***/
|
||||
export type GasAction = FetchGasEstimatesAction | SetGasEstimatesAction;
|
|
@ -1,4 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
GAS_FETCH_ESTIMATES = 'GAS_FETCH_ESTIMATES',
|
||||
GAS_SET_ESTIMATES = 'GAS_SET_ESTIMATES'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './actionCreators';
|
||||
export * from './actionTypes';
|
||||
export * from './constants';
|
|
@ -1,28 +0,0 @@
|
|||
import * as interfaces from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
import { ISignedMessage } from 'libs/signing';
|
||||
|
||||
export type TSignMessageRequested = typeof signMessageRequested;
|
||||
export function signMessageRequested(payload: string): interfaces.SignMessageRequestedAction {
|
||||
return {
|
||||
type: TypeKeys.SIGN_MESSAGE_REQUESTED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TSignLocalMessageSucceeded = typeof signLocalMessageSucceeded;
|
||||
export function signLocalMessageSucceeded(
|
||||
payload: ISignedMessage
|
||||
): interfaces.SignLocalMessageSucceededAction {
|
||||
return {
|
||||
type: TypeKeys.SIGN_LOCAL_MESSAGE_SUCCEEDED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TSignMessageFailed = typeof signMessageFailed;
|
||||
export function signMessageFailed(): interfaces.SignMessageFailedAction {
|
||||
return {
|
||||
type: TypeKeys.SIGN_MESSAGE_FAILED
|
||||
};
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
SIGN_MESSAGE_REQUESTED = 'SIGN_MESSAGE_REQUESTED',
|
||||
SIGN_LOCAL_MESSAGE_SUCCEEDED = 'SIGN_LOCAL_MESSAGE_SUCCEEDED',
|
||||
SIGN_MESSAGE_FAILED = 'SIGN_MESSAGE_FAILED'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './actionCreators';
|
||||
export * from './constants';
|
||||
export * from './actionTypes';
|
|
@ -1,28 +0,0 @@
|
|||
import { ReactElement } from 'react';
|
||||
import * as types from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
|
||||
export type TShowNotification = typeof showNotification;
|
||||
export function showNotification(
|
||||
level: types.NOTIFICATION_LEVEL = 'info',
|
||||
msg: ReactElement<any> | string,
|
||||
duration?: number
|
||||
): types.ShowNotificationAction {
|
||||
return {
|
||||
type: TypeKeys.SHOW_NOTIFICATION,
|
||||
payload: {
|
||||
level,
|
||||
msg,
|
||||
duration,
|
||||
id: Math.random()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export type TCloseNotification = typeof closeNotification;
|
||||
export function closeNotification(notification: types.Notification): types.CloseNotificationAction {
|
||||
return {
|
||||
type: TypeKeys.CLOSE_NOTIFICATION,
|
||||
payload: notification
|
||||
};
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
import { ReactElement } from 'react';
|
||||
import { TypeKeys } from './constants';
|
||||
/*** Shared types ***/
|
||||
export type NOTIFICATION_LEVEL = 'danger' | 'warning' | 'success' | 'info';
|
||||
|
||||
export interface Notification {
|
||||
level: NOTIFICATION_LEVEL;
|
||||
msg: ReactElement<any> | string;
|
||||
id: number;
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
/*** Close notification ***/
|
||||
export interface CloseNotificationAction {
|
||||
type: TypeKeys.CLOSE_NOTIFICATION;
|
||||
payload: Notification;
|
||||
}
|
||||
|
||||
/*** Show Notification ***/
|
||||
export interface ShowNotificationAction {
|
||||
type: TypeKeys.SHOW_NOTIFICATION;
|
||||
payload: Notification;
|
||||
}
|
||||
|
||||
/*** Union Type ***/
|
||||
export type NotificationsAction = ShowNotificationAction | CloseNotificationAction;
|
|
@ -1,4 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
SHOW_NOTIFICATION = 'SHOW_NOTIFICATION',
|
||||
CLOSE_NOTIFICATION = 'CLOSE_NOTIFICATION'
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
export * from './actionTypes';
|
||||
export * from './actionCreators';
|
|
@ -1,31 +0,0 @@
|
|||
import * as interfaces from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
|
||||
export type TStartOnboardSession = typeof startOnboardSession;
|
||||
export function startOnboardSession(): interfaces.StartOnboardSessionAction {
|
||||
return {
|
||||
type: TypeKeys.START_ONBOARD_SESSION
|
||||
};
|
||||
}
|
||||
|
||||
export type TResumeSlide = typeof resumeSlide;
|
||||
export function resumeSlide(slideNumber: number): interfaces.ResumeSlideAction {
|
||||
return {
|
||||
type: TypeKeys.RESUME_SLIDE,
|
||||
slideNumber
|
||||
};
|
||||
}
|
||||
|
||||
export type TDecrementSlide = typeof decrementSlide;
|
||||
export function decrementSlide(): interfaces.DecrementSlideAction {
|
||||
return {
|
||||
type: TypeKeys.DECREMENT_SLIDE
|
||||
};
|
||||
}
|
||||
|
||||
export type TIncrementSlide = typeof incrementSlide;
|
||||
export function incrementSlide(): interfaces.IncrementSlideAction {
|
||||
return {
|
||||
type: TypeKeys.INCREMENT_SLIDE
|
||||
};
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
import { TypeKeys } from './constants';
|
||||
|
||||
export interface StartOnboardSessionAction {
|
||||
type: TypeKeys.START_ONBOARD_SESSION;
|
||||
}
|
||||
|
||||
export interface ResumeSlideAction {
|
||||
type: TypeKeys.RESUME_SLIDE;
|
||||
slideNumber: number;
|
||||
}
|
||||
|
||||
export interface DecrementSlideAction {
|
||||
type: TypeKeys.DECREMENT_SLIDE;
|
||||
}
|
||||
|
||||
export interface IncrementSlideAction {
|
||||
type: TypeKeys.INCREMENT_SLIDE;
|
||||
}
|
||||
|
||||
export type OnboardStatusAction =
|
||||
| StartOnboardSessionAction
|
||||
| ResumeSlideAction
|
||||
| DecrementSlideAction
|
||||
| IncrementSlideAction;
|
|
@ -1,6 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
START_ONBOARD_SESSION = 'START_ONBOARD_SESSION',
|
||||
RESUME_SLIDE = 'RESUME_SLIDE',
|
||||
DECREMENT_SLIDE = 'DECREMENT_SLIDE',
|
||||
INCREMENT_SLIDE = 'INCREMENT_SLIDE'
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
export * from './actionTypes';
|
||||
export * from './actionCreators';
|
|
@ -1,30 +0,0 @@
|
|||
import { TypeKeys } from './constants';
|
||||
|
||||
export interface RequestTransactionSignatureAction {
|
||||
type: TypeKeys.PARITY_SIGNER_REQUEST_TX_SIGNATURE;
|
||||
payload: {
|
||||
isMessage: false;
|
||||
data: string;
|
||||
from: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface RequestMessageSignatureAction {
|
||||
type: TypeKeys.PARITY_SIGNER_REQUEST_MSG_SIGNATURE;
|
||||
payload: {
|
||||
isMessage: true;
|
||||
data: string;
|
||||
from: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface FinalizeSignatureAction {
|
||||
type: TypeKeys.PARITY_SIGNER_FINALIZE_SIGNATURE;
|
||||
payload: string | null;
|
||||
}
|
||||
|
||||
/*** Union Type ***/
|
||||
export type ParitySignerAction =
|
||||
| RequestTransactionSignatureAction
|
||||
| RequestMessageSignatureAction
|
||||
| FinalizeSignatureAction;
|
|
@ -1,5 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
PARITY_SIGNER_REQUEST_TX_SIGNATURE = 'PARITY_SIGNER_REQUEST_TX_SIGNATURE',
|
||||
PARITY_SIGNER_REQUEST_MSG_SIGNATURE = 'PARITY_SIGNER_REQUEST_MSG_SIGNATURE',
|
||||
PARITY_SIGNER_FINALIZE_SIGNATURE = 'PARITY_SIGNER_FINALIZE_SIGNATURE'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './constants';
|
||||
export * from './actionTypes';
|
||||
export * from './actionCreators';
|
|
@ -1,26 +0,0 @@
|
|||
import * as interfaces from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
import { CCResponse } from 'api/rates';
|
||||
|
||||
export type TFetchCCRatesRequested = typeof fetchCCRatesRequested;
|
||||
export function fetchCCRatesRequested(symbols: string[] = []): interfaces.FetchCCRatesRequested {
|
||||
return {
|
||||
type: TypeKeys.RATES_FETCH_CC_REQUESTED,
|
||||
payload: symbols
|
||||
};
|
||||
}
|
||||
|
||||
export type TFetchCCRatesSucceeded = typeof fetchCCRatesSucceeded;
|
||||
export function fetchCCRatesSucceeded(payload: CCResponse): interfaces.FetchCCRatesSucceeded {
|
||||
return {
|
||||
type: TypeKeys.RATES_FETCH_CC_SUCCEEDED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TFetchCCRatesFailed = typeof fetchCCRatesFailed;
|
||||
export function fetchCCRatesFailed(): interfaces.FetchCCRatesFailed {
|
||||
return {
|
||||
type: TypeKeys.RATES_FETCH_CC_FAILED
|
||||
};
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import { TypeKeys } from './constants';
|
||||
import { CCResponse } from 'api/rates';
|
||||
|
||||
export interface FetchCCRatesRequested {
|
||||
type: TypeKeys.RATES_FETCH_CC_REQUESTED;
|
||||
payload: string[];
|
||||
}
|
||||
|
||||
/*** Set rates ***/
|
||||
export interface FetchCCRatesSucceeded {
|
||||
type: TypeKeys.RATES_FETCH_CC_SUCCEEDED;
|
||||
payload: CCResponse;
|
||||
}
|
||||
|
||||
export interface FetchCCRatesFailed {
|
||||
type: TypeKeys.RATES_FETCH_CC_FAILED;
|
||||
}
|
||||
|
||||
/*** Union Type ***/
|
||||
export type RatesAction = FetchCCRatesRequested | FetchCCRatesSucceeded | FetchCCRatesFailed;
|
|
@ -1,5 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
RATES_FETCH_CC_REQUESTED = 'RATES_FETCH_CC_REQUESTED',
|
||||
RATES_FETCH_CC_FAILED = 'RATES_FETCH_CC_FAILED',
|
||||
RATES_FETCH_CC_SUCCEEDED = 'RATES_FETCH_CC_SUCCEEDED'
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
export * from './actionCreators';
|
||||
export * from './actionTypes';
|
|
@ -1,117 +0,0 @@
|
|||
import {
|
||||
SetTimeBountyFieldAction,
|
||||
SetWindowSizeFieldAction,
|
||||
SetWindowStartFieldAction,
|
||||
SetScheduleTimestampFieldAction,
|
||||
SetScheduleTypeAction,
|
||||
SetSchedulingToggleAction,
|
||||
SetScheduleTimezoneAction,
|
||||
SetScheduleGasPriceFieldAction,
|
||||
SetScheduleGasLimitFieldAction,
|
||||
SetScheduleDepositFieldAction,
|
||||
SetScheduleParamsValidityAction
|
||||
} from '../actionTypes';
|
||||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
|
||||
type TSetTimeBountyField = typeof setTimeBountyField;
|
||||
const setTimeBountyField = (
|
||||
payload: SetTimeBountyFieldAction['payload']
|
||||
): SetTimeBountyFieldAction => ({
|
||||
type: TypeKeys.TIME_BOUNTY_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetWindowSizeField = typeof setWindowSizeField;
|
||||
const setWindowSizeField = (
|
||||
payload: SetWindowSizeFieldAction['payload']
|
||||
): SetWindowSizeFieldAction => ({
|
||||
type: TypeKeys.WINDOW_SIZE_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetWindowStartField = typeof setWindowStartField;
|
||||
const setWindowStartField = (
|
||||
payload: SetWindowStartFieldAction['payload']
|
||||
): SetWindowStartFieldAction => ({
|
||||
type: TypeKeys.WINDOW_START_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleTimestampField = typeof setScheduleTimestampField;
|
||||
const setScheduleTimestampField = (
|
||||
payload: SetScheduleTimestampFieldAction['payload']
|
||||
): SetScheduleTimestampFieldAction => ({
|
||||
type: TypeKeys.SCHEDULE_TIMESTAMP_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleType = typeof setScheduleType;
|
||||
const setScheduleType = (payload: SetScheduleTypeAction['payload']): SetScheduleTypeAction => ({
|
||||
type: TypeKeys.SCHEDULE_TYPE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetSchedulingToggle = typeof setSchedulingToggle;
|
||||
const setSchedulingToggle = (
|
||||
payload: SetSchedulingToggleAction['payload']
|
||||
): SetSchedulingToggleAction => ({
|
||||
type: TypeKeys.SCHEDULING_TOGGLE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleTimezone = typeof setScheduleTimezone;
|
||||
const setScheduleTimezone = (
|
||||
payload: SetScheduleTimezoneAction['payload']
|
||||
): SetScheduleTimezoneAction => ({
|
||||
type: TypeKeys.SCHEDULE_TIMEZONE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleGasPriceField = typeof setScheduleGasPriceField;
|
||||
const setScheduleGasPriceField = (payload: SetScheduleGasPriceFieldAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_GAS_PRICE_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleGasLimitField = typeof setScheduleGasLimitField;
|
||||
const setScheduleGasLimitField = (payload: SetScheduleGasLimitFieldAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_GAS_LIMIT_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleDepositField = typeof setScheduleDepositField;
|
||||
const setScheduleDepositField = (payload: SetScheduleDepositFieldAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_DEPOSIT_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleParamsValidity = typeof setScheduleParamsValidity;
|
||||
const setScheduleParamsValidity = (payload: SetScheduleParamsValidityAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_PARAMS_VALIDITY_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export {
|
||||
TSetWindowSizeField,
|
||||
TSetWindowStartField,
|
||||
TSetTimeBountyField,
|
||||
TSetScheduleTimestampField,
|
||||
TSetScheduleType,
|
||||
TSetSchedulingToggle,
|
||||
TSetScheduleTimezone,
|
||||
TSetScheduleGasPriceField,
|
||||
TSetScheduleGasLimitField,
|
||||
TSetScheduleDepositField,
|
||||
TSetScheduleParamsValidity,
|
||||
setTimeBountyField,
|
||||
setWindowSizeField,
|
||||
setWindowStartField,
|
||||
setScheduleTimestampField,
|
||||
setScheduleType,
|
||||
setSchedulingToggle,
|
||||
setScheduleTimezone,
|
||||
setScheduleGasPriceField,
|
||||
setScheduleGasLimitField,
|
||||
setScheduleDepositField,
|
||||
setScheduleParamsValidity
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
export * from './fields';
|
||||
export * from './scheduleTimestamp';
|
||||
export * from './scheduleType';
|
||||
export * from './schedulingToggle';
|
||||
export * from './timeBounty';
|
||||
export * from './windowSize';
|
||||
export * from './windowStart';
|
|
@ -1,21 +0,0 @@
|
|||
import { TypeKeys } from 'actions/schedule';
|
||||
import {
|
||||
SetCurrentScheduleTimestampAction,
|
||||
SetCurrentScheduleTimezoneAction
|
||||
} from '../actionTypes/scheduleTimestamp';
|
||||
|
||||
export type TSetCurrentScheduleTimestamp = typeof setCurrentScheduleTimestamp;
|
||||
export const setCurrentScheduleTimestamp = (
|
||||
payload: SetCurrentScheduleTimestampAction['payload']
|
||||
): SetCurrentScheduleTimestampAction => ({
|
||||
type: TypeKeys.CURRENT_SCHEDULE_TIMESTAMP_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export type TSetCurrentScheduleTimezone = typeof setCurrentScheduleTimezone;
|
||||
export const setCurrentScheduleTimezone = (
|
||||
payload: SetCurrentScheduleTimezoneAction['payload']
|
||||
): SetCurrentScheduleTimezoneAction => ({
|
||||
type: TypeKeys.CURRENT_SCHEDULE_TIMEZONE_SET,
|
||||
payload
|
||||
});
|
|
@ -1,10 +0,0 @@
|
|||
import { TypeKeys } from 'actions/schedule';
|
||||
import { SetCurrentScheduleTypeAction } from '../actionTypes/scheduleType';
|
||||
|
||||
export type TSetCurrentScheduleType = typeof setCurrentScheduleType;
|
||||
export const setCurrentScheduleType = (
|
||||
payload: SetCurrentScheduleTypeAction['payload']
|
||||
): SetCurrentScheduleTypeAction => ({
|
||||
type: TypeKeys.CURRENT_SCHEDULE_TYPE,
|
||||
payload
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
import { SetCurrentSchedulingToggleAction } from '../actionTypes/schedulingToggle';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
type TSetCurrentSchedulingToggle = typeof setCurrentSchedulingToggle;
|
||||
const setCurrentSchedulingToggle = (
|
||||
payload: SetCurrentSchedulingToggleAction['payload']
|
||||
): SetCurrentSchedulingToggleAction => ({
|
||||
type: TypeKeys.CURRENT_SCHEDULING_TOGGLE,
|
||||
payload
|
||||
});
|
||||
|
||||
export { TSetCurrentSchedulingToggle, setCurrentSchedulingToggle };
|
|
@ -1,12 +0,0 @@
|
|||
import { SetCurrentTimeBountyAction } from '../actionTypes/timeBounty';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
type TSetCurrentTimeBounty = typeof setCurrentTimeBounty;
|
||||
const setCurrentTimeBounty = (
|
||||
payload: SetCurrentTimeBountyAction['payload']
|
||||
): SetCurrentTimeBountyAction => ({
|
||||
type: TypeKeys.CURRENT_TIME_BOUNTY_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export { setCurrentTimeBounty, TSetCurrentTimeBounty };
|
|
@ -1,12 +0,0 @@
|
|||
import { SetCurrentWindowSizeAction } from '../actionTypes/windowSize';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
type TSetCurrentWindowSize = typeof setCurrentWindowSize;
|
||||
const setCurrentWindowSize = (
|
||||
payload: SetCurrentWindowSizeAction['payload']
|
||||
): SetCurrentWindowSizeAction => ({
|
||||
type: TypeKeys.CURRENT_WINDOW_SIZE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export { setCurrentWindowSize, TSetCurrentWindowSize };
|
|
@ -1,12 +0,0 @@
|
|||
import { SetCurrentWindowStartAction } from '../actionTypes/windowStart';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
type TSetCurrentWindowStart = typeof setCurrentWindowStart;
|
||||
const setCurrentWindowStart = (
|
||||
payload: SetCurrentWindowStartAction['payload']
|
||||
): SetCurrentWindowStartAction => ({
|
||||
type: TypeKeys.CURRENT_WINDOW_START_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export { setCurrentWindowStart, TSetCurrentWindowStart };
|
|
@ -1,5 +0,0 @@
|
|||
import { ScheduleFieldAction } from './fields';
|
||||
|
||||
export * from './fields';
|
||||
|
||||
export type ScheduleAction = ScheduleFieldAction;
|
|
@ -1,116 +0,0 @@
|
|||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
import { Wei } from 'libs/units';
|
||||
|
||||
interface SetTimeBountyFieldAction {
|
||||
type: TypeKeys.TIME_BOUNTY_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetWindowSizeFieldAction {
|
||||
type: TypeKeys.WINDOW_SIZE_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetWindowStartFieldAction {
|
||||
type: TypeKeys.WINDOW_START_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: number | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleTimestampFieldAction {
|
||||
type: TypeKeys.SCHEDULE_TIMESTAMP_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Date;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleTypeAction {
|
||||
type: TypeKeys.SCHEDULE_TYPE_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetSchedulingToggleAction {
|
||||
type: TypeKeys.SCHEDULING_TOGGLE_SET;
|
||||
payload: {
|
||||
value: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleTimezoneAction {
|
||||
type: TypeKeys.SCHEDULE_TIMEZONE_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleGasPriceFieldAction {
|
||||
type: TypeKeys.SCHEDULE_GAS_PRICE_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleGasLimitFieldAction {
|
||||
type: TypeKeys.SCHEDULE_GAS_LIMIT_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleDepositFieldAction {
|
||||
type: TypeKeys.SCHEDULE_DEPOSIT_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleParamsValidityAction {
|
||||
type: TypeKeys.SCHEDULE_PARAMS_VALIDITY_SET;
|
||||
payload: {
|
||||
value: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
type ScheduleFieldAction =
|
||||
| SetTimeBountyFieldAction
|
||||
| SetWindowSizeFieldAction
|
||||
| SetWindowStartFieldAction
|
||||
| SetScheduleTimestampFieldAction
|
||||
| SetScheduleTypeAction
|
||||
| SetSchedulingToggleAction
|
||||
| SetScheduleGasPriceFieldAction
|
||||
| SetScheduleGasLimitFieldAction
|
||||
| SetScheduleDepositFieldAction
|
||||
| SetScheduleTimezoneAction
|
||||
| SetScheduleParamsValidityAction;
|
||||
|
||||
export {
|
||||
ScheduleFieldAction,
|
||||
SetTimeBountyFieldAction,
|
||||
SetWindowSizeFieldAction,
|
||||
SetWindowStartFieldAction,
|
||||
SetScheduleTimestampFieldAction,
|
||||
SetScheduleTypeAction,
|
||||
SetSchedulingToggleAction,
|
||||
SetScheduleGasPriceFieldAction,
|
||||
SetScheduleGasLimitFieldAction,
|
||||
SetScheduleDepositFieldAction,
|
||||
SetScheduleTimezoneAction,
|
||||
SetScheduleParamsValidityAction
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
export * from './actionTypes';
|
|
@ -1,17 +0,0 @@
|
|||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
||||
interface SetCurrentScheduleTimestampAction {
|
||||
type: TypeKeys.CURRENT_SCHEDULE_TIMESTAMP_SET;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
type CurrentAction = SetCurrentScheduleTimestampAction;
|
||||
|
||||
interface SetCurrentScheduleTimezoneAction {
|
||||
type: TypeKeys.CURRENT_SCHEDULE_TIMEZONE_SET;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
export { SetCurrentScheduleTimestampAction, CurrentAction, SetCurrentScheduleTimezoneAction };
|
|
@ -1,12 +0,0 @@
|
|||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
||||
interface SetCurrentScheduleTypeAction {
|
||||
type: TypeKeys.CURRENT_SCHEDULE_TYPE;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
type CurrentAction = SetCurrentScheduleTypeAction;
|
||||
|
||||
export { SetCurrentScheduleTypeAction, CurrentAction };
|
|
@ -1,12 +0,0 @@
|
|||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
||||
interface SetCurrentSchedulingToggleAction {
|
||||
type: TypeKeys.CURRENT_SCHEDULING_TOGGLE;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
type CurrentAction = SetCurrentSchedulingToggleAction;
|
||||
|
||||
export { SetCurrentSchedulingToggleAction, CurrentAction };
|
|
@ -1,12 +0,0 @@
|
|||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
||||
interface SetCurrentTimeBountyAction {
|
||||
type: TypeKeys.CURRENT_TIME_BOUNTY_SET;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
type CurrentAction = SetCurrentTimeBountyAction;
|
||||
|
||||
export { SetCurrentTimeBountyAction, CurrentAction };
|
|
@ -1,12 +0,0 @@
|
|||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
||||
interface SetCurrentWindowSizeAction {
|
||||
type: TypeKeys.CURRENT_WINDOW_SIZE_SET;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
type CurrentAction = SetCurrentWindowSizeAction;
|
||||
|
||||
export { SetCurrentWindowSizeAction, CurrentAction };
|
|
@ -1,12 +0,0 @@
|
|||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
||||
interface SetCurrentWindowStartAction {
|
||||
type: TypeKeys.CURRENT_WINDOW_START_SET;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
type CurrentAction = SetCurrentWindowStartAction;
|
||||
|
||||
export { SetCurrentWindowStartAction, CurrentAction };
|
|
@ -1,21 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
CURRENT_TIME_BOUNTY_SET = 'CURRENT_TIME_BOUNTY_SET',
|
||||
CURRENT_WINDOW_SIZE_SET = 'CURRENT_WINDOW_SIZE_SET',
|
||||
CURRENT_WINDOW_START_SET = 'CURRENT_WINDOW_START_SET',
|
||||
CURRENT_SCHEDULE_TIMESTAMP_SET = 'CURRENT_SCHEDULE_TIMESTAMP_SET',
|
||||
CURRENT_SCHEDULE_TIMEZONE_SET = 'CURRENT_SCHEDULE_TIMEZONE_SET',
|
||||
CURRENT_SCHEDULE_TYPE = 'CURRENT_SCHEDULE_TYPE',
|
||||
CURRENT_SCHEDULING_TOGGLE = 'CURRENT_SCHEDULING_TOGGLE',
|
||||
|
||||
TIME_BOUNTY_FIELD_SET = 'TIME_BOUNTY_FIELD_SET',
|
||||
WINDOW_SIZE_FIELD_SET = 'WINDOW_SIZE_FIELD_SET',
|
||||
WINDOW_START_FIELD_SET = 'WINDOW_START_FIELD_SET',
|
||||
SCHEDULE_GAS_PRICE_FIELD_SET = 'SCHEDULE_GAS_PRICE_SET',
|
||||
SCHEDULE_GAS_LIMIT_FIELD_SET = 'SCHEDULE_GAS_LIMIT_SET',
|
||||
SCHEDULE_TIMESTAMP_FIELD_SET = 'SCHEDULE_TIMESTAMP_FIELD_SET',
|
||||
SCHEDULE_TIMEZONE_SET = 'SCHEDULE_TIMEZONE_SET',
|
||||
SCHEDULE_TYPE_SET = 'SCHEDULE_TYPE_SET',
|
||||
SCHEDULING_TOGGLE_SET = 'SCHEDULING_TOGGLE_SET',
|
||||
SCHEDULE_DEPOSIT_FIELD_SET = 'SCHEDULE_DEPOSIT_FIELD_SET',
|
||||
SCHEDULE_PARAMS_VALIDITY_SET = 'SCHEDULE_PARAMS_VALIDITY_SET'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './actionCreators';
|
||||
export * from './constants';
|
||||
export * from './actionTypes';
|
|
@ -1,269 +0,0 @@
|
|||
import * as interfaces from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
|
||||
export type TChangeStepSwap = typeof changeStepSwap;
|
||||
export function changeStepSwap(payload: number): interfaces.ChangeStepSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_STEP,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TInitSwap = typeof initSwap;
|
||||
export function initSwap(payload: interfaces.SwapInputs): interfaces.InitSwap {
|
||||
return {
|
||||
type: TypeKeys.SWAP_INIT,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TLoadBityRatesSucceededSwap = typeof loadBityRatesSucceededSwap;
|
||||
export function loadBityRatesSucceededSwap(
|
||||
payload: interfaces.ApiResponse
|
||||
): interfaces.LoadBityRatesSucceededSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_LOAD_BITY_RATES_SUCCEEDED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TLoadShapeshiftRatesSucceededSwap = typeof loadShapeshiftRatesSucceededSwap;
|
||||
export function loadShapeshiftRatesSucceededSwap(
|
||||
payload: interfaces.LoadShapeshiftRatesSucceededSwapAction['payload']
|
||||
): interfaces.LoadShapeshiftRatesSucceededSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TDestinationAddressSwap = typeof destinationAddressSwap;
|
||||
export function destinationAddressSwap(payload?: string): interfaces.DestinationAddressSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_DESTINATION_ADDRESS,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TRestartSwap = typeof restartSwap;
|
||||
export function restartSwap(): interfaces.RestartSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_RESTART
|
||||
};
|
||||
}
|
||||
|
||||
export type TLoadBityRatesRequestedSwap = typeof loadBityRatesRequestedSwap;
|
||||
export function loadBityRatesRequestedSwap(): interfaces.LoadBityRatesRequestedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_LOAD_BITY_RATES_REQUESTED
|
||||
};
|
||||
}
|
||||
|
||||
export type TLoadShapeshiftRatesRequestedSwap = typeof loadShapeshiftRatesRequestedSwap;
|
||||
export function loadShapeshiftRatesRequestedSwap(): interfaces.LoadShapeshiftRatesRequestedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED
|
||||
};
|
||||
}
|
||||
|
||||
export type TLoadBityRatesFailedSwap = typeof loadBityRatesFailedSwap;
|
||||
export function loadBityRatesFailedSwap(): interfaces.LoadBityRatesFailedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_LOAD_BITY_RATES_FAILED
|
||||
};
|
||||
}
|
||||
|
||||
export type TLoadShapeshiftFailedSwap = typeof loadShapeshiftRatesFailedSwap;
|
||||
export function loadShapeshiftRatesFailedSwap(): interfaces.LoadShapeshiftRatesFailedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_FAILED
|
||||
};
|
||||
}
|
||||
|
||||
export type TStopLoadBityRatesSwap = typeof stopLoadBityRatesSwap;
|
||||
export function stopLoadBityRatesSwap(): interfaces.StopLoadBityRatesSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_STOP_LOAD_BITY_RATES
|
||||
};
|
||||
}
|
||||
|
||||
export type TStopLoadShapeshiftRatesSwap = typeof stopLoadShapeshiftRatesSwap;
|
||||
export function stopLoadShapeshiftRatesSwap(): interfaces.StopLoadShapeshiftRatesSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_STOP_LOAD_SHAPESHIFT_RATES
|
||||
};
|
||||
}
|
||||
|
||||
export type TOrderTimeSwap = typeof orderTimeSwap;
|
||||
export function orderTimeSwap(payload: number): interfaces.OrderSwapTimeSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_ORDER_TIME,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TBityOrderCreateSucceededSwap = typeof bityOrderCreateSucceededSwap;
|
||||
export function bityOrderCreateSucceededSwap(
|
||||
payload: interfaces.BityOrderPostResponse
|
||||
): interfaces.BityOrderCreateSucceededSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_CREATE_SUCCEEDED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TShapeshiftOrderCreateSucceededSwap = typeof shapeshiftOrderCreateSucceededSwap;
|
||||
export function shapeshiftOrderCreateSucceededSwap(
|
||||
payload: interfaces.ShapeshiftOrderResponse
|
||||
): interfaces.ShapeshiftOrderCreateSucceededSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_SUCCEEDED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TBityOrderCreateRequestedSwap = typeof bityOrderCreateRequestedSwap;
|
||||
export function bityOrderCreateRequestedSwap(
|
||||
amount: number,
|
||||
destinationAddress: string,
|
||||
pair: string,
|
||||
mode: number = 0
|
||||
): interfaces.BityOrderCreateRequestedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_CREATE_REQUESTED,
|
||||
payload: {
|
||||
amount,
|
||||
destinationAddress,
|
||||
pair,
|
||||
mode
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export type TShapeshiftOrderCreateRequestedSwap = typeof shapeshiftOrderCreateRequestedSwap;
|
||||
export function shapeshiftOrderCreateRequestedSwap(
|
||||
withdrawal: string,
|
||||
originKind: string,
|
||||
destinationKind: string,
|
||||
destinationAmount: number
|
||||
): interfaces.ShapeshiftOrderCreateRequestedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_REQUESTED,
|
||||
payload: {
|
||||
withdrawal,
|
||||
originKind,
|
||||
destinationKind,
|
||||
destinationAmount
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function bityOrderCreateFailedSwap(): interfaces.BityOrderCreateFailedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_CREATE_FAILED
|
||||
};
|
||||
}
|
||||
|
||||
export function shapeshiftOrderCreateFailedSwap(): interfaces.ShapeshiftOrderCreateFailedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_FAILED
|
||||
};
|
||||
}
|
||||
|
||||
export type TBityOrderStatusSucceededSwap = typeof bityOrderStatusSucceededSwap;
|
||||
export function bityOrderStatusSucceededSwap(
|
||||
payload: interfaces.BityOrderResponse
|
||||
): interfaces.BityOrderStatusSucceededSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_STATUS_SUCCEEDED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TShapeshiftOrderStatusSucceededSwap = typeof shapeshiftOrderStatusSucceededSwap;
|
||||
export function shapeshiftOrderStatusSucceededSwap(
|
||||
payload: interfaces.ShapeshiftStatusResponse
|
||||
): interfaces.ShapeshiftOrderStatusSucceededSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_STATUS_SUCCEEDED,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TBityOrderStatusRequestedSwap = typeof bityOrderStatusRequested;
|
||||
export function bityOrderStatusRequested(): interfaces.BityOrderStatusRequestedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_STATUS_REQUESTED
|
||||
};
|
||||
}
|
||||
|
||||
export type TShapeshiftOrderStatusRequestedSwap = typeof shapeshiftOrderStatusRequested;
|
||||
export function shapeshiftOrderStatusRequested(): interfaces.ShapeshiftOrderStatusRequestedSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_STATUS_REQUESTED
|
||||
};
|
||||
}
|
||||
|
||||
export type TStartOrderTimerSwap = typeof startOrderTimerSwap;
|
||||
export function startOrderTimerSwap(): interfaces.StartOrderTimerSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_ORDER_START_TIMER
|
||||
};
|
||||
}
|
||||
|
||||
export type TStopOrderTimerSwap = typeof stopOrderTimerSwap;
|
||||
export function stopOrderTimerSwap(): interfaces.StopOrderTimerSwapAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_ORDER_STOP_TIMER
|
||||
};
|
||||
}
|
||||
|
||||
export type TStartPollBityOrderStatus = typeof startPollBityOrderStatus;
|
||||
export function startPollBityOrderStatus(): interfaces.StartPollBityOrderStatusAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_START_POLL_BITY_ORDER_STATUS
|
||||
};
|
||||
}
|
||||
|
||||
export type TStartPollShapeshiftOrderStatus = typeof startPollShapeshiftOrderStatus;
|
||||
export function startPollShapeshiftOrderStatus(): interfaces.StartPollShapeshiftOrderStatusAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_START_POLL_SHAPESHIFT_ORDER_STATUS
|
||||
};
|
||||
}
|
||||
|
||||
export type TStopPollBityOrderStatus = typeof stopPollBityOrderStatus;
|
||||
export function stopPollBityOrderStatus(): interfaces.StopPollBityOrderStatusAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_STOP_POLL_BITY_ORDER_STATUS
|
||||
};
|
||||
}
|
||||
|
||||
export type TStopPollShapeshiftOrderStatus = typeof stopPollShapeshiftOrderStatus;
|
||||
export function stopPollShapeshiftOrderStatus(): interfaces.StopPollShapeshiftOrderStatusAction {
|
||||
return {
|
||||
type: TypeKeys.SWAP_STOP_POLL_SHAPESHIFT_ORDER_STATUS
|
||||
};
|
||||
}
|
||||
|
||||
export type TConfigureLiteSend = typeof configureLiteSend;
|
||||
export function configureLiteSend(): interfaces.ConfigureLiteSendAction {
|
||||
return { type: TypeKeys.SWAP_CONFIGURE_LITE_SEND };
|
||||
}
|
||||
|
||||
export type TShowLiteSend = typeof showLiteSend;
|
||||
export function showLiteSend(
|
||||
payload: interfaces.ShowLiteSendAction['payload']
|
||||
): interfaces.ShowLiteSendAction {
|
||||
return { type: TypeKeys.SWAP_SHOW_LITE_SEND, payload };
|
||||
}
|
||||
|
||||
export type TChangeSwapProvider = typeof changeSwapProvider;
|
||||
export function changeSwapProvider(
|
||||
payload: interfaces.ProviderName
|
||||
): interfaces.ChangeProviderSwapAcion {
|
||||
return {
|
||||
type: TypeKeys.SWAP_CHANGE_PROVIDER,
|
||||
payload
|
||||
};
|
||||
}
|
|
@ -1,272 +0,0 @@
|
|||
import { TypeKeys } from './constants';
|
||||
|
||||
export interface Pairs {
|
||||
ETHBTC: number;
|
||||
ETHREP: number;
|
||||
BTCETH: number;
|
||||
BTCREP: number;
|
||||
}
|
||||
|
||||
export interface SwapInput {
|
||||
label: string;
|
||||
amount: number | string;
|
||||
}
|
||||
|
||||
export interface SwapInputs {
|
||||
origin: SwapInput;
|
||||
destination: SwapInput;
|
||||
}
|
||||
|
||||
export interface InitSwap {
|
||||
type: TypeKeys.SWAP_INIT;
|
||||
payload: SwapInputs;
|
||||
}
|
||||
|
||||
export interface Option {
|
||||
id: string;
|
||||
status?: string;
|
||||
image?: string;
|
||||
}
|
||||
|
||||
export interface ApiResponseObj {
|
||||
id: string;
|
||||
options: Option[];
|
||||
rate: number;
|
||||
}
|
||||
|
||||
export interface ApiResponse {
|
||||
[name: string]: ApiResponseObj;
|
||||
}
|
||||
|
||||
export interface LoadBityRatesSucceededSwapAction {
|
||||
type: TypeKeys.SWAP_LOAD_BITY_RATES_SUCCEEDED;
|
||||
payload: ApiResponse;
|
||||
}
|
||||
|
||||
export interface LoadShapeshiftRatesSucceededSwapAction {
|
||||
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED;
|
||||
payload: ApiResponse;
|
||||
}
|
||||
|
||||
export interface DestinationAddressSwapAction {
|
||||
type: TypeKeys.SWAP_DESTINATION_ADDRESS;
|
||||
payload?: string;
|
||||
}
|
||||
|
||||
export interface RestartSwapAction {
|
||||
type: TypeKeys.SWAP_RESTART;
|
||||
}
|
||||
|
||||
export interface LoadBityRatesRequestedSwapAction {
|
||||
type: TypeKeys.SWAP_LOAD_BITY_RATES_REQUESTED;
|
||||
}
|
||||
|
||||
export interface LoadShapeshiftRatesRequestedSwapAction {
|
||||
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED;
|
||||
}
|
||||
|
||||
export interface LoadBityRatesFailedSwapAction {
|
||||
type: TypeKeys.SWAP_LOAD_BITY_RATES_FAILED;
|
||||
}
|
||||
|
||||
export interface LoadShapeshiftRatesFailedSwapAction {
|
||||
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_FAILED;
|
||||
}
|
||||
|
||||
export interface ChangeStepSwapAction {
|
||||
type: TypeKeys.SWAP_STEP;
|
||||
payload: number;
|
||||
}
|
||||
|
||||
export interface StopLoadBityRatesSwapAction {
|
||||
type: TypeKeys.SWAP_STOP_LOAD_BITY_RATES;
|
||||
}
|
||||
|
||||
export interface StopLoadShapeshiftRatesSwapAction {
|
||||
type: TypeKeys.SWAP_STOP_LOAD_SHAPESHIFT_RATES;
|
||||
}
|
||||
|
||||
export interface OrderSwapTimeSwapAction {
|
||||
type: TypeKeys.SWAP_ORDER_TIME;
|
||||
payload: number;
|
||||
}
|
||||
|
||||
export interface BityOrderCreateRequestedSwapAction {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_CREATE_REQUESTED;
|
||||
payload: {
|
||||
amount: number;
|
||||
destinationAddress: string;
|
||||
pair: string;
|
||||
mode: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ShapeshiftOrderCreateRequestedSwapAction {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_REQUESTED;
|
||||
payload: {
|
||||
withdrawal: string;
|
||||
originKind: string;
|
||||
destinationKind: string;
|
||||
destinationAmount: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface BityOrderInput {
|
||||
amount: string;
|
||||
currency: string;
|
||||
reference: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface BityOrderOutput {
|
||||
amount: string;
|
||||
currency: string;
|
||||
reference: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface BityOrderResponse {
|
||||
input: BityOrderInput;
|
||||
output: BityOrderOutput;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface ShapeshiftOrderResponse {
|
||||
apiPubKey?: string;
|
||||
deposit: string;
|
||||
depositAmount: string;
|
||||
expiration: number;
|
||||
expirationFormatted?: string;
|
||||
inputCurrency?: string;
|
||||
maxLimit: number;
|
||||
minerFee: string;
|
||||
orderId: string;
|
||||
outputCurrency?: string;
|
||||
pair: string; // e.g. eth_bat
|
||||
provider?: ProviderName; // shapeshift
|
||||
quotedRate: string;
|
||||
withdrawal: string;
|
||||
withdrawalAmount: string;
|
||||
}
|
||||
|
||||
export interface ShapeshiftStatusResponse {
|
||||
status: string;
|
||||
address?: string;
|
||||
withdraw?: string;
|
||||
transaction: string;
|
||||
}
|
||||
|
||||
export type BityOrderPostResponse = BityOrderResponse & {
|
||||
payment_address: string;
|
||||
status: string;
|
||||
input: BityOrderInput;
|
||||
output: BityOrderOutput;
|
||||
timestamp_created: string;
|
||||
validFor: number;
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type ProviderName = 'shapeshift' | 'bity';
|
||||
|
||||
export interface BityOrderCreateSucceededSwapAction {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_CREATE_SUCCEEDED;
|
||||
payload: BityOrderPostResponse;
|
||||
}
|
||||
|
||||
export interface ShapeshiftOrderCreateSucceededSwapAction {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_SUCCEEDED;
|
||||
payload: ShapeshiftOrderResponse;
|
||||
}
|
||||
|
||||
export interface BityOrderCreateFailedSwapAction {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_CREATE_FAILED;
|
||||
}
|
||||
|
||||
export interface ShapeshiftOrderCreateFailedSwapAction {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_FAILED;
|
||||
}
|
||||
|
||||
export interface BityOrderStatusRequestedSwapAction {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_STATUS_REQUESTED;
|
||||
}
|
||||
|
||||
export interface ShapeshiftOrderStatusRequestedSwapAction {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_STATUS_REQUESTED;
|
||||
}
|
||||
|
||||
export interface BityOrderStatusSucceededSwapAction {
|
||||
type: TypeKeys.SWAP_BITY_ORDER_STATUS_SUCCEEDED;
|
||||
payload: BityOrderResponse;
|
||||
}
|
||||
|
||||
export interface ShapeshiftOrderStatusSucceededSwapAction {
|
||||
type: TypeKeys.SWAP_SHAPESHIFT_ORDER_STATUS_SUCCEEDED;
|
||||
payload: ShapeshiftStatusResponse;
|
||||
}
|
||||
|
||||
export interface StartOrderTimerSwapAction {
|
||||
type: TypeKeys.SWAP_ORDER_START_TIMER;
|
||||
}
|
||||
|
||||
export interface StopOrderTimerSwapAction {
|
||||
type: TypeKeys.SWAP_ORDER_STOP_TIMER;
|
||||
}
|
||||
|
||||
export interface StartPollBityOrderStatusAction {
|
||||
type: TypeKeys.SWAP_START_POLL_BITY_ORDER_STATUS;
|
||||
}
|
||||
|
||||
export interface StartPollShapeshiftOrderStatusAction {
|
||||
type: TypeKeys.SWAP_START_POLL_SHAPESHIFT_ORDER_STATUS;
|
||||
}
|
||||
|
||||
export interface StopPollBityOrderStatusAction {
|
||||
type: TypeKeys.SWAP_STOP_POLL_BITY_ORDER_STATUS;
|
||||
}
|
||||
|
||||
export interface StopPollShapeshiftOrderStatusAction {
|
||||
type: TypeKeys.SWAP_STOP_POLL_SHAPESHIFT_ORDER_STATUS;
|
||||
}
|
||||
|
||||
export interface ChangeProviderSwapAcion {
|
||||
type: TypeKeys.SWAP_CHANGE_PROVIDER;
|
||||
payload: ProviderName;
|
||||
}
|
||||
|
||||
export interface ConfigureLiteSendAction {
|
||||
type: TypeKeys.SWAP_CONFIGURE_LITE_SEND;
|
||||
}
|
||||
|
||||
export interface ShowLiteSendAction {
|
||||
type: TypeKeys.SWAP_SHOW_LITE_SEND;
|
||||
payload: boolean;
|
||||
}
|
||||
|
||||
/*** Action Type Union ***/
|
||||
export type SwapAction =
|
||||
| ChangeStepSwapAction
|
||||
| InitSwap
|
||||
| DestinationAddressSwapAction
|
||||
| RestartSwapAction
|
||||
| LoadBityRatesRequestedSwapAction
|
||||
| LoadBityRatesSucceededSwapAction
|
||||
| LoadBityRatesFailedSwapAction
|
||||
| LoadShapeshiftRatesRequestedSwapAction
|
||||
| LoadShapeshiftRatesSucceededSwapAction
|
||||
| LoadShapeshiftRatesFailedSwapAction
|
||||
| StopLoadBityRatesSwapAction
|
||||
| StopLoadShapeshiftRatesSwapAction
|
||||
| BityOrderCreateRequestedSwapAction
|
||||
| ShapeshiftOrderCreateRequestedSwapAction
|
||||
| BityOrderCreateSucceededSwapAction
|
||||
| ShapeshiftOrderCreateSucceededSwapAction
|
||||
| BityOrderStatusSucceededSwapAction
|
||||
| ShapeshiftOrderStatusSucceededSwapAction
|
||||
| StartPollBityOrderStatusAction
|
||||
| StartPollShapeshiftOrderStatusAction
|
||||
| BityOrderCreateFailedSwapAction
|
||||
| ShapeshiftOrderCreateFailedSwapAction
|
||||
| OrderSwapTimeSwapAction
|
||||
| ChangeProviderSwapAcion
|
||||
| ConfigureLiteSendAction
|
||||
| ShowLiteSendAction;
|
|
@ -1,34 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
SWAP_STEP = 'SWAP_STEP',
|
||||
SWAP_INIT = 'SWAP_INIT',
|
||||
SWAP_LOAD_BITY_RATES_SUCCEEDED = 'SWAP_LOAD_BITY_RATES_SUCCEEDED',
|
||||
SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED = 'SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED',
|
||||
SWAP_DESTINATION_ADDRESS = 'SWAP_DESTINATION_ADDRESS',
|
||||
SWAP_RESTART = 'SWAP_RESTART',
|
||||
SWAP_LOAD_BITY_RATES_REQUESTED = 'SWAP_LOAD_BITY_RATES_REQUESTED',
|
||||
SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED = 'SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED',
|
||||
SWAP_LOAD_BITY_RATES_FAILED = 'SWAP_LOAD_BITY_RATES_FAILED',
|
||||
SWAP_LOAD_SHAPESHIFT_RATES_FAILED = 'SWAP_LOAD_SHAPESHIFT_RATES_FAILED',
|
||||
SWAP_STOP_LOAD_BITY_RATES = 'SWAP_STOP_LOAD_BITY_RATES',
|
||||
SWAP_STOP_LOAD_SHAPESHIFT_RATES = 'SWAP_STOP_LOAD_SHAPESHIFT_RATES',
|
||||
SWAP_ORDER_TIME = 'SWAP_ORDER_TIME',
|
||||
SWAP_BITY_ORDER_CREATE_SUCCEEDED = 'SWAP_BITY_ORDER_CREATE_SUCCEEDED',
|
||||
SWAP_SHAPESHIFT_ORDER_CREATE_SUCCEEDED = 'SWAP_SHAPESHIFT_ORDER_CREATE_SUCCEEDED',
|
||||
SWAP_BITY_ORDER_STATUS_SUCCEEDED = 'SWAP_BITY_ORDER_STATUS_SUCCEEDED',
|
||||
SWAP_SHAPESHIFT_ORDER_STATUS_SUCCEEDED = 'SWAP_SHAPESHIFT_ORDER_STATUS_SUCCEEDED',
|
||||
SWAP_BITY_ORDER_STATUS_REQUESTED = 'SWAP_BITY_ORDER_STATUS_REQUESTED',
|
||||
SWAP_SHAPESHIFT_ORDER_STATUS_REQUESTED = 'SWAP_SHAPESHIFT_ORDER_STATUS_REQUESTED',
|
||||
SWAP_ORDER_START_TIMER = 'SWAP_ORDER_START_TIMER',
|
||||
SWAP_ORDER_STOP_TIMER = 'SWAP_ORDER_STOP_TIMER',
|
||||
SWAP_START_POLL_BITY_ORDER_STATUS = 'SWAP_START_POLL_BITY_ORDER_STATUS',
|
||||
SWAP_START_POLL_SHAPESHIFT_ORDER_STATUS = 'SWAP_START_POLL_SHAPESHIFT_ORDER_STATUS',
|
||||
SWAP_STOP_POLL_BITY_ORDER_STATUS = 'SWAP_STOP_POLL_BITY_ORDER_STATUS',
|
||||
SWAP_STOP_POLL_SHAPESHIFT_ORDER_STATUS = 'SWAP_STOP_POLL_SHAPESHIFT_ORDER_STATUS',
|
||||
SWAP_BITY_ORDER_CREATE_REQUESTED = 'SWAP_ORDER_CREATE_REQUESTED',
|
||||
SWAP_SHAPESHIFT_ORDER_CREATE_REQUESTED = 'SWAP_SHAPESHIFT_ORDER_CREATE_REQUESTED',
|
||||
SWAP_BITY_ORDER_CREATE_FAILED = 'SWAP_ORDER_CREATE_FAILED',
|
||||
SWAP_SHAPESHIFT_ORDER_CREATE_FAILED = 'SWAP_SHAPESHIFT_ORDER_CREATE_FAILED',
|
||||
SWAP_CHANGE_PROVIDER = 'SWAP_CHANGE_PROVIDER',
|
||||
SWAP_CONFIGURE_LITE_SEND = 'SWAP_CONFIGURE_LITE_SEND',
|
||||
SWAP_SHOW_LITE_SEND = 'SWAP_SHOW_LITE_SEND'
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
export * from './actionTypes';
|
||||
export * from './actionCreators';
|
|
@ -1,55 +0,0 @@
|
|||
import {
|
||||
BroadcastLocalTransactionRequestedAction,
|
||||
BroadcastWeb3TransactionRequestedAction,
|
||||
BroadcastTransactionFailedAction,
|
||||
BroadcastTransactionSucceededAction,
|
||||
BroadcastTransactionQueuedAction
|
||||
} from '../actionTypes';
|
||||
import { TypeKeys } from '../constants';
|
||||
|
||||
type TBroadcastLocalTransactionRequested = typeof broadcastLocalTransactionRequested;
|
||||
const broadcastLocalTransactionRequested = (): BroadcastLocalTransactionRequestedAction => ({
|
||||
type: TypeKeys.BROADCAST_LOCAL_TRANSACTION_REQUESTED
|
||||
});
|
||||
|
||||
type TBroadcastWeb3TransactionRequested = typeof broadcastWeb3TransactionRequested;
|
||||
const broadcastWeb3TransactionRequested = (): BroadcastWeb3TransactionRequestedAction => ({
|
||||
type: TypeKeys.BROADCAST_WEB3_TRANSACTION_REQUESTED
|
||||
});
|
||||
|
||||
type TBroadcastTransactionSucceeded = typeof broadcastTransactionSucceeded;
|
||||
const broadcastTransactionSucceeded = (
|
||||
payload: BroadcastTransactionSucceededAction['payload']
|
||||
): BroadcastTransactionSucceededAction => ({
|
||||
type: TypeKeys.BROADCAST_TRANSACTION_SUCCEEDED,
|
||||
payload
|
||||
});
|
||||
|
||||
type TBroadcastTransactionFailed = typeof broadcastTransactionFailed;
|
||||
const broadcastTransactionFailed = (
|
||||
payload: BroadcastTransactionFailedAction['payload']
|
||||
): BroadcastTransactionFailedAction => ({
|
||||
type: TypeKeys.BROADCAST_TRASACTION_FAILED,
|
||||
payload
|
||||
});
|
||||
|
||||
type TBroadcastTransactionQueued = typeof broadcastTransactionQueued;
|
||||
const broadcastTransactionQueued = (
|
||||
payload: BroadcastTransactionQueuedAction['payload']
|
||||
): BroadcastTransactionQueuedAction => ({
|
||||
type: TypeKeys.BROADCAST_TRANSACTION_QUEUED,
|
||||
payload
|
||||
});
|
||||
|
||||
export {
|
||||
broadcastLocalTransactionRequested,
|
||||
broadcastWeb3TransactionRequested,
|
||||
broadcastTransactionSucceeded,
|
||||
broadcastTransactionFailed,
|
||||
broadcastTransactionQueued,
|
||||
TBroadcastLocalTransactionRequested,
|
||||
TBroadcastWeb3TransactionRequested,
|
||||
TBroadcastTransactionSucceeded,
|
||||
TBroadcastTransactionFailed,
|
||||
TBroadcastTransactionQueued
|
||||
};
|
|
@ -1,16 +0,0 @@
|
|||
import { SetCurrentToAction, SetCurrentValueAction } from '../actionTypes/current';
|
||||
import { TypeKeys } from '../';
|
||||
|
||||
type TSetCurrentValue = typeof setCurrentValue;
|
||||
const setCurrentValue = (payload: SetCurrentValueAction['payload']): SetCurrentValueAction => ({
|
||||
type: TypeKeys.CURRENT_VALUE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetCurrentTo = typeof setCurrentTo;
|
||||
const setCurrentTo = (payload: SetCurrentToAction['payload']): SetCurrentToAction => ({
|
||||
type: TypeKeys.CURRENT_TO_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export { setCurrentValue, setCurrentTo, TSetCurrentTo, TSetCurrentValue };
|
|
@ -1,124 +0,0 @@
|
|||
import {
|
||||
SetGasLimitFieldAction,
|
||||
SetDataFieldAction,
|
||||
SetToFieldAction,
|
||||
SetNonceFieldAction,
|
||||
SetValueFieldAction,
|
||||
InputGasLimitAction,
|
||||
InputGasPriceAction,
|
||||
InputGasPriceIntentAction,
|
||||
InputDataAction,
|
||||
InputNonceAction,
|
||||
ResetTransactionRequestedAction,
|
||||
ResetTransactionSuccessfulAction,
|
||||
SetGasPriceFieldAction
|
||||
} from '../actionTypes';
|
||||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
|
||||
type TInputGasLimit = typeof inputGasLimit;
|
||||
const inputGasLimit = (payload: InputGasLimitAction['payload']) => ({
|
||||
type: TypeKeys.GAS_LIMIT_INPUT,
|
||||
payload
|
||||
});
|
||||
|
||||
type TInputGasPrice = typeof inputGasPrice;
|
||||
const inputGasPrice = (payload: InputGasPriceAction['payload']) => ({
|
||||
type: TypeKeys.GAS_PRICE_INPUT,
|
||||
payload
|
||||
});
|
||||
|
||||
type TInputGasPriceIntent = typeof inputGasPrice;
|
||||
const inputGasPriceIntent = (payload: InputGasPriceIntentAction['payload']) => ({
|
||||
type: TypeKeys.GAS_PRICE_INPUT_INTENT,
|
||||
payload
|
||||
});
|
||||
|
||||
type TInputNonce = typeof inputNonce;
|
||||
const inputNonce = (payload: InputNonceAction['payload']) => ({
|
||||
type: TypeKeys.NONCE_INPUT,
|
||||
payload
|
||||
});
|
||||
|
||||
type TInputData = typeof inputData;
|
||||
const inputData = (payload: InputDataAction['payload']) => ({
|
||||
type: TypeKeys.DATA_FIELD_INPUT,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetGasLimitField = typeof setGasLimitField;
|
||||
const setGasLimitField = (payload: SetGasLimitFieldAction['payload']): SetGasLimitFieldAction => ({
|
||||
type: TypeKeys.GAS_LIMIT_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetDataField = typeof setDataField;
|
||||
const setDataField = (payload: SetDataFieldAction['payload']): SetDataFieldAction => ({
|
||||
type: TypeKeys.DATA_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetToField = typeof setToField;
|
||||
const setToField = (payload: SetToFieldAction['payload']): SetToFieldAction => ({
|
||||
type: TypeKeys.TO_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetNonceField = typeof setNonceField;
|
||||
const setNonceField = (payload: SetNonceFieldAction['payload']): SetNonceFieldAction => ({
|
||||
type: TypeKeys.NONCE_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetValueField = typeof setValueField;
|
||||
const setValueField = (payload: SetValueFieldAction['payload']): SetValueFieldAction => ({
|
||||
type: TypeKeys.VALUE_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetGasPriceField = typeof setGasPriceField;
|
||||
const setGasPriceField = (payload: SetGasPriceFieldAction['payload']): SetGasPriceFieldAction => ({
|
||||
type: TypeKeys.GAS_PRICE_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TResetTransactionRequested = typeof resetTransactionRequested;
|
||||
const resetTransactionRequested = (): ResetTransactionRequestedAction => ({
|
||||
type: TypeKeys.RESET_REQUESTED
|
||||
});
|
||||
|
||||
type TResetTransactionSuccessful = typeof resetTransactionSuccessful;
|
||||
const resetTransactionSuccessful = (
|
||||
payload: ResetTransactionSuccessfulAction['payload']
|
||||
): ResetTransactionSuccessfulAction => ({
|
||||
type: TypeKeys.RESET_SUCCESSFUL,
|
||||
payload
|
||||
});
|
||||
|
||||
export {
|
||||
TInputGasLimit,
|
||||
TInputGasPrice,
|
||||
TInputGasPriceIntent,
|
||||
TInputNonce,
|
||||
TInputData,
|
||||
TSetGasLimitField,
|
||||
TSetDataField,
|
||||
TSetToField,
|
||||
TSetNonceField,
|
||||
TSetValueField,
|
||||
TSetGasPriceField,
|
||||
TResetTransactionRequested,
|
||||
TResetTransactionSuccessful,
|
||||
inputGasLimit,
|
||||
inputGasPrice,
|
||||
inputGasPriceIntent,
|
||||
inputNonce,
|
||||
inputData,
|
||||
setGasLimitField,
|
||||
setDataField,
|
||||
setToField,
|
||||
setNonceField,
|
||||
setValueField,
|
||||
setGasPriceField,
|
||||
resetTransactionRequested,
|
||||
resetTransactionSuccessful
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
export * from './fields';
|
||||
export * from './meta';
|
||||
export * from './network';
|
||||
export * from './sign';
|
||||
export * from './broadcast';
|
||||
export * from './current';
|
||||
export * from './sendEverything';
|
|
@ -1,36 +0,0 @@
|
|||
import {
|
||||
TypeKeys,
|
||||
SetUnitMetaAction,
|
||||
SetTokenValueMetaAction,
|
||||
SetTokenToMetaAction,
|
||||
SetAsContractInteractionAction,
|
||||
SetAsViewAndSendAction
|
||||
} from 'actions/transaction';
|
||||
|
||||
export type TSetTokenTo = typeof setTokenTo;
|
||||
export const setTokenTo = (payload: SetTokenToMetaAction['payload']): SetTokenToMetaAction => ({
|
||||
type: TypeKeys.TOKEN_TO_META_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export type TSetTokenValue = typeof setTokenValue;
|
||||
export const setTokenValue = (
|
||||
payload: SetTokenValueMetaAction['payload']
|
||||
): SetTokenValueMetaAction => ({
|
||||
type: TypeKeys.TOKEN_VALUE_META_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export type TSetUnitMeta = typeof setUnitMeta;
|
||||
export const setUnitMeta = (payload: SetUnitMetaAction['payload']): SetUnitMetaAction => ({
|
||||
type: TypeKeys.UNIT_META_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export type TSetAsContractInteraction = typeof setAsContractInteraction;
|
||||
export const setAsContractInteraction = (): SetAsContractInteractionAction => ({
|
||||
type: TypeKeys.IS_CONTRACT_INTERACTION
|
||||
});
|
||||
|
||||
export type TSetAsViewAndSend = typeof setAsViewAndSend;
|
||||
export const setAsViewAndSend = (): SetAsViewAndSendAction => ({ type: TypeKeys.IS_VIEW_AND_SEND });
|
|
@ -1,90 +0,0 @@
|
|||
import {
|
||||
TypeKeys,
|
||||
EstimateGasFailedAction,
|
||||
EstimateGasRequestedAction,
|
||||
EstimateGasTimeoutAction,
|
||||
EstimateGasSucceededAction,
|
||||
GetFromRequestedAction,
|
||||
GetFromSucceededAction,
|
||||
GetFromFailedAction,
|
||||
GetNonceRequestedAction,
|
||||
GetNonceSucceededAction,
|
||||
GetNonceFailedAction
|
||||
} from 'actions/transaction';
|
||||
|
||||
type TEstimateGasRequested = typeof estimateGasRequested;
|
||||
const estimateGasRequested = (
|
||||
payload: EstimateGasRequestedAction['payload']
|
||||
): EstimateGasRequestedAction => ({
|
||||
type: TypeKeys.ESTIMATE_GAS_REQUESTED,
|
||||
payload
|
||||
});
|
||||
|
||||
type TEstimateGasSucceeded = typeof estimateGasSucceeded;
|
||||
const estimateGasSucceeded = (): EstimateGasSucceededAction => ({
|
||||
type: TypeKeys.ESTIMATE_GAS_SUCCEEDED
|
||||
});
|
||||
|
||||
type TEstimateGasFailed = typeof estimateGasFailed;
|
||||
const estimateGasFailed = (): EstimateGasFailedAction => ({
|
||||
type: TypeKeys.ESTIMATE_GAS_FAILED
|
||||
});
|
||||
|
||||
type TEstimateGasTimedout = typeof estimateGasTimedout;
|
||||
const estimateGasTimedout = (): EstimateGasTimeoutAction => ({
|
||||
type: TypeKeys.ESTIMATE_GAS_TIMEDOUT
|
||||
});
|
||||
|
||||
type TGetFromRequested = typeof getFromRequested;
|
||||
const getFromRequested = (): GetFromRequestedAction => ({
|
||||
type: TypeKeys.GET_FROM_REQUESTED
|
||||
});
|
||||
|
||||
type TGetFromSucceeded = typeof getFromSucceeded;
|
||||
const getFromSucceeded = (payload: GetFromSucceededAction['payload']): GetFromSucceededAction => ({
|
||||
type: TypeKeys.GET_FROM_SUCCEEDED,
|
||||
payload
|
||||
});
|
||||
|
||||
type TGetFromFailed = typeof getFromFailed;
|
||||
const getFromFailed = (): GetFromFailedAction => ({
|
||||
type: TypeKeys.GET_FROM_FAILED
|
||||
});
|
||||
|
||||
type TGetNonceRequested = typeof getNonceRequested;
|
||||
const getNonceRequested = (): GetNonceRequestedAction => ({
|
||||
type: TypeKeys.GET_NONCE_REQUESTED
|
||||
});
|
||||
|
||||
type TGetNonceSucceeded = typeof getNonceSucceeded;
|
||||
const getNonceSucceeded = (
|
||||
payload: GetNonceSucceededAction['payload']
|
||||
): GetNonceSucceededAction => ({ type: TypeKeys.GET_NONCE_SUCCEEDED, payload });
|
||||
|
||||
type TGetNonceFailed = typeof getNonceFailed;
|
||||
const getNonceFailed = (): GetNonceFailedAction => ({
|
||||
type: TypeKeys.GET_NONCE_FAILED
|
||||
});
|
||||
|
||||
export {
|
||||
estimateGasRequested,
|
||||
estimateGasFailed,
|
||||
estimateGasTimedout,
|
||||
estimateGasSucceeded,
|
||||
getFromRequested,
|
||||
getFromSucceeded,
|
||||
getFromFailed,
|
||||
getNonceRequested,
|
||||
getNonceFailed,
|
||||
getNonceSucceeded,
|
||||
TEstimateGasRequested,
|
||||
TEstimateGasFailed,
|
||||
TEstimateGasSucceeded,
|
||||
TEstimateGasTimedout,
|
||||
TGetFromRequested,
|
||||
TGetFromSucceeded,
|
||||
TGetNonceRequested,
|
||||
TGetNonceSucceeded,
|
||||
TGetNonceFailed,
|
||||
TGetFromFailed
|
||||
};
|
|
@ -1,30 +0,0 @@
|
|||
import {
|
||||
SendEverythingFailedAction,
|
||||
SendEverythingRequestedAction,
|
||||
SendEverythingSucceededAction
|
||||
} from '../actionTypes/sendEverything';
|
||||
import { TypeKeys } from 'actions/transaction';
|
||||
|
||||
type TSendEverythingRequested = typeof sendEverythingRequested;
|
||||
const sendEverythingRequested = (): SendEverythingRequestedAction => ({
|
||||
type: TypeKeys.SEND_EVERYTHING_REQUESTED
|
||||
});
|
||||
|
||||
type TSendEverythingFailed = typeof sendEverythingFailed;
|
||||
const sendEverythingFailed = (): SendEverythingFailedAction => ({
|
||||
type: TypeKeys.SEND_EVERYTHING_FAILED
|
||||
});
|
||||
|
||||
type TSendEverythingSucceeded = typeof sendEverythingSucceeded;
|
||||
const sendEverythingSucceeded = (): SendEverythingSucceededAction => ({
|
||||
type: TypeKeys.SEND_EVERYTHING_SUCCEEDED
|
||||
});
|
||||
|
||||
export {
|
||||
TSendEverythingRequested,
|
||||
TSendEverythingFailed,
|
||||
TSendEverythingSucceeded,
|
||||
sendEverythingRequested,
|
||||
sendEverythingFailed,
|
||||
sendEverythingSucceeded
|
||||
};
|
|
@ -1,45 +0,0 @@
|
|||
import {
|
||||
SignTransactionFailedAction,
|
||||
SignLocalTransactionSucceededAction,
|
||||
SignWeb3TransactionSucceededAction,
|
||||
SignTransactionRequestedAction
|
||||
} from '../actionTypes';
|
||||
import { TypeKeys } from '../constants';
|
||||
|
||||
type TSignTransactionFailed = typeof signTransactionFailed;
|
||||
const signTransactionFailed = (): SignTransactionFailedAction => ({
|
||||
type: TypeKeys.SIGN_TRANSACTION_FAILED
|
||||
});
|
||||
|
||||
type TSignTransactionRequested = typeof signTransactionRequested;
|
||||
const signTransactionRequested = (payload: SignTransactionRequestedAction['payload']) => ({
|
||||
type: TypeKeys.SIGN_TRANSACTION_REQUESTED,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSignLocalTransactionSucceeded = typeof signLocalTransactionSucceeded;
|
||||
const signLocalTransactionSucceeded = (
|
||||
payload: SignLocalTransactionSucceededAction['payload']
|
||||
): SignLocalTransactionSucceededAction => ({
|
||||
type: TypeKeys.SIGN_LOCAL_TRANSACTION_SUCCEEDED,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSignWeb3TransactionSucceeded = typeof signWeb3TransactionSucceeded;
|
||||
const signWeb3TransactionSucceeded = (
|
||||
payload: SignWeb3TransactionSucceededAction['payload']
|
||||
): SignWeb3TransactionSucceededAction => ({
|
||||
type: TypeKeys.SIGN_WEB3_TRANSACTION_SUCCEEDED,
|
||||
payload
|
||||
});
|
||||
|
||||
export {
|
||||
signTransactionRequested,
|
||||
signTransactionFailed,
|
||||
signLocalTransactionSucceeded,
|
||||
signWeb3TransactionSucceeded,
|
||||
TSignLocalTransactionSucceeded,
|
||||
TSignWeb3TransactionSucceeded,
|
||||
TSignTransactionFailed,
|
||||
TSignTransactionRequested
|
||||
};
|
|
@ -1,33 +0,0 @@
|
|||
import {
|
||||
SwapEtherToTokenAction,
|
||||
SwapTokenToEtherAction,
|
||||
SwapTokenToTokenAction
|
||||
} from '../actionTypes';
|
||||
import { TypeKeys } from '../constants';
|
||||
|
||||
type TSwapTokenToEther = typeof swapTokenToEther;
|
||||
const swapTokenToEther = (payload: SwapTokenToEtherAction['payload']): SwapTokenToEtherAction => ({
|
||||
type: TypeKeys.TOKEN_TO_ETHER_SWAP,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSwapEtherToToken = typeof swapEtherToToken;
|
||||
const swapEtherToToken = (payload: SwapEtherToTokenAction['payload']): SwapEtherToTokenAction => ({
|
||||
payload,
|
||||
type: TypeKeys.ETHER_TO_TOKEN_SWAP
|
||||
});
|
||||
|
||||
type TSwapTokenToToken = typeof swapTokenToToken;
|
||||
const swapTokenToToken = (payload: SwapTokenToTokenAction['payload']): SwapTokenToTokenAction => ({
|
||||
payload,
|
||||
type: TypeKeys.TOKEN_TO_TOKEN_SWAP
|
||||
});
|
||||
|
||||
export {
|
||||
swapEtherToToken,
|
||||
swapTokenToEther,
|
||||
swapTokenToToken,
|
||||
TSwapTokenToEther,
|
||||
TSwapEtherToToken,
|
||||
TSwapTokenToToken
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
import { TypeKeys } from '../constants';
|
||||
import { BroadcastAction } from './broadcast';
|
||||
import { FieldAction, InputFieldAction } from './fields';
|
||||
import { MetaAction } from './meta';
|
||||
import { NetworkAction } from './network';
|
||||
import { SignAction } from './sign';
|
||||
import { SwapAction } from './swap';
|
||||
import { CurrentAction } from './current';
|
||||
import { SendEverythingAction } from './sendEverything';
|
||||
|
||||
export * from './broadcast';
|
||||
export * from './fields';
|
||||
export * from './meta';
|
||||
export * from './network';
|
||||
export * from './sign';
|
||||
export * from './swap';
|
||||
export * from './current';
|
||||
export * from './sendEverything';
|
||||
|
||||
export interface ResetTransactionRequestedAction {
|
||||
type: TypeKeys.RESET_REQUESTED;
|
||||
}
|
||||
|
||||
export interface ResetTransactionSuccessfulAction {
|
||||
type: TypeKeys.RESET_SUCCESSFUL;
|
||||
payload: { isContractInteraction: boolean };
|
||||
}
|
||||
|
||||
export type TransactionAction =
|
||||
| InputFieldAction
|
||||
| BroadcastAction
|
||||
| FieldAction
|
||||
| MetaAction
|
||||
| NetworkAction
|
||||
| SignAction
|
||||
| SwapAction
|
||||
| ResetTransactionRequestedAction
|
||||
| ResetTransactionSuccessfulAction
|
||||
| CurrentAction
|
||||
| SendEverythingAction;
|
|
@ -1,35 +0,0 @@
|
|||
import { TypeKeys } from 'actions/transaction';
|
||||
/* Broadcasting actions */
|
||||
interface BroadcastLocalTransactionRequestedAction {
|
||||
type: TypeKeys.BROADCAST_LOCAL_TRANSACTION_REQUESTED;
|
||||
}
|
||||
interface BroadcastWeb3TransactionRequestedAction {
|
||||
type: TypeKeys.BROADCAST_WEB3_TRANSACTION_REQUESTED;
|
||||
}
|
||||
interface BroadcastTransactionSucceededAction {
|
||||
type: TypeKeys.BROADCAST_TRANSACTION_SUCCEEDED;
|
||||
payload: { indexingHash: string; broadcastedHash: string };
|
||||
}
|
||||
interface BroadcastTransactionQueuedAction {
|
||||
type: TypeKeys.BROADCAST_TRANSACTION_QUEUED;
|
||||
payload: { indexingHash: string; serializedTransaction: Buffer };
|
||||
}
|
||||
interface BroadcastTransactionFailedAction {
|
||||
type: TypeKeys.BROADCAST_TRASACTION_FAILED;
|
||||
payload: { indexingHash: string };
|
||||
}
|
||||
type BroadcastAction =
|
||||
| BroadcastLocalTransactionRequestedAction
|
||||
| BroadcastTransactionSucceededAction
|
||||
| BroadcastWeb3TransactionRequestedAction
|
||||
| BroadcastTransactionQueuedAction
|
||||
| BroadcastTransactionFailedAction;
|
||||
|
||||
export {
|
||||
BroadcastLocalTransactionRequestedAction,
|
||||
BroadcastTransactionSucceededAction,
|
||||
BroadcastWeb3TransactionRequestedAction,
|
||||
BroadcastTransactionQueuedAction,
|
||||
BroadcastTransactionFailedAction,
|
||||
BroadcastAction
|
||||
};
|
|
@ -1,17 +0,0 @@
|
|||
import { TypeKeys } from '../constants';
|
||||
|
||||
/* user input */
|
||||
|
||||
interface SetCurrentValueAction {
|
||||
type: TypeKeys.CURRENT_VALUE_SET;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
interface SetCurrentToAction {
|
||||
type: TypeKeys.CURRENT_TO_SET;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
type CurrentAction = SetCurrentValueAction | SetCurrentToAction;
|
||||
|
||||
export { SetCurrentValueAction, SetCurrentToAction, CurrentAction };
|
|
@ -1,102 +0,0 @@
|
|||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { Wei, Data, Address, Nonce } from 'libs/units';
|
||||
|
||||
/* User Input */
|
||||
interface InputGasLimitAction {
|
||||
type: TypeKeys.GAS_LIMIT_INPUT;
|
||||
payload: string;
|
||||
}
|
||||
interface InputGasPriceAction {
|
||||
type: TypeKeys.GAS_PRICE_INPUT;
|
||||
payload: string;
|
||||
}
|
||||
interface InputGasPriceIntentAction {
|
||||
type: TypeKeys.GAS_PRICE_INPUT_INTENT;
|
||||
payload: string;
|
||||
}
|
||||
interface InputDataAction {
|
||||
type: TypeKeys.DATA_FIELD_INPUT;
|
||||
payload: string;
|
||||
}
|
||||
interface InputNonceAction {
|
||||
type: TypeKeys.NONCE_INPUT;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
/*Field Actions -- Reducer input*/
|
||||
|
||||
// We can compute field validity by checking if the value is null
|
||||
|
||||
interface SetGasLimitFieldAction {
|
||||
type: TypeKeys.GAS_LIMIT_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetGasPriceFieldAction {
|
||||
type: TypeKeys.GAS_PRICE_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetDataFieldAction {
|
||||
type: TypeKeys.DATA_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Data | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetToFieldAction {
|
||||
type: TypeKeys.TO_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Address | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetNonceFieldAction {
|
||||
type: TypeKeys.NONCE_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Nonce | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetValueFieldAction {
|
||||
type: TypeKeys.VALUE_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
type InputFieldAction = InputNonceAction | InputGasLimitAction | InputDataAction;
|
||||
|
||||
type FieldAction =
|
||||
| SetGasLimitFieldAction
|
||||
| SetDataFieldAction
|
||||
| SetToFieldAction
|
||||
| SetNonceFieldAction
|
||||
| SetValueFieldAction
|
||||
| SetGasPriceFieldAction;
|
||||
|
||||
export {
|
||||
InputGasLimitAction,
|
||||
InputGasPriceAction,
|
||||
InputGasPriceIntentAction,
|
||||
InputDataAction,
|
||||
InputNonceAction,
|
||||
SetGasLimitFieldAction,
|
||||
SetDataFieldAction,
|
||||
SetToFieldAction,
|
||||
SetNonceFieldAction,
|
||||
SetValueFieldAction,
|
||||
FieldAction,
|
||||
InputFieldAction,
|
||||
SetGasPriceFieldAction
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
export * from './actionTypes';
|
|
@ -1,48 +0,0 @@
|
|||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { Address, TokenValue } from 'libs/units';
|
||||
/*Meta Actions*/
|
||||
|
||||
interface SetTokenToMetaAction {
|
||||
type: TypeKeys.TOKEN_TO_META_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Address | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetUnitMetaAction {
|
||||
type: TypeKeys.UNIT_META_SET;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
interface SetTokenValueMetaAction {
|
||||
type: TypeKeys.TOKEN_VALUE_META_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: TokenValue | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetAsContractInteractionAction {
|
||||
type: TypeKeys.IS_CONTRACT_INTERACTION;
|
||||
}
|
||||
|
||||
interface SetAsViewAndSendAction {
|
||||
type: TypeKeys.IS_VIEW_AND_SEND;
|
||||
}
|
||||
|
||||
type TransactionMetaAction = SetUnitMetaAction | SetTokenValueMetaAction | SetTokenToMetaAction;
|
||||
type TransactionTypeMetaAction = SetAsContractInteractionAction | SetAsViewAndSendAction;
|
||||
|
||||
type MetaAction = TransactionMetaAction | TransactionTypeMetaAction;
|
||||
|
||||
export {
|
||||
TransactionMetaAction,
|
||||
TransactionTypeMetaAction,
|
||||
MetaAction,
|
||||
SetUnitMetaAction,
|
||||
SetTokenToMetaAction,
|
||||
SetTokenValueMetaAction,
|
||||
SetAsContractInteractionAction,
|
||||
SetAsViewAndSendAction
|
||||
};
|
|
@ -1,62 +0,0 @@
|
|||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { IHexStrTransaction } from 'libs/transaction';
|
||||
/* Network actions */
|
||||
interface EstimateGasRequestedAction {
|
||||
type: TypeKeys.ESTIMATE_GAS_REQUESTED;
|
||||
payload: Partial<IHexStrTransaction>;
|
||||
}
|
||||
interface EstimateGasSucceededAction {
|
||||
type: TypeKeys.ESTIMATE_GAS_SUCCEEDED;
|
||||
}
|
||||
interface EstimateGasFailedAction {
|
||||
type: TypeKeys.ESTIMATE_GAS_FAILED;
|
||||
}
|
||||
interface EstimateGasTimeoutAction {
|
||||
type: TypeKeys.ESTIMATE_GAS_TIMEDOUT;
|
||||
}
|
||||
interface GetFromRequestedAction {
|
||||
type: TypeKeys.GET_FROM_REQUESTED;
|
||||
}
|
||||
interface GetFromSucceededAction {
|
||||
type: TypeKeys.GET_FROM_SUCCEEDED;
|
||||
payload: string;
|
||||
}
|
||||
interface GetFromFailedAction {
|
||||
type: TypeKeys.GET_FROM_FAILED;
|
||||
}
|
||||
interface GetNonceRequestedAction {
|
||||
type: TypeKeys.GET_NONCE_REQUESTED;
|
||||
}
|
||||
interface GetNonceSucceededAction {
|
||||
type: TypeKeys.GET_NONCE_SUCCEEDED;
|
||||
payload: string;
|
||||
}
|
||||
interface GetNonceFailedAction {
|
||||
type: TypeKeys.GET_NONCE_FAILED;
|
||||
}
|
||||
|
||||
type NetworkAction =
|
||||
| EstimateGasFailedAction
|
||||
| EstimateGasRequestedAction
|
||||
| EstimateGasSucceededAction
|
||||
| EstimateGasTimeoutAction
|
||||
| GetFromRequestedAction
|
||||
| GetFromSucceededAction
|
||||
| GetFromFailedAction
|
||||
| GetNonceRequestedAction
|
||||
| GetNonceSucceededAction
|
||||
| GetNonceFailedAction;
|
||||
|
||||
export {
|
||||
EstimateGasRequestedAction,
|
||||
EstimateGasSucceededAction,
|
||||
EstimateGasFailedAction,
|
||||
EstimateGasTimeoutAction,
|
||||
GetFromRequestedAction,
|
||||
GetFromSucceededAction,
|
||||
GetFromFailedAction,
|
||||
GetNonceRequestedAction,
|
||||
GetNonceSucceededAction,
|
||||
GetNonceFailedAction,
|
||||
NetworkAction
|
||||
};
|
|
@ -1,23 +0,0 @@
|
|||
import { TypeKeys } from 'actions/transaction';
|
||||
|
||||
interface SendEverythingRequestedAction {
|
||||
type: TypeKeys.SEND_EVERYTHING_REQUESTED;
|
||||
}
|
||||
interface SendEverythingSucceededAction {
|
||||
type: TypeKeys.SEND_EVERYTHING_SUCCEEDED;
|
||||
}
|
||||
interface SendEverythingFailedAction {
|
||||
type: TypeKeys.SEND_EVERYTHING_FAILED;
|
||||
}
|
||||
|
||||
type SendEverythingAction =
|
||||
| SendEverythingRequestedAction
|
||||
| SendEverythingSucceededAction
|
||||
| SendEverythingFailedAction;
|
||||
|
||||
export {
|
||||
SendEverythingAction,
|
||||
SendEverythingSucceededAction,
|
||||
SendEverythingFailedAction,
|
||||
SendEverythingRequestedAction
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
import EthTx from 'ethereumjs-tx';
|
||||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
|
||||
/*
|
||||
* Difference between the web3/local is that a local sign will actually sign the tx
|
||||
* While a web3 sign just gathers the rest of the nessesary parameters of the ethereum tx
|
||||
* to do the sign + broadcast in 1 step later on
|
||||
*/
|
||||
|
||||
/* Signing / Async actions */
|
||||
interface SignTransactionRequestedAction {
|
||||
type: TypeKeys.SIGN_TRANSACTION_REQUESTED;
|
||||
payload: EthTx;
|
||||
}
|
||||
interface SignLocalTransactionSucceededAction {
|
||||
type: TypeKeys.SIGN_LOCAL_TRANSACTION_SUCCEEDED;
|
||||
payload: { signedTransaction: Buffer; indexingHash: string; noVerify?: boolean }; // dont verify against fields, for pushTx
|
||||
}
|
||||
|
||||
interface SignWeb3TransactionSucceededAction {
|
||||
type: TypeKeys.SIGN_WEB3_TRANSACTION_SUCCEEDED;
|
||||
payload: { transaction: Buffer; indexingHash: string; noVerify?: boolean };
|
||||
}
|
||||
interface SignTransactionFailedAction {
|
||||
type: TypeKeys.SIGN_TRANSACTION_FAILED;
|
||||
}
|
||||
|
||||
type SignAction =
|
||||
| SignTransactionRequestedAction
|
||||
| SignLocalTransactionSucceededAction
|
||||
| SignWeb3TransactionSucceededAction
|
||||
| SignTransactionFailedAction;
|
||||
|
||||
export {
|
||||
SignTransactionRequestedAction,
|
||||
SignLocalTransactionSucceededAction,
|
||||
SignWeb3TransactionSucceededAction,
|
||||
SignTransactionFailedAction,
|
||||
SignAction
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import {
|
||||
SetToFieldAction,
|
||||
SetValueFieldAction,
|
||||
SetTokenToMetaAction,
|
||||
SetTokenValueMetaAction,
|
||||
SetDataFieldAction
|
||||
} from 'actions/transaction';
|
||||
|
||||
/* Swapping actions */
|
||||
interface SwapTokenToEtherAction {
|
||||
type: TypeKeys.TOKEN_TO_ETHER_SWAP;
|
||||
payload: {
|
||||
to: SetToFieldAction['payload'];
|
||||
value: SetValueFieldAction['payload'];
|
||||
decimal: number;
|
||||
};
|
||||
}
|
||||
interface SwapEtherToTokenAction {
|
||||
type: TypeKeys.ETHER_TO_TOKEN_SWAP;
|
||||
payload: {
|
||||
to: SetToFieldAction['payload'];
|
||||
data: SetDataFieldAction['payload'];
|
||||
tokenTo: SetTokenToMetaAction['payload'];
|
||||
tokenValue: SetTokenValueMetaAction['payload'];
|
||||
decimal: number;
|
||||
};
|
||||
}
|
||||
interface SwapTokenToTokenAction {
|
||||
type: TypeKeys.TOKEN_TO_TOKEN_SWAP;
|
||||
payload: {
|
||||
to: SetToFieldAction['payload'];
|
||||
data: SetDataFieldAction['payload'];
|
||||
tokenValue: SetTokenValueMetaAction['payload'];
|
||||
decimal: number;
|
||||
};
|
||||
}
|
||||
type SwapAction = SwapEtherToTokenAction | SwapTokenToEtherAction | SwapTokenToTokenAction;
|
||||
|
||||
export { SwapTokenToEtherAction, SwapEtherToTokenAction, SwapAction, SwapTokenToTokenAction };
|
|
@ -1,59 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
ESTIMATE_GAS_REQUESTED = 'ESTIMATE_GAS_REQUESTED',
|
||||
ESTIMATE_GAS_SUCCEEDED = 'ESTIMATE_GAS_SUCCEEDED',
|
||||
ESTIMATE_GAS_FAILED = 'ESTIMATE_GAS_FAILED',
|
||||
ESTIMATE_GAS_TIMEDOUT = 'ESTIMATE_GAS_TIMEDOUT',
|
||||
|
||||
GET_FROM_REQUESTED = 'GET_FROM_REQUESTED',
|
||||
GET_FROM_SUCCEEDED = 'GET_FROM_SUCCEEDED',
|
||||
GET_FROM_FAILED = 'GET_FROM_FAILED',
|
||||
|
||||
GET_NONCE_REQUESTED = 'GET_NONCE_REQUESTED',
|
||||
GET_NONCE_SUCCEEDED = 'GET_NONCE_SUCCEEDED',
|
||||
GET_NONCE_FAILED = 'GET_NONCE_FAILED',
|
||||
|
||||
SIGN_TRANSACTION_REQUESTED = 'SIGN_TRANSACTION_REQUESTED',
|
||||
SIGN_WEB3_TRANSACTION_SUCCEEDED = 'SIGN_WEB3_TRANSACTION_SUCCEEDED',
|
||||
SIGN_LOCAL_TRANSACTION_SUCCEEDED = 'SIGN_LOCAL_TRANSACTION_SUCCEEDED',
|
||||
SIGN_TRANSACTION_FAILED = 'SIGN_TRANSACTION_FAILED',
|
||||
|
||||
BROADCAST_WEB3_TRANSACTION_REQUESTED = 'BROADCAST_WEB3_TRANSACTION_REQUESTED',
|
||||
BROADCAST_TRANSACTION_SUCCEEDED = 'BROADCAST_TRANSACTION_SUCCEEDED',
|
||||
BROADCAST_LOCAL_TRANSACTION_REQUESTED = 'BROADCAST_LOCAL_TRANSACTION_REQUESTED',
|
||||
BROADCAST_TRANSACTION_QUEUED = 'BROADCAST_TRANSACTION_QUEUED',
|
||||
BROADCAST_TRASACTION_FAILED = 'BROADCAST_TRASACTION_FAILED',
|
||||
|
||||
CURRENT_VALUE_SET = 'CURRENT_VALUE_SET',
|
||||
CURRENT_TO_SET = 'CURRENT_TO_SET',
|
||||
|
||||
DATA_FIELD_INPUT = 'DATA_FIELD_INPUT',
|
||||
GAS_LIMIT_INPUT = 'GAS_LIMIT_INPUT',
|
||||
GAS_PRICE_INPUT = 'GAS_PRICE_INPUT',
|
||||
GAS_PRICE_INPUT_INTENT = 'GAS_PRICE_INPUT_INTENT',
|
||||
NONCE_INPUT = 'NONCE_INPUT',
|
||||
|
||||
DATA_FIELD_SET = 'DATA_FIELD_SET',
|
||||
GAS_LIMIT_FIELD_SET = 'GAS_LIMIT_FIELD_SET',
|
||||
TO_FIELD_SET = 'TO_FIELD_SET',
|
||||
VALUE_FIELD_SET = 'VALUE_FIELD_SET',
|
||||
NONCE_FIELD_SET = 'NONCE_FIELD_SET',
|
||||
GAS_PRICE_FIELD_SET = 'GAS_PRICE_FIELD_SET',
|
||||
|
||||
TOKEN_TO_META_SET = 'TOKEN_TO_META_SET',
|
||||
UNIT_META_SET = 'UNIT_META_SET',
|
||||
TOKEN_VALUE_META_SET = 'TOKEN_VALUE_META_SET',
|
||||
|
||||
TOKEN_TO_ETHER_SWAP = 'TOKEN_TO_ETHER_SWAP',
|
||||
ETHER_TO_TOKEN_SWAP = 'ETHER_TO_TOKEN_SWAP',
|
||||
TOKEN_TO_TOKEN_SWAP = 'TOKEN_TO_TOKEN_SWAP',
|
||||
|
||||
SEND_EVERYTHING_REQUESTED = 'SEND_EVERYTHING_REQUESTED',
|
||||
SEND_EVERYTHING_SUCCEEDED = 'SEND_EVERYTHING_SUCCEEDED',
|
||||
SEND_EVERYTHING_FAILED = 'SEND_EVERYTHING_FAILED',
|
||||
|
||||
IS_CONTRACT_INTERACTION = 'IS_CONTRACT_INTERACTION',
|
||||
IS_VIEW_AND_SEND = 'IS_VIEW_AND_SEND',
|
||||
|
||||
RESET_REQUESTED = 'TRANSACTION_RESET_REQUESTED',
|
||||
RESET_SUCCESSFUL = 'TRANSACTION_RESET_SUCCESSFUL'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './actionCreators';
|
||||
export * from './constants';
|
||||
export * from './actionTypes';
|
|
@ -1,35 +0,0 @@
|
|||
import * as interfaces from './actionTypes';
|
||||
import { TypeKeys } from './constants';
|
||||
|
||||
export type TFetchTransactionData = typeof fetchTransactionData;
|
||||
export function fetchTransactionData(txhash: string): interfaces.FetchTransactionDataAction {
|
||||
return {
|
||||
type: TypeKeys.TRANSACTIONS_FETCH_TRANSACTION_DATA,
|
||||
payload: txhash
|
||||
};
|
||||
}
|
||||
|
||||
export type TSetTransactionData = typeof setTransactionData;
|
||||
export function setTransactionData(
|
||||
payload: interfaces.SetTransactionDataAction['payload']
|
||||
): interfaces.SetTransactionDataAction {
|
||||
return {
|
||||
type: TypeKeys.TRANSACTIONS_SET_TRANSACTION_DATA,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export type TResetTransactionData = typeof resetTransactionData;
|
||||
export function resetTransactionData(): interfaces.ResetTransactionDataAction {
|
||||
return { type: TypeKeys.TRANSACTIONS_RESET_TRANSACTION_DATA };
|
||||
}
|
||||
|
||||
export type TAddRecentTransaction = typeof addRecentTransaction;
|
||||
export function addRecentTransaction(
|
||||
payload: interfaces.AddRecentTransactionAction['payload']
|
||||
): interfaces.AddRecentTransactionAction {
|
||||
return {
|
||||
type: TypeKeys.TRANSACTIONS_ADD_RECENT_TRANSACTION,
|
||||
payload
|
||||
};
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
import { TypeKeys } from './constants';
|
||||
import { SavedTransaction, TransactionData, TransactionReceipt } from 'types/transactions';
|
||||
|
||||
export interface FetchTransactionDataAction {
|
||||
type: TypeKeys.TRANSACTIONS_FETCH_TRANSACTION_DATA;
|
||||
payload: string;
|
||||
}
|
||||
|
||||
export interface SetTransactionDataAction {
|
||||
type: TypeKeys.TRANSACTIONS_SET_TRANSACTION_DATA;
|
||||
payload: {
|
||||
txhash: string;
|
||||
data: TransactionData | null;
|
||||
receipt: TransactionReceipt | null;
|
||||
error: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ResetTransactionDataAction {
|
||||
type: TypeKeys.TRANSACTIONS_RESET_TRANSACTION_DATA;
|
||||
}
|
||||
|
||||
export interface AddRecentTransactionAction {
|
||||
type: TypeKeys.TRANSACTIONS_ADD_RECENT_TRANSACTION;
|
||||
payload: SavedTransaction;
|
||||
}
|
||||
|
||||
/*** Union Type ***/
|
||||
export type TransactionsAction =
|
||||
| FetchTransactionDataAction
|
||||
| SetTransactionDataAction
|
||||
| ResetTransactionDataAction
|
||||
| AddRecentTransactionAction;
|
|
@ -1,7 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
TRANSACTIONS_FETCH_TRANSACTION_DATA = 'TRANSACTIONS_FETCH_TRANSACTION_DATA',
|
||||
TRANSACTIONS_SET_TRANSACTION_DATA = 'TRANSACTIONS_SET_TRANSACTION_DATA',
|
||||
TRANSACTIONS_SET_TRANSACTION_ERROR = 'TRANSACTIONS_SET_TRANSACTION_ERROR',
|
||||
TRANSACTIONS_RESET_TRANSACTION_DATA = 'TRANSACTIONS_RESET_TRANSACTION_DATA',
|
||||
TRANSACTIONS_ADD_RECENT_TRANSACTION = 'TRANSACTIONS_ADD_RECENT_TRANSACTION'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './actionCreators';
|
||||
export * from './actionTypes';
|
||||
export * from './constants';
|
|
@ -1,156 +0,0 @@
|
|||
import { Wei, TokenValue } from 'libs/units';
|
||||
import { IWallet, WalletConfig } from 'libs/wallet';
|
||||
import { TypeKeys } from './constants';
|
||||
|
||||
/*** Unlock Private Key ***/
|
||||
export interface PrivateKeyUnlockParams {
|
||||
key: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface UnlockPrivateKeyAction {
|
||||
type: TypeKeys.WALLET_UNLOCK_PRIVATE_KEY;
|
||||
payload: PrivateKeyUnlockParams;
|
||||
}
|
||||
export interface UnlockMnemonicAction {
|
||||
type: TypeKeys.WALLET_UNLOCK_MNEMONIC;
|
||||
payload: MnemonicUnlockParams;
|
||||
}
|
||||
|
||||
export interface UnlockWeb3Action {
|
||||
type: TypeKeys.WALLET_UNLOCK_WEB3;
|
||||
}
|
||||
|
||||
/*** Set Wallet ***/
|
||||
export interface SetWalletAction {
|
||||
type: TypeKeys.WALLET_SET;
|
||||
payload: IWallet;
|
||||
}
|
||||
|
||||
/*** Reset Wallet ***/
|
||||
export interface ResetWalletAction {
|
||||
type: TypeKeys.WALLET_RESET;
|
||||
}
|
||||
|
||||
export interface SetWalletPendingAction {
|
||||
type: TypeKeys.WALLET_SET_PENDING;
|
||||
payload: boolean;
|
||||
}
|
||||
|
||||
/*** Set Balance ***/
|
||||
export interface SetBalancePendingAction {
|
||||
type: TypeKeys.WALLET_SET_BALANCE_PENDING;
|
||||
}
|
||||
export interface SetBalanceFullfilledAction {
|
||||
type: TypeKeys.WALLET_SET_BALANCE_FULFILLED;
|
||||
payload: Wei;
|
||||
}
|
||||
export interface SetBalanceRejectedAction {
|
||||
type: TypeKeys.WALLET_SET_BALANCE_REJECTED;
|
||||
}
|
||||
|
||||
/*** Set Token Balance ***/
|
||||
export interface SetTokenBalancesPendingAction {
|
||||
type: TypeKeys.WALLET_SET_TOKEN_BALANCES_PENDING;
|
||||
}
|
||||
|
||||
export interface SetTokenBalancesFulfilledAction {
|
||||
type: TypeKeys.WALLET_SET_TOKEN_BALANCES_FULFILLED;
|
||||
payload: {
|
||||
[key: string]: {
|
||||
balance: TokenValue;
|
||||
error: string | null;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface SetTokenBalancesRejectedAction {
|
||||
type: TypeKeys.WALLET_SET_TOKEN_BALANCES_REJECTED;
|
||||
}
|
||||
|
||||
export interface SetTokenBalancePendingAction {
|
||||
type: TypeKeys.WALLET_SET_TOKEN_BALANCE_PENDING;
|
||||
payload: { tokenSymbol: string };
|
||||
}
|
||||
|
||||
export interface SetTokenBalanceFulfilledAction {
|
||||
type: TypeKeys.WALLET_SET_TOKEN_BALANCE_FULFILLED;
|
||||
payload: {
|
||||
[key: string]: {
|
||||
balance: TokenValue;
|
||||
error: string | null;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface SetTokenBalanceRejectedAction {
|
||||
type: TypeKeys.WALLET_SET_TOKEN_BALANCE_REJECTED;
|
||||
}
|
||||
|
||||
export interface ScanWalletForTokensAction {
|
||||
type: TypeKeys.WALLET_SCAN_WALLET_FOR_TOKENS;
|
||||
payload: IWallet;
|
||||
}
|
||||
|
||||
export interface SetWalletTokensAction {
|
||||
type: TypeKeys.WALLET_SET_WALLET_TOKENS;
|
||||
payload: string[];
|
||||
}
|
||||
|
||||
/*** Unlock Mnemonic ***/
|
||||
export interface MnemonicUnlockParams {
|
||||
phrase: string;
|
||||
pass: string;
|
||||
path: string;
|
||||
address: string;
|
||||
}
|
||||
|
||||
/*** Unlock Keystore File ***/
|
||||
export interface KeystoreUnlockParams {
|
||||
file: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface UnlockKeystoreAction {
|
||||
type: TypeKeys.WALLET_UNLOCK_KEYSTORE;
|
||||
payload: KeystoreUnlockParams;
|
||||
}
|
||||
|
||||
export interface SetWalletConfigAction {
|
||||
type: TypeKeys.WALLET_SET_CONFIG;
|
||||
payload: WalletConfig;
|
||||
}
|
||||
|
||||
export interface SetPasswordPendingAction {
|
||||
type: TypeKeys.WALLET_SET_PASSWORD_PENDING;
|
||||
}
|
||||
|
||||
export interface RefreshAccountBalanceAction {
|
||||
type: TypeKeys.WALLET_REFRESH_ACCOUNT_BALANCE;
|
||||
}
|
||||
|
||||
export interface RefreshTokenBalancesAction {
|
||||
type: TypeKeys.WALLET_REFRESH_TOKEN_BALANCES;
|
||||
}
|
||||
|
||||
/*** Union Type ***/
|
||||
export type WalletAction =
|
||||
| UnlockPrivateKeyAction
|
||||
| SetWalletAction
|
||||
| SetWalletPendingAction
|
||||
| ResetWalletAction
|
||||
| SetBalancePendingAction
|
||||
| SetBalanceFullfilledAction
|
||||
| SetBalanceRejectedAction
|
||||
| SetTokenBalancesPendingAction
|
||||
| SetTokenBalancesFulfilledAction
|
||||
| SetTokenBalancesRejectedAction
|
||||
| SetTokenBalancePendingAction
|
||||
| SetTokenBalanceFulfilledAction
|
||||
| SetTokenBalanceRejectedAction
|
||||
| ScanWalletForTokensAction
|
||||
| SetWalletTokensAction
|
||||
| SetWalletConfigAction
|
||||
| SetPasswordPendingAction
|
||||
| RefreshAccountBalanceAction
|
||||
| RefreshTokenBalancesAction;
|
|
@ -1,25 +0,0 @@
|
|||
export enum TypeKeys {
|
||||
WALLET_UNLOCK_PRIVATE_KEY = 'WALLET_UNLOCK_PRIVATE_KEY',
|
||||
WALLET_UNLOCK_KEYSTORE = 'WALLET_UNLOCK_KEYSTORE',
|
||||
WALLET_UNLOCK_MNEMONIC = 'WALLET_UNLOCK_MNEMONIC',
|
||||
WALLET_UNLOCK_WEB3 = 'WALLET_UNLOCK_WEB3',
|
||||
WALLET_SET = 'WALLET_SET',
|
||||
WALLET_SET_BALANCE_PENDING = 'WALLET_SET_BALANCE_PENDING',
|
||||
WALLET_SET_BALANCE_FULFILLED = 'WALLET_SET_BALANCE_FULFILLED',
|
||||
WALLET_SET_BALANCE_REJECTED = 'WALLET_SET_BALANCE_REJECTED',
|
||||
WALLET_SET_TOKEN_BALANCES_PENDING = 'WALLET_SET_TOKEN_BALANCES_PENDING',
|
||||
WALLET_SET_TOKEN_BALANCES_FULFILLED = 'WALLET_SET_TOKEN_BALANCES_FULFILLED',
|
||||
WALLET_SET_TOKEN_BALANCES_REJECTED = 'WALLET_SET_TOKEN_BALANCES_REJECTED',
|
||||
WALLET_SET_PENDING = 'WALLET_SET_PENDING',
|
||||
WALLET_SET_NOT_PENDING = 'WALLET_SET_NOT_PENDING',
|
||||
WALLET_SET_TOKEN_BALANCE_PENDING = 'WALLET_SET_TOKEN_BALANCE_PENDING',
|
||||
WALLET_SET_TOKEN_BALANCE_FULFILLED = 'WALLET_SET_TOKEN_BALANCE_FULFILLED',
|
||||
WALLET_SET_TOKEN_BALANCE_REJECTED = 'WALLET_SET_TOKEN_BALANCE_REJECTED',
|
||||
WALLET_SCAN_WALLET_FOR_TOKENS = 'WALLET_SCAN_WALLET_FOR_TOKENS',
|
||||
WALLET_SET_WALLET_TOKENS = 'WALLET_SET_WALLET_TOKENS',
|
||||
WALLET_SET_CONFIG = 'WALLET_SET_CONFIG',
|
||||
WALLET_RESET = 'WALLET_RESET',
|
||||
WALLET_SET_PASSWORD_PENDING = 'WALLET_SET_PASSWORD_PENDING',
|
||||
WALLET_REFRESH_ACCOUNT_BALANCE = 'WALLET_REFRESH_ACCOUNT_BALANCE',
|
||||
WALLET_REFRESH_TOKEN_BALANCES = 'WALLET_REFRESH_TOKEN_BALANCES'
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export * from './constants';
|
||||
export * from './actionTypes';
|
||||
export * from './actionCreators';
|
|
@ -1,6 +1,7 @@
|
|||
import { checkHttpStatus, parseJSON } from './utils';
|
||||
import { Omit } from 'react-redux';
|
||||
|
||||
import { checkHttpStatus, parseJSON } from './utils';
|
||||
|
||||
const MAX_GAS_FAST = 250;
|
||||
|
||||
interface RawGasEstimates {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { handleJSONResponse } from 'api/utils';
|
||||
|
||||
interface IRateSymbols {
|
||||
symbols: {
|
||||
all: TAllSymbols;
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
import shapeshift, { SHAPESHIFT_BASE_URL } from './shapeshift';
|
||||
|
||||
describe('ShapeShift service', () => {
|
||||
beforeEach(() => {
|
||||
(global as any).fetch = jest.fn().mockImplementation(
|
||||
(url: string) =>
|
||||
new Promise(resolve => {
|
||||
const returnValues = {
|
||||
[`${SHAPESHIFT_BASE_URL}/marketinfo`]: {
|
||||
status: 200,
|
||||
json: () => [
|
||||
{
|
||||
limit: 1,
|
||||
maxLimit: 2,
|
||||
min: 1,
|
||||
minerFee: 2,
|
||||
pair: 'BTC_ETH',
|
||||
rate: '1.0'
|
||||
},
|
||||
{
|
||||
limit: 1,
|
||||
maxLimit: 2,
|
||||
min: 1,
|
||||
minerFee: 2,
|
||||
pair: 'ETH_BTC',
|
||||
rate: '1.0'
|
||||
}
|
||||
]
|
||||
},
|
||||
[`${SHAPESHIFT_BASE_URL}/getcoins`]: {
|
||||
status: 200,
|
||||
json: () => ({
|
||||
BTC: {
|
||||
name: 'Bitcoin',
|
||||
symbol: 'BTC',
|
||||
image: '',
|
||||
imageSmall: '',
|
||||
status: 'available',
|
||||
minerFee: 1
|
||||
},
|
||||
ETH: {
|
||||
name: 'Ethereum',
|
||||
symbol: 'ETH',
|
||||
image: '',
|
||||
imageSmall: '',
|
||||
status: 'available',
|
||||
minerFee: 1
|
||||
},
|
||||
XMR: {
|
||||
name: 'Monero',
|
||||
symbol: 'XMR',
|
||||
image: '',
|
||||
imageSmall: '',
|
||||
status: 'unavailable',
|
||||
minerFee: 1
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
resolve(returnValues[url]);
|
||||
})
|
||||
);
|
||||
});
|
||||
it('provides a collection of all available and unavailable coins and tokens', async done => {
|
||||
const rates = await shapeshift.getAllRates();
|
||||
|
||||
expect(rates).toEqual({
|
||||
BTCETH: {
|
||||
id: 'BTCETH',
|
||||
rate: '1.0',
|
||||
limit: 1,
|
||||
min: 1,
|
||||
options: [
|
||||
{
|
||||
id: 'BTC',
|
||||
image: '',
|
||||
name: 'Bitcoin',
|
||||
status: 'available'
|
||||
},
|
||||
{
|
||||
id: 'ETH',
|
||||
image: '',
|
||||
name: 'Ethereum',
|
||||
status: 'available'
|
||||
}
|
||||
]
|
||||
},
|
||||
ETHBTC: {
|
||||
id: 'ETHBTC',
|
||||
rate: '1.0',
|
||||
limit: 1,
|
||||
min: 1,
|
||||
options: [
|
||||
{
|
||||
id: 'ETH',
|
||||
image: '',
|
||||
name: 'Ethereum',
|
||||
status: 'available'
|
||||
},
|
||||
{
|
||||
id: 'BTC',
|
||||
image: '',
|
||||
name: 'Bitcoin',
|
||||
status: 'available'
|
||||
}
|
||||
]
|
||||
},
|
||||
__XMR: {
|
||||
id: '__XMR',
|
||||
limit: 0,
|
||||
min: 0,
|
||||
options: [
|
||||
{
|
||||
id: 'XMR',
|
||||
image: '',
|
||||
name: 'Monero',
|
||||
status: 'unavailable'
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
|
@ -1,9 +1,12 @@
|
|||
import flatten from 'lodash/flatten';
|
||||
import uniqBy from 'lodash/uniqBy';
|
||||
|
||||
import { checkHttpStatus, parseJSON } from 'api/utils';
|
||||
|
||||
const SHAPESHIFT_API_KEY =
|
||||
export const SHAPESHIFT_API_KEY =
|
||||
'8abde0f70ca69d5851702d57b10305705d7333e93263124cc2a2649dab7ff9cf86401fc8de7677e8edcd0e7f1eed5270b1b49be8806937ef95d64839e319e6d9';
|
||||
|
||||
const SHAPESHIFT_BASE_URL = 'https://shapeshift.io';
|
||||
export const SHAPESHIFT_BASE_URL = 'https://shapeshift.io';
|
||||
|
||||
export const SHAPESHIFT_TOKEN_WHITELIST = [
|
||||
'OMG',
|
||||
|
@ -26,7 +29,7 @@ export const SHAPESHIFT_TOKEN_WHITELIST = [
|
|||
'TRST',
|
||||
'GUP'
|
||||
];
|
||||
export const SHAPESHIFT_WHITELIST = [...SHAPESHIFT_TOKEN_WHITELIST, 'ETH', 'ETC', 'BTC'];
|
||||
export const SHAPESHIFT_WHITELIST = [...SHAPESHIFT_TOKEN_WHITELIST, 'ETH', 'ETC', 'BTC', 'XMR'];
|
||||
|
||||
interface IPairData {
|
||||
limit: number;
|
||||
|
@ -66,6 +69,29 @@ interface TokenMap {
|
|||
};
|
||||
}
|
||||
|
||||
interface ShapeshiftCoinInfo {
|
||||
image: string;
|
||||
imageSmall: string;
|
||||
minerFee: number;
|
||||
name: string;
|
||||
status: string;
|
||||
symbol: string;
|
||||
}
|
||||
|
||||
interface ShapeshiftCoinInfoMap {
|
||||
[id: string]: ShapeshiftCoinInfo;
|
||||
}
|
||||
|
||||
interface ShapeshiftOption {
|
||||
id?: string;
|
||||
status?: string;
|
||||
image?: string;
|
||||
}
|
||||
|
||||
interface ShapeshiftOptionMap {
|
||||
[symbol: string]: ShapeshiftOption;
|
||||
}
|
||||
|
||||
class ShapeshiftService {
|
||||
public whitelist = SHAPESHIFT_WHITELIST;
|
||||
private url = SHAPESHIFT_BASE_URL;
|
||||
|
@ -73,6 +99,8 @@ class ShapeshiftService {
|
|||
private postHeaders = {
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
private supportedCoinsAndTokens: ShapeshiftCoinInfoMap = {};
|
||||
private fetchedSupportedCoinsAndTokens = false;
|
||||
|
||||
public checkStatus(address: string) {
|
||||
return fetch(`${this.url}/txStat/${address}`)
|
||||
|
@ -118,19 +146,76 @@ class ShapeshiftService {
|
|||
|
||||
public getAllRates = async () => {
|
||||
const marketInfo = await this.getMarketInfo();
|
||||
const pairRates = await this.filterPairs(marketInfo);
|
||||
const pairRates = this.filterPairs(marketInfo);
|
||||
const checkAvl = await this.checkAvl(pairRates);
|
||||
const mappedRates = this.mapMarketInfo(checkAvl);
|
||||
return mappedRates;
|
||||
const allRates = this.addUnavailableCoinsAndTokens(mappedRates);
|
||||
|
||||
return allRates;
|
||||
};
|
||||
|
||||
public addUnavailableCoinsAndTokens = (availableCoinsAndTokens: TokenMap) => {
|
||||
if (this.fetchedSupportedCoinsAndTokens) {
|
||||
/** @desc Create a hash for efficiently checking which tokens are currently available. */
|
||||
const allOptions = flatten(
|
||||
Object.values(availableCoinsAndTokens).map(({ options }) => options)
|
||||
);
|
||||
const availableOptions: ShapeshiftOptionMap = uniqBy(allOptions, 'id').reduce(
|
||||
(prev: ShapeshiftOptionMap, next) => {
|
||||
prev[next.id] = next;
|
||||
return prev;
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
const unavailableCoinsAndTokens = this.whitelist
|
||||
.map(token => {
|
||||
/** @desc ShapeShift claims support for the token and it is available. */
|
||||
const availableCoinOrToken = availableOptions[token];
|
||||
|
||||
if (availableCoinOrToken) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @desc ShapeShift claims support for the token, but it is unavailable. */
|
||||
const supportedCoinOrToken = this.supportedCoinsAndTokens[token];
|
||||
|
||||
if (supportedCoinOrToken) {
|
||||
const { symbol: id, image, name, status } = supportedCoinOrToken;
|
||||
|
||||
return {
|
||||
/** @desc Preface the false id with '__' to differentiate from actual pairs. */
|
||||
id: `__${id}`,
|
||||
limit: 0,
|
||||
min: 0,
|
||||
options: [{ id, image, name, status }]
|
||||
};
|
||||
}
|
||||
|
||||
/** @desc We claim support for the coin or token, but ShapeShift doesn't. */
|
||||
return null;
|
||||
})
|
||||
.reduce((prev: ShapeshiftOptionMap, next) => {
|
||||
if (next) {
|
||||
prev[next.id] = next;
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
return prev;
|
||||
}, {});
|
||||
|
||||
return { ...availableCoinsAndTokens, ...unavailableCoinsAndTokens };
|
||||
}
|
||||
|
||||
return availableCoinsAndTokens;
|
||||
};
|
||||
|
||||
private filterPairs(marketInfo: ShapeshiftMarketInfo[]) {
|
||||
return marketInfo.filter(obj => {
|
||||
const { pair } = obj;
|
||||
const pairArr = pair.split('_');
|
||||
return this.whitelist.includes(pairArr[0]) && this.whitelist.includes(pairArr[1])
|
||||
? true
|
||||
: false;
|
||||
return this.whitelist.includes(pairArr[0]) && this.whitelist.includes(pairArr[1]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -165,7 +250,13 @@ class ShapeshiftService {
|
|||
private getAvlCoins() {
|
||||
return fetch(`${this.url}/getcoins`)
|
||||
.then(checkHttpStatus)
|
||||
.then(parseJSON);
|
||||
.then(parseJSON)
|
||||
.then(supportedCoinsAndTokens => {
|
||||
this.supportedCoinsAndTokens = supportedCoinsAndTokens;
|
||||
this.fetchedSupportedCoinsAndTokens = true;
|
||||
|
||||
return supportedCoinsAndTokens;
|
||||
});
|
||||
}
|
||||
|
||||
private getMarketInfo() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue