Last active
May 13, 2021 15:43
-
-
Save misu200/8ac8ddfbe1b70666b74ea56033a174d9 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions | |
| // - XState (all XState exports) | |
| const fetchMachine = Machine({ | |
| initial: 'idle', | |
| context: { | |
| status:0, | |
| token: 0, | |
| addLiquidityETH:null, | |
| buyingTx:null, | |
| sellingTx:null | |
| }, | |
| states: { | |
| idle: { | |
| on: { | |
| BUY: 'buy_order_pending' | |
| } | |
| }, | |
| buy_order_pending: { | |
| on: { | |
| MINED: 'trading_engine', | |
| FAILED: 'fail' | |
| } | |
| }, | |
| trading_engine:{ | |
| on:{ | |
| BUY_ORDER_PENDING:'trading_engine', | |
| BUY_ORDER_MINED:'trading_engine', | |
| SELL_ORDER_PENDING:'trading_engine', | |
| SELL_ORDER_MINED:'trading_engine', | |
| REMOVE_LIQUIDITY_PENDING:'trading_engine', | |
| REMOVE_LIQUIDITY_MINED:'trading_engine', | |
| MY_SELL_PENDING:'trading_engine', | |
| MY_SELL_FRONTENDED_IN_PENDING:'trading_engine', | |
| MY_SELL_REPLACED_IN_PENDING:'trading_engine', | |
| MY_SELL_GAS_WAR_GIVING_UP:'trading_engine', | |
| MY_SELL_COMPLETED:'compute_money_result', | |
| MY_SELL_FAILED:'fail' | |
| } | |
| }, | |
| compute_money_result:{ | |
| on:{ | |
| WIN:'success', | |
| LOST:'fail' | |
| } | |
| }, | |
| success: { | |
| type: 'final' | |
| }, | |
| fail: { | |
| type: 'final' | |
| } | |
| } | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment