+
+ // submitAction == 'generate'
+ return buildPromise.then(resp => {
+ if (resp.status === 'fail') {
+ throw new Error(resp.msg)
+ }
+
+ const tpl = resp.data
+ const password = (tpl.signing_instructions || []).map(() => '123456')
+ const client = chainClient()
+ const body = Object.assign({}, {password, 'transaction': tpl})
+ return client.connection.request('/sign-transaction', body, true)
+ }).then(resp => {
+ if (resp.status === 'fail') {
+ throw new Error(resp.msg)
+ }
+ const id = uuid.v4()
+ dispatch({
+ type: 'GENERATED_TX_HEX',
+ generated: {
+ id: id,
+ hex: resp.data.raw_transaction,
+ },
+ })
+ dispatch(push(`/transactions/generated/${id}`))
+ })