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 guards = { | |
channelOpen: {name: 'channelOpen', predicate: () => true, type: 'xstate.guard'}, | |
channelClosing: {name: 'channelClosing', predicate: () => true, type: 'xstate.guard'}, | |
channelClosed: {name: 'channelClosed', predicate: () => true, type: 'xstate.guard'}, | |
isDirectFunding: {name: 'isDirectFunding', predicate: () => true, type: 'xstate.guard'}, | |
amCreator: {name: 'amCreator', predicate: () => true, type: 'xstate.guard'}, | |
amJoiner: {name: 'amJoiner', predicate: () => true, type: 'xstate.guard'} | |
}; | |
const customActions = {}; | |
const config = { |
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: 'ledger-funding', | |
initial: 'acquiringLock', | |
states: { | |
acquiringLock: { | |
invoke: {src: 'acquireLock', onDone: 'fundingTarget'}, | |
exit: {type: 'xstate.assign', assignment: {lock: (_, event) => event.data}} | |
}, | |
fundingTarget: { | |
initial: 'getTargetOutcome', |
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', |
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":"create-and-direct-fund","initial":"preFundSetup","states":{"preFundSetup":{"invoke":{"id":"preFundSetup","src":"advanceChannel","data":({ channelId }) => ({ | |
channelId, | |
targetTurnNum: i | |
}),"onDone":"depositing"}},"depositing":{"initial":"getDepositingInfo","states":{"getDepositingInfo":{"invoke":{"src":"getDepositingInfo","onDone":"invokeDepositing"}},"invokeDepositing":{"invoke":{"id":undefined,"src":"invokeDepositing","data":(_, { data }) => data,"onDone":"done","autoForward":true}},"done":{"type":"final"}},"onDone":"postFundSetup"},"postFundSetup":{"invoke":{"id":"postFundSetup","src":"advanceChannel","data":({ channelId }) => ({ | |
channelId, | |
targetTurnNum: i | |
}),"onDone":"success"}},"success":{"type":"final"}}} | |
const guards = {} | |
const customActions = {} |
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: 'create-and-fund', | |
initial: 'preFundSetup', | |
on: {'xstate.error': {target: 'failure'}}, | |
states: { | |
preFundSetup: { | |
initial: 'getPreFundSetup', | |
states: { | |
getPreFundSetup: { | |
invoke: {src: 'getPreFundSetup', onDone: 'supportState', onError: undefined} |
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 = { | |
id: 'application-workflow', | |
initial: 'initializing', | |
on: {CHANNEL_UPDATED: {actions: ['sendChannelUpdatedNotification']}}, | |
states: { | |
initializing: { | |
entry: 'displayUi', | |
on: { | |
CREATE_CHANNEL: {target: 'confirmCreateChannelWorkflow', actions: ['assignChannelParams']}, | |
JOIN_CHANNEL: {target: 'confirmJoinChannelWorkflow'} |
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 = { | |
id: 'application-workflow', | |
initial: 'initializing', | |
on: {CHANNEL_UPDATED: {actions: ['sendChannelUpdatedNotification']}}, | |
states: { | |
initializing: { | |
entry: 'displayUi', | |
on: { | |
CREATE_CHANNEL: {target: 'createChannelInStore', actions: ['assignChannelParams']}, | |
JOIN_CHANNEL: {target: 'joinChannel'} |
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-leaf', | |
id: 'workflow', | |
initial: 'setupJointChannel', | |
states: { | |
setupJointChannel: { | |
initial: 'waitForFirstJointState', | |
states: { | |
waitForFirstJointState: { | |
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-as-hub', | |
id: 'workflow', | |
initial: 'setupJointChannel', | |
states: { | |
setupJointChannel: { | |
initial: 'waitForFirstJointState', | |
states: { | |
waitForFirstJointState: { | |
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 machine = Machine({ | |
id: 'stepMachine', | |
initial: 'step1', | |
on: { | |
// Accepted in step1, step2 or step3 | |
FINISH_MACHINE: 'step3' | |
}, | |
states: { | |
step1: { | |
initial: 'a', |