Refactoring Transfer Modal (#3705)

* Better Token Select in Transfer > Details

* Better Autocomplete

* Crete MobX store for Transfer modal

* Remove unused var

* Update Webpack Conf

* Small changes...

* Optional gas in MethodDecoding + better input

* New Contract `getAll` method // TxList Row component

* Method Decoding selections

* Rename `getAll` to `getAllLogs`
This commit is contained in:
Nicolas Gotchac
2016-12-02 15:21:01 +01:00
committed by Jaco Greeff
parent bd2e2b630c
commit c892a4f7ae
18 changed files with 865 additions and 642 deletions

View File

@@ -240,9 +240,29 @@ export default class Contract {
return this.unsubscribe(subscriptionId);
};
event.getAllLogs = (options = {}) => {
return this.getAllLogs(event);
};
return event;
}
getAllLogs (event, _options) {
// Options as first parameter
if (!_options && event && event.topics) {
return this.getAllLogs(null, event);
}
const options = this._getFilterOptions(event, _options);
return this._api.eth
.getLogs({
fromBlock: 0,
toBlock: 'latest',
...options
})
.then((logs) => this.parseEventLogs(logs));
}
_findEvent (eventName = null) {
const event = eventName
? this._events.find((evt) => evt.name === eventName)
@@ -256,7 +276,7 @@ export default class Contract {
return event;
}
_createEthFilter (event = null, _options) {
_getFilterOptions (event = null, _options = {}) {
const optionTopics = _options.topics || [];
const signature = event && event.signature || null;
@@ -271,6 +291,11 @@ export default class Contract {
topics
});
return options;
}
_createEthFilter (event = null, _options) {
const options = this._getFilterOptions(event, _options);
return this._api.eth.newFilter(options);
}

View File

@@ -146,7 +146,8 @@ export default class Eth {
getLogs (options) {
return this._transport
.execute('eth_getLogs', inFilter(options));
.execute('eth_getLogs', inFilter(options))
.then((logs) => logs.map(outLog));
}
getLogsEx (options) {

View File

@@ -32,6 +32,10 @@ export function hex2Ascii (_hex) {
return str;
}
export function bytesToAscii (bytes) {
return bytes.map((b) => String.fromCharCode(b % 512)).join('');
}
export function asciiToHex (string) {
return '0x' + string.split('').map((s) => s.charCodeAt(0).toString(16)).join('');
}