Skip to content

Instantly share code, notes, and snippets.

@austinsamsel
Last active May 5, 2021 13:50
Show Gist options
  • Save austinsamsel/699c2cb782c3a24ff621a86896959a4e to your computer and use it in GitHub Desktop.
Save austinsamsel/699c2cb782c3a24ff621a86896959a4e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const POLL_DELAY = 1000;
const machineDef = {
id: 'authorization',
initial: 'idle',
context: {
ix: undefined,
txId: undefined,
txStatus: undefined,
error: undefined,
},
states: {
idle: {},
authorizing: {
entry: 'reset',
invoke: {
src: 'fclSend',
onDone: {
target: 'sealing',
actions: 'assignTxId',
},
onError: {
target: '#error',
actions: 'assignError',
},
},
on: {
authorize: undefined,
},
},
sealing: {
invoke: {
src: 'fclOnceSealed',
onDone: {
target: 'sealed',
actions: 'assignTxStatus',
},
onError: {
target: '#error',
actions: 'assignError',
},
},
},
sealed: {},
declined: {},
error: {
id: 'error',
},
},
on: {
authorize: {
target: 'authorizing',
actions: 'assignAuthorizeData',
},
},
};
const services = {
fclSend: () => {},
fclOnceSealed: () => {},
};
const machine = Machine(machineDef,
{
actions,
services,
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment