aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-24 00:01:23 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-24 05:12:34 +0800
commite01468b49265c1cad9a4d81873584a7e89169aa1 (patch)
treee1592ae8ca9f293fb4c57f1af84e5b0f6f1cf8e4 /packages/0x.js
parentf97074dc84b5c45b9c487ee27ca7ed671bb6fd71 (diff)
downloaddexon-sol-tools-e01468b49265c1cad9a4d81873584a7e89169aa1.tar.gz
dexon-sol-tools-e01468b49265c1cad9a4d81873584a7e89169aa1.tar.zst
dexon-sol-tools-e01468b49265c1cad9a4d81873584a7e89169aa1.zip
Make DecodedLogEvent contain web3 log under a log subkey
Diffstat (limited to 'packages/0x.js')
-rw-r--r--packages/0x.js/src/contract_wrappers/contract_wrapper.ts2
-rw-r--r--packages/0x.js/src/types.ts5
-rw-r--r--packages/0x.js/test/exchange_wrapper_test.ts6
-rw-r--r--packages/0x.js/test/token_wrapper_test.ts12
4 files changed, 15 insertions, 10 deletions
diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
index 7997b1647..70548293c 100644
--- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
@@ -100,7 +100,7 @@ export class ContractWrapper {
if (filterUtils.matchesFilter(log, filter)) {
const decodedLog = this._tryToDecodeLogOrNoop(log) as LogWithDecodedArgs<ArgsType>;
const logEvent = {
- ...decodedLog,
+ log: decodedLog,
removed,
};
this._filterCallbacks[filterToken](null, logEvent);
diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts
index c3aabfd86..d94868d9f 100644
--- a/packages/0x.js/src/types.ts
+++ b/packages/0x.js/src/types.ts
@@ -40,7 +40,10 @@ export type OrderValues = [BigNumber, BigNumber, BigNumber,
BigNumber, BigNumber, BigNumber];
export type LogEvent = Web3.LogEntryEvent;
-export type DecodedLogEvent<ArgsType> = Web3.DecodedLogEntryEvent<ArgsType>;
+export interface DecodedLogEvent<ArgsType> {
+ removed: boolean;
+ log: LogWithDecodedArgs<ArgsType>;
+}
export type EventCallback<ArgsType> = (err: null|Error, log?: DecodedLogEvent<ArgsType>) => void;
export type EventWatcherCallback = (log: LogEvent) => void;
diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts
index add89a3b2..4ea17ec26 100644
--- a/packages/0x.js/test/exchange_wrapper_test.ts
+++ b/packages/0x.js/test/exchange_wrapper_test.ts
@@ -649,7 +649,7 @@ describe('ExchangeWrapper', () => {
(async () => {
const callback = (err: Error, logEvent: DecodedLogEvent<LogFillContractEventArgs>) => {
- expect(logEvent.event).to.be.equal(ExchangeEvents.LogFill);
+ expect(logEvent.log.event).to.be.equal(ExchangeEvents.LogFill);
done();
};
await zeroEx.exchange.subscribeAsync(
@@ -665,7 +665,7 @@ describe('ExchangeWrapper', () => {
(async () => {
const callback = (err: Error, logEvent: DecodedLogEvent<LogCancelContractEventArgs>) => {
- expect(logEvent.event).to.be.equal(ExchangeEvents.LogCancel);
+ expect(logEvent.log.event).to.be.equal(ExchangeEvents.LogCancel);
done();
};
await zeroEx.exchange.subscribeAsync(
@@ -688,7 +688,7 @@ describe('ExchangeWrapper', () => {
await zeroEx.setProviderAsync(newProvider);
const callback = (err: Error, logEvent: DecodedLogEvent<LogFillContractEventArgs>) => {
- expect(logEvent.event).to.be.equal(ExchangeEvents.LogFill);
+ expect(logEvent.log.event).to.be.equal(ExchangeEvents.LogFill);
done();
};
await zeroEx.exchange.subscribeAsync(
diff --git a/packages/0x.js/test/token_wrapper_test.ts b/packages/0x.js/test/token_wrapper_test.ts
index 1a7cb9e40..d44bf603c 100644
--- a/packages/0x.js/test/token_wrapper_test.ts
+++ b/packages/0x.js/test/token_wrapper_test.ts
@@ -361,10 +361,11 @@ describe('TokenWrapper', () => {
(async () => {
const callback = (err: Error, logEvent: DecodedLogEvent<TransferContractEventArgs>) => {
expect(logEvent).to.not.be.undefined();
- expect(logEvent.logIndex).to.be.equal(0);
- expect(logEvent.transactionIndex).to.be.equal(0);
- expect(logEvent.blockNumber).to.be.a('number');
- const args = logEvent.args;
+ expect(logEvent.removed).to.be.false();
+ expect(logEvent.log.logIndex).to.be.equal(0);
+ expect(logEvent.log.transactionIndex).to.be.equal(0);
+ expect(logEvent.log.blockNumber).to.be.a('number');
+ const args = logEvent.log.args;
expect(args._from).to.be.equal(coinbase);
expect(args._to).to.be.equal(addressWithoutFunds);
expect(args._value).to.be.bignumber.equal(transferAmount);
@@ -379,7 +380,8 @@ describe('TokenWrapper', () => {
(async () => {
const callback = (err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
expect(logEvent).to.not.be.undefined();
- const args = logEvent.args;
+ expect(logEvent.removed).to.be.false();
+ const args = logEvent.log.args;
expect(args._owner).to.be.equal(coinbase);
expect(args._spender).to.be.equal(addressWithoutFunds);
expect(args._value).to.be.bignumber.equal(allowanceAmount);