Merge branch 'development' into refactor/website
* development: Introduce an identityCommandBuilder Define types for methodID Define types for ethereumjs-abi Install types for yargs Fix comments Fix linter issues Fix linter error Rename SubscriptionOpts to BlockRange
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
v0.28.0 - _TBD_
|
v0.x.x - _TBD, 2017_
|
||||||
------------------------
|
------------------------
|
||||||
* Add `etherTokenAddress` arg to `depositAsync` and `withdrawAsync` methods on `zeroEx.etherToken` (#267)
|
* Add `etherTokenAddress` arg to `depositAsync` and `withdrawAsync` methods on `zeroEx.etherToken` (#267)
|
||||||
* Removed accidentally included `unsubscribeAll` method from `zeroEx.proxy`, `zeroEx.etherToken` and `zeroEx.tokenRegistry` (#267)
|
* Removed accidentally included `unsubscribeAll` method from `zeroEx.proxy`, `zeroEx.etherToken` and `zeroEx.tokenRegistry` (#267)
|
||||||
* Removed `etherTokenContractAddress` from `ZeroEx` constructor arg `ZeroExConfig` (#267)
|
* Removed `etherTokenContractAddress` from `ZeroEx` constructor arg `ZeroExConfig` (#267)
|
||||||
|
* Rename `SubscriptionOpts` to `BlockRange` (#272)
|
||||||
|
|
||||||
v0.27.1 - _November 28, 2017_
|
v0.27.1 - _November 28, 2017_
|
||||||
------------------------
|
------------------------
|
||||||
|
@@ -7,6 +7,7 @@ import * as Web3 from 'web3';
|
|||||||
import {
|
import {
|
||||||
Artifact,
|
Artifact,
|
||||||
BlockParamLiteral,
|
BlockParamLiteral,
|
||||||
|
BlockRange,
|
||||||
ContractEventArgs,
|
ContractEventArgs,
|
||||||
ContractEvents,
|
ContractEvents,
|
||||||
EventCallback,
|
EventCallback,
|
||||||
@@ -14,7 +15,6 @@ import {
|
|||||||
InternalZeroExError,
|
InternalZeroExError,
|
||||||
LogWithDecodedArgs,
|
LogWithDecodedArgs,
|
||||||
RawLog,
|
RawLog,
|
||||||
SubscriptionOpts,
|
|
||||||
ZeroExError,
|
ZeroExError,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import {AbiDecoder} from '../utils/abi_decoder';
|
import {AbiDecoder} from '../utils/abi_decoder';
|
||||||
@@ -83,9 +83,9 @@ export class ContractWrapper {
|
|||||||
return filterToken;
|
return filterToken;
|
||||||
}
|
}
|
||||||
protected async _getLogsAsync<ArgsType extends ContractEventArgs>(
|
protected async _getLogsAsync<ArgsType extends ContractEventArgs>(
|
||||||
address: string, eventName: ContractEvents, subscriptionOpts: SubscriptionOpts,
|
address: string, eventName: ContractEvents, blockRange: BlockRange,
|
||||||
indexFilterValues: IndexedFilterValues, abi: Web3.ContractAbi): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
|
indexFilterValues: IndexedFilterValues, abi: Web3.ContractAbi): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
|
||||||
const filter = filterUtils.getFilter(address, eventName, indexFilterValues, abi, subscriptionOpts);
|
const filter = filterUtils.getFilter(address, eventName, indexFilterValues, abi, blockRange);
|
||||||
const logs = await this._web3Wrapper.getLogsAsync(filter);
|
const logs = await this._web3Wrapper.getLogsAsync(filter);
|
||||||
const logsWithDecodedArguments = _.map(logs, this._tryToDecodeLogOrNoop.bind(this));
|
const logsWithDecodedArguments = _.map(logs, this._tryToDecodeLogOrNoop.bind(this));
|
||||||
return logsWithDecodedArguments;
|
return logsWithDecodedArguments;
|
||||||
|
@@ -7,6 +7,7 @@ import * as Web3 from 'web3';
|
|||||||
import {artifacts} from '../artifacts';
|
import {artifacts} from '../artifacts';
|
||||||
import {
|
import {
|
||||||
BlockParamLiteral,
|
BlockParamLiteral,
|
||||||
|
BlockRange,
|
||||||
DecodedLogArgs,
|
DecodedLogArgs,
|
||||||
ECSignature,
|
ECSignature,
|
||||||
EventCallback,
|
EventCallback,
|
||||||
@@ -25,7 +26,6 @@ import {
|
|||||||
OrderTransactionOpts,
|
OrderTransactionOpts,
|
||||||
OrderValues,
|
OrderValues,
|
||||||
SignedOrder,
|
SignedOrder,
|
||||||
SubscriptionOpts,
|
|
||||||
ValidateOrderFillableOpts,
|
ValidateOrderFillableOpts,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import {AbiDecoder} from '../utils/abi_decoder';
|
import {AbiDecoder} from '../utils/abi_decoder';
|
||||||
@@ -616,20 +616,20 @@ export class ExchangeWrapper extends ContractWrapper {
|
|||||||
/**
|
/**
|
||||||
* Gets historical logs without creating a subscription
|
* Gets historical logs without creating a subscription
|
||||||
* @param eventName The exchange contract event you would like to subscribe to.
|
* @param eventName The exchange contract event you would like to subscribe to.
|
||||||
* @param subscriptionOpts Subscriptions options that let you configure the subscription.
|
* @param blockRange Block range to get logs from.
|
||||||
* @param indexFilterValues An object where the keys are indexed args returned by the event and
|
* @param indexFilterValues An object where the keys are indexed args returned by the event and
|
||||||
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
|
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
|
||||||
* @return Array of logs that match the parameters
|
* @return Array of logs that match the parameters
|
||||||
*/
|
*/
|
||||||
public async getLogsAsync<ArgsType extends ExchangeContractEventArgs>(
|
public async getLogsAsync<ArgsType extends ExchangeContractEventArgs>(
|
||||||
eventName: ExchangeEvents, subscriptionOpts: SubscriptionOpts, indexFilterValues: IndexedFilterValues,
|
eventName: ExchangeEvents, blockRange: BlockRange, indexFilterValues: IndexedFilterValues,
|
||||||
): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
|
): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
|
||||||
assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents);
|
assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents);
|
||||||
assert.doesConformToSchema('subscriptionOpts', subscriptionOpts, schemas.subscriptionOptsSchema);
|
assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema);
|
||||||
assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema);
|
assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema);
|
||||||
const exchangeContractAddress = this.getContractAddress();
|
const exchangeContractAddress = this.getContractAddress();
|
||||||
const logs = await this._getLogsAsync<ArgsType>(
|
const logs = await this._getLogsAsync<ArgsType>(
|
||||||
exchangeContractAddress, eventName, subscriptionOpts, indexFilterValues, artifacts.ExchangeArtifact.abi,
|
exchangeContractAddress, eventName, blockRange, indexFilterValues, artifacts.ExchangeArtifact.abi,
|
||||||
);
|
);
|
||||||
return logs;
|
return logs;
|
||||||
}
|
}
|
||||||
|
@@ -5,11 +5,11 @@ import * as _ from 'lodash';
|
|||||||
|
|
||||||
import {artifacts} from '../artifacts';
|
import {artifacts} from '../artifacts';
|
||||||
import {
|
import {
|
||||||
|
BlockRange,
|
||||||
EventCallback,
|
EventCallback,
|
||||||
IndexedFilterValues,
|
IndexedFilterValues,
|
||||||
LogWithDecodedArgs,
|
LogWithDecodedArgs,
|
||||||
MethodOpts,
|
MethodOpts,
|
||||||
SubscriptionOpts,
|
|
||||||
TokenContractEventArgs,
|
TokenContractEventArgs,
|
||||||
TokenEvents,
|
TokenEvents,
|
||||||
TransactionOpts,
|
TransactionOpts,
|
||||||
@@ -291,20 +291,20 @@ export class TokenWrapper extends ContractWrapper {
|
|||||||
* Gets historical logs without creating a subscription
|
* Gets historical logs without creating a subscription
|
||||||
* @param tokenAddress An address of the token that emmited the logs.
|
* @param tokenAddress An address of the token that emmited the logs.
|
||||||
* @param eventName The token contract event you would like to subscribe to.
|
* @param eventName The token contract event you would like to subscribe to.
|
||||||
* @param subscriptionOpts Subscriptions options that let you configure the subscription.
|
* @param blockRange Block range to get logs from.
|
||||||
* @param indexFilterValues An object where the keys are indexed args returned by the event and
|
* @param indexFilterValues An object where the keys are indexed args returned by the event and
|
||||||
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
|
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
|
||||||
* @return Array of logs that match the parameters
|
* @return Array of logs that match the parameters
|
||||||
*/
|
*/
|
||||||
public async getLogsAsync<ArgsType extends TokenContractEventArgs>(
|
public async getLogsAsync<ArgsType extends TokenContractEventArgs>(
|
||||||
tokenAddress: string, eventName: TokenEvents, subscriptionOpts: SubscriptionOpts,
|
tokenAddress: string, eventName: TokenEvents, blockRange: BlockRange,
|
||||||
indexFilterValues: IndexedFilterValues): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
|
indexFilterValues: IndexedFilterValues): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
|
||||||
assert.isETHAddressHex('tokenAddress', tokenAddress);
|
assert.isETHAddressHex('tokenAddress', tokenAddress);
|
||||||
assert.doesBelongToStringEnum('eventName', eventName, TokenEvents);
|
assert.doesBelongToStringEnum('eventName', eventName, TokenEvents);
|
||||||
assert.doesConformToSchema('subscriptionOpts', subscriptionOpts, schemas.subscriptionOptsSchema);
|
assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema);
|
||||||
assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema);
|
assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema);
|
||||||
const logs = await this._getLogsAsync<ArgsType>(
|
const logs = await this._getLogsAsync<ArgsType>(
|
||||||
tokenAddress, eventName, subscriptionOpts, indexFilterValues, artifacts.TokenArtifact.abi,
|
tokenAddress, eventName, blockRange, indexFilterValues, artifacts.TokenArtifact.abi,
|
||||||
);
|
);
|
||||||
return logs;
|
return logs;
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ export {
|
|||||||
ExchangeEvents,
|
ExchangeEvents,
|
||||||
TokenEvents,
|
TokenEvents,
|
||||||
IndexedFilterValues,
|
IndexedFilterValues,
|
||||||
SubscriptionOpts,
|
BlockRange,
|
||||||
BlockParam,
|
BlockParam,
|
||||||
OrderCancellationRequest,
|
OrderCancellationRequest,
|
||||||
OrderFillRequest,
|
OrderFillRequest,
|
||||||
|
@@ -217,7 +217,7 @@ export enum BlockParamLiteral {
|
|||||||
|
|
||||||
export type BlockParam = BlockParamLiteral|number;
|
export type BlockParam = BlockParamLiteral|number;
|
||||||
|
|
||||||
export interface SubscriptionOpts {
|
export interface BlockRange {
|
||||||
fromBlock: BlockParam;
|
fromBlock: BlockParam;
|
||||||
toBlock: BlockParam;
|
toBlock: BlockParam;
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@ import * as _ from 'lodash';
|
|||||||
import * as uuid from 'uuid/v4';
|
import * as uuid from 'uuid/v4';
|
||||||
import * as Web3 from 'web3';
|
import * as Web3 from 'web3';
|
||||||
|
|
||||||
import {ContractEvents, IndexedFilterValues, SubscriptionOpts} from '../types';
|
import {BlockRange, ContractEvents, IndexedFilterValues} from '../types';
|
||||||
|
|
||||||
const TOPIC_LENGTH = 32;
|
const TOPIC_LENGTH = 32;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ export const filterUtils = {
|
|||||||
},
|
},
|
||||||
getFilter(address: string, eventName: ContractEvents,
|
getFilter(address: string, eventName: ContractEvents,
|
||||||
indexFilterValues: IndexedFilterValues, abi: Web3.ContractAbi,
|
indexFilterValues: IndexedFilterValues, abi: Web3.ContractAbi,
|
||||||
subscriptionOpts?: SubscriptionOpts): Web3.FilterObject {
|
blockRange?: BlockRange): Web3.FilterObject {
|
||||||
const eventAbi = _.find(abi, {name: eventName}) as Web3.EventAbi;
|
const eventAbi = _.find(abi, {name: eventName}) as Web3.EventAbi;
|
||||||
const eventSignature = filterUtils.getEventSignatureFromAbiByName(eventAbi, eventName);
|
const eventSignature = filterUtils.getEventSignatureFromAbiByName(eventAbi, eventName);
|
||||||
const topicForEventSignature = ethUtil.addHexPrefix(jsSHA3.keccak256(eventSignature));
|
const topicForEventSignature = ethUtil.addHexPrefix(jsSHA3.keccak256(eventSignature));
|
||||||
@@ -24,9 +24,9 @@ export const filterUtils = {
|
|||||||
address,
|
address,
|
||||||
topics,
|
topics,
|
||||||
};
|
};
|
||||||
if (!_.isUndefined(subscriptionOpts)) {
|
if (!_.isUndefined(blockRange)) {
|
||||||
filter = {
|
filter = {
|
||||||
...subscriptionOpts,
|
...blockRange,
|
||||||
...filter,
|
...filter,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import 'mocha';
|
|||||||
import * as Web3 from 'web3';
|
import * as Web3 from 'web3';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
BlockRange,
|
||||||
DecodedLogEvent,
|
DecodedLogEvent,
|
||||||
ExchangeContractErrs,
|
ExchangeContractErrs,
|
||||||
ExchangeEvents,
|
ExchangeEvents,
|
||||||
@@ -13,7 +14,6 @@ import {
|
|||||||
OrderCancellationRequest,
|
OrderCancellationRequest,
|
||||||
OrderFillRequest,
|
OrderFillRequest,
|
||||||
SignedOrder,
|
SignedOrder,
|
||||||
SubscriptionOpts,
|
|
||||||
Token,
|
Token,
|
||||||
ZeroEx,
|
ZeroEx,
|
||||||
} from '../src';
|
} from '../src';
|
||||||
@@ -760,7 +760,7 @@ describe('ExchangeWrapper', () => {
|
|||||||
let takerAddress: string;
|
let takerAddress: string;
|
||||||
const fillableAmount = new BigNumber(5);
|
const fillableAmount = new BigNumber(5);
|
||||||
const shouldThrowOnInsufficientBalanceOrAllowance = true;
|
const shouldThrowOnInsufficientBalanceOrAllowance = true;
|
||||||
const subscriptionOpts: SubscriptionOpts = {
|
const blockRange: BlockRange = {
|
||||||
fromBlock: 0,
|
fromBlock: 0,
|
||||||
toBlock: BlockParamLiteral.Latest,
|
toBlock: BlockParamLiteral.Latest,
|
||||||
};
|
};
|
||||||
@@ -781,7 +781,7 @@ describe('ExchangeWrapper', () => {
|
|||||||
await zeroEx.awaitTransactionMinedAsync(txHash);
|
await zeroEx.awaitTransactionMinedAsync(txHash);
|
||||||
const eventName = ExchangeEvents.LogFill;
|
const eventName = ExchangeEvents.LogFill;
|
||||||
const indexFilterValues = {};
|
const indexFilterValues = {};
|
||||||
const logs = await zeroEx.exchange.getLogsAsync(eventName, subscriptionOpts, indexFilterValues);
|
const logs = await zeroEx.exchange.getLogsAsync(eventName, blockRange, indexFilterValues);
|
||||||
expect(logs).to.have.length(1);
|
expect(logs).to.have.length(1);
|
||||||
expect(logs[0].event).to.be.equal(eventName);
|
expect(logs[0].event).to.be.equal(eventName);
|
||||||
});
|
});
|
||||||
@@ -795,7 +795,7 @@ describe('ExchangeWrapper', () => {
|
|||||||
await zeroEx.awaitTransactionMinedAsync(txHash);
|
await zeroEx.awaitTransactionMinedAsync(txHash);
|
||||||
const differentEventName = ExchangeEvents.LogCancel;
|
const differentEventName = ExchangeEvents.LogCancel;
|
||||||
const indexFilterValues = {};
|
const indexFilterValues = {};
|
||||||
const logs = await zeroEx.exchange.getLogsAsync(differentEventName, subscriptionOpts, indexFilterValues);
|
const logs = await zeroEx.exchange.getLogsAsync(differentEventName, blockRange, indexFilterValues);
|
||||||
expect(logs).to.have.length(0);
|
expect(logs).to.have.length(0);
|
||||||
});
|
});
|
||||||
it('should only get the logs with the correct indexed fields', async () => {
|
it('should only get the logs with the correct indexed fields', async () => {
|
||||||
@@ -821,7 +821,7 @@ describe('ExchangeWrapper', () => {
|
|||||||
maker: differentMakerAddress,
|
maker: differentMakerAddress,
|
||||||
};
|
};
|
||||||
const logs = await zeroEx.exchange.getLogsAsync<LogFillContractEventArgs>(
|
const logs = await zeroEx.exchange.getLogsAsync<LogFillContractEventArgs>(
|
||||||
eventName, subscriptionOpts, indexFilterValues,
|
eventName, blockRange, indexFilterValues,
|
||||||
);
|
);
|
||||||
expect(logs).to.have.length(1);
|
expect(logs).to.have.length(1);
|
||||||
const args = logs[0].args;
|
const args = logs[0].args;
|
||||||
|
@@ -7,8 +7,8 @@ import * as Web3 from 'web3';
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
ApprovalContractEventArgs,
|
ApprovalContractEventArgs,
|
||||||
|
BlockRange,
|
||||||
DecodedLogEvent,
|
DecodedLogEvent,
|
||||||
SubscriptionOpts,
|
|
||||||
Token,
|
Token,
|
||||||
TokenEvents,
|
TokenEvents,
|
||||||
TransferContractEventArgs,
|
TransferContractEventArgs,
|
||||||
@@ -433,7 +433,7 @@ describe('TokenWrapper', () => {
|
|||||||
describe('#getLogsAsync', () => {
|
describe('#getLogsAsync', () => {
|
||||||
let tokenAddress: string;
|
let tokenAddress: string;
|
||||||
let tokenTransferProxyAddress: string;
|
let tokenTransferProxyAddress: string;
|
||||||
const subscriptionOpts: SubscriptionOpts = {
|
const blockRange: BlockRange = {
|
||||||
fromBlock: 0,
|
fromBlock: 0,
|
||||||
toBlock: BlockParamLiteral.Latest,
|
toBlock: BlockParamLiteral.Latest,
|
||||||
};
|
};
|
||||||
@@ -449,7 +449,7 @@ describe('TokenWrapper', () => {
|
|||||||
const eventName = TokenEvents.Approval;
|
const eventName = TokenEvents.Approval;
|
||||||
const indexFilterValues = {};
|
const indexFilterValues = {};
|
||||||
const logs = await zeroEx.token.getLogsAsync<ApprovalContractEventArgs>(
|
const logs = await zeroEx.token.getLogsAsync<ApprovalContractEventArgs>(
|
||||||
tokenAddress, eventName, subscriptionOpts, indexFilterValues,
|
tokenAddress, eventName, blockRange, indexFilterValues,
|
||||||
);
|
);
|
||||||
expect(logs).to.have.length(1);
|
expect(logs).to.have.length(1);
|
||||||
const args = logs[0].args;
|
const args = logs[0].args;
|
||||||
@@ -464,7 +464,7 @@ describe('TokenWrapper', () => {
|
|||||||
const differentEventName = TokenEvents.Transfer;
|
const differentEventName = TokenEvents.Transfer;
|
||||||
const indexFilterValues = {};
|
const indexFilterValues = {};
|
||||||
const logs = await zeroEx.token.getLogsAsync(
|
const logs = await zeroEx.token.getLogsAsync(
|
||||||
tokenAddress, differentEventName, subscriptionOpts, indexFilterValues,
|
tokenAddress, differentEventName, blockRange, indexFilterValues,
|
||||||
);
|
);
|
||||||
expect(logs).to.have.length(0);
|
expect(logs).to.have.length(0);
|
||||||
});
|
});
|
||||||
@@ -478,7 +478,7 @@ describe('TokenWrapper', () => {
|
|||||||
_owner: coinbase,
|
_owner: coinbase,
|
||||||
};
|
};
|
||||||
const logs = await zeroEx.token.getLogsAsync<ApprovalContractEventArgs>(
|
const logs = await zeroEx.token.getLogsAsync<ApprovalContractEventArgs>(
|
||||||
tokenAddress, eventName, subscriptionOpts, indexFilterValues,
|
tokenAddress, eventName, blockRange, indexFilterValues,
|
||||||
);
|
);
|
||||||
expect(logs).to.have.length(1);
|
expect(logs).to.have.length(1);
|
||||||
const args = logs[0].args;
|
const args = logs[0].args;
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
"@types/handlebars": "^4.0.36",
|
"@types/handlebars": "^4.0.36",
|
||||||
"@types/mkdirp": "^0.5.1",
|
"@types/mkdirp": "^0.5.1",
|
||||||
"@types/node": "^8.0.53",
|
"@types/node": "^8.0.53",
|
||||||
"@types/yargs": "^8.0.2",
|
"@types/yargs": "^10.0.0",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
"shx": "^0.2.2",
|
"shx": "^0.2.2",
|
||||||
"tslint": "5.8.0",
|
"tslint": "5.8.0",
|
||||||
|
@@ -23,12 +23,12 @@ const DEFAULT_GAS_PRICE = ((10 ** 9) * 2).toString();
|
|||||||
* Compiles all contracts with options passed in through CLI.
|
* Compiles all contracts with options passed in through CLI.
|
||||||
* @param argv Instance of process.argv provided by yargs.
|
* @param argv Instance of process.argv provided by yargs.
|
||||||
*/
|
*/
|
||||||
async function onCompileCommand(args: CliOptions): Promise<void> {
|
async function onCompileCommand(argv: CliOptions): Promise<void> {
|
||||||
const opts: CompilerOptions = {
|
const opts: CompilerOptions = {
|
||||||
contractsDir: args.contractsDir,
|
contractsDir: argv.contractsDir,
|
||||||
networkId: args.networkId,
|
networkId: argv.networkId,
|
||||||
optimizerEnabled: args.shouldOptimize ? 1 : 0,
|
optimizerEnabled: argv.shouldOptimize ? 1 : 0,
|
||||||
artifactsDir: args.artifactsDir,
|
artifactsDir: argv.artifactsDir,
|
||||||
};
|
};
|
||||||
await commands.compileAsync(opts);
|
await commands.compileAsync(opts);
|
||||||
}
|
}
|
||||||
@@ -113,6 +113,7 @@ function deployCommandBuilder(yargsInstance: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
|
const identityCommandBuilder = _.identity;
|
||||||
return yargs
|
return yargs
|
||||||
.option('contracts-dir', {
|
.option('contracts-dir', {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
@@ -150,11 +151,11 @@ function deployCommandBuilder(yargsInstance: any) {
|
|||||||
})
|
})
|
||||||
.command('compile',
|
.command('compile',
|
||||||
'compile contracts',
|
'compile contracts',
|
||||||
_.noop,
|
identityCommandBuilder,
|
||||||
onCompileCommand)
|
onCompileCommand)
|
||||||
.command('migrate',
|
.command('migrate',
|
||||||
'compile and deploy contracts using migration scripts',
|
'compile and deploy contracts using migration scripts',
|
||||||
_.noop,
|
identityCommandBuilder,
|
||||||
onMigrateCommand)
|
onMigrateCommand)
|
||||||
.command('deploy',
|
.command('deploy',
|
||||||
'deploy a single contract with provided arguments',
|
'deploy a single contract with provided arguments',
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import {TxData} from '@0xproject/types';
|
import {TxData} from '@0xproject/types';
|
||||||
import * as Web3 from 'web3';
|
import * as Web3 from 'web3';
|
||||||
|
import * as yargs from 'yargs';
|
||||||
|
|
||||||
export enum AbiType {
|
export enum AbiType {
|
||||||
Function = 'function',
|
Function = 'function',
|
||||||
@@ -32,7 +33,7 @@ export interface SolcErrors {
|
|||||||
[key: string]: boolean;
|
[key: string]: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CliOptions {
|
export interface CliOptions extends yargs.Arguments {
|
||||||
artifactsDir: string;
|
artifactsDir: string;
|
||||||
contractsDir: string;
|
contractsDir: string;
|
||||||
jsonrpcPort: number;
|
jsonrpcPort: number;
|
||||||
|
8
packages/contracts/globals.d.ts
vendored
8
packages/contracts/globals.d.ts
vendored
@@ -1,8 +1,5 @@
|
|||||||
declare module 'bn.js';
|
|
||||||
declare module 'ethereumjs-abi';
|
|
||||||
declare module 'chai-bignumber';
|
declare module 'chai-bignumber';
|
||||||
declare module 'dirty-chai';
|
declare module 'dirty-chai';
|
||||||
declare module 'yargs';
|
|
||||||
|
|
||||||
// HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion
|
// HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion
|
||||||
// interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise
|
// interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise
|
||||||
@@ -31,6 +28,11 @@ declare module 'web3-eth-abi' {
|
|||||||
export function encodeParameters(typesArray: string[], parameters: any[]): string;
|
export function encodeParameters(typesArray: string[], parameters: any[]): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module 'ethereumjs-abi' {
|
||||||
|
const soliditySHA3: (argTypes: string[], args: any[]) => Buffer;
|
||||||
|
const methodID: (name: string, types: string[]) => Buffer;
|
||||||
|
}
|
||||||
|
|
||||||
// Truffle injects the following into the global scope
|
// Truffle injects the following into the global scope
|
||||||
declare var artifacts: any;
|
declare var artifacts: any;
|
||||||
declare var contract: any;
|
declare var contract: any;
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
"@types/lodash": "^4.14.86",
|
"@types/lodash": "^4.14.86",
|
||||||
"@types/node": "^8.0.53",
|
"@types/node": "^8.0.53",
|
||||||
"@types/request-promise-native": "^1.0.2",
|
"@types/request-promise-native": "^1.0.2",
|
||||||
"@types/yargs": "^8.0.2",
|
"@types/yargs": "^10.0.0",
|
||||||
"chai": "^4.0.1",
|
"chai": "^4.0.1",
|
||||||
"chai-as-promised": "^7.1.0",
|
"chai-as-promised": "^7.1.0",
|
||||||
"chai-as-promised-typescript-typings": "^0.0.3",
|
"chai-as-promised-typescript-typings": "^0.0.3",
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
v0.x.x - _TBD, 2017_
|
||||||
|
------------------------
|
||||||
|
* Rename `subscriptionOptsSchema` to `blockRangeSchema` (#272)
|
||||||
|
|
||||||
v0.6.7 - _Nov. 14, 2017_
|
v0.6.7 - _Nov. 14, 2017_
|
||||||
------------------------
|
------------------------
|
||||||
* Re-publish JSON-schema previously published under NPM package 0x-json-schemas
|
* Re-publish JSON-schema previously published under NPM package 0x-json-schemas
|
||||||
|
@@ -10,8 +10,8 @@ export const blockParamSchema = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const subscriptionOptsSchema = {
|
export const blockRangeSchema = {
|
||||||
id: '/SubscriptionOpts',
|
id: '/BlockRange',
|
||||||
properties: {
|
properties: {
|
||||||
fromBlock: {$ref: '/BlockParam'},
|
fromBlock: {$ref: '/BlockParam'},
|
||||||
toBlock: {$ref: '/BlockParam'},
|
toBlock: {$ref: '/BlockParam'},
|
@@ -2,6 +2,10 @@ import {
|
|||||||
addressSchema,
|
addressSchema,
|
||||||
numberSchema,
|
numberSchema,
|
||||||
} from '../schemas/basic_type_schemas';
|
} from '../schemas/basic_type_schemas';
|
||||||
|
import {
|
||||||
|
blockParamSchema,
|
||||||
|
blockRangeSchema,
|
||||||
|
} from '../schemas/block_range_schema';
|
||||||
import {
|
import {
|
||||||
ecSignatureParameterSchema,
|
ecSignatureParameterSchema,
|
||||||
ecSignatureSchema,
|
ecSignatureSchema,
|
||||||
@@ -55,10 +59,6 @@ import {
|
|||||||
import {
|
import {
|
||||||
signedOrdersSchema,
|
signedOrdersSchema,
|
||||||
} from '../schemas/signed_orders_schema';
|
} from '../schemas/signed_orders_schema';
|
||||||
import {
|
|
||||||
blockParamSchema,
|
|
||||||
subscriptionOptsSchema,
|
|
||||||
} from '../schemas/subscription_opts_schema';
|
|
||||||
import {
|
import {
|
||||||
tokenSchema,
|
tokenSchema,
|
||||||
} from '../schemas/token_schema';
|
} from '../schemas/token_schema';
|
||||||
@@ -81,7 +81,7 @@ export const schemas = {
|
|||||||
signedOrderSchema,
|
signedOrderSchema,
|
||||||
signedOrdersSchema,
|
signedOrdersSchema,
|
||||||
blockParamSchema,
|
blockParamSchema,
|
||||||
subscriptionOptsSchema,
|
blockRangeSchema,
|
||||||
tokenSchema,
|
tokenSchema,
|
||||||
jsNumber,
|
jsNumber,
|
||||||
txDataSchema,
|
txDataSchema,
|
||||||
|
@@ -23,7 +23,7 @@ const {
|
|||||||
signedOrderSchema,
|
signedOrderSchema,
|
||||||
signedOrdersSchema,
|
signedOrdersSchema,
|
||||||
blockParamSchema,
|
blockParamSchema,
|
||||||
subscriptionOptsSchema,
|
blockRangeSchema,
|
||||||
tokenSchema,
|
tokenSchema,
|
||||||
jsNumber,
|
jsNumber,
|
||||||
txDataSchema,
|
txDataSchema,
|
||||||
@@ -170,21 +170,21 @@ describe('Schema', () => {
|
|||||||
validateAgainstSchema(testCases, blockParamSchema, shouldFail);
|
validateAgainstSchema(testCases, blockParamSchema, shouldFail);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('#subscriptionOptsSchema', () => {
|
describe('#blockRangeSchema', () => {
|
||||||
it('should validate valid subscription opts', () => {
|
it('should validate valid subscription opts', () => {
|
||||||
const testCases = [
|
const testCases = [
|
||||||
{fromBlock: 42, toBlock: 'latest'},
|
{fromBlock: 42, toBlock: 'latest'},
|
||||||
{fromBlock: 42},
|
{fromBlock: 42},
|
||||||
{},
|
{},
|
||||||
];
|
];
|
||||||
validateAgainstSchema(testCases, subscriptionOptsSchema);
|
validateAgainstSchema(testCases, blockRangeSchema);
|
||||||
});
|
});
|
||||||
it('should fail for invalid subscription opts', () => {
|
it('should fail for invalid subscription opts', () => {
|
||||||
const testCases = [
|
const testCases = [
|
||||||
{fromBlock: '42'},
|
{fromBlock: '42'},
|
||||||
];
|
];
|
||||||
const shouldFail = true;
|
const shouldFail = true;
|
||||||
validateAgainstSchema(testCases, subscriptionOptsSchema, shouldFail);
|
validateAgainstSchema(testCases, blockRangeSchema, shouldFail);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('#tokenSchema', () => {
|
describe('#tokenSchema', () => {
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
BlockParam,
|
BlockParam,
|
||||||
|
BlockRange,
|
||||||
DecodedLogEvent,
|
DecodedLogEvent,
|
||||||
ExchangeContractEventArgs,
|
ExchangeContractEventArgs,
|
||||||
ExchangeEvents,
|
ExchangeEvents,
|
||||||
@@ -9,7 +10,6 @@ import {
|
|||||||
LogWithDecodedArgs,
|
LogWithDecodedArgs,
|
||||||
Order,
|
Order,
|
||||||
SignedOrder,
|
SignedOrder,
|
||||||
SubscriptionOpts,
|
|
||||||
Token as ZeroExToken,
|
Token as ZeroExToken,
|
||||||
TransactionReceiptWithDecodedLogs,
|
TransactionReceiptWithDecodedLogs,
|
||||||
ZeroEx,
|
ZeroEx,
|
||||||
@@ -524,12 +524,12 @@ export class Blockchain {
|
|||||||
}
|
}
|
||||||
private async fetchHistoricalExchangeLogFillEventsAsync(indexFilterValues: IndexedFilterValues) {
|
private async fetchHistoricalExchangeLogFillEventsAsync(indexFilterValues: IndexedFilterValues) {
|
||||||
const fromBlock = tradeHistoryStorage.getFillsLatestBlock(this.userAddress, this.networkId);
|
const fromBlock = tradeHistoryStorage.getFillsLatestBlock(this.userAddress, this.networkId);
|
||||||
const subscriptionOpts: SubscriptionOpts = {
|
const blockRange: BlockRange = {
|
||||||
fromBlock,
|
fromBlock,
|
||||||
toBlock: 'latest' as BlockParam,
|
toBlock: 'latest' as BlockParam,
|
||||||
};
|
};
|
||||||
const decodedLogs = await this.zeroEx.exchange.getLogsAsync<LogFillContractEventArgs>(
|
const decodedLogs = await this.zeroEx.exchange.getLogsAsync<LogFillContractEventArgs>(
|
||||||
ExchangeEvents.LogFill, subscriptionOpts, indexFilterValues,
|
ExchangeEvents.LogFill, blockRange, indexFilterValues,
|
||||||
);
|
);
|
||||||
for (const decodedLog of decodedLogs) {
|
for (const decodedLog of decodedLogs) {
|
||||||
if (!this.doesLogEventInvolveUser(decodedLog)) {
|
if (!this.doesLogEventInvolveUser(decodedLog)) {
|
||||||
|
@@ -95,6 +95,7 @@ const docsInfoConfig: DocsInfoConfig = {
|
|||||||
'ExchangeEvents',
|
'ExchangeEvents',
|
||||||
'IndexedFilterValues',
|
'IndexedFilterValues',
|
||||||
'SubscriptionOpts',
|
'SubscriptionOpts',
|
||||||
|
'BlockRange',
|
||||||
'BlockParam',
|
'BlockParam',
|
||||||
'OrderFillOrKillRequest',
|
'OrderFillOrKillRequest',
|
||||||
'OrderCancellationRequest',
|
'OrderCancellationRequest',
|
||||||
|
@@ -266,6 +266,10 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@types/yargs@^10.0.0":
|
||||||
|
version "10.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-10.0.0.tgz#b93aa88155fe5106cddf3f934517411ca2a45939"
|
||||||
|
|
||||||
"@types/yargs@^8.0.2":
|
"@types/yargs@^8.0.2":
|
||||||
version "8.0.2"
|
version "8.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-8.0.2.tgz#0f9c7b236e2d78cd8f4b6502de15d0728aa29385"
|
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-8.0.2.tgz#0f9c7b236e2d78cd8f4b6502de15d0728aa29385"
|
||||||
|
Reference in New Issue
Block a user