This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Use trace API for decentralized transaction list #2784
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
31e4fa6
Using traces when available to get accounts transactions (#2148)
ngotchac 7fc3f0b
Fixed traceMode detection and transactions rendering (#2148)
ngotchac 864a82b
[WIP] Use Redux Thunk in main UI => Async Actions (#2148)
ngotchac dee5c8c
Merge branch 'master' into ng-decentralized-txs
ngotchac 4645359
Using Redux for Transaction / Block / Methods... (#2148)
ngotchac 1b5945b
Use BigNumber comparedTo function to sort txs (#2148)
ngotchac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
export function setApi (api) { | ||
return { | ||
type: 'setApi', | ||
api | ||
}; | ||
} |
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,26 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import { handleActions } from 'redux-actions'; | ||
|
||
const initialState = {}; | ||
|
||
export default handleActions({ | ||
setApi (state, action) { | ||
const { api } = action; | ||
return api; | ||
} | ||
}, initialState); |
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,128 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import Contracts from '../../contracts'; | ||
|
||
export function setBlock (blockNumber, block) { | ||
return { | ||
type: 'setBlock', | ||
blockNumber, block | ||
}; | ||
} | ||
|
||
export function setTransaction (txHash, info) { | ||
return { | ||
type: 'setTransaction', | ||
txHash, info | ||
}; | ||
} | ||
|
||
export function setBytecode (address, bytecode) { | ||
return { | ||
type: 'setBytecode', | ||
address, bytecode | ||
}; | ||
} | ||
|
||
export function setMethod (signature, method) { | ||
return { | ||
type: 'setMethod', | ||
signature, method | ||
}; | ||
} | ||
|
||
export function fetchBlock (blockNumber) { | ||
return (dispatch, getState) => { | ||
const { blocks } = getState().blockchain; | ||
|
||
if (blocks[blockNumber.toString()]) { | ||
return; | ||
} | ||
|
||
const { api } = getState(); | ||
|
||
api.eth | ||
.getBlockByNumber(blockNumber) | ||
.then(block => { | ||
dispatch(setBlock(blockNumber, block)); | ||
}) | ||
.catch(e => { | ||
console.error('blockchain::fetchBlock', e); | ||
}); | ||
}; | ||
} | ||
|
||
export function fetchTransaction (txHash) { | ||
return (dispatch, getState) => { | ||
const { transactions } = getState().blockchain; | ||
|
||
if (transactions[txHash]) { | ||
return; | ||
} | ||
|
||
const { api } = getState(); | ||
|
||
api.eth | ||
.getTransactionByHash(txHash) | ||
.then(info => { | ||
dispatch(setTransaction(txHash, info)); | ||
}) | ||
.catch(e => { | ||
console.error('blockchain::fetchTransaction', e); | ||
}); | ||
}; | ||
} | ||
|
||
export function fetchBytecode (address) { | ||
return (dispatch, getState) => { | ||
const { bytecodes } = getState().blockchain; | ||
|
||
if (bytecodes[address]) { | ||
return; | ||
} | ||
|
||
const { api } = getState(); | ||
|
||
api.eth | ||
.getCode(address) | ||
.then(code => { | ||
dispatch(setBytecode(address, code)); | ||
}) | ||
.catch(e => { | ||
console.error('blockchain::fetchBytecode', e); | ||
}); | ||
}; | ||
} | ||
|
||
export function fetchMethod (signature) { | ||
return (dispatch, getState) => { | ||
const { methods } = getState().blockchain; | ||
|
||
if (methods[signature]) { | ||
return; | ||
} | ||
|
||
Contracts | ||
.get() | ||
.signatureReg.lookup(signature) | ||
.then(method => { | ||
dispatch(setMethod(signature, method)); | ||
}) | ||
.catch(e => { | ||
console.error('blockchain::fetchMethod', e); | ||
}); | ||
}; | ||
} |
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,66 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import { handleActions } from 'redux-actions'; | ||
|
||
const initialState = { | ||
blocks: {}, | ||
transactions: {}, | ||
bytecodes: {}, | ||
methods: {} | ||
}; | ||
|
||
export default handleActions({ | ||
setBlock (state, action) { | ||
const { blockNumber, block } = action; | ||
|
||
const blocks = Object.assign({}, state.blocks, { | ||
[blockNumber.toString()]: block | ||
}); | ||
|
||
return Object.assign({}, state, { blocks }); | ||
}, | ||
|
||
setTransaction (state, action) { | ||
const { txHash, info } = action; | ||
|
||
const transactions = Object.assign({}, state.transactions, { | ||
[txHash]: info | ||
}); | ||
|
||
return Object.assign({}, state, { transactions }); | ||
}, | ||
|
||
setBytecode (state, action) { | ||
const { address, bytecode } = action; | ||
|
||
const bytecodes = Object.assign({}, state.bytecodes, { | ||
[address]: bytecode | ||
}); | ||
|
||
return Object.assign({}, state, { bytecodes }); | ||
}, | ||
|
||
setMethod (state, action) { | ||
const { signature, method } = action; | ||
|
||
const methods = Object.assign({}, state.methods, { | ||
[signature]: method | ||
}); | ||
|
||
return Object.assign({}, state, { methods }); | ||
} | ||
}, initialState); |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently miners mine 0 tx's in a block on purpose, not sure this is correct...