Created
June 15, 2020 17:05
-
-
Save andrewgordstewart/f94898d6d9f023ea313d50a3e0f660d4 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 wireMachine = Machine({ | |
initial: 'setup', | |
invoke: {src: 'watcher'}, | |
states: { | |
setup: {invoke: {src: 'createPaymentChannel', onDone: 'uploading'}, exit: 'sendSpacerState'}, | |
uploading: { | |
initial: 'unblocked', | |
on: {DONE: 'refunding'}, | |
states: { | |
unblocked: { | |
entry: 'popFromBlockedRequests', | |
on: { | |
REQUEST: [ | |
{target: 'blocked', cond: 'insufficientFunds'}, | |
{target: 'unblocked', actions: 'upload'} | |
] | |
} | |
}, | |
blocked: { | |
entry: 'blockPeer', | |
on: {PAYMENT: {target: 'unblocked', cond: 'sufficientFunds'}} | |
} | |
} | |
}, | |
refunding: {invoke: {src: 'refund', onDone: 'closing'}}, | |
closing: {invoke: {src: 'closeChannel', onDone: 'done'}}, | |
done: {type: 'final'} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment