UNPKG

dagcoin-wallet-workflows

Version:

Dagcoin wallet workflows implementation using Dagcoin Finite State Machine

25 lines (18 loc) 826 B
"use strict"; module.exports = function (properties, stateMachine, state) { var DataFetcher = require('dagcoin-fsm/lib/dataFetcher'); var fetcher = new DataFetcher(properties, stateMachine, state); fetcher.retrieveData = function () { return properties.fundingExchangeClientService.getByteOrigin().then(function (sharedAddress) { if (sharedAddress) { stateMachine.setData('shared-address', sharedAddress); stateMachine.setData('update-payment-props', true); return Promise.resolve(true); } var errorCodes = require('../../errorCodes'); stateMachine.setData('send-payment-error', errorCodes.SHARED_ADDRESS_NOT_PRESENT); return Promise.resolve(false); }); }; return fetcher; };