This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #549 from LiskHQ/514-pending-transactions
Implement pending transactions in React - Closes #514
- Loading branch information
Showing
17 changed files
with
292 additions
and
70 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import actionTypes from '../constants/actions'; | ||
|
||
/** | ||
* An action to dispatch transactionAdded | ||
* | ||
*/ | ||
export const transactionAdded = data => ({ | ||
data, | ||
type: actionTypes.transactionAdded, | ||
}); | ||
|
||
/** | ||
* An action to dispatch transactionsUpdated | ||
* | ||
*/ | ||
export const transactionsUpdated = data => ({ | ||
data, | ||
type: actionTypes.transactionsUpdated, | ||
}); | ||
|
||
/** | ||
* An action to dispatch transactionsLoaded | ||
* | ||
*/ | ||
export const transactionsLoaded = data => ({ | ||
data, | ||
type: actionTypes.transactionsLoaded, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { expect } from 'chai'; | ||
import actionTypes from '../constants/actions'; | ||
import { transactionAdded, transactionsUpdated, transactionsLoaded } from './transactions'; | ||
|
||
describe('actions: transactions', () => { | ||
const data = { | ||
id: 'dummy', | ||
}; | ||
|
||
describe('transactionAdded', () => { | ||
it('should create an action to transactionAdded', () => { | ||
const expectedAction = { | ||
data, | ||
type: actionTypes.transactionAdded, | ||
}; | ||
expect(transactionAdded(data)).to.be.deep.equal(expectedAction); | ||
}); | ||
}); | ||
|
||
describe('transactionsUpdated', () => { | ||
it('should create an action to transactionsUpdated', () => { | ||
const expectedAction = { | ||
data, | ||
type: actionTypes.transactionsUpdated, | ||
}; | ||
expect(transactionsUpdated(data)).to.be.deep.equal(expectedAction); | ||
}); | ||
}); | ||
|
||
describe('errorToastDisplayed', () => { | ||
it('should create an action to transactionsLoaded', () => { | ||
const expectedAction = { | ||
data, | ||
type: actionTypes.transactionsLoaded, | ||
}; | ||
expect(transactionsLoaded(data)).to.be.deep.equal(expectedAction); | ||
}); | ||
}); | ||
}); |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import { connect } from 'react-redux'; | ||
import Transactions from './transactionsComponent'; | ||
import { transactionsLoaded } from '../../actions/transactions'; | ||
|
||
const mapStateToProps = state => ({ | ||
address: state.account.address, | ||
activePeer: state.peers.data, | ||
transactions: [...state.transactions.pending, ...state.transactions.confirmed], | ||
}); | ||
export default connect(mapStateToProps)(Transactions); | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
transactionsLoaded: data => dispatch(transactionsLoaded(data)), | ||
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(Transactions); | ||
|
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
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
Oops, something went wrong.