aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-10-04 00:05:44 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-10-04 16:14:20 +0800
commit451ded4963aaaa40ff4d00bcb0d589b06b45ce24 (patch)
treed7c0a8aee987531fddf45f78c0309559acc73a33 /src
parent837618c7a016b9b66d70f3c0e9682c97a9d4cf8a (diff)
downloaddexon-sol-tools-451ded4963aaaa40ff4d00bcb0d589b06b45ce24.tar
dexon-sol-tools-451ded4963aaaa40ff4d00bcb0d589b06b45ce24.tar.gz
dexon-sol-tools-451ded4963aaaa40ff4d00bcb0d589b06b45ce24.tar.bz2
dexon-sol-tools-451ded4963aaaa40ff4d00bcb0d589b06b45ce24.tar.lz
dexon-sol-tools-451ded4963aaaa40ff4d00bcb0d589b06b45ce24.tar.xz
dexon-sol-tools-451ded4963aaaa40ff4d00bcb0d589b06b45ce24.tar.zst
dexon-sol-tools-451ded4963aaaa40ff4d00bcb0d589b06b45ce24.zip
Add tests for zeroEx.exchange.getLogsAsync
Diffstat (limited to 'src')
-rw-r--r--src/0x.ts6
-rw-r--r--src/contract_wrappers/contract_wrapper.ts2
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts8
-rw-r--r--src/contract_wrappers/token_wrapper.ts2
4 files changed, 12 insertions, 6 deletions
diff --git a/src/0x.ts b/src/0x.ts
index c187fc5c2..c5e8e0066 100644
--- a/src/0x.ts
+++ b/src/0x.ts
@@ -206,7 +206,11 @@ export class ZeroEx {
this._getTokenTransferProxyAddressAsync.bind(this),
);
const exchageContractAddressIfExists = _.isUndefined(config) ? undefined : config.exchangeContractAddress;
- this.exchange = new ExchangeWrapper(this._web3Wrapper, this.token, exchageContractAddressIfExists);
+ this.exchange = new ExchangeWrapper(
+ this._web3Wrapper,
+ this._abiDecoder,
+ this.token,
+ exchageContractAddressIfExists);
this.proxy = new TokenTransferProxyWrapper(
this._web3Wrapper,
this._getTokenTransferProxyAddressAsync.bind(this),
diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts
index 6b2517fc9..d6c7d915a 100644
--- a/src/contract_wrappers/contract_wrapper.ts
+++ b/src/contract_wrappers/contract_wrapper.ts
@@ -22,7 +22,7 @@ export class ContractWrapper {
}
protected async _getLogsAsync(address: string, eventName: ContractEvents, subscriptionOpts: SubscriptionOpts,
indexFilterValues: IndexedFilterValues,
- abi: Web3.ContractAbi): Promise<Array<LogWithDecodedArgs|RawLog>> {
+ abi: Web3.ContractAbi): Promise<LogWithDecodedArgs[]> {
// TODO include indexFilterValues in topics
const eventSignature = this._getEventSignatureFromAbiByName(abi, eventName);
const filter = {
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index 78c2f4173..b3a35d5bf 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -40,6 +40,7 @@ import {ContractWrapper} from './contract_wrapper';
import {constants} from '../utils/constants';
import {TokenWrapper} from './token_wrapper';
import {decorators} from '../utils/decorators';
+import {AbiDecoder} from '../utils/abi_decoder';
import {artifacts} from '../artifacts';
const SHOULD_VALIDATE_BY_DEFAULT = true;
@@ -80,8 +81,9 @@ export class ExchangeWrapper extends ContractWrapper {
];
return [orderAddresses, orderValues];
}
- constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper, contractAddressIfExists?: string) {
- super(web3Wrapper);
+ constructor(web3Wrapper: Web3Wrapper, abiDecoder: AbiDecoder,
+ tokenWrapper: TokenWrapper, contractAddressIfExists?: string) {
+ super(web3Wrapper, abiDecoder);
this._tokenWrapper = tokenWrapper;
this._orderValidationUtils = new OrderValidationUtils(tokenWrapper, this);
this._exchangeLogEventEmitters = [];
@@ -665,7 +667,7 @@ export class ExchangeWrapper extends ContractWrapper {
* @return Array of logs that match the parameters
*/
public async getLogsAsync(eventName: ExchangeEvents, subscriptionOpts: SubscriptionOpts,
- indexFilterValues: IndexedFilterValues): Promise<Array<LogWithDecodedArgs|RawLog>> {
+ indexFilterValues: IndexedFilterValues): Promise<LogWithDecodedArgs[]> {
const exchangeContractAddress = await this.getContractAddressAsync();
const logs = await this._getLogsAsync(
exchangeContractAddress, eventName, subscriptionOpts, indexFilterValues, artifacts.ExchangeArtifact.abi,
diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts
index 175671f74..95f5491c9 100644
--- a/src/contract_wrappers/token_wrapper.ts
+++ b/src/contract_wrappers/token_wrapper.ts
@@ -290,7 +290,7 @@ export class TokenWrapper extends ContractWrapper {
* @return Array of logs that match the parameters
*/
public async getLogsAsync(tokenAddress: string, eventName: TokenEvents, subscriptionOpts: SubscriptionOpts,
- indexFilterValues: IndexedFilterValues): Promise<Array<LogWithDecodedArgs|RawLog>> {
+ indexFilterValues: IndexedFilterValues): Promise<LogWithDecodedArgs[]> {
const logs = await this._getLogsAsync(
tokenAddress, eventName, subscriptionOpts, indexFilterValues, artifacts.TokenArtifact.abi,
);