aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/redux/actions.ts
blob: 5a4099f15a7168fbe263b4314a98ed3410f0b2c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { BuyQuote } from '@0x/asset-buyer';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';

import { ActionsUnion, OrderState } from '../types';

export interface PlainAction<T extends string> {
    type: T;
}

export interface ActionWithPayload<T extends string, P> extends PlainAction<T> {
    data: P;
}

export type Action = ActionsUnion<typeof actions>;

function createAction<T extends string>(type: T): PlainAction<T>;
function createAction<T extends string, P>(type: T, data: P): ActionWithPayload<T, P>;
function createAction<T extends string, P>(type: T, data?: P): PlainAction<T> | ActionWithPayload<T, P> {
    return _.isUndefined(data) ? { type } : { type, data };
}

export enum ActionTypes {
    UPDATE_ETH_USD_PRICE = 'UPDATE_ETH_USD_PRICE',
    UPDATE_SELECTED_ASSET_AMOUNT = 'UPDATE_SELECTED_ASSET_AMOUNT',
    UPDATE_BUY_ORDER_STATE = 'UPDATE_BUY_ORDER_STATE',
    UPDATE_LATEST_BUY_QUOTE = 'UPDATE_LATEST_BUY_QUOTE',
    UPDATE_SELECTED_ASSET = 'UPDATE_SELECTED_ASSET',
    SET_QUOTE_REQUEST_STATE_PENDING = 'SET_QUOTE_REQUEST_STATE_PENDING',
    SET_QUOTE_REQUEST_STATE_FAILURE = 'SET_QUOTE_REQUEST_STATE_FAILURE',
    SET_ERROR = 'SET_ERROR',
    HIDE_ERROR = 'HIDE_ERROR',
    CLEAR_ERROR = 'CLEAR_ERROR',
    RESET_AMOUNT = 'RESET_AMOUNT',
}

export const actions = {
    updateEthUsdPrice: (price?: BigNumber) => createAction(ActionTypes.UPDATE_ETH_USD_PRICE, price),
    updateSelectedAssetAmount: (amount?: BigNumber) => createAction(ActionTypes.UPDATE_SELECTED_ASSET_AMOUNT, amount),
    updateBuyOrderState: (orderState: OrderState) => createAction(ActionTypes.UPDATE_BUY_ORDER_STATE, orderState),
    updateLatestBuyQuote: (buyQuote?: BuyQuote) => createAction(ActionTypes.UPDATE_LATEST_BUY_QUOTE, buyQuote),
    updateSelectedAsset: (assetData?: string) => createAction(ActionTypes.UPDATE_SELECTED_ASSET, assetData),
    setQuoteRequestStatePending: () => createAction(ActionTypes.SET_QUOTE_REQUEST_STATE_PENDING),
    setQuoteRequestStateFailure: () => createAction(ActionTypes.SET_QUOTE_REQUEST_STATE_FAILURE),
    setError: (error?: any) => createAction(ActionTypes.SET_ERROR, error),
    hideError: () => createAction(ActionTypes.HIDE_ERROR),
    clearError: () => createAction(ActionTypes.CLEAR_ERROR),
    resetAmount: () => createAction(ActionTypes.RESET_AMOUNT),
};
s='ls-mode'>d---------abuse178logstatsplain d---------abuse_sdl141logstatsplain d---------acm178logstatsplain d---------actx217logstatsplain d---------adgali178logstatsplain d---------adom146logstatsplain d---------adonthell178logstatsplain d---------aestats178logstatsplain d---------affenspiel109logstatsplain d---------afternoonstalker146logstatsplain d---------agame178logstatsplain d---------airrox178logstatsplain d---------alephone-data217logstatsplain d---------alephone-scenarios217logstatsplain d---------alephone217logstatsplain d---------alienarena-data146logstatsplain d---------alienarena178logstatsplain d---------alienblaster146logstatsplain d---------alienwave109logstatsplain d---------allacrost185logstatsplain d---------amoebax146logstatsplain d---------amphetamine178logstatsplain d---------an146logstatsplain d---------anagramarama178logstatsplain d---------angband178logstatsplain d---------anki231logstatsplain d---------annelid178logstatsplain d---------antipolix178logstatsplain d---------antrix146logstatsplain d---------aop178logstatsplain d---------apoolGL178logstatsplain d---------apricots178logstatsplain d---------aqbubble146logstatsplain d---------armagetron178logstatsplain d---------asc217logstatsplain d---------asciiquarium109logstatsplain d---------assaultcube178logstatsplain d---------atitd221logstatsplain d---------atlantikdesigner146logstatsplain d---------atomix185logstatsplain d---------atr3d178logstatsplain d---------atris-sounds146logstatsplain d---------atris146logstatsplain d---------avanor146logstatsplain d---------awale146logstatsplain d---------awele141logstatsplain d---------balazar178logstatsplain d---------balazarbrothers178logstatsplain d---------banihstypos141logstatsplain d---------barrage178logstatsplain d---------bass178logstatsplain d---------bastet178logstatsplain d---------battalion178logstatsplain d---------battleball141logstatsplain d---------battletanks178logstatsplain d---------belooted146logstatsplain d---------bfm178logstatsplain d---------biloba146logstatsplain d---------biniax2178logstatsplain d---------biorythm109logstatsplain d---------bitefusion141logstatsplain d---------blackjack141logstatsplain d---------blackshadeselite217logstatsplain d---------blinkensisters146logstatsplain d---------blobby178logstatsplain d---------bloboats178logstatsplain d---------block178logstatsplain d---------blockade141logstatsplain d---------blockout178logstatsplain d---------blokish141logstatsplain d---------bloodfrontier141logstatsplain d---------blue146logstatsplain d---------bogged141logstatsplain d---------bomb178logstatsplain d---------bomberclone178logstatsplain d---------bomberinstinct178logstatsplain d---------bombermaze178logstatsplain d---------bomns146logstatsplain d---------boswars178logstatsplain d---------braincurses146logstatsplain d---------brainparty178logstatsplain d---------brainworkshop178logstatsplain d---------brickshooter146logstatsplain d---------brikx146logstatsplain d---------briquolo146logstatsplain d---------brutalchess178logstatsplain d---------bs109logstatsplain d---------bsdgames178logstatsplain d---------bsdrain109logstatsplain d---------bsdtris178logstatsplain d---------bsp146logstatsplain d---------bubbros178logstatsplain d---------bugsquish178logstatsplain d---------bugsx141logstatsplain d---------bumprace146logstatsplain d---------burgerspace146logstatsplain d---------burrtools141logstatsplain d---------bygfoot178logstatsplain d---------bzflag178logstatsplain d---------cake180logstatsplain d---------cardpics146logstatsplain d---------cave9178logstatsplain d---------cavezofphear146logstatsplain d---------cchess146logstatsplain d---------ceferino146logstatsplain d---------cgoban141logstatsplain d---------cgoban2109logstatsplain d---------chanta178logstatsplain d---------chapping146logstatsplain d---------cheech146logstatsplain d---------childsplay178logstatsplain d---------childsplay_plugins178logstatsplain d---------chroma146logstatsplain d---------chromium-bsu146logstatsplain d---------circuslinux178logstatsplain d---------cleanq3178logstatsplain d---------columns178logstatsplain d---------concentration178logstatsplain d---------connect4178logstatsplain d---------connectfive178logstatsplain d---------conquest256logstatsplain d---------construo146logstatsplain d---------corewars178logstatsplain d---------cosmo178logstatsplain d---------cosmosmash146logstatsplain d---------cowsay178logstatsplain d---------crack-attack146logstatsplain d---------crafty-open-enormous178logstatsplain d---------crafty-open-large178logstatsplain d---------crafty-open-medium178logstatsplain d---------crafty-tablebase-no-pawn219logstatsplain d---------crafty-tablebase-pawn219logstatsplain d---------crafty251logstatsplain d---------cre178logstatsplain d---------crimson146logstatsplain d---------criticalmass141logstatsplain d---------critterding146logstatsplain d---------crossfire-client141logstatsplain d---------crossfire-server178logstatsplain d---------crrcsim178logstatsplain d---------cryptoslam109logstatsplain d---------csmash178logstatsplain d---------ctris109logstatsplain d---------cube178logstatsplain d---------cultivation178logstatsplain d---------cursive141logstatsplain d---------cuyo146logstatsplain d---------d2x-xl178logstatsplain d---------d2x180logstatsplain d---------daimonin-client178logstatsplain d---------daimonin178logstatsplain d---------dangen146logstatsplain d---------dangerdeep-data109logstatsplain d---------dangerdeep141logstatsplain d---------darkplaces141logstatsplain d---------deal141logstatsplain d---------defendguin141logstatsplain d---------demonquake180logstatsplain d---------deng146logstatsplain d---------diameter146logstatsplain d---------digger-vgl178logstatsplain d---------djgame2178logstatsplain d---------dmjava146logstatsplain d---------dodgindiamond2217logstatsplain d---------dontspace146logstatsplain d---------doom-data222logstatsplain d---------doom-freedoom109logstatsplain d---------doom-hacx109logstatsplain d---------doom-hr180logstatsplain d---------doom-hr2109logstatsplain d---------doom-wolfendoom146logstatsplain d---------doom178logstatsplain d---------doomlegacy178logstatsplain d---------dopewars146logstatsplain d---------drm178logstatsplain d---------dsnake178logstatsplain d---------duel178logstatsplain d---------duke3d-data222logstatsplain d---------dungeon178logstatsplain d---------dungeoncrawl141logstatsplain d---------easysok146logstatsplain d---------eboard217logstatsplain d---------edge178logstatsplain d---------editss178logstatsplain d---------eduke32178logstatsplain d---------egl178logstatsplain d---------egoboo217logstatsplain d---------eif146logstatsplain d---------eights141logstatsplain d---------einstein217logstatsplain d---------el-data109logstatsplain d---------el141logstatsplain d---------ember178logstatsplain d---------empire141logstatsplain d---------endgame-singularity-music146logstatsplain d---------endgame-singularity146logstatsplain d---------enigma178logstatsplain d---------ensemblist141logstatsplain d---------enygma178logstatsplain d---------etracer146logstatsplain d---------etuxracer178logstatsplain d---------euchre141logstatsplain d---------evilfinder178logstatsplain d---------evq3178logstatsplain d---------excido178logstatsplain d---------exhaust-doc146logstatsplain d---------exhaust-ma180logstatsplain d---------exhaust180logstatsplain d---------exmars178logstatsplain d---------exult178logstatsplain d---------ezquake178logstatsplain d---------f1spirit-remake178logstatsplain d---------falconseye178logstatsplain d---------farblazer178logstatsplain d---------fargoal178logstatsplain d---------fgkicker185logstatsplain d---------fgrun178logstatsplain d---------fillets-ng146logstatsplain d---------filters178logstatsplain d---------fishsupper146logstatsplain d---------fkiss109logstatsplain d---------flightgear-aircraft109logstatsplain d---------flightgear-aircrafts109logstatsplain d---------flightgear-atlas185logstatsplain d---------flightgear-data109logstatsplain d---------flightgear-mb339-pan109logstatsplain d---------flightgear185logstatsplain d---------flobopuyo178logstatsplain d---------flyhard146logstatsplain d---------flying141logstatsplain d---------fmars178logstatsplain d---------foobillard178logstatsplain d---------formido217logstatsplain d---------fortunate146logstatsplain d---------fotaq185logstatsplain d---------freebsd-carddeck-kde4142logstatsplain d---------freecell-solver178logstatsplain d---------freeciv-nox1136logstatsplain d---------freeciv-sounds146logstatsplain d---------freeciv189logstatsplain d---------freecol141logstatsplain d---------freedink-data178logstatsplain d---------freedink-dfarc178logstatsplain d---------freedink-engine146logstatsplain d---------freedink109logstatsplain d---------freedoko146logstatsplain d---------freedroid146logstatsplain d---------freedroidrpg146logstatsplain d---------freeorion178logstatsplain d---------freera178logstatsplain d---------freesci146logstatsplain d---------freesweep178logstatsplain d---------freesynd178logstatsplain d---------freetennis141logstatsplain d---------fretsonfire-data146logstatsplain d---------fretsonfire178logstatsplain d---------frikqcc141logstatsplain d---------frotz146logstatsplain d---------frozenbubble217logstatsplain d---------fteqw141logstatsplain d---------ftjava178logstatsplain d---------fuhquake178logstatsplain d---------funnyboat178logstatsplain d---------fxsudoku141logstatsplain d---------galaxis109logstatsplain d---------galaxyhack178logstatsplain d---------galaxymage178logstatsplain d---------garith109logstatsplain d---------gbottler146logstatsplain d---------gbrainy146logstatsplain d---------gcompris178logstatsplain d---------gdado178logstatsplain d---------geki2146logstatsplain d---------geki3146logstatsplain d---------gemdropx178logstatsplain d---------gemrb217logstatsplain d---------ggz-client-libs178logstatsplain d---------ggz-gtk-client146logstatsplain d---------ggz-gtk-games146logstatsplain d---------ggz-kde-client178logstatsplain d---------ggz-sdl-games178logstatsplain d---------ggz-txt-client178logstatsplain d---------gillo178logstatsplain d---------gish-demo178logstatsplain d---------gl-117178logstatsplain d---------glasteroids178logstatsplain d---------glaxium178logstatsplain d---------glbsp178logstatsplain d---------glchess185logstatsplain d---------glest-data109logstatsplain d---------glest178logstatsplain d---------glife146logstatsplain d---------glmaze178logstatsplain d---------glob2217logstatsplain d---------glsfcave109logstatsplain d---------gltron178logstatsplain d---------gma178logstatsplain d---------gmastermind178logstatsplain d---------gmines146logstatsplain d---------gnarr178logstatsplain d---------gnmm178logstatsplain d---------gno3dtet178logstatsplain d---------gnome-games-extra-data146logstatsplain d---------gnome-games185logstatsplain d---------gnomeattacks178logstatsplain d---------gnomebreakout178logstatsplain d---------gnomechess178logstatsplain d---------gnomekiss178logstatsplain d---------gnomememoryblocks178logstatsplain d---------gnomermind146logstatsplain d---------gnomesudoku146logstatsplain d---------gnono146logstatsplain d---------gnubg178logstatsplain d---------gnuchess175logstatsplain d---------gnudoku146logstatsplain d---------gnugo141logstatsplain d---------gnurobbo178logstatsplain d---------gnurobots185logstatsplain d---------gnushogi221logstatsplain d---------gnustep-ladder178logstatsplain d---------gnustep-sudoku146logstatsplain d---------golddig178logstatsplain d---------gomoku.app146logstatsplain d---------gondola178logstatsplain d---------goonies178logstatsplain d---------gracer178logstatsplain d---------grande178logstatsplain d---------greed141logstatsplain d---------gretools146logstatsplain d---------grhino178logstatsplain d---------gridlock146logstatsplain d---------gru146logstatsplain d---------grubik146logstatsplain d---------grubinvaders178logstatsplain d---------gshisen146logstatsplain d---------gtetrinet178logstatsplain d---------gtkabale178logstatsplain d---------gtkatlantic178logstatsplain d---------gtkballs178logstatsplain d---------gtklife109logstatsplain d---------gtkpool178logstatsplain d---------gtkradiant178logstatsplain d---------gtktetcolor146logstatsplain d---------gturing178logstatsplain d---------gtypist146logstatsplain d---------gunfudeadlands141logstatsplain d---------gweled217logstatsplain d---------hangman178logstatsplain d---------hedgewars146logstatsplain d---------heretic178logstatsplain d---------heroes178logstatsplain d---------hex-a-hop178logstatsplain d---------hex178logstatsplain d---------hexalate146logstatsplain d---------hexxagon146logstatsplain d---------highmoon146logstatsplain d---------hinversi146logstatsplain d---------hllib109logstatsplain d---------hlstats146logstatsplain d---------hlstatsx146logstatsplain d---------hohlin178logstatsplain d---------holotz-castle178logstatsplain d---------icbm3d178logstatsplain d---------icebreaker178logstatsplain d---------ifm146logstatsplain d---------imaze178logstatsplain d---------inform178logstatsplain d---------intensityengine178logstatsplain d---------interlogic109logstatsplain d---------ioquake3-devel148logstatsplain d---------ioquake3217logstatsplain d---------iourbanterror217logstatsplain d---------irrlamb178logstatsplain d---------ishido146logstatsplain d---------ivan217logstatsplain d---------jag146logstatsplain d---------jaggedalliance2178logstatsplain d---------jchessboard109logstatsplain d---------jetpack178logstatsplain d---------jfduke3d146logstatsplain d---------jfk178logstatsplain d---------jfsw178logstatsplain d---------jigsaw146logstatsplain d---------jigzo178logstatsplain d---------jin178logstatsplain d---------joequake217logstatsplain d---------jools178logstatsplain d---------jtans178logstatsplain d---------jvgs178logstatsplain d---------jzip178logstatsplain d---------kaid178logstatsplain d---------kamikaze146logstatsplain d---------kanatest146logstatsplain d---------kardsgt146logstatsplain d---------kartofel178logstatsplain d---------kbilliards146logstatsplain d---------kcheckers141logstatsplain d---------kdegames3178logstatsplain d---------kdegames4146logstatsplain d---------kevedit178logstatsplain d---------kfreerings178logstatsplain d---------kiki178logstatsplain d---------kimboot178logstatsplain d---------klavaro146logstatsplain d---------klondike146logstatsplain d---------kmastermind146logstatsplain d---------kmquake2178logstatsplain d---------knights-kde4146logstatsplain d---------knights178logstatsplain d---------kobodeluxe146logstatsplain d---------koth141logstatsplain d---------kpicframer178logstatsplain d---------kpictorial146logstatsplain d---------kpuzzle178logstatsplain d---------krosswordplayer178logstatsplain d---------kslide178logstatsplain d---------ksudoku178logstatsplain d---------ktritoc178logstatsplain d---------kuklomenos146logstatsplain d---------kwappen178logstatsplain d---------ladder178logstatsplain d---------lander146logstatsplain d---------lapispuzzle146logstatsplain d---------latrine178logstatsplain d---------lbreakout178logstatsplain d---------lbreakout2185logstatsplain d---------ldmud258logstatsplain d---------legends146logstatsplain d---------legesmotus178logstatsplain d---------lexter185logstatsplain d---------lgeneral-data178logstatsplain d---------lgeneral178logstatsplain d---------lianliankan178logstatsplain d---------libdungeonmaker178logstatsplain d---------libfov146logstatsplain d---------libggz216logstatsplain d---------libmaitretarot146logstatsplain d---------libmt_client146logstatsplain d---------libshhcards178logstatsplain d---------lincity-ng178logstatsplain d---------lincity146logstatsplain d---------linux-americasarmy146logstatsplain d---------linux-candycruncher-demo178logstatsplain d---------linux-coldwar-demo178logstatsplain d---------linux-darwinia-demo217logstatsplain d---------linux-defcon217logstatsplain d---------linux-doom3-demo178logstatsplain d---------linux-doom3178logstatsplain d---------linux-enemyterritory-etpro146logstatsplain d---------linux-enemyterritory-etpub146logstatsplain d---------linux-enemyterritory-fortress146logstatsplain d---------linux-enemyterritory-jaymod-21146logstatsplain d---------linux-enemyterritory-jaymod146logstatsplain d---------linux-enemyterritory-omni-bot-0660146logstatsplain d---------linux-enemyterritory-omni-bot146logstatsplain d---------linux-enemyterritory-shrub109logstatsplain d---------linux-enemyterritory-tce146logstatsplain d---------linux-enemyterritory178logstatsplain d---------linux-etqw-demo-server178logstatsplain d---------linux-etqw-server178logstatsplain d---------linux-gorky17-demo178logstatsplain d---------linux-hdb-demo178logstatsplain d---------linux-majesty-demo178logstatsplain d---------linux-nerogame178logstatsplain d---------linux-ningpo-demo178logstatsplain d---------linux-nwnclient178logstatsplain d---------linux-nwserver178logstatsplain d---------linux-quake3-demo178logstatsplain d---------linux-quake3146logstatsplain d---------linux-quake4-demo178logstatsplain d---------linux-quake4178logstatsplain d---------linux-savage-samuraiwars217logstatsplain d---------linux-savage217logstatsplain d---------linux-skulltag178logstatsplain d---------linux-sof178logstatsplain d---------linux-spheresofchaos-demo146logstatsplain d---------linux-ssamtfe178logstatsplain d---------linux-ssamtse178logstatsplain d---------linux-steam178logstatsplain d---------linux-unrealgold178logstatsplain d---------linux-uplink-demo217logstatsplain d---------linux-ut217logstatsplain d---------linux-ut2003-demo141logstatsplain d---------linux-ut2004-demo141logstatsplain d---------linux-virtual-jay-peak178logstatsplain d---------linux-warsow178logstatsplain d---------linux-worldofgoo-demo146logstatsplain d---------linwarrior178logstatsplain d---------liquidwar178logstatsplain d---------lm-solve146logstatsplain d---------lmarbles146logstatsplain d---------lmpc141logstatsplain d---------lordsawar178logstatsplain d---------lpairs178logstatsplain d---------ltris146logstatsplain d---------lucidlife146logstatsplain d---------luola146logstatsplain d---------macopix146logstatsplain d---------madbomber146logstatsplain d---------maelstrom178logstatsplain d---------magiccube4d178logstatsplain d---------magicor146logstatsplain d---------mahjong109logstatsplain d---------maitretarot109logstatsplain d---------mangband178logstatsplain d---------mangos178logstatsplain d---------marsnomercy141logstatsplain d---------masterserver178logstatsplain d---------maxr146logstatsplain d---------memonix141logstatsplain d---------meqcc178logstatsplain d---------meritous178logstatsplain d---------merlin178logstatsplain d---------mindfocus178logstatsplain d---------mindguard178logstatsplain d---------mirrormagic178logstatsplain d---------miscom178logstatsplain d---------mkgichessclub178logstatsplain d---------mkhexgrid141logstatsplain d---------monkeybubble178logstatsplain d---------monopd146logstatsplain d---------monster-masher178logstatsplain d---------monsterz178logstatsplain d---------moon-buggy141logstatsplain d---------moonlander178logstatsplain d---------moria178logstatsplain d---------mt_dolphin_ia109logstatsplain d---------mt_gtk_client146logstatsplain d---------mtaserver178logstatsplain d---------mudmagic146logstatsplain d---------mvdsv148logstatsplain d---------nInvaders146logstatsplain d---------nadar178logstatsplain d---------naev-data109logstatsplain d---------naev141logstatsplain d---------nazghul178logstatsplain d---------nehquake178logstatsplain d---------nethack32178logstatsplain d---------nethack33-gnome36logstatsplain d---------nethack33-nox1136logstatsplain d---------nethack33178logstatsplain d---------nethack34-gnome36logstatsplain d---------nethack34-nox1136logstatsplain