Skip to content

Instantly share code, notes, and snippets.

@andrewgordstewart
Created November 30, 2019 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewgordstewart/bb478f9e07520d3de15d96e273403486 to your computer and use it in GitHub Desktop.
Save andrewgordstewart/bb478f9e07520d3de15d96e273403486 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const config = {
key: 'virtual-funding-as-hub',
initial: 'createChannels',
states: {
createChannels: {
entry: 'assignChannels',
type: 'parallel',
states: {
createLeftGuarantorChannel: {
invoke: { src: 'createNullChannel', data: 'guarantorChannelArgs' },
},
createRightGuarantorChannel: {
invoke: { src: 'createNullChannel', data: 'guarantorChannelArgs' },
},
createJointChannel: {
invoke: { src: 'createNullChannel', data: 'jointChannelArgs' },
},
},
onDone: 'fundGuarantors',
},
fundGuarantors: {
type: 'parallel',
states: {
fundLeftGuarantor: {
invoke: { src: 'supportState', data: 'guarantorOutcome' },
},
fundRightGuarantor: {
invoke: { src: 'supportState', data: 'guarantorOutcome' },
},
},
onDone: 'fundTarget',
},
fundTarget: {
invoke: { src: 'supportState', data: 'jointOutcome', onDone: 'success' },
},
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