Created
March 11, 2020 19:31
-
-
Save andrewgordstewart/c50887fa48ab4b4cd89ed8641d918739 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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
const config = { | |
key: 'virtual-defunding-as-leaf', | |
initial: 'checkChannels', | |
states: { | |
checkChannels: { | |
invoke: {src: 'checkChannelsService', onDone: 'closeTarget'}, | |
exit: {type: 'xstate.assign', assignment: (_, {data}) => data} | |
}, | |
closeTarget: { | |
initial: 'finalTargetState', | |
states: { | |
finalTargetState: { | |
invoke: {src: 'finalTargetState', onDone: 'supportState', onError: undefined} | |
}, | |
supportState: { | |
invoke: {id: undefined, src: 'supportState', data: (_, {data}) => data, onDone: 'done'} | |
}, | |
done: {type: 'final'} | |
}, | |
onDone: 'defundTarget' | |
}, | |
defundTarget: { | |
initial: 'finalJointChannelUpdate', | |
states: { | |
finalJointChannelUpdate: { | |
invoke: {src: 'finalJointChannelUpdate', onDone: 'supportState', onError: undefined} | |
}, | |
supportState: { | |
invoke: {id: undefined, src: 'supportState', data: (_, {data}) => data, onDone: 'done'} | |
}, | |
done: {type: 'final'} | |
}, | |
onDone: 'defundGuarantor', | |
exit: ['deleteTargetChannel'] | |
}, | |
defundGuarantor: { | |
initial: 'defundGuarantorInLedger', | |
states: { | |
defundGuarantorInLedger: { | |
invoke: {src: 'defundGuarantorInLedger', onDone: 'supportState', onError: undefined} | |
}, | |
supportState: { | |
invoke: {id: undefined, src: 'supportState', data: (_, {data}) => data, onDone: 'done'} | |
}, | |
done: {type: 'final'} | |
}, | |
onDone: 'success', | |
exit: ['deleteJointChannel', 'deleteGuarantorChannel'] | |
}, | |
success: {type: 'final'} | |
} | |
}; | |
const guards = {}; | |
const customActions = {}; | |
const machine = Machine(config, {guards, actions: customActions}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment