Rename variables
This commit is contained in:
@@ -36,9 +36,9 @@ export class ExchangeWrapper {
|
||||
const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
|
||||
tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
|
||||
tx.logs = _.map(tx.logs, log => {
|
||||
const decodedLog = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(decodedLog);
|
||||
return decodedLog;
|
||||
const logWithDecodedArgs = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(logWithDecodedArgs);
|
||||
return logWithDecodedArgs;
|
||||
});
|
||||
return tx;
|
||||
}
|
||||
@@ -57,9 +57,9 @@ export class ExchangeWrapper {
|
||||
const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
|
||||
tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
|
||||
tx.logs = _.map(tx.logs, log => {
|
||||
const decodedLog = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(decodedLog);
|
||||
return decodedLog;
|
||||
const logWithDecodedArgs = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(logWithDecodedArgs);
|
||||
return logWithDecodedArgs;
|
||||
});
|
||||
return tx;
|
||||
}
|
||||
@@ -81,9 +81,9 @@ export class ExchangeWrapper {
|
||||
const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
|
||||
tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
|
||||
tx.logs = _.map(tx.logs, log => {
|
||||
const decodedLog = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(decodedLog);
|
||||
return decodedLog;
|
||||
const logWithDecodedArgs = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(logWithDecodedArgs);
|
||||
return logWithDecodedArgs;
|
||||
});
|
||||
return tx;
|
||||
}
|
||||
@@ -105,9 +105,9 @@ export class ExchangeWrapper {
|
||||
const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
|
||||
tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
|
||||
tx.logs = _.map(tx.logs, log => {
|
||||
const decodedLog = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(decodedLog);
|
||||
return decodedLog;
|
||||
const logWithDecodedArgs = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(logWithDecodedArgs);
|
||||
return logWithDecodedArgs;
|
||||
});
|
||||
return tx;
|
||||
}
|
||||
@@ -129,9 +129,9 @@ export class ExchangeWrapper {
|
||||
const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
|
||||
tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
|
||||
tx.logs = _.map(tx.logs, log => {
|
||||
const decodedLog = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(decodedLog);
|
||||
return decodedLog;
|
||||
const logWithDecodedArgs = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(logWithDecodedArgs);
|
||||
return logWithDecodedArgs;
|
||||
});
|
||||
return tx;
|
||||
}
|
||||
@@ -153,9 +153,9 @@ export class ExchangeWrapper {
|
||||
const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
|
||||
tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
|
||||
tx.logs = _.map(tx.logs, log => {
|
||||
const decodedLog = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(decodedLog);
|
||||
return decodedLog;
|
||||
const logWithDecodedArgs = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(logWithDecodedArgs);
|
||||
return logWithDecodedArgs;
|
||||
});
|
||||
return tx;
|
||||
}
|
||||
@@ -174,9 +174,9 @@ export class ExchangeWrapper {
|
||||
const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
|
||||
tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
|
||||
tx.logs = _.map(tx.logs, log => {
|
||||
const decodedLog = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(decodedLog);
|
||||
return decodedLog;
|
||||
const logWithDecodedArgs = this._logDecoder.tryToDecodeLogOrNoop(log);
|
||||
wrapLogBigNumbers(logWithDecodedArgs);
|
||||
return logWithDecodedArgs;
|
||||
});
|
||||
return tx;
|
||||
}
|
||||
|
||||
@@ -8,17 +8,17 @@ import { Artifact } from './types';
|
||||
|
||||
export class LogDecoder {
|
||||
private _abiDecoder: AbiDecoder;
|
||||
constructor(networkId: number) {
|
||||
if (_.isUndefined(networkId)) {
|
||||
constructor(networkIdIfExists?: number) {
|
||||
if (_.isUndefined(networkIdIfExists)) {
|
||||
throw new Error('networkId not specified');
|
||||
}
|
||||
const abiArrays: Web3.AbiDefinition[][] = [];
|
||||
_.forEach(artifacts, (artifact: Artifact) => {
|
||||
const network = artifact.networks[networkId];
|
||||
if (_.isUndefined(network)) {
|
||||
throw new Error(`Artifact does not exist on network ${networkId}`);
|
||||
const networkIfExists = artifact.networks[networkIdIfExists];
|
||||
if (_.isUndefined(networkIfExists)) {
|
||||
throw new Error(`Artifact does not exist on network ${networkIdIfExists}`);
|
||||
}
|
||||
abiArrays.push(network.abi);
|
||||
abiArrays.push(networkIfExists.abi);
|
||||
});
|
||||
this._abiDecoder = new AbiDecoder(abiArrays);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user