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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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 toggleMachine = Machine( | |
{ | |
id: 'toggle', | |
initial: 'inactive', | |
states: { | |
inactive: { | |
on: { TOGGLE: 'active' } | |
}, | |
active: { | |
// The 'beeping' activity will take place as long as |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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-funding', | |
initial: 'preparation', | |
states: { | |
preparation: { | |
type: 'parallel', | |
states: { | |
prepareJointChannel: { | |
initial: 'waitForProtocol', | |
states: { |
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-fund-as-hub', | |
initial: 'preFundSetup', | |
states: { | |
preFundSetup: { | |
initial: 'preFundData', | |
states: { | |
preFundData: { invoke: { src: 'preFundData', onDone: 'advanceChannel' } }, | |
advanceChannel: { | |
invoke: { |
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-fund-as-leaf', | |
initial: 'preFundSetup', | |
states: { | |
preFundSetup: { | |
initial: 'preFundData', | |
states: { | |
preFundData: { invoke: { src: 'preFundData', onDone: 'advanceChannel' } }, | |
advanceChannel: { | |
invoke: { |
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-funding', | |
initial: 'preFundSetup', | |
states: { | |
preFundSetup: { | |
invoke: { | |
id: 'preFundSetup', | |
src: 'advanceChannel', | |
data: ({ targetChannelId }) => ({ | |
channelId: targetChannelId, |
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-fund-as-leaf', | |
initial: 'createChannels', | |
states: { | |
createChannels: { | |
type: 'parallel', | |
states: { | |
createGuarantorChannel: { | |
initial: 'guarantorChannelArgs', | |
states: { |
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-funding-as-hub', | |
initial: 'createChannels', | |
states: { | |
createChannels: { | |
type: 'parallel', | |
states: { | |
createLeftGuarantorChannel: { | |
initial: 'leftGuarantorArgs', | |
states: { |
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 machineB = Machine({ | |
initial: 'ready', | |
states: { | |
ready: { entry: sendParent({ type: 'CLICK', from: 'machineB' }) }, | |
}, | |
}); | |
const machineC = Machine({ | |
initial: 'ready', | |
states: { |