Skip to content

Instantly share code, notes, and snippets.

@briandipalma briandipalma/machine.js
Last active Aug 12, 2019

Embed
What would you like to do?
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const blockTradesMachine = Machine({
id: 'BlockTrades',
initial: 'Initial',
states: {
Initial: {
on: {
Submit: "Submitted"
}
},
Submitted: {
on: {
ClientClose: "ClientCloseSent",
SumbitAck: "Queued"
}
},
Queued: {
on: {
ClientClose: "ClientCloseSent",
Expire: "Expired",
PickUp: "PickedUp"
}
},
ClientCloseSent: {
on: {
ClientCloseAck: "ClientClosed"
}
},
PickedUp: {
on: {
Hold: "Queued",
PriceUpdate: "Executable",
ClientClose: "ClientCloseSent"
}
},
Executable: {
on: {
Withdraw: "PickedUp",
PriceUpdate: "Executable",
Expire: "Expired",
Execute: "ExecuteSent",
ClientClose: "ClientCloseSent"
}
},
ExecuteSent: {
on: {
PriceUpdate: "ExecuteSent",
ExecuteAck: "Executed",
Warning: "WarningSent"
}
},
WarningSent: {
on: {
RejectWarning: "Executable",
AcceptWarning: "AcceptWarningSent",
ClientClose: "ClientCloseSent"
}
},
AcceptWarningSent: {
on: {
AcceptWarningAck: "Executed"
}
},
Executed: {
on: {
Expire: "Expired",
TradeConfirmation: "TradeConfirmed"
}
},
ClientClosed: {type: "final"},
TradeConfirmed: {type: "final"},
Expired: {type: "final"}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.